Blender  V2.93
Node.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
25 #include "SceneVisitor.h"
26 
27 #include "../system/BaseObject.h"
28 #include "../system/FreestyleConfig.h"
29 #include "../system/Precision.h"
30 
31 #include "../geometry/BBox.h"
32 #include "../geometry/Geom.h"
33 
34 using namespace std;
35 
36 namespace Freestyle {
37 
38 using namespace Geometry;
39 
40 class Node : public BaseObject {
41  public:
42  inline Node() : BaseObject()
43  {
44  }
45 
46  inline Node(const Node &iBrother) : BaseObject()
47  {
48  _BBox = iBrother.bbox();
49  }
50 
51  virtual ~Node()
52  {
53  }
54 
58  virtual void accept(SceneVisitor &v)
59  {
60  v.visitNode(*this);
61  }
62 
67  virtual const BBox<Vec3r> &bbox() const
68  {
69  return _BBox;
70  }
71 
73  virtual void setBBox(const BBox<Vec3r> &iBox)
74  {
75  _BBox = iBox;
76  }
77 
79  virtual void AddBBox(const BBox<Vec3r> &iBox)
80  {
81  if (iBox.empty()) {
82  return;
83  }
84 
85  if (_BBox.empty()) {
86  _BBox = iBox;
87  }
88  else {
89  _BBox += iBox;
90  }
91  }
92 
94  virtual const BBox<Vec3r> &UpdateBBox()
95  {
96  return _BBox;
97  }
98 
100  virtual void clearBBox()
101  {
102  _BBox.clear();
103  }
104 
105  protected:
106  private:
107  BBox<Vec3r> _BBox;
108 
109 #ifdef WITH_CXX_GUARDEDALLOC
110  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Node")
111 #endif
112 };
113 
114 } /* namespace Freestyle */
Class to visit (without doing anything) a scene graph structure.
ATTR_WARN_UNUSED_RESULT const BMVert * v
bool empty() const
Definition: BBox.h:76
virtual const BBox< Vec3r > & UpdateBBox()
Definition: Node.h:94
virtual const BBox< Vec3r > & bbox() const
Definition: Node.h:67
virtual void clearBBox()
Definition: Node.h:100
virtual void accept(SceneVisitor &v)
Definition: Node.h:58
Node(const Node &iBrother)
Definition: Node.h:46
virtual void setBBox(const BBox< Vec3r > &iBox)
Definition: Node.h:73
virtual ~Node()
Definition: Node.h:51
virtual void AddBBox(const BBox< Vec3r > &iBox)
Definition: Node.h:79
inherits from class Rep
Definition: AppCanvas.cpp:32