From 42a3eb1880321bb64d92feee8e444f4be67c6ba5 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 20 Oct 2017 18:21:40 +0800 Subject: [PATCH] Uniform vertex color for fonts in all pipelines --- src/font/font_with_face.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/font/font_with_face.cpp b/src/font/font_with_face.cpp index 9754a63d2..44cb641c1 100644 --- a/src/font/font_with_face.cpp +++ b/src/font/font_with_face.cpp @@ -30,6 +30,8 @@ #include "guiengine/skin.hpp" #include "utils/string_utils.hpp" +#include + // ---------------------------------------------------------------------------- /** Constructor. It will initialize the \ref m_spritebank and TTF files to use. * \param name The name of face, used by irrlicht to distinguish spritebank. @@ -677,15 +679,24 @@ void FontWithFace::render(const core::stringw& text, top.setAlpha(color.getAlpha()); bottom.setAlpha(color.getAlpha()); - video::SColor title_colors[] = {top, bottom, top, bottom}; - if (char_collector != NULL) + std::array title_colors; + if (CVS->isGLSL()) { - char_collector->collectChar(texture, dest, source, - title_colors); + title_colors = { { top, bottom, top, bottom } }; } else { - draw2DImage(texture, dest, source, clip, title_colors, true); + title_colors = { { bottom, top, top, bottom } }; + } + if (char_collector != NULL) + { + char_collector->collectChar(texture, dest, source, + title_colors.data()); + } + else + { + draw2DImage(texture, dest, source, clip, title_colors.data(), + true); } } else