diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp index 8f55c205364..b99ada07ead 100644 --- a/engines/grim/gfx_opengl_shaders.cpp +++ b/engines/grim/gfx_opengl_shaders.cpp @@ -386,6 +386,7 @@ void GfxOpenGLS::positionCamera(const Math::Vector3d &pos, const Math::Vector3d Math::Matrix4 lookMatrix = makeLookMatrix(pos, interest, up_vec); _viewMatrix = viewMatrix * lookMatrix; + _viewMatrix.transpose(); } } @@ -440,6 +441,7 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) { modelMatrix.transpose(); modelMatrix.setPosition(pos); + modelMatrix.transpose(); _mvpMatrix = _viewMatrix * modelMatrix; _mvpMatrix.transpose(); @@ -536,7 +538,7 @@ void GfxOpenGLS::drawShadowPlanes() { const ShadowUserData *sud = (ShadowUserData *)_currentShadowArray->userData; _shadowPlaneProgram->use(); _shadowPlaneProgram->setUniform("projMatrix", _projMatrix); - _shadowPlaneProgram->setUniform("viewMatrix", viewMatrix); + _shadowPlaneProgram->setUniform("viewMatrix", _viewMatrix); glBindBuffer(GL_ARRAY_BUFFER, sud->_verticesVBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, sud->_indicesVBO); diff --git a/engines/grim/shaders/grim_actor.vertex b/engines/grim/shaders/grim_actor.vertex index add9909e9e8..aac76f7a00c 100644 --- a/engines/grim/shaders/grim_actor.vertex +++ b/engines/grim/shaders/grim_actor.vertex @@ -12,9 +12,10 @@ in vec2 texcoord; in vec4 color; in vec3 normal; +uniform highp mat4 modelMatrix; +uniform highp mat4 viewMatrix; uniform highp mat4 projMatrix; uniform highp mat4 extraMatrix; -uniform highp mat4 mvpMatrix; uniform highp vec2 texScale; uniform bool textured; uniform light lights[maxLights]; @@ -26,11 +27,12 @@ out vec4 Color; void main() { vec4 pos = vec4(position, 1.0); - pos = mvpMatrix * + + pos = modelMatrix * extraMatrix * pos; - gl_Position = projMatrix * pos; + gl_Position = projMatrix * viewMatrix * pos; if (textured) { Texcoord = vec2(0.0, 1.0) + (texcoord / texScale);