From 8138a7698f7f8821cf49ea3fdd6eb56f2596521c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 12 May 2009 05:49:36 +0000 Subject: [PATCH] Moved getAttributeVec into public: to allow 3rd party code to access without having to subclass --- include/osg/State | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/osg/State b/include/osg/State index 1db439b17..7b294e468 100644 --- a/include/osg/State +++ b/include/osg/State @@ -978,6 +978,14 @@ class OSG_EXPORT State : public Referenced, public Observer inline GLint getUniformLocation( const std::string& name ) const { return _lastAppliedProgramObject ? _lastAppliedProgramObject->getUniformLocation(name) : -1; } inline GLint getAttribLocation( const std::string& name ) const { return _lastAppliedProgramObject ? _lastAppliedProgramObject->getAttribLocation(name) : -1; } + typedef std::pair AttributePair; + typedef std::vector AttributeVec; + + AttributeVec& getAttributeVec( const osg::StateAttribute* attribute ) + { + AttributeStack& as = _attributeMap[ attribute->getTypeMemberPair() ]; + return as.attributeVec; + } /** Set the frame stamp for the current frame.*/ inline void setFrameStamp(FrameStamp* fs) { _frameStamp = fs; } @@ -1119,9 +1127,6 @@ class OSG_EXPORT State : public Referenced, public Observer struct AttributeStack { - typedef std::pair AttributePair; - typedef std::vector AttributeVec; - AttributeStack() { changed = false; @@ -1383,7 +1388,7 @@ inline void State::pushAttributeList(AttributeMap& attributeMap,const StateSet:: { // first pair so simply push incoming pair to back. as.attributeVec.push_back( - AttributeStack::AttributePair(aitr->second.first.get(),aitr->second.second)); + AttributePair(aitr->second.first.get(),aitr->second.second)); } else if ((as.attributeVec.back().second & StateAttribute::OVERRIDE) && !(aitr->second.second & StateAttribute::PROTECTED)) // check the existing override flag { @@ -1394,7 +1399,7 @@ inline void State::pushAttributeList(AttributeMap& attributeMap,const StateSet:: { // no override on so simply push incoming pair to back. as.attributeVec.push_back( - AttributeStack::AttributePair(aitr->second.first.get(),aitr->second.second)); + AttributePair(aitr->second.first.get(),aitr->second.second)); } as.changed = true; }