Ocean
Loading...
Searching...
No Matches
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
14
15#include <map>
16
17namespace Ocean
18{
19
20namespace Rendering
21{
22
23// Forward declaration
24class 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 */
42class OCEAN_RENDERING_EXPORT Geometry : virtual public Node
43{
44 protected:
45
46 /**
47 * Definition of a map mapping renderable objects to attributes.
48 */
49 using Renderables = std::map<RenderableRef, AttributeSetRef>;
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 */
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
std::map< RenderableRef, AttributeSetRef > Renderables
Definition of a map mapping renderable objects to attributes.
Definition rendering/Geometry.h:49
~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.
Renderables renderables_
Renderables object connected to this geometry.
Definition rendering/Geometry.h:108
virtual void removeRenderable(const RenderableRef &renderable)
Removes a renderable object connected to this geometry.
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.
Node()
Creates a new node.
ObjectType
Definition of different object type.
Definition Object.h:62
This class implements a smart rendering object reference.
Definition rendering/ObjectRef.h:34
SmartObjectRef< AttributeSet > AttributeSetRef
Definition of a smart object reference holding an attribute set.
Definition AttributeSet.h:32
SmartObjectRef< Renderable > RenderableRef
Definition of a smart object reference holding a renderable node.
Definition Renderable.h:29
SmartObjectRef< Geometry > GeometryRef
Definition of a smart object reference holding a geometry.
Definition rendering/Geometry.h:31
Namespace of the Rendering library.
Definition AbsoluteTransform.h:18
The namespace covering the entire Ocean framework.
Definition Accessor.h:15