1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

Merge pull request #5885 from willox/gltransparency

Fix regression in OpenGL DrawImageCommand flags
This commit is contained in:
Ted John
2017-07-13 19:17:59 +01:00
committed by GitHub
3 changed files with 33 additions and 6 deletions

View File

@@ -34,6 +34,14 @@ struct DrawImageInstance {
vec4f colour;
vec4i bounds;
sint32 mask;
enum
{
FLAG_COLOUR = (1 << 0),
FLAG_REMAP = (1 << 1),
FLAG_TRANSPARENT = (1 << 2),
FLAG_TRANSPARENT_SPECIAL = (1 << 3),
};
};
class DrawImageShader final : public OpenGLShaderProgram

View File

@@ -798,10 +798,24 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
(texture2.normalizedBounds.z - texture2.normalizedBounds.x) / (float)(texture2.bounds.z - texture2.bounds.x),
(texture2.normalizedBounds.w - texture2.normalizedBounds.y) / (float)(texture2.bounds.w - texture2.bounds.y)
};
command.flags = (!!(image & IMAGE_TYPE_TRANSPARENT) << 3) | (!!(image & (IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_REMAP)) << 1) | (special << 2);
command.colour = { 0.0f, 0.0f, 0.0f };
command.bounds = { left, top, right, bottom };
command.mask = 0;
command.flags = 0;
if (special)
{
command.flags |= DrawImageCommand::FLAG_TRANSPARENT_SPECIAL;
}
if (image & IMAGE_TYPE_TRANSPARENT)
{
command.flags |= DrawImageCommand::FLAG_TRANSPARENT;
}
else if (image & (IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_REMAP))
{
command.flags |= DrawImageCommand::FLAG_REMAP;
}
_commandBuffers.images.emplace_back(std::move(command));
}
@@ -914,7 +928,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uin
(texture.normalizedBounds.z - texture.normalizedBounds.x) / (float)(texture.bounds.z - texture.bounds.x),
(texture.normalizedBounds.w - texture.normalizedBounds.y) / (float)(texture.bounds.w - texture.bounds.y)
};
command.flags = 1;
command.flags = DrawImageCommand::FLAG_COLOUR;
command.colour = paletteColour;
command.bounds = { left, top, right, bottom };
command.mask = 0;