Uniform vertex color for fonts in all pipelines

This commit is contained in:
Benau 2017-10-20 18:21:40 +08:00
parent e61eb3415a
commit 42a3eb1880

View File

@ -30,6 +30,8 @@
#include "guiengine/skin.hpp" #include "guiengine/skin.hpp"
#include "utils/string_utils.hpp" #include "utils/string_utils.hpp"
#include <array>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Constructor. It will initialize the \ref m_spritebank and TTF files to use. /** 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. * \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()); top.setAlpha(color.getAlpha());
bottom.setAlpha(color.getAlpha()); bottom.setAlpha(color.getAlpha());
video::SColor title_colors[] = {top, bottom, top, bottom}; std::array<video::SColor, 4> title_colors;
if (char_collector != NULL) if (CVS->isGLSL())
{ {
char_collector->collectChar(texture, dest, source, title_colors = { { top, bottom, top, bottom } };
title_colors);
} }
else 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 else