Ver Fonte

bugfix: add obj-material handling for <color> 0 instead of <color> r g b.

Signed-off-by: Kim Kulling <[email protected]>
Kim Kulling há 11 anos atrás
pai
commit
5e265610fb
1 ficheiros alterados com 8 adições e 6 exclusões
  1. 8 6
      code/ObjFileMtlImporter.cpp

+ 8 - 6
code/ObjFileMtlImporter.cpp

@@ -223,15 +223,17 @@ void ObjFileMtlImporter::getColorRGBA( aiColor3D *pColor )
 {
 {
 	ai_assert( NULL != pColor );
 	ai_assert( NULL != pColor );
 	
 	
-	float r, g, b;
+	float r( 0.0f ), g( 0.0f ), b( 0.0f );
 	m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, r );
 	m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, r );
 	pColor->r = r;
 	pColor->r = r;
 	
 	
-	m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, g );
-	pColor->g = g;
-
-	m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, b );
-	pColor->b = b;
+    // we have to check if color is default 0 with only one token
+    if( !isNewLine( *m_DataIt ) ) {
+        m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, g );
+        m_DataIt = getFloat<DataArrayIt>( m_DataIt, m_DataItEnd, b );
+    }
+    pColor->g = g;
+    pColor->b = b;
 }
 }
 
 
 // -------------------------------------------------------------------
 // -------------------------------------------------------------------