feat: updated engine
This commit is contained in:
parent
cbe99774ff
commit
f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions
|
|
@ -30,13 +30,18 @@
|
|||
|
||||
#include "openxr_interface.h"
|
||||
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
|
||||
#include "action_map/openxr_action_map.h"
|
||||
#include "extensions/openxr_eye_gaze_interaction.h"
|
||||
#include "extensions/openxr_hand_interaction_extension.h"
|
||||
#include "extensions/openxr_performance_settings_extension.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
#include "extensions/openxr_user_presence_extension.h"
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
#include "core/io/resource_saver.h"
|
||||
#include "core/object/class_db.h"
|
||||
#include "servers/display/display_server.h"
|
||||
#include "servers/rendering/rendering_server_types.h"
|
||||
|
||||
#include <openxr/openxr.h>
|
||||
|
||||
|
|
@ -58,6 +63,12 @@ void OpenXRInterface::_bind_methods() {
|
|||
// State
|
||||
ClassDB::bind_method(D_METHOD("get_session_state"), &OpenXRInterface::get_session_state);
|
||||
|
||||
// User presence
|
||||
ADD_SIGNAL(MethodInfo("user_presence_changed", PropertyInfo(Variant::BOOL, "is_user_present")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("is_user_presence_supported"), &OpenXRInterface::is_user_presence_supported);
|
||||
ClassDB::bind_method(D_METHOD("is_user_present"), &OpenXRInterface::is_user_present);
|
||||
|
||||
// Display refresh rate
|
||||
ClassDB::bind_method(D_METHOD("get_display_refresh_rate"), &OpenXRInterface::get_display_refresh_rate);
|
||||
ClassDB::bind_method(D_METHOD("set_display_refresh_rate", "refresh_rate"), &OpenXRInterface::set_display_refresh_rate);
|
||||
|
|
@ -79,6 +90,10 @@ void OpenXRInterface::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_foveation_dynamic", "foveation_dynamic"), &OpenXRInterface::set_foveation_dynamic);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "foveation_dynamic"), "set_foveation_dynamic", "get_foveation_dynamic");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_foveation_with_subsampled_images"), &OpenXRInterface::get_foveation_with_subsampled_images);
|
||||
ClassDB::bind_method(D_METHOD("set_foveation_with_subsampled_images", "enabled"), &OpenXRInterface::set_foveation_with_subsampled_images);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "foveation_with_subsampled_images"), "set_foveation_with_subsampled_images", "get_foveation_with_subsampled_images");
|
||||
|
||||
// Action sets
|
||||
ClassDB::bind_method(D_METHOD("is_action_set_active", "name"), &OpenXRInterface::is_action_set_active);
|
||||
ClassDB::bind_method(D_METHOD("set_action_set_active", "name", "active"), &OpenXRInterface::set_action_set_active);
|
||||
|
|
@ -1015,6 +1030,22 @@ void OpenXRInterface::set_foveation_dynamic(bool p_foveation_dynamic) {
|
|||
}
|
||||
}
|
||||
|
||||
bool OpenXRInterface::get_foveation_with_subsampled_images() const {
|
||||
if (openxr_api == nullptr) {
|
||||
return false;
|
||||
} else {
|
||||
return openxr_api->get_foveation_with_subsampled_images();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenXRInterface::set_foveation_with_subsampled_images(bool p_enabled) {
|
||||
if (openxr_api == nullptr) {
|
||||
return;
|
||||
} else {
|
||||
openxr_api->set_foveation_with_subsampled_images(p_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
Size2 OpenXRInterface::get_render_target_size() {
|
||||
if (openxr_api == nullptr) {
|
||||
return Size2();
|
||||
|
|
@ -1246,13 +1277,13 @@ bool OpenXRInterface::pre_draw_viewport(RID p_render_target) {
|
|||
}
|
||||
}
|
||||
|
||||
Vector<BlitToScreen> OpenXRInterface::post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) {
|
||||
Vector<BlitToScreen> blit_to_screen;
|
||||
Vector<RenderingServerTypes::BlitToScreen> OpenXRInterface::post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) {
|
||||
Vector<RenderingServerTypes::BlitToScreen> blit_to_screen;
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
// If separate HMD we should output one eye to screen
|
||||
if (p_screen_rect != Rect2()) {
|
||||
BlitToScreen blit;
|
||||
RenderingServerTypes::BlitToScreen blit;
|
||||
|
||||
blit.render_target = p_render_target;
|
||||
blit.multi_view.use_layer = true;
|
||||
|
|
@ -1448,6 +1479,26 @@ OpenXRInterface::SessionState OpenXRInterface::get_session_state() {
|
|||
return SESSION_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/** User Presence. */
|
||||
bool OpenXRInterface::is_user_presence_supported() const {
|
||||
if (!openxr_api || !openxr_api->is_initialized()) {
|
||||
return false;
|
||||
} else {
|
||||
OpenXRUserPresenceExtension *user_presence_ext = OpenXRUserPresenceExtension::get_singleton();
|
||||
return user_presence_ext && user_presence_ext->is_active();
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenXRInterface::is_user_present() const {
|
||||
// If extension is unavailable or unsupported, we default to user is present.
|
||||
if (!is_user_presence_supported()) {
|
||||
return true;
|
||||
} else {
|
||||
OpenXRUserPresenceExtension *user_presence_ext = OpenXRUserPresenceExtension::get_singleton();
|
||||
return user_presence_ext->is_user_present();
|
||||
}
|
||||
}
|
||||
|
||||
/** Hand tracking. */
|
||||
void OpenXRInterface::set_motion_range(const Hand p_hand, const HandMotionRange p_motion_range) {
|
||||
ERR_FAIL_INDEX(p_hand, HAND_MAX);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue