Coding policy fixes and comment out debugging output.

This commit is contained in:
Wayne Stambaugh 2014-08-16 14:01:00 -04:00
parent 5f70ec63b1
commit cb91e0953d
5 changed files with 395 additions and 370 deletions

View File

@ -56,8 +56,7 @@ char SkipGetChar ( FILE* File )
return EOF; return EOF;
} }
} } while( (c == ' ') || (c == '\t') || (c == '{') || (c == '[') );
while((c == ' ') || (c == '\t') || (c == '{') || (c == '['));
} }
if( (c == '#') || (c == '\n') || (c == '\r') || (c == 0) || (c == ',') ) if( (c == '#') || (c == '\n') || (c == '\r') || (c == 0) || (c == ',') )
@ -72,8 +71,7 @@ char SkipGetChar ( FILE* File )
// DBG( printf( "EOF\n" ) ); // DBG( printf( "EOF\n" ) );
return EOF; return EOF;
} }
} } while( (c != '\n') && (c != '\r') && (c != 0) && (c != ',') );
while((c != '\n') && (c != '\r') && (c != 0) && (c != ','));
} }
else else
{ {
@ -94,27 +92,30 @@ char SkipGetChar ( FILE* File )
char* GetNextTag( FILE* File, char* tag ) char* GetNextTag( FILE* File, char* tag )
{ {
char c = SkipGetChar( File ); char c = SkipGetChar( File );
if( c == EOF ) if( c == EOF )
{ {
return NULL; return NULL;
} }
tag[0] = c; tag[0] = c;
tag[1] = 0; tag[1] = 0;
// DBG( printf( "tag[0] %c\n", tag[0] ) ); // DBG( printf( "tag[0] %c\n", tag[0] ) );
if( (c != '}') && (c != ']') ) if( (c != '}') && (c != ']') )
{ {
char* dst = &tag[1]; char* dst = &tag[1];
while( fscanf( File, "%c", dst ) ) while( fscanf( File, "%c", dst ) )
{ {
if( (*dst == ' ') || (*dst == '[') || (*dst == '{') || if( (*dst == ' ') || (*dst == '[') || (*dst == '{')
(*dst == '\t') || (*dst == '\n')|| (*dst == '\r') ) || (*dst == '\t') || (*dst == '\n')|| (*dst == '\r') )
{ {
*dst = 0; *dst = 0;
break; break;
} }
dst++; dst++;
} }
@ -136,6 +137,7 @@ char* GetNextTag( FILE* File, char* tag )
int read_NotImplemented( FILE* File, char closeChar ) int read_NotImplemented( FILE* File, char closeChar )
{ {
char c; char c;
// DBG( printf( "look for %c\n", closeChar) ); // DBG( printf( "look for %c\n", closeChar) );
while( ( c = fgetc( File ) ) != EOF ) while( ( c = fgetc( File ) ) != EOF )
{ {
@ -143,18 +145,20 @@ int read_NotImplemented( FILE* File, char closeChar)
{ {
// DBG( printf( "{\n") ); // DBG( printf( "{\n") );
read_NotImplemented( File, '}' ); read_NotImplemented( File, '}' );
} else if( c == '[' ) }
else if( c == '[' )
{ {
// DBG( printf( "[\n") ); // DBG( printf( "[\n") );
read_NotImplemented( File, ']' ); read_NotImplemented( File, ']' );
} else if( c == closeChar ) }
else if( c == closeChar )
{ {
// DBG( printf( "%c\n", closeChar) ); // DBG( printf( "%c\n", closeChar) );
return 0; return 0;
} }
} }
DBG( printf( " NotImplemented failed\n" ) ); // DBG( printf( " NotImplemented failed\n" ) );
return -1; return -1;
} }
@ -166,6 +170,7 @@ int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector)
dst_vector.clear(); dst_vector.clear();
glm::vec3 vertex; glm::vec3 vertex;
while( parseVertex( File, vertex ) == 3 ) while( parseVertex( File, vertex ) == 3 )
{ {
dst_vector.push_back( vertex ); dst_vector.push_back( vertex );
@ -191,6 +196,7 @@ int parseVertex( FILE* File, glm::vec3 &dst_vertex )
// Puts again the read char in the buffer // Puts again the read char in the buffer
ungetc( s, File ); ungetc( s, File );
} }
// DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) ); // DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
return ret; return ret;
@ -201,6 +207,7 @@ int parseFloat( FILE* File, float *dst_float )
{ {
float value; float value;
int ret = fscanf( File, "%e", &value ); int ret = fscanf( File, "%e", &value );
*dst_float = value; *dst_float = value;
return ret; return ret;

View File

@ -71,9 +71,12 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; float vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB;
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits ); glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
glm::vec3 matScale( GetMaster()->m_MatScale.x, GetMaster()->m_MatScale.y, GetMaster()->m_MatScale.z ); glm::vec3 matScale( GetMaster()->m_MatScale.x, GetMaster()->m_MatScale.y,
glm::vec3 matRot( GetMaster()->m_MatRotation.x, GetMaster()->m_MatRotation.y, GetMaster()->m_MatRotation.z ); GetMaster()->m_MatScale.z );
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y, GetMaster()->m_MatPosition.z ); glm::vec3 matRot( GetMaster()->m_MatRotation.x, GetMaster()->m_MatRotation.y,
GetMaster()->m_MatRotation.z );
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y,
GetMaster()->m_MatPosition.z );
#define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB ) #define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB )
@ -94,7 +97,6 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) ) if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) )
{ {
continue; continue;
@ -123,6 +125,7 @@ void VRML1_MODEL_PARSER::Load( const wxString aFilename )
} }
} }
int VRML1_MODEL_PARSER::read_separator() int VRML1_MODEL_PARSER::read_separator()
{ {
char text[128]; char text[128];
@ -131,7 +134,6 @@ int VRML1_MODEL_PARSER::read_separator()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( strcmp( text, "Material" ) == 0 ) if( strcmp( text, "Material" ) == 0 )
{ {
readMaterial(); readMaterial();
@ -290,6 +292,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet( )
return -1; return -1;
} }
int VRML1_MODEL_PARSER::readMaterial_ambientColor() int VRML1_MODEL_PARSER::readMaterial_ambientColor()
{ {
// DBG( printf( " readMaterial_ambientColor\n" ) ); // DBG( printf( " readMaterial_ambientColor\n" ) );
@ -408,6 +411,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex()
glm::ivec3 coord; glm::ivec3 coord;
int dummy; // should be -1 int dummy; // should be -1
while( fscanf( m_file, "%d,%d,%d,%d,", &coord[0], &coord[1], &coord[2], &dummy ) ) while( fscanf( m_file, "%d,%d,%d,%d,", &coord[0], &coord[1], &coord[2], &dummy ) )
{ {
std::vector<int> coord_list; std::vector<int> coord_list;
@ -417,9 +421,9 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex()
coord_list[1] = coord[1]; coord_list[1] = coord[1];
coord_list[2] = coord[2]; coord_list[2] = coord[2];
if( (coord[0] == coord[1]) || if( (coord[0] == coord[1])
(coord[0] == coord[2]) || || (coord[0] == coord[2])
(coord[2] == coord[1]) ) || (coord[2] == coord[1]) )
{ {
// DBG( printf( " invalid coordIndex at index %lu (%d, %d, %d, %d)\n", m_model->m_CoordIndex.size()+1,coord[0], coord[1], coord[2], dummy ) ); // DBG( printf( " invalid coordIndex at index %lu (%d, %d, %d, %d)\n", m_model->m_CoordIndex.size()+1,coord[0], coord[1], coord[2], dummy ) );
} }
@ -428,6 +432,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_coordIndex()
{ {
// DBG( printf( " Error at index %lu, -1 Expected, got %d\n", m_model->m_CoordIndex.size()+1, dummy ) ); // DBG( printf( " Error at index %lu, -1 Expected, got %d\n", m_model->m_CoordIndex.size()+1, dummy ) );
} }
m_model->m_CoordIndex.push_back( coord_list ); m_model->m_CoordIndex.push_back( coord_list );
} }
@ -444,6 +449,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet_materialIndex()
m_model->m_MaterialIndex.clear(); m_model->m_MaterialIndex.clear();
int index; int index;
while( fscanf( m_file, "%d,", &index ) ) while( fscanf( m_file, "%d,", &index ) )
{ {
m_model->m_MaterialIndex.push_back( index ); m_model->m_MaterialIndex.push_back( index );

View File

@ -98,7 +98,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) ) if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) )
{ {
continue; continue;
@ -110,7 +109,6 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
childs.push_back( m_model ); childs.push_back( m_model );
read_Transform(); read_Transform();
} }
else if( strcmp( text, "DEF" ) == 0 ) else if( strcmp( text, "DEF" ) == 0 )
{ {
@ -149,11 +147,13 @@ int VRML2_MODEL_PARSER::read_Transform()
{ {
continue; continue;
} }
if( ( *text == '}' ) ) if( ( *text == '}' ) )
{ {
// DBG( printf( " } Exit Transform\n" ) ); // DBG( printf( " } Exit Transform\n" ) );
break; break;
} }
if( strcmp( text, "translation" ) == 0 ) if( strcmp( text, "translation" ) == 0 )
{ {
parseVertex( m_file, m_model->m_translation ); parseVertex( m_file, m_model->m_translation );
@ -210,6 +210,7 @@ int VRML2_MODEL_PARSER::read_Transform()
else if( strcmp( text, "whichChoice" ) == 0 ) else if( strcmp( text, "whichChoice" ) == 0 )
{ {
int dummy; int dummy;
if( fscanf( m_file, "%d", &dummy ) != 1 ) if( fscanf( m_file, "%d", &dummy ) != 1 )
{ {
// !TODO: log errors // !TODO: log errors
@ -236,7 +237,6 @@ int VRML2_MODEL_PARSER::read_Transform()
read_Shape(); read_Shape();
m_model = parent; m_model = parent;
} }
else if( strcmp( text, "DEF" ) == 0 ) else if( strcmp( text, "DEF" ) == 0 )
{ {
@ -244,10 +244,11 @@ int VRML2_MODEL_PARSER::read_Transform()
} }
else else
{ {
DBG( printf( " %s NotImplemented\n", text ) ); // DBG( printf( " %s NotImplemented\n", text ) );
read_NotImplemented( m_file, '}' ); read_NotImplemented( m_file, '}' );
} }
} }
return 0; return 0;
} }
@ -276,7 +277,8 @@ int VRML2_MODEL_PARSER::read_DEF()
if( strcmp( text, "Transform" ) == 0 ) if( strcmp( text, "Transform" ) == 0 )
{ {
return read_Transform(); return read_Transform();
} else if( strcmp( text, "children" ) == 0 ) }
else if( strcmp( text, "children" ) == 0 )
{ {
// skip // skip
} }
@ -304,7 +306,7 @@ int VRML2_MODEL_PARSER::read_DEF()
} }
} }
DBG( printf( " DEF failed\n" ) ); // DBG( printf( " DEF failed\n" ) );
return -1; return -1;
} }
@ -346,12 +348,12 @@ int VRML2_MODEL_PARSER::read_Shape()
} }
else else
{ {
DBG( printf( " %s NotImplemented\n", text ) ); // DBG( printf( " %s NotImplemented\n", text ) );
read_NotImplemented( m_file, '}' ); read_NotImplemented( m_file, '}' );
} }
} }
DBG( printf( " Shape failed\n") ); // DBG( printf( " Shape failed\n" ) );
return -1; return -1;
} }
@ -380,7 +382,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
} }
} }
DBG( printf( " Appearance failed\n") ); // DBG( printf( " Appearance failed\n" ) );
return -1; return -1;
} }
@ -449,12 +451,13 @@ int VRML2_MODEL_PARSER::read_material()
return 0; return 0;
} }
} }
DBG( printf( " read_material error: material not found\n" ) ); DBG( printf( " read_material error: material not found\n" ) );
} }
} }
} }
DBG( printf( " failed material\n") ); // DBG( printf( " failed material\n" ) );
return -1; return -1;
} }
@ -484,10 +487,12 @@ int VRML2_MODEL_PARSER::read_Material()
parseVertex( m_file, vertex ); parseVertex( m_file, vertex );
// DBG( printf( "\n") ); // DBG( printf( "\n") );
m_model->m_Materials->m_DiffuseColor.push_back( vertex ); m_model->m_Materials->m_DiffuseColor.push_back( vertex );
} else if( strcmp( text, "emissiveColor" ) == 0 ) }
else if( strcmp( text, "emissiveColor" ) == 0 )
{ {
// DBG( printf( " emissiveColor") ); // DBG( printf( " emissiveColor") );
parseVertex( m_file, vertex ); parseVertex( m_file, vertex );
// DBG( printf( "\n") ); // DBG( printf( "\n") );
if( GetMaster()->m_use_modelfile_emissiveColor == true ) if( GetMaster()->m_use_modelfile_emissiveColor == true )
{ {
@ -513,7 +518,8 @@ int VRML2_MODEL_PARSER::read_Material()
if( GetMaster()->m_use_modelfile_ambientIntensity == true ) if( GetMaster()->m_use_modelfile_ambientIntensity == true )
{ {
m_model->m_Materials->m_AmbientColor.push_back( glm::vec3( ambientIntensity, ambientIntensity, ambientIntensity ) ); m_model->m_Materials->m_AmbientColor.push_back( glm::vec3( ambientIntensity,
ambientIntensity, ambientIntensity ) );
} }
} }
else if( strcmp( text, "transparency" ) == 0 ) else if( strcmp( text, "transparency" ) == 0 )
@ -542,7 +548,7 @@ int VRML2_MODEL_PARSER::read_Material()
} }
} }
DBG( printf( " Material failed\n") ); // DBG( printf( " Material failed\n" ) );
return -1; return -1;
} }
@ -583,6 +589,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
else if( strcmp( text, "colorPerVertex" ) == 0 ) else if( strcmp( text, "colorPerVertex" ) == 0 )
{ {
GetNextTag( m_file, text ); GetNextTag( m_file, text );
if( strcmp( text, "TRUE" ) ) if( strcmp( text, "TRUE" ) )
{ {
// DBG( printf( " colorPerVertex = true\n") ); // DBG( printf( " colorPerVertex = true\n") );
@ -592,7 +599,6 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{ {
colorPerVertex = false; colorPerVertex = false;
} }
} }
else if( strcmp( text, "Coordinate" ) == 0 ) else if( strcmp( text, "Coordinate" ) == 0 )
{ {
@ -618,10 +624,9 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
{ {
read_colorIndex(); read_colorIndex();
} }
} }
DBG( printf( " IndexedFaceSet failed %s\n", text) ); // DBG( printf( " IndexedFaceSet failed %s\n", text ) );
return -1; return -1;
} }
@ -636,6 +641,7 @@ int VRML2_MODEL_PARSER::read_colorIndex()
{ {
int index; int index;
int first_index; int first_index;
while( fscanf( m_file, "%d, ", &index ) ) while( fscanf( m_file, "%d, ", &index ) )
{ {
if( index == -1 ) if( index == -1 )
@ -677,6 +683,7 @@ int VRML2_MODEL_PARSER::read_NormalIndex()
std::vector<int> coord_list; std::vector<int> coord_list;
coord_list.clear(); coord_list.clear();
while( fscanf( m_file, "%d, ", &dummy ) == 1 ) while( fscanf( m_file, "%d, ", &dummy ) == 1 )
{ {
if( dummy == -1 ) if( dummy == -1 )
@ -710,6 +717,7 @@ int VRML2_MODEL_PARSER::read_coordIndex()
std::vector<int> coord_list; std::vector<int> coord_list;
coord_list.clear(); coord_list.clear();
while( fscanf( m_file, "%d, ", &dummy ) == 1 ) while( fscanf( m_file, "%d, ", &dummy ) == 1 )
{ {
if( dummy == -1 ) if( dummy == -1 )
@ -761,8 +769,6 @@ int VRML2_MODEL_PARSER::read_Color()
} }
int VRML2_MODEL_PARSER::read_Normal() int VRML2_MODEL_PARSER::read_Normal()
{ {
char text[128]; char text[128];
@ -828,4 +834,3 @@ int VRML2_MODEL_PARSER::read_Coordinate()
return -1; return -1;
} }

View File

@ -79,6 +79,7 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
return; return;
} }
fclose( file ); fclose( file );
@ -97,5 +98,5 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
return; return;
} }
DBG( printf( "Unknown VRML file format: %s\n", line ) ); // DBG( printf( "Unknown VRML file format: %s\n", line ) );
} }

