Path: blob/master/servers/rendering/renderer_compositor.cpp
20904 views
/**************************************************************************/1/* renderer_compositor.cpp */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#include "renderer_compositor.h"3132#include "core/config/project_settings.h"3334#ifndef XR_DISABLED35#include "servers/xr/xr_server.h"36#endif // XR_DISABLED3738RendererCompositor *RendererCompositor::singleton = nullptr;3940RendererCompositor *(*RendererCompositor::_create_func)() = nullptr;41bool RendererCompositor::low_end = false;4243RendererCompositor *RendererCompositor::create() {44return _create_func();45}4647void RendererCompositor::set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter) {48RenderingServer::SplashStretchMode stretch_mode = RenderingServer::map_scaling_option_to_stretch_mode(p_scale);49set_boot_image_with_stretch(p_image, p_color, stretch_mode, p_use_filter);50}5152bool RendererCompositor::is_xr_enabled() const {53return xr_enabled;54}5556RendererCompositor::RendererCompositor() {57ERR_FAIL_COND_MSG(singleton != nullptr, "A RendererCompositor singleton already exists.");58singleton = this;5960#ifndef XR_DISABLED61if (XRServer::get_xr_mode() == XRServer::XRMODE_DEFAULT) {62xr_enabled = GLOBAL_GET("xr/shaders/enabled");63} else {64xr_enabled = XRServer::get_xr_mode() == XRServer::XRMODE_ON;65}66#endif // XR_DISABLED67}6869RendererCompositor::~RendererCompositor() {70singleton = nullptr;71}727374