Skip to content

Commit

Permalink
Overlay: Font - handle premult alpha via antialias_colour in material
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Oct 15, 2023
1 parent a9cf5f2 commit a4a1084
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Components/Overlay/include/OgreFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,15 +307,15 @@ namespace Ogre
*/
void putText(BillboardSet* bbs, String text, float height, const ColourValue& colour = ColourValue::White);

/** Sets whether or not the colour of this font is antialiased as it is generated
/** Sets whether the colour of this font is multiplied with alpha as it is generated
from a true type font.
This is valid only for a FT_TRUETYPE font. If you are planning on using
alpha blending to draw your font, then it is a good idea to set this to
alpha blending to draw your font, then set this to
false (which is the default), otherwise the darkening of the font will combine
with the fading out of the alpha around the edges and make your font look thinner
than it should. However, if you intend to blend your font using a colour blending
mode (add or modulate for example) then it's a good idea to set this to true, in
than it should. However, if you intend to use premultipled alpha or a colour blending
mode (add or modulate for example) then set this to true, in
order to soften your font edges.
*/
inline void setAntialiasColour(bool enabled)
Expand Down
2 changes: 1 addition & 1 deletion Components/Overlay/src/OgreFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ namespace Ogre
// Set up blending
if (mTexture->hasAlpha())
{
mMaterial->setSceneBlending( SBT_TRANSPARENT_ALPHA );
mMaterial->setSceneBlending(mAntialiasColour ? SBF_ONE : SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
mMaterial->getTechnique(0)->getPass(0)->setTransparentSortingEnabled(false);
}
else
Expand Down

0 comments on commit a4a1084

Please sign in to comment.