Fixed bug associated with complex RenderBin setup.

This commit is contained in:
Robert Osfield
2007-04-16 12:18:56 +00:00
parent 68a6882d04
commit 9db23e0b22
4 changed files with 117 additions and 3 deletions

View File

@@ -120,10 +120,16 @@ class OSG_EXPORT State : public Referenced
/** Pop stateset off state stack.*/
void popStateSet();
/** pop all statesets off state stack, ensuring it is empty ready for the next frame.
* Note, to return OpenGL to default state, one should do any state.popAllStatSets(); state.apply().*/
void popAllStateSets();
/** Insert stateset onto state stack.*/
void insertStateSet(unsigned int pos,const StateSet* dstate);
/** Pop stateset off state stack.*/
void removeStateSet(unsigned int pos);
/** Get the number of StateSet's on the StateSet stack.*/
unsigned int getStateSetStackSize() { return _stateStateStack.size(); }

View File

@@ -46,7 +46,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
typedef std::map< const osg::StateSet*, osg::ref_ptr<StateGraph> > ChildList;
typedef std::vector< osg::ref_ptr<RenderLeaf> > LeafList;
StateGraph* _parent;
StateGraph* _parent;
const osg::StateSet* _stateset;
int _depth;
@@ -279,6 +279,19 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
}
inline static int numToPop(osg::State& state,StateGraph* sg_curr)
{
int numToPop = 0;
// need to pop back all statesets and matrices.
while (sg_curr)
{
if (sg_curr->_stateset) ++numToPop;
sg_curr = sg_curr->_parent;
}
return numToPop;
}
private:
/// disallow copy construction.