3D viewer: Fix bug #1509506: Crash with MeshLab reduced 3D model.
This commit is contained in:
parent
ade51289a7
commit
c721c21bdf
|
@ -333,6 +333,10 @@ void S3D_MESH::openGL_Render( bool aIsRenderingJustNonTransparentObjects,
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if( m_Materials->m_ColorPerVertex == false )
|
||||||
|
if( m_Materials->m_DiffuseColor.size() == m_Point.size() )
|
||||||
|
m_Materials->m_ColorPerVertex = true;
|
||||||
|
|
||||||
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
|
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
|
||||||
{
|
{
|
||||||
if( m_Materials )
|
if( m_Materials )
|
||||||
|
|
|
@ -1314,7 +1314,8 @@ int VRML2_MODEL_PARSER::read_Material()
|
||||||
if( strcmp( text, "diffuseColor" ) == 0 )
|
if( strcmp( text, "diffuseColor" ) == 0 )
|
||||||
{
|
{
|
||||||
ParseVertex( m_file, vertex );
|
ParseVertex( m_file, vertex );
|
||||||
m_model->m_Materials->m_DiffuseColor.push_back( vertex );
|
if( m_model->m_Materials->m_DiffuseColor.empty() )
|
||||||
|
m_model->m_Materials->m_DiffuseColor.push_back( vertex );
|
||||||
}
|
}
|
||||||
else if( strcmp( text, "emissiveColor" ) == 0 )
|
else if( strcmp( text, "emissiveColor" ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1640,6 +1641,12 @@ int VRML2_MODEL_PARSER::read_Color()
|
||||||
|
|
||||||
if( strcmp( text, "color" ) == 0 )
|
if( strcmp( text, "color" ) == 0 )
|
||||||
{
|
{
|
||||||
|
if( m_model->m_Materials == NULL )
|
||||||
|
{
|
||||||
|
m_model->m_Materials = new S3D_MATERIAL( m_Master, "" );
|
||||||
|
m_Master->Insert( m_model->m_Materials );
|
||||||
|
}
|
||||||
|
|
||||||
m_model->m_Materials->m_DiffuseColor.clear();
|
m_model->m_Materials->m_DiffuseColor.clear();
|
||||||
ParseVertexList( m_file, m_model->m_Materials->m_DiffuseColor );
|
ParseVertexList( m_file, m_model->m_Materials->m_DiffuseColor );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue