1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
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  * @file vrml2_faceset.h
27  */
28 
29 
30 #ifndef VRML2_FACESET_H
31 #define VRML2_FACESET_H
32 
33 #include <vector>
34 
35 #include "vrml2_node.h"
36 
37 class WRL2BASE;
38 class SGNODE;
39 
40 class WRL2FACESET : public WRL2NODE
41 {
42 public:
43     WRL2FACESET();
44     WRL2FACESET( WRL2NODE* aParent );
45     virtual ~WRL2FACESET();
46 
47     bool Read( WRLPROC& proc, WRL2BASE* aTopNode ) override;
48     bool AddRefNode( WRL2NODE* aNode ) override;
49     bool AddChildNode( WRL2NODE* aNode ) override;
50     SGNODE* TranslateToSG( SGNODE* aParent ) override;
51 
52     /**
53      * @return true if the face set has a color node.
54      */
55     bool HasColors( void );
56 
57     bool isDangling( void ) override;
58 
59     void unlinkChildNode( const WRL2NODE* aNode ) override;
60     void unlinkRefNode( const WRL2NODE* aNode ) override;
61 
62 private:
63     /**
64      * @return true if the node type is a valid subnode of FaceSet.
65      */
66     bool checkNodeType( WRL2NODES aType );
67 
68     void setDefaults( void );
69 
70     WRL2NODE* color;
71     WRL2NODE* coord;
72     WRL2NODE* normal;
73     WRL2NODE* texCoord;
74 
75     bool ccw;
76     bool colorPerVertex;
77     bool convex;
78     bool normalPerVertex;
79     bool solid;
80 
81     std::vector< int > colorIndex;
82     std::vector< int > coordIndex;
83     std::vector< int > normalIndex;
84 
85     float creaseAngle;
86     float creaseLimit;
87 };
88 
89 #endif  // VRML2_FACESET_H
90