fix the normal matrix calculation and view matrix check to send the matrix when it... 04/24104/1
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Mon, 7 Jul 2014 17:17:52 +0000 (18:17 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 13:19:39 +0000 (14:19 +0100)
Change-Id: I1afc0383fc0a2712a0121328c8081f37418a6460
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
dali/internal/render/renderers/scene-graph-renderer.cpp

index 7f52d95..25186fd 100644 (file)
@@ -35,7 +35,7 @@ namespace Internal
 namespace
 {
 static Matrix gModelViewProjectionMatrix( false ); ///< a shared matrix to calculate the MVP matrix, dont want to store it locally to reduce storage overhead
-static Matrix gNormalMatrix( false ); ///< a shared matrix to calculate normal matrix, dont want to store it locally to reduce storage overhead
+static Matrix3 gNormalMatrix; ///< a shared matrix to calculate normal matrix, dont want to store it locally to reduce storage overhead
 
 /**
  * Helper to set view and projection matrices once per program
@@ -61,7 +61,7 @@ inline void SetMatrices( Program& program,
   loc = program.GetUniformLocation( Program::UNIFORM_VIEW_MATRIX );
   if( Program::UNIFORM_UNKNOWN != loc )
   {
-    if( program.GetViewMatrix() == &viewMatrix )
+    if( program.GetViewMatrix() != &viewMatrix )
     {
       program.SetViewMatrix( &viewMatrix );
       program.SetUniformMatrix4fv( loc, 1, viewMatrix.AsFloat() );
@@ -92,7 +92,7 @@ inline void SetMatrices( Program& program,
   loc = program.GetUniformLocation( Program::UNIFORM_NORMAL_MATRIX );
   if( Program::UNIFORM_UNKNOWN != loc )
   {
-    gNormalMatrix = modelMatrix;
+    gNormalMatrix = modelViewMatrix;
     gNormalMatrix.Invert();
     gNormalMatrix.Transpose();
     program.SetUniformMatrix3fv( loc, 1, gNormalMatrix.AsFloat() );