41 m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
48 m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
59 wxT(
" * [INFO] Destroying IndexedFaceSet node with %zu children, %zu"
60 "references, and %zu back pointers." ),
93 case WRL2NODES::WRL2_COLOR:
94 case WRL2NODES::WRL2_COORDINATE:
95 case WRL2NODES::WRL2_NORMAL:
96 case WRL2NODES::WRL2_TEXTURECOORDINATE:
121 wxCHECK_MSG( aNode,
false, wxT(
"Invalid node." ) );
129 " * [INFO] bad file format; unexpected child node '%s'." ),
135 if( WRL2NODES::WRL2_COLOR == type )
137 if(
nullptr !=
color )
141 " * [INFO] bad file format; multiple color nodes." ),
142 __FILE__, __FUNCTION__, __LINE__ );
151 if( WRL2NODES::WRL2_COORDINATE == type )
153 if(
nullptr !=
coord )
157 " * [INFO] bad file format; multiple coord nodes." ),
158 __FILE__, __FUNCTION__, __LINE__ );
167 if( WRL2NODES::WRL2_NORMAL == type )
173 " * [INFO] bad file format; multiple normal nodes." ),
174 __FILE__, __FUNCTION__, __LINE__ );
183 wxCHECK_MSG( WRL2NODES::WRL2_TEXTURECOORDINATE == type,
false,
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'." ),
217 if( WRL2NODES::WRL2_COLOR == type )
219 if(
nullptr !=
color )
223 " * [INFO] bad file format; multiple color nodes." ),
224 __FILE__, __FUNCTION__, __LINE__ );
233 if( WRL2NODES::WRL2_COORDINATE == type )
235 if(
nullptr !=
coord )
239 " * [INFO] bad file format; multiple coord nodes." ),
240 __FILE__, __FUNCTION__, __LINE__ );
249 if( WRL2NODES::WRL2_NORMAL == type )
255 " * [INFO] bad file format; multiple normal nodes." ),
256 __FILE__, __FUNCTION__, __LINE__ );
265 wxCHECK_MSG( WRL2NODES::WRL2_TEXTURECOORDINATE == type,
false,
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 )
void AddVertex(WRLVEC3F &aVertex, int aIndex)
Add the vertex and its associated index to the internal list of polygon vertices.
void AddColor(const SGCOLOR &aColor)
Add the given RGB color to the internal list.
bool SetColor(float aRedVal, float aGreenVal, float aBlueVal)
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)
The top node of a VRML2 model.
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
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 Read(WRLPROC &proc, WRL2BASE *aTopNode) override
std::vector< int > normalIndex
std::vector< int > coordIndex
bool checkNodeType(WRL2NODES aType)
void unlinkRefNode(const WRL2NODE *aNode) override
Remove pointers to a referenced node.
bool isDangling(void) override
Determine whether an object should be moved to a different parent during the VRML to SG* translation.
SGNODE * TranslateToSG(SGNODE *aParent) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
bool AddRefNode(WRL2NODE *aNode) override
std::vector< int > colorIndex
void unlinkChildNode(const WRL2NODE *aNode) override
Remove references to an owned child.
bool AddChildNode(WRL2NODE *aNode) override
std::list< WRL2NODE * > m_BackPointers
WRL2NODE * GetParent(void) const
virtual void unlinkChildNode(const WRL2NODE *aNode)
Remove references to an owned child.
std::list< WRL2NODE * > m_Children
virtual bool AddRefNode(WRL2NODE *aNode)
virtual void unlinkRefNode(const WRL2NODE *aNode)
Remove pointers to a referenced node.
const char * GetNodeTypeName(WRL2NODES aNodeType) const
WRL2NODES GetNodeType(void) const
std::list< WRL2NODE * > m_Refs
virtual bool AddChildNode(WRL2NODE *aNode)
bool ReadSFFloat(float &aSFFloat)
std::string GetFileName(void)
bool ReadMFInt(std::vector< int > &aMFInt32)
std::string GetError(void)
bool ReadSFBool(bool &aSFBool)
bool ReadName(std::string &aName)
std::string GetFilePosition() const
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)
declares classes to help manage normals calculations from VRML files