From 39f4520b91311bfdced713a6771833eff476bfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sat, 9 Dec 2023 21:46:41 +0100 Subject: [PATCH] feat: actually apply the disabled_color_multiplier in the debug-renderer --- .../debug_render_pipeline/debug_render_pipeline.rs | 12 +++++++++--- .../debug_render_pipeline/debug_render_style.rs | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs index 2f1c7378d..f214b8cf3 100644 --- a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs +++ b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs @@ -175,7 +175,9 @@ impl DebugRenderPipeline { } if let (Some(rb1), Some(rb2)) = (bodies.get(body1), bodies.get(body2)) { - let coeff = if (rb1.is_fixed() || rb1.is_sleeping()) + let coeff = if !data.is_enabled() || !rb1.is_enabled() || !rb2.is_enabled() { + self.style.disabled_color_multiplier + } else if (rb1.is_fixed() || rb1.is_sleeping()) && (rb2.is_fixed() || rb2.is_sleeping()) { self.style.sleep_color_multiplier @@ -250,7 +252,9 @@ impl DebugRenderPipeline { && backend.filter_object(object) { let basis = rb.rotation().to_rotation_matrix().into_inner(); - let coeff = if rb.is_sleeping() { + let coeff = if !rb.is_enabled() { + self.style.disabled_color_multiplier + } else if rb.is_sleeping() { self.style.sleep_color_multiplier } else { [1.0; 4] @@ -283,7 +287,9 @@ impl DebugRenderPipeline { if backend.filter_object(object) { let color = if let Some(parent) = co.parent().and_then(|p| bodies.get(p)) { - let coeff = if parent.is_sleeping() { + let coeff = if !parent.is_enabled() || !co.is_enabled() { + self.style.disabled_color_multiplier + } else if parent.is_sleeping() { self.style.sleep_color_multiplier } else { [1.0; 4] diff --git a/src/pipeline/debug_render_pipeline/debug_render_style.rs b/src/pipeline/debug_render_pipeline/debug_render_style.rs index 0d4f1ae81..c977cab1c 100644 --- a/src/pipeline/debug_render_pipeline/debug_render_style.rs +++ b/src/pipeline/debug_render_pipeline/debug_render_style.rs @@ -39,7 +39,7 @@ pub struct DebugRenderStyle { /// If a rigid-body is disabled, its attached entities will have their colors /// multiplied by this array. (For a joint, both attached rigid-bodies must be disabled /// for this multiplier to be applied). - pub disable_color_multiplier: [f32; 4], + pub disabled_color_multiplier: [f32; 4], /// The length of the local coordinate axes rendered for a rigid-body. pub rigid_body_axes_length: Real, /// The collor for the segments joining the two contact points. @@ -66,7 +66,7 @@ impl Default for DebugRenderStyle { multibody_joint_anchor_color: [300.0, 1.0, 0.4, 1.0], multibody_joint_separation_color: [0.0, 1.0, 0.4, 1.0], sleep_color_multiplier: [1.0, 1.0, 0.2, 1.0], - disable_color_multiplier: [0.25, 1.0, 0.2, 1.0], + disabled_color_multiplier: [0.0, 0.0, 1.0, 1.0], rigid_body_axes_length: 0.5, contact_depth_color: [120.0, 1.0, 0.4, 1.0], contact_normal_color: [0.0, 1.0, 1.0, 1.0],