Ocean
Loading...
Searching...
No Matches
UndistortedBackground.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_UNDISTORTED_BACKGROUND_H
9#define META_OCEAN_RENDERING_UNDISTORTED_BACKGROUND_H
10
15
17
19
20namespace Ocean
21{
22
23namespace Rendering
24{
25
26// Forward declaration
27class UndistortedBackground;
28
29/**
30 * Definition of a smart object reference holding an undistorted background node.
31 * @see SmartObjectRef, UndistortedBackground.
32 * @ingroup rendering
33 */
35
36/**
37 * This class is the base class for all undistorted backgrounds.<br>
38 * The undistorted background uses a frame medium object as background image<br>
39 * and uses corresponding camera calibration parameters for correct visualization.<br>
40 * @see FrameMedium, PinholeCamera, CameraCalibrationManager
41 * @ingroup rendering
42 */
43class OCEAN_RENDERING_EXPORT UndistortedBackground :
44 virtual public Background,
45 virtual public DynamicObject
46{
47 public:
48
49 /**
50 * Definition of different distortion display types.
51 */
53 {
54 /// Fastest display type.
56 /// Undistorted display type.
57 DT_UNDISTORTED
58 };
59
60 public:
61
62 /**
63 * Returns the image source used as background image.
64 * @return Frame medium background object
65 */
66 virtual const Media::FrameMediumRef& medium() const;
67
68 /**
69 * Returns the camera object related to the background image.
70 * @return Current camera object
71 */
72 virtual const PinholeCamera& camera() const;
73
74 /**
75 * Returns the display type of this background object.
76 * Default is DT_FASTEST.
77 * @return Distortion display type
78 * @exception NotSupportedException Is thrown if this function is not supported
79 */
80 virtual DisplayType displayType() const;
81
82 /**
83 * Sets the distance between viewer and background.
84 * @see Background::setDistance().
85 */
86 bool setDistance(const Scalar distance) override;
87
88 /**
89 * Sets the image source for the undistorted background.
90 * @param medium Frame medium providing the background image
91 */
92 virtual void setMedium(const Media::FrameMediumRef& medium);
93
94 /**
95 * Sets the display type of this background object.
96 * @param type Distortion display type to be set
97 * @return True, if succceeded
98 * @exception NotSupportedException Is thrown if this function is not supported
99 */
100 virtual bool setDisplayType(const DisplayType type);
101
102 /**
103 * Returns the type of this object.
104 * @see Object::type().
105 */
106 ObjectType type() const override;
107
108 protected:
109
110 /**
111 * Creates an undistorted background object.
112 */
114
115 /**
116 * Destructs an undistorted background object.
117 */
119
120 /**
121 * Update function called by the framebuffer.
122 * @see DynamicObject::onDynamicUpdate().
123 */
124 void onDynamicUpdate(const ViewRef& view, const Timestamp timestamp) override;
125
126 /**
127 * Event function if the camera of the used medium has changed.
128 * @param timestamp Event timestamp
129 */
130 virtual void onMediumCameraChanged(const Timestamp timestamp) = 0;
131
132 protected:
133
134 /// Frame medium object providing the image data for the background.
136
137 /// The camera profile of the medium for the last update timestamp.
139
140 /// True, if the camera has changed since the last update.
141 bool cameraChanged_ = false;
142
143 /// 2D texture object holding the background image.
145};
146
147}
148
149}
150
151#endif // META_OCEAN_RENDERING_UNDISTORTED_BACKGROUND_H
This class is the base class for all backgrounds.
Definition rendering/Background.h:37
This class is the base class for all dynamic scene graph objects.
Definition DynamicObject.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 undistorted backgrounds.
Definition UndistortedBackground.h:46
virtual bool setDisplayType(const DisplayType type)
Sets the display type of this background object.
UndistortedBackground()
Creates an undistorted background object.
virtual void onMediumCameraChanged(const Timestamp timestamp)=0
Event function if the camera of the used medium has changed.
virtual void setMedium(const Media::FrameMediumRef &medium)
Sets the image source for the undistorted background.
virtual const Media::FrameMediumRef & medium() const
Returns the image source used as background image.
PinholeCamera mediumCamera_
The camera profile of the medium for the last update timestamp.
Definition UndistortedBackground.h:138
virtual DisplayType displayType() const
Returns the display type of this background object.
DisplayType
Definition of different distortion display types.
Definition UndistortedBackground.h:53
@ DT_FASTEST
Fastest display type.
Definition UndistortedBackground.h:55
MediaTexture2DRef texture_
2D texture object holding the background image.
Definition UndistortedBackground.h:144
Media::FrameMediumRef medium_
Frame medium object providing the image data for the background.
Definition UndistortedBackground.h:135
~UndistortedBackground() override
Destructs an undistorted background object.
ObjectType type() const override
Returns the type of this object.
virtual const PinholeCamera & camera() const
Returns the camera object related to the background image.
void onDynamicUpdate(const ViewRef &view, const Timestamp timestamp) override
Update function called by the framebuffer.
bool setDistance(const Scalar distance) override
Sets the distance between viewer and background.
This class implements a timestamp.
Definition Timestamp.h:36
float Scalar
Definition of a scalar type.
Definition Math.h:129
SmartMediumRef< FrameMedium > FrameMediumRef
Definition of a smart medium reference holding a frame medium object.
Definition FrameMedium.h:39
SmartObjectRef< UndistortedBackground > UndistortedBackgroundRef
Definition of a smart object reference holding an undistorted background node.
Definition UndistortedBackground.h:34
The namespace covering the entire Ocean framework.
Definition Accessor.h:15