View File

@ -43,11 +43,13 @@
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) : X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster ) S3D_MODEL_PARSER( aMaster )
{} {
}
X3D_MODEL_PARSER::~X3D_MODEL_PARSER() X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
{} {
}
void X3D_MODEL_PARSER::Load( const wxString aFilename ) void X3D_MODEL_PARSER::Load( const wxString aFilename )
@ -197,11 +199,13 @@ void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps
} }
} }
/* Private ----- */ /* Private ----- */
void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode ) void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
{ {
NODE_LIST childnodes; NODE_LIST childnodes;
GetChildsByName( aTransformNode, wxT( "Material" ), childnodes ); GetChildsByName( aTransformNode, wxT( "Material" ), childnodes );
for( NODE_LIST::iterator node = childnodes.begin(); for( NODE_LIST::iterator node = childnodes.begin();
@ -234,6 +238,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
glm::vec3 color; glm::vec3 color;
PROPERTY_MAP properties; PROPERTY_MAP properties;
GetNodeProperties( aMatNode, properties ); GetNodeProperties( aMatNode, properties );
// DEFine new Material named as value of DEF // DEFine new Material named as value of DEF
@ -246,10 +251,9 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
m_model->m_Materials = material; m_model->m_Materials = material;
if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], color ) )
color ) )
{ {
DBG( printf("diffuseColor parsing error") ); // DBG( printf( "diffuseColor parsing error" ) );
} }
else else
{ {
@ -258,7 +262,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ], color ) ) if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ], color ) )
{ {
DBG( printf("specularColor parsing error") ); // DBG( printf( "specularColor parsing error" ) );
} }
else else
{ {
@ -267,7 +271,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ], color ) ) if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ], color ) )
{ {
DBG( printf("emissiveColor parsing error") ); // DBG( printf( "emissiveColor parsing error" ) );
} }
else else
{ {
@ -283,7 +287,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
} }
else else
{ {
DBG( printf( "ambienterror" ) ); // DBG( printf( "ambienterror" ) );
} }
values.SetString( properties[ wxT( "shininess" ) ] ); values.SetString( properties[ wxT( "shininess" ) ] );
@ -296,7 +300,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
} }
else else
{ {
DBG( printf( "shininess error" ) ); // DBG( printf( "shininess error" ) );
} }
values.SetString( properties[ wxT( "transparency" ) ] ); values.SetString( properties[ wxT( "transparency" ) ] );
@ -307,7 +311,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
} }
else else
{ {
DBG( printf( "trans error") ); // DBG( printf( "trans error" ) );
} }
// VRML // VRML
@ -321,7 +325,6 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
vrml_materials.push_back( vrml_material ); vrml_materials.push_back( vrml_material );
} }
// USE existing material named by value of USE // USE existing material named by value of USE
else if( properties.find( wxT( "USE" ) ) != properties.end() ) else if( properties.find( wxT( "USE" ) ) != properties.end() )
{ {
@ -366,7 +369,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
} }
} }
DBG( printf( "ReadMaterial error: material not found\n" ) ); // DBG( printf( "ReadMaterial error: material not found\n" ) );
} }
} }
@ -378,9 +381,9 @@ bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData,
double x, y, z; double x, y, z;
bool ret = tokens.GetNextToken().ToDouble( &x ) && bool ret = tokens.GetNextToken().ToDouble( &x )
tokens.GetNextToken().ToDouble( &y ) && && tokens.GetNextToken().ToDouble( &y )
tokens.GetNextToken().ToDouble( &z ); && tokens.GetNextToken().ToDouble( &z );
aResult.x = x; aResult.x = x;
aResult.y = y; aResult.y = y;
@ -430,6 +433,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
* --------------------------- */ * --------------------------- */
S3D_VERTEX translation; S3D_VERTEX translation;
parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], translation ); parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], translation );
S3D_VERTEX scale; S3D_VERTEX scale;
@ -440,12 +444,13 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
wxStringTokenizer tokens( aTransformProps[ wxT( "rotation" ) ] ); wxStringTokenizer tokens( aTransformProps[ wxT( "rotation" ) ] );
double x, y, z; double x, y, z;
if( !(tokens.GetNextToken().ToDouble( &x ) &&
tokens.GetNextToken().ToDouble( &y ) && if( !( tokens.GetNextToken().ToDouble( &x )
tokens.GetNextToken().ToDouble( &z ) && && tokens.GetNextToken().ToDouble( &y )
tokens.GetNextToken().ToDouble( &angle ) ) ) && tokens.GetNextToken().ToDouble( &z )
&& tokens.GetNextToken().ToDouble( &angle ) ) )
{ {
DBG( printf("rotation read error") ); // DBG( printf( "rotation read error" ) );
} }
else else
{ {
@ -482,7 +487,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
if( points.size() % 3 != 0 ) if( points.size() % 3 != 0 )
{ {
DBG( printf( "Number of points is incorrect" ) ); // DBG( printf( "Number of points is incorrect" ) );
return; return;
} }
@ -549,13 +554,14 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
if( color_points.size() % 3 != 0 ) if( color_points.size() % 3 != 0 )
{ {
DBG( printf( "Number of points is incorrect" ) ); // DBG( printf( "Number of points is incorrect" ) );
return; return;
} }
/* Create 3D face color from 3 color points /* Create 3D face color from 3 color points
*/ */
m_model->m_Materials->m_DiffuseColor.clear(); m_model->m_Materials->m_DiffuseColor.clear();
for( unsigned id = 0; id < color_points.size() / 3; id++ ) for( unsigned id = 0; id < color_points.size() / 3; id++ )
{ {
m_model->m_MaterialIndex.push_back( id ); m_model->m_MaterialIndex.push_back( id );