From 842b96bbc907155babf9ceec8b0922d407abee72 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 2 Oct 2006 15:59:43 +0000 Subject: [PATCH] From Colin McDonald, "I've included render bin checks in the StateSet::compare function, because without them the Optimizer can incorrectly eliminate (otherwise identical) StateSets from different render bins." --- src/osg/StateSet.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/osg/StateSet.cpp b/src/osg/StateSet.cpp index 2de565a7e..0b5457ca5 100644 --- a/src/osg/StateSet.cpp +++ b/src/osg/StateSet.cpp @@ -353,6 +353,20 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const } else if (rhs_uniform_itr == rhs._uniformList.end()) return 1; + // check render bin details + + if ( _binMode < rhs._binMode ) return -1; + else if ( _binMode > rhs._binMode ) return 1; + + if ( _binMode != INHERIT_RENDERBIN_DETAILS ) + { + if ( _binNum < rhs._binNum ) return -1; + else if ( _binNum > rhs._binNum ) return 1; + + if ( _binName < rhs._binName ) return -1; + else if ( _binName > rhs._binName ) return 1; + } + return 0; }