[Scummvm-git-logs] scummvm master -> 5a1410fc606069afc9eb7ca6ca40092661bd33ab
aquadran
noreply at scummvm.org
Sun Oct 26 08:37:16 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
6b52d461e9 GRIM: Avoid rounding Z coordinate in EMI sprite vertex shader
5a1410fc60 GRIM: Use proper sprite texture coordinates in shader renderer
Commit: 6b52d461e94d87597f2f3bbe8321f066ef04e0dc
https://github.com/scummvm/scummvm/commit/6b52d461e94d87597f2f3bbe8321f066ef04e0dc
Author: Ingo van Lil (inguin at gmx.de)
Date: 2025-10-26T09:37:12+01:00
Commit Message:
GRIM: Avoid rounding Z coordinate in EMI sprite vertex shader
Rounding the resulting Z coordinate skews the depth test and causes
clipping issues intest in many places. Examples are the ship hulls in
the Mêlée Island harbour, or the gauge bananas in the options menu.
Remove an obsolete comment about inconsistent depth calculations between
meshes and sprites.
Changed paths:
engines/grim/gfx_opengl_shaders.cpp
engines/grim/shaders/emi_sprite.vertex
diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index 16f8c8ad150..d6ec353bcff 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -1153,8 +1153,6 @@ void GfxOpenGLS::drawSprite(const Sprite *sprite) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- // FIXME: depth test does not work yet because final z coordinates
- // for Sprites and actor textures are inconsistently calculated
if (sprite->_flags2 & Sprite::DepthTest || _currentActor->isInOverworld()) {
glEnable(GL_DEPTH_TEST);
} else {
diff --git a/engines/grim/shaders/emi_sprite.vertex b/engines/grim/shaders/emi_sprite.vertex
index 0f6eb090444..51f1bb86464 100644
--- a/engines/grim/shaders/emi_sprite.vertex
+++ b/engines/grim/shaders/emi_sprite.vertex
@@ -38,7 +38,6 @@ void main() {
pos.z *= -1.0;
vec4 projectedPos = projMatrix * pos;
- projectedPos.z = ROUND(projectedPos.z);
gl_Position = projectedPos;
Commit: 5a1410fc606069afc9eb7ca6ca40092661bd33ab
https://github.com/scummvm/scummvm/commit/5a1410fc606069afc9eb7ca6ca40092661bd33ab
Author: Ingo van Lil (inguin at gmx.de)
Date: 2025-10-26T09:37:12+01:00
Commit Message:
GRIM: Use proper sprite texture coordinates in shader renderer
The Dainty Lady in the Mêlée Island harbour is visible from either her
left or right side, depending on the camera position. Both views use the
same texture, but with different texture coordinates to flip the image.
The OpenGL and software renderers correctly use the sprite's texture
coordinates. Do the same in the shader-based renderer.
Changed paths:
engines/grim/gfx_opengl_shaders.cpp
diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index d6ec353bcff..2f745136274 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -81,14 +81,6 @@ static float textured_quad[] = {
0.0f, 1.0f, 0.0f, 1.0f,
};
-static float textured_quad_centered[] = {
-// X , Y , Z , S , T
- -0.5f, -0.5f, 0.0f, 0.0f, 1.0f,
- -0.5f, +0.5f, 0.0f, 0.0f, 0.0f,
- +0.5f, +0.5f, 0.0f, 1.0f, 0.0f,
- +0.5f, -0.5f, 0.0f, 1.0f, 1.0f,
-};
-
static float zero_texVerts[] = { 0.0, 0.0 };
struct GrimVertex {
@@ -310,7 +302,7 @@ void GfxOpenGLS::setupTexturedQuad() {
}
void GfxOpenGLS::setupTexturedCenteredQuad() {
- _spriteVBO = OpenGL::Shader::createBuffer(GL_ARRAY_BUFFER, sizeof(textured_quad_centered), textured_quad_centered, GL_STATIC_DRAW);
+ _spriteVBO = OpenGL::Shader::createBuffer(GL_ARRAY_BUFFER, 0, nullptr, GL_STATIC_DRAW);
_spriteProgram->enableVertexAttribute("position", _spriteVBO, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 0);
_spriteProgram->enableVertexAttribute("texcoord", _spriteVBO, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), 3 * sizeof(float));
_spriteProgram->disableVertexAttribute("color", Math::Vector4d(1.0f, 1.0f, 1.0f, 1.0f));
@@ -1186,6 +1178,16 @@ void GfxOpenGLS::drawSprite(const Sprite *sprite) {
Math::Vector4d color(sprite->_red[0] / 255.0f, sprite->_green[0] / 255.0f, sprite->_blue[0] / 255.0f, sprite->_alpha[0] / 255.0f);
_spriteProgram->setUniform("uniformColor", color);
+ float sprite_textured_quad[] = {
+ // X , Y , Z , S , T
+ -0.5f, +0.5f, 0.0f, sprite->_texCoordX[0], sprite->_texCoordY[0],
+ +0.5f, +0.5f, 0.0f, sprite->_texCoordX[1], sprite->_texCoordY[1],
+ +0.5f, -0.5f, 0.0f, sprite->_texCoordX[2], sprite->_texCoordY[2],
+ -0.5f, -0.5f, 0.0f, sprite->_texCoordX[3], sprite->_texCoordY[3],
+ };
+
+ glBindBuffer(GL_ARRAY_BUFFER, _spriteVBO);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(sprite_textured_quad), sprite_textured_quad, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _quadEBO);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
More information about the Scummvm-git-logs
mailing list