Ocean
rendering/Geometry.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_GEOMETRY_H
9 #define META_OCEAN_RENDERING_GEOMETRY_H
10 
13 #include "ocean/rendering/Node.h"
14 
15 #include <map>
16 
17 namespace Ocean
18 {
19 
20 namespace Rendering
21 {
22 
23 // Forward declaration
24 class Geometry;
25 
26 /**
27  * Definition of a smart object reference holding a geometry.
28  * @see SmartObjectRef, Geometry.
29  * @ingroup rendering
30  */
32 
33 /**
34  * This class is the base class for all rendering geometry nodes.<br>
35  * Each geometry node can holds several different renderable objects associated with different appearance attributes.<br>
36  * All renderable objects are defined in the same coordinate system.<br>
37  * A group node can be used to group several independent geometry nodes.<br>
38  * Geometry nodes with different coordinate systems can be defined by the use of transform nodes as father nodes.<br>
39  * @see Renderable, AttributeSet, Group, Transform
40  * @ingroup rendering
41  */
42 class OCEAN_RENDERING_EXPORT Geometry : virtual public Node
43 {
44  protected:
45 
46  /**
47  * Definition of a map mapping renderable objects to attributes.
48  */
49  typedef std::map<RenderableRef, AttributeSetRef> Renderables;
50 
51  public:
52 
53  /**
54  * Adds a new renderable object to this geometry.
55  * @see Renderable, AttributeSet
56  * @param renderable New renderable object
57  * @param attributes Attributes associated with the renderable object
58  */
59  virtual void addRenderable(const RenderableRef& renderable, const AttributeSetRef& attributes);
60 
61  /**
62  * Returns the number of renderable objects connected to this geometry.
63  * @return Number of renderable objects
64  */
65  virtual unsigned int numberRenderables() const;
66 
67  /**
68  * Returns a specified renderable holds by this geometry object.
69  * @param index Index of the renderable object to return
70  * @return Renderable object
71  */
72  virtual RenderableRef renderable(const unsigned int index) const;
73 
74  /**
75  * Returns an attribute set connected with a renderable object specified by the index.
76  * @param index Index of the renderable object to return the attribute set for
77  * @return Attribute set object
78  */
79  virtual AttributeSetRef attributeSet(const unsigned int index) const;
80 
81  /**
82  * Removes a renderable object connected to this geometry.
83  * @param renderable Renderable object to remove
84  */
85  virtual void removeRenderable(const RenderableRef& renderable);
86 
87  /**
88  * Returns the type of this object.
89  * @see Object::type().
90  */
91  ObjectType type() const override;
92 
93  protected:
94 
95  /**
96  * Creates a new geometry object.
97  */
99 
100  /**
101  * Destructs a geometry object.
102  */
103  ~Geometry() override;
104 
105  protected:
106 
107  /// Renderables object connected to this geometry.
109 };
110 
111 }
112 
113 }
114 
115 #endif // META_OCEAN_RENDERING_GEOMETRY_H
This class is the base class for all rendering geometry nodes.
Definition: rendering/Geometry.h:43
~Geometry() override
Destructs a geometry object.
ObjectType type() const override
Returns the type of this object.
virtual void addRenderable(const RenderableRef &renderable, const AttributeSetRef &attributes)
Adds a new renderable object to this geometry.
virtual RenderableRef renderable(const unsigned int index) const
Returns a specified renderable holds by this geometry object.
virtual void removeRenderable(const RenderableRef &renderable)
Removes a renderable object connected to this geometry.
std::map< RenderableRef, AttributeSetRef > Renderables
Definition of a map mapping renderable objects to attributes.
Definition: rendering/Geometry.h:49
Geometry()
Creates a new geometry object.
virtual AttributeSetRef attributeSet(const unsigned int index) const
Returns an attribute set connected with a renderable object specified by the index.
virtual unsigned int numberRenderables() const
Returns the number of renderable objects connected to this geometry.
Renderables geometryRenderables
Renderables object connected to this geometry.
Definition: rendering/Geometry.h:108
This is the base class for all rendering nodes.
Definition: rendering/Node.h:47
ObjectType
Definition of different object type.
Definition: Object.h:63
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
SmartObjectRef< Geometry > GeometryRef
Definition of a smart object reference holding a geometry.
Definition: rendering/Geometry.h:24
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15