pub trait DebugDraw {
Show 28 methods
// Provided methods
fn draw_polygon(
&mut self,
transform: WorldTransform,
vertices: &[Vec2],
color: HexColor,
) { ... }
fn draw_solid_polygon(
&mut self,
transform: WorldTransform,
vertices: &[Vec2],
radius: f32,
color: HexColor,
) { ... }
fn draw_circle(&mut self, center: Pos, radius: f32, color: HexColor) { ... }
fn draw_solid_circle(
&mut self,
transform: WorldTransform,
center: Vec2,
radius: f32,
color: HexColor,
) { ... }
fn draw_solid_capsule(
&mut self,
p1: Pos,
p2: Pos,
radius: f32,
color: HexColor,
) { ... }
fn draw_line(&mut self, p1: Pos, p2: Pos, color: HexColor) { ... }
fn draw_transform(&mut self, transform: WorldTransform) { ... }
fn draw_point(&mut self, p: Pos, size: f32, color: HexColor) { ... }
fn draw_string(&mut self, p: Pos, s: &str, color: HexColor) { ... }
fn draw_bounds(&mut self, aabb: Aabb, color: HexColor) { ... }
fn drawing_bounds(&self) -> Aabb { ... }
fn force_scale(&self) -> f32 { ... }
fn joint_scale(&self) -> f32 { ... }
fn draw_contacts(&self) -> bool { ... }
fn draw_anchor_a(&self) -> bool { ... }
fn draw_shapes(&self) -> bool { ... }
fn draw_chain_normals(&self) -> bool { ... }
fn draw_joints(&self) -> bool { ... }
fn draw_joint_extras(&self) -> bool { ... }
fn draw_bounds_boxes(&self) -> bool { ... }
fn draw_mass(&self) -> bool { ... }
fn draw_body_names(&self) -> bool { ... }
fn draw_graph_colors(&self) -> bool { ... }
fn draw_contact_features(&self) -> bool { ... }
fn draw_contact_normals(&self) -> bool { ... }
fn draw_contact_forces(&self) -> bool { ... }
fn draw_friction_forces(&self) -> bool { ... }
fn draw_islands(&self) -> bool { ... }
}Expand description
Debug drawing callbacks and options (b2DebugDraw). C carries function
pointers plus option fields in one struct initialized by
b2DefaultDebugDraw; the Rust port is a trait where every method has a
default body matching those defaults (draw callbacks default to no-ops so
an implementation can supply only the subset it cares about, options
default to the b2DefaultDebugDraw values). Callbacks receive world
coordinates: in large world mode Pos/WorldTransform translations are
double precision so they stay accurate far from the origin.
Provided Methods§
Sourcefn draw_polygon(
&mut self,
transform: WorldTransform,
vertices: &[Vec2],
color: HexColor,
)
fn draw_polygon( &mut self, transform: WorldTransform, vertices: &[Vec2], color: HexColor, )
Draw a closed polygon provided in CCW order (DrawPolygonFcn).
Sourcefn draw_solid_polygon(
&mut self,
transform: WorldTransform,
vertices: &[Vec2],
radius: f32,
color: HexColor,
)
fn draw_solid_polygon( &mut self, transform: WorldTransform, vertices: &[Vec2], radius: f32, color: HexColor, )
Draw a solid closed polygon provided in CCW order (DrawSolidPolygonFcn).
Sourcefn draw_circle(&mut self, center: Pos, radius: f32, color: HexColor)
fn draw_circle(&mut self, center: Pos, radius: f32, color: HexColor)
Draw a circle (DrawCircleFcn).
Sourcefn draw_solid_circle(
&mut self,
transform: WorldTransform,
center: Vec2,
radius: f32,
color: HexColor,
)
fn draw_solid_circle( &mut self, transform: WorldTransform, center: Vec2, radius: f32, color: HexColor, )
Draw a solid circle (DrawSolidCircleFcn).
Sourcefn draw_solid_capsule(&mut self, p1: Pos, p2: Pos, radius: f32, color: HexColor)
fn draw_solid_capsule(&mut self, p1: Pos, p2: Pos, radius: f32, color: HexColor)
Draw a solid capsule (DrawSolidCapsuleFcn).
Sourcefn draw_transform(&mut self, transform: WorldTransform)
fn draw_transform(&mut self, transform: WorldTransform)
Draw a transform; choose your own length scale (DrawTransformFcn).
Sourcefn draw_point(&mut self, p: Pos, size: f32, color: HexColor)
fn draw_point(&mut self, p: Pos, size: f32, color: HexColor)
Draw a point (DrawPointFcn).
Sourcefn draw_string(&mut self, p: Pos, s: &str, color: HexColor)
fn draw_string(&mut self, p: Pos, s: &str, color: HexColor)
Draw a string in world space (DrawStringFcn).
Sourcefn draw_bounds(&mut self, aabb: Aabb, color: HexColor)
fn draw_bounds(&mut self, aabb: Aabb, color: HexColor)
Draw a bounding box (DrawBoundsFcn). With double precision enabled, the single precision bounding box gets increasing padding when moving far from the origin.
Sourcefn drawing_bounds(&self) -> Aabb
fn drawing_bounds(&self) -> Aabb
World bounds to use for debug draw (drawingBounds).
Sourcefn force_scale(&self) -> f32
fn force_scale(&self) -> f32
Scale to use when drawing forces (forceScale).
Sourcefn joint_scale(&self) -> f32
fn joint_scale(&self) -> f32
Global scaling for joint drawing (jointScale).
Sourcefn draw_contacts(&self) -> bool
fn draw_contacts(&self) -> bool
Option to draw contact points (drawContacts).
Sourcefn draw_anchor_a(&self) -> bool
fn draw_anchor_a(&self) -> bool
Draw anchor A for contact points instead of anchor B (drawAnchorA).
Sourcefn draw_shapes(&self) -> bool
fn draw_shapes(&self) -> bool
Option to draw shapes (drawShapes). The only option on by default.
Sourcefn draw_chain_normals(&self) -> bool
fn draw_chain_normals(&self) -> bool
Option to draw chain shape normals (drawChainNormals).
Sourcefn draw_joints(&self) -> bool
fn draw_joints(&self) -> bool
Option to draw joints (drawJoints).
Sourcefn draw_joint_extras(&self) -> bool
fn draw_joint_extras(&self) -> bool
Option to draw additional information for joints (drawJointExtras).
Sourcefn draw_bounds_boxes(&self) -> bool
fn draw_bounds_boxes(&self) -> bool
Option to draw the bounding boxes for shapes (drawBounds).
Sourcefn draw_mass(&self) -> bool
fn draw_mass(&self) -> bool
Option to draw the mass and center of mass of dynamic bodies (drawMass).
Sourcefn draw_body_names(&self) -> bool
fn draw_body_names(&self) -> bool
Option to draw body names (drawBodyNames).
Sourcefn draw_graph_colors(&self) -> bool
fn draw_graph_colors(&self) -> bool
Option to visualize the graph coloring used for contacts and joints (drawGraphColors).
Sourcefn draw_contact_features(&self) -> bool
fn draw_contact_features(&self) -> bool
Option to draw contact feature ids (drawContactFeatures).
Sourcefn draw_contact_normals(&self) -> bool
fn draw_contact_normals(&self) -> bool
Option to draw contact normals (drawContactNormals).
Sourcefn draw_contact_forces(&self) -> bool
fn draw_contact_forces(&self) -> bool
Option to draw contact normal forces (drawContactForces).
Sourcefn draw_friction_forces(&self) -> bool
fn draw_friction_forces(&self) -> bool
Option to draw contact friction forces (drawFrictionForces).
Sourcefn draw_islands(&self) -> bool
fn draw_islands(&self) -> bool
Option to draw islands as bounding boxes (drawIslands).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".