KiCad PCB EDA Suite
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
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  *
20  * or you may search the 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  */
29 #ifndef SG_NORMALS_H
30 #define SG_NORMALS_H
32 #include <vector>
33 #include "3d_cache/sg/sg_node.h"
38 class SGNORMALS : public SGNODE
39 {
40 public:
41  SGNORMALS( SGNODE* aParent );
42  virtual ~SGNORMALS();
44  virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
46  SGNODE* FindNode( const char* aNodeName, const SGNODE* aCaller ) noexcept override;
47  bool AddRefNode( SGNODE* aNode ) noexcept override;
48  bool AddChildNode( SGNODE* aNode ) noexcept override;
50  bool GetNormalList( size_t& aListSize, SGVECTOR*& aNormalList );
51  void SetNormalList( size_t aListSize, const SGVECTOR* aNormalList );
52  void AddNormal( double aXValue, double aYValue, double aZValue );
53  void AddNormal( const SGVECTOR& aNormal );
55  void ReNameNodes( void ) override;
56  bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
58  bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
59  bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
61  void unlinkChildNode( const SGNODE* aNode ) noexcept override;
62  void unlinkRefNode( const SGNODE* aNode ) noexcept override;
64  std::vector< SGVECTOR > norms;
65 };
67 #endif // SG_NORMALS_H
bool AddChildNode(SGNODE *aNode) noexcept override
Definition: sg_normals.cpp:121
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
Definition: sg_normals.cpp:168
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
Definition: sg_normals.cpp:234
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
Definition: sg_normals.cpp:101
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition: sg_normals.cpp:59
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
Definition: sg_normals.cpp:107
The base class of all Scene Graph nodes.
Definition: sg_node.h:74
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
Definition: sg_normals.cpp:279
virtual ~SGNORMALS()
Definition: sg_normals.cpp:53
Define a set of vertex normals for a scene graph object.
Definition: sg_normals.h:38
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
Definition: sg_normals.cpp:178
std::vector< SGVECTOR > norms
Definition: sg_normals.h:64
void AddNormal(double aXValue, double aYValue, double aZValue)
Definition: sg_normals.cpp:156
bool AddRefNode(SGNODE *aNode) noexcept override
Definition: sg_normals.cpp:113
void SetNormalList(size_t aListSize, const SGVECTOR *aNormalList)
Definition: sg_normals.cpp:144
bool GetNormalList(size_t &aListSize, SGVECTOR *&aNormalList)
Definition: sg_normals.cpp:129
Definition: sg_normals.cpp:33
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override
Search the tree of linked nodes and return a reference to the first node found with the given name.
Definition: sg_normals.cpp:89