Debian Codegraph @

modules/openxr/openxr_api_extension.h

raw symbols SCIP
1 /**************************************************************************/
2 /* openxr_api_extension.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #pragma once
32
33 #include "openxr_api.h"
34
35 #include "core/object/ref_counted.h"
36 #include "core/os/thread_safe.h"
37 #include "core/variant/native_ptr.h"
38
39 class OpenXRExtensionWrapper;
40 class OpenXRExtensionWrapperExtension;
41
42 class OpenXRAPIExtension : public RefCounted {
43 GDCLASS(OpenXRAPIExtension, RefCounted);
44
45 protected:
46 _THREAD_SAFE_CLASS_
47
48 static void _bind_methods();
49
50 #ifndef DISABLE_DEPRECATED
51 static void _bind_compatibility_methods();
52 void _register_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
53 void _unregister_composition_layer_provider_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
54 void _register_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
55 void _unregister_projection_views_extension_bind_compat_104087(OpenXRExtensionWrapperExtension *p_extension);
56 #endif
57
58 public:
59 uint64_t get_openxr_version();
60 uint64_t get_instance();
61 uint64_t get_system_id();
62 uint64_t get_session();
63
64 // Helper method to convert an XrPosef to a Transform3D.
65 Transform3D transform_from_pose(GDExtensionConstPtr<const void> p_pose);
66
67 bool xr_result(uint64_t p_result, const String &p_format, const Array &p_args = Array());
68
69 static bool openxr_is_enabled(bool p_check_run_in_editor = true);
70
71 //TODO workaround as GDExtensionPtr<void> return type results in build error in godot-cpp
72 uint64_t get_instance_proc_addr(const String &p_name);
73 String get_error_string(uint64_t result);
74 String get_swapchain_format_name(int64_t p_swapchain_format);
75 void set_object_name(int64_t p_object_type, uint64_t p_object_handle, const String &p_object_name);
76 void begin_debug_label_region(const String &p_label_name);
77 void end_debug_label_region();
78 void insert_debug_label(const String &p_label_name);
79
80 bool is_initialized();
81 bool is_running();
82
83 void set_custom_play_space(GDExtensionConstPtr<const void> p_custom_space);
84 uint64_t get_play_space();
85 int64_t get_predicted_display_time();
86 int64_t get_next_frame_time();
87 bool can_render();
88
89 RID find_action(const String &p_name, const RID &p_action_set = RID());
90 uint64_t action_get_handle(RID p_action);
91
92 uint64_t get_hand_tracker(int p_hand_index);
93
94 void register_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
95 void unregister_composition_layer_provider(OpenXRExtensionWrapper *p_extension);
96
97 void register_projection_views_extension(OpenXRExtensionWrapper *p_extension);
98 void unregister_projection_views_extension(OpenXRExtensionWrapper *p_extension);
99
100 void register_frame_info_extension(OpenXRExtensionWrapper *p_extension);
101 void unregister_frame_info_extension(OpenXRExtensionWrapper *p_extension);
102
103 double get_render_state_z_near();
104 double get_render_state_z_far();
105
106 void set_velocity_texture(RID p_render_target);
107 void set_velocity_depth_texture(RID p_render_target);
108 void set_velocity_target_size(const Size2i &p_target_size);
109
110 PackedInt64Array get_supported_swapchain_formats();
111
112 uint64_t openxr_swapchain_create(XrSwapchainCreateFlags p_create_flags, XrSwapchainUsageFlags p_usage_flags, int64_t p_swapchain_format, uint32_t p_width, uint32_t p_height, uint32_t p_sample_count, uint32_t p_array_size);
113 void openxr_swapchain_free(uint64_t p_swapchain_info);
114 uint64_t openxr_swapchain_get_swapchain(uint64_t p_swapchain_info);
115 void openxr_swapchain_acquire(uint64_t p_swapchain_info);
116 RID openxr_swapchain_get_image(uint64_t p_swapchain_info);
117 void openxr_swapchain_release(uint64_t p_swapchain_info);
118
119 uint64_t get_projection_layer();
120
121 void set_render_region(const Rect2i &p_render_region);
122
123 void update_main_swapchain_size();
124
125 enum OpenXRAlphaBlendModeSupport {
126 OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE = 0,
127 OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL = 1,
128 OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING = 2,
129 };
130
131 void set_emulate_environment_blend_mode_alpha_blend(bool p_enabled);
132 OpenXRAlphaBlendModeSupport is_environment_blend_mode_alpha_blend_supported();
133
134 OpenXRAPIExtension();
135 };
136
137 VARIANT_ENUM_CAST(OpenXRAPIExtension::OpenXRAlphaBlendModeSupport);