Ocean
rendering/Node.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_RENDERING_NODE_H
9 #define META_OCEAN_RENDERING_NODE_H
10 
12 #include "ocean/rendering/Object.h"
15 
16 #include "ocean/math/BoundingBox.h"
19 
20 namespace Ocean
21 {
22 
23 namespace Rendering
24 {
25 
26 // Forward declaration
27 class Node;
28 
29 /**
30  * Definition of a smart object reference holding a node.
31  * @see SmartObjectRef, Node.
32  * @ingroup rendering
33  */
35 
36 /**
37  * Definition of a vector holding node references.
38  * @ingroup rendering
39  */
40 typedef std::vector<NodeRef> NodeRefs;
41 
42 /**
43  * This is the base class for all rendering nodes.
44  * @ingroup rendering
45  */
46 class OCEAN_RENDERING_EXPORT Node : virtual public Object
47 {
48  public:
49 
50  /**
51  * Returns the type of this object.
52  * @see Object::type().
53  */
54  ObjectType type() const override;
55 
56  /**
57  * Returns whether the node is visible.
58  * As default the node is visible.
59  * @see setVisible().
60  * @return True, if so
61  */
62  virtual bool visible() const;
63 
64  /**
65  * Returns the bounding box of this node.
66  * @param involveLocalTransformation True, to involve local transformations (e.g., from a Transform node) into the bounding box; False, to skip any local transformation
67  * @return Node bounding box
68  */
69  virtual BoundingBox boundingBox(const bool involveLocalTransformation = true) const;
70 
71  /**
72  * Returns the bounding sphere of this node.
73  * @param involveLocalTransformation True, to involve local transformations (e.g., from a Transform node) into the bounding box; False, to skip any local transformation
74  * @return Bounding sphere
75  */
76  virtual BoundingSphere boundingSphere(const bool involveLocalTransformation = true) const;
77 
78  /**
79  * Returns the first possible transformation transforming this node into world coordinates.
80  * The returned transformation is the concatenated transformation result of this node with all parent nodes up to the global root-scene.<br>
81  * @return The first possible world transformation, which is world_T_node
82  * @see worldTransformations().
83  */
85 
86  /**
87  * Returns all possible transformations transforming this node into world coordinates.
88  * The returned transformations are concatenated transformations of this node with all parent nodes up to the global root-scene.<br>
89  * @return All possible world transformations, which is world_T_nodes
90  * @see worldTransformation().
91  */
93 
94  /**
95  * Sets whether the node is visible.
96  * As default the node is visible.
97  * @param visible True, to make the node visible
98  * @see visible().
99  */
100  virtual void setVisible(const bool visible);
101 
102  protected:
103 
104  /**
105  * Creates a new node.
106  */
107  Node();
108 
109  /**
110  * Destructs a node.
111  */
112  ~Node() override;
113 };
114 
115 }
116 
117 }
118 
119 #endif // META_OCEAN_RENDERING_NODE_H
This class implements a 3D bounding box.
Definition: BoundingBox.h:23
This class implements a bounding sphere.
Definition: BoundingSphere.h:23
This is the base class for all rendering nodes.
Definition: rendering/Node.h:47
virtual bool visible() const
Returns whether the node is visible.
virtual HomogenousMatrices4 worldTransformations() const
Returns all possible transformations transforming this node into world coordinates.
virtual HomogenousMatrix4 worldTransformation() const
Returns the first possible transformation transforming this node into world coordinates.
virtual void setVisible(const bool visible)
Sets whether the node is visible.
virtual BoundingBox boundingBox(const bool involveLocalTransformation=true) const
Returns the bounding box of this node.
virtual BoundingSphere boundingSphere(const bool involveLocalTransformation=true) const
Returns the bounding sphere of this node.
Node()
Creates a new node.
ObjectType type() const override
Returns the type of this object.
~Node() override
Destructs a node.
This class is the base class for all rendering objects.
Definition: Object.h:54
ObjectType
Definition of different object type.
Definition: Object.h:63
std::vector< HomogenousMatrix4 > HomogenousMatrices4
Definition of a vector holding HomogenousMatrix4 objects.
Definition: HomogenousMatrix4.h:73
SmartObjectRef< Node > NodeRef
Definition of a smart object reference holding a node.
Definition: rendering/Node.h:27
std::vector< NodeRef > NodeRefs
Definition of a vector holding node references.
Definition: rendering/Node.h:40
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15