Ocean
Loading...
Searching...
No Matches
VRImageVisualizer.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_PLATFORM_META_QUEST_APPLICATION_VR_IMAGE_VISUALIZER_H
9#define META_OCEAN_PLATFORM_META_QUEST_APPLICATION_VR_IMAGE_VISUALIZER_H
10
13
16
17namespace Ocean
18{
19
20namespace Platform
21{
22
23namespace Meta
24{
25
26namespace Quest
27{
28
29namespace Application
30{
31
32/**
33 * This class implements a helper function allowing to visualize images in an Ocean-based VR application (e.g., VRNativeApplication).
34 * The visualize allows to place images at arbitrary locations in the 3D environment, to update them (e.g., a video), or to remove them again.<br>
35 * The `image` coordinate system of the visualization is defined as follows:
36 * <pre>
37 * Coordinate system of image, the origin is in the center of the image, the image is visualized in the local z=0 plane:
38 *
39 * (image top-left)
40 * ---------------------------------------------
41 * | |
42 * | ^ |
43 * | | y-axis |
44 * | | |
45 * | *------> x-axis |
46 * | / |
47 * | / z-axis |
48 * | v |
49 * | |
50 * ---------------------------------------------
51 * (image bottom-right)
52 *
53 * |<-------------- object width --------------->|
54 * </pre>
55 * @see VRNativeApplication.
56 * @ingroup platformmetaquestapplication
57 */
58class OCEAN_PLATFORM_META_QUEST_APPLICATION_EXPORT VRImageVisualizer : public VRVisualizer
59{
60 public:
61
62 /**
63 * Default constructor, creates a new invalid visualizer.
64 */
65 inline VRImageVisualizer();
66
67 /**
68 * Creates a new image visualizer and initializes the object with a given rendering engine and associated framebuffer.
69 * Rendering engine and framebuffer are necessary so that the rendering objects (like Scene, Transform, Texture2D) can be created and attached to the existing rendering objects.
70 * @param engine The rendering engine to be used, must be valid
71 * @param framebuffer The framebuffer to be used, must be valid
72 */
73 explicit inline VRImageVisualizer(const Rendering::EngineRef& engine, const Rendering::FramebufferRef framebuffer);
74
75 /**
76 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the world).
77 * A previous visualization can be updated by specifying the old id and a new frame.
78 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
79 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
80 * @param world_T_image The transformation at which the image will be displayed, transforming image to world, can be invalid to remove the existing visualization
81 * @param frame The frame to visualize, can be invalid to remove the existing visualization
82 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
83 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
84 * @see visualizeImageInView().
85 */
86 inline void visualizeImageInWorld(const unsigned int id, const HomogenousMatrix4& world_T_image, Frame&& frame, const ObjectSize& objectSize, const bool useMipMaps = true);
87
88 /**
89 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the world).
90 * A previous visualization can be updated by specifying the old id and a new frame.
91 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
92 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
93 * @param world_T_image The transformation at which the image will be displayed, transforming image to world, can be invalid to remove the existing visualization
94 * @param frame The frame to visualize, can be invalid to remove the existing visualization
95 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
96 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
97 * @see visualizeImageInView().
98 */
99 inline void visualizeImageInWorld(const unsigned int id, const HomogenousMatrix4& world_T_image, const Frame& frame, const ObjectSize& objectSize, const bool useMipMaps = true);
100
101 /**
102 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the view).
103 * A previous visualization can be updated by specifying the old id and a new frame.
104 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
105 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
106 * @param view_T_image The transformation at which the image will be displayed, transforming image to view, can be invalid to remove the existing visualization
107 * @param frame The frame to visualize, can be invalid to remove the existing visualization
108 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
109 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
110 * @see visualizeImageInWorld().
111 */
112 inline void visualizeImageInView(const unsigned int id, const HomogenousMatrix4& view_T_image, Frame&& frame, const ObjectSize& objectSize, const bool useMipMaps = true);
113
114 /**
115 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the view).
116 * A previous visualization can be updated by specifying the old id and a new frame.
117 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
118 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
119 * @param view_T_image The transformation at which the image will be displayed, transforming image to view, can be invalid to remove the existing visualization
120 * @param frame The frame to visualize, can be invalid to remove the existing visualization
121 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
122 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
123 * @see visualizeImageInWorld().
124 */
125 inline void visualizeImageInView(const unsigned int id, const HomogenousMatrix4& view_T_image, const Frame& frame, const ObjectSize& objectSize, const bool useMipMaps = true);
126
127 /**
128 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the world or to the view).
129 * A previous visualization can be updated by specifying the old id and a new frame.
130 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
131 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
132 * @param reference_T_image The transformation at which the image will be displayed, transforming image to reference (either world or view), can be invalid to remove the existing visualization
133 * @param frame The frame to visualize, can be invalid to remove the existing visualization
134 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
135 * @param referenceIsWorld True, if reference is world; False, if reference is view
136 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
137 */
138 void visualizeImage(const unsigned int id, const HomogenousMatrix4& reference_T_image, Frame&& frame, const ObjectSize& objectSize, const bool referenceIsWorld = true, const bool useMipMaps = true);
139
140 /**
141 * Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment (defined in relation to the world or to the view).
142 * A previous visualization can be updated by specifying the old id and a new frame.
143 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
144 * @param id The unique id of the visualization, the same id can be used to update/change the visualization
145 * @param reference_T_image The transformation at which the image will be displayed, transforming image to reference (either world or view), can be invalid to remove the existing visualization
146 * @param frame The frame to visualize, can be invalid to remove the existing visualization
147 * @param objectSize The size of the visualized image in virtual space (in object space), an invalid object to remove the visualization
148 * @param referenceIsWorld True, if reference is world; False, if reference is view
149 * @param useMipMaps Use mipmaps to reduce aliasing artifacts.
150 */
151 inline void visualizeImage(const unsigned int id, const HomogenousMatrix4& reference_T_image, const Frame& frame, const ObjectSize& objectSize, const bool referenceIsWorld = true, const bool useMipMaps = true);
152};
153
155{
156 // nothing to do here
157}
158
160 VRVisualizer(engine, framebuffer)
161{
162 // nothing to do here
163}
164
165inline void VRImageVisualizer::visualizeImageInWorld(const unsigned int id, const HomogenousMatrix4& world_T_image, Frame&& frame, const ObjectSize& objectSize, const bool useMipMaps)
166{
167 return visualizeImage(id, world_T_image, std::move(frame), objectSize, true, useMipMaps);
168}
169
170inline void VRImageVisualizer::visualizeImageInWorld(const unsigned int id, const HomogenousMatrix4& world_T_image, const Frame& frame, const ObjectSize& objectSize, const bool useMipMaps)
171{
172 return visualizeImage(id, world_T_image, frame, objectSize, true, useMipMaps);
173}
174
175inline void VRImageVisualizer::visualizeImageInView(const unsigned int id, const HomogenousMatrix4& world_T_image, Frame&& frame, const ObjectSize& objectSize, const bool useMipMaps)
176{
177 return visualizeImage(id, world_T_image, std::move(frame), objectSize, false, useMipMaps);
178}
179
180inline void VRImageVisualizer::visualizeImageInView(const unsigned int id, const HomogenousMatrix4& world_T_image, const Frame& frame, const ObjectSize& objectSize, const bool useMipMaps)
181{
182 return visualizeImage(id, world_T_image, frame, objectSize, false, useMipMaps);
183}
184
185inline void VRImageVisualizer::visualizeImage(const unsigned int id, const HomogenousMatrix4& reference_T_image, const Frame& frame, const ObjectSize& objectSize, const bool referenceIsWorld, const bool useMipMaps)
186{
187 return visualizeImage(id, reference_T_image, Frame(frame, Frame::ACM_COPY_REMOVE_PADDING_LAYOUT), objectSize, referenceIsWorld, useMipMaps);
188}
189
190}
191
192}
193
194}
195
196}
197
198}
199
200#endif // META_OCEAN_PLATFORM_META_QUEST_APPLICATION_VR_IMAGE_VISUALIZER_H
This class implements Ocean's image class.
Definition Frame.h:1808
@ ACM_COPY_REMOVE_PADDING_LAYOUT
Same as CM_COPY_REMOVE_PADDING_LAYOUT.
Definition Frame.h:1834
This class implements a helper function allowing to visualize images in an Ocean-based VR application...
Definition VRImageVisualizer.h:59
VRImageVisualizer()
Default constructor, creates a new invalid visualizer.
Definition VRImageVisualizer.h:154
void visualizeImageInWorld(const unsigned int id, const HomogenousMatrix4 &world_T_image, Frame &&frame, const ObjectSize &objectSize, const bool useMipMaps=true)
Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment ...
Definition VRImageVisualizer.h:165
void visualizeImage(const unsigned int id, const HomogenousMatrix4 &reference_T_image, Frame &&frame, const ObjectSize &objectSize, const bool referenceIsWorld=true, const bool useMipMaps=true)
Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment ...
void visualizeImageInView(const unsigned int id, const HomogenousMatrix4 &view_T_image, Frame &&frame, const ObjectSize &objectSize, const bool useMipMaps=true)
Visualizes an image (e.g., for debugging purposes) at a specific location in the virtual environment ...
Definition VRImageVisualizer.h:175
Definition of a size object allowing to specify either width and height, or only width,...
Definition VRVisualizer.h:50
This class implements the base class for all VR visualizers allowing to visualize e....
Definition VRVisualizer.h:43
The namespace covering the entire Ocean framework.
Definition Accessor.h:15