diff --git a/src/irrlicht_changes/CGUITTFont.cpp b/src/irrlicht_changes/CGUITTFont.cpp index 842f0f2f7..ac3a20524 100644 --- a/src/irrlicht_changes/CGUITTFont.cpp +++ b/src/irrlicht_changes/CGUITTFont.cpp @@ -678,13 +678,6 @@ void CGUITTFont::draw(const EnrichedString &text, const core::rect& positio CGUITTGlyphPage* page = it->second; ++it; - if (shadow_offset) { - for (size_t i = 0; i < page->render_positions.size(); ++i) - page->render_positions[i] += core::vector2di(shadow_offset, shadow_offset); - Driver->draw2DImageBatch(page->texture, page->render_positions, page->render_source_rects, clip, video::SColor(shadow_alpha,0,0,0), true); - for (size_t i = 0; i < page->render_positions.size(); ++i) - page->render_positions[i] -= core::vector2di(shadow_offset, shadow_offset); - } // render runs of matching color in batch size_t ibegin; video::SColor colprev; @@ -700,6 +693,19 @@ void CGUITTFont::draw(const EnrichedString &text, const core::rect& positio if (!use_transparency) colprev.color |= 0xff000000; + + if (shadow_offset) { + for (size_t i = 0; i < tmp_positions.size(); ++i) + tmp_positions[i] += core::vector2di(shadow_offset, shadow_offset); + + u32 new_shadow_alpha = core::clamp(core::round32(shadow_alpha * colprev.getAlpha() / 255.0f), 0, 255); + video::SColor shadow_color = video::SColor(new_shadow_alpha, 0, 0, 0); + Driver->draw2DImageBatch(page->texture, tmp_positions, tmp_source_rects, clip, shadow_color, true); + + for (size_t i = 0; i < tmp_positions.size(); ++i) + tmp_positions[i] -= core::vector2di(shadow_offset, shadow_offset); + } + Driver->draw2DImageBatch(page->texture, tmp_positions, tmp_source_rects, clip, colprev, true); } }