feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -49,7 +49,7 @@ if env["builtin_openxr"]:
|
|||
thirdparty_dir = "#thirdparty/openxr"
|
||||
|
||||
env_openxr.Prepend(
|
||||
CPPPATH=[
|
||||
CPPEXTPATH=[
|
||||
thirdparty_dir,
|
||||
thirdparty_dir + "/include",
|
||||
thirdparty_dir + "/src",
|
||||
|
|
@ -65,7 +65,7 @@ if env["builtin_openxr"]:
|
|||
if env["disable_exceptions"]:
|
||||
env_thirdparty.AppendUnique(CPPDEFINES=["XRLOADER_DISABLE_EXCEPTION_HANDLING", ("JSON_USE_EXCEPTION", 0)])
|
||||
|
||||
env_thirdparty.Append(CPPPATH=[thirdparty_dir + "/src/loader"])
|
||||
env_thirdparty.Append(CPPEXTPATH=[thirdparty_dir + "/src/loader"])
|
||||
|
||||
# add in external jsoncpp dependency
|
||||
thirdparty_jsoncpp_dir = thirdparty_dir + "/src/external/jsoncpp/src/lib_json/"
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_H
|
||||
#define OPENXR_ACTION_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/resource.h"
|
||||
|
||||
|
|
@ -83,5 +82,3 @@ public:
|
|||
};
|
||||
|
||||
VARIANT_ENUM_CAST(OpenXRAction::ActionType);
|
||||
|
||||
#endif // OPENXR_ACTION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_MAP_H
|
||||
#define OPENXR_ACTION_MAP_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_action.h"
|
||||
#include "openxr_action_set.h"
|
||||
|
|
@ -79,5 +78,3 @@ public:
|
|||
|
||||
~OpenXRActionMap();
|
||||
};
|
||||
|
||||
#endif // OPENXR_ACTION_MAP_H
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ int OpenXRActionSet::get_action_count() const {
|
|||
|
||||
void OpenXRActionSet::clear_actions() {
|
||||
// Actions held within our action set should be released and destroyed but just in case they are still used some where else
|
||||
if (actions.size() == 0) {
|
||||
if (actions.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_SET_H
|
||||
#define OPENXR_ACTION_SET_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_action.h"
|
||||
|
||||
|
|
@ -71,5 +70,3 @@ public:
|
|||
|
||||
~OpenXRActionSet();
|
||||
};
|
||||
|
||||
#endif // OPENXR_ACTION_SET_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_BINDING_MODIFIER_H
|
||||
#define OPENXR_BINDING_MODIFIER_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action.h"
|
||||
#include "core/io/resource.h"
|
||||
|
|
@ -77,5 +76,3 @@ protected:
|
|||
public:
|
||||
OpenXRIPBinding *get_ip_binding() const { return ip_binding; }
|
||||
};
|
||||
|
||||
#endif // OPENXR_BINDING_MODIFIER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HAPTIC_FEEDBACK_H
|
||||
#define OPENXR_HAPTIC_FEEDBACK_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/resource.h"
|
||||
#include <openxr/openxr.h>
|
||||
|
|
@ -68,5 +67,3 @@ public:
|
|||
|
||||
OpenXRHapticVibration();
|
||||
};
|
||||
|
||||
#endif // OPENXR_HAPTIC_FEEDBACK_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_INTERACTION_PROFILE_H
|
||||
#define OPENXR_INTERACTION_PROFILE_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_action.h"
|
||||
#include "openxr_binding_modifier.h"
|
||||
|
|
@ -137,5 +136,3 @@ public:
|
|||
|
||||
~OpenXRInteractionProfile();
|
||||
};
|
||||
|
||||
#endif // OPENXR_INTERACTION_PROFILE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_INTERACTION_PROFILE_METADATA_H
|
||||
#define OPENXR_INTERACTION_PROFILE_METADATA_H
|
||||
#pragma once
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Stores available interaction profile metadata
|
||||
|
|
@ -121,5 +120,3 @@ public:
|
|||
void register_io_path(const String &p_interaction_profile, const String &p_display_name, const String &p_toplevel_path, const String &p_openxr_path, const String &p_openxr_extension_name, OpenXRAction::ActionType p_action_type);
|
||||
const IOPath *get_io_path(const String p_interaction_profile, const String p_io_path) const;
|
||||
};
|
||||
|
||||
#endif // OPENXR_INTERACTION_PROFILE_METADATA_H
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
def can_build(env, platform):
|
||||
if platform in ("linuxbsd", "windows", "android", "macos"):
|
||||
return env["openxr"] and not env["disable_3d"]
|
||||
return not env["disable_xr"]
|
||||
else:
|
||||
# not supported on these platforms
|
||||
# Not supported on these platforms.
|
||||
return False
|
||||
|
||||
|
||||
|
|
@ -17,7 +17,10 @@ def get_doc_classes():
|
|||
"OpenXRActionSet",
|
||||
"OpenXRActionMap",
|
||||
"OpenXRAPIExtension",
|
||||
"OpenXRExtensionWrapper",
|
||||
"OpenXRExtensionWrapperExtension",
|
||||
"OpenXRFutureResult",
|
||||
"OpenXRFutureExtension",
|
||||
"OpenXRInteractionProfile",
|
||||
"OpenXRInteractionProfileMetadata",
|
||||
"OpenXRIPBinding",
|
||||
|
|
|
|||
|
|
@ -225,18 +225,32 @@
|
|||
</method>
|
||||
<method name="register_composition_layer_provider">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapperExtension" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Registers the given extension as a composition layer provider.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_frame_info_extension">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Registers the given extension as modifying frame info via the [method OpenXRExtensionWrapper._set_frame_wait_info_and_get_next_pointer], [method OpenXRExtensionWrapper._set_view_locate_info_and_get_next_pointer], or [method OpenXRExtensionWrapper._set_frame_end_info_and_get_next_pointer] virtual methods.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_projection_views_extension">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapperExtension" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Registers the given extension as a provider of additional data structures to projections views.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_custom_play_space">
|
||||
<return type="void" />
|
||||
<param index="0" name="space" type="const void*" />
|
||||
<description>
|
||||
Sets the reference space used by OpenXR to the given [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html]XrSpace[/url] (cast to a [code]void *[/code]).
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_emulate_environment_blend_mode_alpha_blend">
|
||||
<return type="void" />
|
||||
<param index="0" name="enabled" type="bool" />
|
||||
|
|
@ -290,14 +304,21 @@
|
|||
</method>
|
||||
<method name="unregister_composition_layer_provider">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapperExtension" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Unregisters the given extension as a composition layer provider.
|
||||
</description>
|
||||
</method>
|
||||
<method name="unregister_frame_info_extension">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Unregisters the given extension as modifying frame info.
|
||||
</description>
|
||||
</method>
|
||||
<method name="unregister_projection_views_extension">
|
||||
<return type="void" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapperExtension" />
|
||||
<param index="0" name="extension" type="OpenXRExtensionWrapper" />
|
||||
<description>
|
||||
Unregisters the given extension as a provider of additional data structures to projections views.
|
||||
</description>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@
|
|||
Haptic pulse to emit when the user releases the input.
|
||||
</member>
|
||||
<member name="off_threshold" type="float" setter="set_off_threshold" getter="get_off_threshold" default="0.4">
|
||||
When our input value falls below this, our output becomes false.
|
||||
When our input value falls below this, our output becomes [code]false[/code].
|
||||
</member>
|
||||
<member name="on_haptic" type="OpenXRHapticBase" setter="set_on_haptic" getter="get_on_haptic">
|
||||
Haptic pulse to emit when the user presses the input.
|
||||
</member>
|
||||
<member name="on_threshold" type="float" setter="set_on_threshold" getter="get_on_threshold" default="0.6">
|
||||
When our input value is equal or larger than this value, our output becomes true. It stays true until it falls under the [member off_threshold] value.
|
||||
When our input value is equal or larger than this value, our output becomes [code]true[/code]. It stays [code]true[/code] until it falls under the [member off_threshold] value.
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
|||
|
|
@ -53,10 +53,109 @@
|
|||
The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.
|
||||
[b]Note:[/b] This will have no effect if a fallback mesh is being used.
|
||||
</member>
|
||||
<member name="swapchain_state_alpha_swizzle" type="int" setter="set_alpha_swizzle" getter="get_alpha_swizzle" enum="OpenXRCompositionLayer.Swizzle" default="3">
|
||||
The swizzle value for the alpha channel of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_blue_swizzle" type="int" setter="set_blue_swizzle" getter="get_blue_swizzle" enum="OpenXRCompositionLayer.Swizzle" default="2">
|
||||
The swizzle value for the blue channel of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_border_color" type="Color" setter="set_border_color" getter="get_border_color" default="Color(0, 0, 0, 0)">
|
||||
The border color of the swapchain state that is used when the wrap mode clamps to the border.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_green_swizzle" type="int" setter="set_green_swizzle" getter="get_green_swizzle" enum="OpenXRCompositionLayer.Swizzle" default="1">
|
||||
The swizzle value for the green channel of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_horizontal_wrap" type="int" setter="set_horizontal_wrap" getter="get_horizontal_wrap" enum="OpenXRCompositionLayer.Wrap" default="0">
|
||||
The horizontal wrap mode of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_mag_filter" type="int" setter="set_mag_filter" getter="get_mag_filter" enum="OpenXRCompositionLayer.Filter" default="1">
|
||||
The magnification filter of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_max_anisotropy" type="float" setter="set_max_anisotropy" getter="get_max_anisotropy" default="1.0">
|
||||
The max anisotropy of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_min_filter" type="int" setter="set_min_filter" getter="get_min_filter" enum="OpenXRCompositionLayer.Filter" default="1">
|
||||
The minification filter of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_mipmap_mode" type="int" setter="set_mipmap_mode" getter="get_mipmap_mode" enum="OpenXRCompositionLayer.MipmapMode" default="2">
|
||||
The mipmap mode of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_red_swizzle" type="int" setter="set_red_swizzle" getter="get_red_swizzle" enum="OpenXRCompositionLayer.Swizzle" default="0">
|
||||
The swizzle value for the red channel of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="swapchain_state_vertical_wrap" type="int" setter="set_vertical_wrap" getter="get_vertical_wrap" enum="OpenXRCompositionLayer.Wrap" default="0">
|
||||
The vertical wrap mode of the swapchain state.
|
||||
[b]Note:[/b] This property only has an effect on devices that support the OpenXR XR_FB_swapchain_update_state OpenGLES/Vulkan extensions.
|
||||
</member>
|
||||
<member name="use_android_surface" type="bool" setter="set_use_android_surface" getter="get_use_android_surface" default="false">
|
||||
If enabled, an Android surface will be created (with the dimensions from [member android_surface_size]) which will provide the 2D content for the composition layer, rather than using [member layer_viewport].
|
||||
See [method get_android_surface] for information about how to get the surface so that your application can draw to it.
|
||||
[b]Note:[/b] This will only work in Android builds.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="FILTER_NEAREST" value="0" enum="Filter">
|
||||
Perform nearest-neighbor filtering when sampling the texture.
|
||||
</constant>
|
||||
<constant name="FILTER_LINEAR" value="1" enum="Filter">
|
||||
Perform linear filtering when sampling the texture.
|
||||
</constant>
|
||||
<constant name="FILTER_CUBIC" value="2" enum="Filter">
|
||||
Perform cubic filtering when sampling the texture.
|
||||
</constant>
|
||||
<constant name="MIPMAP_MODE_DISABLED" value="0" enum="MipmapMode">
|
||||
Disable mipmapping.
|
||||
[b]Note:[/b] Mipmapping can only be disabled in the compatibility renderer.
|
||||
</constant>
|
||||
<constant name="MIPMAP_MODE_NEAREST" value="1" enum="MipmapMode">
|
||||
Use the mipmap of the nearest resolution.
|
||||
</constant>
|
||||
<constant name="MIPMAP_MODE_LINEAR" value="2" enum="MipmapMode">
|
||||
Use linear interpolation of the two mipmaps of the nearest resolution.
|
||||
</constant>
|
||||
<constant name="WRAP_CLAMP_TO_BORDER" value="0" enum="Wrap">
|
||||
Clamp the texture to its specified border color.
|
||||
</constant>
|
||||
<constant name="WRAP_CLAMP_TO_EDGE" value="1" enum="Wrap">
|
||||
Clamp the texture to its edge color.
|
||||
</constant>
|
||||
<constant name="WRAP_REPEAT" value="2" enum="Wrap">
|
||||
Repeat the texture infinitely.
|
||||
</constant>
|
||||
<constant name="WRAP_MIRRORED_REPEAT" value="3" enum="Wrap">
|
||||
Repeat the texture infinitely, mirroring it on each repeat.
|
||||
</constant>
|
||||
<constant name="WRAP_MIRROR_CLAMP_TO_EDGE" value="4" enum="Wrap">
|
||||
Mirror the texture once and then clamp the texture to its edge color.
|
||||
[b]Note:[/b] This wrap mode is not available in the compatibility renderer.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_RED" value="0" enum="Swizzle">
|
||||
Maps a color channel to the value of the red channel.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_GREEN" value="1" enum="Swizzle">
|
||||
Maps a color channel to the value of the green channel.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_BLUE" value="2" enum="Swizzle">
|
||||
Maps a color channel to the value of the blue channel.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_ALPHA" value="3" enum="Swizzle">
|
||||
Maps a color channel to the value of the alpha channel.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_ZERO" value="4" enum="Swizzle">
|
||||
Maps a color channel to the value of zero.
|
||||
</constant>
|
||||
<constant name="SWIZZLE_ONE" value="5" enum="Swizzle">
|
||||
Maps a color channel to the value of one.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
Input path for this dpad binding modifier.
|
||||
</member>
|
||||
<member name="is_sticky" type="bool" setter="set_is_sticky" getter="get_is_sticky" default="false">
|
||||
If [code]false[/code], when the joystick enters a new dpad zone this becomes true.
|
||||
If [code]true[/code], when the joystick remains in active dpad zone, this remains true even if we overlap with another zone.
|
||||
If [code]false[/code], when the joystick enters a new dpad zone this becomes [code]true[/code].
|
||||
If [code]true[/code], when the joystick remains in active dpad zone, this remains [code]true[/code] even if we overlap with another zone.
|
||||
</member>
|
||||
<member name="off_haptic" type="OpenXRHapticBase" setter="set_off_haptic" getter="get_off_haptic">
|
||||
Haptic pulse to emit when the user releases the input.
|
||||
|
|
@ -31,10 +31,10 @@
|
|||
Haptic pulse to emit when the user presses the input.
|
||||
</member>
|
||||
<member name="threshold" type="float" setter="set_threshold" getter="get_threshold" default="0.6">
|
||||
When our input value is equal or larger than this value, our dpad in that direction becomes true. It stays true until it falls under the [member threshold_released] value.
|
||||
When our input value is equal or larger than this value, our dpad in that direction becomes [code]true[/code]. It stays [code]true[/code] until it falls under the [member threshold_released] value.
|
||||
</member>
|
||||
<member name="threshold_released" type="float" setter="set_threshold_released" getter="get_threshold_released" default="0.4">
|
||||
When our input value falls below this, our output becomes false.
|
||||
When our input value falls below this, our output becomes [code]false[/code].
|
||||
</member>
|
||||
<member name="wedge_angle" type="float" setter="set_wedge_angle" getter="get_wedge_angle" default="1.5708">
|
||||
The angle of each wedge that identifies the 4 directions of the emulated dpad.
|
||||
|
|
|
|||
305
engine/modules/openxr/doc_classes/OpenXRExtensionWrapper.xml
Normal file
305
engine/modules/openxr/doc_classes/OpenXRExtensionWrapper.xml
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OpenXRExtensionWrapper" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Allows implementing OpenXR extensions with GDExtension.
|
||||
</brief_description>
|
||||
<description>
|
||||
[OpenXRExtensionWrapper] allows implementing OpenXR extensions with GDExtension. The extension should be registered with [method register_extension_wrapper].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_composition_layer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="index" type="int" />
|
||||
<description>
|
||||
Returns a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct to provide the given composition layer.
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_composition_layer_count" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the number of composition layers this extension wrapper provides via [method _get_composition_layer].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_composition_layer_order" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="index" type="int" />
|
||||
<description>
|
||||
Returns an integer that will be used to sort the given composition layer provided via [method _get_composition_layer]. Lower numbers will move the layer to the front of the list, and higher numbers to the end. The default projection layer has an order of [code]0[/code], so layers provided by this method should probably be above or below (but not exactly) [code]0[/code].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_requested_extensions" qualifiers="virtual">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Returns a [Dictionary] of OpenXR extensions related to this extension. The [Dictionary] should contain the name of the extension, mapped to a [code]bool *[/code] cast to an integer:
|
||||
- If the [code]bool *[/code] is a [code]nullptr[/code] this extension is mandatory.
|
||||
- If the [code]bool *[/code] points to a boolean, the boolean will be updated to [code]true[/code] if the extension is enabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_suggested_tracker_names" qualifiers="virtual">
|
||||
<return type="PackedStringArray" />
|
||||
<description>
|
||||
Returns a [PackedStringArray] of positional tracker names that are used within the extension wrapper.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_viewport_composition_layer_extension_properties" qualifiers="virtual">
|
||||
<return type="Dictionary[]" />
|
||||
<description>
|
||||
Gets an array of [Dictionary]s that represent properties, just like [method Object._get_property_list], that will be added to [OpenXRCompositionLayer] nodes.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_viewport_composition_layer_extension_property_defaults" qualifiers="virtual">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Gets a [Dictionary] containing the default values for the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_before_instance_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called before the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_event_polled" qualifiers="virtual">
|
||||
<return type="bool" />
|
||||
<param index="0" name="event" type="const void*" />
|
||||
<description>
|
||||
Called when there is an OpenXR event to process. When implementing, return [code]true[/code] if the event was handled, return [code]false[/code] otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_instance_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="instance" type="int" />
|
||||
<description>
|
||||
Called right after the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_instance_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the OpenXR instance is destroyed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_main_swapchains_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right after the main swapchains are (re)created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_post_draw_viewport" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="viewport" type="RID" />
|
||||
<description>
|
||||
Called right after the given viewport is rendered.
|
||||
[b]Note:[/b] The draw commands might only be queued at this point, not executed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_pre_draw_viewport" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="viewport" type="RID" />
|
||||
<description>
|
||||
Called right before the given viewport is rendered.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_pre_render" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the XR viewports begin their rendering step.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_process" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called as part of the OpenXR process handling. This happens right before general and physics processing steps of the main loop. During this step controller data is queried and made available to game logic.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_register_metadata" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Allows extensions to register additional controller metadata. This function is called even when the OpenXR API is not constructed as the metadata needs to be available to the editor.
|
||||
Extensions should also provide metadata regardless of whether they are supported on the host system. The controller data is used to setup action maps for users who may have access to the relevant hardware.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_session_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="session" type="int" />
|
||||
<description>
|
||||
Called right after the OpenXR session is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_session_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the OpenXR session is destroyed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_exiting" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to exiting.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_focused" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to focused. This state is the active state when the game runs.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_idle" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to idle.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_loss_pending" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to loss pending.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_ready" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to ready. This means OpenXR is ready to set up the session.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_stopping" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to stopping.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_synchronized" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to synchronized. OpenXR also returns to this state when the application loses focus.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_visible" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to visible. This means OpenXR is now ready to receive frames.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_viewport_composition_layer_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="layer" type="const void*" />
|
||||
<description>
|
||||
Called when a composition layer created via [OpenXRCompositionLayer] is destroyed.
|
||||
[param layer] is a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_android_surface_swapchain_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="property_values" type="Dictionary" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to Android surface swapchains created by [OpenXRCompositionLayer].
|
||||
[param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_frame_end_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to [code]XrFrameEndInfo[/code].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_frame_info_extension].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_frame_wait_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to [code]XrFrameWaitInfo[/code].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_frame_info_extension].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_hand_joint_locations_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="hand_index" type="int" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when each hand tracker is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_instance_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_projection_views_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="view_index" type="int" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to the projection view of the given [param view_index].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_reference_space_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="reference_space_type" type="int" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to [code]XrReferenceSpaceCreateInfo[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_session_create_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when the OpenXR session is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_swapchain_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when creating OpenXR swapchains.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_system_properties_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when querying OpenXR system abilities.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_view_locate_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to [code]XrViewLocateInfo[/code].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_frame_info_extension].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_viewport_composition_layer_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="layer" type="const void*" />
|
||||
<param index="1" name="property_values" type="Dictionary" />
|
||||
<param index="2" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to composition layers created by [OpenXRCompositionLayer].
|
||||
[param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
[param layer] is a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_openxr_api">
|
||||
<return type="OpenXRAPIExtension" />
|
||||
<description>
|
||||
Returns the created [OpenXRAPIExtension], which can be used to access the OpenXR API.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_extension_wrapper">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Registers the extension. This should happen at core module initialization level.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
|
@ -1,273 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OpenXRExtensionWrapperExtension" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<class name="OpenXRExtensionWrapperExtension" inherits="OpenXRExtensionWrapper" deprecated="Use [OpenXRExtensionWrapper] instead." xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Allows clients to implement OpenXR extensions with GDExtension.
|
||||
Allows implementing OpenXR extensions with GDExtension.
|
||||
</brief_description>
|
||||
<description>
|
||||
[OpenXRExtensionWrapperExtension] allows clients to implement OpenXR extensions with GDExtension. The extension should be registered with [method register_extension_wrapper].
|
||||
[OpenXRExtensionWrapperExtension] allows implementing OpenXR extensions with GDExtension. The extension should be registered with [method OpenXRExtensionWrapper.register_extension_wrapper].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="_get_composition_layer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="index" type="int" />
|
||||
<description>
|
||||
Returns a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct to provide the given composition layer.
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_composition_layer_count" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the number of composition layers this extension wrapper provides via [method _get_composition_layer].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_composition_layer_order" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="index" type="int" />
|
||||
<description>
|
||||
Returns an integer that will be used to sort the given composition layer provided via [method _get_composition_layer]. Lower numbers will move the layer to the front of the list, and higher numbers to the end. The default projection layer has an order of [code]0[/code], so layers provided by this method should probably be above or below (but not exactly) [code]0[/code].
|
||||
This will only be called if the extension previously registered itself with [method OpenXRAPIExtension.register_composition_layer_provider].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_requested_extensions" qualifiers="virtual">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Returns a [Dictionary] of OpenXR extensions related to this extension. The [Dictionary] should contain the name of the extension, mapped to a [code]bool *[/code] cast to an integer:
|
||||
- If the [code]bool *[/code] is a [code]nullptr[/code] this extension is mandatory.
|
||||
- If the [code]bool *[/code] points to a boolean, the boolean will be updated to [code]true[/code] if the extension is enabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_suggested_tracker_names" qualifiers="virtual">
|
||||
<return type="PackedStringArray" />
|
||||
<description>
|
||||
Returns a [PackedStringArray] of positional tracker names that are used within the extension wrapper.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_viewport_composition_layer_extension_properties" qualifiers="virtual">
|
||||
<return type="Dictionary[]" />
|
||||
<description>
|
||||
Gets an array of [Dictionary]s that represent properties, just like [method Object._get_property_list], that will be added to [OpenXRCompositionLayer] nodes.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_get_viewport_composition_layer_extension_property_defaults" qualifiers="virtual">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Gets a [Dictionary] containing the default values for the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_before_instance_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called before the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_event_polled" qualifiers="virtual">
|
||||
<return type="bool" />
|
||||
<param index="0" name="event" type="const void*" />
|
||||
<description>
|
||||
Called when there is an OpenXR event to process. When implementing, return [code]true[/code] if the event was handled, return [code]false[/code] otherwise.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_instance_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="instance" type="int" />
|
||||
<description>
|
||||
Called right after the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_instance_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the OpenXR instance is destroyed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_main_swapchains_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right after the main swapchains are (re)created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_post_draw_viewport" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="viewport" type="RID" />
|
||||
<description>
|
||||
Called right after the given viewport is rendered.
|
||||
[b]Note:[/b] The draw commands might only be queued at this point, not executed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_pre_draw_viewport" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="viewport" type="RID" />
|
||||
<description>
|
||||
Called right before the given viewport is rendered.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_pre_render" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the XR viewports begin their rendering step.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_process" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called as part of the OpenXR process handling. This happens right before general and physics processing steps of the main loop. During this step controller data is queried and made available to game logic.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_register_metadata" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Allows extensions to register additional controller metadata. This function is called even when the OpenXR API is not constructed as the metadata needs to be available to the editor.
|
||||
Extensions should also provide metadata regardless of whether they are supported on the host system. The controller data is used to setup action maps for users who may have access to the relevant hardware.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_session_created" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="session" type="int" />
|
||||
<description>
|
||||
Called right after the OpenXR session is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_session_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called right before the OpenXR session is destroyed.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_exiting" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to exiting.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_focused" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to focused. This state is the active state when the game runs.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_idle" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to idle.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_loss_pending" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to loss pending.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_ready" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to ready. This means OpenXR is ready to set up the session.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_stopping" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to stopping.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_synchronized" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to synchronized. OpenXR also returns to this state when the application loses focus.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_state_visible" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Called when the OpenXR session state is changed to visible. This means OpenXR is now ready to receive frames.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_on_viewport_composition_layer_destroyed" qualifiers="virtual">
|
||||
<return type="void" />
|
||||
<param index="0" name="layer" type="const void*" />
|
||||
<description>
|
||||
Called when a composition layer created via [OpenXRCompositionLayer] is destroyed.
|
||||
[param layer] is a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_android_surface_swapchain_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="property_values" type="Dictionary" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to Android surface swapchains created by [OpenXRCompositionLayer].
|
||||
[param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_hand_joint_locations_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="hand_index" type="int" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when each hand tracker is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_instance_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when the OpenXR instance is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_projection_views_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="view_index" type="int" />
|
||||
<param index="1" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to the projection view of the given [param view_index].
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_session_create_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when the OpenXR session is created.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_swapchain_create_info_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when creating OpenXR swapchains.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_system_properties_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures when querying OpenXR system abilities.
|
||||
</description>
|
||||
</method>
|
||||
<method name="_set_viewport_composition_layer_and_get_next_pointer" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="layer" type="const void*" />
|
||||
<param index="1" name="property_values" type="Dictionary" />
|
||||
<param index="2" name="next_pointer" type="void*" />
|
||||
<description>
|
||||
Adds additional data structures to composition layers created by [OpenXRCompositionLayer].
|
||||
[param property_values] contains the values of the properties returned by [method _get_viewport_composition_layer_extension_properties].
|
||||
[param layer] is a pointer to an [code]XrCompositionLayerBaseHeader[/code] struct.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_openxr_api">
|
||||
<return type="OpenXRAPIExtension" />
|
||||
<description>
|
||||
Returns the created [OpenXRAPIExtension], which can be used to access the OpenXR API.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_extension_wrapper">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Registers the extension. This should happen at core module initialization level.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
|
|
|
|||
43
engine/modules/openxr/doc_classes/OpenXRFutureExtension.xml
Normal file
43
engine/modules/openxr/doc_classes/OpenXRFutureExtension.xml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OpenXRFutureExtension" inherits="OpenXRExtensionWrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
The OpenXR Future extension allows for asynchronous APIs to be used.
|
||||
</brief_description>
|
||||
<description>
|
||||
This is a support extension in OpenXR that allows other OpenXR extensions to start asynchronous functions and get a callback after this function finishes. It is not intended for consumption within GDScript but can be accessed from GDExtension.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="cancel_future">
|
||||
<return type="void" />
|
||||
<param index="0" name="future" type="int" />
|
||||
<description>
|
||||
Cancels an in-progress future. [param future] must be an [code]XrFutureEXT[/code] value previously returned by an API that started an asynchronous function.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_active" qualifiers="const">
|
||||
<return type="bool" />
|
||||
<description>
|
||||
Returns [code]true[/code] if futures are available in the OpenXR runtime used. This function will only return a usable result after OpenXR has been initialized.
|
||||
</description>
|
||||
</method>
|
||||
<method name="register_future">
|
||||
<return type="OpenXRFutureResult" />
|
||||
<param index="0" name="future" type="int" />
|
||||
<param index="1" name="on_success" type="Callable" default="Callable()" />
|
||||
<description>
|
||||
Register an OpenXR Future object so we monitor for completion. [param future] must be an [code]XrFutureEXT[/code] value previously returned by an API that started an asynchronous function.
|
||||
You can optionally specify [param on_success], it will be invoked on successful completion of the future.
|
||||
Or you can use the returned [OpenXRFutureResult] object to [code]await[/code] its [signal OpenXRFutureResult.completed] signal.
|
||||
[codeblock]
|
||||
var future_result = OpenXRFutureExtension.register_future(future)
|
||||
await future_result.completed
|
||||
if future_result.get_status() == OpenXRFutureResult.RESULT_FINISHED:
|
||||
# Handle your success
|
||||
pass
|
||||
[/codeblock]
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
</class>
|
||||
50
engine/modules/openxr/doc_classes/OpenXRFutureResult.xml
Normal file
50
engine/modules/openxr/doc_classes/OpenXRFutureResult.xml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="OpenXRFutureResult" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
|
||||
<brief_description>
|
||||
Result object tracking the asynchronous result of an OpenXR Future object.
|
||||
</brief_description>
|
||||
<description>
|
||||
Result object tracking the asynchronous result of an OpenXR Future object, you can use this object to track the result status.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="cancel_future">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Cancel this future, this will interrupt and stop the asynchronous function.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_future" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Return the [code]XrFutureEXT[/code] value this result relates to.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_status" qualifiers="const">
|
||||
<return type="int" enum="OpenXRFutureResult.ResultStatus" />
|
||||
<description>
|
||||
Returns the status of this result.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<signals>
|
||||
<signal name="completed">
|
||||
<param index="0" name="result" type="OpenXRFutureResult" />
|
||||
<description>
|
||||
Emitted when the asynchronous function is finished or has been cancelled.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
<constants>
|
||||
<constant name="RESULT_RUNNING" value="0" enum="ResultStatus">
|
||||
The asynchronous function is running.
|
||||
</constant>
|
||||
<constant name="RESULT_FINISHED" value="1" enum="ResultStatus">
|
||||
The asynchronous function has finished.
|
||||
</constant>
|
||||
<constant name="RESULT_CANCELLED" value="2" enum="ResultStatus">
|
||||
The asynchronous function has been cancelled.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
@ -128,6 +128,20 @@
|
|||
Sets the given action set as active or inactive.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_cpu_level">
|
||||
<return type="void" />
|
||||
<param index="0" name="level" type="int" enum="OpenXRInterface.PerfSettingsLevel" />
|
||||
<description>
|
||||
Sets the CPU performance level of the OpenXR device.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_gpu_level">
|
||||
<return type="void" />
|
||||
<param index="0" name="level" type="int" enum="OpenXRInterface.PerfSettingsLevel" />
|
||||
<description>
|
||||
Sets the GPU performance level of the OpenXR device.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_motion_range">
|
||||
<return type="void" />
|
||||
<param index="0" name="hand" type="int" enum="OpenXRInterface.Hand" />
|
||||
|
|
@ -162,6 +176,22 @@
|
|||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="cpu_level_changed">
|
||||
<param index="0" name="sub_domain" type="int" />
|
||||
<param index="1" name="from_level" type="int" />
|
||||
<param index="2" name="to_level" type="int" />
|
||||
<description>
|
||||
Informs the device CPU performance level has changed in the specified subdomain.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="gpu_level_changed">
|
||||
<param index="0" name="sub_domain" type="int" />
|
||||
<param index="1" name="from_level" type="int" />
|
||||
<param index="2" name="to_level" type="int" />
|
||||
<description>
|
||||
Informs the device GPU performance level has changed in the specified subdomain.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="instance_exiting">
|
||||
<description>
|
||||
Informs our OpenXR instance is exiting.
|
||||
|
|
@ -234,7 +264,7 @@
|
|||
The source of hand tracking is a controller, bone positions are inferred from controller inputs.
|
||||
</constant>
|
||||
<constant name="HAND_TRACKED_SOURCE_MAX" value="3" enum="HandTrackedSource">
|
||||
Maximum value for the hand tracked source enum.
|
||||
Represents the size of the [enum HandTrackedSource] enum.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_PALM" value="0" enum="HandJoints">
|
||||
Palm joint.
|
||||
|
|
@ -255,67 +285,97 @@
|
|||
Thumb tip joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_INDEX_METACARPAL" value="6" enum="HandJoints">
|
||||
Index metacarpal joint.
|
||||
Index finger metacarpal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_INDEX_PROXIMAL" value="7" enum="HandJoints">
|
||||
Index proximal joint.
|
||||
Index finger phalanx proximal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_INDEX_INTERMEDIATE" value="8" enum="HandJoints">
|
||||
Index intermediate joint.
|
||||
Index finger phalanx intermediate joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_INDEX_DISTAL" value="9" enum="HandJoints">
|
||||
Index distal joint.
|
||||
Index finger phalanx distal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_INDEX_TIP" value="10" enum="HandJoints">
|
||||
Index tip joint.
|
||||
Index finger tip joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MIDDLE_METACARPAL" value="11" enum="HandJoints">
|
||||
Middle metacarpal joint.
|
||||
Middle finger metacarpal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MIDDLE_PROXIMAL" value="12" enum="HandJoints">
|
||||
Middle proximal joint.
|
||||
Middle finger phalanx proximal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MIDDLE_INTERMEDIATE" value="13" enum="HandJoints">
|
||||
Middle intermediate joint.
|
||||
Middle finger phalanx intermediate joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MIDDLE_DISTAL" value="14" enum="HandJoints">
|
||||
Middle distal joint.
|
||||
Middle finger phalanx distal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MIDDLE_TIP" value="15" enum="HandJoints">
|
||||
Middle tip joint.
|
||||
Middle finger tip joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_RING_METACARPAL" value="16" enum="HandJoints">
|
||||
Ring metacarpal joint.
|
||||
Ring finger metacarpal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_RING_PROXIMAL" value="17" enum="HandJoints">
|
||||
Ring proximal joint.
|
||||
Ring finger phalanx proximal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_RING_INTERMEDIATE" value="18" enum="HandJoints">
|
||||
Ring intermediate joint.
|
||||
Ring finger phalanx intermediate joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_RING_DISTAL" value="19" enum="HandJoints">
|
||||
Ring distal joint.
|
||||
Ring finger phalanx distal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_RING_TIP" value="20" enum="HandJoints">
|
||||
Ring tip joint.
|
||||
Ring finger tip joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_LITTLE_METACARPAL" value="21" enum="HandJoints">
|
||||
Little metacarpal joint.
|
||||
Pinky finger metacarpal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_LITTLE_PROXIMAL" value="22" enum="HandJoints">
|
||||
Little proximal joint.
|
||||
Pinky finger phalanx proximal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_LITTLE_INTERMEDIATE" value="23" enum="HandJoints">
|
||||
Little intermediate joint.
|
||||
Pinky finger phalanx intermediate joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_LITTLE_DISTAL" value="24" enum="HandJoints">
|
||||
Little distal joint.
|
||||
Pinky finger phalanx distal joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_LITTLE_TIP" value="25" enum="HandJoints">
|
||||
Little tip joint.
|
||||
Pinky finger tip joint.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_MAX" value="26" enum="HandJoints">
|
||||
Maximum value for the hand joint enum.
|
||||
Represents the size of the [enum HandJoints] enum.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_LEVEL_POWER_SAVINGS" value="0" enum="PerfSettingsLevel">
|
||||
The application has entered a non-XR section (head-locked / static screen), during which power savings are to be prioritized.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_LEVEL_SUSTAINED_LOW" value="1" enum="PerfSettingsLevel">
|
||||
The application has entered a low and stable complexity section, during which reducing power is more important than occasional late rendering frames.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_LEVEL_SUSTAINED_HIGH" value="2" enum="PerfSettingsLevel">
|
||||
The application has entered a high or dynamic complexity section, during which the XR Runtime strives for consistent XR compositing and frame rendering within a thermally sustainable range.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_LEVEL_BOOST" value="3" enum="PerfSettingsLevel">
|
||||
The application has entered a section with very high complexity, during which the XR Runtime is allowed to step up beyond the thermally sustainable range.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_SUB_DOMAIN_COMPOSITING" value="0" enum="PerfSettingsSubDomain">
|
||||
The compositing performance within the runtime has reached a new level.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_SUB_DOMAIN_RENDERING" value="1" enum="PerfSettingsSubDomain">
|
||||
The application rendering performance has reached a new level.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_SUB_DOMAIN_THERMAL" value="2" enum="PerfSettingsSubDomain">
|
||||
The temperature of the device has reached a new level.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_NOTIF_LEVEL_NORMAL" value="0" enum="PerfSettingsNotificationLevel">
|
||||
The sub-domain has reached a level where no further actions other than currently applied are necessary.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_NOTIF_LEVEL_WARNING" value="1" enum="PerfSettingsNotificationLevel">
|
||||
The sub-domain has reached an early warning level where the application should start proactive mitigation actions.
|
||||
</constant>
|
||||
<constant name="PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED" value="2" enum="PerfSettingsNotificationLevel">
|
||||
The sub-domain has reached a critical level where the application should start drastic mitigation actions.
|
||||
</constant>
|
||||
<constant name="HAND_JOINT_NONE" value="0" enum="HandJointFlags" is_bitfield="true">
|
||||
No flags are set.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "openxr_action_editor.h"
|
||||
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
void OpenXRActionEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_do_set_name", "name"), &OpenXRActionEditor::_do_set_name);
|
||||
|
|
@ -133,25 +134,31 @@ OpenXRActionEditor::OpenXRActionEditor(Ref<OpenXRAction> p_action) {
|
|||
|
||||
action_name = memnew(LineEdit);
|
||||
action_name->set_text(action->get_name());
|
||||
action_name->set_custom_minimum_size(Size2(150.0, 0.0));
|
||||
action_name->set_tooltip_text(TTR("Internal name of the action. Some XR runtimes don't allow spaces or special characters."));
|
||||
action_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0));
|
||||
action_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionEditor::_on_action_name_changed));
|
||||
action_name->set_accessibility_name(TTRC("Action Name"));
|
||||
add_child(action_name);
|
||||
|
||||
action_localized_name = memnew(LineEdit);
|
||||
action_localized_name->set_text(action->get_localized_name());
|
||||
action_localized_name->set_custom_minimum_size(Size2(150.0, 0.0));
|
||||
action_localized_name->set_tooltip_text(TTR("Human-readable name of the action. This can be displayed to end users."));
|
||||
action_localized_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0));
|
||||
action_localized_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
action_localized_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionEditor::_on_action_localized_name_changed));
|
||||
action_localized_name->set_accessibility_name(TTRC("Action Localized Name"));
|
||||
add_child(action_localized_name);
|
||||
|
||||
action_type_button = memnew(OptionButton);
|
||||
action_type_button->set_tooltip_text(TTR("Type of the action"));
|
||||
action_type_button->add_item("Bool", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
action_type_button->add_item("Float", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
action_type_button->add_item("Vector2", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
action_type_button->add_item("Pose", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
action_type_button->add_item("Haptic", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
action_type_button->set_accessibility_name(TTRC("Action Type"));
|
||||
action_type_button->select(int(action->get_action_type()));
|
||||
action_type_button->set_custom_minimum_size(Size2(100.0, 0.0));
|
||||
action_type_button->set_custom_minimum_size(Size2(100.0 * EDSCALE, 0.0));
|
||||
action_type_button->connect(SceneStringName(item_selected), callable_mp(this, &OpenXRActionEditor::_on_item_selected));
|
||||
add_child(action_type_button);
|
||||
|
||||
|
|
@ -159,6 +166,7 @@ OpenXRActionEditor::OpenXRActionEditor(Ref<OpenXRAction> p_action) {
|
|||
|
||||
rem_action = memnew(Button);
|
||||
rem_action->set_tooltip_text(TTR("Remove action"));
|
||||
rem_action->set_accessibility_name(TTRC("Remove action"));
|
||||
rem_action->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionEditor::_on_remove_action));
|
||||
rem_action->set_flat(true);
|
||||
add_child(rem_action);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_EDITOR_H
|
||||
#define OPENXR_ACTION_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action.h"
|
||||
|
||||
|
|
@ -71,5 +70,3 @@ public:
|
|||
Ref<OpenXRAction> get_action() { return action; }
|
||||
OpenXRActionEditor(Ref<OpenXRAction> p_action);
|
||||
};
|
||||
|
||||
#endif // OPENXR_ACTION_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "editor/editor_node.h"
|
||||
#include "editor/gui/editor_bottom_panel.h"
|
||||
#include "editor/gui/editor_file_dialog.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
HashMap<String, String> OpenXRActionMapEditor::interaction_profile_editors;
|
||||
HashMap<String, String> OpenXRActionMapEditor::binding_modifier_editors;
|
||||
|
|
@ -431,7 +432,7 @@ String OpenXRActionMapEditor::get_binding_modifier_editor_class(const String &p_
|
|||
|
||||
OpenXRActionMapEditor::OpenXRActionMapEditor() {
|
||||
undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
set_custom_minimum_size(Size2(0.0, 300.0));
|
||||
set_custom_minimum_size(Size2(0.0, 300.0 * EDSCALE));
|
||||
|
||||
top_hb = memnew(HBoxContainer);
|
||||
add_child(top_hb);
|
||||
|
|
@ -496,6 +497,3 @@ OpenXRActionMapEditor::OpenXRActionMapEditor() {
|
|||
// So load our action map and if it doesn't exist, create it right away.
|
||||
_load_action_map(GLOBAL_GET("xr/openxr/default_action_map"), true);
|
||||
}
|
||||
|
||||
OpenXRActionMapEditor::~OpenXRActionMapEditor() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_MAP_EDITOR_H
|
||||
#define OPENXR_ACTION_MAP_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
#include "openxr_action_set_editor.h"
|
||||
|
|
@ -111,7 +110,4 @@ public:
|
|||
void open_action_map(String p_path);
|
||||
|
||||
OpenXRActionMapEditor();
|
||||
~OpenXRActionMapEditor();
|
||||
};
|
||||
|
||||
#endif // OPENXR_ACTION_MAP_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "openxr_action_set_editor.h"
|
||||
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/themes/editor_scale.h"
|
||||
#include "openxr_action_editor.h"
|
||||
|
||||
void OpenXRActionSetEditor::_bind_methods() {
|
||||
|
|
@ -230,6 +231,7 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map,
|
|||
fold_btn = memnew(Button);
|
||||
fold_btn->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
|
||||
fold_btn->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_toggle_expand));
|
||||
fold_btn->set_accessibility_name(TTRC("Fold"));
|
||||
fold_btn->set_flat(true);
|
||||
panel_hb->add_child(fold_btn);
|
||||
|
||||
|
|
@ -243,32 +245,40 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map,
|
|||
|
||||
action_set_name = memnew(LineEdit);
|
||||
action_set_name->set_text(action_set->get_name());
|
||||
action_set_name->set_custom_minimum_size(Size2(150.0, 0.0));
|
||||
action_set_name->set_tooltip_text(TTR("Internal name of the action. Some XR runtimes don't allow spaces or special characters."));
|
||||
action_set_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0));
|
||||
action_set_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_name_changed));
|
||||
action_set_name->set_accessibility_name(TTRC("Action Set Name"));
|
||||
action_set_hb->add_child(action_set_name);
|
||||
|
||||
action_set_localized_name = memnew(LineEdit);
|
||||
action_set_localized_name->set_text(action_set->get_localized_name());
|
||||
action_set_localized_name->set_custom_minimum_size(Size2(150.0, 0.0));
|
||||
action_set_localized_name->set_tooltip_text(TTR("Human-readable name of the action set. This can be displayed to end users."));
|
||||
action_set_localized_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0));
|
||||
action_set_localized_name->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
action_set_localized_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_localized_name_changed));
|
||||
action_set_localized_name->set_accessibility_name(TTRC("Action Set Localized Name"));
|
||||
action_set_hb->add_child(action_set_localized_name);
|
||||
|
||||
action_set_priority = memnew(TextEdit);
|
||||
action_set_priority->set_text(itos(action_set->get_priority()));
|
||||
action_set_priority->set_custom_minimum_size(Size2(50.0, 0.0));
|
||||
action_set_priority->set_tooltip_text(TTR("Priority of the action set. If multiple action sets bind to the same input, the action set with the highest priority will be updated."));
|
||||
action_set_priority->set_custom_minimum_size(Size2(50.0 * EDSCALE, 0.0));
|
||||
action_set_priority->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_priority_changed));
|
||||
action_set_priority->set_accessibility_name(TTRC("Action Set Priority"));
|
||||
action_set_hb->add_child(action_set_priority);
|
||||
|
||||
add_action = memnew(Button);
|
||||
add_action->set_tooltip_text(TTR("Add action."));
|
||||
add_action->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_add_action));
|
||||
add_action->set_accessibility_name(TTRC("Add"));
|
||||
add_action->set_flat(true);
|
||||
action_set_hb->add_child(add_action);
|
||||
|
||||
rem_action_set = memnew(Button);
|
||||
rem_action_set->set_tooltip_text(TTR("Remove action set."));
|
||||
rem_action_set->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_remove_action_set));
|
||||
rem_action_set->set_accessibility_name(TTRC("Remove"));
|
||||
rem_action_set->set_flat(true);
|
||||
action_set_hb->add_child(rem_action_set);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ACTION_SET_EDITOR_H
|
||||
#define OPENXR_ACTION_SET_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
#include "../action_map/openxr_action_set.h"
|
||||
|
|
@ -94,5 +93,3 @@ public:
|
|||
|
||||
OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRActionSet> p_action_set);
|
||||
};
|
||||
|
||||
#endif // OPENXR_ACTION_SET_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -261,8 +261,9 @@ OpenXRBindingModifierEditor::OpenXRBindingModifierEditor() {
|
|||
header_hb->add_child(binding_modifier_title);
|
||||
|
||||
rem_binding_modifier_btn = memnew(Button);
|
||||
rem_binding_modifier_btn->set_tooltip_text(TTR("Remove binding modifier."));
|
||||
rem_binding_modifier_btn->set_tooltip_text(TTR("Remove this binding modifier."));
|
||||
rem_binding_modifier_btn->connect(SceneStringName(pressed), callable_mp(this, &OpenXRBindingModifierEditor::_on_remove_binding_modifier));
|
||||
rem_binding_modifier_btn->set_accessibility_name(TTRC("Remove"));
|
||||
rem_binding_modifier_btn->set_flat(true);
|
||||
header_hb->add_child(rem_binding_modifier_btn);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_BINDING_MODIFIER_EDITOR_H
|
||||
#define OPENXR_BINDING_MODIFIER_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
#include "../action_map/openxr_action_set.h"
|
||||
|
|
@ -109,5 +108,3 @@ public:
|
|||
|
||||
OpenXRBindingModifierEditor();
|
||||
};
|
||||
|
||||
#endif // OPENXR_BINDING_MODIFIER_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@
|
|||
#include "../action_map/openxr_interaction_profile_metadata.h"
|
||||
#include "openxr_action_map_editor.h"
|
||||
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
void OpenXRBindingModifiersDialog::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_do_add_binding_modifier_editor", "binding_modifier_editor"), &OpenXRBindingModifiersDialog::_do_add_binding_modifier_editor);
|
||||
ClassDB::bind_method(D_METHOD("_do_remove_binding_modifier_editor", "binding_modifier_editor"), &OpenXRBindingModifiersDialog::_do_remove_binding_modifier_editor);
|
||||
|
|
@ -191,7 +193,7 @@ OpenXRBindingModifiersDialog::OpenXRBindingModifiersDialog() {
|
|||
set_transient(true);
|
||||
|
||||
binding_modifier_sc = memnew(ScrollContainer);
|
||||
binding_modifier_sc->set_custom_minimum_size(Size2(350.0, 0.0));
|
||||
binding_modifier_sc->set_custom_minimum_size(Size2(350.0 * EDSCALE, 0.0));
|
||||
binding_modifier_sc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
binding_modifier_sc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
binding_modifier_sc->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_BINDING_MODIFIERS_DIALOG_H
|
||||
#define OPENXR_BINDING_MODIFIERS_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
#include "../action_map/openxr_interaction_profile.h"
|
||||
|
|
@ -77,5 +76,3 @@ public:
|
|||
|
||||
void setup(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile, Ref<OpenXRIPBinding> p_ip_binding = Ref<OpenXRIPBinding>());
|
||||
};
|
||||
|
||||
#endif // OPENXR_BINDING_MODIFIERS_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -64,6 +64,3 @@ OpenXREditorPlugin::OpenXREditorPlugin() {
|
|||
add_control_to_container(CONTAINER_TOOLBAR, select_runtime);
|
||||
#endif
|
||||
}
|
||||
|
||||
OpenXREditorPlugin::~OpenXREditorPlugin() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_EDITOR_PLUGIN_H
|
||||
#define OPENXR_EDITOR_PLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_action_map_editor.h"
|
||||
#include "openxr_binding_modifier_editor.h"
|
||||
|
|
@ -54,7 +53,4 @@ public:
|
|||
virtual void make_visible(bool p_visible) override;
|
||||
|
||||
OpenXREditorPlugin();
|
||||
~OpenXREditorPlugin();
|
||||
};
|
||||
|
||||
#endif // OPENXR_EDITOR_PLUGIN_H
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase() {
|
|||
binding_modifiers_btn = memnew(Button);
|
||||
binding_modifiers_btn->set_tooltip_text(TTR("Edit binding modifiers"));
|
||||
binding_modifiers_btn->connect("pressed", callable_mp(this, &OpenXRInteractionProfileEditorBase::_on_open_binding_modifiers));
|
||||
binding_modifiers_btn->set_accessibility_name(TTRC("Edit"));
|
||||
// TODO show visual difference if there are binding modifiers for this interaction profile
|
||||
toolbar_vb->add_child(binding_modifiers_btn);
|
||||
}
|
||||
|
|
@ -308,6 +309,7 @@ void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, co
|
|||
action_binding_modifiers_btn->set_flat(true);
|
||||
action_binding_modifiers_btn->set_button_icon(get_theme_icon(SNAME("Modifiers"), EditorStringName(EditorIcons)));
|
||||
action_binding_modifiers_btn->connect(SceneStringName(pressed), callable_mp((Window *)action_binding_modifiers_dialog, &Window::popup_centered).bind(Size2i(500, 400)));
|
||||
action_binding_modifiers_btn->set_accessibility_name(TTRC("Modifiers"));
|
||||
// TODO change style of button if there are binding modifiers
|
||||
action_hb->add_child(action_binding_modifiers_btn);
|
||||
|
||||
|
|
@ -315,6 +317,7 @@ void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, co
|
|||
action_rem->set_flat(true);
|
||||
action_rem->set_button_icon(get_theme_icon(SNAME("Remove"), EditorStringName(EditorIcons)));
|
||||
action_rem->connect(SceneStringName(pressed), callable_mp((OpenXRInteractionProfileEditor *)this, &OpenXRInteractionProfileEditor::_on_remove_pressed).bind(action->get_name_with_set(), String(p_io_path->openxr_path)));
|
||||
action_rem->set_accessibility_name(TTRC("Remove"));
|
||||
action_hb->add_child(action_rem);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_INTERACTION_PROFILE_EDITOR_H
|
||||
#define OPENXR_INTERACTION_PROFILE_EDITOR_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
#include "../action_map/openxr_interaction_profile.h"
|
||||
|
|
@ -106,5 +105,3 @@ public:
|
|||
|
||||
OpenXRInteractionProfileEditor();
|
||||
};
|
||||
|
||||
#endif // OPENXR_INTERACTION_PROFILE_EDITOR_H
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include "openxr_select_action_dialog.h"
|
||||
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
void OpenXRSelectActionDialog::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("action_selected", PropertyInfo(Variant::STRING, "action")));
|
||||
}
|
||||
|
|
@ -124,7 +126,7 @@ OpenXRSelectActionDialog::OpenXRSelectActionDialog(Ref<OpenXRActionMap> p_action
|
|||
set_title(TTR("Select an action"));
|
||||
|
||||
scroll = memnew(ScrollContainer);
|
||||
scroll->set_custom_minimum_size(Size2(600.0, 400.0));
|
||||
scroll->set_custom_minimum_size(Size2(600.0 * EDSCALE, 400.0 * EDSCALE));
|
||||
add_child(scroll);
|
||||
|
||||
main_vb = memnew(VBoxContainer);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_SELECT_ACTION_DIALOG_H
|
||||
#define OPENXR_SELECT_ACTION_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_map.h"
|
||||
|
||||
|
|
@ -64,5 +63,3 @@ public:
|
|||
|
||||
OpenXRSelectActionDialog(Ref<OpenXRActionMap> p_action_map);
|
||||
};
|
||||
|
||||
#endif // OPENXR_SELECT_ACTION_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#include "../action_map/openxr_interaction_profile_metadata.h"
|
||||
#include "../openxr_api.h"
|
||||
|
||||
#include "editor/themes/editor_scale.h"
|
||||
|
||||
void OpenXRSelectInteractionProfileDialog::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("interaction_profile_selected", PropertyInfo(Variant::STRING, "interaction_profile")));
|
||||
}
|
||||
|
|
@ -116,7 +118,7 @@ OpenXRSelectInteractionProfileDialog::OpenXRSelectInteractionProfileDialog() {
|
|||
set_title(TTR("Select an interaction profile"));
|
||||
|
||||
scroll = memnew(ScrollContainer);
|
||||
scroll->set_custom_minimum_size(Size2(600.0, 400.0));
|
||||
scroll->set_custom_minimum_size(Size2(600.0 * EDSCALE, 400.0 * EDSCALE));
|
||||
add_child(scroll);
|
||||
|
||||
main_vb = memnew(VBoxContainer);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H
|
||||
#define OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
|
@ -58,5 +57,3 @@ public:
|
|||
|
||||
OpenXRSelectInteractionProfileDialog();
|
||||
};
|
||||
|
||||
#endif // OPENXR_SELECT_INTERACTION_PROFILE_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -54,10 +54,9 @@ void OpenXRSelectRuntime::_update_items() {
|
|||
set_item_metadata(index, "");
|
||||
index++;
|
||||
|
||||
Array keys = runtimes.keys();
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
String key = keys[i];
|
||||
String path = runtimes[key];
|
||||
for (const KeyValue<Variant, Variant> &kv : runtimes) {
|
||||
const String &key = kv.key;
|
||||
const String &path = kv.value;
|
||||
String adj_path = path.replace("~", home_folder);
|
||||
|
||||
if (da->file_exists(adj_path)) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_SELECT_RUNTIME_H
|
||||
#define OPENXR_SELECT_RUNTIME_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/option_button.h"
|
||||
|
||||
|
|
@ -46,5 +45,3 @@ private:
|
|||
void _update_items();
|
||||
void _on_item_selected(int p_which);
|
||||
};
|
||||
|
||||
#endif // OPENXR_SELECT_RUNTIME_H
|
||||
|
|
|
|||
|
|
@ -28,13 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_COMPOSITION_LAYER_DEPTH_EXTENSION_H
|
||||
#define OPENXR_COMPOSITION_LAYER_DEPTH_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_composition_layer_provider.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRCompositionLayerDepthExtension : public OpenXRExtensionWrapper, public OpenXRCompositionLayerProvider {
|
||||
class OpenXRCompositionLayerDepthExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRCompositionLayerDepthExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRCompositionLayerDepthExtension *get_singleton();
|
||||
|
||||
|
|
@ -52,5 +55,3 @@ private:
|
|||
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_COMPOSITION_LAYER_DEPTH_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <openxr/openxr_platform.h>
|
||||
#endif
|
||||
|
||||
#include "openxr_fb_update_swapchain_extension.h"
|
||||
#include "platform/android/api/java_class_wrapper.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
|
|
@ -227,6 +228,13 @@ void OpenXRViewportCompositionLayerProvider::set_viewport(RID p_viewport, Size2i
|
|||
void OpenXRViewportCompositionLayerProvider::set_use_android_surface(bool p_use_android_surface, Size2i p_size) {
|
||||
#ifdef ANDROID_ENABLED
|
||||
if (p_use_android_surface == use_android_surface) {
|
||||
if (use_android_surface && swapchain_size != p_size) {
|
||||
OpenXRFBUpdateSwapchainExtension *fb_update_swapchain_ext = OpenXRFBUpdateSwapchainExtension::get_singleton();
|
||||
if (fb_update_swapchain_ext && fb_update_swapchain_ext->is_android_ext_enabled()) {
|
||||
swapchain_size = p_size;
|
||||
fb_update_swapchain_ext->update_swapchain_surface_size(android_surface.swapchain, swapchain_size);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +288,8 @@ void OpenXRViewportCompositionLayerProvider::create_android_surface() {
|
|||
jobject surface;
|
||||
composition_layer_extension->create_android_surface_swapchain(&info, &android_surface.swapchain, &surface);
|
||||
|
||||
swapchain_state.dirty = true;
|
||||
|
||||
if (surface) {
|
||||
android_surface.surface.instantiate(JavaClassWrapper::get_singleton()->wrap("android.view.Surface"), surface);
|
||||
}
|
||||
|
|
@ -327,6 +337,11 @@ void OpenXRViewportCompositionLayerProvider::on_pre_render() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (swapchain_state.dirty) {
|
||||
update_swapchain_state();
|
||||
swapchain_state.dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_composition_layer() {
|
||||
|
|
@ -393,6 +408,34 @@ XrCompositionLayerBaseHeader *OpenXRViewportCompositionLayerProvider::get_compos
|
|||
return composition_layer;
|
||||
}
|
||||
|
||||
void OpenXRViewportCompositionLayerProvider::update_swapchain_state() {
|
||||
OpenXRFBUpdateSwapchainExtension *fb_update_swapchain_ext = OpenXRFBUpdateSwapchainExtension::get_singleton();
|
||||
if (!fb_update_swapchain_ext) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
if (use_android_surface) {
|
||||
if (android_surface.swapchain == XR_NULL_HANDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb_update_swapchain_ext->update_swapchain_state(android_surface.swapchain, &swapchain_state);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (subviewport.swapchain_info.get_swapchain() == XR_NULL_HANDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
fb_update_swapchain_ext->update_swapchain_state(subviewport.swapchain_info.get_swapchain(), &swapchain_state);
|
||||
}
|
||||
}
|
||||
|
||||
OpenXRViewportCompositionLayerProvider::SwapchainState *OpenXRViewportCompositionLayerProvider::get_swapchain_state() {
|
||||
return &swapchain_state;
|
||||
}
|
||||
|
||||
void OpenXRViewportCompositionLayerProvider::update_swapchain_sub_image(XrSwapchainSubImage &r_subimage) {
|
||||
#ifdef ANDROID_ENABLED
|
||||
if (use_android_surface) {
|
||||
|
|
@ -451,6 +494,8 @@ bool OpenXRViewportCompositionLayerProvider::update_and_acquire_swapchain(bool p
|
|||
return false;
|
||||
}
|
||||
|
||||
swapchain_state.dirty = true;
|
||||
|
||||
// Acquire our image so we can start rendering into it,
|
||||
// we can ignore should_render here, ret will be false.
|
||||
bool should_render = true;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,8 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_COMPOSITION_LAYER_EXTENSION_H
|
||||
#define OPENXR_COMPOSITION_LAYER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_composition_layer_provider.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
#include "../openxr_api.h"
|
||||
|
|
@ -50,7 +48,12 @@ class OpenXRViewportCompositionLayerProvider;
|
|||
// This extension provides access to composition layers for displaying 2D content through the XR compositor.
|
||||
|
||||
// OpenXRCompositionLayerExtension enables the extensions related to this functionality
|
||||
class OpenXRCompositionLayerExtension : public OpenXRExtensionWrapper, public OpenXRCompositionLayerProvider {
|
||||
class OpenXRCompositionLayerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRCompositionLayerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRCompositionLayerExtension *get_singleton();
|
||||
|
||||
|
|
@ -97,6 +100,56 @@ private:
|
|||
};
|
||||
|
||||
class OpenXRViewportCompositionLayerProvider {
|
||||
public:
|
||||
// Must be identical to Filter enum definition in OpenXRCompositionLayer.
|
||||
enum Filter {
|
||||
FILTER_NEAREST,
|
||||
FILTER_LINEAR,
|
||||
FILTER_CUBIC,
|
||||
};
|
||||
|
||||
// Must be identical to MipmapMode enum definition in OpenXRCompositionLayer.
|
||||
enum MipmapMode {
|
||||
MIPMAP_MODE_DISABLED,
|
||||
MIPMAP_MODE_NEAREST,
|
||||
MIPMAP_MODE_LINEAR,
|
||||
};
|
||||
|
||||
// Must be identical to Wrap enum definition in OpenXRCompositionLayer.
|
||||
enum Wrap {
|
||||
WRAP_CLAMP_TO_BORDER,
|
||||
WRAP_CLAMP_TO_EDGE,
|
||||
WRAP_REPEAT,
|
||||
WRAP_MIRRORED_REPEAT,
|
||||
WRAP_MIRROR_CLAMP_TO_EDGE,
|
||||
};
|
||||
|
||||
// Must be identical to Swizzle enum definition in OpenXRCompositionLayer.
|
||||
enum Swizzle {
|
||||
SWIZZLE_RED,
|
||||
SWIZZLE_GREEN,
|
||||
SWIZZLE_BLUE,
|
||||
SWIZZLE_ALPHA,
|
||||
SWIZZLE_ZERO,
|
||||
SWIZZLE_ONE,
|
||||
};
|
||||
|
||||
struct SwapchainState {
|
||||
Filter min_filter = Filter::FILTER_LINEAR;
|
||||
Filter mag_filter = Filter::FILTER_LINEAR;
|
||||
MipmapMode mipmap_mode = MipmapMode::MIPMAP_MODE_LINEAR;
|
||||
Wrap horizontal_wrap = Wrap::WRAP_CLAMP_TO_BORDER;
|
||||
Wrap vertical_wrap = Wrap::WRAP_CLAMP_TO_BORDER;
|
||||
Swizzle red_swizzle = Swizzle::SWIZZLE_RED;
|
||||
Swizzle green_swizzle = Swizzle::SWIZZLE_GREEN;
|
||||
Swizzle blue_swizzle = Swizzle::SWIZZLE_BLUE;
|
||||
Swizzle alpha_swizzle = Swizzle::SWIZZLE_ALPHA;
|
||||
float max_anisotropy = 1.0;
|
||||
Color border_color = { 0.0, 0.0, 0.0, 0.0 };
|
||||
bool dirty = false;
|
||||
};
|
||||
|
||||
private:
|
||||
XrCompositionLayerBaseHeader *composition_layer = nullptr;
|
||||
int sort_order = 1;
|
||||
bool alpha_blend = false;
|
||||
|
|
@ -130,6 +183,8 @@ class OpenXRViewportCompositionLayerProvider {
|
|||
void update_swapchain_sub_image(XrSwapchainSubImage &r_swapchain_sub_image);
|
||||
void free_swapchain();
|
||||
|
||||
SwapchainState swapchain_state;
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
void create_android_surface();
|
||||
#endif
|
||||
|
|
@ -156,8 +211,9 @@ public:
|
|||
void on_pre_render();
|
||||
XrCompositionLayerBaseHeader *get_composition_layer();
|
||||
|
||||
void update_swapchain_state();
|
||||
SwapchainState *get_swapchain_state();
|
||||
|
||||
OpenXRViewportCompositionLayerProvider(XrCompositionLayerBaseHeader *p_composition_layer);
|
||||
~OpenXRViewportCompositionLayerProvider();
|
||||
};
|
||||
|
||||
#endif // OPENXR_COMPOSITION_LAYER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,13 +28,17 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_DEBUG_UTILS_EXTENSION_H
|
||||
#define OPENXR_DEBUG_UTILS_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../util.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRDebugUtilsExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRDebugUtilsExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRDebugUtilsExtension *get_singleton();
|
||||
|
||||
|
|
@ -72,5 +76,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC1(xrSessionEndDebugUtilsLabelRegionEXT, (XrSession), p_session)
|
||||
EXT_PROTO_XRRESULT_FUNC2(xrSessionInsertDebugUtilsLabelEXT, (XrSession), p_session, (const XrDebugUtilsLabelEXT *), p_label_info)
|
||||
};
|
||||
|
||||
#endif // OPENXR_DEBUG_UTILS_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_DPAD_BINDING_EXTENSION_H
|
||||
#define OPENXR_DPAD_BINDING_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_action_set.h"
|
||||
#include "../action_map/openxr_binding_modifier.h"
|
||||
|
|
@ -38,6 +37,11 @@
|
|||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRDPadBindingExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRDPadBindingExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRDPadBindingExtension *get_singleton();
|
||||
|
||||
|
|
@ -105,5 +109,3 @@ public:
|
|||
virtual String get_description() const override { return "DPad modifier"; }
|
||||
virtual PackedByteArray get_ip_modification() override;
|
||||
};
|
||||
|
||||
#endif // OPENXR_DPAD_BINDING_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_extension_wrapper_extension.cpp */
|
||||
/* openxr_extension_wrapper.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,11 +28,12 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "openxr_extension_wrapper_extension.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
#include "../openxr_api.h"
|
||||
#include "../openxr_api_extension.h"
|
||||
|
||||
void OpenXRExtensionWrapperExtension::_bind_methods() {
|
||||
void OpenXRExtensionWrapper::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_get_requested_extensions);
|
||||
GDVIRTUAL_BIND(_set_system_properties_and_get_next_pointer, "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_instance_create_info_and_get_next_pointer, "next_pointer");
|
||||
|
|
@ -40,6 +41,10 @@ void OpenXRExtensionWrapperExtension::_bind_methods() {
|
|||
GDVIRTUAL_BIND(_set_swapchain_create_info_and_get_next_pointer, "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_hand_joint_locations_and_get_next_pointer, "hand_index", "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_projection_views_and_get_next_pointer, "view_index", "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_frame_wait_info_and_get_next_pointer, "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_frame_end_info_and_get_next_pointer, "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_view_locate_info_and_get_next_pointer, "next_pointer");
|
||||
GDVIRTUAL_BIND(_set_reference_space_create_info_and_get_next_pointer, "reference_space_type", "next_pointer");
|
||||
GDVIRTUAL_BIND(_get_composition_layer_count);
|
||||
GDVIRTUAL_BIND(_get_composition_layer, "index");
|
||||
GDVIRTUAL_BIND(_get_composition_layer_order, "index");
|
||||
|
|
@ -70,20 +75,18 @@ void OpenXRExtensionWrapperExtension::_bind_methods() {
|
|||
GDVIRTUAL_BIND(_on_viewport_composition_layer_destroyed, "layer");
|
||||
GDVIRTUAL_BIND(_set_android_surface_swapchain_create_info_and_get_next_pointer, "property_values", "next_pointer");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_openxr_api"), &OpenXRExtensionWrapperExtension::get_openxr_api);
|
||||
ClassDB::bind_method(D_METHOD("register_extension_wrapper"), &OpenXRExtensionWrapperExtension::register_extension_wrapper);
|
||||
ClassDB::bind_method(D_METHOD("get_openxr_api"), &OpenXRExtensionWrapper::_gdextension_get_openxr_api);
|
||||
ClassDB::bind_method(D_METHOD("register_extension_wrapper"), &OpenXRExtensionWrapper::_gdextension_register_extension_wrapper);
|
||||
}
|
||||
|
||||
HashMap<String, bool *> OpenXRExtensionWrapperExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> OpenXRExtensionWrapper::get_requested_extensions() {
|
||||
Dictionary request_extension;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_requested_extensions, request_extension)) {
|
||||
HashMap<String, bool *> result;
|
||||
Array keys = request_extension.keys();
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
String key = keys.get(i);
|
||||
GDExtensionPtr<bool> value = VariantCaster<GDExtensionPtr<bool>>::cast(request_extension.get(key, GDExtensionPtr<bool>(nullptr)));
|
||||
result.insert(key, value);
|
||||
for (const KeyValue<Variant, Variant> &kv : request_extension) {
|
||||
GDExtensionPtr<bool> value = VariantCaster<GDExtensionPtr<bool>>::cast(kv.value);
|
||||
result.insert(kv.key, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -91,7 +94,7 @@ HashMap<String, bool *> OpenXRExtensionWrapperExtension::get_requested_extension
|
|||
return HashMap<String, bool *>();
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_system_properties_and_get_next_pointer(void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_system_properties_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_system_properties_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -101,7 +104,7 @@ void *OpenXRExtensionWrapperExtension::set_system_properties_and_get_next_pointe
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_instance_create_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_instance_create_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_instance_create_info_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -111,7 +114,7 @@ void *OpenXRExtensionWrapperExtension::set_instance_create_info_and_get_next_poi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_session_create_and_get_next_pointer(void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_session_create_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_session_create_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -121,7 +124,7 @@ void *OpenXRExtensionWrapperExtension::set_session_create_and_get_next_pointer(v
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_swapchain_create_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_swapchain_create_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_swapchain_create_info_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -131,7 +134,7 @@ void *OpenXRExtensionWrapperExtension::set_swapchain_create_info_and_get_next_po
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_hand_joint_locations_and_get_next_pointer, p_hand_index, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -141,7 +144,7 @@ void *OpenXRExtensionWrapperExtension::set_hand_joint_locations_and_get_next_poi
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_projection_views_and_get_next_pointer(int p_view_index, void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_projection_views_and_get_next_pointer(int p_view_index, void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_projection_views_and_get_next_pointer, p_view_index, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -151,7 +154,47 @@ void *OpenXRExtensionWrapperExtension::set_projection_views_and_get_next_pointer
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
PackedStringArray OpenXRExtensionWrapperExtension::get_suggested_tracker_names() {
|
||||
void *OpenXRExtensionWrapper::set_reference_space_create_info_and_get_next_pointer(int p_reference_space_type, void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_reference_space_create_info_and_get_next_pointer, p_reference_space_type, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
return reinterpret_cast<void *>(pointer);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapper::set_frame_wait_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_frame_wait_info_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
return reinterpret_cast<void *>(pointer);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapper::set_frame_end_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_frame_end_info_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
return reinterpret_cast<void *>(pointer);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapper::set_view_locate_info_and_get_next_pointer(void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_view_locate_info_and_get_next_pointer, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
return reinterpret_cast<void *>(pointer);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PackedStringArray OpenXRExtensionWrapper::get_suggested_tracker_names() {
|
||||
PackedStringArray ret;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_suggested_tracker_names, ret)) {
|
||||
|
|
@ -161,13 +204,13 @@ PackedStringArray OpenXRExtensionWrapperExtension::get_suggested_tracker_names()
|
|||
return PackedStringArray();
|
||||
}
|
||||
|
||||
int OpenXRExtensionWrapperExtension::get_composition_layer_count() {
|
||||
int OpenXRExtensionWrapper::get_composition_layer_count() {
|
||||
int count = 0;
|
||||
GDVIRTUAL_CALL(_get_composition_layer_count, count);
|
||||
return count;
|
||||
}
|
||||
|
||||
XrCompositionLayerBaseHeader *OpenXRExtensionWrapperExtension::get_composition_layer(int p_index) {
|
||||
XrCompositionLayerBaseHeader *OpenXRExtensionWrapper::get_composition_layer(int p_index) {
|
||||
uint64_t pointer;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_composition_layer, p_index, pointer)) {
|
||||
|
|
@ -177,91 +220,91 @@ XrCompositionLayerBaseHeader *OpenXRExtensionWrapperExtension::get_composition_l
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
int OpenXRExtensionWrapperExtension::get_composition_layer_order(int p_index) {
|
||||
int OpenXRExtensionWrapper::get_composition_layer_order(int p_index) {
|
||||
int order = 0;
|
||||
GDVIRTUAL_CALL(_get_composition_layer_order, p_index, order);
|
||||
return order;
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_register_metadata() {
|
||||
void OpenXRExtensionWrapper::on_register_metadata() {
|
||||
GDVIRTUAL_CALL(_on_register_metadata);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_before_instance_created() {
|
||||
void OpenXRExtensionWrapper::on_before_instance_created() {
|
||||
GDVIRTUAL_CALL(_on_before_instance_created);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_instance_created(const XrInstance p_instance) {
|
||||
void OpenXRExtensionWrapper::on_instance_created(const XrInstance p_instance) {
|
||||
uint64_t instance = (uint64_t)p_instance;
|
||||
GDVIRTUAL_CALL(_on_instance_created, instance);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_instance_destroyed() {
|
||||
void OpenXRExtensionWrapper::on_instance_destroyed() {
|
||||
GDVIRTUAL_CALL(_on_instance_destroyed);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_session_created(const XrSession p_session) {
|
||||
void OpenXRExtensionWrapper::on_session_created(const XrSession p_session) {
|
||||
uint64_t session = (uint64_t)p_session;
|
||||
GDVIRTUAL_CALL(_on_session_created, session);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_process() {
|
||||
void OpenXRExtensionWrapper::on_process() {
|
||||
GDVIRTUAL_CALL(_on_process);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_pre_render() {
|
||||
void OpenXRExtensionWrapper::on_pre_render() {
|
||||
GDVIRTUAL_CALL(_on_pre_render);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_main_swapchains_created() {
|
||||
void OpenXRExtensionWrapper::on_main_swapchains_created() {
|
||||
GDVIRTUAL_CALL(_on_main_swapchains_created);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_session_destroyed() {
|
||||
void OpenXRExtensionWrapper::on_session_destroyed() {
|
||||
GDVIRTUAL_CALL(_on_session_destroyed);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_pre_draw_viewport(RID p_render_target) {
|
||||
void OpenXRExtensionWrapper::on_pre_draw_viewport(RID p_render_target) {
|
||||
GDVIRTUAL_CALL(_on_pre_draw_viewport, p_render_target);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_post_draw_viewport(RID p_render_target) {
|
||||
void OpenXRExtensionWrapper::on_post_draw_viewport(RID p_render_target) {
|
||||
GDVIRTUAL_CALL(_on_post_draw_viewport, p_render_target);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_idle() {
|
||||
void OpenXRExtensionWrapper::on_state_idle() {
|
||||
GDVIRTUAL_CALL(_on_state_idle);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_ready() {
|
||||
void OpenXRExtensionWrapper::on_state_ready() {
|
||||
GDVIRTUAL_CALL(_on_state_ready);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_synchronized() {
|
||||
void OpenXRExtensionWrapper::on_state_synchronized() {
|
||||
GDVIRTUAL_CALL(_on_state_synchronized);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_visible() {
|
||||
void OpenXRExtensionWrapper::on_state_visible() {
|
||||
GDVIRTUAL_CALL(_on_state_visible);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_focused() {
|
||||
void OpenXRExtensionWrapper::on_state_focused() {
|
||||
GDVIRTUAL_CALL(_on_state_focused);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_stopping() {
|
||||
void OpenXRExtensionWrapper::on_state_stopping() {
|
||||
GDVIRTUAL_CALL(_on_state_stopping);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_loss_pending() {
|
||||
void OpenXRExtensionWrapper::on_state_loss_pending() {
|
||||
GDVIRTUAL_CALL(_on_state_loss_pending);
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_state_exiting() {
|
||||
void OpenXRExtensionWrapper::on_state_exiting() {
|
||||
GDVIRTUAL_CALL(_on_state_exiting);
|
||||
}
|
||||
|
||||
bool OpenXRExtensionWrapperExtension::on_event_polled(const XrEventDataBuffer &p_event) {
|
||||
bool OpenXRExtensionWrapper::on_event_polled(const XrEventDataBuffer &p_event) {
|
||||
bool event_polled;
|
||||
|
||||
if (GDVIRTUAL_CALL(_on_event_polled, GDExtensionConstPtr<void>(&p_event), event_polled)) {
|
||||
|
|
@ -271,7 +314,7 @@ bool OpenXRExtensionWrapperExtension::on_event_polled(const XrEventDataBuffer &p
|
|||
return false;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_viewport_composition_layer_and_get_next_pointer, GDExtensionConstPtr<void>(p_layer), p_property_values, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -281,11 +324,11 @@ void *OpenXRExtensionWrapperExtension::set_viewport_composition_layer_and_get_ne
|
|||
return p_next_pointer;
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::on_viewport_composition_layer_destroyed(const XrCompositionLayerBaseHeader *p_layer) {
|
||||
void OpenXRExtensionWrapper::on_viewport_composition_layer_destroyed(const XrCompositionLayerBaseHeader *p_layer) {
|
||||
GDVIRTUAL_CALL(_on_viewport_composition_layer_destroyed, GDExtensionConstPtr<void>(p_layer));
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::get_viewport_composition_layer_extension_properties(List<PropertyInfo> *p_property_list) {
|
||||
void OpenXRExtensionWrapper::get_viewport_composition_layer_extension_properties(List<PropertyInfo> *p_property_list) {
|
||||
TypedArray<Dictionary> properties;
|
||||
|
||||
if (GDVIRTUAL_CALL(_get_viewport_composition_layer_extension_properties, properties)) {
|
||||
|
|
@ -295,13 +338,13 @@ void OpenXRExtensionWrapperExtension::get_viewport_composition_layer_extension_p
|
|||
}
|
||||
}
|
||||
|
||||
Dictionary OpenXRExtensionWrapperExtension::get_viewport_composition_layer_extension_property_defaults() {
|
||||
Dictionary OpenXRExtensionWrapper::get_viewport_composition_layer_extension_property_defaults() {
|
||||
Dictionary property_defaults;
|
||||
GDVIRTUAL_CALL(_get_viewport_composition_layer_extension_property_defaults, property_defaults);
|
||||
return property_defaults;
|
||||
}
|
||||
|
||||
void *OpenXRExtensionWrapperExtension::set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer) {
|
||||
void *OpenXRExtensionWrapper::set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer) {
|
||||
uint64_t pointer = 0;
|
||||
|
||||
if (GDVIRTUAL_CALL(_set_android_surface_swapchain_create_info_and_get_next_pointer, p_property_values, GDExtensionPtr<void>(p_next_pointer), pointer)) {
|
||||
|
|
@ -311,17 +354,14 @@ void *OpenXRExtensionWrapperExtension::set_android_surface_swapchain_create_info
|
|||
return p_next_pointer;
|
||||
}
|
||||
|
||||
Ref<OpenXRAPIExtension> OpenXRExtensionWrapperExtension::get_openxr_api() {
|
||||
return openxr_api;
|
||||
Ref<OpenXRAPIExtension> OpenXRExtensionWrapper::_gdextension_get_openxr_api() {
|
||||
static Ref<OpenXRAPIExtension> openxr_api_extension;
|
||||
if (unlikely(openxr_api_extension.is_null())) {
|
||||
openxr_api_extension.instantiate();
|
||||
}
|
||||
return openxr_api_extension;
|
||||
}
|
||||
|
||||
void OpenXRExtensionWrapperExtension::register_extension_wrapper() {
|
||||
void OpenXRExtensionWrapper::_gdextension_register_extension_wrapper() {
|
||||
OpenXRAPI::register_extension_wrapper(this);
|
||||
}
|
||||
|
||||
OpenXRExtensionWrapperExtension::OpenXRExtensionWrapperExtension() {
|
||||
openxr_api.instantiate();
|
||||
}
|
||||
|
||||
OpenXRExtensionWrapperExtension::~OpenXRExtensionWrapperExtension() {
|
||||
}
|
||||
|
|
@ -28,28 +28,42 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_EXTENSION_WRAPPER_H
|
||||
#define OPENXR_EXTENSION_WRAPPER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/math/projection.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "core/object/gdvirtual.gen.inc"
|
||||
#include "core/templates/hash_map.h"
|
||||
#include "core/templates/rid.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
#include "core/variant/variant.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
class OpenXRAPI;
|
||||
class OpenXRAPIExtension;
|
||||
class OpenXRActionMap;
|
||||
|
||||
// `OpenXRExtensionWrapper` allows us to implement OpenXR extensions.
|
||||
class OpenXRExtensionWrapper {
|
||||
class OpenXRExtensionWrapper : public Object {
|
||||
GDCLASS(OpenXRExtensionWrapper, Object);
|
||||
|
||||
Ref<OpenXRAPIExtension> _gdextension_get_openxr_api();
|
||||
void _gdextension_register_extension_wrapper();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
// `get_requested_extensions` should return a list of OpenXR extensions related to this extension.
|
||||
// If the bool * is a nullptr this extension is mandatory
|
||||
// If the bool * points to a boolean, the boolean will be updated
|
||||
// to true if the extension is enabled.
|
||||
virtual HashMap<String, bool *> get_requested_extensions() = 0;
|
||||
virtual HashMap<String, bool *> get_requested_extensions();
|
||||
|
||||
GDVIRTUAL0R(Dictionary, _get_requested_extensions);
|
||||
|
||||
// These functions allow an extension to add entries to a struct chain.
|
||||
// `p_next_pointer` points to the last struct that was created for this chain
|
||||
|
|
@ -57,14 +71,36 @@ public:
|
|||
// You should return the pointer to the last struct you define as your result.
|
||||
// If you are not adding any structs, just return `p_next_pointer`.
|
||||
// See existing extensions for examples of this implementation.
|
||||
virtual void *set_system_properties_and_get_next_pointer(void *p_next_pointer) { return p_next_pointer; } // Add additional data structures when we interrogate OpenXRS system abilities.
|
||||
virtual void *set_instance_create_info_and_get_next_pointer(void *p_next_pointer) { return p_next_pointer; } // Add additional data structures when we create our OpenXR instance.
|
||||
virtual void *set_session_create_and_get_next_pointer(void *p_next_pointer) { return p_next_pointer; } // Add additional data structures when we create our OpenXR session.
|
||||
virtual void *set_swapchain_create_info_and_get_next_pointer(void *p_next_pointer) { return p_next_pointer; } // Add additional data structures when creating OpenXR swap chains.
|
||||
virtual void *set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer) { return p_next_pointer; }
|
||||
virtual void *set_projection_views_and_get_next_pointer(int p_view_index, void *p_next_pointer) { return p_next_pointer; }
|
||||
virtual void *set_system_properties_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when we interrogate OpenXRS system abilities.
|
||||
virtual void *set_instance_create_info_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when we create our OpenXR instance.
|
||||
virtual void *set_session_create_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when we create our OpenXR session.
|
||||
virtual void *set_swapchain_create_info_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when creating OpenXR swap chains.
|
||||
virtual void *set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer);
|
||||
virtual void *set_projection_views_and_get_next_pointer(int p_view_index, void *p_next_pointer);
|
||||
virtual void *set_reference_space_create_info_and_get_next_pointer(int p_reference_space_type, void *p_next_pointer);
|
||||
// These will only be called for extensions registered via OpenXRApi::register_frame_info_extension().
|
||||
virtual void *set_frame_wait_info_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when calling xrWaitFrame
|
||||
virtual void *set_view_locate_info_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when calling xrLocateViews
|
||||
virtual void *set_frame_end_info_and_get_next_pointer(void *p_next_pointer); // Add additional data structures when calling xrEndFrame
|
||||
|
||||
virtual PackedStringArray get_suggested_tracker_names() { return PackedStringArray(); }
|
||||
//TODO workaround as GDExtensionPtr<void> return type results in build error in godot-cpp
|
||||
GDVIRTUAL1R(uint64_t, _set_system_properties_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_instance_create_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_session_create_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_swapchain_create_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL2R(uint64_t, _set_hand_joint_locations_and_get_next_pointer, int, GDExtensionPtr<void>);
|
||||
GDVIRTUAL2R(uint64_t, _set_projection_views_and_get_next_pointer, int, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_frame_wait_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_frame_end_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_view_locate_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL2R(uint64_t, _set_reference_space_create_info_and_get_next_pointer, int, GDExtensionPtr<void>);
|
||||
GDVIRTUAL0R(int, _get_composition_layer_count);
|
||||
GDVIRTUAL1R(uint64_t, _get_composition_layer, int);
|
||||
GDVIRTUAL1R(int, _get_composition_layer_order, int);
|
||||
|
||||
virtual PackedStringArray get_suggested_tracker_names();
|
||||
|
||||
GDVIRTUAL0R(PackedStringArray, _get_suggested_tracker_names);
|
||||
|
||||
// `on_register_metadata` allows extensions to register additional controller metadata.
|
||||
// This function is called even when OpenXRApi is not constructured as the metadata
|
||||
|
|
@ -72,43 +108,75 @@ public:
|
|||
// Also extensions should provide metadata regardless of whether they are supported
|
||||
// on the host system as the controller data is used to setup action maps for users
|
||||
// who may have access to the relevant hardware.
|
||||
virtual void on_register_metadata() {}
|
||||
virtual void on_register_metadata();
|
||||
|
||||
virtual void on_before_instance_created() {} // `on_before_instance_created` is called before we create our OpenXR instance.
|
||||
virtual void on_instance_created(const XrInstance p_instance) {} // `on_instance_created` is called right after we've successfully created our OpenXR instance.
|
||||
virtual void on_instance_destroyed() {} // `on_instance_destroyed` is called right before we destroy our OpenXR instance.
|
||||
virtual void on_session_created(const XrSession p_session) {} // `on_session_created` is called right after we've successfully created our OpenXR session.
|
||||
virtual void on_session_destroyed() {} // `on_session_destroyed` is called right before we destroy our OpenXR session.
|
||||
virtual void on_before_instance_created(); // `on_before_instance_created` is called before we create our OpenXR instance.
|
||||
virtual void on_instance_created(const XrInstance p_instance); // `on_instance_created` is called right after we've successfully created our OpenXR instance.
|
||||
virtual void on_instance_destroyed(); // `on_instance_destroyed` is called right before we destroy our OpenXR instance.
|
||||
virtual void on_session_created(const XrSession p_session); // `on_session_created` is called right after we've successfully created our OpenXR session.
|
||||
virtual void on_session_destroyed(); // `on_session_destroyed` is called right before we destroy our OpenXR session.
|
||||
|
||||
// `on_process` is called as part of our OpenXR process handling,
|
||||
// this happens right before physics process and normal processing is run.
|
||||
// This is when controller data is queried and made available to game logic.
|
||||
virtual void on_process() {}
|
||||
virtual void on_pre_render() {} // `on_pre_render` is called right before we start rendering our XR viewports.
|
||||
virtual void on_main_swapchains_created() {} // `on_main_swapchains_created` is called right after our main swapchains are (re)created.
|
||||
virtual void on_pre_draw_viewport(RID p_render_target) {} // `on_pre_draw_viewport` is called right before we start rendering this viewport
|
||||
virtual void on_post_draw_viewport(RID p_render_target) {} // `on_port_draw_viewport` is called right after we start rendering this viewport (note that on Vulkan draw commands may only be queued)
|
||||
virtual void on_process();
|
||||
virtual void on_pre_render(); // `on_pre_render` is called right before we start rendering our XR viewports.
|
||||
virtual void on_main_swapchains_created(); // `on_main_swapchains_created` is called right after our main swapchains are (re)created.
|
||||
virtual void on_pre_draw_viewport(RID p_render_target); // `on_pre_draw_viewport` is called right before we start rendering this viewport
|
||||
virtual void on_post_draw_viewport(RID p_render_target); // `on_port_draw_viewport` is called right after we start rendering this viewport (note that on Vulkan draw commands may only be queued)
|
||||
|
||||
virtual void on_state_idle() {} // `on_state_idle` is called when the OpenXR session state is changed to idle.
|
||||
virtual void on_state_ready() {} // `on_state_ready` is called when the OpenXR session state is changed to ready, this means OpenXR is ready to setup our session.
|
||||
virtual void on_state_synchronized() {} // `on_state_synchronized` is called when the OpenXR session state is changed to synchronized, note that OpenXR also returns to this state when our application looses focus.
|
||||
virtual void on_state_visible() {} // `on_state_visible` is called when the OpenXR session state is changed to visible, OpenXR is now ready to receive frames.
|
||||
virtual void on_state_focused() {} // `on_state_focused` is called when the OpenXR session state is changed to focused, this state is the active state when our game runs.
|
||||
virtual void on_state_stopping() {} // `on_state_stopping` is called when the OpenXR session state is changed to stopping.
|
||||
virtual void on_state_loss_pending() {} // `on_state_loss_pending` is called when the OpenXR session state is changed to loss pending.
|
||||
virtual void on_state_exiting() {} // `on_state_exiting` is called when the OpenXR session state is changed to exiting.
|
||||
GDVIRTUAL0(_on_register_metadata);
|
||||
GDVIRTUAL0(_on_before_instance_created);
|
||||
GDVIRTUAL1(_on_instance_created, uint64_t);
|
||||
GDVIRTUAL0(_on_instance_destroyed);
|
||||
GDVIRTUAL1(_on_session_created, uint64_t);
|
||||
GDVIRTUAL0(_on_process);
|
||||
GDVIRTUAL0(_on_pre_render);
|
||||
GDVIRTUAL0(_on_main_swapchains_created);
|
||||
GDVIRTUAL0(_on_session_destroyed);
|
||||
GDVIRTUAL1(_on_pre_draw_viewport, RID);
|
||||
GDVIRTUAL1(_on_post_draw_viewport, RID);
|
||||
|
||||
virtual void *set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer) { return p_next_pointer; } // Add additional data structures to composition layers created via OpenXRCompositionLayer.
|
||||
virtual void on_viewport_composition_layer_destroyed(const XrCompositionLayerBaseHeader *p_layer) {} // `on_viewport_composition_layer_destroyed` is called when a composition layer created via OpenXRCompositionLayer is destroyed.
|
||||
virtual void get_viewport_composition_layer_extension_properties(List<PropertyInfo> *p_property_list) {} // Get additional property definitions for OpenXRCompositionLayer.
|
||||
virtual Dictionary get_viewport_composition_layer_extension_property_defaults() { return Dictionary(); } // Get the default values for the additional property definitions for OpenXRCompositionLayer.
|
||||
virtual void *set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer) { return p_next_pointer; }
|
||||
virtual void on_state_idle(); // `on_state_idle` is called when the OpenXR session state is changed to idle.
|
||||
virtual void on_state_ready(); // `on_state_ready` is called when the OpenXR session state is changed to ready, this means OpenXR is ready to setup our session.
|
||||
virtual void on_state_synchronized(); // `on_state_synchronized` is called when the OpenXR session state is changed to synchronized, note that OpenXR also returns to this state when our application looses focus.
|
||||
virtual void on_state_visible(); // `on_state_visible` is called when the OpenXR session state is changed to visible, OpenXR is now ready to receive frames.
|
||||
virtual void on_state_focused(); // `on_state_focused` is called when the OpenXR session state is changed to focused, this state is the active state when our game runs.
|
||||
virtual void on_state_stopping(); // `on_state_stopping` is called when the OpenXR session state is changed to stopping.
|
||||
virtual void on_state_loss_pending(); // `on_state_loss_pending` is called when the OpenXR session state is changed to loss pending.
|
||||
virtual void on_state_exiting(); // `on_state_exiting` is called when the OpenXR session state is changed to exiting.
|
||||
|
||||
GDVIRTUAL0(_on_state_idle);
|
||||
GDVIRTUAL0(_on_state_ready);
|
||||
GDVIRTUAL0(_on_state_synchronized);
|
||||
GDVIRTUAL0(_on_state_visible);
|
||||
GDVIRTUAL0(_on_state_focused);
|
||||
GDVIRTUAL0(_on_state_stopping);
|
||||
GDVIRTUAL0(_on_state_loss_pending);
|
||||
GDVIRTUAL0(_on_state_exiting);
|
||||
|
||||
// These will only be called on extensions registered via OpenXRAPI::register_composition_layer_provider().
|
||||
virtual int get_composition_layer_count();
|
||||
virtual XrCompositionLayerBaseHeader *get_composition_layer(int p_index);
|
||||
virtual int get_composition_layer_order(int p_index);
|
||||
|
||||
virtual void *set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer); // Add additional data structures to composition layers created via OpenXRCompositionLayer.
|
||||
virtual void on_viewport_composition_layer_destroyed(const XrCompositionLayerBaseHeader *p_layer); // `on_viewport_composition_layer_destroyed` is called when a composition layer created via OpenXRCompositionLayer is destroyed.
|
||||
virtual void get_viewport_composition_layer_extension_properties(List<PropertyInfo> *p_property_list); // Get additional property definitions for OpenXRCompositionLayer.
|
||||
virtual Dictionary get_viewport_composition_layer_extension_property_defaults(); // Get the default values for the additional property definitions for OpenXRCompositionLayer.
|
||||
virtual void *set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer);
|
||||
|
||||
GDVIRTUAL3R(uint64_t, _set_viewport_composition_layer_and_get_next_pointer, GDExtensionConstPtr<void>, Dictionary, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1(_on_viewport_composition_layer_destroyed, GDExtensionConstPtr<void>);
|
||||
GDVIRTUAL0R(TypedArray<Dictionary>, _get_viewport_composition_layer_extension_properties);
|
||||
GDVIRTUAL0R(Dictionary, _get_viewport_composition_layer_extension_property_defaults);
|
||||
GDVIRTUAL2R(uint64_t, _set_android_surface_swapchain_create_info_and_get_next_pointer, Dictionary, GDExtensionPtr<void>);
|
||||
|
||||
// `on_event_polled` is called when there is an OpenXR event to process.
|
||||
// Should return true if the event was handled, false otherwise.
|
||||
virtual bool on_event_polled(const XrEventDataBuffer &event) {
|
||||
return false;
|
||||
}
|
||||
virtual bool on_event_polled(const XrEventDataBuffer &event);
|
||||
|
||||
GDVIRTUAL1R(bool, _on_event_polled, GDExtensionConstPtr<void>);
|
||||
|
||||
OpenXRExtensionWrapper() = default;
|
||||
virtual ~OpenXRExtensionWrapper() = default;
|
||||
|
|
@ -125,5 +193,3 @@ public:
|
|||
virtual bool create_projection_fov(const XrFovf p_fov, double p_z_near, double p_z_far, Projection &r_camera_matrix) = 0; // `create_projection_fov` creates a proper projection matrix based on asymmetric FOV data provided by OpenXR.
|
||||
virtual RID get_texture(void *p_swapchain_graphics_data, int p_image_index) = 0; // `get_texture` returns a Godot texture RID for the current active texture in our swapchain.
|
||||
};
|
||||
|
||||
#endif // OPENXR_EXTENSION_WRAPPER_H
|
||||
|
|
|
|||
|
|
@ -28,122 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_EXTENSION_WRAPPER_EXTENSION_H
|
||||
#define OPENXR_EXTENSION_WRAPPER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../openxr_api_extension.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "core/os/thread_safe.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
#include "core/variant/typed_array.h"
|
||||
|
||||
class OpenXRExtensionWrapperExtension : public Object, public OpenXRExtensionWrapper, public OpenXRCompositionLayerProvider {
|
||||
GDCLASS(OpenXRExtensionWrapperExtension, Object);
|
||||
|
||||
protected:
|
||||
_THREAD_SAFE_CLASS_
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
Ref<OpenXRAPIExtension> openxr_api;
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
GDVIRTUAL0R(Dictionary, _get_requested_extensions);
|
||||
|
||||
virtual void *set_system_properties_and_get_next_pointer(void *p_next_pointer) override;
|
||||
virtual void *set_instance_create_info_and_get_next_pointer(void *p_next_pointer) override;
|
||||
virtual void *set_session_create_and_get_next_pointer(void *p_next_pointer) override;
|
||||
virtual void *set_swapchain_create_info_and_get_next_pointer(void *p_next_pointer) override;
|
||||
virtual void *set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer) override;
|
||||
virtual void *set_projection_views_and_get_next_pointer(int p_view_index, void *p_next_pointer) override;
|
||||
|
||||
virtual int get_composition_layer_count() override;
|
||||
virtual XrCompositionLayerBaseHeader *get_composition_layer(int p_index) override;
|
||||
virtual int get_composition_layer_order(int p_index) override;
|
||||
|
||||
//TODO workaround as GDExtensionPtr<void> return type results in build error in godot-cpp
|
||||
GDVIRTUAL1R(uint64_t, _set_system_properties_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_instance_create_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_session_create_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1R(uint64_t, _set_swapchain_create_info_and_get_next_pointer, GDExtensionPtr<void>);
|
||||
GDVIRTUAL2R(uint64_t, _set_hand_joint_locations_and_get_next_pointer, int, GDExtensionPtr<void>);
|
||||
GDVIRTUAL2R(uint64_t, _set_projection_views_and_get_next_pointer, int, GDExtensionPtr<void>);
|
||||
GDVIRTUAL0R(int, _get_composition_layer_count);
|
||||
GDVIRTUAL1R(uint64_t, _get_composition_layer, int);
|
||||
GDVIRTUAL1R(int, _get_composition_layer_order, int);
|
||||
|
||||
virtual PackedStringArray get_suggested_tracker_names() override;
|
||||
|
||||
GDVIRTUAL0R(PackedStringArray, _get_suggested_tracker_names);
|
||||
|
||||
virtual void on_register_metadata() override;
|
||||
virtual void on_before_instance_created() override;
|
||||
virtual void on_instance_created(const XrInstance p_instance) override;
|
||||
virtual void on_instance_destroyed() override;
|
||||
virtual void on_session_created(const XrSession p_session) override;
|
||||
virtual void on_process() override;
|
||||
virtual void on_pre_render() override;
|
||||
virtual void on_main_swapchains_created() override;
|
||||
virtual void on_session_destroyed() override;
|
||||
virtual void on_pre_draw_viewport(RID p_render_target) override;
|
||||
virtual void on_post_draw_viewport(RID p_render_target) override;
|
||||
|
||||
GDVIRTUAL0(_on_register_metadata);
|
||||
GDVIRTUAL0(_on_before_instance_created);
|
||||
GDVIRTUAL1(_on_instance_created, uint64_t);
|
||||
GDVIRTUAL0(_on_instance_destroyed);
|
||||
GDVIRTUAL1(_on_session_created, uint64_t);
|
||||
GDVIRTUAL0(_on_process);
|
||||
GDVIRTUAL0(_on_pre_render);
|
||||
GDVIRTUAL0(_on_main_swapchains_created);
|
||||
GDVIRTUAL0(_on_session_destroyed);
|
||||
GDVIRTUAL1(_on_pre_draw_viewport, RID);
|
||||
GDVIRTUAL1(_on_post_draw_viewport, RID);
|
||||
|
||||
virtual void on_state_idle() override;
|
||||
virtual void on_state_ready() override;
|
||||
virtual void on_state_synchronized() override;
|
||||
virtual void on_state_visible() override;
|
||||
virtual void on_state_focused() override;
|
||||
virtual void on_state_stopping() override;
|
||||
virtual void on_state_loss_pending() override;
|
||||
virtual void on_state_exiting() override;
|
||||
|
||||
GDVIRTUAL0(_on_state_idle);
|
||||
GDVIRTUAL0(_on_state_ready);
|
||||
GDVIRTUAL0(_on_state_synchronized);
|
||||
GDVIRTUAL0(_on_state_visible);
|
||||
GDVIRTUAL0(_on_state_focused);
|
||||
GDVIRTUAL0(_on_state_stopping);
|
||||
GDVIRTUAL0(_on_state_loss_pending);
|
||||
GDVIRTUAL0(_on_state_exiting);
|
||||
|
||||
virtual bool on_event_polled(const XrEventDataBuffer &p_event) override;
|
||||
|
||||
GDVIRTUAL1R(bool, _on_event_polled, GDExtensionConstPtr<void>);
|
||||
|
||||
virtual void *set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer) override;
|
||||
virtual void on_viewport_composition_layer_destroyed(const XrCompositionLayerBaseHeader *p_layer) override;
|
||||
virtual void get_viewport_composition_layer_extension_properties(List<PropertyInfo> *p_property_list) override;
|
||||
virtual Dictionary get_viewport_composition_layer_extension_property_defaults() override;
|
||||
virtual void *set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer) override;
|
||||
|
||||
GDVIRTUAL3R(uint64_t, _set_viewport_composition_layer_and_get_next_pointer, GDExtensionConstPtr<void>, Dictionary, GDExtensionPtr<void>);
|
||||
GDVIRTUAL1(_on_viewport_composition_layer_destroyed, GDExtensionConstPtr<void>);
|
||||
GDVIRTUAL0R(TypedArray<Dictionary>, _get_viewport_composition_layer_extension_properties);
|
||||
GDVIRTUAL0R(Dictionary, _get_viewport_composition_layer_extension_property_defaults);
|
||||
GDVIRTUAL2R(uint64_t, _set_android_surface_swapchain_create_info_and_get_next_pointer, Dictionary, GDExtensionPtr<void>);
|
||||
|
||||
Ref<OpenXRAPIExtension> get_openxr_api();
|
||||
|
||||
void register_extension_wrapper();
|
||||
|
||||
OpenXRExtensionWrapperExtension();
|
||||
virtual ~OpenXRExtensionWrapperExtension() override;
|
||||
class OpenXRExtensionWrapperExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRExtensionWrapperExtension, OpenXRExtensionWrapper);
|
||||
};
|
||||
|
||||
#endif // OPENXR_EXTENSION_WRAPPER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -97,15 +97,15 @@ bool OpenXREyeGazeInteractionExtension::supports_eye_gaze_interaction() {
|
|||
}
|
||||
|
||||
void OpenXREyeGazeInteractionExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Eyes top path
|
||||
metadata->register_top_level_path("Eye gaze tracker", "/user/eyes_ext", XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Eye gaze tracker", "/user/eyes_ext", XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
|
||||
// Eye gaze interaction
|
||||
metadata->register_interaction_profile("Eye gaze", "/interaction_profiles/ext/eye_gaze_interaction", XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_io_path("/interaction_profiles/ext/eye_gaze_interaction", "Gaze pose", "/user/eyes_ext", "/user/eyes_ext/input/gaze_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_interaction_profile("Eye gaze", "/interaction_profiles/ext/eye_gaze_interaction", XR_EXT_EYE_GAZE_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/eye_gaze_interaction", "Gaze pose", "/user/eyes_ext", "/user/eyes_ext/input/gaze_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
}
|
||||
|
||||
bool OpenXREyeGazeInteractionExtension::get_eye_gaze_pose(double p_dist, Vector3 &r_eye_pose) {
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_EYE_GAZE_INTERACTION_H
|
||||
#define OPENXR_EYE_GAZE_INTERACTION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXREyeGazeInteractionExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXREyeGazeInteractionExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXREyeGazeInteractionExtension *get_singleton();
|
||||
|
||||
|
|
@ -62,5 +66,3 @@ private:
|
|||
RID eye_tracker;
|
||||
RID eye_action;
|
||||
};
|
||||
|
||||
#endif // OPENXR_EYE_GAZE_INTERACTION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_FB_DISPLAY_REFRESH_RATE_EXTENSION_H
|
||||
#define OPENXR_FB_DISPLAY_REFRESH_RATE_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
// This extension gives us access to the possible display refresh rates
|
||||
// supported by the HMD.
|
||||
|
|
@ -41,6 +40,11 @@
|
|||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRDisplayRefreshRateExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRDisplayRefreshRateExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRDisplayRefreshRateExtension *get_singleton();
|
||||
|
||||
|
|
@ -68,5 +72,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC2(xrGetDisplayRefreshRateFB, (XrSession), session, (float *), display_refresh_rate);
|
||||
EXT_PROTO_XRRESULT_FUNC2(xrRequestDisplayRefreshRateFB, (XrSession), session, (float), display_refresh_rate);
|
||||
};
|
||||
|
||||
#endif // OPENXR_FB_DISPLAY_REFRESH_RATE_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_FB_FOVEATION_EXTENSION_H
|
||||
#define OPENXR_FB_FOVEATION_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
// This extension implements the FB Foveation extension.
|
||||
// This is an extension Meta added due to VRS being unavailable on Android.
|
||||
|
|
@ -47,6 +46,11 @@
|
|||
#include "openxr_fb_update_swapchain_extension.h"
|
||||
|
||||
class OpenXRFBFoveationExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRFBFoveationExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRFBFoveationExtension *get_singleton();
|
||||
|
||||
|
|
@ -100,5 +104,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC3(xrCreateFoveationProfileFB, (XrSession), session, (const XrFoveationProfileCreateInfoFB *), create_info, (XrFoveationProfileFB *), profile);
|
||||
EXT_PROTO_XRRESULT_FUNC1(xrDestroyFoveationProfileFB, (XrFoveationProfileFB), profile);
|
||||
};
|
||||
|
||||
#endif // OPENXR_FB_FOVEATION_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -33,6 +33,19 @@
|
|||
// Always include this as late as possible.
|
||||
#include "../openxr_platform_inc.h"
|
||||
|
||||
#ifndef GL_CUBIC_IMG
|
||||
#define GL_CUBIC_IMG 0x9139
|
||||
#endif
|
||||
#ifndef GL_CUBIC_MIPMAP_LINEAR_IMG
|
||||
#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B
|
||||
#endif
|
||||
#ifndef GL_CUBIC_MIPMAP_NEAREST_IMG
|
||||
#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A
|
||||
#endif
|
||||
#ifndef GL_CLAMP_TO_BORDER
|
||||
#define GL_CLAMP_TO_BORDER 0x812D
|
||||
#endif
|
||||
|
||||
OpenXRFBUpdateSwapchainExtension *OpenXRFBUpdateSwapchainExtension::singleton = nullptr;
|
||||
|
||||
OpenXRFBUpdateSwapchainExtension *OpenXRFBUpdateSwapchainExtension::get_singleton() {
|
||||
|
|
@ -63,6 +76,10 @@ HashMap<String, bool *> OpenXRFBUpdateSwapchainExtension::get_requested_extensio
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
request_extensions[XR_FB_SWAPCHAIN_UPDATE_STATE_ANDROID_SURFACE_EXTENSION_NAME] = &fb_swapchain_update_state_android_ext;
|
||||
#endif
|
||||
|
||||
return request_extensions;
|
||||
}
|
||||
|
||||
|
|
@ -100,3 +117,231 @@ bool OpenXRFBUpdateSwapchainExtension::is_enabled() const {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OpenXRFBUpdateSwapchainExtension::is_android_ext_enabled() const {
|
||||
return fb_swapchain_update_state_android_ext;
|
||||
}
|
||||
|
||||
void OpenXRFBUpdateSwapchainExtension::update_swapchain_state(XrSwapchain p_swapchain, const OpenXRViewportCompositionLayerProvider::SwapchainState *p_swapchain_state) {
|
||||
if (!p_swapchain_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rendering_driver == "vulkan") {
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
if (!fb_swapchain_update_state_ext || !fb_swapchain_update_state_vulkan_ext) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color border_color = p_swapchain_state->border_color;
|
||||
XrSwapchainStateSamplerVulkanFB swapchain_state = {
|
||||
XR_TYPE_SWAPCHAIN_STATE_SAMPLER_VULKAN_FB, // type
|
||||
nullptr, // next
|
||||
(VkFilter)filter_to_vk(p_swapchain_state->min_filter), // minFilter
|
||||
(VkFilter)filter_to_vk(p_swapchain_state->mag_filter), // magFilter
|
||||
(VkSamplerMipmapMode)mipmap_mode_to_vk(p_swapchain_state->mipmap_mode), // mipmapMode
|
||||
(VkSamplerAddressMode)wrap_to_vk(p_swapchain_state->horizontal_wrap), // wrapModeS;
|
||||
(VkSamplerAddressMode)wrap_to_vk(p_swapchain_state->vertical_wrap), // wrapModeT
|
||||
(VkComponentSwizzle)swizzle_to_vk(p_swapchain_state->red_swizzle), // swizzleRed
|
||||
(VkComponentSwizzle)swizzle_to_vk(p_swapchain_state->green_swizzle), // swizzleGreen
|
||||
(VkComponentSwizzle)swizzle_to_vk(p_swapchain_state->blue_swizzle), // swizzleBlue
|
||||
(VkComponentSwizzle)swizzle_to_vk(p_swapchain_state->alpha_swizzle), // swizzleAlpha
|
||||
p_swapchain_state->max_anisotropy, // maxAnisotropy
|
||||
{ border_color.r, border_color.g, border_color.b, border_color.a } // borderColor
|
||||
};
|
||||
|
||||
XrResult result = xrUpdateSwapchainFB(p_swapchain, (XrSwapchainStateBaseHeaderFB *)&swapchain_state);
|
||||
if (XR_FAILED(result)) {
|
||||
print_error(vformat("OpenXR: Failed to update swapchain [%s]", OpenXRAPI::get_singleton()->get_error_string(result)));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
} else if (rendering_driver == "opengl3") {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
if (!fb_swapchain_update_state_ext || !fb_swapchain_update_state_opengles_ext) {
|
||||
return;
|
||||
}
|
||||
|
||||
Color border_color = p_swapchain_state->border_color;
|
||||
XrSwapchainStateSamplerOpenGLESFB swapchain_state = {
|
||||
XR_TYPE_SWAPCHAIN_STATE_SAMPLER_OPENGL_ES_FB, // type
|
||||
nullptr, // next
|
||||
filter_to_gl(p_swapchain_state->min_filter, p_swapchain_state->mipmap_mode), // minFilter
|
||||
filter_to_gl(p_swapchain_state->mag_filter), // magFilter
|
||||
wrap_to_gl(p_swapchain_state->horizontal_wrap), // wrapModeS;
|
||||
wrap_to_gl(p_swapchain_state->vertical_wrap), // wrapModeT
|
||||
swizzle_to_gl(p_swapchain_state->red_swizzle), // swizzleRed
|
||||
swizzle_to_gl(p_swapchain_state->green_swizzle), // swizzleGreen
|
||||
swizzle_to_gl(p_swapchain_state->blue_swizzle), // swizzleBlue
|
||||
swizzle_to_gl(p_swapchain_state->alpha_swizzle), // swizzleAlpha
|
||||
p_swapchain_state->max_anisotropy, // maxAnisotropy
|
||||
{ border_color.r, border_color.g, border_color.b, border_color.a } // borderColor
|
||||
};
|
||||
|
||||
XrResult result = xrUpdateSwapchainFB(p_swapchain, (XrSwapchainStateBaseHeaderFB *)&swapchain_state);
|
||||
if (XR_FAILED(result)) {
|
||||
print_error(vformat("OpenXR: Failed to update swapchain [%s]", OpenXRAPI::get_singleton()->get_error_string(result)));
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRFBUpdateSwapchainExtension::update_swapchain_surface_size(XrSwapchain p_swapchain, const Size2i &p_size) {
|
||||
#ifdef ANDROID_ENABLED
|
||||
if (!fb_swapchain_update_state_ext || !fb_swapchain_update_state_android_ext) {
|
||||
return;
|
||||
}
|
||||
|
||||
XrSwapchainStateAndroidSurfaceDimensionsFB swapchain_state = {
|
||||
XR_TYPE_SWAPCHAIN_STATE_ANDROID_SURFACE_DIMENSIONS_FB, // type
|
||||
nullptr, // next
|
||||
(uint32_t)p_size.width, // width
|
||||
(uint32_t)p_size.height // height
|
||||
};
|
||||
|
||||
XrResult result = xrUpdateSwapchainFB(p_swapchain, (XrSwapchainStateBaseHeaderFB *)&swapchain_state);
|
||||
if (XR_FAILED(result)) {
|
||||
print_error(vformat("OpenXR: Failed to update swapchain surface size [%s]", OpenXRAPI::get_singleton()->get_error_string(result)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::filter_to_gl(OpenXRViewportCompositionLayerProvider::Filter p_filter, OpenXRViewportCompositionLayerProvider::MipmapMode p_mipmap_mode) {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
switch (p_mipmap_mode) {
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_DISABLED:
|
||||
switch (p_filter) {
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_NEAREST:
|
||||
return GL_NEAREST;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_LINEAR:
|
||||
return GL_LINEAR;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_CUBIC:
|
||||
return GL_CUBIC_IMG;
|
||||
}
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_NEAREST:
|
||||
switch (p_filter) {
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_NEAREST:
|
||||
return GL_NEAREST_MIPMAP_NEAREST;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_LINEAR:
|
||||
return GL_LINEAR_MIPMAP_NEAREST;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_CUBIC:
|
||||
return GL_CUBIC_MIPMAP_NEAREST_IMG;
|
||||
}
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_LINEAR:
|
||||
switch (p_filter) {
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_NEAREST:
|
||||
return GL_NEAREST_MIPMAP_LINEAR;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_LINEAR:
|
||||
return GL_LINEAR_MIPMAP_LINEAR;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_CUBIC:
|
||||
return GL_CUBIC_MIPMAP_LINEAR_IMG;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::wrap_to_gl(OpenXRViewportCompositionLayerProvider::Wrap p_wrap) {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
switch (p_wrap) {
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_CLAMP_TO_BORDER:
|
||||
return GL_CLAMP_TO_BORDER;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_CLAMP_TO_EDGE:
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_REPEAT:
|
||||
return GL_REPEAT;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_MIRRORED_REPEAT:
|
||||
return GL_MIRRORED_REPEAT;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_MIRROR_CLAMP_TO_EDGE:
|
||||
return GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::swizzle_to_gl(OpenXRViewportCompositionLayerProvider::Swizzle p_swizzle) {
|
||||
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
|
||||
switch (p_swizzle) {
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_RED:
|
||||
return GL_RED;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_GREEN:
|
||||
return GL_GREEN;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_BLUE:
|
||||
return GL_BLUE;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ALPHA:
|
||||
return GL_ALPHA;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ZERO:
|
||||
return GL_ZERO;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ONE:
|
||||
return GL_ONE;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::filter_to_vk(OpenXRViewportCompositionLayerProvider::Filter p_filter) {
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
switch (p_filter) {
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_NEAREST:
|
||||
return VK_FILTER_NEAREST;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_LINEAR:
|
||||
return VK_FILTER_LINEAR;
|
||||
case OpenXRViewportCompositionLayerProvider::Filter::FILTER_CUBIC:
|
||||
return VK_FILTER_CUBIC_EXT;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::mipmap_mode_to_vk(OpenXRViewportCompositionLayerProvider::MipmapMode p_mipmap_mode) {
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
switch (p_mipmap_mode) {
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_DISABLED:
|
||||
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_NEAREST:
|
||||
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||
case OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_LINEAR:
|
||||
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::wrap_to_vk(OpenXRViewportCompositionLayerProvider::Wrap p_wrap) {
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
switch (p_wrap) {
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_CLAMP_TO_BORDER:
|
||||
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_CLAMP_TO_EDGE:
|
||||
return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_REPEAT:
|
||||
return VK_SAMPLER_ADDRESS_MODE_REPEAT;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_MIRRORED_REPEAT:
|
||||
return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT;
|
||||
case OpenXRViewportCompositionLayerProvider::Wrap::WRAP_MIRROR_CLAMP_TO_EDGE:
|
||||
return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t OpenXRFBUpdateSwapchainExtension::swizzle_to_vk(OpenXRViewportCompositionLayerProvider::Swizzle p_swizzle) {
|
||||
#ifdef XR_USE_GRAPHICS_API_VULKAN
|
||||
switch (p_swizzle) {
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_RED:
|
||||
return VK_COMPONENT_SWIZZLE_R;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_GREEN:
|
||||
return VK_COMPONENT_SWIZZLE_G;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_BLUE:
|
||||
return VK_COMPONENT_SWIZZLE_B;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ALPHA:
|
||||
return VK_COMPONENT_SWIZZLE_A;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ZERO:
|
||||
return VK_COMPONENT_SWIZZLE_ZERO;
|
||||
case OpenXRViewportCompositionLayerProvider::Swizzle::SWIZZLE_ONE:
|
||||
return VK_COMPONENT_SWIZZLE_ONE;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_FB_UPDATE_SWAPCHAIN_EXTENSION_H
|
||||
#define OPENXR_FB_UPDATE_SWAPCHAIN_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
// This extension implements the FB update swapchain extension.
|
||||
// This is an extension Meta added to further configure the swapchain.
|
||||
|
|
@ -38,9 +37,15 @@
|
|||
|
||||
#include "../openxr_api.h"
|
||||
#include "../util.h"
|
||||
#include "openxr_composition_layer_extension.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRFBUpdateSwapchainExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRFBUpdateSwapchainExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
friend class OpenXRFBFoveationExtension;
|
||||
|
||||
public:
|
||||
|
|
@ -55,6 +60,11 @@ public:
|
|||
virtual void on_instance_destroyed() override;
|
||||
|
||||
bool is_enabled() const;
|
||||
bool is_android_ext_enabled() const;
|
||||
|
||||
void update_swapchain_state(XrSwapchain p_swapchain, const OpenXRViewportCompositionLayerProvider::SwapchainState *p_swapchain_state);
|
||||
|
||||
void update_swapchain_surface_size(XrSwapchain p_swapchain, const Size2i &p_size);
|
||||
|
||||
private:
|
||||
static OpenXRFBUpdateSwapchainExtension *singleton;
|
||||
|
|
@ -64,10 +74,18 @@ private:
|
|||
bool fb_swapchain_update_state_ext = false;
|
||||
bool fb_swapchain_update_state_vulkan_ext = false;
|
||||
bool fb_swapchain_update_state_opengles_ext = false;
|
||||
bool fb_swapchain_update_state_android_ext = false;
|
||||
|
||||
uint32_t filter_to_gl(OpenXRViewportCompositionLayerProvider::Filter p_filter, OpenXRViewportCompositionLayerProvider::MipmapMode p_mipmap_mode = OpenXRViewportCompositionLayerProvider::MipmapMode::MIPMAP_MODE_DISABLED);
|
||||
uint32_t wrap_to_gl(OpenXRViewportCompositionLayerProvider::Wrap p_wrap);
|
||||
uint32_t swizzle_to_gl(OpenXRViewportCompositionLayerProvider::Swizzle p_swizzle);
|
||||
|
||||
uint32_t filter_to_vk(OpenXRViewportCompositionLayerProvider::Filter p_filter);
|
||||
uint32_t mipmap_mode_to_vk(OpenXRViewportCompositionLayerProvider::MipmapMode p_mipmap);
|
||||
uint32_t wrap_to_vk(OpenXRViewportCompositionLayerProvider::Wrap p_wrap);
|
||||
uint32_t swizzle_to_vk(OpenXRViewportCompositionLayerProvider::Swizzle p_swizzle);
|
||||
|
||||
// OpenXR API call wrappers
|
||||
EXT_PROTO_XRRESULT_FUNC2(xrUpdateSwapchainFB, (XrSwapchain), swapchain, (const XrSwapchainStateBaseHeaderFB *), state);
|
||||
EXT_PROTO_XRRESULT_FUNC2(xrGetSwapchainStateFB, (XrSwapchain), swapchain, (XrSwapchainStateBaseHeaderFB *), state);
|
||||
};
|
||||
|
||||
#endif // OPENXR_FB_UPDATE_SWAPCHAIN_EXTENSION_H
|
||||
|
|
|
|||
254
engine/modules/openxr/extensions/openxr_future_extension.cpp
Normal file
254
engine/modules/openxr/extensions/openxr_future_extension.cpp
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_future_extension.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "openxr_future_extension.h"
|
||||
|
||||
#include "../openxr_api.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// OpenXRFutureResult
|
||||
|
||||
void OpenXRFutureResult::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_status"), &OpenXRFutureResult::get_status);
|
||||
ClassDB::bind_method(D_METHOD("get_future"), &OpenXRFutureResult::_get_future);
|
||||
ClassDB::bind_method(D_METHOD("cancel_future"), &OpenXRFutureResult::cancel_future);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("completed", PropertyInfo(Variant::OBJECT, "result", PROPERTY_HINT_RESOURCE_TYPE, "OpenXRFutureResult")));
|
||||
|
||||
BIND_ENUM_CONSTANT(RESULT_RUNNING);
|
||||
BIND_ENUM_CONSTANT(RESULT_FINISHED);
|
||||
BIND_ENUM_CONSTANT(RESULT_CANCELLED);
|
||||
}
|
||||
|
||||
void OpenXRFutureResult::_mark_as_finished() {
|
||||
// Update our status
|
||||
status = RESULT_FINISHED;
|
||||
|
||||
// Perform our callback
|
||||
on_success_callback.call((uint64_t)future);
|
||||
|
||||
// Emit our signal
|
||||
emit_signal(SNAME("completed"), this);
|
||||
}
|
||||
|
||||
void OpenXRFutureResult::_mark_as_cancelled() {
|
||||
// Update our status
|
||||
status = RESULT_CANCELLED;
|
||||
|
||||
// There is no point in doing a callback for cancellation as its always user invoked.
|
||||
|
||||
// But we do emit our signal to make sure any await finishes.
|
||||
emit_signal(SNAME("completed"), this);
|
||||
}
|
||||
|
||||
OpenXRFutureResult::ResultStatus OpenXRFutureResult::get_status() const {
|
||||
return status;
|
||||
}
|
||||
|
||||
XrFutureEXT OpenXRFutureResult::get_future() const {
|
||||
return future;
|
||||
}
|
||||
|
||||
uint64_t OpenXRFutureResult::_get_future() const {
|
||||
return (uint64_t)future;
|
||||
}
|
||||
|
||||
void OpenXRFutureResult::cancel_future() {
|
||||
ERR_FAIL_COND(status != RESULT_RUNNING);
|
||||
|
||||
OpenXRFutureExtension *future_extension = OpenXRFutureExtension::get_singleton();
|
||||
ERR_FAIL_NULL(future_extension);
|
||||
|
||||
future_extension->cancel_future(future);
|
||||
}
|
||||
|
||||
OpenXRFutureResult::OpenXRFutureResult(XrFutureEXT p_future, const Callable &p_on_success) {
|
||||
future = p_future;
|
||||
on_success_callback = p_on_success;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// OpenXRFutureExtension
|
||||
|
||||
OpenXRFutureExtension *OpenXRFutureExtension::singleton = nullptr;
|
||||
|
||||
OpenXRFutureExtension *OpenXRFutureExtension::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
OpenXRFutureExtension::OpenXRFutureExtension() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
OpenXRFutureExtension::~OpenXRFutureExtension() {
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_active"), &OpenXRFutureExtension::is_active);
|
||||
ClassDB::bind_method(D_METHOD("register_future", "future", "on_success"), &OpenXRFutureExtension::_register_future, DEFVAL(Callable()));
|
||||
ClassDB::bind_method(D_METHOD("cancel_future", "future"), &OpenXRFutureExtension::_cancel_future);
|
||||
}
|
||||
|
||||
HashMap<String, bool *> OpenXRFutureExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> request_extensions;
|
||||
|
||||
request_extensions[XR_EXT_FUTURE_EXTENSION_NAME] = &future_ext;
|
||||
|
||||
return request_extensions;
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::on_instance_created(const XrInstance p_instance) {
|
||||
if (future_ext) {
|
||||
EXT_INIT_XR_FUNC(xrPollFutureEXT);
|
||||
EXT_INIT_XR_FUNC(xrCancelFutureEXT);
|
||||
|
||||
future_ext = xrPollFutureEXT_ptr && xrCancelFutureEXT_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::on_instance_destroyed() {
|
||||
xrPollFutureEXT_ptr = nullptr;
|
||||
xrCancelFutureEXT_ptr = nullptr;
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::on_session_destroyed() {
|
||||
if (!is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OpenXRAPI *openxr_api = OpenXRAPI::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_api);
|
||||
|
||||
// Cancel any running futures.
|
||||
for (const KeyValue<XrFutureEXT, Ref<OpenXRFutureResult>> &element : futures) {
|
||||
XrFutureCancelInfoEXT cancel_info = {
|
||||
XR_TYPE_FUTURE_CANCEL_INFO_EXT, // type
|
||||
nullptr, // next
|
||||
element.key // future
|
||||
};
|
||||
XrResult result = xrCancelFutureEXT_ptr(openxr_api->get_instance(), &cancel_info);
|
||||
if (XR_FAILED(result)) {
|
||||
WARN_PRINT("OpenXR: Failed to cancel future [" + openxr_api->get_error_string(result) + "]");
|
||||
}
|
||||
|
||||
// Make sure we mark our future result as cancelled
|
||||
element.value->_mark_as_cancelled();
|
||||
}
|
||||
futures.clear();
|
||||
}
|
||||
|
||||
bool OpenXRFutureExtension::is_active() const {
|
||||
return future_ext;
|
||||
}
|
||||
|
||||
Ref<OpenXRFutureResult> OpenXRFutureExtension::register_future(XrFutureEXT p_future, const Callable &p_on_success) {
|
||||
ERR_FAIL_COND_V(futures.has(p_future), nullptr);
|
||||
|
||||
Ref<OpenXRFutureResult> future_result;
|
||||
future_result.instantiate(p_future, p_on_success);
|
||||
|
||||
futures[p_future] = future_result;
|
||||
|
||||
return future_result;
|
||||
}
|
||||
|
||||
Ref<OpenXRFutureResult> OpenXRFutureExtension::_register_future(uint64_t p_future, const Callable &p_on_success) {
|
||||
return register_future((XrFutureEXT)p_future, p_on_success);
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::cancel_future(XrFutureEXT p_future) {
|
||||
ERR_FAIL_COND(!futures.has(p_future));
|
||||
|
||||
OpenXRAPI *openxr_api = OpenXRAPI::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_api);
|
||||
|
||||
XrFutureCancelInfoEXT cancel_info = {
|
||||
XR_TYPE_FUTURE_CANCEL_INFO_EXT, // type
|
||||
nullptr, // next
|
||||
p_future // future
|
||||
};
|
||||
XrResult result = xrCancelFutureEXT_ptr(openxr_api->get_instance(), &cancel_info);
|
||||
if (XR_FAILED(result)) {
|
||||
WARN_PRINT("OpenXR: Failed to cancel future [" + openxr_api->get_error_string(result) + "]");
|
||||
}
|
||||
|
||||
// Make sure we mark our future result as cancelled
|
||||
futures[p_future]->_mark_as_cancelled();
|
||||
|
||||
// And erase it from the futures we track
|
||||
futures.erase(p_future);
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::_cancel_future(uint64_t p_future) {
|
||||
cancel_future((XrFutureEXT)p_future);
|
||||
}
|
||||
|
||||
void OpenXRFutureExtension::on_process() {
|
||||
if (!is_active()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OpenXRAPI *openxr_api = OpenXRAPI::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_api);
|
||||
|
||||
// Process futures
|
||||
Vector<XrFutureEXT> completed;
|
||||
for (const KeyValue<XrFutureEXT, Ref<OpenXRFutureResult>> &element : futures) {
|
||||
XrFuturePollInfoEXT poll_info = {
|
||||
XR_TYPE_FUTURE_POLL_INFO_EXT, // type
|
||||
nullptr, // next
|
||||
element.key // future
|
||||
};
|
||||
XrFuturePollResultEXT poll_result = {
|
||||
XR_TYPE_FUTURE_POLL_RESULT_EXT, // type
|
||||
nullptr, // next
|
||||
XR_FUTURE_STATE_MAX_ENUM_EXT // state
|
||||
};
|
||||
XrResult result = xrPollFutureEXT_ptr(openxr_api->get_instance(), &poll_info, &poll_result);
|
||||
if (XR_FAILED(result)) {
|
||||
ERR_PRINT("OpenXR: Failed to obtain future status [" + openxr_api->get_error_string(result) + "]");
|
||||
// Maybe remove this depending on the error?
|
||||
continue;
|
||||
}
|
||||
if (poll_result.state == XR_FUTURE_STATE_READY_EXT) {
|
||||
// Mark our future result as finished (this will invoke our callback).
|
||||
element.value->_mark_as_finished();
|
||||
|
||||
// Queue removing this
|
||||
completed.push_back(element.key);
|
||||
}
|
||||
}
|
||||
|
||||
// Now clean up completed futures.
|
||||
for (const XrFutureEXT &future : completed) {
|
||||
futures.erase(future);
|
||||
}
|
||||
}
|
||||
132
engine/modules/openxr/extensions/openxr_future_extension.h
Normal file
132
engine/modules/openxr/extensions/openxr_future_extension.h
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_future_extension.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
The OpenXR future extension forms the basis of OpenXRs ability to
|
||||
execute logic asynchronously.
|
||||
|
||||
Asynchronous functions will return a future object which can be
|
||||
polled each frame to determine if the asynchronous function has
|
||||
been completed.
|
||||
|
||||
If so the future can be used to obtain final return values.
|
||||
The API call for this is often part of the extension that utilizes
|
||||
the future.
|
||||
|
||||
We will be using Godot Callables to drive responses on futures.
|
||||
*/
|
||||
|
||||
#include "../util.h"
|
||||
#include "core/object/ref_counted.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
class OpenXRFutureExtension;
|
||||
|
||||
class OpenXRFutureResult : public RefCounted {
|
||||
GDCLASS(OpenXRFutureResult, RefCounted);
|
||||
|
||||
friend class OpenXRFutureExtension;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
void _mark_as_finished();
|
||||
void _mark_as_cancelled();
|
||||
|
||||
public:
|
||||
enum ResultStatus {
|
||||
RESULT_RUNNING,
|
||||
RESULT_FINISHED,
|
||||
RESULT_CANCELLED,
|
||||
};
|
||||
|
||||
ResultStatus get_status() const;
|
||||
XrFutureEXT get_future() const;
|
||||
|
||||
void cancel_future();
|
||||
|
||||
OpenXRFutureResult(XrFutureEXT p_future, const Callable &p_on_success);
|
||||
|
||||
private:
|
||||
ResultStatus status = RESULT_RUNNING;
|
||||
XrFutureEXT future;
|
||||
Callable on_success_callback;
|
||||
|
||||
uint64_t _get_future() const;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(OpenXRFutureResult::ResultStatus);
|
||||
|
||||
class OpenXRFutureExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRFutureExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
static OpenXRFutureExtension *get_singleton();
|
||||
|
||||
OpenXRFutureExtension();
|
||||
virtual ~OpenXRFutureExtension() override;
|
||||
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
virtual void on_instance_created(const XrInstance p_instance) override;
|
||||
virtual void on_instance_destroyed() override;
|
||||
virtual void on_session_destroyed() override;
|
||||
|
||||
virtual void on_process() override;
|
||||
|
||||
bool is_active() const;
|
||||
|
||||
Ref<OpenXRFutureResult> register_future(XrFutureEXT p_future, const Callable &p_on_success = Callable());
|
||||
void cancel_future(XrFutureEXT p_future);
|
||||
|
||||
private:
|
||||
static OpenXRFutureExtension *singleton;
|
||||
|
||||
bool future_ext = false;
|
||||
|
||||
HashMap<XrFutureEXT, Ref<OpenXRFutureResult>> futures;
|
||||
|
||||
// Make these accessible from GDExtension and/or GDScript
|
||||
Ref<OpenXRFutureResult> _register_future(uint64_t p_future, const Callable &p_on_success = Callable());
|
||||
void _cancel_future(uint64_t p_future);
|
||||
|
||||
// OpenXR API call wrappers
|
||||
|
||||
// Futures
|
||||
EXT_PROTO_XRRESULT_FUNC3(xrPollFutureEXT, (XrInstance), instance, (const XrFuturePollInfoEXT *), poll_info, (XrFuturePollResultEXT *), poll_result);
|
||||
EXT_PROTO_XRRESULT_FUNC2(xrCancelFutureEXT, (XrInstance), instance, (const XrFutureCancelInfoEXT *), cancel_info);
|
||||
};
|
||||
|
|
@ -64,34 +64,34 @@ bool OpenXRHandInteractionExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRHandInteractionExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Hand interaction profile
|
||||
metadata->register_interaction_profile("Hand interaction", "/interaction_profiles/ext/hand_interaction_ext", XR_EXT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grip pose", "/user/hand/left", "/user/hand/left/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grip pose", "/user/hand/right", "/user/hand/right/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim pose", "/user/hand/left", "/user/hand/left/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim pose", "/user/hand/right", "/user/hand/right/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch pose", "/user/hand/left", "/user/hand/left/input/pinch_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch pose", "/user/hand/right", "/user/hand/right/input/pinch_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Poke pose", "/user/hand/left", "/user/hand/left/input/poke_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Poke pose", "/user/hand/right", "/user/hand/right/input/poke_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Palm pose", "/user/hand/left", "/user/hand/left/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Palm pose", "/user/hand/right", "/user/hand/right/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_interaction_profile("Hand interaction", "/interaction_profiles/ext/hand_interaction_ext", XR_EXT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grip pose", "/user/hand/left", "/user/hand/left/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grip pose", "/user/hand/right", "/user/hand/right/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim pose", "/user/hand/left", "/user/hand/left/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim pose", "/user/hand/right", "/user/hand/right/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch pose", "/user/hand/left", "/user/hand/left/input/pinch_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch pose", "/user/hand/right", "/user/hand/right/input/pinch_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Poke pose", "/user/hand/left", "/user/hand/left/input/poke_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Poke pose", "/user/hand/right", "/user/hand/right/input/poke_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Palm pose", "/user/hand/left", "/user/hand/left/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Palm pose", "/user/hand/right", "/user/hand/right/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch", "/user/hand/left", "/user/hand/left/input/pinch_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch", "/user/hand/right", "/user/hand/right/input/pinch_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch ready", "/user/hand/left", "/user/hand/left/input/pinch_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch ready", "/user/hand/right", "/user/hand/right/input/pinch_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch", "/user/hand/left", "/user/hand/left/input/pinch_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch", "/user/hand/right", "/user/hand/right/input/pinch_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch ready", "/user/hand/left", "/user/hand/left/input/pinch_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Pinch ready", "/user/hand/right", "/user/hand/right/input/pinch_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate", "/user/hand/left", "/user/hand/left/input/aim_activate_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate", "/user/hand/right", "/user/hand/right/input/aim_activate_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate ready", "/user/hand/left", "/user/hand/left/input/aim_activate_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate ready", "/user/hand/right", "/user/hand/right/input/aim_activate_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate", "/user/hand/left", "/user/hand/left/input/aim_activate_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate", "/user/hand/right", "/user/hand/right/input/aim_activate_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate ready", "/user/hand/left", "/user/hand/left/input/aim_activate_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Aim activate ready", "/user/hand/right", "/user/hand/right/input/aim_activate_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp", "/user/hand/left", "/user/hand/left/input/grasp_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp", "/user/hand/right", "/user/hand/right/input/grasp_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp ready", "/user/hand/left", "/user/hand/left/input/grasp_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp ready", "/user/hand/right", "/user/hand/right/input/grasp_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp", "/user/hand/left", "/user/hand/left/input/grasp_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp", "/user/hand/right", "/user/hand/right/input/grasp_ext/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp ready", "/user/hand/left", "/user/hand/left/input/grasp_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/ext/hand_interaction_ext", "Grasp ready", "/user/hand/right", "/user/hand/right/input/grasp_ext/ready_ext", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HAND_INTERACTION_EXTENSION_H
|
||||
#define OPENXR_HAND_INTERACTION_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
|
|
@ -51,6 +50,11 @@
|
|||
// for more information.
|
||||
|
||||
class OpenXRHandInteractionExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRHandInteractionExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRHandInteractionExtension *get_singleton();
|
||||
|
||||
|
|
@ -68,5 +72,3 @@ private:
|
|||
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_HAND_INTERACTION_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ void OpenXRHandTrackingExtension::on_process() {
|
|||
// SKELETON_RIG_HUMANOID bone adjustment. This rotation performs:
|
||||
// OpenXR Z+ -> Godot Humanoid Y- (Back along the bone)
|
||||
// OpenXR Y+ -> Godot Humanoid Z- (Out the back of the hand)
|
||||
const Quaternion bone_adjustment(0.0, -Math_SQRT12, Math_SQRT12, 0.0);
|
||||
const Quaternion bone_adjustment(0.0, -Math::SQRT12, Math::SQRT12, 0.0);
|
||||
|
||||
for (int joint = 0; joint < XR_HAND_JOINT_COUNT_EXT; joint++) {
|
||||
const XrHandJointLocationEXT &location = hand_trackers[i].joint_locations[joint];
|
||||
|
|
@ -263,7 +263,7 @@ void OpenXRHandTrackingExtension::on_process() {
|
|||
Transform3D transform;
|
||||
Vector3 linear_velocity;
|
||||
Vector3 angular_velocity;
|
||||
BitField<XRHandTracker::HandJointFlags> flags;
|
||||
BitField<XRHandTracker::HandJointFlags> flags = {};
|
||||
|
||||
if (location.locationFlags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT) {
|
||||
if (pose.orientation.x != 0 || pose.orientation.y != 0 || pose.orientation.z != 0 || pose.orientation.w != 0) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HAND_TRACKING_EXTENSION_H
|
||||
#define OPENXR_HAND_TRACKING_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../util.h"
|
||||
#include "core/math/quaternion.h"
|
||||
|
|
@ -37,6 +36,11 @@
|
|||
#include "servers/xr/xr_hand_tracker.h"
|
||||
|
||||
class OpenXRHandTrackingExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRHandTrackingExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
enum HandTrackedHands {
|
||||
OPENXR_TRACKED_LEFT_HAND,
|
||||
|
|
@ -122,5 +126,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC1(xrDestroyHandTrackerEXT, (XrHandTrackerEXT), p_handTracker)
|
||||
EXT_PROTO_XRRESULT_FUNC3(xrLocateHandJointsEXT, (XrHandTrackerEXT), p_handTracker, (const XrHandJointsLocateInfoEXT *), p_locateInfo, (XrHandJointLocationsEXT *), p_locations)
|
||||
};
|
||||
|
||||
#endif // OPENXR_HAND_TRACKING_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -55,94 +55,94 @@ bool OpenXRHTCControllerExtension::is_available(HTCControllers p_type) {
|
|||
}
|
||||
|
||||
void OpenXRHTCControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
metadata->register_top_level_path("HTC left hand tracker", "/user/hand_htc/left", XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("HTC right hand tracker", "/user/hand_htc/right", XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("HTC left hand tracker", "/user/hand_htc/left", XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("HTC right hand tracker", "/user/hand_htc/right", XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
|
||||
{ // HTC Vive Cosmos controller
|
||||
const String profile_path = "/interaction_profiles/htc/vive_cosmos_controller";
|
||||
metadata->register_interaction_profile("Vive Cosmos controller", profile_path, XR_HTC_VIVE_COSMOS_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Vive Cosmos controller", profile_path, XR_HTC_VIVE_COSMOS_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Shoulder click", user_path, user_path + "/input/shoulder/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Shoulder click", user_path, user_path + "/input/shoulder/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
||||
{ // HTC Vive Focus 3 controller
|
||||
const String profile_path = "/interaction_profiles/htc/vive_focus3_controller";
|
||||
metadata->register_interaction_profile("Vive Focus 3 controller", profile_path, XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Vive Focus 3 controller", profile_path, XR_HTC_VIVE_FOCUS3_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Squeeze touch", user_path, user_path + "/input/squeeze/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze touch", user_path, user_path + "/input/squeeze/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
||||
{ // HTC Hand interaction profile
|
||||
const String profile_path = "/interaction_profiles/htc/hand_interaction";
|
||||
metadata->register_interaction_profile("HTC Hand interaction", profile_path, XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("HTC Hand interaction", profile_path, XR_HTC_HAND_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand_htc/left", "/user/hand_htc/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Select (pinch)", user_path, user_path + "/input/select/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Select (pinch)", user_path, user_path + "/input/select/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze (grab)", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze (grab)", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HTC_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_HTC_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRHTCControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRHTCControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
enum HTCControllers {
|
||||
// Note, HTC Vive Wand controllers are part of the core spec and not part of our extension.
|
||||
|
|
@ -54,5 +58,3 @@ public:
|
|||
private:
|
||||
bool available[HTC_MAX_CONTROLLERS] = { false, false };
|
||||
};
|
||||
|
||||
#endif // OPENXR_HTC_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -66,28 +66,28 @@ bool OpenXRHTCViveTrackerExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRHTCViveTrackerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// register_top_level_path("Handheld object tracker", "/user/vive_tracker_htcx/role/handheld_object", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Left foot tracker", "/user/vive_tracker_htcx/role/left_foot", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Right foot tracker", "/user/vive_tracker_htcx/role/right_foot", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Left shoulder tracker", "/user/vive_tracker_htcx/role/left_shoulder", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Right shoulder tracker", "/user/vive_tracker_htcx/role/right_shoulder", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Left elbow tracker", "/user/vive_tracker_htcx/role/left_elbow", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Right elbow tracker", "/user/vive_tracker_htcx/role/right_elbow", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Left knee tracker", "/user/vive_tracker_htcx/role/left_knee", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Right knee tracker", "/user/vive_tracker_htcx/role/right_knee", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Waist tracker", "/user/vive_tracker_htcx/role/waist", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Chest tracker", "/user/vive_tracker_htcx/role/chest", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Camera tracker", "/user/vive_tracker_htcx/role/camera", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
metadata->register_top_level_path("Keyboard tracker", "/user/vive_tracker_htcx/role/keyboard", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Left foot tracker", "/user/vive_tracker_htcx/role/left_foot", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Right foot tracker", "/user/vive_tracker_htcx/role/right_foot", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Left shoulder tracker", "/user/vive_tracker_htcx/role/left_shoulder", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Right shoulder tracker", "/user/vive_tracker_htcx/role/right_shoulder", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Left elbow tracker", "/user/vive_tracker_htcx/role/left_elbow", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Right elbow tracker", "/user/vive_tracker_htcx/role/right_elbow", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Left knee tracker", "/user/vive_tracker_htcx/role/left_knee", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Right knee tracker", "/user/vive_tracker_htcx/role/right_knee", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Waist tracker", "/user/vive_tracker_htcx/role/waist", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Chest tracker", "/user/vive_tracker_htcx/role/chest", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Camera tracker", "/user/vive_tracker_htcx/role/camera", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_top_level_path("Keyboard tracker", "/user/vive_tracker_htcx/role/keyboard", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
|
||||
{ // HTC Vive tracker
|
||||
// Interestingly enough trackers don't have buttons or inputs, yet these are defined in the spec.
|
||||
// I think this can be supported through attachments on the trackers.
|
||||
const String profile_path = "/interaction_profiles/htc/vive_tracker_htcx";
|
||||
metadata->register_interaction_profile("HTC Vive tracker", profile_path, XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("HTC Vive tracker", profile_path, XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : {
|
||||
/* "/user/vive_tracker_htcx/role/handheld_object", */
|
||||
"/user/vive_tracker_htcx/role/left_foot",
|
||||
|
|
@ -103,23 +103,23 @@ void OpenXRHTCViveTrackerExtension::on_register_metadata() {
|
|||
"/user/vive_tracker_htcx/role/camera",
|
||||
"/user/vive_tracker_htcx/role/keyboard",
|
||||
}) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HTC_VIVE_TRACKER_EXTENSION_H
|
||||
#define OPENXR_HTC_VIVE_TRACKER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRHTCViveTrackerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRHTCViveTrackerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
|
|
@ -47,5 +51,3 @@ public:
|
|||
private:
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_HTC_VIVE_TRACKER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -45,36 +45,36 @@ bool OpenXRHuaweiControllerExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRHuaweiControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
{ // Huawei controller
|
||||
const String profile_path = "/interaction_profiles/huawei/controller";
|
||||
metadata->register_interaction_profile("Huawei controller", profile_path, XR_HUAWEI_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Huawei controller", profile_path, XR_HUAWEI_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Home click", user_path, user_path + "/input/home/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Back click", user_path, user_path + "/input/back/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Home click", user_path, user_path + "/input/home/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Back click", user_path, user_path + "/input/back/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Volume up click", user_path, user_path + "/input/volume_up/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Volume down click", user_path, user_path + "/input/volume_down/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Volume up click", user_path, user_path + "/input/volume_up/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Volume down click", user_path, user_path + "/input/volume_down/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_HUAWEI_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_HUAWEI_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRHuaweiControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRHuaweiControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
|
|
@ -44,5 +48,3 @@ public:
|
|||
private:
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_HUAWEI_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_LOCAL_FLOOR_EXTENSION_H
|
||||
#define OPENXR_LOCAL_FLOOR_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRLocalFloorExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRLocalFloorExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRLocalFloorExtension *get_singleton();
|
||||
|
||||
|
|
@ -49,5 +53,3 @@ private:
|
|||
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_LOCAL_FLOOR_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -47,115 +47,115 @@ bool OpenXRMetaControllerExtension::is_available(MetaControllers p_type) {
|
|||
}
|
||||
|
||||
void OpenXRMetaControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Note, we register controllers regardless if they are supported on the current hardware.
|
||||
|
||||
{ // Normal touch controller is part of the core spec, but we do have some extensions.
|
||||
const String profile_path = "/interaction_profiles/oculus/touch_controller";
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_fb ", "XR_FB_touch_controller_proximity", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_fb/proximity_fb ", "XR_FB_touch_controller_proximity", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_fb ", "XR_FB_touch_controller_proximity", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_fb/proximity_fb ", "XR_FB_touch_controller_proximity", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
}
|
||||
|
||||
{ // Touch controller pro (Quest Pro)
|
||||
const String profile_path = "/interaction_profiles/facebook/touch_controller_pro";
|
||||
metadata->register_interaction_profile("Touch controller pro", profile_path, "XR_FB_touch_controller_pro");
|
||||
openxr_metadata->register_interaction_profile("Touch controller pro", profile_path, "XR_FB_touch_controller_pro");
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_fb", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger curl", user_path, user_path + "/input/trigger/curl_fb", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger slide", user_path, user_path + "/input/trigger/slide_fb", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger force", user_path, user_path + "/input/trigger/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_fb", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger curl", user_path, user_path + "/input/trigger/curl_fb", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger slide", user_path, user_path + "/input/trigger/slide_fb", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger force", user_path, user_path + "/input/trigger/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_fb/proximity_fb", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_fb/proximity_fb", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick X", user_path, user_path + "/input/thumbstick/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Y", user_path, user_path + "/input/thumbstick/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick X", user_path, user_path + "/input/thumbstick/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Y", user_path, user_path + "/input/thumbstick/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbrest force", user_path, user_path + "/input/thumbrest/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbrest force", user_path, user_path + "/input/thumbrest/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Stylus force", user_path, user_path + "/input/stylus_fb/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Stylus force", user_path, user_path + "/input/stylus_fb/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
metadata->register_io_path(profile_path, "Haptic trigger output", user_path, user_path + "/output/haptic_trigger_fb", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
metadata->register_io_path(profile_path, "Haptic thumb output", user_path, user_path + "/output/haptic_thumb_fb", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic trigger output", user_path, user_path + "/output/haptic_trigger_fb", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic thumb output", user_path, user_path + "/output/haptic_thumb_fb", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
||||
{ // Touch controller plus (Quest 3)
|
||||
const String profile_path = "/interaction_profiles/meta/touch_controller_plus";
|
||||
metadata->register_interaction_profile("Touch controller plus", profile_path, "XR_META_touch_controller_plus");
|
||||
openxr_metadata->register_interaction_profile("Touch controller plus", profile_path, "XR_META_touch_controller_plus");
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_meta", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger curl", user_path, user_path + "/input/trigger/curl_meta", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger slide", user_path, user_path + "/input/trigger/slide_meta", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger force", user_path, user_path + "/input/trigger/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger proximity", user_path, user_path + "/input/trigger/proximity_meta", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger curl", user_path, user_path + "/input/trigger/curl_meta", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger slide", user_path, user_path + "/input/trigger/slide_meta", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger force", user_path, user_path + "/input/trigger/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_meta/proximity_meta", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumb proximity", user_path, user_path + "/input/thumb_meta/proximity_meta", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick X", user_path, user_path + "/input/thumbstick/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Y", user_path, user_path + "/input/thumbstick/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick X", user_path, user_path + "/input/thumbstick/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Y", user_path, user_path + "/input/thumbstick/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbrest touch", user_path, user_path + "/input/thumbrest/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_META_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_META_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRMetaControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRMetaControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
enum MetaControllers {
|
||||
META_TOUCH_PROXIMITY, // Proximity extensions for normal touch controllers
|
||||
|
|
@ -51,5 +55,3 @@ public:
|
|||
private:
|
||||
bool available[META_MAX_CONTROLLERS] = { false, false, false };
|
||||
};
|
||||
|
||||
#endif // OPENXR_META_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -45,33 +45,33 @@ bool OpenXRML2ControllerExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRML2ControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Magic Leap 2 Controller
|
||||
const String profile_path = "/interaction_profiles/ml/ml2_controller";
|
||||
metadata->register_interaction_profile("Magic Leap 2 controller", profile_path, XR_ML_ML2_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Magic Leap 2 controller", profile_path, XR_ML_ML2_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Shoulder click", user_path, user_path + "/input/shoulder/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Shoulder click", user_path, user_path + "/input/shoulder/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad force", user_path, user_path + "/input/trackpad/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trackpad X", user_path, user_path + "/input/trackpad/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trackpad Y", user_path, user_path + "/input/trackpad/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad force", user_path, user_path + "/input/trackpad/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad X", user_path, user_path + "/input/trackpad/x", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Y", user_path, user_path + "/input/trackpad/y", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ML2_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_ML2_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRML2ControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRML2ControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
|
|
@ -44,5 +48,3 @@ public:
|
|||
private:
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_ML2_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -48,36 +48,36 @@ bool OpenXRMxInkExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRMxInkExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Logitech MX Ink Stylus
|
||||
metadata->register_interaction_profile("Logitech MX Ink Stylus", "/interaction_profiles/logitech/mx_ink_stylus_logitech", XR_LOGITECH_MX_INK_STYLUS_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Logitech MX Ink Stylus", "/interaction_profiles/logitech/mx_ink_stylus_logitech", XR_LOGITECH_MX_INK_STYLUS_INTERACTION_EXTENSION_NAME);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip Force", "/user/hand/left", "/user/hand/left/input/tip_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Middle force", "/user/hand/left", "/user/hand/left/input/cluster_middle_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front click", "/user/hand/left", "/user/hand/left/input/cluster_front_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front double", "/user/hand/left", "/user/hand/left/input/cluster_front_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back click", "/user/hand/left", "/user/hand/left/input/cluster_back_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back double", "/user/hand/left", "/user/hand/left/input/cluster_back_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "System click", "/user/hand/left", "/user/hand/left/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Docked", "/user/hand/left", "/user/hand/left/input/dock_logitech/docked_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Grip pose", "/user/hand/left", "/user/hand/left/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Aim pose", "/user/hand/left", "/user/hand/left/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip pose", "/user/hand/left", "/user/hand/left/input/tip_logitech/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip Force", "/user/hand/left", "/user/hand/left/input/tip_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Middle force", "/user/hand/left", "/user/hand/left/input/cluster_middle_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front click", "/user/hand/left", "/user/hand/left/input/cluster_front_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front double", "/user/hand/left", "/user/hand/left/input/cluster_front_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back click", "/user/hand/left", "/user/hand/left/input/cluster_back_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back double", "/user/hand/left", "/user/hand/left/input/cluster_back_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "System click", "/user/hand/left", "/user/hand/left/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Docked", "/user/hand/left", "/user/hand/left/input/dock_logitech/docked_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Grip pose", "/user/hand/left", "/user/hand/left/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Aim pose", "/user/hand/left", "/user/hand/left/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip pose", "/user/hand/left", "/user/hand/left/input/tip_logitech/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip Force", "/user/hand/right", "/user/hand/right/input/tip_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Middle force", "/user/hand/right", "/user/hand/right/input/cluster_middle_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front click", "/user/hand/right", "/user/hand/right/input/cluster_front_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front double", "/user/hand/right", "/user/hand/right/input/cluster_front_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back click", "/user/hand/right", "/user/hand/right/input/cluster_back_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back double", "/user/hand/right", "/user/hand/right/input/cluster_back_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Docked", "/user/hand/right", "/user/hand/right/input/dock_logitech/docked_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Grip pose", "/user/hand/right", "/user/hand/right/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Aim pose", "/user/hand/right", "/user/hand/right/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip pose", "/user/hand/right", "/user/hand/right/input/tip_logitech/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip Force", "/user/hand/right", "/user/hand/right/input/tip_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Middle force", "/user/hand/right", "/user/hand/right/input/cluster_middle_logitech/force", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front click", "/user/hand/right", "/user/hand/right/input/cluster_front_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Front double", "/user/hand/right", "/user/hand/right/input/cluster_front_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back click", "/user/hand/right", "/user/hand/right/input/cluster_back_logitech/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Back double", "/user/hand/right", "/user/hand/right/input/cluster_back_logitech/double_tap_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "System click", "/user/hand/right", "/user/hand/right/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Docked", "/user/hand/right", "/user/hand/right/input/dock_logitech/docked_logitech", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Grip pose", "/user/hand/right", "/user/hand/right/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Aim pose", "/user/hand/right", "/user/hand/right/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Tip pose", "/user/hand/right", "/user/hand/right/input/tip_logitech/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Haptic output", "/user/hand/left", "/user/hand/left/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Haptic output", "/user/hand/right", "/user/hand/right/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Haptic output", "/user/hand/left", "/user/hand/left/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path("/interaction_profiles/logitech/mx_ink_stylus_logitech", "Haptic output", "/user/hand/right", "/user/hand/right/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_MXINK_EXTENSION_H
|
||||
#define OPENXR_MXINK_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRMxInkExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRMxInkExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
|
|
@ -44,5 +48,3 @@ public:
|
|||
private:
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_MXINK_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_PALM_POSE_EXTENSION_H
|
||||
#define OPENXR_PALM_POSE_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRPalmPoseExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRPalmPoseExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRPalmPoseExtension *get_singleton();
|
||||
|
||||
|
|
@ -49,5 +53,3 @@ private:
|
|||
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_PALM_POSE_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,156 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_performance_settings_extension.cpp */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "openxr_performance_settings_extension.h"
|
||||
|
||||
#include "../openxr_api.h"
|
||||
|
||||
OpenXRPerformanceSettingsExtension *OpenXRPerformanceSettingsExtension::singleton = nullptr;
|
||||
|
||||
OpenXRPerformanceSettingsExtension *OpenXRPerformanceSettingsExtension::get_singleton() {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
OpenXRPerformanceSettingsExtension::OpenXRPerformanceSettingsExtension() {
|
||||
singleton = this;
|
||||
}
|
||||
|
||||
OpenXRPerformanceSettingsExtension::~OpenXRPerformanceSettingsExtension() {
|
||||
singleton = nullptr;
|
||||
}
|
||||
|
||||
HashMap<String, bool *> OpenXRPerformanceSettingsExtension::get_requested_extensions() {
|
||||
HashMap<String, bool *> request_extensions;
|
||||
|
||||
request_extensions[XR_EXT_PERFORMANCE_SETTINGS_EXTENSION_NAME] = &available;
|
||||
|
||||
return request_extensions;
|
||||
}
|
||||
|
||||
void OpenXRPerformanceSettingsExtension::on_instance_created(const XrInstance p_instance) {
|
||||
if (available) {
|
||||
EXT_INIT_XR_FUNC(xrPerfSettingsSetPerformanceLevelEXT);
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenXRPerformanceSettingsExtension::on_event_polled(const XrEventDataBuffer &event) {
|
||||
switch (event.type) {
|
||||
case XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT: {
|
||||
const XrEventDataPerfSettingsEXT *perf_settings_event = (XrEventDataPerfSettingsEXT *)&event;
|
||||
|
||||
OpenXRInterface::PerfSettingsSubDomain sub_domain = openxr_to_sub_domain(perf_settings_event->subDomain);
|
||||
OpenXRInterface::PerfSettingsNotificationLevel from_level = openxr_to_notification_level(perf_settings_event->fromLevel);
|
||||
OpenXRInterface::PerfSettingsNotificationLevel to_level = openxr_to_notification_level(perf_settings_event->toLevel);
|
||||
|
||||
OpenXRInterface *openxr_interface = OpenXRAPI::get_singleton()->get_xr_interface();
|
||||
|
||||
if (perf_settings_event->domain == XR_PERF_SETTINGS_DOMAIN_CPU_EXT) {
|
||||
openxr_interface->on_cpu_level_changed(sub_domain, from_level, to_level);
|
||||
} else if (perf_settings_event->domain == XR_PERF_SETTINGS_DOMAIN_GPU_EXT) {
|
||||
openxr_interface->on_gpu_level_changed(sub_domain, from_level, to_level);
|
||||
} else {
|
||||
print_error(vformat("OpenXR: no matching performance settings domain for %s", perf_settings_event->domain));
|
||||
}
|
||||
return true;
|
||||
} break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenXRPerformanceSettingsExtension::is_available() {
|
||||
return available;
|
||||
}
|
||||
|
||||
void OpenXRPerformanceSettingsExtension::set_cpu_level(OpenXRInterface::PerfSettingsLevel p_level) {
|
||||
XrSession session = OpenXRAPI::get_singleton()->get_session();
|
||||
XrPerfSettingsLevelEXT xr_level = level_to_openxr(p_level);
|
||||
|
||||
XrResult result = xrPerfSettingsSetPerformanceLevelEXT(session, XR_PERF_SETTINGS_DOMAIN_CPU_EXT, xr_level);
|
||||
if (XR_FAILED(result)) {
|
||||
print_error(vformat("OpenXR: failed to set CPU performance level [%s]", OpenXRAPI::get_singleton()->get_error_string(result)));
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRPerformanceSettingsExtension::set_gpu_level(OpenXRInterface::PerfSettingsLevel p_level) {
|
||||
XrSession session = OpenXRAPI::get_singleton()->get_session();
|
||||
XrPerfSettingsLevelEXT xr_level = level_to_openxr(p_level);
|
||||
|
||||
XrResult result = xrPerfSettingsSetPerformanceLevelEXT(session, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, xr_level);
|
||||
if (XR_FAILED(result)) {
|
||||
print_error(vformat("OpenXR: failed to set GPU performance level [%s]", OpenXRAPI::get_singleton()->get_error_string(result)));
|
||||
}
|
||||
}
|
||||
|
||||
XrPerfSettingsLevelEXT OpenXRPerformanceSettingsExtension::level_to_openxr(OpenXRInterface::PerfSettingsLevel p_level) {
|
||||
switch (p_level) {
|
||||
case OpenXRInterface::PerfSettingsLevel::PERF_SETTINGS_LEVEL_POWER_SAVINGS:
|
||||
return XR_PERF_SETTINGS_LEVEL_POWER_SAVINGS_EXT;
|
||||
break;
|
||||
case OpenXRInterface::PerfSettingsLevel::PERF_SETTINGS_LEVEL_SUSTAINED_LOW:
|
||||
return XR_PERF_SETTINGS_LEVEL_SUSTAINED_LOW_EXT;
|
||||
break;
|
||||
case OpenXRInterface::PerfSettingsLevel::PERF_SETTINGS_LEVEL_SUSTAINED_HIGH:
|
||||
return XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT;
|
||||
case OpenXRInterface::PerfSettingsLevel::PERF_SETTINGS_LEVEL_BOOST:
|
||||
return XR_PERF_SETTINGS_LEVEL_BOOST_EXT;
|
||||
default:
|
||||
print_error("Invalid performance settings level.");
|
||||
return XR_PERF_SETTINGS_LEVEL_SUSTAINED_HIGH_EXT;
|
||||
}
|
||||
}
|
||||
|
||||
OpenXRInterface::PerfSettingsSubDomain OpenXRPerformanceSettingsExtension::openxr_to_sub_domain(XrPerfSettingsSubDomainEXT p_sub_domain) {
|
||||
switch (p_sub_domain) {
|
||||
case XR_PERF_SETTINGS_SUB_DOMAIN_COMPOSITING_EXT:
|
||||
return OpenXRInterface::PerfSettingsSubDomain::PERF_SETTINGS_SUB_DOMAIN_COMPOSITING;
|
||||
case XR_PERF_SETTINGS_SUB_DOMAIN_RENDERING_EXT:
|
||||
return OpenXRInterface::PerfSettingsSubDomain::PERF_SETTINGS_SUB_DOMAIN_RENDERING;
|
||||
case XR_PERF_SETTINGS_SUB_DOMAIN_THERMAL_EXT:
|
||||
return OpenXRInterface::PerfSettingsSubDomain::PERF_SETTINGS_SUB_DOMAIN_THERMAL;
|
||||
default:
|
||||
print_error("Invalid performance settings sub domain.");
|
||||
return OpenXRInterface::PerfSettingsSubDomain::PERF_SETTINGS_SUB_DOMAIN_COMPOSITING;
|
||||
}
|
||||
}
|
||||
|
||||
OpenXRInterface::PerfSettingsNotificationLevel OpenXRPerformanceSettingsExtension::openxr_to_notification_level(XrPerfSettingsNotificationLevelEXT p_notification_level) {
|
||||
switch (p_notification_level) {
|
||||
case XR_PERF_SETTINGS_NOTIF_LEVEL_NORMAL_EXT:
|
||||
return OpenXRInterface::PerfSettingsNotificationLevel::PERF_SETTINGS_NOTIF_LEVEL_NORMAL;
|
||||
case XR_PERF_SETTINGS_NOTIF_LEVEL_WARNING_EXT:
|
||||
return OpenXRInterface::PerfSettingsNotificationLevel::PERF_SETTINGS_NOTIF_LEVEL_WARNING;
|
||||
case XR_PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED_EXT:
|
||||
return OpenXRInterface::PerfSettingsNotificationLevel::PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED;
|
||||
default:
|
||||
print_error("Invalid performance settings notification level.");
|
||||
return OpenXRInterface::PerfSettingsNotificationLevel::PERF_SETTINGS_NOTIF_LEVEL_NORMAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_composition_layer_provider.h */
|
||||
/* openxr_performance_settings_extension.h */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
|
|
@ -28,21 +28,37 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_COMPOSITION_LAYER_PROVIDER_H
|
||||
#define OPENXR_COMPOSITION_LAYER_PROVIDER_H
|
||||
#pragma once
|
||||
|
||||
#include "../openxr_interface.h"
|
||||
#include "../util.h"
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
// Interface for OpenXR extensions that provide a composition layer.
|
||||
class OpenXRCompositionLayerProvider {
|
||||
class OpenXRPerformanceSettingsExtension : public OpenXRExtensionWrapper {
|
||||
public:
|
||||
virtual int get_composition_layer_count() = 0;
|
||||
virtual XrCompositionLayerBaseHeader *get_composition_layer(int p_index) = 0;
|
||||
virtual int get_composition_layer_order(int p_index) = 0;
|
||||
static OpenXRPerformanceSettingsExtension *get_singleton();
|
||||
|
||||
virtual ~OpenXRCompositionLayerProvider() {}
|
||||
OpenXRPerformanceSettingsExtension();
|
||||
virtual ~OpenXRPerformanceSettingsExtension() override;
|
||||
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
virtual void on_instance_created(const XrInstance p_instance) override;
|
||||
virtual bool on_event_polled(const XrEventDataBuffer &event) override;
|
||||
|
||||
bool is_available();
|
||||
|
||||
void set_cpu_level(OpenXRInterface::PerfSettingsLevel p_level);
|
||||
void set_gpu_level(OpenXRInterface::PerfSettingsLevel p_level);
|
||||
|
||||
private:
|
||||
static OpenXRPerformanceSettingsExtension *singleton;
|
||||
|
||||
bool available = false;
|
||||
|
||||
XrPerfSettingsLevelEXT level_to_openxr(OpenXRInterface::PerfSettingsLevel p_level);
|
||||
OpenXRInterface::PerfSettingsSubDomain openxr_to_sub_domain(XrPerfSettingsSubDomainEXT p_sub_domain);
|
||||
OpenXRInterface::PerfSettingsNotificationLevel openxr_to_notification_level(XrPerfSettingsNotificationLevelEXT p_notification_level);
|
||||
|
||||
EXT_PROTO_XRRESULT_FUNC3(xrPerfSettingsSetPerformanceLevelEXT, (XrSession), session, (XrPerfSettingsDomainEXT), domain, (XrPerfSettingsLevelEXT), level)
|
||||
};
|
||||
|
||||
#endif // OPENXR_COMPOSITION_LAYER_PROVIDER_H
|
||||
|
|
@ -49,85 +49,85 @@ bool OpenXRPicoControllerExtension::is_available() {
|
|||
}
|
||||
|
||||
void OpenXRPicoControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
// Make sure we switch to our new name.
|
||||
metadata->register_profile_rename("/interaction_profiles/pico/neo3_controller", "/interaction_profiles/bytedance/pico_neo3_controller");
|
||||
openxr_metadata->register_profile_rename("/interaction_profiles/pico/neo3_controller", "/interaction_profiles/bytedance/pico_neo3_controller");
|
||||
|
||||
{ // Pico neo 3 controller.
|
||||
const String profile_path = "/interaction_profiles/bytedance/pico_neo3_controller";
|
||||
metadata->register_interaction_profile("Pico Neo3 controller", profile_path, XR_BD_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Pico Neo3 controller", profile_path, XR_BD_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "System click", user_path, user_path + "/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", user_path, user_path + "/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
||||
{ // Pico 4 controller.
|
||||
const String profile_path = "/interaction_profiles/bytedance/pico4_controller";
|
||||
metadata->register_interaction_profile("Pico 4 controller", profile_path, XR_BD_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Pico 4 controller", profile_path, XR_BD_CONTROLLER_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "System click", user_path, user_path + "/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "System click", user_path, user_path + "/input/system/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger touch", user_path, user_path + "/input/trigger/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick touch", user_path, user_path + "/input/thumbstick/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", "/user/hand/left", "/user/hand/left/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
// Note, no menu on right controller!
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X touch", "/user/hand/left", "/user/hand/left/input/x/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y touch", "/user/hand/left", "/user/hand/left/input/y/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A touch", "/user/hand/right", "/user/hand/right/input/a/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B touch", "/user/hand/right", "/user/hand/right/input/b/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_PICO_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_PICO_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRPicoControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRPicoControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
virtual HashMap<String, bool *> get_requested_extensions() override;
|
||||
|
||||
|
|
@ -44,5 +48,3 @@ public:
|
|||
private:
|
||||
bool available = false;
|
||||
};
|
||||
|
||||
#endif // OPENXR_PICO_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_VALVE_ANALOG_THRESHOLD_EXTENSION_H
|
||||
#define OPENXR_VALVE_ANALOG_THRESHOLD_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../action_map/openxr_binding_modifier.h"
|
||||
#include "../action_map/openxr_haptic_feedback.h"
|
||||
|
|
@ -38,6 +37,11 @@
|
|||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRValveAnalogThresholdExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRValveAnalogThresholdExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRValveAnalogThresholdExtension *get_singleton();
|
||||
|
||||
|
|
@ -84,5 +88,3 @@ public:
|
|||
virtual String get_description() const override { return "Analog threshold modifier"; }
|
||||
virtual PackedByteArray get_ip_modification() override;
|
||||
};
|
||||
|
||||
#endif // OPENXR_VALVE_ANALOG_THRESHOLD_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_VISIBILITY_MASK_EXTENSION_H
|
||||
#define OPENXR_VISIBILITY_MASK_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../util.h"
|
||||
|
||||
|
|
@ -48,6 +47,11 @@
|
|||
// https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_KHR_visibility_mask
|
||||
|
||||
class OpenXRVisibilityMaskExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRVisibilityMaskExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
static OpenXRVisibilityMaskExtension *get_singleton();
|
||||
|
||||
|
|
@ -91,5 +95,3 @@ private:
|
|||
// OpenXR API call wrappers
|
||||
EXT_PROTO_XRRESULT_FUNC5(xrGetVisibilityMaskKHR, (XrSession), session, (XrViewConfigurationType), viewConfigurationType, (uint32_t), viewIndex, (XrVisibilityMaskTypeKHR), visibilityMaskType, (XrVisibilityMaskKHR *), visibilityMask);
|
||||
};
|
||||
|
||||
#endif // OPENXR_VISIBILITY_MASK_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -48,88 +48,88 @@ bool OpenXRWMRControllerExtension::is_available(WMRControllers p_type) {
|
|||
}
|
||||
|
||||
void OpenXRWMRControllerExtension::on_register_metadata() {
|
||||
OpenXRInteractionProfileMetadata *metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(metadata);
|
||||
OpenXRInteractionProfileMetadata *openxr_metadata = OpenXRInteractionProfileMetadata::get_singleton();
|
||||
ERR_FAIL_NULL(openxr_metadata);
|
||||
|
||||
{ // HP MR controller (newer G2 controllers)
|
||||
const String profile_path = "/interaction_profiles/hp/mixed_reality_controller";
|
||||
metadata->register_interaction_profile("HPMR controller", profile_path, XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("HPMR controller", profile_path, XR_EXT_HP_MIXED_REALITY_CONTROLLER_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
|
||||
metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "X click", "/user/hand/left", "/user/hand/left/input/x/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Y click", "/user/hand/left", "/user/hand/left/input/y/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "A click", "/user/hand/right", "/user/hand/right/input/a/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "B click", "/user/hand/right", "/user/hand/right/input/b/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
}
|
||||
|
||||
{ // Samsung Odyssey controller
|
||||
const String profile_path = "/interaction_profiles/samsung/odyssey_controller";
|
||||
metadata->register_interaction_profile("Samsung Odyssey controller", profile_path, XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("Samsung Odyssey controller", profile_path, XR_EXT_SAMSUNG_ODYSSEY_CONTROLLER_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Menu click", user_path, user_path + "/input/menu/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger", user_path, user_path + "/input/trigger/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Trigger click", user_path, user_path + "/input/trigger/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze click", user_path, user_path + "/input/squeeze/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick", user_path, user_path + "/input/thumbstick", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick click", user_path, user_path + "/input/thumbstick/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Up", user_path, user_path + "/input/thumbstick/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Down", user_path, user_path + "/input/thumbstick/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Left", user_path, user_path + "/input/thumbstick/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Thumbstick Dpad Right", user_path, user_path + "/input/thumbstick/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad", user_path, user_path + "/input/trackpad", "", OpenXRAction::OPENXR_ACTION_VECTOR2);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad click", user_path, user_path + "/input/trackpad/click", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad touch", user_path, user_path + "/input/trackpad/touch", "", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Up", user_path, user_path + "/input/trackpad/dpad_up", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Down", user_path, user_path + "/input/trackpad/dpad_down", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Left", user_path, user_path + "/input/trackpad/dpad_left", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Right", user_path, user_path + "/input/trackpad/dpad_right", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
openxr_metadata->register_io_path(profile_path, "Trackpad Dpad Center", user_path, user_path + "/input/trackpad/dpad_center", "XR_EXT_dpad_binding", OpenXRAction::OPENXR_ACTION_BOOL);
|
||||
|
||||
metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
openxr_metadata->register_io_path(profile_path, "Haptic output", user_path, user_path + "/output/haptic", "", OpenXRAction::OPENXR_ACTION_HAPTIC);
|
||||
}
|
||||
}
|
||||
|
||||
{ // MSFT Hand interaction profile, also supported by other headsets
|
||||
const String profile_path = "/interaction_profiles/microsoft/hand_interaction";
|
||||
metadata->register_interaction_profile("MSFT Hand interaction", profile_path, XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
openxr_metadata->register_interaction_profile("MSFT Hand interaction", profile_path, XR_MSFT_HAND_INTERACTION_EXTENSION_NAME);
|
||||
for (const String user_path : { "/user/hand/left", "/user/hand/right" }) {
|
||||
metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Pinch pose", user_path, user_path + "/input/pinch_ext/pose", XR_EXT_HAND_INTERACTION_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Poke pose", user_path, user_path + "/input/poke_ext/pose", XR_EXT_HAND_INTERACTION_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Grip pose", user_path, user_path + "/input/grip/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Aim pose", user_path, user_path + "/input/aim/pose", "", OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Pinch pose", user_path, user_path + "/input/pinch_ext/pose", XR_EXT_HAND_INTERACTION_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Poke pose", user_path, user_path + "/input/poke_ext/pose", XR_EXT_HAND_INTERACTION_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
openxr_metadata->register_io_path(profile_path, "Palm pose", user_path, user_path + "/input/palm_ext/pose", XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE);
|
||||
|
||||
metadata->register_io_path(profile_path, "Select (pinch)", user_path, user_path + "/input/select/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Select (pinch)", user_path, user_path + "/input/select/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
|
||||
metadata->register_io_path(profile_path, "Squeeze (grab)", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
openxr_metadata->register_io_path(profile_path, "Squeeze (grab)", user_path, user_path + "/input/squeeze/value", "", OpenXRAction::OPENXR_ACTION_FLOAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_WMR_CONTROLLER_EXTENSION_H
|
||||
#define OPENXR_WMR_CONTROLLER_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_extension_wrapper.h"
|
||||
|
||||
class OpenXRWMRControllerExtension : public OpenXRExtensionWrapper {
|
||||
GDCLASS(OpenXRWMRControllerExtension, OpenXRExtensionWrapper);
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {}
|
||||
|
||||
public:
|
||||
enum WMRControllers {
|
||||
WMR_HPMR,
|
||||
|
|
@ -51,5 +55,3 @@ public:
|
|||
private:
|
||||
bool available[WMR_MAX_CONTROLLERS] = { false, false };
|
||||
};
|
||||
|
||||
#endif // OPENXR_WMR_CONTROLLER_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_ANDROID_EXTENSION_H
|
||||
#define OPENXR_ANDROID_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../../util.h"
|
||||
#include "../openxr_extension_wrapper.h"
|
||||
|
|
@ -59,5 +58,3 @@ private:
|
|||
// Initialize the loader
|
||||
EXT_PROTO_XRRESULT_FUNC1(xrInitializeLoaderKHR, (const XrLoaderInitInfoBaseHeaderKHR *), loaderInitInfo)
|
||||
};
|
||||
|
||||
#endif // OPENXR_ANDROID_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_METAL_EXTENSION_H
|
||||
#define OPENXR_METAL_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../../openxr_api.h"
|
||||
#include "../../util.h"
|
||||
|
|
@ -68,5 +67,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC3(xrGetMetalGraphicsRequirementsKHR, (XrInstance), p_instance, (XrSystemId), p_system_id, (XrGraphicsRequirementsMetalKHR *), p_graphics_requirements)
|
||||
EXT_PROTO_XRRESULT_FUNC4(xrEnumerateSwapchainImages, (XrSwapchain), p_swapchain, (uint32_t), p_image_capacity_input, (uint32_t *), p_image_count_output, (XrSwapchainImageBaseHeader *), p_images)
|
||||
};
|
||||
|
||||
#endif // OPENXR_METAL_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#include "openxr_metal_extension.h"
|
||||
#import "openxr_metal_extension.h"
|
||||
|
||||
#include "../../openxr_util.h"
|
||||
#include "drivers/metal/rendering_device_driver_metal.h"
|
||||
|
||||
#import "drivers/metal/rendering_device_driver_metal.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
|
||||
HashMap<String, bool *> OpenXRMetalExtension::get_requested_extensions() {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,12 @@ XrGraphicsBindingEGLMNDX OpenXROpenGLExtension::graphics_binding_egl;
|
|||
#endif
|
||||
|
||||
void *OpenXROpenGLExtension::set_session_create_and_get_next_pointer(void *p_next_pointer) {
|
||||
XrVersion desired_version = XR_MAKE_VERSION(3, 3, 0);
|
||||
GLint gl_version_major = 0;
|
||||
GLint gl_version_minor = 0;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &gl_version_major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &gl_version_minor);
|
||||
|
||||
XrVersion desired_version = XR_MAKE_VERSION(gl_version_major, gl_version_minor, 0);
|
||||
|
||||
if (!check_graphics_api_support(desired_version)) {
|
||||
print_line("OpenXR: Trying to initialize with OpenGL anyway...");
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_OPENGL_EXTENSION_H
|
||||
#define OPENXR_OPENGL_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#ifdef GLES3_ENABLED
|
||||
|
||||
|
|
@ -93,5 +92,3 @@ private:
|
|||
};
|
||||
|
||||
#endif // GLES3_ENABLED
|
||||
|
||||
#endif // OPENXR_OPENGL_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_VULKAN_EXTENSION_H
|
||||
#define OPENXR_VULKAN_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "../../openxr_api.h"
|
||||
#include "../../util.h"
|
||||
|
|
@ -87,5 +86,3 @@ private:
|
|||
EXT_PROTO_XRRESULT_FUNC4(xrCreateVulkanDeviceKHR, (XrInstance), p_instance, (const XrVulkanDeviceCreateInfoKHR *), p_create_info, (VkDevice *), r_device, (VkResult *), r_result)
|
||||
EXT_PROTO_XRRESULT_FUNC4(xrEnumerateSwapchainImages, (XrSwapchain), p_swapchain, (uint32_t), p_image_capacity_input, (uint32_t *), p_image_count_output, (XrSwapchainImageBaseHeader *), p_images)
|
||||
};
|
||||
|
||||
#endif // OPENXR_VULKAN_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include "openxr_api.h"
|
||||
|
||||
#include "extensions/openxr_extension_wrapper_extension.h"
|
||||
#include "openxr_interface.h"
|
||||
#include "openxr_util.h"
|
||||
|
||||
|
|
@ -61,6 +60,10 @@
|
|||
#include "extensions/openxr_fb_update_swapchain_extension.h"
|
||||
#include "extensions/openxr_hand_tracking_extension.h"
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#include "extensions/openxr_extension_wrapper_extension.h"
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
#ifdef ANDROID_ENABLED
|
||||
#define OPENXR_LOADER_NAME "libopenxr_loader.so"
|
||||
#endif
|
||||
|
|
@ -296,8 +299,7 @@ String OpenXRAPI::get_error_string(XrResult result) const {
|
|||
}
|
||||
|
||||
if (instance == XR_NULL_HANDLE) {
|
||||
Array args;
|
||||
args.push_back(Variant(result));
|
||||
Array args = { Variant(result) };
|
||||
return String("Error code {0}").format(args);
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +580,7 @@ bool OpenXRAPI::create_instance() {
|
|||
|
||||
Vector<const char *> extension_ptrs;
|
||||
for (int i = 0; i < enabled_extensions.size(); i++) {
|
||||
print_verbose(String("OpenXR: Enabling extension ") + String(enabled_extensions[i]));
|
||||
print_verbose(String("OpenXR: Enabling extension ") + String(enabled_extensions[i].get_data()));
|
||||
extension_ptrs.push_back(enabled_extensions[i].get_data());
|
||||
}
|
||||
|
||||
|
|
@ -587,7 +589,7 @@ bool OpenXRAPI::create_instance() {
|
|||
"Godot Engine", // applicationName, if we're running a game we'll update this down below.
|
||||
1, // applicationVersion, we don't currently have this
|
||||
"Godot Engine", // engineName
|
||||
VERSION_MAJOR * 10000 + VERSION_MINOR * 100 + VERSION_PATCH, // engineVersion 4.0 -> 40000, 4.0.1 -> 40001, 4.1 -> 40100, etc.
|
||||
GODOT_VERSION_MAJOR * 10000 + GODOT_VERSION_MINOR * 100 + GODOT_VERSION_PATCH, // engineVersion 4.0 -> 40000, 4.0.1 -> 40001, 4.1 -> 40100, etc.
|
||||
XR_API_VERSION_1_0 // apiVersion
|
||||
};
|
||||
|
||||
|
|
@ -924,7 +926,11 @@ bool OpenXRAPI::setup_play_space() {
|
|||
XrSpace new_play_space = XR_NULL_HANDLE;
|
||||
bool will_emulate_local_floor = false;
|
||||
|
||||
if (is_reference_space_supported(requested_reference_space)) {
|
||||
if (custom_play_space != XR_NULL_HANDLE) {
|
||||
new_play_space = custom_play_space;
|
||||
// We use this to mark custom reference spaces.
|
||||
new_reference_space = XR_REFERENCE_SPACE_TYPE_MAX_ENUM;
|
||||
} else if (is_reference_space_supported(requested_reference_space)) {
|
||||
new_reference_space = requested_reference_space;
|
||||
} else if (requested_reference_space == XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR_EXT && is_reference_space_supported(XR_REFERENCE_SPACE_TYPE_STAGE)) {
|
||||
print_verbose("OpenXR: LOCAL_FLOOR space isn't supported, emulating using STAGE and LOCAL spaces.");
|
||||
|
|
@ -982,21 +988,34 @@ bool OpenXRAPI::setup_play_space() {
|
|||
new_reference_space = XR_REFERENCE_SPACE_TYPE_LOCAL;
|
||||
}
|
||||
|
||||
XrReferenceSpaceCreateInfo play_space_create_info = {
|
||||
XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
|
||||
nullptr, // next
|
||||
new_reference_space, // referenceSpaceType
|
||||
identityPose, // poseInReferenceSpace
|
||||
};
|
||||
if (new_play_space == XR_NULL_HANDLE) {
|
||||
void *next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) {
|
||||
void *np = wrapper->set_reference_space_create_info_and_get_next_pointer(
|
||||
new_reference_space, next_pointer);
|
||||
if (np != nullptr) {
|
||||
next_pointer = np;
|
||||
}
|
||||
}
|
||||
|
||||
XrResult result = xrCreateReferenceSpace(session, &play_space_create_info, &new_play_space);
|
||||
if (XR_FAILED(result)) {
|
||||
print_line("OpenXR: Failed to create play space [", get_error_string(result), "]");
|
||||
return false;
|
||||
XrReferenceSpaceCreateInfo play_space_create_info = {
|
||||
XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
|
||||
next_pointer, // next
|
||||
new_reference_space, // referenceSpaceType
|
||||
identityPose, // poseInReferenceSpace
|
||||
};
|
||||
|
||||
XrResult result = xrCreateReferenceSpace(session, &play_space_create_info, &new_play_space);
|
||||
if (XR_FAILED(result)) {
|
||||
print_line("OpenXR: Failed to create play space [", get_error_string(result), "]");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If we've previously created a play space, clean it up first.
|
||||
if (play_space != XR_NULL_HANDLE) {
|
||||
// But if it was a custom reference space, we don't touch it - it's the job of the extension that
|
||||
// created it to clean it up.
|
||||
if (play_space != XR_NULL_HANDLE && reference_space != XR_REFERENCE_SPACE_TYPE_MAX_ENUM) {
|
||||
// TODO Investigate if destroying our play space here is safe,
|
||||
// it may still be used in the rendering thread.
|
||||
|
||||
|
|
@ -1029,9 +1048,17 @@ bool OpenXRAPI::setup_view_space() {
|
|||
{ 0.0, 0.0, 0.0 }
|
||||
};
|
||||
|
||||
void *next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) {
|
||||
void *np = wrapper->set_reference_space_create_info_and_get_next_pointer(XR_REFERENCE_SPACE_TYPE_VIEW, next_pointer);
|
||||
if (np != nullptr) {
|
||||
next_pointer = np;
|
||||
}
|
||||
}
|
||||
|
||||
XrReferenceSpaceCreateInfo view_space_create_info = {
|
||||
XR_TYPE_REFERENCE_SPACE_CREATE_INFO, // type
|
||||
nullptr, // next
|
||||
next_pointer, // next
|
||||
XR_REFERENCE_SPACE_TYPE_VIEW, // referenceSpaceType
|
||||
identityPose // poseInReferenceSpace
|
||||
};
|
||||
|
|
@ -1081,6 +1108,17 @@ bool OpenXRAPI::reset_emulated_floor_height() {
|
|||
};
|
||||
|
||||
XrSpace new_play_space;
|
||||
|
||||
void *next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) {
|
||||
void *np = wrapper->set_reference_space_create_info_and_get_next_pointer(
|
||||
create_info.referenceSpaceType, next_pointer);
|
||||
if (np != nullptr) {
|
||||
next_pointer = np;
|
||||
}
|
||||
}
|
||||
create_info.next = next_pointer;
|
||||
|
||||
result = xrCreateReferenceSpace(session, &create_info, &new_play_space);
|
||||
if (XR_FAILED(result)) {
|
||||
print_line("OpenXR: Failed to recreate emulated LOCAL_FLOOR play space with latest floor estimate [", get_error_string(result), "]");
|
||||
|
|
@ -1478,12 +1516,21 @@ void OpenXRAPI::set_view_configuration(XrViewConfigurationType p_view_configurat
|
|||
}
|
||||
|
||||
bool OpenXRAPI::set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space) {
|
||||
if (custom_play_space != XR_NULL_HANDLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
requested_reference_space = p_requested_reference_space;
|
||||
play_space_is_dirty = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenXRAPI::set_custom_play_space(XrSpace p_custom_space) {
|
||||
custom_play_space = p_custom_space;
|
||||
play_space_is_dirty = true;
|
||||
}
|
||||
|
||||
void OpenXRAPI::set_submit_depth_buffer(bool p_submit_depth_buffer) {
|
||||
ERR_FAIL_COND(is_initialized());
|
||||
|
||||
|
|
@ -1740,11 +1787,14 @@ void OpenXRAPI::register_extension_metadata() {
|
|||
|
||||
void OpenXRAPI::cleanup_extension_wrappers() {
|
||||
for (OpenXRExtensionWrapper *extension_wrapper : registered_extension_wrappers) {
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
// Fix crash when the extension wrapper comes from GDExtension.
|
||||
OpenXRExtensionWrapperExtension *gdextension_extension_wrapper = dynamic_cast<OpenXRExtensionWrapperExtension *>(extension_wrapper);
|
||||
if (gdextension_extension_wrapper) {
|
||||
memdelete(gdextension_extension_wrapper);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
memdelete(extension_wrapper);
|
||||
}
|
||||
}
|
||||
|
|
@ -2111,7 +2161,15 @@ bool OpenXRAPI::process() {
|
|||
// As the name suggests, OpenXR can pause the thread to minimize the time between
|
||||
// retrieving tracking data and using that tracking data to render.
|
||||
// OpenXR thus works best if rendering is performed on a separate thread.
|
||||
XrFrameWaitInfo frame_wait_info = { XR_TYPE_FRAME_WAIT_INFO, nullptr };
|
||||
void *frame_wait_info_next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *extension : frame_info_extensions) {
|
||||
void *np = extension->set_frame_wait_info_and_get_next_pointer(frame_wait_info_next_pointer);
|
||||
if (np != nullptr) {
|
||||
frame_wait_info_next_pointer = np;
|
||||
}
|
||||
}
|
||||
|
||||
XrFrameWaitInfo frame_wait_info = { XR_TYPE_FRAME_WAIT_INFO, frame_wait_info_next_pointer };
|
||||
frame_state.predictedDisplayTime = 0;
|
||||
frame_state.predictedDisplayPeriod = 0;
|
||||
frame_state.shouldRender = false;
|
||||
|
|
@ -2189,6 +2247,14 @@ void OpenXRAPI::pre_render() {
|
|||
wrapper->on_pre_render();
|
||||
}
|
||||
|
||||
void *view_locate_info_next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *extension : frame_info_extensions) {
|
||||
void *np = extension->set_view_locate_info_and_get_next_pointer(view_locate_info_next_pointer);
|
||||
if (np != nullptr) {
|
||||
view_locate_info_next_pointer = np;
|
||||
}
|
||||
}
|
||||
|
||||
// Get our view info for the frame we're about to render, note from the OpenXR manual:
|
||||
// "Repeatedly calling xrLocateViews with the same time may not necessarily return the same result. Instead the prediction gets increasingly accurate as the function is called closer to the given time for which a prediction is made"
|
||||
|
||||
|
|
@ -2202,7 +2268,7 @@ void OpenXRAPI::pre_render() {
|
|||
|
||||
XrViewLocateInfo view_locate_info = {
|
||||
XR_TYPE_VIEW_LOCATE_INFO, // type
|
||||
nullptr, // next
|
||||
view_locate_info_next_pointer, // next
|
||||
view_configuration, // viewConfigurationType
|
||||
render_state.predicted_display_time, // displayTime
|
||||
render_state.play_space // space
|
||||
|
|
@ -2245,7 +2311,7 @@ void OpenXRAPI::pre_render() {
|
|||
};
|
||||
result = xrBeginFrame(session, &frame_begin_info);
|
||||
if (XR_FAILED(result)) {
|
||||
print_line("OpenXR: failed to being frame [", get_error_string(result), "]");
|
||||
print_line("OpenXR: failed to begin frame [", get_error_string(result), "]");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2425,11 +2491,11 @@ void OpenXRAPI::end_frame() {
|
|||
bool projection_layer_is_first = true;
|
||||
|
||||
// Add composition layers from providers
|
||||
for (OpenXRCompositionLayerProvider *provider : composition_layer_providers) {
|
||||
for (int i = 0; i < provider->get_composition_layer_count(); i++) {
|
||||
for (OpenXRExtensionWrapper *extension : composition_layer_providers) {
|
||||
for (int i = 0; i < extension->get_composition_layer_count(); i++) {
|
||||
OrderedCompositionLayer layer = {
|
||||
provider->get_composition_layer(i),
|
||||
provider->get_composition_layer_order(i),
|
||||
extension->get_composition_layer(i),
|
||||
extension->get_composition_layer_order(i),
|
||||
};
|
||||
if (layer.composition_layer) {
|
||||
ordered_layers_list.push_back(layer);
|
||||
|
|
@ -2476,9 +2542,17 @@ void OpenXRAPI::end_frame() {
|
|||
layers_list.push_back(ordered_layer.composition_layer);
|
||||
}
|
||||
|
||||
void *frame_end_info_next_pointer = nullptr;
|
||||
for (OpenXRExtensionWrapper *extension : frame_info_extensions) {
|
||||
void *np = extension->set_frame_end_info_and_get_next_pointer(frame_end_info_next_pointer);
|
||||
if (np != nullptr) {
|
||||
frame_end_info_next_pointer = np;
|
||||
}
|
||||
}
|
||||
|
||||
XrFrameEndInfo frame_end_info = {
|
||||
XR_TYPE_FRAME_END_INFO, // type
|
||||
nullptr, // next
|
||||
frame_end_info_next_pointer, // next
|
||||
render_state.predicted_display_time, // displayTime
|
||||
environment_blend_mode, // environmentBlendMode
|
||||
static_cast<uint32_t>(layers_list.size()), // layerCount
|
||||
|
|
@ -2683,12 +2757,8 @@ OpenXRAPI::OpenXRAPI() {
|
|||
}
|
||||
|
||||
OpenXRAPI::~OpenXRAPI() {
|
||||
// cleanup our composition layer providers
|
||||
for (OpenXRCompositionLayerProvider *provider : composition_layer_providers) {
|
||||
memdelete(provider);
|
||||
}
|
||||
composition_layer_providers.clear();
|
||||
|
||||
frame_info_extensions.clear();
|
||||
supported_extensions.clear();
|
||||
layer_properties.clear();
|
||||
|
||||
|
|
@ -2712,8 +2782,6 @@ Transform3D OpenXRAPI::transform_from_pose(const XrPosef &p_pose) {
|
|||
|
||||
template <typename T>
|
||||
XRPose::TrackingConfidence _transform_from_location(const T &p_location, Transform3D &r_transform) {
|
||||
Basis basis;
|
||||
Vector3 origin;
|
||||
XRPose::TrackingConfidence confidence = XRPose::XR_TRACKING_CONFIDENCE_NONE;
|
||||
const XrPosef &pose = p_location.pose;
|
||||
|
||||
|
|
@ -3596,12 +3664,12 @@ bool OpenXRAPI::trigger_haptic_pulse(RID p_action, RID p_tracker, float p_freque
|
|||
return true;
|
||||
}
|
||||
|
||||
void OpenXRAPI::register_composition_layer_provider(OpenXRCompositionLayerProvider *provider) {
|
||||
composition_layer_providers.append(provider);
|
||||
void OpenXRAPI::register_composition_layer_provider(OpenXRExtensionWrapper *p_extension) {
|
||||
composition_layer_providers.append(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPI::unregister_composition_layer_provider(OpenXRCompositionLayerProvider *provider) {
|
||||
composition_layer_providers.erase(provider);
|
||||
void OpenXRAPI::unregister_composition_layer_provider(OpenXRExtensionWrapper *p_extension) {
|
||||
composition_layer_providers.erase(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPI::register_projection_views_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
|
|
@ -3612,6 +3680,14 @@ void OpenXRAPI::unregister_projection_views_extension(OpenXRExtensionWrapper *p_
|
|||
projection_views_extensions.erase(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPI::register_frame_info_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
frame_info_extensions.append(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPI::unregister_frame_info_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
frame_info_extensions.erase(p_extension);
|
||||
}
|
||||
|
||||
const Vector<XrEnvironmentBlendMode> OpenXRAPI::get_supported_environment_blend_modes() {
|
||||
return supported_environment_blend_modes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_API_H
|
||||
#define OPENXR_API_H
|
||||
#pragma once
|
||||
|
||||
#include "action_map/openxr_action.h"
|
||||
#include "extensions/openxr_composition_layer_provider.h"
|
||||
#include "extensions/openxr_extension_wrapper.h"
|
||||
#include "util.h"
|
||||
|
||||
|
|
@ -95,11 +93,14 @@ private:
|
|||
Vector<CharString> enabled_extensions;
|
||||
|
||||
// composition layer providers
|
||||
Vector<OpenXRCompositionLayerProvider *> composition_layer_providers;
|
||||
Vector<OpenXRExtensionWrapper *> composition_layer_providers;
|
||||
|
||||
// projection views extensions
|
||||
Vector<OpenXRExtensionWrapper *> projection_views_extensions;
|
||||
|
||||
// frame info extensions
|
||||
Vector<OpenXRExtensionWrapper *> frame_info_extensions;
|
||||
|
||||
// view configuration
|
||||
LocalVector<XrViewConfigurationType> supported_view_configuration_types;
|
||||
|
||||
|
|
@ -155,6 +156,7 @@ private:
|
|||
|
||||
bool play_space_is_dirty = true;
|
||||
XrSpace play_space = XR_NULL_HANDLE;
|
||||
XrSpace custom_play_space = XR_NULL_HANDLE;
|
||||
XrSpace view_space = XR_NULL_HANDLE;
|
||||
XRPose::TrackingConfidence head_pose_confidence = XRPose::XR_TRACKING_CONFIDENCE_NONE;
|
||||
|
||||
|
|
@ -420,6 +422,8 @@ public:
|
|||
OpenXRGraphicsExtensionWrapper *get_graphics_extension() const { return graphics_extension; }
|
||||
String get_runtime_name() const { return runtime_name; }
|
||||
String get_runtime_version() const { return runtime_version; }
|
||||
String get_system_name() const { return system_name; }
|
||||
uint32_t get_vendor_id() const { return vendor_id; }
|
||||
|
||||
// helper method to convert an XrPosef to a Transform3D
|
||||
Transform3D transform_from_pose(const XrPosef &p_pose);
|
||||
|
|
@ -465,6 +469,7 @@ public:
|
|||
bool set_requested_reference_space(XrReferenceSpaceType p_requested_reference_space);
|
||||
XrReferenceSpaceType get_requested_reference_space() const { return requested_reference_space; }
|
||||
XrReferenceSpaceType get_reference_space() const { return reference_space; }
|
||||
void set_custom_play_space(XrSpace p_custom_space);
|
||||
|
||||
void set_submit_depth_buffer(bool p_submit_depth_buffer);
|
||||
bool get_submit_depth_buffer() const { return submit_depth_buffer; }
|
||||
|
|
@ -576,12 +581,15 @@ public:
|
|||
XRPose::TrackingConfidence get_action_pose(RID p_action, RID p_tracker, Transform3D &r_transform, Vector3 &r_linear_velocity, Vector3 &r_angular_velocity);
|
||||
bool trigger_haptic_pulse(RID p_action, RID p_tracker, float p_frequency, float p_amplitude, XrDuration p_duration_ns);
|
||||
|
||||
void register_composition_layer_provider(OpenXRCompositionLayerProvider *provider);
|
||||
void unregister_composition_layer_provider(OpenXRCompositionLayerProvider *provider);
|
||||
void register_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
void register_projection_views_extension(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_projection_views_extension(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
void register_frame_info_extension(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_frame_info_extension(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
const Vector<XrEnvironmentBlendMode> get_supported_environment_blend_modes();
|
||||
bool is_environment_blend_mode_supported(XrEnvironmentBlendMode p_blend_mode) const;
|
||||
bool set_environment_blend_mode(XrEnvironmentBlendMode p_blend_mode);
|
||||
|
|
@ -599,5 +607,3 @@ public:
|
|||
OpenXRAPI();
|
||||
~OpenXRAPI();
|
||||
};
|
||||
|
||||
#endif // OPENXR_API_H
|
||||
|
|
|
|||
58
engine/modules/openxr/openxr_api_extension.compat.inc
Normal file
58
engine/modules/openxr/openxr_api_extension.compat.inc
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/**************************************************************************/
|
||||
/* openxr_api_extension.compat.inc */
|
||||
/**************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
/* https://godotengine.org */
|
||||
/**************************************************************************/
|
||||
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
||||
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
||||
/* */
|
||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
||||
/* a copy of this software and associated documentation files (the */
|
||||
/* "Software"), to deal in the Software without restriction, including */
|
||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
||||
/* the following conditions: */
|
||||
/* */
|
||||
/* The above copyright notice and this permission notice shall be */
|
||||
/* included in all copies or substantial portions of the Software. */
|
||||
/* */
|
||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
|
||||
#include "extensions/openxr_extension_wrapper_extension.h"
|
||||
|
||||
void OpenXRAPIExtension::_register_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
register_composition_layer_provider(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::_unregister_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
unregister_composition_layer_provider(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::_register_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
register_projection_views_extension(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::_unregister_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
unregister_projection_views_extension(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::_bind_compatibility_methods() {
|
||||
ClassDB::bind_compatibility_method(D_METHOD("register_composition_layer_provider", "extension"), &OpenXRAPIExtension::_register_composition_layer_provider_bind_compat_104087);
|
||||
ClassDB::bind_compatibility_method(D_METHOD("unregister_composition_layer_provider", "extension"), &OpenXRAPIExtension::_unregister_composition_layer_provider_bind_compat_104087);
|
||||
ClassDB::bind_compatibility_method(D_METHOD("register_projection_views_extension", "extension"), &OpenXRAPIExtension::_register_projection_views_extension_bind_compat_104087);
|
||||
ClassDB::bind_compatibility_method(D_METHOD("unregister_projection_views_extension", "extension"), &OpenXRAPIExtension::_unregister_projection_views_extension_bind_compat_104087);
|
||||
}
|
||||
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
#include "openxr_api_extension.h"
|
||||
|
||||
#include "extensions/openxr_extension_wrapper_extension.h"
|
||||
#include "extensions/openxr_extension_wrapper.h"
|
||||
#include "openxr_api_extension.compat.inc"
|
||||
|
||||
void OpenXRAPIExtension::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_instance"), &OpenXRAPIExtension::get_instance);
|
||||
|
|
@ -51,6 +52,7 @@ void OpenXRAPIExtension::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("is_initialized"), &OpenXRAPIExtension::is_initialized);
|
||||
ClassDB::bind_method(D_METHOD("is_running"), &OpenXRAPIExtension::is_running);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_custom_play_space", "space"), &OpenXRAPIExtension::set_custom_play_space);
|
||||
ClassDB::bind_method(D_METHOD("get_play_space"), &OpenXRAPIExtension::get_play_space);
|
||||
ClassDB::bind_method(D_METHOD("get_predicted_display_time"), &OpenXRAPIExtension::get_predicted_display_time);
|
||||
ClassDB::bind_method(D_METHOD("get_next_frame_time"), &OpenXRAPIExtension::get_next_frame_time);
|
||||
|
|
@ -67,6 +69,9 @@ void OpenXRAPIExtension::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("register_projection_views_extension", "extension"), &OpenXRAPIExtension::register_projection_views_extension);
|
||||
ClassDB::bind_method(D_METHOD("unregister_projection_views_extension", "extension"), &OpenXRAPIExtension::unregister_projection_views_extension);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("register_frame_info_extension", "extension"), &OpenXRAPIExtension::register_frame_info_extension);
|
||||
ClassDB::bind_method(D_METHOD("unregister_frame_info_extension", "extension"), &OpenXRAPIExtension::unregister_frame_info_extension);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_render_state_z_near"), &OpenXRAPIExtension::get_render_state_z_near);
|
||||
ClassDB::bind_method(D_METHOD("get_render_state_z_far"), &OpenXRAPIExtension::get_render_state_z_far);
|
||||
|
||||
|
|
@ -180,6 +185,11 @@ bool OpenXRAPIExtension::is_running() {
|
|||
return OpenXRAPI::get_singleton()->is_running();
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::set_custom_play_space(GDExtensionConstPtr<const void> p_custom_space) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->set_custom_play_space(*(XrSpace *)p_custom_space.data);
|
||||
}
|
||||
|
||||
uint64_t OpenXRAPIExtension::get_play_space() {
|
||||
ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0);
|
||||
return (uint64_t)OpenXRAPI::get_singleton()->get_play_space();
|
||||
|
|
@ -220,26 +230,36 @@ uint64_t OpenXRAPIExtension::get_hand_tracker(int p_hand_index) {
|
|||
return (uint64_t)OpenXRAPI::get_singleton()->get_hand_tracker(p_hand_index);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
void OpenXRAPIExtension::register_composition_layer_provider(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->register_composition_layer_provider(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::unregister_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
void OpenXRAPIExtension::unregister_composition_layer_provider(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->unregister_composition_layer_provider(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::register_projection_views_extension(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
void OpenXRAPIExtension::register_projection_views_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->register_projection_views_extension(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::unregister_projection_views_extension(OpenXRExtensionWrapperExtension *p_extension) {
|
||||
void OpenXRAPIExtension::unregister_projection_views_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->unregister_projection_views_extension(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::register_frame_info_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->register_frame_info_extension(p_extension);
|
||||
}
|
||||
|
||||
void OpenXRAPIExtension::unregister_frame_info_extension(OpenXRExtensionWrapper *p_extension) {
|
||||
ERR_FAIL_NULL(OpenXRAPI::get_singleton());
|
||||
OpenXRAPI::get_singleton()->unregister_frame_info_extension(p_extension);
|
||||
}
|
||||
|
||||
double OpenXRAPIExtension::get_render_state_z_near() {
|
||||
ERR_NOT_ON_RENDER_THREAD_V(0.0);
|
||||
ERR_FAIL_NULL_V(OpenXRAPI::get_singleton(), 0.0);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_API_EXTENSION_H
|
||||
#define OPENXR_API_EXTENSION_H
|
||||
#pragma once
|
||||
|
||||
#include "openxr_api.h"
|
||||
|
||||
|
|
@ -37,6 +36,7 @@
|
|||
#include "core/os/thread_safe.h"
|
||||
#include "core/variant/native_ptr.h"
|
||||
|
||||
class OpenXRExtensionWrapper;
|
||||
class OpenXRExtensionWrapperExtension;
|
||||
|
||||
class OpenXRAPIExtension : public RefCounted {
|
||||
|
|
@ -47,6 +47,14 @@ protected:
|
|||
|
||||
static void _bind_methods();
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
static void _bind_compatibility_methods();
|
||||
void _register_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void _unregister_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void _register_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void _unregister_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
|
||||
#endif
|
||||
|
||||
public:
|
||||
uint64_t get_instance();
|
||||
uint64_t get_system_id();
|
||||
|
|
@ -71,6 +79,7 @@ public:
|
|||
bool is_initialized();
|
||||
bool is_running();
|
||||
|
||||
void set_custom_play_space(GDExtensionConstPtr<const void> p_custom_space);
|
||||
uint64_t get_play_space();
|
||||
int64_t get_predicted_display_time();
|
||||
int64_t get_next_frame_time();
|
||||
|
|
@ -81,11 +90,14 @@ public:
|
|||
|
||||
uint64_t get_hand_tracker(int p_hand_index);
|
||||
|
||||
void register_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void unregister_composition_layer_provider(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void register_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
void register_projection_views_extension(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void unregister_projection_views_extension(OpenXRExtensionWrapperExtension *p_extension);
|
||||
void register_projection_views_extension(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_projection_views_extension(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
void register_frame_info_extension(OpenXRExtensionWrapper *p_extension);
|
||||
void unregister_frame_info_extension(OpenXRExtensionWrapper *p_extension);
|
||||
|
||||
double get_render_state_z_near();
|
||||
double get_render_state_z_far();
|
||||
|
|
@ -120,5 +132,3 @@ public:
|
|||
};
|
||||
|
||||
VARIANT_ENUM_CAST(OpenXRAPIExtension::OpenXRAlphaBlendModeSupport);
|
||||
|
||||
#endif // OPENXR_API_EXTENSION_H
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "extensions/openxr_eye_gaze_interaction.h"
|
||||
#include "extensions/openxr_hand_interaction_extension.h"
|
||||
#include "extensions/openxr_performance_settings_extension.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
|
@ -50,6 +51,9 @@ void OpenXRInterface::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("pose_recentered"));
|
||||
ADD_SIGNAL(MethodInfo("refresh_rate_changed", PropertyInfo(Variant::FLOAT, "refresh_rate")));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("cpu_level_changed", PropertyInfo(Variant::INT, "sub_domain"), PropertyInfo(Variant::INT, "from_level"), PropertyInfo(Variant::INT, "to_level")));
|
||||
ADD_SIGNAL(MethodInfo("gpu_level_changed", PropertyInfo(Variant::INT, "sub_domain"), PropertyInfo(Variant::INT, "from_level"), PropertyInfo(Variant::INT, "to_level")));
|
||||
|
||||
// Display refresh rate
|
||||
ClassDB::bind_method(D_METHOD("get_display_refresh_rate"), &OpenXRInterface::get_display_refresh_rate);
|
||||
ClassDB::bind_method(D_METHOD("set_display_refresh_rate", "refresh_rate"), &OpenXRInterface::set_display_refresh_rate);
|
||||
|
|
@ -104,6 +108,10 @@ void OpenXRInterface::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_vrs_strength"), &OpenXRInterface::get_vrs_strength);
|
||||
ClassDB::bind_method(D_METHOD("set_vrs_strength", "strength"), &OpenXRInterface::set_vrs_strength);
|
||||
|
||||
// Performance settings.
|
||||
ClassDB::bind_method(D_METHOD("set_cpu_level", "level"), &OpenXRInterface::set_cpu_level);
|
||||
ClassDB::bind_method(D_METHOD("set_gpu_level", "level"), &OpenXRInterface::set_gpu_level);
|
||||
|
||||
ADD_GROUP("Vulkan VRS", "vrs_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_min_radius", PROPERTY_HINT_RANGE, "1.0,100.0,1.0"), "set_vrs_min_radius", "get_vrs_min_radius");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "vrs_strength", PROPERTY_HINT_RANGE, "0.1,10.0,0.1"), "set_vrs_strength", "get_vrs_strength");
|
||||
|
|
@ -149,6 +157,19 @@ void OpenXRInterface::_bind_methods() {
|
|||
BIND_ENUM_CONSTANT(HAND_JOINT_LITTLE_TIP);
|
||||
BIND_ENUM_CONSTANT(HAND_JOINT_MAX);
|
||||
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_LEVEL_POWER_SAVINGS);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_LEVEL_SUSTAINED_LOW);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_LEVEL_SUSTAINED_HIGH);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_LEVEL_BOOST);
|
||||
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_SUB_DOMAIN_COMPOSITING);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_SUB_DOMAIN_RENDERING);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_SUB_DOMAIN_THERMAL);
|
||||
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_NOTIF_LEVEL_NORMAL);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_NOTIF_LEVEL_WARNING);
|
||||
BIND_ENUM_CONSTANT(PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED);
|
||||
|
||||
BIND_BITFIELD_FLAG(HAND_JOINT_NONE);
|
||||
BIND_BITFIELD_FLAG(HAND_JOINT_ORIENTATION_VALID);
|
||||
BIND_BITFIELD_FLAG(HAND_JOINT_ORIENTATION_TRACKED);
|
||||
|
|
@ -705,6 +726,8 @@ Dictionary OpenXRInterface::get_system_info() {
|
|||
if (openxr_api) {
|
||||
dict[SNAME("XRRuntimeName")] = openxr_api->get_runtime_name();
|
||||
dict[SNAME("XRRuntimeVersion")] = openxr_api->get_runtime_version();
|
||||
dict[SNAME("OpenXRSystemName")] = openxr_api->get_system_name();
|
||||
dict[SNAME("OpenXRVendorID")] = openxr_api->get_vendor_id();
|
||||
}
|
||||
|
||||
return dict;
|
||||
|
|
@ -730,6 +753,8 @@ XRInterface::PlayAreaMode OpenXRInterface::get_play_area_mode() const {
|
|||
return XRInterface::XR_PLAY_AREA_ROOMSCALE;
|
||||
} else if (reference_space == XR_REFERENCE_SPACE_TYPE_STAGE) {
|
||||
return XRInterface::XR_PLAY_AREA_STAGE;
|
||||
} else if (reference_space == XR_REFERENCE_SPACE_TYPE_MAX_ENUM) {
|
||||
return XRInterface::XR_PLAY_AREA_CUSTOM;
|
||||
}
|
||||
|
||||
return XRInterface::XR_PLAY_AREA_UNKNOWN;
|
||||
|
|
@ -1441,7 +1466,7 @@ OpenXRInterface::HandTrackedSource OpenXRInterface::get_hand_tracking_source(con
|
|||
}
|
||||
|
||||
BitField<OpenXRInterface::HandJointFlags> OpenXRInterface::get_hand_joint_flags(Hand p_hand, HandJoints p_joint) const {
|
||||
BitField<OpenXRInterface::HandJointFlags> bits;
|
||||
BitField<OpenXRInterface::HandJointFlags> bits = HAND_JOINT_NONE;
|
||||
|
||||
OpenXRHandTrackingExtension *hand_tracking_ext = OpenXRHandTrackingExtension::get_singleton();
|
||||
if (hand_tracking_ext && hand_tracking_ext->get_active()) {
|
||||
|
|
@ -1536,6 +1561,28 @@ RID OpenXRInterface::get_vrs_texture() {
|
|||
return xr_vrs.make_vrs_texture(target_size, eye_foci);
|
||||
}
|
||||
|
||||
void OpenXRInterface::set_cpu_level(PerfSettingsLevel p_level) {
|
||||
OpenXRPerformanceSettingsExtension *performance_settings_ext = OpenXRPerformanceSettingsExtension::get_singleton();
|
||||
if (performance_settings_ext && performance_settings_ext->is_available()) {
|
||||
performance_settings_ext->set_cpu_level(p_level);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRInterface::set_gpu_level(PerfSettingsLevel p_level) {
|
||||
OpenXRPerformanceSettingsExtension *performance_settings_ext = OpenXRPerformanceSettingsExtension::get_singleton();
|
||||
if (performance_settings_ext && performance_settings_ext->is_available()) {
|
||||
performance_settings_ext->set_gpu_level(p_level);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRInterface::on_cpu_level_changed(PerfSettingsSubDomain p_sub_domain, PerfSettingsNotificationLevel p_from_level, PerfSettingsNotificationLevel p_to_level) {
|
||||
emit_signal(SNAME("cpu_level_changed"), p_sub_domain, p_from_level, p_to_level);
|
||||
}
|
||||
|
||||
void OpenXRInterface::on_gpu_level_changed(PerfSettingsSubDomain p_sub_domain, PerfSettingsNotificationLevel p_from_level, PerfSettingsNotificationLevel p_to_level) {
|
||||
emit_signal(SNAME("gpu_level_changed"), p_sub_domain, p_from_level, p_to_level);
|
||||
}
|
||||
|
||||
OpenXRInterface::OpenXRInterface() {
|
||||
openxr_api = OpenXRAPI::get_singleton();
|
||||
if (openxr_api) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_INTERFACE_H
|
||||
#define OPENXR_INTERFACE_H
|
||||
#pragma once
|
||||
|
||||
// A note on multithreading and thread safety in OpenXR.
|
||||
//
|
||||
|
|
@ -292,6 +291,31 @@ public:
|
|||
|
||||
virtual RID get_vrs_texture() override;
|
||||
|
||||
// Performance settings.
|
||||
enum PerfSettingsLevel {
|
||||
PERF_SETTINGS_LEVEL_POWER_SAVINGS,
|
||||
PERF_SETTINGS_LEVEL_SUSTAINED_LOW,
|
||||
PERF_SETTINGS_LEVEL_SUSTAINED_HIGH,
|
||||
PERF_SETTINGS_LEVEL_BOOST,
|
||||
};
|
||||
|
||||
enum PerfSettingsSubDomain {
|
||||
PERF_SETTINGS_SUB_DOMAIN_COMPOSITING,
|
||||
PERF_SETTINGS_SUB_DOMAIN_RENDERING,
|
||||
PERF_SETTINGS_SUB_DOMAIN_THERMAL,
|
||||
};
|
||||
|
||||
enum PerfSettingsNotificationLevel {
|
||||
PERF_SETTINGS_NOTIF_LEVEL_NORMAL,
|
||||
PERF_SETTINGS_NOTIF_LEVEL_WARNING,
|
||||
PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED,
|
||||
};
|
||||
|
||||
void set_cpu_level(PerfSettingsLevel p_level);
|
||||
void set_gpu_level(PerfSettingsLevel p_level);
|
||||
void on_cpu_level_changed(PerfSettingsSubDomain p_sub_domain, PerfSettingsNotificationLevel p_from_level, PerfSettingsNotificationLevel p_to_level);
|
||||
void on_gpu_level_changed(PerfSettingsSubDomain p_sub_domain, PerfSettingsNotificationLevel p_from_level, PerfSettingsNotificationLevel p_to_level);
|
||||
|
||||
OpenXRInterface();
|
||||
~OpenXRInterface();
|
||||
};
|
||||
|
|
@ -300,6 +324,7 @@ VARIANT_ENUM_CAST(OpenXRInterface::Hand)
|
|||
VARIANT_ENUM_CAST(OpenXRInterface::HandMotionRange)
|
||||
VARIANT_ENUM_CAST(OpenXRInterface::HandTrackedSource)
|
||||
VARIANT_ENUM_CAST(OpenXRInterface::HandJoints)
|
||||
VARIANT_ENUM_CAST(OpenXRInterface::PerfSettingsLevel)
|
||||
VARIANT_ENUM_CAST(OpenXRInterface::PerfSettingsSubDomain)
|
||||
VARIANT_ENUM_CAST(OpenXRInterface::PerfSettingsNotificationLevel)
|
||||
VARIANT_BITFIELD_CAST(OpenXRInterface::HandJointFlags)
|
||||
|
||||
#endif // OPENXR_INTERFACE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_PLATFORM_INC_H
|
||||
#define OPENXR_PLATFORM_INC_H
|
||||
#pragma once
|
||||
|
||||
// In various places we need to include platform definitions but we can't
|
||||
// include these in our normal header files as we'll end up with issues.
|
||||
|
|
@ -86,5 +85,3 @@
|
|||
|
||||
// Include platform dependent structs.
|
||||
#include <openxr/openxr_platform.h>
|
||||
|
||||
#endif // OPENXR_PLATFORM_INC_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_UTIL_H
|
||||
#define OPENXR_UTIL_H
|
||||
#pragma once
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
|
||||
|
|
@ -66,5 +65,3 @@ public:
|
|||
static void XrMatrix4x4f_CreateProjectionFov(XrMatrix4x4f *result, GraphicsAPI graphicsApi, const XrFovf fov,
|
||||
const float nearZ, const float farZ);
|
||||
};
|
||||
|
||||
#endif // OPENXR_UTIL_H
|
||||
|
|
|
|||
|
|
@ -36,9 +36,12 @@
|
|||
#include "action_map/openxr_haptic_feedback.h"
|
||||
#include "action_map/openxr_interaction_profile.h"
|
||||
#include "action_map/openxr_interaction_profile_metadata.h"
|
||||
#include "openxr_api_extension.h"
|
||||
#include "openxr_interface.h"
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
#include "extensions/openxr_extension_wrapper_extension.h"
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
#include "scene/openxr_composition_layer.h"
|
||||
#include "scene/openxr_composition_layer_cylinder.h"
|
||||
|
|
@ -53,6 +56,7 @@
|
|||
#include "extensions/openxr_dpad_binding_extension.h"
|
||||
#include "extensions/openxr_eye_gaze_interaction.h"
|
||||
#include "extensions/openxr_fb_display_refresh_rate_extension.h"
|
||||
#include "extensions/openxr_future_extension.h"
|
||||
#include "extensions/openxr_hand_interaction_extension.h"
|
||||
#include "extensions/openxr_hand_tracking_extension.h"
|
||||
#include "extensions/openxr_htc_controller_extension.h"
|
||||
|
|
@ -63,6 +67,7 @@
|
|||
#include "extensions/openxr_ml2_controller_extension.h"
|
||||
#include "extensions/openxr_mxink_extension.h"
|
||||
#include "extensions/openxr_palm_pose_extension.h"
|
||||
#include "extensions/openxr_performance_settings_extension.h"
|
||||
#include "extensions/openxr_pico_controller_extension.h"
|
||||
#include "extensions/openxr_valve_analog_threshold_extension.h"
|
||||
#include "extensions/openxr_visibility_mask_extension.h"
|
||||
|
|
@ -110,8 +115,16 @@ static void _editor_init() {
|
|||
|
||||
void initialize_openxr_module(ModuleInitializationLevel p_level) {
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_CORE) {
|
||||
GDREGISTER_CLASS(OpenXRExtensionWrapperExtension);
|
||||
GDREGISTER_VIRTUAL_CLASS(OpenXRExtensionWrapper);
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
GDREGISTER_VIRTUAL_CLASS(OpenXRExtensionWrapperExtension);
|
||||
#endif // DISABLE_DEPRECATED
|
||||
GDREGISTER_ABSTRACT_CLASS(OpenXRFutureResult); // Declared abstract, should never be instantiated by a user (Q or should this be internal?)
|
||||
GDREGISTER_CLASS(OpenXRFutureExtension);
|
||||
GDREGISTER_CLASS(OpenXRAPIExtension);
|
||||
|
||||
// Note, we're not registering all wrapper classes here, there is no point in exposing them
|
||||
// if there isn't specific logic to expose.
|
||||
}
|
||||
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SERVERS) {
|
||||
|
|
@ -139,6 +152,12 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) {
|
|||
OpenXRAPI::register_extension_wrapper(memnew(OpenXRHandInteractionExtension));
|
||||
OpenXRAPI::register_extension_wrapper(memnew(OpenXRMxInkExtension));
|
||||
OpenXRAPI::register_extension_wrapper(memnew(OpenXRVisibilityMaskExtension));
|
||||
OpenXRAPI::register_extension_wrapper(memnew(OpenXRPerformanceSettingsExtension));
|
||||
|
||||
// Futures extension has to be registered as a singleton so extensions can access it.
|
||||
OpenXRFutureExtension *future_extension = memnew(OpenXRFutureExtension);
|
||||
OpenXRAPI::register_extension_wrapper(future_extension);
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("OpenXRFutureExtension", future_extension));
|
||||
|
||||
// register gated extensions
|
||||
if (int(GLOBAL_GET("xr/openxr/extensions/debug_utils")) > 0) {
|
||||
|
|
@ -223,15 +242,17 @@ void initialize_openxr_module(ModuleInitializationLevel p_level) {
|
|||
openxr_interface->initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
if (p_level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||
GDREGISTER_ABSTRACT_CLASS(OpenXRInteractionProfileEditorBase);
|
||||
GDREGISTER_CLASS(OpenXRInteractionProfileEditor);
|
||||
GDREGISTER_CLASS(OpenXRBindingModifierEditor);
|
||||
|
||||
EditorNode::add_init_callback(_editor_init);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void uninitialize_openxr_module(ModuleInitializationLevel p_level) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_REGISTER_TYPES_H
|
||||
#define OPENXR_REGISTER_TYPES_H
|
||||
#pragma once
|
||||
|
||||
#define MODULE_OPENXR_HAS_PREREGISTER
|
||||
|
||||
|
|
@ -37,5 +36,3 @@
|
|||
|
||||
void initialize_openxr_module(ModuleInitializationLevel p_level);
|
||||
void uninitialize_openxr_module(ModuleInitializationLevel p_level);
|
||||
|
||||
#endif // OPENXR_REGISTER_TYPES_H
|
||||
|
|
|
|||
|
|
@ -30,12 +30,11 @@
|
|||
|
||||
#include "openxr_composition_layer.h"
|
||||
|
||||
#include "../extensions/openxr_composition_layer_extension.h"
|
||||
#include "../openxr_api.h"
|
||||
#include "../openxr_interface.h"
|
||||
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/xr_nodes.h"
|
||||
#include "scene/3d/xr/xr_nodes.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
#include "platform/android/api/java_class_wrapper.h"
|
||||
|
|
@ -52,6 +51,7 @@ static const char *HOLE_PUNCH_SHADER_CODE =
|
|||
OpenXRCompositionLayer::OpenXRCompositionLayer(XrCompositionLayerBaseHeader *p_composition_layer) {
|
||||
composition_layer_base_header = p_composition_layer;
|
||||
openxr_layer_provider = memnew(OpenXRViewportCompositionLayerProvider(composition_layer_base_header));
|
||||
swapchain_state = openxr_layer_provider->get_swapchain_state();
|
||||
|
||||
openxr_api = OpenXRAPI::get_singleton();
|
||||
composition_layer_extension = OpenXRCompositionLayerExtension::get_singleton();
|
||||
|
|
@ -113,6 +113,39 @@ void OpenXRCompositionLayer::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_android_surface"), &OpenXRCompositionLayer::get_android_surface);
|
||||
ClassDB::bind_method(D_METHOD("is_natively_supported"), &OpenXRCompositionLayer::is_natively_supported);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_min_filter", "mode"), &OpenXRCompositionLayer::set_min_filter);
|
||||
ClassDB::bind_method(D_METHOD("get_min_filter"), &OpenXRCompositionLayer::get_min_filter);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_mag_filter", "mode"), &OpenXRCompositionLayer::set_mag_filter);
|
||||
ClassDB::bind_method(D_METHOD("get_mag_filter"), &OpenXRCompositionLayer::get_mag_filter);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_mipmap_mode", "mode"), &OpenXRCompositionLayer::set_mipmap_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_mipmap_mode"), &OpenXRCompositionLayer::get_mipmap_mode);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_horizontal_wrap", "mode"), &OpenXRCompositionLayer::set_horizontal_wrap);
|
||||
ClassDB::bind_method(D_METHOD("get_horizontal_wrap"), &OpenXRCompositionLayer::get_horizontal_wrap);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_vertical_wrap", "mode"), &OpenXRCompositionLayer::set_vertical_wrap);
|
||||
ClassDB::bind_method(D_METHOD("get_vertical_wrap"), &OpenXRCompositionLayer::get_vertical_wrap);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_red_swizzle", "mode"), &OpenXRCompositionLayer::set_red_swizzle);
|
||||
ClassDB::bind_method(D_METHOD("get_red_swizzle"), &OpenXRCompositionLayer::get_red_swizzle);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_green_swizzle", "mode"), &OpenXRCompositionLayer::set_green_swizzle);
|
||||
ClassDB::bind_method(D_METHOD("get_green_swizzle"), &OpenXRCompositionLayer::get_green_swizzle);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_blue_swizzle", "mode"), &OpenXRCompositionLayer::set_blue_swizzle);
|
||||
ClassDB::bind_method(D_METHOD("get_blue_swizzle"), &OpenXRCompositionLayer::get_blue_swizzle);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_alpha_swizzle", "mode"), &OpenXRCompositionLayer::set_alpha_swizzle);
|
||||
ClassDB::bind_method(D_METHOD("get_alpha_swizzle"), &OpenXRCompositionLayer::get_alpha_swizzle);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_max_anisotropy", "value"), &OpenXRCompositionLayer::set_max_anisotropy);
|
||||
ClassDB::bind_method(D_METHOD("get_max_anisotropy"), &OpenXRCompositionLayer::get_max_anisotropy);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_border_color", "color"), &OpenXRCompositionLayer::set_border_color);
|
||||
ClassDB::bind_method(D_METHOD("get_border_color"), &OpenXRCompositionLayer::get_border_color);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("intersects_ray", "origin", "direction"), &OpenXRCompositionLayer::intersects_ray);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "layer_viewport", PROPERTY_HINT_NODE_TYPE, "SubViewport"), "set_layer_viewport", "get_layer_viewport");
|
||||
|
|
@ -121,10 +154,45 @@ void OpenXRCompositionLayer::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::INT, "sort_order", PROPERTY_HINT_NONE, ""), "set_sort_order", "get_sort_order");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "alpha_blend", PROPERTY_HINT_NONE, ""), "set_alpha_blend", "get_alpha_blend");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enable_hole_punch", PROPERTY_HINT_NONE, ""), "set_enable_hole_punch", "get_enable_hole_punch");
|
||||
|
||||
ADD_GROUP("Swapchain State", "swapchain_state_");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_min_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Cubic"), "set_min_filter", "get_min_filter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_mag_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Cubic"), "set_mag_filter", "get_mag_filter");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_mipmap_mode", PROPERTY_HINT_ENUM, "Disabled,Nearest,Linear"), "set_mipmap_mode", "get_mipmap_mode");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_horizontal_wrap", PROPERTY_HINT_ENUM, "Clamp to Border,Clamp to Edge,Repeat,Mirrored Repeat,Mirror Clamp to Edge"), "set_horizontal_wrap", "get_horizontal_wrap");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_vertical_wrap", PROPERTY_HINT_ENUM, "Clamp to Border,Clamp to Edge,Repeat,Mirrored Repeat,Mirror Clamp to Edge"), "set_vertical_wrap", "get_vertical_wrap");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_red_swizzle", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Zero,One"), "set_red_swizzle", "get_red_swizzle");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_green_swizzle", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Zero,One"), "set_green_swizzle", "get_green_swizzle");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_blue_swizzle", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Zero,One"), "set_blue_swizzle", "get_blue_swizzle");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "swapchain_state_alpha_swizzle", PROPERTY_HINT_ENUM, "Red,Green,Blue,Alpha,Zero,One"), "set_alpha_swizzle", "get_alpha_swizzle");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "swapchain_state_max_anisotropy", PROPERTY_HINT_RANGE, "1.0,16.0,0.001"), "set_max_anisotropy", "get_max_anisotropy");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "swapchain_state_border_color"), "set_border_color", "get_border_color");
|
||||
ADD_GROUP("", "");
|
||||
|
||||
BIND_ENUM_CONSTANT(FILTER_NEAREST);
|
||||
BIND_ENUM_CONSTANT(FILTER_LINEAR);
|
||||
BIND_ENUM_CONSTANT(FILTER_CUBIC);
|
||||
|
||||
BIND_ENUM_CONSTANT(MIPMAP_MODE_DISABLED);
|
||||
BIND_ENUM_CONSTANT(MIPMAP_MODE_NEAREST);
|
||||
BIND_ENUM_CONSTANT(MIPMAP_MODE_LINEAR);
|
||||
|
||||
BIND_ENUM_CONSTANT(WRAP_CLAMP_TO_BORDER);
|
||||
BIND_ENUM_CONSTANT(WRAP_CLAMP_TO_EDGE);
|
||||
BIND_ENUM_CONSTANT(WRAP_REPEAT);
|
||||
BIND_ENUM_CONSTANT(WRAP_MIRRORED_REPEAT);
|
||||
BIND_ENUM_CONSTANT(WRAP_MIRROR_CLAMP_TO_EDGE);
|
||||
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_RED);
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_GREEN);
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_BLUE);
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_ALPHA);
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_ZERO);
|
||||
BIND_ENUM_CONSTANT(SWIZZLE_ONE);
|
||||
}
|
||||
|
||||
bool OpenXRCompositionLayer::_should_use_fallback_node() {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
if (Engine::get_singleton()->is_editor_hint() || openxr_api == nullptr) {
|
||||
return true;
|
||||
} else if (openxr_session_running) {
|
||||
return enable_hole_punch || (!is_natively_supported() && !use_android_surface);
|
||||
|
|
@ -151,6 +219,7 @@ void OpenXRCompositionLayer::_setup_composition_layer_provider() {
|
|||
if (use_android_surface || layer_viewport) {
|
||||
if (composition_layer_extension) {
|
||||
composition_layer_extension->register_viewport_composition_layer_provider(openxr_layer_provider);
|
||||
registered = true;
|
||||
}
|
||||
|
||||
// NOTE: We don't setup/clear when using Android surfaces, so we don't destroy the surface unexpectedly.
|
||||
|
|
@ -164,6 +233,7 @@ void OpenXRCompositionLayer::_setup_composition_layer_provider() {
|
|||
void OpenXRCompositionLayer::_clear_composition_layer_provider() {
|
||||
if (composition_layer_extension) {
|
||||
composition_layer_extension->unregister_viewport_composition_layer_provider(openxr_layer_provider);
|
||||
registered = false;
|
||||
}
|
||||
|
||||
// NOTE: We don't setup/clear when using Android surfaces, so we don't destroy the surface unexpectedly.
|
||||
|
|
@ -228,6 +298,9 @@ void OpenXRCompositionLayer::set_layer_viewport(SubViewport *p_viewport) {
|
|||
}
|
||||
|
||||
layer_viewport = p_viewport;
|
||||
if (!registered && is_natively_supported() && openxr_session_running && is_inside_tree() && is_visible()) {
|
||||
_setup_composition_layer_provider();
|
||||
}
|
||||
|
||||
if (layer_viewport) {
|
||||
SubViewport::UpdateMode update_mode = layer_viewport->get_update_mode();
|
||||
|
|
@ -331,12 +404,155 @@ bool OpenXRCompositionLayer::get_alpha_blend() const {
|
|||
}
|
||||
|
||||
bool OpenXRCompositionLayer::is_natively_supported() const {
|
||||
if (composition_layer_extension) {
|
||||
if (composition_layer_extension && openxr_api) {
|
||||
return composition_layer_extension->is_available(openxr_layer_provider->get_openxr_type());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_min_filter(Filter p_mode) {
|
||||
if (swapchain_state->min_filter == (OpenXRViewportCompositionLayerProvider::Filter)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->min_filter = (OpenXRViewportCompositionLayerProvider::Filter)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Filter OpenXRCompositionLayer::get_min_filter() const {
|
||||
return (OpenXRCompositionLayer::Filter)swapchain_state->min_filter;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_mag_filter(Filter p_mode) {
|
||||
if (swapchain_state->mag_filter == (OpenXRViewportCompositionLayerProvider::Filter)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->mag_filter = (OpenXRViewportCompositionLayerProvider::Filter)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Filter OpenXRCompositionLayer::get_mag_filter() const {
|
||||
return (OpenXRCompositionLayer::Filter)swapchain_state->mag_filter;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_mipmap_mode(MipmapMode p_mode) {
|
||||
if (swapchain_state->mipmap_mode == (OpenXRViewportCompositionLayerProvider::MipmapMode)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->mipmap_mode = (OpenXRViewportCompositionLayerProvider::MipmapMode)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::MipmapMode OpenXRCompositionLayer::get_mipmap_mode() const {
|
||||
return (OpenXRCompositionLayer::MipmapMode)swapchain_state->mipmap_mode;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_horizontal_wrap(Wrap p_mode) {
|
||||
if (swapchain_state->horizontal_wrap == (OpenXRViewportCompositionLayerProvider::Wrap)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->horizontal_wrap = (OpenXRViewportCompositionLayerProvider::Wrap)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Wrap OpenXRCompositionLayer::get_horizontal_wrap() const {
|
||||
return (OpenXRCompositionLayer::Wrap)swapchain_state->horizontal_wrap;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_vertical_wrap(Wrap p_mode) {
|
||||
if (swapchain_state->vertical_wrap == (OpenXRViewportCompositionLayerProvider::Wrap)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->vertical_wrap = (OpenXRViewportCompositionLayerProvider::Wrap)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Wrap OpenXRCompositionLayer::get_vertical_wrap() const {
|
||||
return (OpenXRCompositionLayer::Wrap)swapchain_state->vertical_wrap;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_red_swizzle(Swizzle p_mode) {
|
||||
if (swapchain_state->red_swizzle == (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->red_swizzle = (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Swizzle OpenXRCompositionLayer::get_red_swizzle() const {
|
||||
return (OpenXRCompositionLayer::Swizzle)swapchain_state->red_swizzle;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_green_swizzle(Swizzle p_mode) {
|
||||
if (swapchain_state->green_swizzle == (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->green_swizzle = (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Swizzle OpenXRCompositionLayer::get_green_swizzle() const {
|
||||
return (OpenXRCompositionLayer::Swizzle)swapchain_state->green_swizzle;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_blue_swizzle(Swizzle p_mode) {
|
||||
if (swapchain_state->blue_swizzle == (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->blue_swizzle = (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Swizzle OpenXRCompositionLayer::get_blue_swizzle() const {
|
||||
return (OpenXRCompositionLayer::Swizzle)swapchain_state->blue_swizzle;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_alpha_swizzle(Swizzle p_mode) {
|
||||
if (swapchain_state->alpha_swizzle == (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->alpha_swizzle = (OpenXRViewportCompositionLayerProvider::Swizzle)p_mode;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
OpenXRCompositionLayer::Swizzle OpenXRCompositionLayer::get_alpha_swizzle() const {
|
||||
return (OpenXRCompositionLayer::Swizzle)swapchain_state->alpha_swizzle;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_max_anisotropy(float p_value) {
|
||||
if (swapchain_state->max_anisotropy == p_value) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->max_anisotropy = p_value;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
float OpenXRCompositionLayer::get_max_anisotropy() const {
|
||||
return swapchain_state->max_anisotropy;
|
||||
}
|
||||
|
||||
void OpenXRCompositionLayer::set_border_color(Color p_color) {
|
||||
if (swapchain_state->border_color == p_color) {
|
||||
return;
|
||||
}
|
||||
|
||||
swapchain_state->border_color = p_color;
|
||||
swapchain_state->dirty = true;
|
||||
}
|
||||
|
||||
Color OpenXRCompositionLayer::get_border_color() const {
|
||||
return swapchain_state->border_color;
|
||||
}
|
||||
|
||||
Ref<JavaObject> OpenXRCompositionLayer::get_android_surface() {
|
||||
return openxr_layer_provider->get_android_surface();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef OPENXR_COMPOSITION_LAYER_H
|
||||
#define OPENXR_COMPOSITION_LAYER_H
|
||||
#pragma once
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
#include "../extensions/openxr_composition_layer_extension.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
|
||||
class JavaObject;
|
||||
|
|
@ -46,6 +46,41 @@ class SubViewport;
|
|||
class OpenXRCompositionLayer : public Node3D {
|
||||
GDCLASS(OpenXRCompositionLayer, Node3D);
|
||||
|
||||
public:
|
||||
// Must be identical to Filter enum definition in OpenXRViewportCompositionLayerProvider.
|
||||
enum Filter {
|
||||
FILTER_NEAREST,
|
||||
FILTER_LINEAR,
|
||||
FILTER_CUBIC,
|
||||
};
|
||||
|
||||
// Must be identical to MipmapMode enum definition in OpenXRViewportCompositionLayerProvider.
|
||||
enum MipmapMode {
|
||||
MIPMAP_MODE_DISABLED,
|
||||
MIPMAP_MODE_NEAREST,
|
||||
MIPMAP_MODE_LINEAR,
|
||||
};
|
||||
|
||||
// Must be identical to Wrap enum definition in OpenXRViewportCompositionLayerProvider.
|
||||
enum Wrap {
|
||||
WRAP_CLAMP_TO_BORDER,
|
||||
WRAP_CLAMP_TO_EDGE,
|
||||
WRAP_REPEAT,
|
||||
WRAP_MIRRORED_REPEAT,
|
||||
WRAP_MIRROR_CLAMP_TO_EDGE,
|
||||
};
|
||||
|
||||
// Must be identical to Swizzle enum definition in OpenXRViewportCompositionLayerProvider.
|
||||
enum Swizzle {
|
||||
SWIZZLE_RED,
|
||||
SWIZZLE_GREEN,
|
||||
SWIZZLE_BLUE,
|
||||
SWIZZLE_ALPHA,
|
||||
SWIZZLE_ZERO,
|
||||
SWIZZLE_ONE,
|
||||
};
|
||||
|
||||
private:
|
||||
XrCompositionLayerBaseHeader *composition_layer_base_header = nullptr;
|
||||
OpenXRViewportCompositionLayerProvider *openxr_layer_provider = nullptr;
|
||||
|
||||
|
|
@ -56,6 +91,9 @@ class OpenXRCompositionLayer : public Node3D {
|
|||
MeshInstance3D *fallback = nullptr;
|
||||
bool should_update_fallback_mesh = false;
|
||||
bool openxr_session_running = false;
|
||||
bool registered = false;
|
||||
|
||||
OpenXRViewportCompositionLayerProvider::SwapchainState *swapchain_state = nullptr;
|
||||
|
||||
Dictionary extension_property_values;
|
||||
|
||||
|
|
@ -115,6 +153,39 @@ public:
|
|||
Ref<JavaObject> get_android_surface();
|
||||
bool is_natively_supported() const;
|
||||
|
||||
void set_min_filter(Filter p_mode);
|
||||
Filter get_min_filter() const;
|
||||
|
||||
void set_mag_filter(Filter p_mode);
|
||||
Filter get_mag_filter() const;
|
||||
|
||||
void set_mipmap_mode(MipmapMode p_mode);
|
||||
MipmapMode get_mipmap_mode() const;
|
||||
|
||||
void set_horizontal_wrap(Wrap p_mode);
|
||||
Wrap get_horizontal_wrap() const;
|
||||
|
||||
void set_vertical_wrap(Wrap p_mode);
|
||||
Wrap get_vertical_wrap() const;
|
||||
|
||||
void set_red_swizzle(Swizzle p_mode);
|
||||
Swizzle get_red_swizzle() const;
|
||||
|
||||
void set_green_swizzle(Swizzle p_mode);
|
||||
Swizzle get_green_swizzle() const;
|
||||
|
||||
void set_blue_swizzle(Swizzle p_mode);
|
||||
Swizzle get_blue_swizzle() const;
|
||||
|
||||
void set_alpha_swizzle(Swizzle p_mode);
|
||||
Swizzle get_alpha_swizzle() const;
|
||||
|
||||
void set_max_anisotropy(float p_value);
|
||||
float get_max_anisotropy() const;
|
||||
|
||||
void set_border_color(Color p_color);
|
||||
Color get_border_color() const;
|
||||
|
||||
virtual PackedStringArray get_configuration_warnings() const override;
|
||||
|
||||
virtual Vector2 intersects_ray(const Vector3 &p_origin, const Vector3 &p_direction) const;
|
||||
|
|
@ -122,4 +193,7 @@ public:
|
|||
~OpenXRCompositionLayer();
|
||||
};
|
||||
|
||||
#endif // OPENXR_COMPOSITION_LAYER_H
|
||||
VARIANT_ENUM_CAST(OpenXRCompositionLayer::Filter)
|
||||
VARIANT_ENUM_CAST(OpenXRCompositionLayer::MipmapMode)
|
||||
VARIANT_ENUM_CAST(OpenXRCompositionLayer::Wrap)
|
||||
VARIANT_ENUM_CAST(OpenXRCompositionLayer::Swizzle)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue