diff options
Diffstat (limited to 'servers/xr')
-rw-r--r-- | servers/xr/xr_interface.cpp | 14 | ||||
-rw-r--r-- | servers/xr/xr_interface.h | 11 | ||||
-rw-r--r-- | servers/xr/xr_interface_extension.cpp | 8 | ||||
-rw-r--r-- | servers/xr/xr_interface_extension.h | 6 | ||||
-rw-r--r-- | servers/xr/xr_positional_tracker.cpp | 8 |
5 files changed, 36 insertions, 11 deletions
diff --git a/servers/xr/xr_interface.cpp b/servers/xr/xr_interface.cpp index 9968a47b0c..7f3d8668a4 100644 --- a/servers/xr/xr_interface.cpp +++ b/servers/xr/xr_interface.cpp @@ -75,6 +75,10 @@ void XRInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_transform_for_view", "view", "cam_transform"), &XRInterface::get_transform_for_view); ClassDB::bind_method(D_METHOD("get_projection_for_view", "view", "aspect", "near", "far"), &XRInterface::get_projection_for_view); + /** environment blend mode. */ + ClassDB::bind_method(D_METHOD("get_supported_environment_blend_modes"), &XRInterface::get_supported_environment_blend_modes); + ClassDB::bind_method(D_METHOD("set_environment_blend_mode", "mode"), &XRInterface::set_environment_blend_mode); + ADD_GROUP("AR", "ar_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ar_is_anchor_detection_enabled"), "set_anchor_detection_is_enabled", "get_anchor_detection_is_enabled"); @@ -97,6 +101,10 @@ void XRInterface::_bind_methods() { BIND_ENUM_CONSTANT(XR_PLAY_AREA_SITTING); BIND_ENUM_CONSTANT(XR_PLAY_AREA_ROOMSCALE); BIND_ENUM_CONSTANT(XR_PLAY_AREA_STAGE); + + BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_OPAQUE); + BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_ADDITIVE); + BIND_ENUM_CONSTANT(XR_ENV_BLEND_MODE_ALPHA_BLEND); }; bool XRInterface::is_primary() { @@ -273,3 +281,9 @@ XRInterface::TrackingStatus XRInterface::get_tracking_status() const { void XRInterface::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) { } + +Array XRInterface::get_supported_environment_blend_modes() { + Array default_blend_modes; + default_blend_modes.push_back(XR_ENV_BLEND_MODE_OPAQUE); + return default_blend_modes; +} diff --git a/servers/xr/xr_interface.h b/servers/xr/xr_interface.h index 6f70f75772..c32455f466 100644 --- a/servers/xr/xr_interface.h +++ b/servers/xr/xr_interface.h @@ -78,6 +78,12 @@ public: XR_PLAY_AREA_STAGE, /* Same as roomscale but origin point is fixed to the center of the physical space, XRServer.center_on_hmd disabled */ }; + enum EnvironmentBlendMode { + XR_ENV_BLEND_MODE_OPAQUE, /* You cannot see the real world, VR like */ + XR_ENV_BLEND_MODE_ADDITIVE, /* You can see the real world, AR like */ + XR_ENV_BLEND_MODE_ALPHA_BLEND, /* Real world is passed through where alpha channel is 0.0 and gradually blends to opaque for value 1.0. */ + }; + protected: _THREAD_SAFE_CLASS_ @@ -138,6 +144,10 @@ public: virtual bool start_passthrough() { return false; } virtual void stop_passthrough() {} + /** environment blend mode. */ + virtual Array get_supported_environment_blend_modes(); + virtual bool set_environment_blend_mode(EnvironmentBlendMode mode) { return false; } + XRInterface(); ~XRInterface(); @@ -151,5 +161,6 @@ private: VARIANT_ENUM_CAST(XRInterface::Capabilities); VARIANT_ENUM_CAST(XRInterface::TrackingStatus); VARIANT_ENUM_CAST(XRInterface::PlayAreaMode); +VARIANT_ENUM_CAST(XRInterface::EnvironmentBlendMode); #endif // XR_INTERFACE_H diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp index 63e862f605..0ff59d2a39 100644 --- a/servers/xr/xr_interface_extension.cpp +++ b/servers/xr/xr_interface_extension.cpp @@ -136,9 +136,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam } XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const { - uint32_t status = XR_UNKNOWN_TRACKING; + XRInterface::TrackingStatus status = XR_UNKNOWN_TRACKING; GDVIRTUAL_CALL(_get_tracking_status, status); - return TrackingStatus(status); + return status; } void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) { @@ -152,9 +152,9 @@ bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_m } XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const { - uint32_t mode = XR_PLAY_AREA_UNKNOWN; + XRInterface::PlayAreaMode mode = XR_PLAY_AREA_UNKNOWN; GDVIRTUAL_CALL(_get_play_area_mode, mode); - return XRInterface::PlayAreaMode(mode); + return mode; } bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) { diff --git a/servers/xr/xr_interface_extension.h b/servers/xr/xr_interface_extension.h index 39cd284e5c..454a50cb28 100644 --- a/servers/xr/xr_interface_extension.h +++ b/servers/xr/xr_interface_extension.h @@ -71,7 +71,7 @@ public: GDVIRTUAL0RC(PackedStringArray, _get_suggested_tracker_names); GDVIRTUAL1RC(PackedStringArray, _get_suggested_pose_names, const StringName &); - GDVIRTUAL0RC(uint32_t, _get_tracking_status); + GDVIRTUAL0RC(XRInterface::TrackingStatus, _get_tracking_status); GDVIRTUAL6(_trigger_haptic_pulse, const String &, const StringName &, double, double, double, double); /** specific to VR **/ @@ -81,8 +81,8 @@ public: virtual PackedVector3Array get_play_area() const override; /* if available, returns an array of vectors denoting the play area the player can move around in */ GDVIRTUAL1RC(bool, _supports_play_area_mode, XRInterface::PlayAreaMode); - GDVIRTUAL0RC(uint32_t, _get_play_area_mode); - GDVIRTUAL1RC(bool, _set_play_area_mode, uint32_t); + GDVIRTUAL0RC(XRInterface::PlayAreaMode, _get_play_area_mode); + GDVIRTUAL1RC(bool, _set_play_area_mode, XRInterface::PlayAreaMode); GDVIRTUAL0RC(PackedVector3Array, _get_play_area); /** specific to AR **/ diff --git a/servers/xr/xr_positional_tracker.cpp b/servers/xr/xr_positional_tracker.cpp index 87c1697a35..ffb89fc385 100644 --- a/servers/xr/xr_positional_tracker.cpp +++ b/servers/xr/xr_positional_tracker.cpp @@ -67,8 +67,8 @@ void XRPositionalTracker::_bind_methods() { ClassDB::bind_method(D_METHOD("set_input", "name", "value"), &XRPositionalTracker::set_input); ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::STRING, "name"))); ADD_SIGNAL(MethodInfo("button_released", PropertyInfo(Variant::STRING, "name"))); - ADD_SIGNAL(MethodInfo("input_value_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value"))); - ADD_SIGNAL(MethodInfo("input_axis_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector"))); + ADD_SIGNAL(MethodInfo("input_float_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "value"))); + ADD_SIGNAL(MethodInfo("input_vector2_changed", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::VECTOR2, "vector"))); ADD_SIGNAL(MethodInfo("profile_changed", PropertyInfo(Variant::STRING, "role"))); }; @@ -203,12 +203,12 @@ void XRPositionalTracker::set_input(const StringName &p_action_name, const Varia // TODO discuss whether we also want to create and emit an InputEventXRButton event } break; case Variant::FLOAT: { - emit_signal(SNAME("input_value_changed"), p_action_name, p_value); + emit_signal(SNAME("input_float_changed"), p_action_name, p_value); // TODO discuss whether we also want to create and emit an InputEventXRValue event } break; case Variant::VECTOR2: { - emit_signal(SNAME("input_axis_changed"), p_action_name, p_value); + emit_signal(SNAME("input_vector2_changed"), p_action_name, p_value); // TODO discuss whether we also want to create and emit an InputEventXRAxis event } break; |