KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vrml2_faceset.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 Cirilo Bernardo <[email protected]>
5 * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25
26#include <iostream>
27#include <sstream>
28#include <wx/log.h>
29
30#include "vrml2_base.h"
31#include "vrml2_faceset.h"
32#include "vrml2_coords.h"
33#include "vrml2_color.h"
34#include "wrlfacet.h"
36
37
39{
41 m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
42}
43
44
46{
48 m_Type = WRL2NODES::WRL2_INDEXEDFACESET;
49 m_Parent = aParent;
50
51 if( nullptr != m_Parent )
52 m_Parent->AddChildNode( this );
53}
54
55
57{
58 wxLogTrace( traceVrmlPlugin,
59 wxT( " * [INFO] Destroying IndexedFaceSet node with %zu children, %zu"
60 "references, and %zu back pointers." ),
61 m_Children.size(), m_Refs.size(), m_BackPointers.size() );
62}
63
64
66{
67 color = nullptr;
68 coord = nullptr;
69 normal = nullptr;
70 texCoord = nullptr;
71
72 ccw = true;
73 colorPerVertex = true;
74 convex = true;
75 normalPerVertex = true;
76 solid = true;
77
78 creaseAngle = 0.733f; // approx 42 degrees; this is larger than VRML spec.
79 creaseLimit = 0.74317f; // cos( 0.733 )
80}
81
82
84{
85 // nodes must be one of:
86 // Color
87 // Coordinate
88 // Normal
89 // TextureCoordinate
90
91 switch( aType )
92 {
93 case WRL2NODES::WRL2_COLOR:
94 case WRL2NODES::WRL2_COORDINATE:
95 case WRL2NODES::WRL2_NORMAL:
96 case WRL2NODES::WRL2_TEXTURECOORDINATE:
97 break;
98
99 default:
100 return false;
101 break;
102 }
103
104 return true;
105}
106
107
109{
110 // this node is dangling unless it has a parent of type WRL2_SHAPE
111
112 if( nullptr == m_Parent || m_Parent->GetNodeType() != WRL2NODES::WRL2_SHAPE )
113 return true;
114
115 return false;
116}
117
118
120{
121 wxCHECK_MSG( aNode, false, wxT( "Invalid node." ) );
122
123 WRL2NODES type = aNode->GetNodeType();
124
125 if( !checkNodeType( type ) )
126 {
127 wxLogTrace( traceVrmlPlugin,
128 wxT( "%s:%s:%d\n"
129 " * [INFO] bad file format; unexpected child node '%s'." ),
130 __FILE__, __FUNCTION__, __LINE__, aNode->GetNodeTypeName( type ) );
131
132 return false;
133 }
134
135 if( WRL2NODES::WRL2_COLOR == type )
136 {
137 if( nullptr != color )
138 {
139 wxLogTrace( traceVrmlPlugin,
140 wxT( "%s:%s:%d\n"
141 " * [INFO] bad file format; multiple color nodes." ),
142 __FILE__, __FUNCTION__, __LINE__ );
143
144 return false;
145 }
146
147 color = aNode;
148 return WRL2NODE::AddRefNode( aNode );
149 }
150
151 if( WRL2NODES::WRL2_COORDINATE == type )
152 {
153 if( nullptr != coord )
154 {
155 wxLogTrace( traceVrmlPlugin,
156 wxT( "%s:%s:%d\n"
157 " * [INFO] bad file format; multiple coord nodes." ),
158 __FILE__, __FUNCTION__, __LINE__ );
159
160 return false;
161 }
162
163 coord = aNode;
164 return WRL2NODE::AddRefNode( aNode );
165 }
166
167 if( WRL2NODES::WRL2_NORMAL == type )
168 {
169 if( nullptr != normal )
170 {
171 wxLogTrace( traceVrmlPlugin,
172 wxT( "%s:%s:%d\n"
173 " * [INFO] bad file format; multiple normal nodes." ),
174 __FILE__, __FUNCTION__, __LINE__ );
175
176 return false;
177 }
178
179 normal = aNode;
180 return WRL2NODE::AddRefNode( aNode );
181 }
182
183 wxCHECK_MSG( WRL2NODES::WRL2_TEXTURECOORDINATE == type, false,
184 wxT( "Unexpected code branch." ) );
185
186 if( nullptr != texCoord )
187 {
188 wxLogTrace( traceVrmlPlugin,
189 wxT( "%s:%s:%d\n"
190 " * [INFO] bad file format; multiple texCoord nodes." ),
191 __FILE__, __FUNCTION__, __LINE__ );
192
193 return false;
194 }
195
196 texCoord = aNode;
197 return WRL2NODE::AddRefNode( aNode );
198}
199
200
202{
203 wxCHECK_MSG( aNode, false, wxT( "Invalid node." ) );
204
205 WRL2NODES type = aNode->GetNodeType();
206
207 if( !checkNodeType( type ) )
208 {
209 wxLogTrace( traceVrmlPlugin,
210 wxT( "%s:%s:%d\n"
211 " * [INFO] bad file format; unexpected child node '%s'." ),
212 __FILE__, __FUNCTION__, __LINE__, aNode->GetNodeTypeName( type ) );
213
214 return false;
215 }
216
217 if( WRL2NODES::WRL2_COLOR == type )
218 {
219 if( nullptr != color )
220 {
221 wxLogTrace( traceVrmlPlugin,
222 wxT( "%s:%s:%d\n"
223 " * [INFO] bad file format; multiple color nodes." ),
224 __FILE__, __FUNCTION__, __LINE__ );
225
226 return false;
227 }
228
229 color = aNode;
230 return WRL2NODE::AddChildNode( aNode );
231 }
232
233 if( WRL2NODES::WRL2_COORDINATE == type )
234 {
235 if( nullptr != coord )
236 {
237 wxLogTrace( traceVrmlPlugin,
238 wxT( "%s:%s:%d\n"
239 " * [INFO] bad file format; multiple coord nodes." ),
240 __FILE__, __FUNCTION__, __LINE__ );
241
242 return false;
243 }
244
245 coord = aNode;
246 return WRL2NODE::AddChildNode( aNode );
247 }
248
249 if( WRL2NODES::WRL2_NORMAL == type )
250 {
251 if( nullptr != normal )
252 {
253 wxLogTrace( traceVrmlPlugin,
254 wxT( "%s:%s:%d\n"
255 " * [INFO] bad file format; multiple normal nodes." ),
256 __FILE__, __FUNCTION__, __LINE__ );
257
258 return false;
259 }
260
261 normal = aNode;
262 return WRL2NODE::AddChildNode( aNode );
263 }
264
265 wxCHECK_MSG( WRL2NODES::WRL2_TEXTURECOORDINATE == type, false,
266 wxT( "Unexpected code branch." ) );
267
268 if( nullptr != texCoord )
269 {
270 wxLogTrace( traceVrmlPlugin,
271 wxT( "%s:%s:%d\n"
272 " * [INFO] bad file format; multiple texCoord nodes." ),
273 __FILE__, __FUNCTION__, __LINE__ );
274
275 return false;
276 }
277
278 texCoord = aNode;
279 return WRL2NODE::AddChildNode( aNode );
280}
281
282
283
284bool WRL2FACESET::Read( WRLPROC& proc, WRL2BASE* aTopNode )
285{
286 char tok = proc.Peek();
287
288 if( proc.eof() )
289 {
290 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
291 " * [INFO] bad file format; unexpected eof %s." ),
292 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition() );
293
294 return false;
295 }
296
297 if( '{' != tok )
298 {
299 wxLogTrace( traceVrmlPlugin,
300 wxT( "%s:%s:%d\n"
301 " * [INFO] bad file format; expecting '{' but got '%s' %s." ),
302 __FILE__, __FUNCTION__, __LINE__, tok, proc.GetFilePosition() );
303
304 return false;
305 }
306
307 proc.Pop();
308 std::string glob;
309
310 while( true )
311 {
312 if( proc.Peek() == '}' )
313 {
314 proc.Pop();
315 break;
316 }
317
318 if( !proc.ReadName( glob ) )
319 {
320 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
321 "%s" ),
322 __FILE__, __FUNCTION__, __LINE__ , proc.GetError() );
323
324 return false;
325 }
326
327 // expecting one of:
328 // [node]
329 // color
330 // coord
331 // normal
332 // texCoord
333 // [bool]
334 // ccw
335 // colorPerVertex
336 // convex
337 // normalPerVertex
338 // solid
339 // [ vector<int> ]
340 // colorIndex
341 // coordIndex
342 // normalIndex;
343 // [float]
344 // creaseAngle
345
346 if( !glob.compare( "ccw" ) )
347 {
348 if( !proc.ReadSFBool( ccw ) )
349 {
350 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
351 " * [INFO] invalid ccw %s\n"
352 " * [INFO] file: '%s'\n"
353 "%s" ),
354 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
355 proc.GetFileName(), proc.GetError() );
356
357 return false;
358 }
359 }
360 else if( !glob.compare( "colorPerVertex" ) )
361 {
362 if( !proc.ReadSFBool( colorPerVertex ) )
363 {
364 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
365 " * [INFO] invalid colorPerVertex %s\n"
366 " * [INFO] file: '%s'\n"
367 "%s" ),
368 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
369 proc.GetFileName(), proc.GetError() );
370
371 return false;
372 }
373 }
374 else if( !glob.compare( "convex" ) )
375 {
376 if( !proc.ReadSFBool( convex ) )
377 {
378 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
379 " * [INFO] invalid convex %s\n"
380 " * [INFO] file: '%s'\n"
381 "%s" ),
382 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
383 proc.GetFileName(), proc.GetError() );
384
385 return false;
386 }
387 }
388 else if( !glob.compare( "normalPerVertex" ) )
389 {
390 if( !proc.ReadSFBool( normalPerVertex ) )
391 {
392 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
393 " * [INFO] invalid normalPerVertex %s\n"
394 " * [INFO] file: '%s'\n"
395 "%s" ),
396 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
397 proc.GetFileName(), proc.GetError() );
398
399 return false;
400 }
401 }
402 else if( !glob.compare( "solid" ) )
403 {
404 if( !proc.ReadSFBool( solid ) )
405 {
406 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
407 " * [INFO] invalid solid %s\n"
408 " * [INFO] file: '%s'\n"
409 "%s" ),
410 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
411 proc.GetFileName(), proc.GetError() );
412
413 return false;
414 }
415 }
416 else if( !glob.compare( "creaseAngle" ) )
417 {
418 if( !proc.ReadSFFloat( creaseAngle ) )
419 {
420 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
421 " * [INFO] invalid creaseAngle %s\n"
422 " * [INFO] file: '%s'\n"
423 "%s" ),
424 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
425 proc.GetFileName(), proc.GetError() );
426
427 return false;
428 }
429
430 if( creaseAngle < 0.0 )
431 creaseAngle = 0.0f;
432 else if( creaseAngle > M_PI_2 )
433 creaseAngle = static_cast<float>( M_PI_2 );
434
435 creaseLimit = cosf( creaseAngle );
436 }
437 else if( !glob.compare( "colorIndex" ) )
438 {
439 if( !proc.ReadMFInt( colorIndex ) )
440 {
441 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
442 " * [INFO] invalid colorIndex %s\n"
443 " * [INFO] file: '%s'\n"
444 "%s" ),
445 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
446 proc.GetFileName(), proc.GetError() );
447
448 return false;
449 }
450 }
451 else if( !glob.compare( "coordIndex" ) )
452 {
453 if( !proc.ReadMFInt( coordIndex ) )
454 {
455 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
456 " * [INFO] invalid coordIndex %s\n"
457 " * [INFO] file: '%s'\n"
458 "%s" ),
459 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
460 proc.GetFileName(), proc.GetError() );
461
462 return false;
463 }
464 }
465 else if( !glob.compare( "normalIndex" ) )
466 {
467 if( !proc.ReadMFInt( normalIndex ) )
468 {
469 wxLogTrace( traceVrmlPlugin, wxT( "%s:%s:%d\n"
470 " * [INFO] invalid normalIndex %s\n"
471 " * [INFO] file: '%s'\n"
472 "%s" ),
473 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
474 proc.GetFileName(), proc.GetError() );
475
476 return false;
477 }
478 }
479 else if( !glob.compare( "color" ) )
480 {
481 if( !aTopNode->ReadNode( proc, this, nullptr ) )
482 {
483 wxLogTrace( traceVrmlPlugin,
484 wxT( "%s:%s:%d\n"
485 " * [INFO] could not read color node information." ),
486 __FILE__, __FUNCTION__, __LINE__ );
487
488 return false;
489 }
490 }
491 else if( !glob.compare( "coord" ) )
492 {
493 if( !aTopNode->ReadNode( proc, this, nullptr ) )
494 {
495 wxLogTrace( traceVrmlPlugin,
496 wxT( "%s:%s:%d\n"
497 " * [INFO] could not read coord node information." ),
498 __FILE__, __FUNCTION__, __LINE__ );
499
500 return false;
501 }
502 }
503 else if( !glob.compare( "normal" ) )
504 {
505 if( !aTopNode->ReadNode( proc, this, nullptr ) )
506 {
507 wxLogTrace( traceVrmlPlugin,
508 wxT( "%s:%s:%d\n"
509 " * [INFO] could not read normal node information." ),
510 __FILE__, __FUNCTION__, __LINE__ );
511
512 return false;
513 }
514 }
515 else if( !glob.compare( "texCoord" ) )
516 {
517 if( !aTopNode->ReadNode( proc, this, nullptr ) )
518 {
519 wxLogTrace( traceVrmlPlugin,
520 wxT( "%s:%s:%d\n"
521 " * [INFO] could not read texCoord node information." ),
522 __FILE__, __FUNCTION__, __LINE__ );
523
524 return false;
525 }
526 }
527 else
528 {
529 wxLogTrace( traceVrmlPlugin,
530 wxT( "%s:%s:%d\n"
531 " * [INFO] invalid IndexedFaceSet %s (no closing brace)\n"
532 " * [INFO] file: '%s'\n" ),
533 __FILE__, __FUNCTION__, __LINE__, proc.GetFilePosition(),
534 proc.GetFileName() );
535
536 return false;
537 }
538 } // while( true ) -- reading contents of IndexedFaceSet{}
539
540 return true;
541}
542
543
545{
546 S3D::SGTYPES ptype = S3D::GetSGNodeType( aParent );
547
548 wxCHECK_MSG( aParent && ( ptype == S3D::SGTYPE_SHAPE ), nullptr,
549 wxString::Format( wxT( "IndexedFaceSet does not have a Shape parent (parent "
550 "ID: %d)." ), ptype ) );
551
552 wxLogTrace( traceVrmlPlugin,
553 wxT( " * [INFO] Translating IndexedFaceSet with %zu children, %zu references, "
554 "%zu back pointers, and %zu coord indices." ),
555 m_Children.size(), m_Refs.size(), m_BackPointers.size(), coordIndex.size() );
556
557 if( m_sgNode )
558 {
559 if( nullptr != aParent )
560 {
561 if( nullptr == S3D::GetSGNodeParent( m_sgNode )
562 && !S3D::AddSGNodeChild( aParent, m_sgNode ) )
563 {
564 return nullptr;
565 }
566 else if( aParent != S3D::GetSGNodeParent( m_sgNode )
567 && !S3D::AddSGNodeRef( aParent, m_sgNode ) )
568 {
569 return nullptr;
570 }
571 }
572
573 return m_sgNode;
574 }
575
576 size_t vsize = coordIndex.size();
577
578 if( nullptr == coord || vsize < 3 )
579 return nullptr;
580
581 WRLVEC3F* pcoords;
582 size_t coordsize;
583 ((WRL2COORDS*) coord)->GetCoords( pcoords, coordsize );
584
585 if( coordsize < 3 )
586 return nullptr;
587
588 // check that all indices are valid
589 for( size_t idx = 0; idx < vsize; ++idx )
590 {
591 if( coordIndex[idx] < 0 )
592 continue;
593
594 if( coordIndex[idx] >= (int)coordsize )
595 return nullptr;
596 }
597
598 SHAPE lShape;
599 FACET* fp = nullptr;
600 size_t iCoord;
601 int idx; // coordinate index
602 size_t cidx = 0; // color index
603 SGCOLOR pc1;
604
605 if( nullptr == color )
606 {
607 // no per-vertex colors; we can save a few CPU cycles
608 for( iCoord = 0; iCoord < vsize; ++iCoord )
609 {
610 idx = coordIndex[iCoord];
611
612 if( idx < 0 )
613 {
614 if( nullptr != fp )
615 {
616 if( fp->HasMinPoints() )
617 fp = nullptr;
618 else
619 fp->Init();
620 }
621
622 continue;
623 }
624
625 // if the coordinate is bad then skip it
626 if( idx >= (int)coordsize )
627 continue;
628
629 if( nullptr == fp )
630 fp = lShape.NewFacet();
631
632 // push the vertex value and index
633 fp->AddVertex( pcoords[idx], idx );
634 }
635 }
636 else
637 {
638 WRL2COLOR* cn = (WRL2COLOR*) color;
639 WRLVEC3F tc;
640
641 for( iCoord = 0; iCoord < vsize; ++iCoord )
642 {
643 idx = coordIndex[iCoord];
644
645 if( idx < 0 )
646 {
647 if( nullptr != fp )
648 {
649 if( fp->HasMinPoints() )
650 fp = nullptr;
651 else
652 fp->Init();
653 }
654
655 if( !colorPerVertex )
656 ++cidx;
657
658 continue;
659 }
660
661 // if the coordinate is bad then skip it
662 if( idx >= (int)coordsize )
663 continue;
664
665 if( nullptr == fp )
666 fp = lShape.NewFacet();
667
668 // push the vertex value and index
669 fp->AddVertex( pcoords[idx], idx );
670
671 // push the color if appropriate
672 if( !colorPerVertex )
673 {
674 if( colorIndex.empty() )
675 {
676 cn->GetColor( cidx, tc.x, tc.y, tc.z );
677 pc1.SetColor( tc.x, tc.y, tc.z );
678 fp->AddColor( pc1 );
679 }
680 else
681 {
682 if( cidx < colorIndex.size() )
683 cn->GetColor( colorIndex[cidx], tc.x, tc.y, tc.z );
684 else
685 cn->GetColor( colorIndex.back(), tc.x, tc.y, tc.z );
686
687 pc1.SetColor( tc.x, tc.y, tc.z );
688 fp->AddColor( pc1 );
689 }
690 }
691 else
692 {
693 if( colorIndex.empty() )
694 {
695 cn->GetColor( idx, tc.x, tc.y, tc.z );
696 pc1.SetColor( tc.x, tc.y, tc.z );
697 fp->AddColor( pc1 );
698 }
699 else
700 {
701 if( iCoord < colorIndex.size() )
702 cn->GetColor( colorIndex[iCoord], tc.x, tc.y, tc.z );
703 else
704 cn->GetColor( colorIndex.back(), tc.x, tc.y, tc.z );
705
706 pc1.SetColor( tc.x, tc.y, tc.z );
707 fp->AddColor( pc1 );
708 }
709 }
710 }
711 }
712
713 SGNODE* np = nullptr;
714
715 if( ccw )
716 np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CCW, creaseLimit, true );
717 else
718 np = lShape.CalcShape( aParent, nullptr, WRL1_ORDER::ORD_CLOCKWISE, creaseLimit, true );
719
720 return np;
721}
722
723
725{
726 if( nullptr == aNode )
727 return;
728
729 if( aNode->GetParent() == this )
730 {
731 if( aNode == color )
732 color = nullptr;
733 else if( aNode == coord )
734 coord = nullptr;
735 else if( aNode == normal )
736 normal = nullptr;
737 else if( aNode == texCoord )
738 texCoord = nullptr;
739 }
740
742}
743
744
746{
747 if( nullptr == aNode )
748 return;
749
750 if( aNode->GetParent() != this )
751 {
752 if( aNode == color )
753 color = nullptr;
754 else if( aNode == coord )
755 coord = nullptr;
756 else if( aNode == normal )
757 normal = nullptr;
758 else if( aNode == texCoord )
759 texCoord = nullptr;
760 }
761
763}
764
765
767{
768 if( nullptr == color )
769 return false;
770
771 return ( (WRL2COLOR*) color )->HasColors();
772}
Definition: wrlfacet.h:43
bool HasMinPoints()
Definition: wrlfacet.cpp:173
void AddVertex(WRLVEC3F &aVertex, int aIndex)
Add the vertex and its associated index to the internal list of polygon vertices.
Definition: wrlfacet.cpp:191
void AddColor(const SGCOLOR &aColor)
Add the given RGB color to the internal list.
Definition: wrlfacet.cpp:204
void Init()
Definition: wrlfacet.cpp:158
bool SetColor(float aRedVal, float aGreenVal, float aBlueVal)
Definition: sg_base.cpp:85
The base class of all Scene Graph nodes.
Definition: sg_node.h:75
An abstract shape on 2D plane.
Definition: shape.h:126
FACET * NewFacet()
Definition: wrlfacet.cpp:695
SGNODE * CalcShape(SGNODE *aParent, SGNODE *aColor, WRL1_ORDER aVertexOrder, float aCreaseLimit=0.74317, bool isVRML2=false)
Definition: wrlfacet.cpp:703
The top node of a VRML2 model.
Definition: vrml2_base.h:60
bool ReadNode(WRLPROC &proc, WRL2NODE *aParent, WRL2NODE **aNode)
Definition: vrml2_base.cpp:277
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).
WRL2NODE * normal
Definition: vrml2_faceset.h:72
bool Read(WRLPROC &proc, WRL2BASE *aTopNode) override
WRL2NODE * coord
Definition: vrml2_faceset.h:71
std::vector< int > normalIndex
Definition: vrml2_faceset.h:83
virtual ~WRL2FACESET()
float creaseAngle
Definition: vrml2_faceset.h:85
std::vector< int > coordIndex
Definition: vrml2_faceset.h:82
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...
WRL2NODE * color
Definition: vrml2_faceset.h:70
float creaseLimit
Definition: vrml2_faceset.h:86
bool AddRefNode(WRL2NODE *aNode) override
void setDefaults(void)
bool normalPerVertex
Definition: vrml2_faceset.h:78
bool HasColors(void)
std::vector< int > colorIndex
Definition: vrml2_faceset.h:81
WRL2NODE * texCoord
Definition: vrml2_faceset.h:73
void unlinkChildNode(const WRL2NODE *aNode) override
Remove references to an owned child.
bool AddChildNode(WRL2NODE *aNode) override
bool colorPerVertex
Definition: vrml2_faceset.h:76
SGNODE * m_sgNode
Definition: vrml2_node.h:178
std::list< WRL2NODE * > m_BackPointers
Definition: vrml2_node.h:173
WRL2NODE * GetParent(void) const
Definition: vrml2_node.cpp:210
virtual void unlinkChildNode(const WRL2NODE *aNode)
Remove references to an owned child.
Definition: vrml2_node.cpp:407
WRL2NODE * m_Parent
Definition: vrml2_node.h:169
std::list< WRL2NODE * > m_Children
Definition: vrml2_node.h:174
WRL2NODES m_Type
Definition: vrml2_node.h:170
virtual bool AddRefNode(WRL2NODE *aNode)
Definition: vrml2_node.cpp:383
virtual void unlinkRefNode(const WRL2NODE *aNode)
Remove pointers to a referenced node.
Definition: vrml2_node.cpp:425
const char * GetNodeTypeName(WRL2NODES aNodeType) const
Definition: vrml2_node.cpp:273
WRL2NODES GetNodeType(void) const
Definition: vrml2_node.cpp:204
std::list< WRL2NODE * > m_Refs
Definition: vrml2_node.h:175
virtual bool AddChildNode(WRL2NODE *aNode)
Definition: vrml2_node.cpp:356
void Pop(void)
Definition: wrlproc.cpp:2035
bool ReadSFFloat(float &aSFFloat)
Definition: wrlproc.cpp:806
char Peek(void)
Definition: wrlproc.cpp:2007
std::string GetFileName(void)
Definition: wrlproc.cpp:1995
bool ReadMFInt(std::vector< int > &aMFInt32)
Definition: wrlproc.cpp:1504
std::string GetError(void)
Definition: wrlproc.cpp:1960
bool ReadSFBool(bool &aSFBool)
Definition: wrlproc.cpp:729
bool eof(void)
Definition: wrlproc.cpp:1954
bool ReadName(std::string &aName)
Definition: wrlproc.cpp:289
std::string GetFilePosition() const
Definition: wrlproc.cpp:1982
const wxChar *const traceVrmlPlugin
Flag to enable VRML plugin trace output.
Definition: vrml.cpp:63
collects header files for all SG* wrappers and the API
SGLIB_API S3D::SGTYPES GetSGNodeType(SGNODE *aNode)
Definition: ifsg_api.cpp:485
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:494
SGTYPES
Definition: sg_types.h:35
@ SGTYPE_SHAPE
Definition: sg_types.h:44
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
Definition: ifsg_api.cpp:512
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
Definition: ifsg_api.cpp:503
#define M_PI_2
Definition: transline.cpp:40
declares classes to help manage normals calculations from VRML files
WRL2NODES
Definition: wrltypes.h:125
glm::vec3 WRLVEC3F
Definition: wrltypes.h:188