mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
More XR disable for Viewport and export.
This commit is contained in:
parent
d413181b8a
commit
9894256e3a
9 changed files with 30 additions and 0 deletions
|
@ -125,11 +125,13 @@ bool ShaderBakerExportPlugin::_begin_customize_resources(const Ref<EditorExportP
|
|||
customization_configuration_hash = to_hash.as_string().hash64();
|
||||
|
||||
BitField<RenderingShaderLibrary::FeatureBits> renderer_features = {};
|
||||
#ifndef XR_DISABLED
|
||||
bool xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
||||
renderer_features.set_flag(RenderingShaderLibrary::FEATURE_ADVANCED_BIT);
|
||||
if (xr_enabled) {
|
||||
renderer_features.set_flag(RenderingShaderLibrary::FEATURE_MULTIVIEW_BIT);
|
||||
}
|
||||
#endif // XR_DISABLED
|
||||
|
||||
int vrs_mode = GLOBAL_GET("rendering/vrs/mode");
|
||||
if (vrs_mode != 0) {
|
||||
|
|
|
@ -2177,7 +2177,9 @@ void EditorExportPlatformAndroid::get_export_options(List<ExportOption> *r_optio
|
|||
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "shader_baker/enabled"), false));
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,OpenXR"), XR_MODE_REGULAR, false, true));
|
||||
#endif // XR_DISABLED
|
||||
|
||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "gesture/swipe_to_dismiss"), false));
|
||||
|
||||
|
@ -3087,6 +3089,7 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
|
|||
command_line_strings.push_back(apk_expansion_public_key.strip_edges());
|
||||
}
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
int xr_mode_index = p_preset->get("xr_features/xr_mode");
|
||||
if (xr_mode_index == XR_MODE_OPENXR) {
|
||||
command_line_strings.push_back("--xr_mode_openxr");
|
||||
|
@ -3100,6 +3103,7 @@ void EditorExportPlatformAndroid::get_command_line_flags(const Ref<EditorExportP
|
|||
command_line_strings.push_back("--xr-mode");
|
||||
command_line_strings.push_back("off");
|
||||
}
|
||||
#endif // XR_DISABLED
|
||||
|
||||
bool immersive = p_preset->get("screen/immersive_mode");
|
||||
if (immersive) {
|
||||
|
|
|
@ -4768,6 +4768,7 @@ void Viewport::_propagate_exit_world_3d(Node *p_node) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
void Viewport::set_use_xr(bool p_use_xr) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
if (use_xr != p_use_xr) {
|
||||
|
@ -4794,6 +4795,7 @@ bool Viewport::is_using_xr() {
|
|||
ERR_READ_THREAD_GUARD_V(false);
|
||||
return use_xr;
|
||||
}
|
||||
#endif // XR_DISABLED
|
||||
|
||||
void Viewport::set_scaling_3d_mode(Scaling3DMode p_scaling_3d_mode) {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
|
@ -5060,8 +5062,10 @@ void Viewport::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_disable_3d", "disable"), &Viewport::set_disable_3d);
|
||||
ClassDB::bind_method(D_METHOD("is_3d_disabled"), &Viewport::is_3d_disabled);
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("set_use_xr", "use"), &Viewport::set_use_xr);
|
||||
ClassDB::bind_method(D_METHOD("is_using_xr"), &Viewport::is_using_xr);
|
||||
#endif // XR_DISABLED
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_scaling_3d_mode", "scaling_3d_mode"), &Viewport::set_scaling_3d_mode);
|
||||
ClassDB::bind_method(D_METHOD("get_scaling_3d_mode"), &Viewport::get_scaling_3d_mode);
|
||||
|
@ -5088,7 +5092,9 @@ void Viewport::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_vrs_texture"), &Viewport::get_vrs_texture);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "disable_3d"), "set_disable_3d", "is_3d_disabled");
|
||||
#ifndef XR_DISABLED
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_xr"), "set_use_xr", "is_using_xr");
|
||||
#endif // XR_DISABLED
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "own_world_3d"), "set_use_own_world_3d", "is_using_own_world_3d");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_3d", PROPERTY_HINT_RESOURCE_TYPE, "World3D"), "set_world_3d", "get_world_3d");
|
||||
#endif // _3D_DISABLED
|
||||
|
|
|
@ -791,7 +791,9 @@ public:
|
|||
#ifndef _3D_DISABLED
|
||||
private:
|
||||
// 3D audio, camera, physics, and world.
|
||||
#ifndef XR_DISABLED
|
||||
bool use_xr = false;
|
||||
#endif // XR_DISABLED
|
||||
friend class AudioListener3D;
|
||||
AudioListener3D *audio_listener_3d = nullptr;
|
||||
HashSet<AudioListener3D *> audio_listener_3d_set;
|
||||
|
@ -849,8 +851,10 @@ public:
|
|||
void set_use_own_world_3d(bool p_use_own_world_3d);
|
||||
bool is_using_own_world_3d() const;
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
void set_use_xr(bool p_use_xr);
|
||||
bool is_using_xr();
|
||||
#endif // XR_DISABLED
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
Viewport();
|
||||
|
|
|
@ -955,6 +955,7 @@ void RendererViewport::viewport_initialize(RID p_rid) {
|
|||
viewport->fsr_enabled = !RSG::rasterizer->is_low_end() && !viewport->disable_3d;
|
||||
}
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
void RendererViewport::viewport_set_use_xr(RID p_viewport, bool p_use_xr) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
ERR_FAIL_NULL(viewport);
|
||||
|
@ -972,6 +973,7 @@ void RendererViewport::viewport_set_use_xr(RID p_viewport, bool p_use_xr) {
|
|||
_configure_3d_render_buffers(viewport);
|
||||
}
|
||||
}
|
||||
#endif // !XR_DISABLED
|
||||
|
||||
void RendererViewport::viewport_set_scaling_3d_mode(RID p_viewport, RS::ViewportScaling3DMode p_mode) {
|
||||
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
|
||||
|
|
|
@ -216,7 +216,9 @@ public:
|
|||
RID viewport_allocate();
|
||||
void viewport_initialize(RID p_rid);
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
void viewport_set_use_xr(RID p_viewport, bool p_use_xr);
|
||||
#endif // XR_DISABLED
|
||||
|
||||
void viewport_set_size(RID p_viewport, int p_width, int p_height);
|
||||
|
||||
|
|
|
@ -2821,7 +2821,9 @@ void RenderingServer::_bind_methods() {
|
|||
/* VIEWPORT */
|
||||
|
||||
ClassDB::bind_method(D_METHOD("viewport_create"), &RenderingServer::viewport_create);
|
||||
#ifndef XR_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_use_xr", "viewport", "use_xr"), &RenderingServer::viewport_set_use_xr);
|
||||
#endif // XR_DISABLED
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_size", "viewport", "width", "height"), &RenderingServer::viewport_set_size);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_active", "viewport", "active"), &RenderingServer::viewport_set_active);
|
||||
ClassDB::bind_method(D_METHOD("viewport_set_parent_viewport", "viewport", "parent_viewport"), &RenderingServer::viewport_set_parent_viewport);
|
||||
|
@ -3756,7 +3758,9 @@ void RenderingServer::init() {
|
|||
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_renderable_lights", PROPERTY_HINT_RANGE, "2,256,1"), 32);
|
||||
GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/limits/opengl/max_lights_per_object", PROPERTY_HINT_RANGE, "2,1024,1"), 8);
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
GLOBAL_DEF_RST_BASIC("xr/shaders/enabled", false);
|
||||
#endif // XR_DISABLED
|
||||
|
||||
GLOBAL_DEF("debug/shader_language/warnings/enable", true);
|
||||
GLOBAL_DEF("debug/shader_language/warnings/treat_warnings_as_errors", false);
|
||||
|
|
|
@ -978,7 +978,10 @@ public:
|
|||
return VIEWPORT_SCALING_3D_TYPE_NONE;
|
||||
}
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
virtual void viewport_set_use_xr(RID p_viewport, bool p_use_xr) = 0;
|
||||
#endif // !XR_DISABLED
|
||||
|
||||
virtual void viewport_set_size(RID p_viewport, int p_width, int p_height) = 0;
|
||||
virtual void viewport_set_active(RID p_viewport, bool p_active) = 0;
|
||||
virtual void viewport_set_parent_viewport(RID p_viewport, RID p_parent_viewport) = 0;
|
||||
|
|
|
@ -693,7 +693,10 @@ public:
|
|||
|
||||
FUNCRIDSPLIT(viewport)
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
FUNC2(viewport_set_use_xr, RID, bool)
|
||||
#endif // XR_DISABLED
|
||||
|
||||
FUNC3(viewport_set_size, RID, int, int)
|
||||
|
||||
FUNC2(viewport_set_active, RID, bool)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue