Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/servers/rendering/renderer_rd/effects/debug_effects.h
10279 views
1
/**************************************************************************/
2
/* debug_effects.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "servers/rendering/renderer_rd/pipeline_cache_rd.h"
34
#include "servers/rendering/renderer_rd/shaders/effects/motion_vectors.glsl.gen.h"
35
#include "servers/rendering/renderer_rd/shaders/effects/shadow_frustum.glsl.gen.h"
36
37
namespace RendererRD {
38
39
class DebugEffects {
40
private:
41
struct {
42
RD::VertexFormatID vertex_format;
43
RID vertex_buffer;
44
RID vertex_array;
45
46
RID index_buffer;
47
RID index_array;
48
49
RID lines_buffer;
50
RID lines_array;
51
} frustum;
52
53
struct ShadowFrustumPushConstant {
54
float mvp[16];
55
float color[4];
56
};
57
58
enum ShadowFrustumPipelines {
59
SFP_TRANSPARENT,
60
SFP_WIREFRAME,
61
SFP_MAX
62
};
63
64
struct {
65
ShadowFrustumShaderRD shader;
66
RID shader_version;
67
PipelineCacheRD pipelines[SFP_MAX];
68
} shadow_frustum;
69
70
struct MotionVectorsPushConstant {
71
float reprojection_matrix[16];
72
float resolution[2];
73
uint32_t force_derive_from_depth;
74
float pad;
75
};
76
77
struct {
78
MotionVectorsShaderRD shader;
79
RID shader_version;
80
PipelineCacheRD pipeline;
81
MotionVectorsPushConstant push_constant;
82
} motion_vectors;
83
84
void _create_frustum_arrays();
85
86
protected:
87
public:
88
DebugEffects();
89
~DebugEffects();
90
91
void draw_shadow_frustum(RID p_light, const Projection &p_cam_projection, const Transform3D &p_cam_transform, RID p_dest_fb, const Rect2 p_rect);
92
void 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);
93
};
94
95
} // namespace RendererRD
96
97