Ocean
AbsoluteTransform.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_ABSOLUTE_TRANSFORM_H
9 #define META_OCEAN_RENDERING_ABSOLUTE_TRANSFORM_H
10 
12 #include "ocean/rendering/Group.h"
13 
14 namespace Ocean
15 {
16 
17 namespace Rendering
18 {
19 
20 // Forward declaration
21 class AbsoluteTransform;
22 
23 /**
24  * Definition of a smart object reference holding a transform node.
25  * @see SmartObjectRef, AbsoluteTransform.
26  * @ingroup rendering
27  */
29 
30 /**
31  * This class is the base class for all absolute transform nodes.
32  * An absolute transformation provides an own and explicit transformation independent form parent nodes.
33  * @ingroup rendering
34  */
35 class OCEAN_RENDERING_EXPORT AbsoluteTransform : virtual public Group
36 {
37  public:
38 
39  /**
40  * Defines different transformation types.
41  */
43  {
44  /// Transformation with no explicit absolute coordinate system
46  /// Transformation which is defined in relation to the view.
48  /// Transformation providing an explicit coordinate system for head-up objects.
49  TT_HEAD_UP
50  };
51 
52  public:
53 
54  /**
55  * Returns the current transfomation type.
56  * Default is TT_NONE.
57  * @return Transformation type
58  * @exception NotSupportedException Is thrown if this function is not supported
59  */
61 
62  /**
63  * Returns the relative screen position of the head-up node.
64  * The default value is (0.5, 0.5)
65  * @return Relative screen position, with range [0.0, 1.0] for each axis, -1.0 neglects this definition
66  * @exception NotSupportedException Is thrown if this function is not supported
67  * @see setHeadUpRelativePosition().
68  */
70 
71  /**
72  * Returns the transformation which is applied on top of the absolute transformation.
73  * @return The transformation between all child nodes and the absolute transformation (absolute_T_children)
74  */
75  virtual HomogenousMatrix4 transformation() const = 0;
76 
77  /**
78  * Sets or changes the transfomation type.
79  * Default is TT_NONE.
80  * @param type Transformation type to set
81  * @return True, if succeeded
82  * @exception NotSupportedException Is thrown if this function is not supported
83  */
84  virtual bool setTransformationType(const TransformationType type);
85 
86  /**
87  * Sets the relative screen position of the head-up node.
88  * @param position Relative screen position, with range [0.0, 1.0] for each axis, -1.0 neglects this definition
89  * @return True, if succeeded
90  * @exception NotSupportedException Is thrown if this function is not supported
91  * @see headUpRelativePosition().
92  */
93  virtual bool setHeadUpRelativePosition(const Vector2& position);
94 
95  /**
96  * Sets an additional transformation which is applied on top of the absolute transformation.
97  * @param absolute_T_children The transformation between all child nodes and the absolute transformation, must be valid
98  */
99  virtual void setTransformation(const HomogenousMatrix4& absolute_T_children) = 0;
100 
101  /**
102  * Returns the type of this object.
103  * @see Object::type().
104  */
105  ObjectType type() const override;
106 
107  protected:
108 
109  /**
110  * Creates a new absolute transform node.
111  */
113 
114  /**
115  * Destructs an absolute transform node.
116  */
117  ~AbsoluteTransform() override;
118 };
119 
120 }
121 
122 }
123 
124 #endif // META_OCEAN_RENDERING_ABSOLUTE_TRANSFORM_H
This class is the base class for all absolute transform nodes.
Definition: AbsoluteTransform.h:36
ObjectType type() const override
Returns the type of this object.
virtual Vector2 headUpRelativePosition() const
Returns the relative screen position of the head-up node.
~AbsoluteTransform() override
Destructs an absolute transform node.
virtual TransformationType transformationType() const
Returns the current transfomation type.
virtual void setTransformation(const HomogenousMatrix4 &absolute_T_children)=0
Sets an additional transformation which is applied on top of the absolute transformation.
virtual HomogenousMatrix4 transformation() const =0
Returns the transformation which is applied on top of the absolute transformation.
virtual bool setHeadUpRelativePosition(const Vector2 &position)
Sets the relative screen position of the head-up node.
AbsoluteTransform()
Creates a new absolute transform node.
TransformationType
Defines different transformation types.
Definition: AbsoluteTransform.h:43
@ TT_VIEW
Transformation which is defined in relation to the view.
Definition: AbsoluteTransform.h:47
@ TT_NONE
Transformation with no explicit absolute coordinate system.
Definition: AbsoluteTransform.h:45
virtual bool setTransformationType(const TransformationType type)
Sets or changes the transfomation type.
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
SmartObjectRef< AbsoluteTransform > AbsoluteTransformRef
Definition of a smart object reference holding a transform node.
Definition: AbsoluteTransform.h:21
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15