59 wxT(
" * [INFO] Destroying IndexedFaceSet node with %zu children, %zu" 60 "references, and %zu back pointers." ),
121 wxCHECK_MSG( aNode,
false, wxT(
"Invalid node." ) );
129 " * [INFO] bad file format; unexpected child node '%s'." ),
137 if(
nullptr !=
color )
141 " * [INFO] bad file format; multiple color nodes." ),
142 __FILE__, __FUNCTION__, __LINE__ );
153 if(
nullptr !=
coord )
157 " * [INFO] bad file format; multiple coord nodes." ),
158 __FILE__, __FUNCTION__, __LINE__ );
173 " * [INFO] bad file format; multiple normal nodes." ),
174 __FILE__, __FUNCTION__, __LINE__ );
184 wxT(
"Unexpected code branch." ) );
190 " * [INFO] bad file format; multiple texCoord nodes." ),
191 __FILE__, __FUNCTION__, __LINE__ );
203 wxCHECK_MSG( aNode,
false, wxT(
"Invalid node." ) );
211 " * [INFO] bad file format; unexpected child node '%s'." ),
219 if(
nullptr !=
color )
223 " * [INFO] bad file format; multiple color nodes." ),
224 __FILE__, __FUNCTION__, __LINE__ );
235 if(
nullptr !=
coord )
239 " * [INFO] bad file format; multiple coord nodes." ),
240 __FILE__, __FUNCTION__, __LINE__ );
255 " * [INFO] bad file format; multiple normal nodes." ),
256 __FILE__, __FUNCTION__, __LINE__ );
266 wxT(
"Unexpected code branch." ) );
272 " * [INFO] bad file format; multiple texCoord nodes." ),
273 __FILE__, __FUNCTION__, __LINE__ );
286 char tok = proc.
Peek();
291 " * [INFO] bad file format; unexpected eof %s." ),
301 " * [INFO] bad file format; expecting '{' but got '%s' %s." ),
312 if( proc.
Peek() ==
'}' )
322 __FILE__, __FUNCTION__, __LINE__ , proc.
GetError() );
346 if( !glob.compare(
"ccw" ) )
351 " * [INFO] invalid ccw %s\n" 352 " * [INFO] file: '%s'\n" 360 else if( !glob.compare(
"colorPerVertex" ) )
365 " * [INFO] invalid colorPerVertex %s\n" 366 " * [INFO] file: '%s'\n" 374 else if( !glob.compare(
"convex" ) )
379 " * [INFO] invalid convex %s\n" 380 " * [INFO] file: '%s'\n" 388 else if( !glob.compare(
"normalPerVertex" ) )
393 " * [INFO] invalid normalPerVertex %s\n" 394 " * [INFO] file: '%s'\n" 402 else if( !glob.compare(
"solid" ) )
407 " * [INFO] invalid solid %s\n" 408 " * [INFO] file: '%s'\n" 416 else if( !glob.compare(
"creaseAngle" ) )
421 " * [INFO] invalid creaseAngle %s\n" 422 " * [INFO] file: '%s'\n" 437 else if( !glob.compare(
"colorIndex" ) )
442 " * [INFO] invalid colorIndex %s\n" 443 " * [INFO] file: '%s'\n" 451 else if( !glob.compare(
"coordIndex" ) )
456 " * [INFO] invalid coordIndex %s\n" 457 " * [INFO] file: '%s'\n" 465 else if( !glob.compare(
"normalIndex" ) )
470 " * [INFO] invalid normalIndex %s\n" 471 " * [INFO] file: '%s'\n" 479 else if( !glob.compare(
"color" ) )
481 if( !aTopNode->
ReadNode( proc,
this,
nullptr ) )
485 " * [INFO] could not read color node information." ),
486 __FILE__, __FUNCTION__, __LINE__ );
491 else if( !glob.compare(
"coord" ) )
493 if( !aTopNode->
ReadNode( proc,
this,
nullptr ) )
497 " * [INFO] could not read coord node information." ),
498 __FILE__, __FUNCTION__, __LINE__ );
503 else if( !glob.compare(
"normal" ) )
505 if( !aTopNode->
ReadNode( proc,
this,
nullptr ) )
509 " * [INFO] could not read normal node information." ),
510 __FILE__, __FUNCTION__, __LINE__ );
515 else if( !glob.compare(
"texCoord" ) )
517 if( !aTopNode->
ReadNode( proc,
this,
nullptr ) )
521 " * [INFO] could not read texCoord node information." ),
522 __FILE__, __FUNCTION__, __LINE__ );
531 " * [INFO] invalid IndexedFaceSet %s (no closing brace)\n" 532 " * [INFO] file: '%s'\n" ),
549 wxString::Format( wxT(
"IndexedFaceSet does not have a Shape parent (parent " 550 "ID: %d)." ), ptype ) );
553 wxT(
" * [INFO] Translating IndexedFaceSet with %zu children, %zu references, " 554 "%zu back pointers, and %zu coord indices." ),
559 if(
nullptr != aParent )
578 if(
nullptr ==
coord || vsize < 3 )
589 for(
size_t idx = 0; idx < vsize; ++idx )
605 if(
nullptr ==
color )
608 for( iCoord = 0; iCoord < vsize; ++iCoord )
626 if( idx >= (
int)coordsize )
641 for( iCoord = 0; iCoord < vsize; ++iCoord )
662 if( idx >= (
int)coordsize )
676 cn->
GetColor( cidx, tc.x, tc.y, tc.z );
695 cn->
GetColor( idx, tc.x, tc.y, tc.z );
726 if(
nullptr == aNode )
733 else if( aNode ==
coord )
735 else if( aNode ==
normal )
747 if(
nullptr == aNode )
754 else if( aNode ==
coord )
756 else if( aNode ==
normal )
768 if(
nullptr ==
color )
SGNODE * CalcShape(SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false)
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
std::list< WRL2NODE * > m_Children
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
std::vector< int > coordIndex
bool AddChildNode(WRL2NODE *aNode) override
void AddVertex(WRLVEC3F &aVertex, int aIndex)
Add the vertex and its associated index to the internal list of polygon vertices.
std::list< WRL2NODE * > m_Refs
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
bool ReadMFInt(std::vector< int > &aMFInt32)
bool SetColor(float aRedVal, float aGreenVal, float aBlueVal)
void unlinkChildNode(const WRL2NODE *aNode) override
Remove references to an owned child.
The base class of all Scene Graph nodes.
collects header files for all SG* wrappers and the API
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
declares classes to help manage normals calculations from VRML files
void AddColor(const SGCOLOR &aColor)
Add the given RGB color to the internal list.
std::vector< int > colorIndex
bool checkNodeType(WRL2NODES aType)
void unlinkRefNode(const WRL2NODE *aNode) override
Remove pointers to a referenced node.
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
std::string GetFilePosition() const
bool ReadSFFloat(float &aSFFloat)
std::list< WRL2NODE * > m_BackPointers
An abstract shape on 2D plane.
void GetColor(int aIndex, float &red, float &green, float &blue)
Retrieve the given color (or default 0.8, 0.8, 0.8 if index is invalid).
bool ReadSFBool(bool &aSFBool)
WRL2NODES GetNodeType(void) const
std::string GetFileName(void)
The top node of a VRML2 model.
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
const char * GetNodeTypeName(WRL2NODES aNodeType) const
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
virtual bool AddChildNode(WRL2NODE *aNode)
bool ReadName(std::string &aName)
virtual void unlinkRefNode(const WRL2NODE *aNode)
Remove pointers to a referenced node.
WRL2NODE * GetParent(void) const
std::vector< int > normalIndex
std::string GetError(void)
virtual void unlinkChildNode(const WRL2NODE *aNode)
Remove references to an owned child.
virtual bool AddRefNode(WRL2NODE *aNode)
bool AddRefNode(WRL2NODE *aNode) override