Blender  V3.3
Node.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #pragma once
4 
11 #include "SceneVisitor.h"
12 
13 #include "../system/BaseObject.h"
14 #include "../system/FreestyleConfig.h"
15 #include "../system/Precision.h"
16 
17 #include "../geometry/BBox.h"
18 #include "../geometry/Geom.h"
19 
20 using namespace std;
21 
22 namespace Freestyle {
23 
24 using namespace Geometry;
25 
26 class Node : public BaseObject {
27  public:
28  inline Node() : BaseObject()
29  {
30  }
31 
32  inline Node(const Node &iBrother) : BaseObject()
33  {
34  _BBox = iBrother.bbox();
35  }
36 
37  virtual ~Node()
38  {
39  }
40 
44  virtual void accept(SceneVisitor &v)
45  {
46  v.visitNode(*this);
47  }
48 
53  virtual const BBox<Vec3r> &bbox() const
54  {
55  return _BBox;
56  }
57 
59  virtual void setBBox(const BBox<Vec3r> &iBox)
60  {
61  _BBox = iBox;
62  }
63 
65  virtual void AddBBox(const BBox<Vec3r> &iBox)
66  {
67  if (iBox.empty()) {
68  return;
69  }
70 
71  if (_BBox.empty()) {
72  _BBox = iBox;
73  }
74  else {
75  _BBox += iBox;
76  }
77  }
78 
80  virtual const BBox<Vec3r> &UpdateBBox()
81  {
82  return _BBox;
83  }
84 
86  virtual void clearBBox()
87  {
88  _BBox.clear();
89  }
90 
91  protected:
92  private:
93  BBox<Vec3r> _BBox;
94 
95 #ifdef WITH_CXX_GUARDEDALLOC
96  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Node")
97 #endif
98 };
99 
100 } /* 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:62
virtual const BBox< Vec3r > & UpdateBBox()
Definition: Node.h:80
virtual const BBox< Vec3r > & bbox() const
Definition: Node.h:53
virtual void clearBBox()
Definition: Node.h:86
virtual void accept(SceneVisitor &v)
Definition: Node.h:44
Node(const Node &iBrother)
Definition: Node.h:32
virtual void setBBox(const BBox< Vec3r > &iBox)
Definition: Node.h:59
virtual ~Node()
Definition: Node.h:37
virtual void AddBBox(const BBox< Vec3r > &iBox)
Definition: Node.h:65
inherits from class Rep
Definition: AppCanvas.cpp:18