KiCad PCB EDA Suite
sg_shape.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 <cirilo.bernardo@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
30 #ifndef SG_SHAPE_H
31 #define SG_SHAPE_H
32 
33 #include <vector>
34 #include "3d_cache/sg/sg_node.h"
35 
36 class SGAPPEARANCE;
37 class SGFACESET;
38 
39 class SGSHAPE : public SGNODE
40 {
41 private:
42  void unlinkNode( const SGNODE* aNode, bool isChild );
43  bool addNode( SGNODE* aNode, bool isChild );
44 
45 public:
46  // owned node
49 
50  // referenced nodes
53 
54  void unlinkChildNode( const SGNODE* aNode ) override;
55  void unlinkRefNode( const SGNODE* aNode ) override;
56 
57 public:
58  SGSHAPE( SGNODE* aParent );
59  virtual ~SGSHAPE();
60 
61  virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
62 
63  SGNODE* FindNode(const char *aNodeName, const SGNODE *aCaller) override;
64  bool AddRefNode( SGNODE* aNode ) override;
65  bool AddChildNode( SGNODE* aNode ) override;
66 
67  void ReNameNodes( void ) override;
68  bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
69 
70  bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
71  bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
72 
73  bool Prepare( const glm::dmat4* aTransform,
74  S3D::MATLIST& materials, std::vector< SMESH >& meshes );
75 };
76 
77 /*
78  p.107
79  Shape {
80  appearance NULL
81  geometry NULL
82  }
83 */
84 
85 #endif // SG_SHAPE_H
virtual ~SGSHAPE()
Definition: sg_shape.cpp:68
void unlinkChildNode(const SGNODE *aNode) override
Function unlinkChild removes references to an owned child; it is invoked by the child upon destructio...
Definition: sg_shape.cpp:219
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Function ReadCache Reads binary format data from a cache file.
Definition: sg_shape.cpp:511
void unlinkNode(const SGNODE *aNode, bool isChild)
Definition: sg_shape.cpp:170
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Function WriteVRML writes this node's data to a VRML file; this includes all data of child and refere...
Definition: sg_shape.cpp:359
bool addNode(SGNODE *aNode, bool isChild)
Definition: sg_shape.cpp:233
SGFACESET * m_RFaceSet
Definition: sg_shape.h:52
defines the base class of the intermediate scene graph NODE
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
bool Prepare(const glm::dmat4 *aTransform, S3D::MATLIST &materials, std::vector< SMESH > &meshes)
Definition: sg_shape.cpp:711
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Function WriteCache write's this node's data to a binary cache file; the data includes all data of ch...
Definition: sg_shape.cpp:403
SGAPPEARANCE * m_Appearance
Definition: sg_shape.h:47
bool AddRefNode(SGNODE *aNode) override
Definition: sg_shape.cpp:327
void ReNameNodes(void) override
Function ReNameNodes renames a node and all its child nodes in preparation for Write() operations...
Definition: sg_shape.cpp:339
SGFACESET * m_FaceSet
Definition: sg_shape.h:48
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) override
Function FindNode searches the tree of linked nodes and returns a reference to the first node found w...
Definition: sg_shape.cpp:132
SGSHAPE(SGNODE *aParent)
Definition: sg_shape.cpp:39
bool AddChildNode(SGNODE *aNode) override
Definition: sg_shape.cpp:333
SGAPPEARANCE * m_RAppearance
Definition: sg_shape.h:51
void unlinkRefNode(const SGNODE *aNode) override
Function unlinkRef removes pointers to a referenced node; it is invoked by the referenced node upon d...
Definition: sg_shape.cpp:226
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Function SetParent sets the parent SGNODE of this object.
Definition: sg_shape.cpp:102