40 m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
47 m_Type = WRL1NODES::WRL1_INDEXEDFACESET;
57 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] Destroying IndexedFaceSet with %zu children, "
58 "%zu references, and %zu back pointers." ),
66 wxCHECK_MSG(
false,
false, wxT(
"AddRefNode is not applicable." ) );
73 wxCHECK_MSG(
false,
false, wxT(
"AddChildNode is not applicable." ) );
79 char tok = proc.
Peek();
85 " * [INFO] bad file format; unexpected eof %s." ),
95 " * [INFO] bad file format; expecting '{' but got '%s' %s." ),
106 if( proc.
Peek() ==
'}' )
115 __FILE__, __FUNCTION__, __LINE__, proc.
GetError() );
124 if( !glob.compare(
"coordIndex" ) )
130 " * [INFO] invalid coordIndex %s.\n"
131 " * [INFO] file: '%s'\n"
139 else if( !glob.compare(
"materialIndex" ) )
145 " * [INFO] invalid materialIndex %s.\n"
146 " * [INFO] file: '%s'\n"
154 else if( !glob.compare(
"normalIndex" ) )
160 " * [INFO] invalid normalIndex %s\n"
161 " * [INFO] file: '%s'\n"
169 else if( !glob.compare(
"textureCoordIndex" ) )
175 " * [INFO] invalid textureCoordIndex %s.\n"
176 " * [INFO] file: '%s'\n"
188 " * [INFO] invalid IndexedFaceSet %s.\n"
189 " * [INFO] file: '%s'" ),
209 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] bad model: no parent node." ) );
217 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] bad model: no base data given." ) );
227 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] bad model: no vertex set." ) );
233 wxLogTrace(
traceVrmlPlugin, wxT(
" * [INFO] bad model: no material set." ) );
243 if( coordsize < 3 || vsize < 3 )
246 wxT(
" * [INFO] bad model: coordsize = %zu, indexsize = %zu" ),
253 SGNODE* sgcolor =
nullptr;
259 case WRL1_BINDING::BIND_PER_FACE:
260 case WRL1_BINDING::BIND_PER_VERTEX:
261 case WRL1_BINDING::BIND_PER_VERTEX_INDEXED:
264 case WRL1_BINDING::BIND_PER_FACE_INDEXED:
269 wxT(
" * [INFO] bad model: per face indexed but no indices" ) );
272 mbind = WRL1_BINDING::BIND_OVERALL;
294 if( mbind == WRL1_BINDING::BIND_OVERALL || mbind == WRL1_BINDING::BIND_DEFAULT )
297 for( iCoord = 0; iCoord < vsize; ++iCoord )
315 if( idx >= (
int)coordsize )
323 glm::vec4 pt = glm::vec4( pcoords[idx].x, pcoords[idx].y, pcoords[idx].z, 1.0 );
334 for( iCoord = 0; iCoord < vsize; ++iCoord )
348 if( mbind == WRL1_BINDING::BIND_PER_FACE
349 || mbind == WRL1_BINDING::BIND_PER_FACE_INDEXED )
356 if( idx >= (
int)coordsize )
364 glm::vec4 pt = glm::vec4( pcoords[idx].x, pcoords[idx].y, pcoords[idx].z, 1.0 );
375 case WRL1_BINDING::BIND_PER_FACE:
385 case WRL1_BINDING::BIND_PER_VERTEX:
390 case WRL1_BINDING::BIND_PER_FACE_INDEXED:
394 if( cidx >= matSize )
404 case WRL1_BINDING::BIND_PER_VERTEX_INDEXED:
412 if( iCoord >= matSize )
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.
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)
Represent the top node of a VRML1 model.
void GetCoords(WRLVEC3F *&aCoordList, size_t &aListSize)
SGNODE * TranslateToSG(SGNODE *aParent, WRL1STATUS *sp) override
Produce a representation of the data using the intermediate scenegraph structures of the kicad_3dsg l...
std::vector< int > normIndex
WRL1FACESET(NAMEREGISTER *aDictionary)
bool AddChildNode(WRL1NODE *aNode) override
bool Read(WRLPROC &proc, WRL1BASE *aTopNode) override
bool AddRefNode(WRL1NODE *aNode) override
std::vector< int > texIndex
std::vector< int > matIndex
std::vector< int > coordIndex
void GetColor(SGCOLOR *aColor, int aIndex)
Compute an SGCOLOR representing the appearance of a vertex or face.
SGNODE * GetAppearance(int aIndex)
Return an SGAPPEARANCE node representing the appearance for an IndexedFaceSet.
The base class of all VRML1 nodes.
virtual bool AddChildNode(WRL1NODE *aNode)
std::list< WRL1NODE * > m_BackPointers
std::list< WRL1NODE * > m_Children
std::list< WRL1NODE * > m_Refs
std::string GetFileName(void)
bool ReadMFInt(std::vector< int > &aMFInt32)
std::string GetError(void)
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
declares classes to help manage normals calculations from VRML files