KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright The 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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25
26#ifndef SG_SHAPE_H
27#define SG_SHAPE_H
28
29#include <vector>
30#include "3d_cache/sg/sg_node.h"
31
32class SGAPPEARANCE;
33class SGFACESET;
34
38class SGSHAPE : public SGNODE
39{
40public:
41 SGSHAPE( SGNODE* aParent );
42 virtual ~SGSHAPE();
43
44 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
45
46 SGNODE* FindNode(const char* aNodeName, const SGNODE* aCaller) override;
47 bool AddRefNode( SGNODE* aNode ) override;
48 bool AddChildNode( SGNODE* aNode ) override;
49
50 void ReNameNodes( void ) override;
51 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
52
53 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
54 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
55
56 bool Prepare( const glm::dmat4* aTransform, S3D::MATLIST& materials,
57 std::vector< SMESH >& meshes );
58
59 void unlinkChildNode( const SGNODE* aNode ) override;
60 void unlinkRefNode( const SGNODE* aNode ) override;
61
62private:
63 void unlinkNode( const SGNODE* aNode, bool isChild );
64 bool addNode( SGNODE* aNode, bool isChild );
65
66public:
67 // owned node
70
71 // referenced nodes
74};
75
76/*
77 p.107
78 Shape {
79 appearance NULL
80 geometry NULL
81 }
82*/
83
84#endif // SG_SHAPE_H
Defines the generic material appearance of a scenegraph object.
Define an indexed face set for a scenegraph.
Definition sg_faceset.h:43
SGNODE(SGNODE *aParent)
Definition sg_node.cpp:72
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_shape.cpp:120
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
Definition sg_shape.cpp:312
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition sg_shape.cpp:90
bool AddChildNode(SGNODE *aNode) override
Definition sg_shape.cpp:288
void unlinkRefNode(const SGNODE *aNode) override
Remove pointers to a referenced node.
Definition sg_shape.cpp:205
void unlinkNode(const SGNODE *aNode, bool isChild)
Definition sg_shape.cpp:158
bool Prepare(const glm::dmat4 *aTransform, S3D::MATLIST &materials, std::vector< SMESH > &meshes)
Definition sg_shape.cpp:599
virtual ~SGSHAPE()
Definition sg_shape.cpp:58
SGFACESET * m_RFaceSet
Definition sg_shape.h:73
bool AddRefNode(SGNODE *aNode) override
Definition sg_shape.cpp:282
SGSHAPE(SGNODE *aParent)
Definition sg_shape.cpp:36
SGFACESET * m_FaceSet
Definition sg_shape.h:69
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
Definition sg_shape.cpp:294
bool addNode(SGNODE *aNode, bool isChild)
Definition sg_shape.cpp:211
void unlinkChildNode(const SGNODE *aNode) override
Remove references to an owned child.
Definition sg_shape.cpp:199
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
Definition sg_shape.cpp:355
SGAPPEARANCE * m_RAppearance
Definition sg_shape.h:72
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
Definition sg_shape.cpp:443
SGAPPEARANCE * m_Appearance
Definition sg_shape.h:68