Skip to content

Instantly share code, notes, and snippets.

@bgK
Created March 25, 2015 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bgK/0308b600a10359cb1489 to your computer and use it in GitHub Desktop.
Save bgK/0308b600a10359cb1489 to your computer and use it in GitHub Desktop.
diff --git a/engines/grim/gfx_opengl_shaders.cpp b/engines/grim/gfx_opengl_shaders.cpp
index 728c9e3..f9feaef 100644
--- a/engines/grim/gfx_opengl_shaders.cpp
+++ b/engines/grim/gfx_opengl_shaders.cpp
@@ -727,6 +727,7 @@ void GfxOpenGLS::startActorDraw(const Actor *actor) {
_actorProgram->setUniform("hasZBuffer", hasZBuffer);
_actorProgram->setUniform("texcropZBuf", _zBufTexCrop);
_actorProgram->setUniform("screenSize", Math::Vector2d(_screenWidth, _screenHeight));
+ _actorProgram->setUniform1f("alphaRef", 0.5f);
}
if (_currentShadowArray) {
diff --git a/engines/grim/shaders/grim_actor.fragment b/engines/grim/shaders/grim_actor.fragment
index 00b78cf..efd78e6 100644
--- a/engines/grim/shaders/grim_actor.fragment
+++ b/engines/grim/shaders/grim_actor.fragment
@@ -7,6 +7,7 @@ uniform bool textured;
uniform bool hasZBuffer;
uniform vec2 texcropZBuf;
uniform vec2 screenSize;
+uniform float alphaRef;
//#define SGSPLUS_FIX
#ifndef SGSPLUS_FIX
@@ -40,4 +41,7 @@ void main()
if (textured) {
outColor *= texture(tex, Texcoord);
}
+
+ if (outColor.a < alphaRef)
+ discard;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment