2022-12-29 06:34:25 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* openxr_extension_wrapper_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_EXTENSION_WRAPPER_EXTENSION_H
|
|
|
|
#define OPENXR_EXTENSION_WRAPPER_EXTENSION_H
|
|
|
|
|
|
|
|
#include "../openxr_api_extension.h"
|
|
|
|
#include "openxr_extension_wrapper.h"
|
|
|
|
|
|
|
|
#include "core/object/ref_counted.h"
|
|
|
|
#include "core/os/os.h"
|
|
|
|
#include "core/os/thread_safe.h"
|
|
|
|
#include "core/variant/native_ptr.h"
|
2024-04-04 22:04:07 +02:00
|
|
|
#include "core/variant/typed_array.h"
|
2022-12-29 06:34:25 +01:00
|
|
|
|
2024-01-25 21:07:50 +01:00
|
|
|
class OpenXRExtensionWrapperExtension : public Object, public OpenXRExtensionWrapper, public OpenXRCompositionLayerProvider {
|
2022-12-29 06:34:25 +01:00
|
|
|
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;
|
2024-01-23 18:14:47 +01:00
|
|
|
virtual void *set_hand_joint_locations_and_get_next_pointer(int p_hand_index, void *p_next_pointer) override;
|
2024-04-04 22:04:07 +02:00
|
|
|
|
2023-05-09 15:29:13 +02:00
|
|
|
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;
|
2022-12-29 06:34:25 +01:00
|
|
|
|
|
|
|
//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>);
|
2024-01-23 18:14:47 +01:00
|
|
|
GDVIRTUAL2R(uint64_t, _set_hand_joint_locations_and_get_next_pointer, int, GDExtensionPtr<void>);
|
2023-05-09 15:29:13 +02:00
|
|
|
GDVIRTUAL0R(int, _get_composition_layer_count);
|
|
|
|
GDVIRTUAL1R(uint64_t, _get_composition_layer, int);
|
|
|
|
GDVIRTUAL1R(int, _get_composition_layer_order, int);
|
2022-12-29 06:34:25 +01:00
|
|
|
|
2024-02-13 23:13:56 +01:00
|
|
|
virtual PackedStringArray get_suggested_tracker_names() override;
|
|
|
|
|
|
|
|
GDVIRTUAL0R(PackedStringArray, _get_suggested_tracker_names);
|
|
|
|
|
2022-12-29 06:34:25 +01:00
|
|
|
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;
|
2024-05-20 03:15:21 +02:00
|
|
|
virtual void on_main_swapchains_created() override;
|
2022-12-29 06:34:25 +01:00
|
|
|
virtual void on_session_destroyed() 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);
|
2024-05-20 03:15:21 +02:00
|
|
|
GDVIRTUAL0(_on_main_swapchains_created);
|
2022-12-29 06:34:25 +01:00
|
|
|
GDVIRTUAL0(_on_session_destroyed);
|
|
|
|
|
|
|
|
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>);
|
|
|
|
|
2024-09-19 23:54:05 +02:00
|
|
|
virtual void *set_viewport_composition_layer_and_get_next_pointer(const XrCompositionLayerBaseHeader *p_layer, const Dictionary &p_property_values, void *p_next_pointer) override;
|
2024-04-04 22:04:07 +02:00
|
|
|
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;
|
2024-09-19 23:54:05 +02:00
|
|
|
virtual void *set_android_surface_swapchain_create_info_and_get_next_pointer(const Dictionary &p_property_values, void *p_next_pointer) override;
|
2024-04-04 22:04:07 +02:00
|
|
|
|
|
|
|
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);
|
2024-09-19 23:54:05 +02:00
|
|
|
GDVIRTUAL2R(uint64_t, _set_android_surface_swapchain_create_info_and_get_next_pointer, Dictionary, GDExtensionPtr<void>);
|
2024-04-04 22:04:07 +02:00
|
|
|
|
2022-12-29 06:34:25 +01:00
|
|
|
Ref<OpenXRAPIExtension> get_openxr_api();
|
|
|
|
|
|
|
|
void register_extension_wrapper();
|
|
|
|
|
|
|
|
OpenXRExtensionWrapperExtension();
|
2024-02-23 19:10:33 +01:00
|
|
|
virtual ~OpenXRExtensionWrapperExtension() override;
|
2022-12-29 06:34:25 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OPENXR_EXTENSION_WRAPPER_EXTENSION_H
|