Added beginnings of VRML parser
This commit is contained in:
parent
fb4b48f35b
commit
e13dade517
|
@ -1 +1,2 @@
|
|||
add_subdirectory( idf )
|
||||
add_subdirectory( vrml )
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/v2 )
|
||||
|
||||
add_library( s3d_plugin_vrml MODULE
|
||||
vrml.cpp
|
||||
v2/wrlproc.cpp
|
||||
# v2/vrml2_node.cpp
|
||||
# v2/vrml2_base.cpp
|
||||
)
|
||||
|
||||
target_link_libraries( s3d_plugin_vrml kicad_3dsg ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} )
|
||||
|
||||
install( TARGETS
|
||||
s3d_plugin_vrml
|
||||
DESTINATION ${KICAD_USER_PLUGIN}/3d
|
||||
COMPONENT binary
|
||||
)
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "vrml2_base.h"
|
||||
#include "vrml2_helpers.h"
|
||||
|
||||
|
||||
WRL2BASE::WRL2BASE( WRL2NODE* aParent ) : WRL2NODE()
|
||||
{
|
||||
m_Type = V2_BASE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2BASE::~WRL2BASE()
|
||||
{
|
||||
std::list< WRL2NODE* >::iterator sC = m_Children.begin();
|
||||
std::list< WRL2NODE* >::iterator eC = m_Children.end();
|
||||
|
||||
while( sC != eC )
|
||||
{
|
||||
(*sC)->SetParent( NULL );
|
||||
delete (*sC);
|
||||
++sC;
|
||||
}
|
||||
|
||||
sC.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// functions inherited from WRL2NODE
|
||||
bool WRL2BASE::SetParent( WRL2NODE* aParent )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] attempting to extract name from virtual base node\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
WRL2NODE* WRL2BASE::FindNode( const char *aNodeName, const WRL2NODE *aCaller )
|
||||
{
|
||||
if( NULL == aNodeName || 0 == aNodeName[0] )
|
||||
return NULL;
|
||||
|
||||
if( !m_Name.compare( aNodeName ) )
|
||||
return this;
|
||||
|
||||
FIND_NODE( aNodeName, m_Children, this );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2BASE::AddRefNode( WRL2NODE* aNode )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] attempting to add reference node to WRL2BASE\n";
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2BASE::AddChildNode( WRL2NODE* aNode )
|
||||
{
|
||||
if( aNode->GetNodeType() == WRL2_BASE )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] attempting to add a base node to another base node\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
std::list< WRL2NODE* >::iterator sC = m_Children.begin();
|
||||
std::list< WRL2NODE* >::iterator eC = m_Children.end();
|
||||
|
||||
while( sC != eC )
|
||||
{
|
||||
if( *sC == aNode )
|
||||
return false;
|
||||
}
|
||||
|
||||
aNode->SetParent( this );
|
||||
m_Children.push_back( aNode );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const char* WRL2BASE::GetName( void )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] attempting to extract name from virtual base node\n";
|
||||
#endif
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2BASE::SetName(const char *aName)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] attempting to set name on virtual base node\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2BASE::Read( WRLPROC& proc )
|
||||
{
|
||||
if( proc.GetVRMLType() != VRML_V2 )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [INFO] no open file or file is not a VRML2 file\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string glob;
|
||||
|
||||
while( proc.ReadGlob( glob ) )
|
||||
{
|
||||
// XXX - Process node name
|
||||
|
||||
|
||||
xxx;
|
||||
} while( !glob.empty() );
|
||||
|
||||
|
||||
// XXX -
|
||||
#warning TO BE IMPLEMENTED
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrmlv2_node.h
|
||||
* defines the base class for VRML2.0 nodes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Notes on deleting unsupported entities:
|
||||
* 1. PROTO: PROTO ProtoName [parameter list] {body}
|
||||
* the parameter list will always have '[]'. So the items
|
||||
* to delete are: String, List, Body
|
||||
* 2. EXTERNPROTO: EXTERNPROTO extern protoname [] MFstring
|
||||
* delete: string, string, string, list, list
|
||||
* 3. Unsupported node types: NodeName (Optional DEF RefName) {body}
|
||||
* This scheme should also apply to PROTO'd node types.
|
||||
* 4. ROUTE: ROUTE nodename1.event to nodename2.event
|
||||
* Delete a String 3 times
|
||||
* 5. Script: Script { ... }
|
||||
*/
|
||||
|
||||
#ifndef VRML2_BASE_H
|
||||
#define VRML2_BASE_H
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "vrml2_node.h"
|
||||
|
||||
|
||||
/**
|
||||
* Class WRL2BASE
|
||||
* represents the top node of a VRML2 model
|
||||
*/
|
||||
class WRL2BASE : public WRL2NODE
|
||||
{
|
||||
protected:
|
||||
std::list< WRL2NODE* > m_Children; // nodes owned by this node
|
||||
|
||||
public:
|
||||
|
||||
// functions inherited from WRL2NODE
|
||||
void unlinkChildNode( const WRL2NODE* aNode );
|
||||
void unlinkRefNode( const WRL2NODE* aNode );
|
||||
|
||||
public:
|
||||
WRL2BASE();
|
||||
virtual ~WRL2BASE();
|
||||
|
||||
// overrides
|
||||
virtual const char* GetName( void );
|
||||
virtual bool SetName(const char *aName);
|
||||
|
||||
// functions inherited from WRL2NODE
|
||||
bool Read( WRLPROC& proc );
|
||||
bool SetParent( WRL2NODE* aParent );
|
||||
WRL2NODE* FindNode( const char *aNodeName, const WRL2NODE *aCaller );
|
||||
bool AddRefNode( WRL2NODE* aNode );
|
||||
bool AddChildNode( WRL2NODE* aNode );
|
||||
};
|
||||
|
||||
#endif // VRML2_BASE_H
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrml2_helpers.h
|
||||
* helper functions for VRML2 processing
|
||||
*/
|
||||
|
||||
#ifndef VRML2_HELPERS_H
|
||||
#define VRML2_HELPERS_H
|
||||
|
||||
|
||||
// Function to find a node object given a (non-unique) node name
|
||||
#define FIND_NODE( aName, aNodeList, aCallingNode ) do { \
|
||||
std::vector< aType* >::iterator sLA = aNodeList.begin(); \
|
||||
std::vector< aType* >::iterator eLA = aNodeList.end(); \
|
||||
WRL2NODE* psg = NULL; \
|
||||
while( sLA != eLA ) { \
|
||||
if( (WRL2NODE*)*sLA != aCallingNode ) { \
|
||||
psg = (WRL2NODE*) (*sLA)->FindNode( aName, this ); \
|
||||
if( NULL != psg) \
|
||||
return psg; \
|
||||
} \
|
||||
++sLA; \
|
||||
} } while ( 0 )
|
||||
|
||||
#endif // VRML2_HELPERS_H
|
|
@ -0,0 +1,255 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <cctype>
|
||||
#include "vrml2_node.h"
|
||||
|
||||
|
||||
|
||||
static std::set< std::string > badNames;
|
||||
|
||||
typedef std::pair< std::string, WRLNODES > NODEITEM;
|
||||
typedef std::map< std::string, WRLNODES > NODEMAP;
|
||||
static NODEMAP nodenames;
|
||||
|
||||
|
||||
WRL2NODE::WRL2NODE()
|
||||
{
|
||||
m_Parent = NULL;
|
||||
m_Type = V2_END;
|
||||
|
||||
if( badNames.empty() )
|
||||
{
|
||||
badNames.insert( "DEF" );
|
||||
badNames.insert( "EXTERNPROTO" );
|
||||
badNames.insert( "FALSE" );
|
||||
badNames.insert( "IS" );
|
||||
badNames.insert( "NULL" );
|
||||
badNames.insert( "PROTO" );
|
||||
badNames.insert( "ROUTE" );
|
||||
badNames.insert( "TO" );
|
||||
badNames.insert( "TRUE" );
|
||||
badNames.insert( "USE" );
|
||||
badNames.insert( "eventIn" );
|
||||
badNames.insert( "eventOut" );
|
||||
badNames.insert( "exposedField" );
|
||||
badNames.insert( "field" );
|
||||
}
|
||||
|
||||
if( nodenames.empty() )
|
||||
{
|
||||
node_names.insert( NODEITEM( "Anchor", WRL2_ANCHOR ) );
|
||||
node_names.insert( NODEITEM( "Appearance", WRL2_APPEARANCE ) );
|
||||
node_names.insert( NODEITEM( "Audioclip", WRL2_AUDIOCLIP );
|
||||
node_names.insert( NODEITEM( "Background", WRL2_BACKGROUND ) );
|
||||
node_names.insert( NODEITEM( "Billboard", WRL2_BILLBOARD ) );
|
||||
node_names.insert( NODEITEM( "Box", WRL2_BOX ) );
|
||||
node_names.insert( NODEITEM( "Collision", WRL2_COLLISION ) );
|
||||
node_names.insert( NODEITEM( "Color", WRL2_COLOR ) );
|
||||
node_names.insert( NODEITEM( "ColorInterpolator", WRL2_COLORINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "Cone", WRL2_CONE ) );
|
||||
node_names.insert( NODEITEM( "Coordinate", WRL2_COORDINATE ) );
|
||||
node_names.insert( NODEITEM( "CoordinateInterpolator", WRL2_COORDINATEINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "Cylinder", WRL2_CYLINDER ) );
|
||||
node_names.insert( NODEITEM( "CylinderSensor", WRL2_CYLINDERSENSOR ) );
|
||||
node_names.insert( NODEITEM( "DirectionalLight", WRL2_DIRECTIONALLIGHT ) );
|
||||
node_names.insert( NODEITEM( "ElevationGrid", WRL2_ELEVATIONGRID ) );
|
||||
node_names.insert( NODEITEM( "Extrusion", WRL2_EXTRUSION ) );
|
||||
node_names.insert( NODEITEM( "Fog", WRL2_FOG ) );
|
||||
node_names.insert( NODEITEM( "FontStyle", WRL2_FONTSTYLE ) );
|
||||
node_names.insert( NODEITEM( "Group", WRL2_GROUP ) );
|
||||
node_names.insert( NODEITEM( "ImageTexture", WRL2_IMAGETEXTURE ) );
|
||||
node_names.insert( NODEITEM( "IndexedFaceSet", WRL2_INDEXEDFACESET ) );
|
||||
node_names.insert( NODEITEM( "IndexedLineSet", WRL2_INDEXEDLINESET ) );
|
||||
node_names.insert( NODEITEM( "Inline", WRL2_INLINE ) );
|
||||
node_names.insert( NODEITEM( "LOD", WRL2_LOD ) );
|
||||
node_names.insert( NODEITEM( "Material", WRL2_MATERIAL ) );
|
||||
node_names.insert( NODEITEM( "MovieTexture", WRL2_MOVIETEXTURE ) );
|
||||
node_names.insert( NODEITEM( "NavigationInfo", WRL2_NAVIGATIONINFO ) );
|
||||
node_names.insert( NODEITEM( "Normal", WRL2_NORMAL ) );
|
||||
node_names.insert( NODEITEM( "NormalInterpolator", WRL2_NORMALINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "OrientationInterpolator", WRL2_ORIENTATIONINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "PixelTexture", WRL2_PIXELTEXTURE ) );
|
||||
node_names.insert( NODEITEM( "PlaneSensor", WRL2_PLANESENSOR ) );
|
||||
node_names.insert( NODEITEM( "PointLight", WRL2_POINTLIGHT ) );
|
||||
node_names.insert( NODEITEM( "PointSet", WRL2_POINTSET ) );
|
||||
node_names.insert( NODEITEM( "PositionInterpolator", WRL2_POSITIONINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "ProximitySensor", WRL2_PROXIMITYSENSOR ) );
|
||||
node_names.insert( NODEITEM( "ScalarInterpolator", WRL2_SCALARINTERPOLATOR ) );
|
||||
node_names.insert( NODEITEM( "Script", WRL2_SCRIPT ) );
|
||||
node_names.insert( NODEITEM( "Shape", WRL2_SHAPE ) );
|
||||
node_names.insert( NODEITEM( "Sound", WRL2_SOUND ) );
|
||||
node_names.insert( NODEITEM( "Sphere", WRL2_SPHERE ) );
|
||||
node_names.insert( NODEITEM( "SphereSensor", WRL2_SPHERESENSOR ) );
|
||||
node_names.insert( NODEITEM( "SpotLight", WRL2_SPOTLIGHT ) );
|
||||
node_names.insert( NODEITEM( "Switch", WRL2_SWITCH ) );
|
||||
node_names.insert( NODEITEM( "Text", WRL2_TEXT ) );
|
||||
node_names.insert( NODEITEM( "TextureCoordinate", WRL2_TEXTURECOORDINATE ) );
|
||||
node_names.insert( NODEITEM( "TextureTransform", WRL2_TEXTURETRANSFORM ) );
|
||||
node_names.insert( NODEITEM( "TimeSensor", WRL2_TIMESENSOR ) );
|
||||
node_names.insert( NODEITEM( "TouchSensor", WRL2_TOUCHSENSOR ) );
|
||||
node_names.insert( NODEITEM( "Transform", WRL2_TRANSFORM ) );
|
||||
node_names.insert( NODEITEM( "ViewPoint", WRL2_VIEWPOINT ) );
|
||||
node_names.insert( NODEITEM( "VisibilitySensor", WRL2_VISIBILITYSENSOR ) );
|
||||
node_names.insert( NODEITEM( "WorldInfo", WRL2_WORLDINFO ) );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2NODE::~WRL2NODE()
|
||||
{
|
||||
std::list< WRL2NODE* > m_BackPointers; // nodes which hold a reference to this
|
||||
std::list< WRL2NODE* > m_Children; // nodes owned by this node
|
||||
std::list< WRL2NODE* > m_References; // nodes not owned but referenced by this node
|
||||
|
||||
if( m_Parent )
|
||||
m_Parent->unlinkChildNode( this );
|
||||
|
||||
std::list< WRL2NODE* >::iterator sBP = m_BackPointers.begin();
|
||||
std::list< WRL2NODE* >::iterator eBP = m_BackPointers.end();
|
||||
|
||||
while( sBP != eBP )
|
||||
{
|
||||
(*sBP)->unlinkRefNode( this );
|
||||
++sBP;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2NODE::addNodeRef( WRL2NODE* aNode )
|
||||
{
|
||||
std::list< WRL2NODE* >::iterator np =
|
||||
std::find( m_BackPointers.begin(), m_BackPointers.end(), aNode );
|
||||
|
||||
if( np != m_BackPointers.end() )
|
||||
return;
|
||||
|
||||
m_BackPointers.push_back( aNode );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void WRL2NODE::delNodeRef( WRL2NODE* aNode )
|
||||
{
|
||||
std::list< WRL2NODE* >::iterator np =
|
||||
std::find( m_BackPointers.begin(), m_BackPointers.end(), aNode );
|
||||
|
||||
if( np != m_BackPointers.end() )
|
||||
{
|
||||
m_BackPointers.erase( np );
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [BUG] delNodeRef() did not find its target\n";
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WRL2TYPES WRL2NODE::GetNodeType( void ) const
|
||||
{
|
||||
return m_Type;
|
||||
}
|
||||
|
||||
|
||||
WRL2NODE* WRL2NODE::GetParent( void )
|
||||
{
|
||||
return m_Parent;
|
||||
}
|
||||
|
||||
|
||||
const char* WRL2NODE::GetName( void )
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
|
||||
|
||||
bool WRL2NODE::SetName(const char *aName)
|
||||
{
|
||||
if( NULL == aName || '\0' == aName[0] )
|
||||
{
|
||||
m_Name.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::set< std::string >::iterator item = badNames.find( aName );
|
||||
|
||||
if( item != badNames.end() )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [INFO] invalid node name '" << *item << "' (matches restricted word)\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if( isdigit( aName[0] ) )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [INFO] invalid node name '" << *item << "' (begins with digit)\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string tmpstr( aName );
|
||||
#define BAD_CHARS1 "\"\'#+,-.\\[]{}\x00\x01\x02\x03\x04\x05\x06\x09\x0A\x0B\x0C\x0D\x0E\x0F"
|
||||
#define BAD_CHARS2 "\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"
|
||||
|
||||
if( std::string::npos != tmpstr.find_first_of( BAD_CHARS1 )
|
||||
|| std::string::npos != tmpstr.find_first_of( BAD_CHARS2 ) )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
|
||||
std::cerr << " * [INFO] invalid node name '" << *item;
|
||||
std::cerr<< "' (contains invalid character)\n";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Name = aName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const char* WRL2NODE::GetNodeTypeName( WRL::V2TYPES aNodeType ) const
|
||||
{
|
||||
if( aNodeType < WRL2_BEGIN || aNodeType >= WRL2_END )
|
||||
return NULL;
|
||||
|
||||
return nodenames[aNodeType]->first.c_str();
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file vrmlv2_node.h
|
||||
* defines the base class for VRML2.0 nodes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Notes on deleting unsupported entities:
|
||||
* 1. PROTO: PROTO ProtoName [parameter list] {body}
|
||||
* the parameter list will always have '[]'. So the items
|
||||
* to delete are: String, List, Body
|
||||
* 2. EXTERNPROTO: EXTERNPROTO extern protoname [] MFstring
|
||||
* delete: string, string, string, list, list
|
||||
* 3. Unsupported node types: NodeName (Optional DEF RefName) {body}
|
||||
* This scheme should also apply to PROTO'd node types.
|
||||
* 4. ROUTE: ROUTE nodename1.event to nodename2.event
|
||||
* Delete a String 3 times
|
||||
* 5. Script: Script { ... }
|
||||
*/
|
||||
|
||||
#ifndef VRML2_NODE_H
|
||||
#define VRML2_NODE_H
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "wrlproc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Class WRL2NODE
|
||||
* represents the base class of all VRML2 nodes
|
||||
*/
|
||||
class WRL2NODE
|
||||
{
|
||||
protected:
|
||||
WRL2NODE* m_Parent; // pointer to parent node; may be NULL for top level node
|
||||
WRL2TYPES m_Type; // type of VRML node
|
||||
std::string m_Name; // name to use for referencing the node by name
|
||||
|
||||
std::list< WRL2NODE* > m_BackPointers; // nodes which hold a reference to this
|
||||
|
||||
public:
|
||||
/**
|
||||
* Function unlinkChild
|
||||
* removes references to an owned child; it is invoked by the child upon destruction
|
||||
* to ensure that the parent has no invalid references.
|
||||
*
|
||||
* @param aNode is the child which is being deleted
|
||||
*/
|
||||
virtual void unlinkChildNode( const WRL2NODE* aNode ) = 0;
|
||||
|
||||
/**
|
||||
* Function unlinkRef
|
||||
* removes pointers to a referenced node; it is invoked by the referenced node
|
||||
* upon destruction to ensure that the referring node has no invalid references.
|
||||
*
|
||||
* @param aNode is the node which is being deleted
|
||||
*/
|
||||
virtual void unlinkRefNode( const WRL2NODE* aNode ) = 0;
|
||||
|
||||
/**
|
||||
* Function addNodeRef
|
||||
* adds a pointer to a node which references, but does not own, this node.
|
||||
* Such back-pointers are required to ensure that invalidated references
|
||||
* are removed when a node is deleted
|
||||
*
|
||||
* @param aNode is the node holding a reference to this object
|
||||
*/
|
||||
void addNodeRef( WRL2NODE* aNode );
|
||||
|
||||
/**
|
||||
* Function delNodeRef
|
||||
* removes a pointer to a node which references, but does not own, this node.
|
||||
*
|
||||
* @param aNode is the node holding a reference to this object
|
||||
*/
|
||||
void delNodeRef( WRL2NODE* aNode );
|
||||
|
||||
public:
|
||||
WRL2NODE();
|
||||
virtual ~WRL2NODE();
|
||||
|
||||
// read data via the given file processor
|
||||
virtual bool Read( WRLPROC& proc ) = 0;
|
||||
|
||||
/**
|
||||
* Function GetNodeType
|
||||
* returns the type of this node instance
|
||||
*/
|
||||
WRL2TYPES GetNodeType( void ) const;
|
||||
|
||||
/**
|
||||
* Function GetParent
|
||||
* returns a pointer to the parent SGNODE of this object
|
||||
* or NULL if the object has no parent (ie. top level transform)
|
||||
*/
|
||||
WRL2NODE* GetParent( void );
|
||||
|
||||
/**
|
||||
* Function SetParent
|
||||
* sets the parent WRL2NODE of this object.
|
||||
*
|
||||
* @param aParent [in] is the desired parent node
|
||||
* @return true if the operation succeeds; false if
|
||||
* the given node is not allowed to be a parent to
|
||||
* the derived object.
|
||||
*/
|
||||
virtual bool SetParent( WRL2NODE* aParent ) = 0;
|
||||
|
||||
virtual const char* GetName( void );
|
||||
virtual bool SetName(const char *aName);
|
||||
|
||||
const char * GetNodeTypeName( WRL::V2TYPES aNodeType ) const;
|
||||
|
||||
/**
|
||||
* Function FindNode searches the tree of linked nodes and returns a
|
||||
* reference to the first node found with the given name. The reference
|
||||
* is then typically added to another node via AddRefNode().
|
||||
*
|
||||
* @param aNodeName is the name of the node to search for
|
||||
* @param aCaller is a pointer to the node invoking this function
|
||||
* @return is a valid node pointer on success, otherwise NULL
|
||||
*/
|
||||
virtual WRL2NODE* FindNode( const char *aNodeName, const WRL2NODE *aCaller ) = 0;
|
||||
|
||||
virtual bool AddRefNode( WRL2NODE* aNode ) = 0;
|
||||
|
||||
virtual bool AddChildNode( WRL2NODE* aNode ) = 0;
|
||||
};
|
||||
|
||||
#endif // VRML2_NODE_H
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file wrlproc.h
|
||||
* defines the basic input class for VRML
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WRLPROC_H
|
||||
#define WRLPROC_H
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "wrltypes.h"
|
||||
|
||||
class WRLPROC
|
||||
{
|
||||
private:
|
||||
std::ifstream m_file;
|
||||
std::string m_filename; // name of the open file
|
||||
size_t m_filepos; // position in the file
|
||||
size_t m_fileline; // line being processed
|
||||
size_t m_linepos; // position within 'buf'
|
||||
std::string m_buf; // string being parsed
|
||||
|
||||
WRLVERSION m_fileVersion; // VRML file version
|
||||
std::string m_error; // error message
|
||||
std::string m_badchars; // characters forbidden in VRML{1|2} names
|
||||
|
||||
// getRawLine reads a single non-blank line and in the case of a VRML1 file
|
||||
// it checks for invalid characters (bit 8 set). If m_buf is not empty and
|
||||
// not completely parsed the function returns 'true'. The file position
|
||||
// parameters are updated as appropriate.
|
||||
bool getRawLine( void );
|
||||
|
||||
// eatSpace discards all leading white space from the current m_linepos
|
||||
// and continues until a non-empty line is found which contains non-blank
|
||||
// characters
|
||||
bool eatSpace( void );
|
||||
|
||||
public:
|
||||
WRLPROC();
|
||||
~WRLPROC();
|
||||
|
||||
bool Open( const std::string& aFileName );
|
||||
void Close();
|
||||
|
||||
WRLVERSION GetVRMLType( void );
|
||||
|
||||
// helper routines
|
||||
|
||||
// read up to the next whitespace or comma
|
||||
bool ReadGlob( std::string& aGlob, bool* hasComma = NULL );
|
||||
// read a VRML name; is similar to ReadGlob except that it enforces
|
||||
// name checking rules, does not allow a comma at the end, and
|
||||
// stops when a left brace or bracket is found.
|
||||
bool ReadName( std::string& aName );
|
||||
bool DiscardNode( void ); // discard node data in a matched '{}' set
|
||||
bool DiscardList( void ); // discard list data in a matched '[]' set
|
||||
|
||||
// single variable readers
|
||||
bool ReadString( std::string& aSFString ); // read a VRML string
|
||||
bool ReadSFBool( bool& aSFBool );
|
||||
bool ReadSFColor( WRLVEC3F& aSFColor, bool* hasComma = NULL );
|
||||
bool ReadSFFloat( float& aSFFloat, bool* hasComma = NULL );
|
||||
bool ReadSFInt( int& aSFInt32, bool* hasComma = NULL );
|
||||
bool ReadSFRotation( WRLROTATION& aSFRotation, bool* hasComma = NULL );
|
||||
bool ReadSFVec2f( WRLVEC2F& aSFVec2f, bool* hasComma = NULL );
|
||||
bool ReadSFVec3f( WRLVEC3F& aSFVec3f, bool* hasComma = NULL );
|
||||
|
||||
// array readers
|
||||
bool ReadMFString( std::vector< std::string >& aMFString );
|
||||
bool ReadMFColor( std::vector< WRLVEC3F >& aMFColor );
|
||||
bool ReadMFFloat( std::vector< float >& aMFFloat );
|
||||
bool ReadMFInt( std::vector< int >& aMFInt32 );
|
||||
bool ReadMFRotation( std::vector< WRLROTATION >& aMFRotation );
|
||||
bool ReadMFVec2f( std::vector< WRLVEC2F >& aMFVec2f );
|
||||
bool ReadMFVec3f( std::vector< WRLVEC3F >& aMFVec3f );
|
||||
};
|
||||
|
||||
#endif // WRLPROC_H
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file wrltypes.h
|
||||
* declares some compound types used for VRML
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WRLTYPES_H
|
||||
#define WRLTYPES_H
|
||||
|
||||
|
||||
// version of the VRML file being parsed
|
||||
enum WRLVERSION
|
||||
{
|
||||
VRML_INVALID = 0, // not a valid VRML file
|
||||
VRML_V1,
|
||||
VRML_V2
|
||||
};
|
||||
|
||||
|
||||
// VRML Node Types
|
||||
// These are used to look up node names and to quickly
|
||||
// determine what routine to invoke to read a section of
|
||||
// a file.
|
||||
enum WRLNODES
|
||||
{
|
||||
WRL2_BASE = 0, // not really a VRML node but we need a top level virtual node
|
||||
WRL2_BEGIN,
|
||||
WRL2_ANCHOR = WRL2_BEGIN,
|
||||
WRL2_APPEARANCE,
|
||||
WRL2_AUDIOCLIP,
|
||||
WRL2_BACKGROUND,
|
||||
WRL2_BILLBOARD,
|
||||
WRL2_BOX,
|
||||
WRL2_COLLISION,
|
||||
WRL2_COLOR,
|
||||
WRL2_COLORINTERPOLATOR,
|
||||
WRL2_CONE,
|
||||
WRL2_COORDINATE,
|
||||
WRL2_COORDINATEINTERPOLATOR,
|
||||
WRL2_CYLINDER,
|
||||
WRL2_CYLINDERSENSOR,
|
||||
WRL2_DIRECTIONALLIGHT,
|
||||
WRL2_ELEVATIONGRID,
|
||||
WRL2_EXTRUSION,
|
||||
WRL2_FOG,
|
||||
WRL2_FONTSTYLE,
|
||||
WRL2_GROUP,
|
||||
WRL2_IMAGETEXTURE,
|
||||
WRL2_INDEXEDFACESET,
|
||||
WRL2_INDEXEDLINESET,
|
||||
WRL2_INLINE,
|
||||
WRL2_LOD,
|
||||
WRL2_MATERIAL,
|
||||
WRL2_MOVIETEXTURE,
|
||||
WRL2_NAVIGATIONINFO,
|
||||
WRL2_NORMAL,
|
||||
WRL2_NORMALINTERPOLATOR,
|
||||
WRL2_ORIENTATIONINTERPOLATOR,
|
||||
WRL2_PIXELTEXTURE,
|
||||
WRL2_PLANESENSOR,
|
||||
WRL2_POINTLIGHT,
|
||||
WRL2_POINTSET,
|
||||
WRL2_POSITIONINTERPOLATOR,
|
||||
WRL2_PROXIMITYSENSOR,
|
||||
WRL2_SCALARINTERPOLATOR,
|
||||
WRL2_SCRIPT,
|
||||
WRL2_SHAPE,
|
||||
WRL2_SOUND,
|
||||
WRL2_SPHERE,
|
||||
WRL2_SPHERESENSOR,
|
||||
WRL2_SPOTLIGHT,
|
||||
WRL2_SWITCH,
|
||||
WRL2_TEXT,
|
||||
WRL2_TEXTURECOORDINATE,
|
||||
WRL2_TEXTURETRANSFORM,
|
||||
WRL2_TIMESENSOR,
|
||||
WRL2_TOUCHSENSOR,
|
||||
WRL2_TRANSFORM,
|
||||
WRL2_VIEWPOINT,
|
||||
WRL2_VISIBILITYSENSOR,
|
||||
WRL2_WORLDINFO,
|
||||
WRL2_END
|
||||
};
|
||||
|
||||
|
||||
struct WRLVEC2F
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
struct WRLVEC3F
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
struct WRLROTATION
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
#endif // WRLTYPES_H
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* Description:
|
||||
* This plugin implements the legacy kicad VRML1/VRML2 parsers.
|
||||
* This VRML plugin will invoke a VRML1 or VRML2 parser depending
|
||||
* on the identifying information in the file header:
|
||||
*
|
||||
* #VRML V1.0 ascii
|
||||
* #VRML V2.0 utf8
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
#include <wx/filename.h>
|
||||
#include "plugins/3d/3d_plugin.h"
|
||||
#include "plugins/3dapi/ifsg_all.h"
|
||||
#include "wrlproc.h"
|
||||
|
||||
|
||||
#define PLUGIN_VRML_MAJOR 1
|
||||
#define PLUGIN_VRML_MINOR 0
|
||||
#define PLUGIN_VRML_PATCH 0
|
||||
#define PLUGIN_VRML_REVNO 0
|
||||
|
||||
|
||||
const char* GetKicadPluginName( void )
|
||||
{
|
||||
return "PLUGIN_3D_VRML";
|
||||
}
|
||||
|
||||
|
||||
void GetPluginVersion( unsigned char* Major,
|
||||
unsigned char* Minor, unsigned char* Patch, unsigned char* Revision )
|
||||
{
|
||||
if( Major )
|
||||
*Major = PLUGIN_VRML_MAJOR;
|
||||
|
||||
if( Minor )
|
||||
*Minor = PLUGIN_VRML_MINOR;
|
||||
|
||||
if( Patch )
|
||||
*Patch = PLUGIN_VRML_PATCH;
|
||||
|
||||
if( Revision )
|
||||
*Revision = PLUGIN_VRML_REVNO;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// number of extensions supported
|
||||
#ifdef _WIN32
|
||||
#define NEXTS 1
|
||||
#else
|
||||
#define NEXTS 2
|
||||
#endif
|
||||
|
||||
// number of filter sets supported
|
||||
#define NFILS 1
|
||||
|
||||
static char ext0[] = "wrl";
|
||||
|
||||
#ifdef _WIN32
|
||||
static char fil0[] = "VRML 1.0/2.0 (*.wrl)|*.wrl";
|
||||
#else
|
||||
static char ext1[] = "WRL";
|
||||
static char fil0[] = "VRML 1.0/2.0 (*.wrl;*.WRL)|*.wrl;*.WRL";
|
||||
#endif
|
||||
|
||||
static struct FILE_DATA
|
||||
{
|
||||
char const* extensions[NEXTS];
|
||||
char const* filters[NFILS];
|
||||
|
||||
FILE_DATA()
|
||||
{
|
||||
extensions[0] = ext0;
|
||||
filters[0] = fil0;
|
||||
|
||||
#ifndef _WIN32
|
||||
extensions[1] = ext1;
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
} file_data;
|
||||
|
||||
|
||||
int GetNExtensions( void )
|
||||
{
|
||||
return NEXTS;
|
||||
}
|
||||
|
||||
|
||||
char const* GetModelExtension( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= NEXTS )
|
||||
return NULL;
|
||||
|
||||
return file_data.extensions[aIndex];
|
||||
}
|
||||
|
||||
|
||||
int GetNFilters( void )
|
||||
{
|
||||
return NFILS;
|
||||
}
|
||||
|
||||
|
||||
char const* GetFileFilter( int aIndex )
|
||||
{
|
||||
if( aIndex < 0 || aIndex >= NFILS )
|
||||
return NULL;
|
||||
|
||||
return file_data.filters[aIndex];
|
||||
}
|
||||
|
||||
|
||||
bool CanRender( void )
|
||||
{
|
||||
// this plugin supports rendering of IDF component outlines
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
class LOCALESWITCH
|
||||
{
|
||||
public:
|
||||
LOCALESWITCH()
|
||||
{
|
||||
setlocale( LC_NUMERIC, "C" );
|
||||
}
|
||||
|
||||
~LOCALESWITCH()
|
||||
{
|
||||
setlocale( LC_NUMERIC, "" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
SCENEGRAPH* Load( char const* aFileName )
|
||||
{
|
||||
if( NULL == aFileName )
|
||||
return NULL;
|
||||
|
||||
wxString fname = wxString::FromUTF8Unchecked( aFileName );
|
||||
|
||||
if( !wxFileName::FileExists( fname ) )
|
||||
return NULL;
|
||||
|
||||
LOCALESWITCH switcher;
|
||||
|
||||
// VRML file processor
|
||||
WRLPROC proc;
|
||||
|
||||
if( !proc.Open( std::string( fname.ToUTF8() ) ) )
|
||||
return NULL;
|
||||
|
||||
if( proc.GetVRMLType() == VRML_V1 )
|
||||
std::cout << "XXX: Processing VRML 1.0 file\n";
|
||||
else
|
||||
std::cout << "XXX: Processing VRML 2.0 file\n";
|
||||
|
||||
return NULL;
|
||||
}
|
Loading…
Reference in New Issue