1 | /**************************************************************************/ |
2 | /* webxr_interface.cpp */ |
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 | #include "webxr_interface.h" |
32 | |
33 | #include <stdlib.h> |
34 | |
35 | void WebXRInterface::_bind_methods() { |
36 | ClassDB::bind_method(D_METHOD("is_session_supported" , "session_mode" ), &WebXRInterface::is_session_supported); |
37 | ClassDB::bind_method(D_METHOD("set_session_mode" , "session_mode" ), &WebXRInterface::set_session_mode); |
38 | ClassDB::bind_method(D_METHOD("get_session_mode" ), &WebXRInterface::get_session_mode); |
39 | ClassDB::bind_method(D_METHOD("set_required_features" , "required_features" ), &WebXRInterface::set_required_features); |
40 | ClassDB::bind_method(D_METHOD("get_required_features" ), &WebXRInterface::get_required_features); |
41 | ClassDB::bind_method(D_METHOD("set_optional_features" , "optional_features" ), &WebXRInterface::set_optional_features); |
42 | ClassDB::bind_method(D_METHOD("get_optional_features" ), &WebXRInterface::get_optional_features); |
43 | ClassDB::bind_method(D_METHOD("get_reference_space_type" ), &WebXRInterface::get_reference_space_type); |
44 | ClassDB::bind_method(D_METHOD("set_requested_reference_space_types" , "requested_reference_space_types" ), &WebXRInterface::set_requested_reference_space_types); |
45 | ClassDB::bind_method(D_METHOD("get_requested_reference_space_types" ), &WebXRInterface::get_requested_reference_space_types); |
46 | ClassDB::bind_method(D_METHOD("is_input_source_active" , "input_source_id" ), &WebXRInterface::is_input_source_active); |
47 | ClassDB::bind_method(D_METHOD("get_input_source_tracker" , "input_source_id" ), &WebXRInterface::get_input_source_tracker); |
48 | ClassDB::bind_method(D_METHOD("get_input_source_target_ray_mode" , "input_source_id" ), &WebXRInterface::get_input_source_target_ray_mode); |
49 | ClassDB::bind_method(D_METHOD("get_visibility_state" ), &WebXRInterface::get_visibility_state); |
50 | ClassDB::bind_method(D_METHOD("get_display_refresh_rate" ), &WebXRInterface::get_display_refresh_rate); |
51 | ClassDB::bind_method(D_METHOD("set_display_refresh_rate" , "refresh_rate" ), &WebXRInterface::set_display_refresh_rate); |
52 | ClassDB::bind_method(D_METHOD("get_available_display_refresh_rates" ), &WebXRInterface::get_available_display_refresh_rates); |
53 | |
54 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "session_mode" , PROPERTY_HINT_NONE), "set_session_mode" , "get_session_mode" ); |
55 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "required_features" , PROPERTY_HINT_NONE), "set_required_features" , "get_required_features" ); |
56 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "optional_features" , PROPERTY_HINT_NONE), "set_optional_features" , "get_optional_features" ); |
57 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "requested_reference_space_types" , PROPERTY_HINT_NONE), "set_requested_reference_space_types" , "get_requested_reference_space_types" ); |
58 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "reference_space_type" , PROPERTY_HINT_NONE), "" , "get_reference_space_type" ); |
59 | ADD_PROPERTY(PropertyInfo(Variant::STRING, "visibility_state" , PROPERTY_HINT_NONE), "" , "get_visibility_state" ); |
60 | |
61 | ADD_SIGNAL(MethodInfo("session_supported" , PropertyInfo(Variant::STRING, "session_mode" ), PropertyInfo(Variant::BOOL, "supported" ))); |
62 | ADD_SIGNAL(MethodInfo("session_started" )); |
63 | ADD_SIGNAL(MethodInfo("session_ended" )); |
64 | ADD_SIGNAL(MethodInfo("session_failed" , PropertyInfo(Variant::STRING, "message" ))); |
65 | |
66 | ADD_SIGNAL(MethodInfo("selectstart" , PropertyInfo(Variant::INT, "input_source_id" ))); |
67 | ADD_SIGNAL(MethodInfo("select" , PropertyInfo(Variant::INT, "input_source_id" ))); |
68 | ADD_SIGNAL(MethodInfo("selectend" , PropertyInfo(Variant::INT, "input_source_id" ))); |
69 | ADD_SIGNAL(MethodInfo("squeezestart" , PropertyInfo(Variant::INT, "input_source_id" ))); |
70 | ADD_SIGNAL(MethodInfo("squeeze" , PropertyInfo(Variant::INT, "input_source_id" ))); |
71 | ADD_SIGNAL(MethodInfo("squeezeend" , PropertyInfo(Variant::INT, "input_source_id" ))); |
72 | |
73 | ADD_SIGNAL(MethodInfo("visibility_state_changed" )); |
74 | ADD_SIGNAL(MethodInfo("reference_space_reset" )); |
75 | ADD_SIGNAL(MethodInfo("display_refresh_rate_changed" )); |
76 | |
77 | BIND_ENUM_CONSTANT(TARGET_RAY_MODE_UNKNOWN); |
78 | BIND_ENUM_CONSTANT(TARGET_RAY_MODE_GAZE); |
79 | BIND_ENUM_CONSTANT(TARGET_RAY_MODE_TRACKED_POINTER); |
80 | BIND_ENUM_CONSTANT(TARGET_RAY_MODE_SCREEN); |
81 | } |
82 | |