From Simon Carmody, "Patches for compare and copy of Programs and related state
-Added copying of shaders and attributes in osg::Program copy constructor. -Changed StateSet::compare function to compare Uniforms and their override values. Previously it compared a RefUniformPair."
This commit is contained in:
parent
009ddf1b1e
commit
6e780bfa62
@ -105,7 +105,23 @@ Program::Program() :
|
||||
Program::Program(const Program& rhs, const osg::CopyOp& copyop):
|
||||
osg::StateAttribute(rhs, copyop)
|
||||
{
|
||||
osg::notify(osg::FATAL) << "how got here?" << std::endl;
|
||||
for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
|
||||
{
|
||||
addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) );
|
||||
}
|
||||
|
||||
const osg::Program::AttribBindingList &abl = rhs.getAttribBindingList();
|
||||
for( osg::Program::AttribBindingList::const_iterator attribute = abl.begin(); attribute != abl.end(); ++attribute )
|
||||
{
|
||||
addBindAttribLocation( attribute->first, attribute->second );
|
||||
}
|
||||
|
||||
const osg::Program::FragDataBindingList &fdl = rhs.getFragDataBindingList();
|
||||
for( osg::Program::FragDataBindingList::const_iterator fragdata = fdl.begin(); fragdata != fdl.end(); ++fragdata )
|
||||
{
|
||||
addBindFragDataLocation( fragdata->first, fragdata->second );
|
||||
}
|
||||
|
||||
_geometryVerticesOut = rhs._geometryVerticesOut;
|
||||
_geometryInputType = rhs._geometryInputType;
|
||||
_geometryOutputType = rhs._geometryOutputType;
|
||||
|
@ -425,8 +425,10 @@ int StateSet::compare(const StateSet& rhs,bool compareAttributeContents) const
|
||||
{
|
||||
if (lhs_uniform_itr->first<rhs_uniform_itr->first) return -1;
|
||||
else if (rhs_uniform_itr->first<lhs_uniform_itr->first) return 1;
|
||||
if (lhs_uniform_itr->second<rhs_uniform_itr->second) return -1;
|
||||
else if (rhs_uniform_itr->second<lhs_uniform_itr->second) return 1;
|
||||
if (*lhs_uniform_itr->second.first<*rhs_uniform_itr->second.first) return -1;
|
||||
else if (*rhs_uniform_itr->second.first<*lhs_uniform_itr->second.first) return 1;
|
||||
if (lhs_uniform_itr->second.second<rhs_uniform_itr->second.second) return -1;
|
||||
else if (rhs_uniform_itr->second.second<lhs_uniform_itr->second.second) return 1;
|
||||
++lhs_uniform_itr;
|
||||
++rhs_uniform_itr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user