Path: blob/master/servers/rendering/renderer_compositor.h
10277 views
/**************************************************************************/1/* renderer_compositor.h */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#pragma once3132#include "servers/rendering/environment/renderer_fog.h"33#include "servers/rendering/environment/renderer_gi.h"34#include "servers/rendering/renderer_canvas_render.h"35#include "servers/rendering/storage/light_storage.h"36#include "servers/rendering/storage/material_storage.h"37#include "servers/rendering/storage/mesh_storage.h"38#include "servers/rendering/storage/particles_storage.h"39#include "servers/rendering/storage/texture_storage.h"40#include "servers/rendering/storage/utilities.h"4142class RendererSceneRender;43struct BlitToScreen {44RID render_target;45Rect2 src_rect = Rect2(0.0, 0.0, 1.0, 1.0);46Rect2i dst_rect;4748struct {49bool use_layer = false;50uint32_t layer = 0;51} multi_view;5253struct {54//lens distorted parameters for VR55bool apply = false;56Vector2 eye_center;57float k1 = 0.0;58float k2 = 0.0;5960float upscale = 1.0;61float aspect_ratio = 1.0;62} lens_distortion;63};6465class RendererCompositor {66private:67bool xr_enabled = false;68static RendererCompositor *singleton;6970protected:71static RendererCompositor *(*_create_func)();72bool back_end = false;73static bool low_end;7475public:76static RendererCompositor *create();7778virtual RendererUtilities *get_utilities() = 0;79virtual RendererLightStorage *get_light_storage() = 0;80virtual RendererMaterialStorage *get_material_storage() = 0;81virtual RendererMeshStorage *get_mesh_storage() = 0;82virtual RendererParticlesStorage *get_particles_storage() = 0;83virtual RendererTextureStorage *get_texture_storage() = 0;84virtual RendererGI *get_gi() = 0;85virtual RendererFog *get_fog() = 0;86virtual RendererCanvasRender *get_canvas() = 0;87virtual RendererSceneRender *get_scene() = 0;8889virtual void set_boot_image(const Ref<Image> &p_image, const Color &p_color, bool p_scale, bool p_use_filter = true) = 0;9091virtual void initialize() = 0;92virtual void begin_frame(double frame_step) = 0;9394virtual void blit_render_targets_to_screen(DisplayServer::WindowID p_screen, const BlitToScreen *p_render_targets, int p_amount) = 0;9596virtual bool is_opengl() = 0;97virtual void gl_end_frame(bool p_swap_buffers) = 0;98virtual void end_frame(bool p_present) = 0;99virtual void finalize() = 0;100virtual uint64_t get_frame_number() const = 0;101virtual double get_frame_delta_time() const = 0;102virtual double get_total_time() const = 0;103virtual bool can_create_resources_async() const = 0;104105static bool is_low_end() { return low_end; }106virtual bool is_xr_enabled() const;107108static RendererCompositor *get_singleton() { return singleton; }109RendererCompositor();110virtual ~RendererCompositor();111};112113114