Show
Ignore:
Timestamp:
04/08/09 14:32:52 (5 years ago)
Author:
robert
Message:

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?."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/Program.cpp

    r8296 r9989  
    106106    osg::StateAttribute(rhs, copyop) 
    107107{ 
    108     osg::notify(osg::FATAL) << "how got here?" << std::endl; 
     108    for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex ) 
     109    { 
     110        addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) ); 
     111    } 
     112 
     113    const osg::Program::AttribBindingList &abl = rhs.getAttribBindingList(); 
     114    for( osg::Program::AttribBindingList::const_iterator attribute = abl.begin(); attribute != abl.end(); ++attribute ) 
     115    { 
     116        addBindAttribLocation( attribute->first, attribute->second ); 
     117    } 
     118 
     119    const osg::Program::FragDataBindingList &fdl = rhs.getFragDataBindingList(); 
     120    for( osg::Program::FragDataBindingList::const_iterator fragdata = fdl.begin(); fragdata != fdl.end(); ++fragdata ) 
     121    { 
     122        addBindFragDataLocation( fragdata->first, fragdata->second ); 
     123    } 
     124 
    109125    _geometryVerticesOut = rhs._geometryVerticesOut; 
    110126    _geometryInputType = rhs._geometryInputType;