30#include <wx/xml/xml.h>
31#include <wx/tokenzr.h>
53 if(
nullptr != aParent )
68 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Destroying IndexedFaceSet." ) );
91 for( prop = aNode->GetAttributes(); prop !=
nullptr; prop = prop->GetNext() )
93 const wxString& pname = prop->GetName();
95 if( pname == wxT(
"DEF" ) )
100 else if( pname == wxT(
"ccw" ) )
104 else if( pname == wxT(
"creaseAngle" ) )
110 else if(
creaseAngle >
static_cast<float>( M_PI * 0.34f ) )
115 else if( pname == wxT(
"coordIndex" ) )
117 wxStringTokenizer indices( prop->GetValue() );
119 while( indices.HasMoreTokens() )
122 indices.GetNextToken().ToLong( &index );
132 if(
nullptr == aTopNode ||
nullptr == aNode )
139 for( wxXmlNode* child = aNode->GetChildren(); child !=
nullptr; child = child->GetNext() )
141 if( child->GetName() == wxT(
"Coordinate" ) )
161 if(
nullptr != aParent )
169 if(
nullptr !=
m_Parent && doUnlink )
183 if(
nullptr == aNode )
192 if(
nullptr !=
coord )
207 if(
nullptr == aNode )
216 if(
nullptr !=
coord )
219 m_Refs.push_back( aNode );
233 wxT(
" * [BUG] IndexedFaceSet does not have a valid Shape parent "
234 "(parent ID: %d)" ), ptype );
240 wxT(
" * [INFO] Translating IndexedFaceSet with %zu children, %zu references, "
241 "%zu back pointers, and %zu coordinate indices." ),
246 if(
nullptr != aParent )
265 if(
nullptr ==
coord || vsize < 3 )
276 for(
size_t idx = 0; idx < vsize; ++idx )
291 for( iCoord = 0; iCoord < vsize; ++iCoord )
309 if( idx >= (
int)coordsize )
void AddVertex(WRLVEC3F &aVertex, int aIndex)
Add the vertex and its associated index to the internal list of polygon vertices.
The base class of all Scene Graph nodes.
An abstract shape on 2D plane.
SGNODE * CalcShape(SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false)
void readFields(wxXmlNode *aNode)
bool AddChildNode(X3DNODE *aNode) override
bool AddRefNode(X3DNODE *aNode) override
std::vector< int > coordIndex
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
bool SetParent(X3DNODE *aParent, bool doUnlink=true) override
Set the parent X3DNODE of this object.
bool Read(wxXmlNode *aNode, X3DNODE *aTopNode, X3D_DICT &aDict) override
The base class of all X3D nodes.
void addNodeRef(X3DNODE *aNode)
Add a pointer to a node which references, but does not own, this node.
std::list< X3DNODE * > m_Children
std::list< X3DNODE * > m_BackPointers
virtual bool AddChildNode(X3DNODE *aNode)=0
std::list< X3DNODE * > m_Refs
X3DNODES GetNodeType(void) const
Return the type of this node instance.
X3DNODE * GetParent(void) const
Return a pointer to the parent node of this object or NULL if the object has no parent (ie.
virtual bool SetParent(X3DNODE *aParent, bool doUnlink=true)=0
Set the parent X3DNODE of this object.
virtual void unlinkChildNode(const X3DNODE *aNode)
Remove references to an owned child; it is invoked by the child upon destruction to ensure that the p...
bool AddName(const wxString &aName, X3DNODE *aNode)
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
collects header files for all SG* wrappers and the API
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
bool ParseSFBool(const wxString &aSource, bool &aResult)
bool ReadCoordinates(wxXmlNode *aNode, X3DNODE *aParent, X3D_DICT &aDict)
bool ParseSFFloat(const wxString &aSource, float &aResult)
declares classes to help manage normals calculations from VRML files