0.2.0-dev Download ZIP
101 lines ·4.7 KB Raw
| 1 | /**************************************************************************/ |
| 2 | /* godot_webxr.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 | #ifdef __cplusplus |
| 34 | extern "C" { |
| 35 | #endif |
| 36 | |
| 37 | enum WebXRInputEvent { |
| 38 | WEBXR_INPUT_EVENT_SELECTSTART, |
| 39 | WEBXR_INPUT_EVENT_SELECTEND, |
| 40 | WEBXR_INPUT_EVENT_SQUEEZESTART, |
| 41 | WEBXR_INPUT_EVENT_SQUEEZEEND, |
| 42 | }; |
| 43 | |
| 44 | typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported); |
| 45 | typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type, char *p_enabled_features, char *p_environment_blend_mode); |
| 46 | typedef void (*GodotWebXREndedCallback)(); |
| 47 | typedef void (*GodotWebXRFailedCallback)(char *p_message); |
| 48 | typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_input_source_id); |
| 49 | typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name); |
| 50 | |
| 51 | extern int godot_webxr_is_supported(); |
| 52 | extern void godot_webxr_is_session_supported(const char *p_session_mode, GodotWebXRSupportedCallback p_callback); |
| 53 | |
| 54 | extern void godot_webxr_initialize( |
| 55 | const char *p_session_mode, |
| 56 | const char *p_required_features, |
| 57 | const char *p_optional_features, |
| 58 | const char *p_requested_reference_space_types, |
| 59 | bool p_disable_webxr_layers, |
| 60 | GodotWebXRStartedCallback p_on_session_started, |
| 61 | GodotWebXREndedCallback p_on_session_ended, |
| 62 | GodotWebXRFailedCallback p_on_session_failed, |
| 63 | GodotWebXRInputEventCallback p_on_input_event, |
| 64 | GodotWebXRSimpleEventCallback p_on_simple_event); |
| 65 | extern void godot_webxr_uninitialize(); |
| 66 | |
| 67 | extern int godot_webxr_get_view_count(); |
| 68 | extern bool godot_webxr_get_render_target_size(int *r_size); |
| 69 | extern bool godot_webxr_get_transform_for_view(int p_view, float *r_transform); |
| 70 | extern bool godot_webxr_get_projection_for_view(int p_view, float *r_transform); |
| 71 | extern unsigned int godot_webxr_get_color_texture(); |
| 72 | extern unsigned int godot_webxr_get_depth_texture(); |
| 73 | extern unsigned int godot_webxr_get_velocity_texture(); |
| 74 | extern void godot_webxr_commit_render_target(unsigned int p_texture_id, int p_layer_count); |
| 75 | |
| 76 | extern bool godot_webxr_update_input_source( |
| 77 | int p_input_source_id, |
| 78 | float *r_target_pose, |
| 79 | int *r_target_ray_mode, |
| 80 | int *r_touch_index, |
| 81 | int *r_has_grip_pose, |
| 82 | float *r_grip_pose, |
| 83 | int *r_has_standard_mapping, |
| 84 | int *r_button_count, |
| 85 | float *r_buttons, |
| 86 | int *r_axes_count, |
| 87 | float *r_axes, |
| 88 | int *r_has_hand_data, |
| 89 | float *r_hand_joints, |
| 90 | float *r_hand_radii); |
| 91 | |
| 92 | extern char *godot_webxr_get_visibility_state(); |
| 93 | extern int godot_webxr_get_bounds_geometry(float **r_points); |
| 94 | |
| 95 | extern float godot_webxr_get_frame_rate(); |
| 96 | extern void godot_webxr_update_target_frame_rate(float p_frame_rate); |
| 97 | extern int godot_webxr_get_supported_frame_rates(float **r_frame_rates); |
| 98 | |
| 99 | #ifdef __cplusplus |
| 100 | } |
| 101 | #endif |