Commit 4456840a authored by unknown's avatar unknown Committed by jean-pierre charras
Browse files

3D viewer: Commit patch to enable the rendering of wrl files generated with...

3D viewer: Commit patch to enable the rendering of wrl files generated with Meshlab. See https://bugs.launchpad.net/kicad/+bug/804778
parent 834699ac
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 * Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
 * Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
 * 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
 * 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 )
            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 ) )
            {
@@ -121,7 +121,7 @@ int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
        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 );

@@ -197,6 +197,9 @@ int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
    {
        text = strtok( line, sep_chars );

        if( *text == '[' )
            continue;

        if( *text == ']' )
            return 0;

@@ -233,6 +236,11 @@ int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
            break;
        }

        if( *text == '{' )
            {
                continue;
            }

        if( stricmp( text, "appearance" ) == 0 )
        {
            readAppearance( file, LineNum );
@@ -267,6 +275,11 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
            break;
        }

        if( *text == '{' )
            {
                continue;
            }

        if( stricmp( text, "material" ) == 0 )
        {
            readMaterial( file, LineNum );
@@ -380,6 +393,16 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
            break;
        }

        if( stricmp( text, "creaseAngle" ) == 0 )
        {
            continue;
        }

        if( *text == '{' )
        {
            continue;
        }

        if( stricmp( text, "normalPerVertex" ) == 0 )
        {
            text = strtok( NULL, " ,\t\n\r" );