Added Text::assignStateSet() and usage to make sure the correct StateSet is setup for each combination of backdrop settings

This commit is contained in:
Robert Osfield 2017-09-20 14:29:05 +01:00
parent b0829cc352
commit e8eb1ee0c7
2 changed files with 19 additions and 0 deletions

View File

@ -278,6 +278,8 @@ protected:
virtual osg::StateSet* createStateSet();
void assignStateSet();
Font* getActiveFont();
const Font* getActiveFont() const;

View File

@ -205,6 +205,11 @@ osg::StateSet* Text::createStateSet()
return stateset.release();
}
void Text::assignStateSet()
{
setStateSet(createStateSet());
}
Font* Text::getActiveFont()
{
return _font.valid() ? _font.get() : Font::getDefaultFont().get();
@ -1454,6 +1459,9 @@ void Text::setBackdropType(BackdropType type)
if (_backdropType==type) return;
_backdropType = type;
assignStateSet();
computeGlyphRepresentation();
}
@ -1462,6 +1470,9 @@ void Text::setBackdropImplementation(BackdropImplementation implementation)
if (_backdropImplementation==implementation) return;
_backdropImplementation = implementation;
assignStateSet();
computeGlyphRepresentation();
}
@ -1470,6 +1481,9 @@ void Text::setBackdropOffset(float offset)
{
_backdropHorizontalOffset = offset;
_backdropVerticalOffset = offset;
assignStateSet();
computeGlyphRepresentation();
}
@ -1477,6 +1491,9 @@ void Text::setBackdropOffset(float horizontal, float vertical)
{
_backdropHorizontalOffset = horizontal;
_backdropVerticalOffset = vertical;
assignStateSet();
computeGlyphRepresentation();
}