Path: blob/master/servers/rendering/renderer_rd/effects/debug_effects.h
10279 views
/**************************************************************************/1/* debug_effects.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/renderer_rd/pipeline_cache_rd.h"33#include "servers/rendering/renderer_rd/shaders/effects/motion_vectors.glsl.gen.h"34#include "servers/rendering/renderer_rd/shaders/effects/shadow_frustum.glsl.gen.h"3536namespace RendererRD {3738class DebugEffects {39private:40struct {41RD::VertexFormatID vertex_format;42RID vertex_buffer;43RID vertex_array;4445RID index_buffer;46RID index_array;4748RID lines_buffer;49RID lines_array;50} frustum;5152struct ShadowFrustumPushConstant {53float mvp[16];54float color[4];55};5657enum ShadowFrustumPipelines {58SFP_TRANSPARENT,59SFP_WIREFRAME,60SFP_MAX61};6263struct {64ShadowFrustumShaderRD shader;65RID shader_version;66PipelineCacheRD pipelines[SFP_MAX];67} shadow_frustum;6869struct MotionVectorsPushConstant {70float reprojection_matrix[16];71float resolution[2];72uint32_t force_derive_from_depth;73float pad;74};7576struct {77MotionVectorsShaderRD shader;78RID shader_version;79PipelineCacheRD pipeline;80MotionVectorsPushConstant push_constant;81} motion_vectors;8283void _create_frustum_arrays();8485protected:86public:87DebugEffects();88~DebugEffects();8990void draw_shadow_frustum(RID p_light, const Projection &p_cam_projection, const Transform3D &p_cam_transform, RID p_dest_fb, const Rect2 p_rect);91void draw_motion_vectors(RID p_velocity, RID p_depth, RID p_dest_fb, const Projection &p_current_projection, const Transform3D &p_current_transform, const Projection &p_previous_projection, const Transform3D &p_previous_transform, Size2i p_resolution);92};9394} // namespace RendererRD959697