Ocean
rendering/Group.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_GROUP_H
9 #define META_OCEAN_RENDERING_GROUP_H
10 
13 #include "ocean/rendering/Node.h"
15 
16 #include <set>
17 #include <vector>
18 
19 namespace Ocean
20 {
21 
22 namespace Rendering
23 {
24 
25 // Forward declaration
26 class Group;
27 
28 /**
29  * Definition of a smart object reference holding a group.
30  * @see SmartObjectRef, Group.
31  * @ingroup rendering
32  */
34 
35 /**
36  * This is the base class for all rendering groups.
37  * @ingroup rendering
38  */
39 class OCEAN_RENDERING_EXPORT Group : virtual public Node
40 {
41  protected:
42 
43  /**
44  * Definition of a vector holding node objects.
45  */
46  typedef std::vector<NodeRef> Nodes;
47 
48  /**
49  * Definition of a set holding light objects.
50  */
51  typedef std::set<LightSourceRef> LightSet;
52 
53  public:
54 
55  /**
56  * Adds a new child node to this group.
57  * @param node New child node to add
58  */
59  virtual void addChild(const NodeRef& node);
60 
61  /**
62  * Registers a light lighting all childs of this group node.
63  * @param light Light to register
64  */
65  virtual void registerLight(const LightSourceRef& light);
66 
67  /**
68  * Returns the number of child nodes connected to this group.
69  * @return Number of child nodes
70  */
71  virtual unsigned int numberChildren() const;
72 
73  /**
74  * Returns a specific child node defined by it's index.
75  * @param index Index of the child node inside this group
76  * @return Child node
77  */
78  virtual NodeRef child(const unsigned int index) const;
79 
80  /**
81  * Removes a child node connected to this group.
82  * @param node Child node to remove
83  */
84  virtual void removeChild(const NodeRef& node);
85 
86  /**
87  * Unregisters a light.
88  * @param light Light to unregister
89  */
90  virtual void unregisterLight(const LightSourceRef& light);
91 
92  /**
93  * Removes all child nodes connected to this group.
94  */
95  virtual void clear();
96 
97  /**
98  * Returns the type of this object.
99  * @see Object::type().
100  */
101  ObjectType type() const override;
102 
103  protected:
104 
105  /**
106  * Creates a new group object.
107  */
108  Group();
109 
110  /**
111  * Destructs a group object.
112  */
113  ~Group() override;
114 
115  protected:
116 
117  /// Child nodes connected to this group
119 
120  /// Set holding all lights lighting object in this group
122 };
123 
124 }
125 
126 }
127 
128 #endif // META_OCEAN_RENDERING_GROUP_H
This is the base class for all rendering groups.
Definition: rendering/Group.h:40
std::set< LightSourceRef > LightSet
Definition of a set holding light objects.
Definition: rendering/Group.h:51
Nodes groupNodes
Child nodes connected to this group.
Definition: rendering/Group.h:118
~Group() override
Destructs a group object.
virtual void clear()
Removes all child nodes connected to this group.
Group()
Creates a new group object.
LightSet groupLights
Set holding all lights lighting object in this group.
Definition: rendering/Group.h:121
virtual void registerLight(const LightSourceRef &light)
Registers a light lighting all childs of this group node.
virtual void unregisterLight(const LightSourceRef &light)
Unregisters a light.
std::vector< NodeRef > Nodes
Definition of a vector holding node objects.
Definition: rendering/Group.h:46
virtual void addChild(const NodeRef &node)
Adds a new child node to this group.
virtual NodeRef child(const unsigned int index) const
Returns a specific child node defined by it's index.
virtual void removeChild(const NodeRef &node)
Removes a child node connected to this group.
virtual unsigned int numberChildren() const
Returns the number of child nodes connected to this group.
ObjectType type() const override
Returns the type of this object.
This is the base class for all rendering nodes.
Definition: rendering/Node.h:47
ObjectType
Definition of different object type.
Definition: Object.h:63
SmartObjectRef< Group > GroupRef
Definition of a smart object reference holding a group.
Definition: rendering/Group.h:26
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15