Blender V4.3
Node.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13#include "SceneVisitor.h"
14
17#include "../system/Precision.h"
18
19#include "../geometry/BBox.h"
20#include "../geometry/Geom.h"
21
22using namespace std;
23
24namespace Freestyle {
25
26using namespace Geometry;
27
28class Node : public BaseObject {
29 public:
30 inline Node() : BaseObject() {}
31
32 inline Node(const Node &iBrother) : BaseObject()
33 {
34 _BBox = iBrother.bbox();
35 }
36
37 virtual ~Node() {}
38
42 virtual void accept(SceneVisitor &v)
43 {
44 v.visitNode(*this);
45 }
46
51 virtual const BBox<Vec3r> &bbox() const
52 {
53 return _BBox;
54 }
55
57 virtual void setBBox(const BBox<Vec3r> &iBox)
58 {
59 _BBox = iBox;
60 }
61
63 virtual void AddBBox(const BBox<Vec3r> &iBox)
64 {
65 if (iBox.empty()) {
66 return;
67 }
68
69 if (_BBox.empty()) {
70 _BBox = iBox;
71 }
72 else {
73 _BBox += iBox;
74 }
75 }
76
78 virtual const BBox<Vec3r> &UpdateBBox()
79 {
80 return _BBox;
81 }
82
84 virtual void clearBBox()
85 {
86 _BBox.clear();
87 }
88
89 protected:
90 private:
91 BBox<Vec3r> _BBox;
92
93#ifdef WITH_CXX_GUARDEDALLOC
94 MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Node")
95#endif
96};
97
98} /* namespace Freestyle */
A class to hold a bounding box.
Base Class for most shared objects (Node, Rep). Defines the addRef, release system.
Configuration definitions.
Vectors and Matrices (useful type definitions)
Define the float precision used in the program.
Class to visit (without doing anything) a scene graph structure.
ATTR_WARN_UNUSED_RESULT const BMVert * v
bool empty() const
Definition BBox.h:64
virtual const BBox< Vec3r > & bbox() const
Definition Node.h:51
virtual void clearBBox()
Definition Node.h:84
virtual void accept(SceneVisitor &v)
Definition Node.h:42
Node(const Node &iBrother)
Definition Node.h:32
virtual void setBBox(const BBox< Vec3r > &iBox)
Definition Node.h:57
virtual ~Node()
Definition Node.h:37
virtual void AddBBox(const BBox< Vec3r > &iBox)
Definition Node.h:63
virtual const BBox< Vec3r > & UpdateBBox()
Definition Node.h:78
inherits from class Rep
Definition AppCanvas.cpp:20