Skip to main content

DebugDraw

Trait DebugDraw 

Source
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§

Source

fn draw_polygon( &mut self, transform: WorldTransform, vertices: &[Vec2], color: HexColor, )

Draw a closed polygon provided in CCW order (DrawPolygonFcn).

Source

fn draw_solid_polygon( &mut self, transform: WorldTransform, vertices: &[Vec2], radius: f32, color: HexColor, )

Draw a solid closed polygon provided in CCW order (DrawSolidPolygonFcn).

Source

fn draw_circle(&mut self, center: Pos, radius: f32, color: HexColor)

Draw a circle (DrawCircleFcn).

Source

fn draw_solid_circle( &mut self, transform: WorldTransform, center: Vec2, radius: f32, color: HexColor, )

Draw a solid circle (DrawSolidCircleFcn).

Source

fn draw_solid_capsule(&mut self, p1: Pos, p2: Pos, radius: f32, color: HexColor)

Draw a solid capsule (DrawSolidCapsuleFcn).

Source

fn draw_line(&mut self, p1: Pos, p2: Pos, color: HexColor)

Draw a line segment (DrawLineFcn).

Source

fn draw_transform(&mut self, transform: WorldTransform)

Draw a transform; choose your own length scale (DrawTransformFcn).

Source

fn draw_point(&mut self, p: Pos, size: f32, color: HexColor)

Draw a point (DrawPointFcn).

Source

fn draw_string(&mut self, p: Pos, s: &str, color: HexColor)

Draw a string in world space (DrawStringFcn).

Source

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.

Source

fn drawing_bounds(&self) -> Aabb

World bounds to use for debug draw (drawingBounds).

Source

fn force_scale(&self) -> f32

Scale to use when drawing forces (forceScale).

Source

fn joint_scale(&self) -> f32

Global scaling for joint drawing (jointScale).

Source

fn draw_contacts(&self) -> bool

Option to draw contact points (drawContacts).

Source

fn draw_anchor_a(&self) -> bool

Draw anchor A for contact points instead of anchor B (drawAnchorA).

Source

fn draw_shapes(&self) -> bool

Option to draw shapes (drawShapes). The only option on by default.

Source

fn draw_chain_normals(&self) -> bool

Option to draw chain shape normals (drawChainNormals).

Source

fn draw_joints(&self) -> bool

Option to draw joints (drawJoints).

Source

fn draw_joint_extras(&self) -> bool

Option to draw additional information for joints (drawJointExtras).

Source

fn draw_bounds_boxes(&self) -> bool

Option to draw the bounding boxes for shapes (drawBounds).

Source

fn draw_mass(&self) -> bool

Option to draw the mass and center of mass of dynamic bodies (drawMass).

Source

fn draw_body_names(&self) -> bool

Option to draw body names (drawBodyNames).

Source

fn draw_graph_colors(&self) -> bool

Option to visualize the graph coloring used for contacts and joints (drawGraphColors).

Source

fn draw_contact_features(&self) -> bool

Option to draw contact feature ids (drawContactFeatures).

Source

fn draw_contact_normals(&self) -> bool

Option to draw contact normals (drawContactNormals).

Source

fn draw_contact_forces(&self) -> bool

Option to draw contact normal forces (drawContactForces).

Source

fn draw_friction_forces(&self) -> bool

Option to draw contact friction forces (drawFrictionForces).

Source

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".

Implementors§