Ocean
Primitive.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_PRIMITIVE_H
9 #define META_OCEAN_RENDERING_PRIMITIVE_H
10 
14 
15 namespace Ocean
16 {
17 
18 namespace Rendering
19 {
20 
21 // Forward declaration
22 class Primitive;
23 
24 /**
25  * Definition of a smart object reference holding a primitive.
26  * @see SmartObjectRef, Primitive.
27  * @ingroup rendering
28  */
30 
31 /**
32  * This class is the base class for all primitive objects.
33  * A primitive object defines a mesh by the use of a vertex set.<br>
34  * Mainly two different types primitives exist: independent primitives and strip primitives.<br>
35  * Independent primitives defines a mesh by separated and self-contained triangles or quads.<br>
36  * Strip primitives defines a mesh using strips or fans to define consecutive triangles or quads.<br>
37  * Different primitive objects can use the same vertex set to share common vertices and to reduce memory usage.
38  * @see VertexSet, IndependentPrimitive, StripPrimitive
39  * @ingroup rendering
40  */
41 class OCEAN_RENDERING_EXPORT Primitive : virtual public Renderable
42 {
43  public:
44 
45  /**
46  * Returns the vertex set of this primitive object.
47  * @return Vertex set object
48  */
49  inline const VertexSetRef& vertexSet() const;
50 
51  /**
52  * Sets the vertex set of this primitive object.
53  * @param vertexSet New vertex set object
54  */
55  virtual void setVertexSet(const VertexSetRef& vertexSet);
56 
57  /**
58  * Returns the type of this object.
59  * @see Object::type().
60  */
61  ObjectType type() const override;
62 
63  protected:
64 
65  /**
66  * Creates a new primitive object.
67  */
69 
70  /**
71  * Destructs a primitive object.
72  */
73  ~Primitive() override;
74 
75  protected:
76 
77  /// Vertex set object.
79 };
80 
81 inline const VertexSetRef& Primitive::vertexSet() const
82 {
83  return primitiveVertexSet;
84 }
85 
86 }
87 
88 }
89 
90 #endif // META_OCEAN_RENDERING_PRIMITIVE_H
ObjectType
Definition of different object type.
Definition: Object.h:63
This class is the base class for all primitive objects.
Definition: Primitive.h:42
VertexSetRef primitiveVertexSet
Vertex set object.
Definition: Primitive.h:78
const VertexSetRef & vertexSet() const
Returns the vertex set of this primitive object.
Definition: Primitive.h:81
Primitive()
Creates a new primitive object.
virtual void setVertexSet(const VertexSetRef &vertexSet)
Sets the vertex set of this primitive object.
~Primitive() override
Destructs a primitive object.
ObjectType type() const override
Returns the type of this object.
This class is the base class for all renderable objects.
Definition: Renderable.h:38
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
SmartObjectRef< Primitive > PrimitiveRef
Definition of a smart object reference holding a primitive.
Definition: Primitive.h:22
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15