use super::*;
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct Capacity {
pub static_shape_count: i32,
pub dynamic_shape_count: i32,
pub static_body_count: i32,
pub dynamic_body_count: i32,
pub contact_count: i32,
}
impl Capacity {
#[inline]
pub const fn from_raw(raw: ffi::b3Capacity) -> Self {
Self {
static_shape_count: raw.staticShapeCount,
dynamic_shape_count: raw.dynamicShapeCount,
static_body_count: raw.staticBodyCount,
dynamic_body_count: raw.dynamicBodyCount,
contact_count: raw.contactCount,
}
}
#[inline]
pub const fn into_raw(self) -> ffi::b3Capacity {
ffi::b3Capacity {
staticShapeCount: self.static_shape_count,
dynamicShapeCount: self.dynamic_shape_count,
staticBodyCount: self.static_body_count,
dynamicBodyCount: self.dynamic_body_count,
contactCount: self.contact_count,
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct Profile {
pub step: f32,
pub pairs: f32,
pub collide: f32,
pub solve: f32,
pub solver_setup: f32,
pub constraints: f32,
pub prepare_constraints: f32,
pub integrate_velocities: f32,
pub warm_start: f32,
pub solve_impulses: f32,
pub integrate_positions: f32,
pub relax_impulses: f32,
pub apply_restitution: f32,
pub store_impulses: f32,
pub split_islands: f32,
pub transforms: f32,
pub sensor_hits: f32,
pub joint_events: f32,
pub hit_events: f32,
pub refit: f32,
pub bullets: f32,
pub sleep_islands: f32,
pub sensors: f32,
}
impl Profile {
#[inline]
pub const fn from_raw(raw: ffi::b3Profile) -> Self {
Self {
step: raw.step,
pairs: raw.pairs,
collide: raw.collide,
solve: raw.solve,
solver_setup: raw.solverSetup,
constraints: raw.constraints,
prepare_constraints: raw.prepareConstraints,
integrate_velocities: raw.integrateVelocities,
warm_start: raw.warmStart,
solve_impulses: raw.solveImpulses,
integrate_positions: raw.integratePositions,
relax_impulses: raw.relaxImpulses,
apply_restitution: raw.applyRestitution,
store_impulses: raw.storeImpulses,
split_islands: raw.splitIslands,
transforms: raw.transforms,
sensor_hits: raw.sensorHits,
joint_events: raw.jointEvents,
hit_events: raw.hitEvents,
refit: raw.refit,
bullets: raw.bullets,
sleep_islands: raw.sleepIslands,
sensors: raw.sensors,
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Counters {
pub body_count: i32,
pub shape_count: i32,
pub contact_count: i32,
pub joint_count: i32,
pub island_count: i32,
pub stack_used: i32,
pub arena_capacity: i32,
pub static_tree_height: i32,
pub tree_height: i32,
pub sat_call_count: i32,
pub sat_cache_hit_count: i32,
pub byte_count: i32,
pub task_count: i32,
pub color_counts: [i32; 24],
pub manifold_counts: [i32; 8],
pub awake_contact_count: i32,
pub recycled_contact_count: i32,
pub distance_iterations: i32,
pub push_back_iterations: i32,
pub root_iterations: i32,
}
impl Counters {
#[inline]
pub const fn from_raw(raw: ffi::b3Counters) -> Self {
Self {
body_count: raw.bodyCount,
shape_count: raw.shapeCount,
contact_count: raw.contactCount,
joint_count: raw.jointCount,
island_count: raw.islandCount,
stack_used: raw.stackUsed,
arena_capacity: raw.arenaCapacity,
static_tree_height: raw.staticTreeHeight,
tree_height: raw.treeHeight,
sat_call_count: raw.satCallCount,
sat_cache_hit_count: raw.satCacheHitCount,
byte_count: raw.byteCount,
task_count: raw.taskCount,
color_counts: raw.colorCounts,
manifold_counts: raw.manifoldCounts,
awake_contact_count: raw.awakeContactCount,
recycled_contact_count: raw.recycledContactCount,
distance_iterations: raw.distanceIterations,
push_back_iterations: raw.pushBackIterations,
root_iterations: raw.rootIterations,
}
}
}
impl Default for Counters {
fn default() -> Self {
Self {
body_count: 0,
shape_count: 0,
contact_count: 0,
joint_count: 0,
island_count: 0,
stack_used: 0,
arena_capacity: 0,
static_tree_height: 0,
tree_height: 0,
sat_call_count: 0,
sat_cache_hit_count: 0,
byte_count: 0,
task_count: 0,
color_counts: [0; 24],
manifold_counts: [0; 8],
awake_contact_count: 0,
recycled_contact_count: 0,
distance_iterations: 0,
push_back_iterations: 0,
root_iterations: 0,
}
}
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
pub struct Version {
pub major: i32,
pub minor: i32,
pub revision: i32,
}
impl Version {
#[inline]
pub const fn from_raw(raw: ffi::b3Version) -> Self {
Self {
major: raw.major,
minor: raw.minor,
revision: raw.revision,
}
}
}