Removed hardcoded values for DebugColor in various places (#774)

This commit is contained in:
legendofa
2025-01-13 09:09:21 +01:00
committed by GitHub
parent 4867586c8c
commit b0e72bb79d
4 changed files with 26 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
use super::DebugColor;
use crate::dynamics::{
ImpulseJoint, ImpulseJointHandle, Multibody, MultibodyLink, RigidBody, RigidBodyHandle,
};
@@ -43,7 +44,7 @@ pub trait DebugRenderBackend {
object: DebugRenderObject,
a: Point<Real>,
b: Point<Real>,
color: [f32; 4],
color: DebugColor,
);
/// Draws a set of lines.
@@ -54,7 +55,7 @@ pub trait DebugRenderBackend {
indices: &[[u32; 2]],
transform: &Isometry<Real>,
scale: &Vector<Real>,
color: [f32; 4],
color: DebugColor,
) {
for idx in indices {
let a = transform * (Scale::from(*scale) * vertices[idx[0] as usize]);
@@ -70,7 +71,7 @@ pub trait DebugRenderBackend {
vertices: &[Point<Real>],
transform: &Isometry<Real>,
scale: &Vector<Real>,
color: [f32; 4],
color: DebugColor,
closed: bool,
) {
for vtx in vertices.windows(2) {

View File

@@ -1,4 +1,4 @@
use super::{outlines, DebugRenderBackend};
use super::{outlines, DebugColor, DebugRenderBackend};
use crate::dynamics::{
GenericJoint, ImpulseJointSet, MultibodyJointSet, RigidBodySet, RigidBodyType,
};
@@ -180,8 +180,8 @@ impl DebugRenderPipeline {
let mut render_joint = |body1,
body2,
data: &GenericJoint,
mut anchor_color: [f32; 4],
mut separation_color: [f32; 4],
mut anchor_color: DebugColor,
mut separation_color: DebugColor,
object| {
if !backend.filter_object(object) {
return;
@@ -363,7 +363,7 @@ impl DebugRenderPipeline {
backend: &mut impl DebugRenderBackend,
shape: &dyn Shape,
pos: &Isometry<Real>,
color: [f32; 4],
color: DebugColor,
) {
match shape.as_typed_shape() {
TypedShape::Ball(s) => {
@@ -471,7 +471,7 @@ impl DebugRenderPipeline {
backend: &mut impl DebugRenderBackend,
shape: &dyn Shape,
pos: &Isometry<Real>,
color: [f32; 4],
color: DebugColor,
) {
match shape.as_typed_shape() {
TypedShape::Ball(s) => {

View File

@@ -35,11 +35,11 @@ pub struct DebugRenderStyle {
/// If a rigid-body is sleeping, its attached entities will have their colors
/// multiplied by this array. (For a joint, both attached rigid-bodies must be sleeping
/// or non-dynamic for this multiplier to be applied).
pub sleep_color_multiplier: [f32; 4],
pub sleep_color_multiplier: DebugColor,
/// 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 disabled_color_multiplier: [f32; 4],
pub disabled_color_multiplier: DebugColor,
/// The length of the local coordinate axes rendered for a rigid-body.
pub rigid_body_axes_length: Real,
/// The color for the segments joining the two contact points.