Ocean
rendering/Switch.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_SWITCH_H
9 #define META_OCEAN_RENDERING_SWITCH_H
10 
12 #include "ocean/rendering/Group.h"
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 // Forward declaration
21 class Switch;
22 
23 /**
24  * Definition of a smart object reference holding a switch.
25  * @see SmartObjectRef, Switch.
26  * @ingroup rendering
27  */
29 
30 /**
31  * This class is the base class for all switch nodes.
32  * A switch node holds several sub nodes like a group. However, at most one of the sub nodes is visible.<br>
33  * An index is used to define which sub node is visible.
34  * @ingroup rendering
35  */
36 class OCEAN_RENDERING_EXPORT Switch : virtual public Group
37 {
38  public:
39 
40  /**
41  * Definitio of an invalid index.
42  */
43  static constexpr Index32 invalidIndex = Index32(-1);
44 
45  public:
46 
47  /**
48  * Returns the index of the active node.
49  * @return Index of active node
50  * @exception NotSupportedException Is thrown if this function is not supported
51  */
52  virtual Index32 activeNode() const;
53 
54  /**
55  * Sets the index of the active node.
56  * @param index Index of the active node
57  * @exception NotSupportedException Is thrown if this function is not supported
58  */
59  virtual void setActiveNode(const Index32 index);
60 
61  /**
62  * Returns the type of this object.
63  * @see Object::type().
64  */
65  ObjectType type() const override;
66 
67  protected:
68 
69  /**
70  * Creates a new switch object.
71  */
72  Switch();
73 
74  /**
75  * Destructs a switch object.
76  */
77  ~Switch() override;
78 };
79 
80 }
81 
82 }
83 
84 #endif // META_OCEAN_RENDERING_SWITCH_H
This is the base class for all rendering groups.
Definition: rendering/Group.h:40
ObjectType
Definition of different object type.
Definition: Object.h:63
This class implements a smart rendering object reference.
Definition: rendering/ObjectRef.h:34
This class is the base class for all switch nodes.
Definition: rendering/Switch.h:37
virtual void setActiveNode(const Index32 index)
Sets the index of the active node.
~Switch() override
Destructs a switch object.
Switch()
Creates a new switch object.
ObjectType type() const override
Returns the type of this object.
virtual Index32 activeNode() const
Returns the index of the active node.
uint32_t Index32
Definition of a 32 bit index value.
Definition: Base.h:84
constexpr VertexIndex invalidIndex
Definition of an invalid vertex index.
Definition: rendering/Rendering.h:77
SmartObjectRef< Switch > SwitchRef
Definition of a smart object reference holding a switch.
Definition: rendering/Switch.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15