Skip to content
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
34extern "C" {
35#endif
36
37enum WebXRInputEvent {
38 WEBXR_INPUT_EVENT_SELECTSTART,
39 WEBXR_INPUT_EVENT_SELECTEND,
40 WEBXR_INPUT_EVENT_SQUEEZESTART,
41 WEBXR_INPUT_EVENT_SQUEEZEEND,
42};
43
44typedef void (*GodotWebXRSupportedCallback)(char *p_session_mode, int p_supported);
45typedef void (*GodotWebXRStartedCallback)(char *p_reference_space_type, char *p_enabled_features, char *p_environment_blend_mode);
46typedef void (*GodotWebXREndedCallback)();
47typedef void (*GodotWebXRFailedCallback)(char *p_message);
48typedef void (*GodotWebXRInputEventCallback)(int p_event_type, int p_input_source_id);
49typedef void (*GodotWebXRSimpleEventCallback)(char *p_signal_name);
50
51extern int godot_webxr_is_supported();
52extern void godot_webxr_is_session_supported(const char *p_session_mode, GodotWebXRSupportedCallback p_callback);
53
54extern 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);
65extern void godot_webxr_uninitialize();
66
67extern int godot_webxr_get_view_count();
68extern bool godot_webxr_get_render_target_size(int *r_size);
69extern bool godot_webxr_get_transform_for_view(int p_view, float *r_transform);
70extern bool godot_webxr_get_projection_for_view(int p_view, float *r_transform);
71extern unsigned int godot_webxr_get_color_texture();
72extern unsigned int godot_webxr_get_depth_texture();
73extern unsigned int godot_webxr_get_velocity_texture();
74extern void godot_webxr_commit_render_target(unsigned int p_texture_id, int p_layer_count);
75
76extern 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
92extern char *godot_webxr_get_visibility_state();
93extern int godot_webxr_get_bounds_geometry(float **r_points);
94
95extern float godot_webxr_get_frame_rate();
96extern void godot_webxr_update_target_frame_rate(float p_frame_rate);
97extern int godot_webxr_get_supported_frame_rates(float **r_frame_rates);
98
99#ifdef __cplusplus
100}
101#endif