3D viewer: Commit patch to enable the rendering of wrl files generated with Meshlab. See https://bugs.launchpad.net/kicad/+bug/804778

This commit is contained in:
unknown 2014-04-27 15:49:41 +02:00 committed by jean-pierre charras
parent 834699accb
commit 4456840a1f
1 changed files with 26 additions and 3 deletions

View File

@ -4,7 +4,7 @@
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com> * Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -71,7 +71,7 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
if ( text == NULL ) if ( text == NULL )
continue; continue;
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 ) if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Transform" ) == 0 || stricmp( text, "Group" ) == 0 )
{ {
while( GetLine( file, line, &LineNum, 512 ) ) while( GetLine( file, line, &LineNum, 512 ) )
{ {
@ -121,7 +121,7 @@ int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
return 0; return 0;
} }
if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0) if( stricmp( command, "DEF" ) == 0 || stricmp( command,"Transform" ) == 0 || stricmp( command, "Material") == 0)
{ {
material = new S3D_MATERIAL( GetMaster(), mat_name ); material = new S3D_MATERIAL( GetMaster(), mat_name );
@ -197,6 +197,9 @@ int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
{ {
text = strtok( line, sep_chars ); text = strtok( line, sep_chars );
if( *text == '[' )
continue;
if( *text == ']' ) if( *text == ']' )
return 0; return 0;
@ -233,6 +236,11 @@ int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
break; break;
} }
if( *text == '{' )
{
continue;
}
if( stricmp( text, "appearance" ) == 0 ) if( stricmp( text, "appearance" ) == 0 )
{ {
readAppearance( file, LineNum ); readAppearance( file, LineNum );
@ -267,6 +275,11 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
break; break;
} }
if( *text == '{' )
{
continue;
}
if( stricmp( text, "material" ) == 0 ) if( stricmp( text, "material" ) == 0 )
{ {
readMaterial( file, LineNum ); readMaterial( file, LineNum );
@ -380,6 +393,16 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
break; break;
} }
if( stricmp( text, "creaseAngle" ) == 0 )
{
continue;
}
if( *text == '{' )
{
continue;
}
if( stricmp( text, "normalPerVertex" ) == 0 ) if( stricmp( text, "normalPerVertex" ) == 0 )
{ {
text = strtok( NULL, " ,\t\n\r" ); text = strtok( NULL, " ,\t\n\r" );