[Scummvm-git-logs] scummvm master -> bdbce2dc0cb8841d99285175baed3872d5921866

aquadran aquadran at gmail.com
Mon Oct 18 05:36:50 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bdbce2dc0c STARK: Cleanup renderer code


Commit: bdbce2dc0cb8841d99285175baed3872d5921866
    https://github.com/scummvm/scummvm/commit/bdbce2dc0cb8841d99285175baed3872d5921866
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-10-18T07:36:45+02:00

Commit Message:
STARK: Cleanup renderer code

Changed paths:
    engines/stark/gfx/opengl.cpp
    engines/stark/gfx/openglactor.cpp
    engines/stark/gfx/openglsactor.cpp


diff --git a/engines/stark/gfx/opengl.cpp b/engines/stark/gfx/opengl.cpp
index d407257f1b..d635d67941 100644
--- a/engines/stark/gfx/opengl.cpp
+++ b/engines/stark/gfx/opengl.cpp
@@ -108,7 +108,6 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 	assert(ambient->type == LightEntry::kAmbient); // The first light must be the ambient light
 
 	Math::Matrix4 viewMatrix = StarkScene->getViewMatrix();
-	Math::Matrix3 viewMatrixRot = viewMatrix.getRotation();
 
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
@@ -133,7 +132,7 @@ void OpenGLDriver::setupLights(const LightEntryArray &lights) {
 		Math::Vector4d eyePosition = viewMatrix * worldPosition;
 
 		Math::Vector3d worldDirection = l->direction;
-		Math::Vector3d eyeDirection = viewMatrixRot * worldDirection;
+		Math::Vector3d eyeDirection = viewMatrix.getRotation() * worldDirection;
 		eyeDirection.normalize();
 
 		glDisable(GL_LIGHT0 + i);
diff --git a/engines/stark/gfx/openglactor.cpp b/engines/stark/gfx/openglactor.cpp
index 9d775743f1..f68779e559 100644
--- a/engines/stark/gfx/openglactor.cpp
+++ b/engines/stark/gfx/openglactor.cpp
@@ -73,10 +73,14 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
 	Math::Matrix4 projection = StarkScene->getProjectionMatrix();
 
 	Math::Matrix4 modelViewMatrix = view * model;
-	modelViewMatrix.transpose(); // OpenGL expects matrices transposed when compared to ScummVM's
+	modelViewMatrix.transpose(); // OpenGL expects matrices transposed
+	glMatrixMode(GL_MODELVIEW);
+	glLoadMatrixf(modelViewMatrix.getData());
 
 	Math::Matrix4 projectionMatrix = projection;
-	projectionMatrix.transpose(); // OpenGL expects matrices transposed when compared to ScummVM's
+	projectionMatrix.transpose(); // OpenGL expects matrices transposed
+	glMatrixMode(GL_PROJECTION);
+	glLoadMatrixf(projectionMatrix.getData());
 
 	Math::Matrix4 mvp;
 	if (drawShadow) {
@@ -87,12 +91,6 @@ void OpenGLActorRenderer::render(const Math::Vector3d &position, float direction
 		lightDirection = getShadowLightDirection(lights, position, modelInverse.getRotation());
 	}
 
-	glMatrixMode(GL_PROJECTION);
-	glLoadMatrixf(projectionMatrix.getData());
-
-	glMatrixMode(GL_MODELVIEW);
-	glLoadMatrixf(modelViewMatrix.getData());
-
 	glEnable(GL_TEXTURE_2D);
 
 	Common::Array<Face *> faces = _model->getFaces();
diff --git a/engines/stark/gfx/openglsactor.cpp b/engines/stark/gfx/openglsactor.cpp
index 4ef1b9fc9b..31bafb69dd 100644
--- a/engines/stark/gfx/openglsactor.cpp
+++ b/engines/stark/gfx/openglsactor.cpp
@@ -71,15 +71,13 @@ void OpenGLSActorRenderer::render(const Math::Vector3d &position, float directio
 	Math::Matrix4 projection = StarkScene->getProjectionMatrix();
 
 	Math::Matrix4 modelViewMatrix = view * model;
-	modelViewMatrix.transpose(); // OpenGL expects matrices transposed when compared to ScummVM's
+	modelViewMatrix.transpose(); // OpenGL expects matrices transposed
 
 	Math::Matrix4 projectionMatrix = projection;
-	projectionMatrix.transpose(); // OpenGL expects matrices transposed when compared to ScummVM's
+	projectionMatrix.transpose(); // OpenGL expects matrices transposed
 
 	Math::Matrix4 normalMatrix = modelViewMatrix;
 	normalMatrix.invertAffineOrthonormal();
-	//normalMatrix.transpose(); // OpenGL expects matrices transposed when compared to ScummVM's
-	//normalMatrix.transpose(); // No need to transpose twice in a row
 
 	_shader->enableVertexAttribute("position1", _faceVBO, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), 0);
 	_shader->enableVertexAttribute("position2", _faceVBO, 3, GL_FLOAT, GL_FALSE, 14 * sizeof(float), 12);




More information about the Scummvm-git-logs mailing list