Skip to content
Snippets Groups Projects
Commit b8eac0fd authored by Sebastian Freitag's avatar Sebastian Freitag
Browse files

Merge branch 'feature/OpenSGMultiMaterialBugfix' into 'develop'

Fixed OpenSGMultiMaterial bug with native pipeline

See merge request !22
parents e8fe2eb0 683789a9
No related branches found
No related tags found
1 merge request!22Fixed OpenSGMultiMaterial bug with native pipeline
......@@ -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 )
{
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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment