Added VRML2 Box node

This commit is contained in:
Cirilo Bernardo 2016-01-03 16:55:53 +11:00
parent 59cf4c5ed0
commit 5208a1b47e
3 changed files with 54 additions and 13 deletions

View File

@ -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
)

View File

@ -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() )

View File

@ -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: