From e8eb1ee0c7e27b5961986bff1a655427a4a8fc53 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 20 Sep 2017 14:29:05 +0100 Subject: [PATCH] Added Text::assignStateSet() and usage to make sure the correct StateSet is setup for each combination of backdrop settings --- include/osgText/Text | 2 ++ src/osgText/Text.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/osgText/Text b/include/osgText/Text index fc6fbfc0f..0d991a805 100644 --- a/include/osgText/Text +++ b/include/osgText/Text @@ -278,6 +278,8 @@ protected: virtual osg::StateSet* createStateSet(); + void assignStateSet(); + Font* getActiveFont(); const Font* getActiveFont() const; diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 25585d0d6..665147bd7 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -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(); }