[Scummvm-git-logs] scummvm master -> 05eb1ec6dc9648638abba64723be44827b81e568
klusark
noreply at scummvm.org
Mon Nov 16 20:41:40 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
b3fcb9066c EMI: Disable sprite overworld check
afb423f7ff GRIM/EMI: Disable shadow projection for sprites
05eb1ec6dc GRIM: Simplify OpenGL Shaders sprite renderer
Commit: b3fcb9066c3f52a084f6020bfdb5deb7176774ff
https://github.com/scummvm/scummvm/commit/b3fcb9066c3f52a084f6020bfdb5deb7176774ff
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-16T15:41:34-05:00
Commit Message:
EMI: Disable sprite overworld check
This check isn't needed and was already removed from the other
renderers.
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 4cdd389f82d..09c01319f4b 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -1194,7 +1194,7 @@ void GfxOpenGLS::drawSprite(const Sprite *sprite) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- if (sprite->_flags2 & Sprite::DepthTest || _currentActor->isInOverworld()) {
+ if (sprite->_flags2 & Sprite::DepthTest) {
glEnable(GL_DEPTH_TEST);
} else {
glDisable(GL_DEPTH_TEST);
Commit: afb423f7ff5b04440a8e9b700a5393cb1e46a1f9
https://github.com/scummvm/scummvm/commit/afb423f7ff5b04440a8e9b700a5393cb1e46a1f9
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-16T15:41:34-05:00
Commit Message:
GRIM/EMI: Disable shadow projection for sprites
Shadows were already disabled for sprites in Grim, but not in EMI. The
original engine skips sprites when drawing shadows, and no difference
can be seen after the change.
Changed paths:
engines/grim/emi/costume/emisprite_component.cpp
engines/grim/gfx_opengl_shaders.cpp
engines/grim/shaders/emi_sprite.vertex
engines/grim/shaders/grim_sprite.vertex
diff --git a/engines/grim/emi/costume/emisprite_component.cpp b/engines/grim/emi/costume/emisprite_component.cpp
index 11fbe6da894..84ef8fdffc5 100644
--- a/engines/grim/emi/costume/emisprite_component.cpp
+++ b/engines/grim/emi/costume/emisprite_component.cpp
@@ -24,6 +24,7 @@
#include "engines/grim/resource.h"
#include "engines/grim/costume.h"
#include "engines/grim/sprite.h"
+#include "engines/grim/gfx_base.h"
namespace Grim {
@@ -47,7 +48,7 @@ void EMISpriteComponent::reset() {
}
void EMISpriteComponent::draw() {
- if (_sprite) {
+ if (_sprite && !g_driver->isShadowModeActive()) {
_sprite->draw();
}
}
diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index 09c01319f4b..db940a0e104 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -804,6 +804,7 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
}
}
+ OpenGL::Shader *actorShaders[] = { _actorProgram, _actorLightsProgram };
if (_currentShadowArray) {
const Sector *shadowSector = _currentShadowArray->planeList.front().sector;
Math::Vector3d color;
@@ -816,13 +817,13 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
if (!_currentShadowArray->dontNegate)
normal = -normal;
- for (int i = 0; i < 3; i++) {
- shaders[i]->use();
- shaders[i]->setUniform("shadow._active", true);
- shaders[i]->setUniform("shadow._color", color);
- shaders[i]->setUniform("shadow._light", _currentShadowArray->pos);
- shaders[i]->setUniform("shadow._point", shadowSector->getVertices()[0]);
- shaders[i]->setUniform("shadow._normal", normal);
+ for (int i = 0; i < 2; i++) {
+ actorShaders[i]->use();
+ actorShaders[i]->setUniform("shadow._active", true);
+ actorShaders[i]->setUniform("shadow._color", color);
+ actorShaders[i]->setUniform("shadow._light", _currentShadowArray->pos);
+ actorShaders[i]->setUniform("shadow._point", shadowSector->getVertices()[0]);
+ actorShaders[i]->setUniform("shadow._normal", normal);
}
glDepthMask(GL_FALSE);
@@ -830,9 +831,9 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
glEnable(GL_POLYGON_OFFSET_FILL);
}
else {
- for (int i = 0; i < 3; i++) {
- shaders[i]->use();
- shaders[i]->setUniform("shadow._active", false);
+ for (int i = 0; i < 2; i++) {
+ actorShaders[i]->use();
+ actorShaders[i]->setUniform("shadow._active", false);
}
}
diff --git a/engines/grim/shaders/emi_sprite.vertex b/engines/grim/shaders/emi_sprite.vertex
index 90855b73b74..264f84c6210 100644
--- a/engines/grim/shaders/emi_sprite.vertex
+++ b/engines/grim/shaders/emi_sprite.vertex
@@ -14,16 +14,6 @@ uniform UBOOL useVertexAlpha;
uniform vec4 uniformColor;
uniform vec4 spriteColor;
-struct shadow_info {
- UBOOL _active;
- vec3 _color;
- vec3 _light;
- vec3 _point;
- vec3 _normal;
-};
-
-uniform shadow_info shadow;
-
out vec2 Texcoord;
out vec4 Color;
@@ -42,11 +32,7 @@ void main() {
gl_Position = projectedPos;
- if (UBOOL_TEST(shadow._active)) {
- Color = vec4(shadow._color, 1.0);
- } else {
- Color = color;
- }
+ Color = color;
if (!UBOOL_TEST(useVertexAlpha))
Color.a = 1.0;
Color *= uniformColor;
diff --git a/engines/grim/shaders/grim_sprite.vertex b/engines/grim/shaders/grim_sprite.vertex
index b9d800f4136..bf5bd45ca53 100644
--- a/engines/grim/shaders/grim_sprite.vertex
+++ b/engines/grim/shaders/grim_sprite.vertex
@@ -10,16 +10,6 @@ uniform highp mat4 extraMatrix;
uniform highp vec3 spritePos;
uniform highp vec2 spriteSize;
-struct shadow_info {
- UBOOL _active;
- vec3 _color;
- vec3 _light;
- vec3 _point;
- vec3 _normal;
-};
-
-uniform shadow_info shadow;
-
out vec2 Texcoord;
out vec4 Color;
out float ClipDist;
@@ -33,10 +23,6 @@ void main() {
gl_Position = projMatrix * viewPos;
ClipDist = 1.0;
- if (UBOOL_TEST(shadow._active)) {
- Color = vec4(shadow._color, 1.0);
- } else {
- Color = color;
- }
+ Color = color;
Texcoord = texcoord;
}
Commit: 05eb1ec6dc9648638abba64723be44827b81e568
https://github.com/scummvm/scummvm/commit/05eb1ec6dc9648638abba64723be44827b81e568
Author: Joel Teichroeb (joel at teichroeb.net)
Date: 2026-11-16T15:41:34-05:00
Commit Message:
GRIM: Simplify OpenGL Shaders sprite renderer
Changed paths:
engines/grim/gfx_opengl_shaders.cpp
engines/grim/shaders/grim_sprite.vertex
diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index db940a0e104..7aa6e9e7f0a 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -1139,29 +1139,26 @@ void GfxOpenGLS::drawModelFace(const Mesh *mesh, const MeshFace *face) {
}
void GfxOpenGLS::drawSprite(const Sprite *sprite) {
- if (g_grim->getGameType() == GType_GRIM) {
- // A sprite of Grim (the smoke of Manny's cigarette, sparks) is a quad that faces the camera, its bottom edge on the position of the sprite, and the
- // texture runs flipped along x, as in the fixed pipeline.
- // The sprite writes depth, as in the fixed pipeline: the meshes of the model are drawn after the sprites of their node (Manny's head after
- // the smoke of his cigarette) and must not cover them. The alpha test keeps the clear texels from writing depth.
- glDepthMask(GL_TRUE);
- glEnable(GL_BLEND);
- if (sprite->_flags1 & Sprite::BlendAdditive) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- } else {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- if (sprite->_flags2 & Sprite::DepthTest) {
- glEnable(GL_DEPTH_TEST);
- } else {
- glDisable(GL_DEPTH_TEST);
- }
+ glDepthMask(GL_TRUE);
+ glEnable(GL_BLEND);
+ if (sprite->_flags1 & Sprite::BlendAdditive) {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ } else {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+ if (sprite->_flags2 & Sprite::DepthTest) {
+ glEnable(GL_DEPTH_TEST);
+ } else {
+ glDisable(GL_DEPTH_TEST);
+ }
- _spriteProgram->use();
+ _spriteProgram->use();
+ _spriteProgram->setUniform("textured", GL_TRUE);
+
+ if (g_grim->getGameType() == GType_GRIM) {
_spriteProgram->setUniform("extraMatrix", _matrixStack.top());
_spriteProgram->setUniform("spritePos", sprite->_pos);
_spriteProgram->setUniform("spriteSize", Math::Vector2d(sprite->_width, sprite->_height));
- _spriteProgram->setUniform("textured", GL_TRUE);
_spriteProgram->setUniform1f("alphaRef", 0.5f);
float sprite_quad[] = {
@@ -1171,79 +1168,43 @@ void GfxOpenGLS::drawSprite(const Sprite *sprite) {
-0.5f, 1.0f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.0f, 0.0f, 1.0f, 1.0f,
};
-
glBindBuffer(GL_ARRAY_BUFFER, _spriteVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(sprite_quad), sprite_quad, GL_STATIC_DRAW);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _quadEBO);
- glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
- glEnable(GL_DEPTH_TEST);
- glDepthMask(GL_TRUE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- return;
- }
-
- if (g_grim->getGameType() == GType_MONKEY4) {
- glDepthMask(GL_TRUE);
} else {
- glDepthMask(GL_FALSE);
- }
-
- if (sprite->_flags1 & Sprite::BlendAdditive) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- } else {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
-
- if (sprite->_flags2 & Sprite::DepthTest) {
- glEnable(GL_DEPTH_TEST);
- } else {
- glDisable(GL_DEPTH_TEST);
- }
-
- _spriteProgram->use();
+ Math::Matrix4 rotateMatrix;
+ rotateMatrix.buildAroundZ(_currentActor->getYaw());
- Math::Matrix4 rotateMatrix;
- rotateMatrix.buildAroundZ(_currentActor->getYaw());
-
- Math::Matrix4 extraMatrix;
- extraMatrix.setPosition(sprite->_pos);
- extraMatrix(0, 0) = sprite->_width;
- extraMatrix(1, 1) = sprite->_height;
-
- extraMatrix = rotateMatrix * extraMatrix;
- extraMatrix.transpose();
- _spriteProgram->setUniform("extraMatrix", extraMatrix);
- _spriteProgram->setUniform("textured", GL_TRUE);
- if (g_grim->getGameType() == GType_GRIM) {
- _spriteProgram->setUniform1f("alphaRef", 0.5f);
- } else if (sprite->_flags2 & Sprite::AlphaTest) {
- _spriteProgram->setUniform1f("alphaRef", 0.1f);
- } else {
- _spriteProgram->setUniform1f("alphaRef", 0.0f);
- }
+ Math::Matrix4 extraMatrix;
+ extraMatrix.setPosition(sprite->_pos);
+ extraMatrix(0, 0) = sprite->_width;
+ extraMatrix(1, 1) = sprite->_height;
+
+ extraMatrix = rotateMatrix * extraMatrix;
+ extraMatrix.transpose();
+ _spriteProgram->setUniform("extraMatrix", extraMatrix);
+ if (sprite->_flags2 & Sprite::AlphaTest) {
+ _spriteProgram->setUniform1f("alphaRef", 0.1f);
+ } else {
+ _spriteProgram->setUniform1f("alphaRef", 0.0f);
+ }
- // FIXME: Currently vertex-specific colors are not supported for sprites.
- // It is unknown at this time if this is really needed anywhere.
- Math::Vector4d color(sprite->_red[0] / 255.0f, sprite->_green[0] / 255.0f, sprite->_blue[0] / 255.0f, sprite->_alpha[0] / 255.0f);
- if (g_grim->getGameType() == GType_MONKEY4) {
+ // FIXME: Currently vertex-specific colors are not supported for sprites.
+ // It is unknown at this time if this is really needed anywhere.
+ Math::Vector4d color(sprite->_red[0] / 255.0f, sprite->_green[0] / 255.0f, sprite->_blue[0] / 255.0f, sprite->_alpha[0] / 255.0f);
// Don't overwrite the actor's alpha value which is set via uniformColor in startActorDraw()
_spriteProgram->setUniform("spriteColor", color);
- } else {
- // No need to set spriteColor for GRIM, it is specific to the EMI sprite shader program
- _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],
- };
+ 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_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);
diff --git a/engines/grim/shaders/grim_sprite.vertex b/engines/grim/shaders/grim_sprite.vertex
index bf5bd45ca53..b8c68b68a2a 100644
--- a/engines/grim/shaders/grim_sprite.vertex
+++ b/engines/grim/shaders/grim_sprite.vertex
@@ -5,7 +5,6 @@ in vec4 color;
uniform highp mat4 modelMatrix;
uniform highp mat4 viewMatrix;
uniform highp mat4 projMatrix;
-// the node of the model that the sprite hangs on, and the place of the sprite in it
uniform highp mat4 extraMatrix;
uniform highp vec3 spritePos;
uniform highp vec2 spriteSize;
@@ -14,8 +13,6 @@ out vec2 Texcoord;
out vec4 Color;
out float ClipDist;
-// A sprite of Grim is a quad that always faces the camera (smoke, sparks): its bottom edge stands on the position of the sprite and the corners
-// are put around that point in the plane of the view.
void main() {
vec4 anchor = modelMatrix * extraMatrix * vec4(spritePos, 1.0);
vec4 viewPos = viewMatrix * anchor;
More information about the Scummvm-git-logs
mailing list