summaryrefslogtreecommitdiffstats
path: root/modules/openxr/extensions/openxr_hand_interaction_extension.h
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2023-09-11 13:26:11 +1000
committerBastiaan Olij <mux213@gmail.com>2024-05-02 19:15:02 +1000
commit527c30c5940ce5ff25013f9876a75581603d8a55 (patch)
tree4593a424e44d9cdd67a053243ca2c942d51bcf24 /modules/openxr/extensions/openxr_hand_interaction_extension.h
parentf91db3dc58f1d6a0cb63d591515183b5a45cd3ba (diff)
downloadredot-engine-527c30c5940ce5ff25013f9876a75581603d8a55.tar.gz
Add support for OpenXR hand interaction extension
Diffstat (limited to 'modules/openxr/extensions/openxr_hand_interaction_extension.h')
-rw-r--r--modules/openxr/extensions/openxr_hand_interaction_extension.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/modules/openxr/extensions/openxr_hand_interaction_extension.h b/modules/openxr/extensions/openxr_hand_interaction_extension.h
new file mode 100644
index 0000000000..789e300c0b
--- /dev/null
+++ b/modules/openxr/extensions/openxr_hand_interaction_extension.h
@@ -0,0 +1,72 @@
+/**************************************************************************/
+/* openxr_hand_interaction_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. */
+/**************************************************************************/
+
+#ifndef OPENXR_HAND_INTERACTION_EXTENSION_H
+#define OPENXR_HAND_INTERACTION_EXTENSION_H
+
+#include "openxr_extension_wrapper.h"
+
+// When supported the hand interaction extension introduces an interaction
+// profile that becomes active when the user either lets go of their
+// controllers or isn't using controllers at all.
+//
+// The OpenXR specification states that all XR runtimes that support this
+// interaction profile should also allow it's controller to use this
+// interaction profile.
+// This means that if you only supply this interaction profile in your
+// action map, it should work both when the player is holding a controller
+// or using visual hand tracking.
+//
+// This allows easier portability between games that use controller
+// tracking or hand tracking.
+//
+// See: https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#XR_EXT_hand_interaction
+// for more information.
+
+class OpenXRHandInteractionExtension : public OpenXRExtensionWrapper {
+public:
+ static OpenXRHandInteractionExtension *get_singleton();
+
+ OpenXRHandInteractionExtension();
+ virtual ~OpenXRHandInteractionExtension() override;
+
+ virtual HashMap<String, bool *> get_requested_extensions() override;
+
+ bool is_available();
+
+ virtual void on_register_metadata() override;
+
+private:
+ static OpenXRHandInteractionExtension *singleton;
+
+ bool available = false;
+};
+
+#endif // OPENXR_HAND_INTERACTION_EXTENSION_H