Ocean
GLESAbsoluteTransform.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_GLES_ABSOLUTE_TRANSFORM_H
9 #define META_OCEAN_RENDERING_GLES_ABSOLUTE_TRANSFORM_H
10 
13 
15 
16 namespace Ocean
17 {
18 
19 namespace Rendering
20 {
21 
22 namespace GLESceneGraph
23 {
24 
25 /**
26  * This class implements a GLESceneGraph absolute transform node.
27  * @ingroup renderinggles
28  */
29 class OCEAN_RENDERING_GLES_EXPORT GLESAbsoluteTransform :
30  virtual public GLESGroup,
31  virtual public AbsoluteTransform
32 {
33  friend class GLESFactory;
34 
35  public:
36 
37  /**
38  * Returns the current transfomation type.
39  * @see AbsoluteTransform::transformationType().
40  */
42 
43  /**
44  * Returns the relative screen position of the head-up node.
45  * @see AbsoluteTransformation::headUpRelativePosition().
46  */
47  Vector2 headUpRelativePosition() const override;
48 
49  /**
50  * Returns the transformation which is applied on top of the absolute transformation.
51  * @see AbsoluteTransformation::transformation().
52  */
54 
55  /**
56  * Sets or changes the transfomation type.
57  * @see AbsoluteTransform::setTransformationType().
58  */
59  bool setTransformationType(const TransformationType type) override;
60 
61  /**
62  * Sets the relative screen position of the head-up node.
63  * @see AbsoluteTransform::setHeadUpRelativePosition().
64  */
65  bool setHeadUpRelativePosition(const Vector2& position) override;
66 
67  /**
68  * Sets an additional transformation which is applied on top of the absolute transformation.
69  * @see AbsoluteTransform::setTransformation().
70  */
71  void setTransformation(const HomogenousMatrix4& absolute_T_children) override;
72 
73  /**
74  * Adds this node and all child node to a traverser.
75  * @see GLESNode::addToTraverser().
76  */
77  void addToTraverser(const GLESFramebuffer& framebuffer, const SquareMatrix4& projectionMatrix, const HomogenousMatrix4& camera_T_parent, const Lights& lights, GLESTraverser& traverser) const override;
78 
79  protected:
80 
81  /**
82  * Creates a new GLESceneGraph absolute transform node.
83  */
85 
86  /**
87  * Destructs a GLESceneGraph absolute transform node.
88  */
90 
91  protected:
92 
93  /// The transformation type to be used.
94  TransformationType transformationType_ = TT_NONE;
95 
96  /// The relative screen position, for headup transformations.
97  Vector2 headUpPosition_ = Vector2(Scalar(0.5), Scalar(0.5));
98 
99  /// The transformation between all children and the absolute transformation.
100  HomogenousMatrix4 absolute_T_children_ = HomogenousMatrix4(true);
101 };
102 
103 }
104 
105 }
106 
107 }
108 
109 #endif // META_OCEAN_RENDERING_GLES_ABSOLUTE_TRANSFORM_H
This class is the base class for all absolute transform nodes.
Definition: AbsoluteTransform.h:36
TransformationType
Defines different transformation types.
Definition: AbsoluteTransform.h:43
This class implements a GLESceneGraph absolute transform node.
Definition: GLESAbsoluteTransform.h:32
TransformationType transformationType() const override
Returns the current transfomation type.
void addToTraverser(const GLESFramebuffer &framebuffer, const SquareMatrix4 &projectionMatrix, const HomogenousMatrix4 &camera_T_parent, const Lights &lights, GLESTraverser &traverser) const override
Adds this node and all child node to a traverser.
HomogenousMatrix4 transformation() const override
Returns the transformation which is applied on top of the absolute transformation.
bool setTransformationType(const TransformationType type) override
Sets or changes the transfomation type.
Vector2 headUpRelativePosition() const override
Returns the relative screen position of the head-up node.
GLESAbsoluteTransform()
Creates a new GLESceneGraph absolute transform node.
bool setHeadUpRelativePosition(const Vector2 &position) override
Sets the relative screen position of the head-up node.
~GLESAbsoluteTransform() override
Destructs a GLESceneGraph absolute transform node.
void setTransformation(const HomogenousMatrix4 &absolute_T_children) override
Sets an additional transformation which is applied on top of the absolute transformation.
This class implements a class factory for all GLESceneGraph objects.
Definition: GLESFactory.h:30
This class implements a base for all GLESceneGraph framebuffers.
Definition: rendering/glescenegraph/GLESFramebuffer.h:34
This class implements a GLESceneGraph group object.
Definition: GLESGroup.h:32
This class implements a traverser for renderables.
Definition: GLESTraverser.h:39
float Scalar
Definition of a scalar type.
Definition: Math.h:128
HomogenousMatrixT4< Scalar > HomogenousMatrix4
Definition of the HomogenousMatrix4 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION flag eit...
Definition: HomogenousMatrix4.h:37
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition: Vector2.h:21
std::vector< LightPair > Lights
Definition of a set holding light sources.
Definition: GLESLightSource.h:44
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15