Added _defineList into the osg::StateSet::compare() implementation to address issues with osgUtil::Optimizer ignoring defines.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14948 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
c4fdc93053
commit
423105c299
@ -310,7 +310,11 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const
|
||||
if (_uniformList.size()<rhs._uniformList.size()) return -1;
|
||||
if (_uniformList.size()>rhs._uniformList.size()) return 1;
|
||||
|
||||
// check render bin details
|
||||
if (_defineList.size()<rhs._defineList.size()) return -1;
|
||||
if (_defineList.size()>rhs._defineList.size()) return 1;
|
||||
|
||||
|
||||
// check render bin details
|
||||
|
||||
if ( _binMode < rhs._binMode ) return -1;
|
||||
else if ( _binMode > rhs._binMode ) return 1;
|
||||
@ -487,6 +491,28 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const
|
||||
}
|
||||
else if (rhs_uniform_itr == rhs._uniformList.end()) return 1;
|
||||
|
||||
|
||||
// check defines.
|
||||
DefineList::const_iterator lhs_define_itr = _defineList.begin();
|
||||
DefineList::const_iterator rhs_define_itr = rhs._defineList.begin();
|
||||
while (lhs_define_itr!=_defineList.end() && rhs_define_itr!=rhs._defineList.end())
|
||||
{
|
||||
if (lhs_define_itr->first<rhs_define_itr->first) return -1;
|
||||
else if (rhs_define_itr->first<lhs_define_itr->first) return 1;
|
||||
if (lhs_define_itr->second.first<rhs_define_itr->second.first) return -1;
|
||||
else if (rhs_define_itr->second.first<lhs_define_itr->second.first) return 1;
|
||||
if (lhs_define_itr->second.second<rhs_define_itr->second.second) return -1;
|
||||
else if (rhs_define_itr->second.second<lhs_define_itr->second.second) return 1;
|
||||
++lhs_define_itr;
|
||||
++rhs_define_itr;
|
||||
}
|
||||
if (lhs_define_itr==_defineList.end())
|
||||
{
|
||||
if (rhs_define_itr!=rhs._defineList.end()) return -1;
|
||||
}
|
||||
else if (rhs_define_itr == rhs._defineList.end()) return 1;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user