KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sg_faceset.h
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) 2015-2017 Cirilo Bernardo <[email protected]>
5 * Copyright (C) 2020 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
30#ifndef SG_FACESET_H
31#define SG_FACESET_H
32
33#include <vector>
34#include "3d_cache/sg/sg_node.h"
35
36
37class SGCOLORS;
38class SGCOORDS;
39class SGNORMALS;
40class SGCOLORINDEX;
41class SGCOORDINDEX;
42
46class SGFACESET : public SGNODE
47{
48public:
49 SGFACESET( SGNODE* aParent );
50 virtual ~SGFACESET();
51
52 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
53
54 SGNODE* FindNode( const char* aNodeName, const SGNODE* aCaller ) override;
55 bool AddRefNode( SGNODE* aNode ) override;
56 bool AddChildNode( SGNODE* aNode ) override;
57
58 bool CalcNormals( SGNODE** aPtr );
59
60 void ReNameNodes( void ) override;
61 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
62
63 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
64 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
65
70 void GatherCoordIndices( std::vector< int >& aIndexList );
71
72 void unlinkChildNode( const SGNODE* aNode ) override;
73 void unlinkRefNode( const SGNODE* aNode ) override;
74
75 // validate the data held by this face set
76 bool validate( void );
77
78 // owned objects
83
84 // referenced objects
88
89private:
90 bool valid;
92 void unlinkNode( const SGNODE* aNode, bool isChild );
93 bool addNode( SGNODE* aNode, bool isChild );
94
95};
96
97/*
98 p.88
99 IndexedFaceSet {
100 color NULL
101 coord NULL
102 normal NULL
103 texCoord NULL
104 ccw TRUE
105 colorIndex []
106 colorPerVertex TRUE
107 convex TRUE
108 coordIndex []
109 creaseAngle 0
110 normalIndex []
111 normalPerVertex TRUE
112 solid TRUE
113 texCoordIndex []
114 }
115*/
116
117#endif // SG_FACESET_H
Define an RGB color set for a scenegraph object.
Definition: sg_colors.h:39
An object to maintain a coordinate index list.
Definition: sg_coordindex.h:43
Define a vertex coordinate set for a scenegraph object.
Definition: sg_coords.h:41
Define an indexed face set for a scenegraph.
Definition: sg_faceset.h:47
bool validated
Definition: sg_faceset.h:91
void GatherCoordIndices(std::vector< int > &aIndexList)
Add all internal coordinate indices to the given list in preparation for a normals calculation.
Definition: sg_faceset.cpp:968
void unlinkRefNode(const SGNODE *aNode) override
Remove pointers to a referenced node.
Definition: sg_faceset.cpp:268
SGCOORDS * m_RCoords
Definition: sg_faceset.h:86
SGCOORDINDEX * m_CoordIndices
Definition: sg_faceset.h:81
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) override
Search the tree of linked nodes and return a reference to the first node found with the given name.
Definition: sg_faceset.cpp:149
bool addNode(SGNODE *aNode, bool isChild)
Definition: sg_faceset.cpp:275
SGCOORDS * m_Coords
Definition: sg_faceset.h:80
bool CalcNormals(SGNODE **aPtr)
Definition: sg_faceset.cpp:975
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
Definition: sg_faceset.cpp:413
SGNORMALS * m_Normals
Definition: sg_faceset.h:82
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition: sg_faceset.cpp:119
void unlinkChildNode(const SGNODE *aNode) override
Remove references to an owned child.
Definition: sg_faceset.cpp:262
void unlinkNode(const SGNODE *aNode, bool isChild)
Definition: sg_faceset.cpp:199
SGCOLORS * m_RColors
Definition: sg_faceset.h:85
SGNORMALS * m_RNormals
Definition: sg_faceset.h:87
bool AddRefNode(SGNODE *aNode) override
Definition: sg_faceset.cpp:401
virtual ~SGFACESET()
Definition: sg_faceset.cpp:67
bool valid
Definition: sg_faceset.h:90
bool validate(void)
Definition: sg_faceset.cpp:854
SGCOLORS * m_Colors
Definition: sg_faceset.h:79
bool AddChildNode(SGNODE *aNode) override
Definition: sg_faceset.cpp:407
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
Definition: sg_faceset.cpp:493
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
Definition: sg_faceset.cpp:438
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
Definition: sg_faceset.cpp:601
The base class of all Scene Graph nodes.
Definition: sg_node.h:75
Define a set of vertex normals for a scene graph object.
Definition: sg_normals.h:39