Removed StateSet::ENCLOSE_RENDERBIN_DETAILS since it is rendendent, and

implemented the OVERRIDE_RENDERBIN_DETAILS.
This commit is contained in:
Robert Osfield
2006-07-11 21:53:57 +00:00
parent 165351196e
commit dd6a33da49
6 changed files with 24 additions and 10 deletions

View File

@@ -327,8 +327,7 @@ class OSG_EXPORT StateSet : public Object
{
INHERIT_RENDERBIN_DETAILS,
USE_RENDERBIN_DETAILS,
OVERRIDE_RENDERBIN_DETAILS,
ENCLOSE_RENDERBIN_DETAILS
OVERRIDE_RENDERBIN_DETAILS
};
/** Set the render bin details.*/

View File

@@ -92,10 +92,14 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
inline void pushStateSet(const osg::StateSet* ss)
{
_currentStateGraph = _currentStateGraph->find_or_insert(ss);
if (ss->useRenderBinDetails())
if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty())
{
_currentRenderBin = _currentRenderBin->find_or_insert(ss->getBinNumber(),ss->getBinName());
}
if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)
{
++_numberOfEncloseOverrideRenderBinDetails;
}
}
/** Pop the top state set and hence associated state group.
@@ -104,9 +108,18 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
*/
inline void popStateSet()
{
if (_currentStateGraph->_stateset->useRenderBinDetails())
const osg::StateSet* ss = _currentStateGraph->_stateset;
if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty())
{
_currentRenderBin = _currentRenderBin->getParent();
if (_currentRenderBin->getParent())
{
_currentRenderBin = _currentRenderBin->getParent();
}
}
if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)
{
--_numberOfEncloseOverrideRenderBinDetails;
}
_currentStateGraph = _currentStateGraph->_parent;
}
@@ -269,6 +282,8 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
inline RenderLeaf* createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth=0.0f);
unsigned int _numberOfEncloseOverrideRenderBinDetails;
osg::ref_ptr<osg::State> _state;