mirror of
https://github.com/godotengine/godot.git
synced 2025-03-19 23:53:32 +08:00
Allow to compile the engine without XR support
This commit is contained in:
parent
cc7a951140
commit
aea559b39a
@ -186,7 +186,6 @@ opts.Add(BoolVariable("vulkan", "Enable the vulkan rendering driver", True))
|
||||
opts.Add(BoolVariable("opengl3", "Enable the OpenGL/GLES3 rendering driver", True))
|
||||
opts.Add(BoolVariable("d3d12", "Enable the Direct3D 12 rendering driver on supported platforms", False))
|
||||
opts.Add(BoolVariable("metal", "Enable the Metal rendering driver on supported platforms (Apple arm64 only)", False))
|
||||
opts.Add(BoolVariable("openxr", "Enable the OpenXR driver", True))
|
||||
opts.Add(BoolVariable("use_volk", "Use the volk library to load the Vulkan loader dynamically", True))
|
||||
opts.Add(BoolVariable("disable_exceptions", "Force disabling exception handling code", True))
|
||||
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
|
||||
@ -220,6 +219,7 @@ opts.Add("vsproj_name", "Name of the Visual Studio solution", "godot")
|
||||
opts.Add("import_env_vars", "A comma-separated list of environment variables to copy from the outer environment.", "")
|
||||
opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
|
||||
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
|
||||
opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False))
|
||||
opts.Add("build_profile", "Path to a file containing a feature build profile", "")
|
||||
opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True))
|
||||
opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True))
|
||||
@ -995,6 +995,7 @@ if env["disable_3d"]:
|
||||
Exit(255)
|
||||
else:
|
||||
env.Append(CPPDEFINES=["_3D_DISABLED"])
|
||||
env["disable_xr"] = True
|
||||
if env["disable_advanced_gui"]:
|
||||
if env.editor_build:
|
||||
print_error(
|
||||
@ -1003,6 +1004,8 @@ if env["disable_advanced_gui"]:
|
||||
Exit(255)
|
||||
else:
|
||||
env.Append(CPPDEFINES=["ADVANCED_GUI_DISABLED"])
|
||||
if env["disable_xr"]:
|
||||
env.Append(CPPDEFINES=["XR_DISABLED"])
|
||||
if env["minizip"]:
|
||||
env.Append(CPPDEFINES=["MINIZIP_ENABLED"])
|
||||
if env["brotli"]:
|
||||
|
@ -46,7 +46,7 @@ const char *EditorBuildProfile::build_option_identifiers[BUILD_OPTION_MAX] = {
|
||||
"disable_2d_physics",
|
||||
"disable_3d_physics",
|
||||
"disable_navigation",
|
||||
"openxr",
|
||||
"disable_xr",
|
||||
"rendering_device", // FIXME: there's no scons option to disable rendering device
|
||||
"opengl3",
|
||||
"vulkan",
|
||||
@ -82,7 +82,7 @@ const bool EditorBuildProfile::build_option_disable_values[BUILD_OPTION_MAX] = {
|
||||
true, // PHYSICS_2D
|
||||
true, // PHYSICS_3D
|
||||
true, // NAVIGATION
|
||||
false, // XR
|
||||
true, // XR
|
||||
false, // RENDERING_DEVICE
|
||||
false, // OPENGL
|
||||
false, // VULKAN
|
||||
|
@ -587,7 +587,7 @@ EditorRunBar::EditorRunBar() {
|
||||
run_native->connect("native_run", callable_mp(this, &EditorRunBar::_run_native));
|
||||
|
||||
bool add_play_xr_mode_options = false;
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (OS::get_singleton()->has_feature("xr_editor") &&
|
||||
(XRServer::get_xr_mode() == XRServer::XRMODE_ON ||
|
||||
(XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT && GLOBAL_GET("xr/openxr/enabled")))) {
|
||||
@ -596,7 +596,7 @@ EditorRunBar::EditorRunBar() {
|
||||
// either regular mode or XR mode.
|
||||
add_play_xr_mode_options = true;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
if (add_play_xr_mode_options) {
|
||||
MenuButton *menu_button = memnew(MenuButton);
|
||||
|
@ -713,9 +713,9 @@ Error Main::test_setup() {
|
||||
|
||||
/** INITIALIZE SERVERS **/
|
||||
register_server_types();
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
XRServer::set_xr_mode(XRServer::XRMODE_OFF); // Skip in tests.
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
initialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS);
|
||||
GDExtensionManager::get_singleton()->initialize_extensions(GDExtension::INITIALIZATION_LEVEL_SERVERS);
|
||||
|
||||
@ -1734,7 +1734,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
OS::get_singleton()->disable_crash_handler();
|
||||
} else if (arg == "--skip-breakpoints") {
|
||||
skip_breakpoints = true;
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
} else if (arg == "--xr-mode") {
|
||||
if (N) {
|
||||
String xr_mode = N->get().to_lower();
|
||||
@ -1753,7 +1753,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
OS::get_singleton()->print("Missing --xr-mode argument, aborting.\n");
|
||||
goto error;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
} else if (arg == "--benchmark") {
|
||||
OS::get_singleton()->set_use_benchmark(true);
|
||||
} else if (arg == "--benchmark-file") {
|
||||
@ -3196,7 +3196,7 @@ Error Main::setup2(bool p_show_boot_logo) {
|
||||
OS::get_singleton()->benchmark_end_measure("Servers", "Audio");
|
||||
}
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
/* Initialize XR Server */
|
||||
|
||||
{
|
||||
@ -3206,7 +3206,7 @@ Error Main::setup2(bool p_show_boot_logo) {
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("Servers", "XR");
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("Startup", "Servers");
|
||||
|
||||
@ -4427,9 +4427,9 @@ bool Main::iteration() {
|
||||
bool exit = false;
|
||||
|
||||
// process all our active interfaces
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
XRServer::get_singleton()->_process();
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
NavigationServer2D::get_singleton()->sync();
|
||||
NavigationServer3D::get_singleton()->sync();
|
||||
@ -4683,13 +4683,13 @@ void Main::cleanup(bool p_force) {
|
||||
//clear global shader variables before scene and other graphics stuff are deinitialized.
|
||||
rendering_server->global_shader_parameters_clear();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (xr_server) {
|
||||
// Now that we're unregistering properly in plugins we need to keep access to xr_server for a little longer
|
||||
// We do however unset our primary interface
|
||||
xr_server->set_primary_interface(Ref<XRInterface>());
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_EDITOR);
|
||||
|
@ -1,5 +1,5 @@
|
||||
def can_build(env, platform):
|
||||
return not env["disable_3d"]
|
||||
return not env["disable_xr"]
|
||||
|
||||
|
||||
def configure(env):
|
||||
|
@ -1,8 +1,8 @@
|
||||
def can_build(env, platform):
|
||||
if platform in ("linuxbsd", "windows", "android", "macos"):
|
||||
return env["openxr"] and not env["disable_3d"]
|
||||
return not env["disable_xr"]
|
||||
else:
|
||||
# not supported on these platforms
|
||||
# Not supported on these platforms.
|
||||
return False
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "../openxr_interface.h"
|
||||
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/xr_nodes.h"
|
||||
#include "scene/3d/xr/xr_nodes.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
#include "platform/android/api/java_class_wrapper.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "../extensions/openxr_visibility_mask_extension.h"
|
||||
#include "../openxr_interface.h"
|
||||
#include "scene/3d/xr_nodes.h"
|
||||
#include "scene/3d/xr/xr_nodes.h"
|
||||
|
||||
void OpenXRVisibilityMask::_bind_methods() {
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
def can_build(env, platform):
|
||||
return env["opengl3"] and not env["disable_3d"]
|
||||
return env["opengl3"] and not env["disable_xr"]
|
||||
|
||||
|
||||
def configure(env):
|
||||
|
@ -272,7 +272,7 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env,
|
||||
|
||||
if (step.get() == STEP_SHOW_LOGO) {
|
||||
bool xr_enabled = false;
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
// Unlike PCVR, there's no additional 2D screen onto which to render the boot logo,
|
||||
// so we skip this step if xr is enabled.
|
||||
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
||||
@ -280,7 +280,7 @@ JNIEXPORT jboolean JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv *env,
|
||||
} else {
|
||||
xr_enabled = XRServer::get_xr_mode() == XRServer::XRMODE_ON;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
if (!xr_enabled) {
|
||||
Main::setup_boot_logo();
|
||||
}
|
||||
|
@ -7,3 +7,5 @@ env.add_source_files(env.scene_sources, "*.cpp")
|
||||
|
||||
# Chain load SCsubs
|
||||
SConscript("physics/SCsub")
|
||||
if not env["disable_xr"]:
|
||||
SConscript("xr/SCsub")
|
||||
|
6
scene/3d/xr/SCsub
Normal file
6
scene/3d/xr/SCsub
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
from misc.utility.scons_hints import *
|
||||
|
||||
Import("env")
|
||||
|
||||
env.add_source_files(env.scene_sources, "*.cpp")
|
@ -31,7 +31,7 @@
|
||||
#ifndef XR_FACE_MODIFIER_3D_H
|
||||
#define XR_FACE_MODIFIER_3D_H
|
||||
|
||||
#include "mesh_instance_3d.h"
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
|
||||
/**
|
@ -701,7 +701,7 @@ void Viewport::_process_picking() {
|
||||
physics_picking_events.clear();
|
||||
return;
|
||||
}
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (use_xr) {
|
||||
if (XRServer::get_singleton() != nullptr) {
|
||||
Ref<XRInterface> xr_interface = XRServer::get_singleton()->get_primary_interface();
|
||||
@ -712,7 +712,7 @@ void Viewport::_process_picking() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // XR_DISABLED
|
||||
|
||||
_drop_physics_mouseover(true);
|
||||
|
||||
@ -1058,7 +1058,7 @@ bool Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override,
|
||||
}
|
||||
|
||||
Size2i Viewport::_get_size() const {
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (use_xr) {
|
||||
if (XRServer::get_singleton() != nullptr) {
|
||||
Ref<XRInterface> xr_interface = XRServer::get_singleton()->get_primary_interface();
|
||||
@ -1069,7 +1069,7 @@ Size2i Viewport::_get_size() const {
|
||||
}
|
||||
return Size2i();
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
return size;
|
||||
}
|
||||
|
@ -293,10 +293,10 @@
|
||||
#include "scene/3d/visible_on_screen_notifier_3d.h"
|
||||
#include "scene/3d/voxel_gi.h"
|
||||
#include "scene/3d/world_environment.h"
|
||||
#include "scene/3d/xr_body_modifier_3d.h"
|
||||
#include "scene/3d/xr_face_modifier_3d.h"
|
||||
#include "scene/3d/xr_hand_modifier_3d.h"
|
||||
#include "scene/3d/xr_nodes.h"
|
||||
#include "scene/3d/xr/xr_body_modifier_3d.h"
|
||||
#include "scene/3d/xr/xr_face_modifier_3d.h"
|
||||
#include "scene/3d/xr/xr_hand_modifier_3d.h"
|
||||
#include "scene/3d/xr/xr_nodes.h"
|
||||
#include "scene/animation/root_motion_view.h"
|
||||
#include "scene/resources/3d/box_shape_3d.h"
|
||||
#include "scene/resources/3d/capsule_shape_3d.h"
|
||||
@ -555,6 +555,7 @@ void register_scene_types() {
|
||||
GDREGISTER_VIRTUAL_CLASS(GeometryInstance3D);
|
||||
GDREGISTER_CLASS(Camera3D);
|
||||
GDREGISTER_CLASS(AudioListener3D);
|
||||
#ifndef XR_DISABLED
|
||||
GDREGISTER_CLASS(XRCamera3D);
|
||||
GDREGISTER_CLASS(XRNode3D);
|
||||
GDREGISTER_CLASS(XRController3D);
|
||||
@ -563,6 +564,7 @@ void register_scene_types() {
|
||||
GDREGISTER_CLASS(XRBodyModifier3D);
|
||||
GDREGISTER_CLASS(XRHandModifier3D);
|
||||
GDREGISTER_CLASS(XRFaceModifier3D);
|
||||
#endif // XR_DISABLED
|
||||
GDREGISTER_CLASS(MeshInstance3D);
|
||||
GDREGISTER_CLASS(OccluderInstance3D);
|
||||
GDREGISTER_ABSTRACT_CLASS(Occluder3D);
|
||||
|
@ -343,6 +343,7 @@ def generate_scu_files(max_includes_per_scu):
|
||||
process_folder(["scene/3d"])
|
||||
process_folder(["scene/3d/physics"])
|
||||
process_folder(["scene/3d/physics/joints"])
|
||||
process_folder(["scene/3d/xr"])
|
||||
process_folder(["scene/animation"])
|
||||
process_folder(["scene/gui"])
|
||||
process_folder(["scene/main"])
|
||||
|
@ -29,8 +29,10 @@ SConscript("text/SCsub")
|
||||
if not env["disable_3d"]:
|
||||
env.add_source_files(env.servers_sources, "physics_server_3d.cpp")
|
||||
env.add_source_files(env.servers_sources, "physics_server_3d_wrap_mt.cpp")
|
||||
SConscript("xr/SCsub")
|
||||
env.add_source_files(env.servers_sources, "xr_server.cpp")
|
||||
|
||||
if not env["disable_xr"]:
|
||||
env.add_source_files(env.servers_sources, "xr_server.cpp")
|
||||
SConscript("xr/SCsub")
|
||||
|
||||
lib = env.add_library("servers", env.servers_sources)
|
||||
|
||||
|
@ -307,6 +307,7 @@ void register_server_types() {
|
||||
|
||||
PhysicsServer3DManager::get_singleton()->register_server("Dummy", callable_mp_static(_create_dummy_physics_server_3d));
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
GDREGISTER_ABSTRACT_CLASS(XRInterface);
|
||||
GDREGISTER_CLASS(XRVRS);
|
||||
GDREGISTER_CLASS(XRBodyTracker);
|
||||
@ -318,6 +319,7 @@ void register_server_types() {
|
||||
GDREGISTER_CLASS(XRPositionalTracker);
|
||||
GDREGISTER_CLASS(XRServer);
|
||||
GDREGISTER_ABSTRACT_CLASS(XRTracker);
|
||||
#endif // XR_DISABLED
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
GDREGISTER_ABSTRACT_CLASS(NavigationServer3D);
|
||||
@ -358,7 +360,9 @@ void register_server_singletons() {
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer2D", PhysicsServer2D::get_singleton(), "PhysicsServer2D"));
|
||||
#ifndef _3D_DISABLED
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer3D", PhysicsServer3D::get_singleton(), "PhysicsServer3D"));
|
||||
#ifndef XR_DISABLED
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("XRServer", XRServer::get_singleton(), "XRServer"));
|
||||
#endif // XR_DISABLED
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
OS::get_singleton()->benchmark_end_measure("Servers", "Register Singletons");
|
||||
|
@ -50,13 +50,13 @@ RendererCompositor::RendererCompositor() {
|
||||
ERR_FAIL_COND_MSG(singleton != nullptr, "A RendererCompositor singleton already exists.");
|
||||
singleton = this;
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {
|
||||
xr_enabled = GLOBAL_GET("xr/shaders/enabled");
|
||||
} else {
|
||||
xr_enabled = XRServer::get_xr_mode() == XRServer::XRMODE_ON;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
}
|
||||
|
||||
RendererCompositor::~RendererCompositor() {
|
||||
|
@ -135,7 +135,7 @@ void VRS::update_vrs_texture(RID p_vrs_fb, RID p_render_target) {
|
||||
copy_vrs(rd_texture, p_vrs_fb, layers > 1);
|
||||
}
|
||||
}
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
} else if (vrs_mode == RS::VIEWPORT_VRS_XR) {
|
||||
Ref<XRInterface> interface = XRServer::get_singleton()->get_primary_interface();
|
||||
if (interface.is_valid()) {
|
||||
@ -150,7 +150,7 @@ void VRS::update_vrs_texture(RID p_vrs_fb, RID p_render_target) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
}
|
||||
|
||||
if (vrs_update_mode == RS::VIEWPORT_VRS_UPDATE_ONCE) {
|
||||
|
@ -2726,6 +2726,7 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu
|
||||
}
|
||||
|
||||
camera_data.set_camera(transform, projection, is_orthogonal, is_frustum, vaspect, jitter, taa_frame_count, camera->visible_layers);
|
||||
#ifndef XR_DISABLED
|
||||
} else {
|
||||
XRServer *xr_server = XRServer::get_singleton();
|
||||
|
||||
@ -2763,6 +2764,7 @@ void RendererSceneCull::render_camera(const Ref<RenderSceneBuffers> &p_render_bu
|
||||
} else {
|
||||
// this won't be called (see fail check above) but keeping this comment to indicate we may support more then 2 views in the future...
|
||||
}
|
||||
#endif // XR_DISABLED
|
||||
}
|
||||
|
||||
RID environment = _render_get_environment(p_camera, p_scenario);
|
||||
|
@ -47,10 +47,6 @@
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
#include "servers/rendering/storage/utilities.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/xr/xr_interface.h"
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
class RenderingLightCuller;
|
||||
|
||||
class RendererSceneCull : public RenderingMethod {
|
||||
|
@ -38,6 +38,10 @@
|
||||
#include "rendering_server_globals.h"
|
||||
#include "storage/texture_storage.h"
|
||||
|
||||
#ifndef XR_DISABLED
|
||||
#include "servers/xr/xr_interface.h"
|
||||
#endif // XR_DISABLED
|
||||
|
||||
static Transform2D _canvas_get_transform(RendererViewport::Viewport *p_viewport, RendererCanvasCull::Canvas *p_canvas, RendererViewport::Viewport::CanvasData *p_canvas_data, const Vector2 &p_vp_size) {
|
||||
Transform2D xf = p_viewport->global_transform;
|
||||
|
||||
@ -272,9 +276,11 @@ void RendererViewport::_draw_3d(Viewport *p_viewport) {
|
||||
RENDER_TIMESTAMP("> Render 3D Scene");
|
||||
|
||||
Ref<XRInterface> xr_interface;
|
||||
#ifndef XR_DISABLED
|
||||
if (p_viewport->use_xr && XRServer::get_singleton() != nullptr) {
|
||||
xr_interface = XRServer::get_singleton()->get_primary_interface();
|
||||
}
|
||||
#endif // XR_DISABLED
|
||||
|
||||
if (p_viewport->use_occlusion_culling) {
|
||||
if (p_viewport->occlusion_buffer_dirty) {
|
||||
@ -713,7 +719,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) {
|
||||
void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
timestamp_vp_map.clear();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
// get our xr interface in case we need it
|
||||
Ref<XRInterface> xr_interface;
|
||||
XRServer *xr_server = XRServer::get_singleton();
|
||||
@ -724,7 +730,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
// retrieve the interface responsible for rendering
|
||||
xr_interface = xr_server->get_primary_interface();
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
RSG::texture_storage->set_default_clear_color(GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
|
||||
@ -757,7 +763,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
|
||||
bool visible = vp->viewport_to_screen_rect != Rect2();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (vp->use_xr) {
|
||||
if (xr_interface.is_valid()) {
|
||||
// Ignore update mode we have to commit frames to our XR interface
|
||||
@ -772,7 +778,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
vp->size = Size2();
|
||||
}
|
||||
} else
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
{
|
||||
if (vp->update_mode == RS::VIEWPORT_UPDATE_ALWAYS || vp->update_mode == RS::VIEWPORT_UPDATE_ONCE) {
|
||||
visible = true;
|
||||
@ -811,7 +817,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
RENDER_TIMESTAMP("> Render Viewport " + itos(i));
|
||||
|
||||
RSG::texture_storage->render_target_set_as_unused(vp->render_target);
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
if (vp->use_xr && xr_interface.is_valid()) {
|
||||
// Inform XR interface we're about to render its viewport,
|
||||
// if this returns false we don't render.
|
||||
@ -860,7 +866,7 @@ void RendererViewport::draw_viewports(bool p_swap_buffers) {
|
||||
}
|
||||
}
|
||||
} else
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
{
|
||||
RSG::scene->set_debug_draw_mode(vp->debug_draw);
|
||||
|
||||
|
@ -37,10 +37,6 @@
|
||||
#include "servers/rendering_server.h"
|
||||
#include "storage/render_scene_buffers.h"
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#include "servers/xr/xr_interface.h"
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
class RendererViewport {
|
||||
public:
|
||||
struct CanvasBase {
|
||||
|
@ -34,13 +34,13 @@
|
||||
#include "servers/rendering/storage/render_scene_buffers.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
#ifdef _3D_DISABLED
|
||||
#ifdef XR_DISABLED
|
||||
// RendererSceneCull::render_camera is empty when 3D is disabled, but
|
||||
// it and RenderingMethod::render_camera have a parameter for XRInterface.
|
||||
#define XRInterface RefCounted
|
||||
#else // 3D enabled
|
||||
#else
|
||||
#include "servers/xr/xr_interface.h"
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
class RenderingMethod {
|
||||
public:
|
||||
|
@ -87,13 +87,13 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
|
||||
|
||||
RSG::rasterizer->end_frame(p_swap_buffers);
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef XR_DISABLED
|
||||
XRServer *xr_server = XRServer::get_singleton();
|
||||
if (xr_server != nullptr) {
|
||||
// let our XR server know we're done so we can get our frame timing
|
||||
xr_server->end_frame();
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // XR_DISABLED
|
||||
|
||||
RSG::canvas->update_visibility_notifiers();
|
||||
RSG::scene->update_visibility_notifiers();
|
||||
|
Loading…
x
Reference in New Issue
Block a user