diff --git a/VistaCoreLibs/VistaKernelOpenSGExt/VistaOpenSGMultiMaterial.cpp b/VistaCoreLibs/VistaKernelOpenSGExt/VistaOpenSGMultiMaterial.cpp index 7e0afe77ce13d75e41d3fad72370cb7e05ea6b0a..bb133c1429bd29f7385bf5aeeb34458f3841b16f 100644 --- a/VistaCoreLibs/VistaKernelOpenSGExt/VistaOpenSGMultiMaterial.cpp +++ b/VistaCoreLibs/VistaKernelOpenSGExt/VistaOpenSGMultiMaterial.cpp @@ -102,7 +102,6 @@ public: beginEditCP( m_pMaterial ); m_pMaterial->addChunk( m_pMaterialChunk ); m_pMaterial->addChunk( m_pPolygonChunk ); - m_pMaterial->addChunk( m_pShaderUniforms ); endEditCP( m_pMaterial ); UpdateFogParameter(); @@ -138,9 +137,11 @@ public: { if( m_pCurrentShader != osg::NullFC ) { - m_pMaterial->subChunk( m_pShaderUniforms ); - m_pMaterial->subChunk( m_pCurrentShader ); - m_pCurrentShader = osg::NullFC; + beginEditCP( m_pMaterial ); + m_pMaterial->subChunk( m_pShaderUniforms ); + m_pMaterial->subChunk( m_pCurrentShader ); + m_pCurrentShader = osg::NullFC; + endEditCP( m_pMaterial ); } } else @@ -153,7 +154,7 @@ public: } m_pCurrentShader = GetShader(); - beginEditCP( m_pShaderUniforms, osg::SHLParameterChunk::SHLChunkFieldMask ); + beginEditCP( m_pShaderUniforms ); m_pShaderUniforms->setSHLChunk( m_pCurrentShader ); //m_pShaderUniforms->clearUniformParameters(); m_pShaderUniforms->subUniformParameter( "nReflectionFactor" ); @@ -161,7 +162,7 @@ public: m_pShaderUniforms->subUniformParameter( "nFogType" ); m_pShaderUniforms->subUniformParameter( "u_v4TexCoordScale" ); m_pShaderUniforms->subUniformParameter( "nBlendFactor" ); - endEditCP( m_pShaderUniforms, osg::SHLParameterChunk::SHLChunkFieldMask ); + endEditCP( m_pShaderUniforms ); m_pMaterial->addChunk( m_pCurrentShader ); m_pMaterial->addChunk( m_pShaderUniforms ); @@ -1198,44 +1199,6 @@ bool VistaOpenSGMultiMaterial::ApplyTo( osg::GeometryPtr pGeometry, const bool b if( bReplaceVertexColors ) { - //beginEditCP( pGeometry ); - // osg::MFUInt16& vecGeoIndices = pGeometry->getIndexMapping(); - // std::size_t nColorIndex = -1; - // std::size_t nTotalIndices = vecGeoIndices.size(); - // for( int i = 0; i < vecGeoIndices.size(); ++i ) - // { - // if( vecGeoIndices[i] == osg::Geometry::MapNormal ) - // { - // vecGeoIndices.erase( vecGeoIndices.begin() + i ); - // nColorIndex = 1; - // break; - // } - // } - // if( nColorIndex >= 0 ) - // { - // osg::GeoIndicesPtr pIndices = pGeometry->editIndices(); - // beginEditCP( pIndices ); - // { - // // indices for the polygon - // for( i = 0; i < n; ++i ) - // { - // if( vFormat.coordinate == VistaVertexFormat::COORDINATE ) - // indices->push_back(vertices[i].GetCoordinateIndex()); - - // if( vFormat.color == VistaVertexFormat::COLOR_RGB ) - // indices->push_back(vertices[i].GetColorIndex()); - - // if( vFormat.normal == VistaVertexFormat::NORMAL ) - // indices->push_back(vertices[i].GetNormalIndex()); - - // if( vFormat.textureCoord == VistaVertexFormat::TEXTURE_COORD_2D ) - // indices->push_back(vertices[i].GetTextureCoordinateIndex()); - // } - // } - // endEditCP( pIndices ); - // } - //endEditCP( pGeometry ); - beginEditCP( pGeometry ); osg::Color4f oFullColor = m_pInternals->m_pMaterialChunk->getDiffuse(); osg::GeoColorsPtr pColors = pGeometry->getColors();