[Scummvm-git-logs] scummvm master -> 7e5364e340c5a745ce5bceeef16051207d0d32ed
aquadran
aquadran at gmail.com
Mon Oct 18 23:59:32 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:
7e5364e340 STARK: Implement double side flag for OpenGL renderer
Commit: 7e5364e340c5a745ce5bceeef16051207d0d32ed
https://github.com/scummvm/scummvm/commit/7e5364e340c5a745ce5bceeef16051207d0d32ed
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2021-10-19T01:59:25+02:00
Commit Message:
STARK: Implement double side flag for OpenGL renderer
Changed paths:
engines/stark/gfx/openglprop.cpp
diff --git a/engines/stark/gfx/openglprop.cpp b/engines/stark/gfx/openglprop.cpp
index af56498a48..cd4b2a7c56 100644
--- a/engines/stark/gfx/openglprop.cpp
+++ b/engines/stark/gfx/openglprop.cpp
@@ -95,12 +95,21 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
glColorMaterial(GL_FRONT, GL_DIFFUSE);
}
for (uint32 i = 0; i < numVertexIndices; i++) {
+ uint32 index = vertexIndices[i];
+ auto vertex = _faceVBO[index];
if (tex) {
tex->bind();
if (_gfx->computeLightsEnabled())
color = Math::Vector3d(1.0f, 1.0f, 1.0f);
else
glColor3f(1.0f, 1.0f, 1.0f);
+ if (material.doubleSided) {
+ vertex.texS = vertex.texS;
+ vertex.texT = 1.0f - vertex.texT;
+ } else {
+ vertex.texS = 1.0f - vertex.texS;
+ vertex.texT = 1.0f - vertex.texT;
+ }
} else {
glBindTexture(GL_TEXTURE_2D, 0);
if (_gfx->computeLightsEnabled())
@@ -110,8 +119,6 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
}
if (_gfx->computeLightsEnabled()) {
- uint32 index = vertexIndices[i];
- auto vertex = _faceVBO[index];
Math::Vector4d modelEyePosition = modelViewMatrix * Math::Vector4d(vertex.x, vertex.y, vertex.z, 1.0);
Math::Vector3d modelEyeNormal = normalMatrix.getRotation() * Math::Vector3d(vertex.nx, vertex.ny, vertex.nz);
modelEyeNormal.normalize();
@@ -184,9 +191,8 @@ void OpenGLPropRenderer::render(const Math::Vector3d &position, float direction,
vertex.r = color.x();
vertex.g = color.y();
vertex.b = color.z();
-
- _faceVBO[index] = vertex;
}
+ _faceVBO[index] = vertex;
}
glEnableClientState(GL_VERTEX_ARRAY);
More information about the Scummvm-git-logs
mailing list