Added FadeText::setFadeSpeed and made internal data structures protected.
This commit is contained in:
parent
648455da34
commit
85dc696c09
@ -28,10 +28,12 @@ public:
|
||||
|
||||
META_Object(osgText,FadeText)
|
||||
|
||||
typedef std::map<osg::View*, osg::Vec4 > ViewBlendColourMap;
|
||||
|
||||
ViewBlendColourMap& getViewBlendColourMap() { return _viewBlendColourMap; }
|
||||
const ViewBlendColourMap& getViewBlendColourMap() const { return _viewBlendColourMap; }
|
||||
/** Set the speed that the alpha value changes as the text is occluded or becomes visible.*/
|
||||
void setFadeSpeed(float fadeSpeed) { _fadeSpeed = fadeSpeed; }
|
||||
|
||||
/** Get the speed that the alpha value changes.*/
|
||||
float getFadeSpeed() const { return _fadeSpeed; }
|
||||
|
||||
/** Draw the text.*/
|
||||
virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
|
||||
@ -42,6 +44,16 @@ protected:
|
||||
|
||||
void init();
|
||||
|
||||
struct FadeTextUpdateCallback;
|
||||
friend struct FadeTextUpdateCallback;
|
||||
|
||||
typedef std::map<osg::View*, osg::Vec4 > ViewBlendColourMap;
|
||||
|
||||
ViewBlendColourMap& getViewBlendColourMap() { return _viewBlendColourMap; }
|
||||
const ViewBlendColourMap& getViewBlendColourMap() const { return _viewBlendColourMap; }
|
||||
|
||||
float _fadeSpeed;
|
||||
|
||||
mutable ViewBlendColourMap _viewBlendColourMap;
|
||||
};
|
||||
|
||||
|
@ -273,7 +273,7 @@ GlobalFadeText* getGlobalFadeText()
|
||||
return s_globalFadeText.get();
|
||||
}
|
||||
|
||||
struct FadeTextUpdateCallback : public osg::Drawable::UpdateCallback
|
||||
struct FadeText::FadeTextUpdateCallback : public osg::Drawable::UpdateCallback
|
||||
{
|
||||
FadeTextData _ftd;
|
||||
|
||||
@ -291,7 +291,7 @@ struct FadeTextUpdateCallback : public osg::Drawable::UpdateCallback
|
||||
|
||||
_ftd._fadeText = fadeText;
|
||||
|
||||
float fadeSpeed = 0.01f;
|
||||
float fadeSpeed = fadeText->getFadeSpeed();
|
||||
|
||||
GlobalFadeText::ViewFadeTextMap& vftm = gft->_viewFadeTextMap;
|
||||
for(GlobalFadeText::ViewFadeTextMap::iterator itr = vftm.begin();
|
||||
@ -342,6 +342,7 @@ FadeText::FadeText(const Text& text,const osg::CopyOp& copyop):
|
||||
|
||||
void FadeText::init()
|
||||
{
|
||||
_fadeSpeed = 0.01f;
|
||||
setUpdateCallback(new FadeTextUpdateCallback());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user