diff --git a/plugins/3d/vrml/CMakeLists.txt b/plugins/3d/vrml/CMakeLists.txt index e69de29bb2..3119a84dae 100644 --- a/plugins/3d/vrml/CMakeLists.txt +++ b/plugins/3d/vrml/CMakeLists.txt @@ -0,0 +1,30 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/v2 +) + +#add_definitions( -DDEBUG_VRML2=3 ) + +add_library( s3d_plugin_vrml MODULE + vrml.cpp + wrlproc.cpp + v2/vrml2_node.cpp + v2/vrml2_base.cpp + v2/vrml2_transform.cpp + v2/vrml2_shape.cpp + v2/vrml2_appearance.cpp + v2/vrml2_material.cpp + v2/vrml2_faceset.cpp + v2/vrml2_coords.cpp + v2/vrml2_norms.cpp + v2/vrml2_color.cpp + v2/vrml2_box.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 + ) diff --git a/plugins/3d/vrml/v2/vrml2_base.cpp b/plugins/3d/vrml/v2/vrml2_base.cpp index e880e3b738..f5df3416e8 100644 --- a/plugins/3d/vrml/v2/vrml2_base.cpp +++ b/plugins/3d/vrml/v2/vrml2_base.cpp @@ -32,6 +32,7 @@ #include "vrml2_coords.h" #include "vrml2_norms.h" #include "vrml2_color.h" +#include "vrml2_box.h" #include "plugins/3dapi/ifsg_all.h" @@ -369,20 +370,9 @@ bool WRL2BASE::ReadNode( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) break; case WRL2_BOX: - // XXX - IMPLEMENT - if( !proc.DiscardNode() ) - { - #ifdef DEBUG_VRML2 - std::cerr << " * [INFO] FAIL: discard " << glob << " node at l" << line << ", c" << column << "\n"; - #endif + + if( !readBox( proc, aParent, aNode ) ) return false; - } - #ifdef DEBUG_VRML2 - else - { - std::cerr << " * [INFO] OK: discard " << glob << " node at l" << line << ", c" << column << "\n"; - } - #endif break; @@ -765,6 +755,26 @@ bool WRL2BASE::readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) } +bool WRL2BASE::readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ) +{ + if( NULL != aNode ) + *aNode = NULL; + + WRL2BOX* np = new WRL2BOX( aParent ); + + if( !np->Read( proc, this ) ) + { + delete np; + return false; + } + + if( NULL != aNode ) + *aNode = (WRL2NODE*) np; + + return true; +} + + SGNODE* WRL2BASE::TranslateToSG( SGNODE* aParent, bool calcNormals ) { if( m_Children.empty() ) diff --git a/plugins/3d/vrml/v2/vrml2_base.h b/plugins/3d/vrml/v2/vrml2_base.h index 94982d10d7..be528b5636 100644 --- a/plugins/3d/vrml/v2/vrml2_base.h +++ b/plugins/3d/vrml/v2/vrml2_base.h @@ -68,6 +68,7 @@ private: bool readCoords( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ); bool readNorms( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ); bool readColor( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ); + bool readBox( WRLPROC& proc, WRL2NODE* aParent, WRL2NODE** aNode ); public: