summaryrefslogtreecommitdiffstats
path: root/servers/rendering/renderer_viewport.cpp
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2024-06-11 12:46:56 -0700
committerclayjohn <claynjohn@gmail.com>2024-06-11 12:46:56 -0700
commitfa3e00e2c4027d3a3cf4d1f903b1f28d4fa8c486 (patch)
treeb37a5c1167badae1b1a6cd6efb0dfff3acd5404b /servers/rendering/renderer_viewport.cpp
parent292e50e17e3f6e2509d3178a00204f964a907460 (diff)
downloadredot-engine-fa3e00e2c4027d3a3cf4d1f903b1f28d4fa8c486.tar.gz
Ensure Motion Vectors are enabled by particles and skeletons when using the Motion Vector debug draw option
Diffstat (limited to 'servers/rendering/renderer_viewport.cpp')
-rw-r--r--servers/rendering/renderer_viewport.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp
index 884f8adb8c..80c1f67d8a 100644
--- a/servers/rendering/renderer_viewport.cpp
+++ b/servers/rendering/renderer_viewport.cpp
@@ -971,7 +971,7 @@ void RendererViewport::_viewport_set_size(Viewport *p_viewport, int p_width, int
}
bool RendererViewport::_viewport_requires_motion_vectors(Viewport *p_viewport) {
- return p_viewport->use_taa || p_viewport->scaling_3d_mode == RenderingServer::VIEWPORT_SCALING_3D_MODE_FSR2;
+ return p_viewport->use_taa || p_viewport->scaling_3d_mode == RenderingServer::VIEWPORT_SCALING_3D_MODE_FSR2 || p_viewport->debug_draw == RenderingServer::VIEWPORT_DEBUG_DRAW_MOTION_VECTORS;
}
void RendererViewport::viewport_set_active(RID p_viewport, bool p_active) {
@@ -1370,7 +1370,13 @@ void RendererViewport::viewport_set_debug_draw(RID p_viewport, RS::ViewportDebug
Viewport *viewport = viewport_owner.get_or_null(p_viewport);
ERR_FAIL_NULL(viewport);
+ bool motion_vectors_before = _viewport_requires_motion_vectors(viewport);
viewport->debug_draw = p_draw;
+
+ bool motion_vectors_after = _viewport_requires_motion_vectors(viewport);
+ if (motion_vectors_before != motion_vectors_after) {
+ num_viewports_with_motion_vectors += motion_vectors_after ? 1 : -1;
+ }
}
void RendererViewport::viewport_set_measure_render_time(RID p_viewport, bool p_enable) {