Added StateSet::RenderBinMode::PROTECTED_RENDERBIN_DETAILS and OVERRIDE_PROTECTED_RENDERBIN_DETAILS options.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14392 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-07-30 12:47:16 +00:00
parent 46440ad0a8
commit 0bdd7351f6
4 changed files with 19 additions and 8 deletions

View File

@ -333,9 +333,11 @@ class OSG_EXPORT StateSet : public Object
enum RenderBinMode
{
INHERIT_RENDERBIN_DETAILS,
USE_RENDERBIN_DETAILS,
OVERRIDE_RENDERBIN_DETAILS
INHERIT_RENDERBIN_DETAILS =0,
USE_RENDERBIN_DETAILS =1,
OVERRIDE_RENDERBIN_DETAILS =2,
PROTECTED_RENDERBIN_DETAILS =4,
OVERRIDE_PROTECTED_RENDERBIN_DETAILS = OVERRIDE_RENDERBIN_DETAILS|PROTECTED_RENDERBIN_DETAILS
};
/** Set the render bin details.*/

View File

@ -21,7 +21,7 @@ extern "C" {
#define OPENSCENEGRAPH_MAJOR_VERSION 3
#define OPENSCENEGRAPH_MINOR_VERSION 3
#define OPENSCENEGRAPH_PATCH_VERSION 3
#define OPENSCENEGRAPH_SOVERSION 114
#define OPENSCENEGRAPH_SOVERSION 115
/* Convenience macro that can be used to decide whether a feature is present or not i.e.
* #if OSG_MIN_VERSION_REQUIRED(2,9,5)

View File

@ -117,7 +117,10 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
{
_currentStateGraph = _currentStateGraph->find_or_insert(ss);
if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty())
bool useRenderBinDetails = (ss->useRenderBinDetails() && !ss->getBinName().empty()) &&
(_numberOfEncloseOverrideRenderBinDetails==0 || (ss->getRenderBinMode()&osg::StateSet::PROTECTED_RENDERBIN_DETAILS)!=0);
if (useRenderBinDetails)
{
_renderBinStack.push_back(_currentRenderBin);
@ -126,7 +129,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
_currentRenderBin->getStage()->find_or_insert(ss->getBinNumber(),ss->getBinName());
}
if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)
if ((ss->getRenderBinMode()&osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)!=0)
{
++_numberOfEncloseOverrideRenderBinDetails;
}
@ -139,11 +142,15 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
inline void popStateSet()
{
const osg::StateSet* ss = _currentStateGraph->getStateSet();
if (ss->getRenderBinMode()==osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)
if ((ss->getRenderBinMode()&osg::StateSet::OVERRIDE_RENDERBIN_DETAILS)!=0)
{
--_numberOfEncloseOverrideRenderBinDetails;
}
if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDetails() && !ss->getBinName().empty())
bool useRenderBinDetails = (ss->useRenderBinDetails() && !ss->getBinName().empty()) &&
(_numberOfEncloseOverrideRenderBinDetails==0 || (ss->getRenderBinMode()&osg::StateSet::PROTECTED_RENDERBIN_DETAILS)!=0);
if (useRenderBinDetails)
{
if (_renderBinStack.empty())
{

View File

@ -286,6 +286,8 @@ REGISTER_OBJECT_WRAPPER( StateSet,
ADD_ENUM_VALUE( INHERIT_RENDERBIN_DETAILS );
ADD_ENUM_VALUE( USE_RENDERBIN_DETAILS );
ADD_ENUM_VALUE( OVERRIDE_RENDERBIN_DETAILS );
ADD_ENUM_VALUE( PROTECTED_RENDERBIN_DETAILS );
ADD_ENUM_VALUE( OVERRIDE_PROTECTED_RENDERBIN_DETAILS );
END_ENUM_SERIALIZER(); // _binMode
ADD_INT_SERIALIZER( BinNumber, 0 ); // _binNum