| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 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 |
} |