[Scummvm-git-logs] scummvm master -> 6974da91dea41814757b3cf86948c6630a4afbc5

aquadran noreply at scummvm.org
Sun Nov 3 09:51:38 UTC 2024


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:
6974da91de WINTERMUTE: Small cleanup in drawSpriteEx()


Commit: 6974da91dea41814757b3cf86948c6630a4afbc5
    https://github.com/scummvm/scummvm/commit/6974da91dea41814757b3cf86948c6630a4afbc5
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2024-11-03T10:51:34+01:00

Commit Message:
WINTERMUTE: Small cleanup in drawSpriteEx()

Changed paths:
    engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
    engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp


diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
index c3eb1d380a4..fb9e53e7f31 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
@@ -348,18 +348,24 @@ bool BaseRenderOpenGL3D::drawSpriteEx(BaseSurface *tex, const Wintermute::Rect32
 		commitSpriteBatch();
 	}
 
+	// Convert to OpenGL origin space
+	SWAP(texTop, texBottom);
+
 	// texture coords
 	vertices[0].u = texLeft;
-	vertices[0].v = texTop;
+	vertices[0].v = texBottom;
 
 	vertices[1].u = texLeft;
-	vertices[1].v = texBottom;
+	vertices[1].v = texTop;
 
 	vertices[2].u = texRight;
-	vertices[2].v = texTop;
+	vertices[2].v = texBottom;
 
 	vertices[3].u = texRight;
-	vertices[3].v = texBottom;
+	vertices[3].v = texTop;
+
+	float offset = _height / 2.0f;
+	float correctedYPos = (pos.y - offset) * -1.0f + offset;
 
 	// position coords
 	vertices[0].x = pos.x;
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
index 299f4734e07..f8c92d52bf7 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
@@ -319,9 +319,6 @@ bool BaseRenderOpenGL3DShader::drawSpriteEx(BaseSurface *tex, const Wintermute::
 	float texRight = (float)rect.right / (float)texWidth;
 	float texBottom = (float)rect.bottom / (float)texHeight;
 
-	float offset = _height / 2.0f;
-	float correctedYPos = (pos.y - offset) * -1.0f + offset;
-
 	if (mirrorX) {
 		SWAP(texLeft, texRight);
 	}
@@ -338,18 +335,24 @@ bool BaseRenderOpenGL3DShader::drawSpriteEx(BaseSurface *tex, const Wintermute::
 		commitSpriteBatch();
 	}
 
+	// Convert to OpenGL origin space
+	SWAP(texTop, texBottom);
+
 	// texture coords
 	vertices[0].u = texLeft;
-	vertices[0].v = texTop;
+	vertices[0].v = texBottom;
 
 	vertices[1].u = texLeft;
-	vertices[1].v = texBottom;
+	vertices[1].v = texTop;
 
 	vertices[2].u = texRight;
-	vertices[2].v = texTop;
+	vertices[2].v = texBottom;
 
 	vertices[3].u = texRight;
-	vertices[3].v = texBottom;
+	vertices[3].v = texTop;
+
+	float offset = _height / 2.0f;
+	float correctedYPos = (pos.y - offset) * -1.0f + offset;
 
 	// position coords
 	vertices[0].x = pos.x;




More information about the Scummvm-git-logs mailing list