mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
Support negative shadow offsets for texts and force shadow colour
This commit is contained in:
parent
42ef84998a
commit
6bb43324a2
@ -61,7 +61,7 @@ public:
|
||||
|
||||
void setFontTexture( int index, const std::string& font );
|
||||
|
||||
void renderText( const TextInfo& ti );
|
||||
void renderText( const TextInfo& ti, bool forceColour = false );
|
||||
|
||||
private:
|
||||
std::string fonts[GAME_FONTS];
|
||||
|
@ -177,7 +177,7 @@ void TextRenderer::setFontTexture(int index, const std::string& texture)
|
||||
}
|
||||
}
|
||||
|
||||
void TextRenderer::renderText(const TextRenderer::TextInfo& ti)
|
||||
void TextRenderer::renderText(const TextRenderer::TextInfo& ti, bool forceColour)
|
||||
{
|
||||
renderer->getRenderer()->pushDebugGroup("Text");
|
||||
renderer->getRenderer()->useProgram(textShader);
|
||||
@ -233,6 +233,10 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti)
|
||||
c = text[i];
|
||||
}
|
||||
|
||||
if (forceColour) {
|
||||
colour = glm::vec3(ti.baseColour) * (1/255.f);
|
||||
}
|
||||
|
||||
int glyph = charToIndex(c);
|
||||
if( glyph >= GAME_GLYPHS )
|
||||
{
|
||||
|
@ -237,13 +237,15 @@ void drawOnScreenText(GameWorld* world, GameRenderer* renderer)
|
||||
// Check for the background type
|
||||
if (t.colourBG.a == 0)
|
||||
{
|
||||
glm::vec2 shadowPosition((int8_t)t.colourBG.x, (int8_t)t.colourBG.y);
|
||||
|
||||
ti.baseColour = glm::vec3(0.f);
|
||||
ti.screenPosition += glm::vec2(t.colourBG.x, t.colourBG.y);
|
||||
ti.screenPosition += shadowPosition;
|
||||
ti.backgroundColour = {0, 0, 0, 0};
|
||||
|
||||
renderer->text.renderText(ti);
|
||||
renderer->text.renderText(ti, true);
|
||||
|
||||
ti.screenPosition -= glm::vec2(t.colourBG.x, t.colourBG.y);
|
||||
ti.screenPosition -= shadowPosition;
|
||||
}
|
||||
else if(t.colourBG.a > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user