Ocean
Loading...
Searching...
No Matches
openxr/OpenXR.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_OPENXR_OPEN_XR_H
9#define META_OCEAN_PLATFORM_OPENXR_OPEN_XR_H
10
12
14
15#include <openxr/openxr.h>
16
17namespace Ocean
18{
19
20namespace Platform
21{
22
23namespace OpenXR
24{
25
26/**
27 * @ingroup platform
28 * @defgroup platformopenxr Ocean Platform OpenXR Library
29 * @{
30 * The Ocean OpenXR Library provides specific functionalities for OpenXR.
31 * The library is available on platforms supporting OpenXR.
32 * @}
33 */
34
35/**
36 * @namespace Ocean::Platform::OpenXR Namespace of the Platform OpenXR library.<p>
37 * The Namespace Ocean::Platform::OpenXR is used in the entire Ocean Platform OpenXR Library.
38 */
39
40// Defines OCEAN_PLATFORM_OPENXR_EXPORT for dll export and import.
41#if defined(_WINDOWS) && defined(OCEAN_RUNTIME_SHARED)
42 #ifdef USE_OCEAN_PLATFORM_OPENXR_EXPORT
43 #define OCEAN_PLATFORM_OPENXR_EXPORT __declspec(dllexport)
44 #else
45 #define OCEAN_PLATFORM_OPENXR_EXPORT __declspec(dllimport)
46 #endif
47#else
48 #define OCEAN_PLATFORM_OPENXR_EXPORT
49#endif
50
51/**
52 * Creates a zero-initialized OpenXR object with the given structure type.
53 * @param xrStructureType The structure type to set for the object, e.g., XR_TYPE_SPACE_LOCATION
54 * @return The zero-initialized object with the type field set
55 * @tparam T The type of the OpenXR object to create, e.g., XrSpaceLocation
56 * @ingroup platformopenxr
57 */
58template <typename T>
59constexpr T xrCreateObject(const XrStructureType xrStructureType);
60
61/**
62 * Wrapper function for xrDestroySpace.
63 * @param xrSpace The object to destroy
64 * @return The return value
65 * @ingroup platformopenxr
66 */
67XrResult xrDestroySpaceOcean(XrSpace xrSpace);
68
69/**
70 * Definition of a scoped object holding a XrSpace object.
71 * The wrapped XrSpace object will be released automatically once the scoped object does not exist anymore.
72 * @ingroup platformopenxr
73 */
75
76/**
77 * Definition of a vector holding OpenXR XrVector2f objects.
78 * @see XrVector2f.
79 * @ingroup platformopenxr
80 */
81using XrVectors2f = std::vector<XrVector2f>;
82
83/**
84 * Definition of a vector holding OpenXR XrVector3f objects.
85 * @see XrVector3f.
86 * @ingroup platformopenxr
87 */
88using XrVectors3f = std::vector<XrVector3f>;
89
90/**
91 * Definition of a vector holding OpenXR XrVector4f objects.
92 * @see XrVector4f.
93 * @ingroup platformopenxr
94 */
95using XrVectors4f = std::vector<XrVector4f>;
96
97/**
98 * Definition of a vector holding OpenXR XrVector4sFB objects.
99 * @see XrVector4sFB.
100 * @ingroup platformopenxr
101 */
102using XrVectors4sFB = std::vector<XrVector4sFB>;
103
104/**
105 * Definition of a vector holding OpenXR XrPosef objects.
106 * @see XrPosef.
107 * @ingroup platformopenxr
108 */
109using XrPosesf = std::vector<XrPosef>;
110
111/**
112 * Definition of a vector holding OpenXR XrHandJointEXT objects.
113 * @see XrHandJointEXT.
114 * @ingroup platformopenxr
115 */
116using XrHandJointsEXT = std::vector<XrHandJointEXT>;
117
118/**
119 * Definition of a vector holding OpenXR XrPath objects.
120 * @see XrPath.
121 * @ingroup platformopenxr
122 */
123using XrPaths = std::vector<XrPath>;
124
125template <typename T>
126constexpr T xrCreateObject(const XrStructureType xrStructureType)
127{
128 T object = {};
129 object.type = xrStructureType;
130
131 return object;
132}
133
134}
135
136}
137
138}
139
140#endif // META_OCEAN_PLATFORM_OPENXR_OPEN_XR_H
std::vector< XrVector4sFB > XrVectors4sFB
Definition of a vector holding OpenXR XrVector4sFB objects.
Definition openxr/OpenXR.h:102
XrResult xrDestroySpaceOcean(XrSpace xrSpace)
Wrapper function for xrDestroySpace.
std::vector< XrPosef > XrPosesf
Definition of a vector holding OpenXR XrPosef objects.
Definition openxr/OpenXR.h:109
std::vector< XrVector3f > XrVectors3f
Definition of a vector holding OpenXR XrVector3f objects.
Definition openxr/OpenXR.h:88
std::vector< XrVector4f > XrVectors4f
Definition of a vector holding OpenXR XrVector4f objects.
Definition openxr/OpenXR.h:95
constexpr T xrCreateObject(const XrStructureType xrStructureType)
Creates a zero-initialized OpenXR object with the given structure type.
Definition openxr/OpenXR.h:126
std::vector< XrVector2f > XrVectors2f
Definition of a vector holding OpenXR XrVector2f objects.
Definition openxr/OpenXR.h:81
std::vector< XrPath > XrPaths
Definition of a vector holding OpenXR XrPath objects.
Definition openxr/OpenXR.h:123
std::vector< XrHandJointEXT > XrHandJointsEXT
Definition of a vector holding OpenXR XrHandJointEXT objects.
Definition openxr/OpenXR.h:116
The namespace covering the entire Ocean framework.
Definition Accessor.h:15