Ocean
Loading...
Searching...
No Matches
openxr/application/VRControllerVisualizer.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_OPENXR_APPLICATION_VR_CONTROLLER_VISUALIZER_H
9#define META_OCEAN_PLATFORM_META_QUEST_OPENXR_APPLICATION_VR_CONTROLLER_VISUALIZER_H
10
12
14
16
17namespace Ocean
18{
19
20namespace Platform
21{
22
23namespace Meta
24{
25
26namespace Quest
27{
28
29namespace OpenXR
30{
31
32namespace Application
33{
34
35/**
36 * This class implements helper functions allowing to visualize the controllers of Quest headsets in an Ocean-based VR application (e.g., VRNativeApplication) using OpenXR as input.
37 * @see VRNativeApplication.
38 * @ingroup platformmetaquestopenxrapplication
39 */
40class OCEAN_PLATFORM_META_QUEST_OPENXR_APPLICATION_EXPORT VRControllerVisualizer final : public Quest::Application::VRControllerVisualizer
41{
42 public:
43
44 /**
45 * Default constructor.
46 */
48
49 /**
50 * Creates a new controller visualizer and initializes the object with a given rendering engine and associated framebuffer and load the models from the specified files
51 * @param engine The rendering engine to be used, must be valid
52 * @param framebuffer The framebuffer to be used, must be valid
53 * @param leftRenderModelFilename The path to file that contains the render model of the left controller, must be valid
54 * @param rightRenderModelFilename The path to file that contains the render model of the left controller, must be valid
55 * @param controllerAim_t_controllerModel The translation offset between controller model and controller aim transformation, must be valid
56 * @see Quest::Application::VRControllerVisualizer::VRControllerVisualizer().
57 */
58 inline VRControllerVisualizer(const Rendering::EngineRef& engine, const Rendering::FramebufferRef framebuffer, const std::string& leftRenderModelFilename, const std::string& rightRenderModelFilename, const Vector3& controllerAim_t_controllerModel = Vector3(0, 0, 0));
59
60 /**
61 * Creates a new controller visualizer and initializes the object with a given rendering engine and associated framebuffer and load the models from the specified files
62 * @see Quest::Application::VRControllerVisualizer::VRControllerVisualizer().
63 */
64 VRControllerVisualizer(const Rendering::EngineRef& engine, const Rendering::FramebufferRef framebuffer, const Device::DeviceType deviceType, const std::string& renderModelDirectoryName);
65
66 /**
67 * Visualizes both controllers of an Oculus headset at a specific location in the virtual environment (defined in relation to the world).
68 * A previous visualization can be updated by specifying the same controller again in conjunction with a new transformation.
69 * Beware: The visualizer must be created with a valid engine and framebuffer before usage.
70 * @param trackedController The instance of a tracked controller that is used to query the pose of the controllers, must be valid
71 * @param controllerRayLength Optional explicit parameter used for the length of the controller ray, will be hidden for value 0, -1 to use the length as defined in controllerRayLength()
72 */
73 void visualizeControllersInWorld(const TrackedController& trackedController, const Scalar controllerRayLength = -1);
74
75 protected:
76
77 /// The translation offset between controller model and controller aim transformation, must be valid
78 Vector3 controllerAim_t_controllerModel_ = Vector3(Numeric::minValue(), Numeric::minValue(), Numeric::minValue());
79};
80
81inline VRControllerVisualizer::VRControllerVisualizer(const Rendering::EngineRef& engine, const Rendering::FramebufferRef framebuffer, const std::string& leftRenderModelFilename, const std::string& rightRenderModelFilename, const Vector3& controllerAim_t_controllerModel) :
82 Quest::Application::VRControllerVisualizer(engine, framebuffer, leftRenderModelFilename, rightRenderModelFilename),
83 controllerAim_t_controllerModel_(controllerAim_t_controllerModel)
84{
85 // nothing to do here
86}
87
88#ifdef OCEAN_PLATFORM_META_QUEST_OPENXR_USE_EXTERNAL_TRANSLATION_OFFSET
89
90/**
91 * Returns the translation offset for an external controller.
92 * @param deviceType The device type associated with the external controller, must be valid
93 * @return The translation offset, Vector3(0, 0, 0) if unknown
94 */
96
97#endif // OCEAN_PLATFORM_META_QUEST_OPENXR_USE_EXTERNAL_TRANSLATION_OFFSET
98
99}
100
101}
102
103}
104
105}
106
107}
108
109}
110
111#endif // META_OCEAN_PLATFORM_META_QUEST_OPENXR_APPLICATION_VR_CONTROLLER_VISUALIZER_H
This class implements helper functions allowing to visualize the controllers of Quest headsets in an ...
Definition application/VRControllerVisualizer.h:41
DeviceType
Definition of individual device types.
Definition platform/meta/quest/Device.h:37
This class implements helper functions allowing to visualize the controllers of Quest headsets in an ...
Definition openxr/application/VRControllerVisualizer.h:41
VRControllerVisualizer(const Rendering::EngineRef &engine, const Rendering::FramebufferRef framebuffer, const Device::DeviceType deviceType, const std::string &renderModelDirectoryName)
Creates a new controller visualizer and initializes the object with a given rendering engine and asso...
void visualizeControllersInWorld(const TrackedController &trackedController, const Scalar controllerRayLength=-1)
Visualizes both controllers of an Oculus headset at a specific location in the virtual environment (d...
This class implements a wrapper for tracker controllers.
Definition TrackedController.h:40
float Scalar
Definition of a scalar type.
Definition Math.h:129
Vector3 VRControllerVisualizer_externalTranslationOffset(const uint32_t deviceType)
Returns the translation offset for an external controller.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15