Implemented ability to switch between different shaders with new MultipassTechnique

This commit is contained in:
Robert Osfield
2013-12-13 12:38:01 +00:00
parent 939aa38a2a
commit 5571c361dc
5 changed files with 318 additions and 91 deletions

View File

@@ -145,9 +145,20 @@ Program::Program() :
Program::Program(const Program& rhs, const osg::CopyOp& copyop):
osg::StateAttribute(rhs, copyop)
{
for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
if ((copyop.getCopyFlags()&osg::CopyOp::DEEP_COPY_STATEATTRIBUTES)!=0)
{
addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) );
for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
{
addShader( new osg::Shader( *rhs.getShader( shaderIndex ), copyop ) );
}
}
else
{
for( unsigned int shaderIndex=0; shaderIndex < rhs.getNumShaders(); ++shaderIndex )
{
addShader( const_cast<osg::Shader*>(rhs.getShader( shaderIndex )) );
}
}
const osg::Program::AttribBindingList &abl = rhs.getAttribBindingList();