Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/gameengine/Ketsji/BL_Shader.cpp')
-rw-r--r--source/gameengine/Ketsji/BL_Shader.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index 57d0fe4140f..f28d3fa2912 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -433,7 +433,7 @@ void BL_Shader::SetProg(bool enable)
}
}
-void BL_Shader::Update( const KX_MeshSlot & ms, RAS_IRasterizer* rasty )
+void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
{
if(!Ok() || !mPreDef.size())
return;
@@ -445,8 +445,7 @@ void BL_Shader::Update( const KX_MeshSlot & ms, RAS_IRasterizer* rasty )
{
MT_Matrix4x4 model;
model.setValue(ms.m_OpenGLMatrix);
- MT_Matrix4x4 view;
- rasty->GetViewMatrix(view);
+ const MT_Matrix4x4& view = rasty->GetViewMatrix();
if(mAttr==SHD_TANGENT)
ms.m_mesh->SetMeshModified(true);
@@ -525,13 +524,15 @@ void BL_Shader::Update( const KX_MeshSlot & ms, RAS_IRasterizer* rasty )
}
case VIEWMATRIX_INVERSE:
{
- view.invert();
+ MT_Matrix4x4 viewinv = view;
+ viewinv.invert();
SetUniform(uni->mLoc, view);
break;
}
case VIEWMATRIX_INVERSETRANSPOSE:
{
- view.invert();
+ MT_Matrix4x4 viewinv = view;
+ viewinv.invert();
SetUniform(uni->mLoc, view, true);
break;
}
@@ -670,6 +671,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose)
)
{
float value[16];
+ // note: getValue gives back column major as needed by OpenGL
vec.getValue(value);
glUniformMatrix4fvARB(uniform, 1, transpose?GL_TRUE:GL_FALSE, value);
}