1use super::*;
4
5#[repr(C)]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
9pub struct Capacity {
10 pub static_shape_count: i32,
12 pub dynamic_shape_count: i32,
14 pub static_body_count: i32,
16 pub dynamic_body_count: i32,
18 pub contact_count: i32,
20}
21
22impl Capacity {
23 #[inline]
25 pub const fn from_raw(raw: ffi::b3Capacity) -> Self {
26 Self {
27 static_shape_count: raw.staticShapeCount,
28 dynamic_shape_count: raw.dynamicShapeCount,
29 static_body_count: raw.staticBodyCount,
30 dynamic_body_count: raw.dynamicBodyCount,
31 contact_count: raw.contactCount,
32 }
33 }
34
35 #[inline]
37 pub const fn into_raw(self) -> ffi::b3Capacity {
38 ffi::b3Capacity {
39 staticShapeCount: self.static_shape_count,
40 dynamicShapeCount: self.dynamic_shape_count,
41 staticBodyCount: self.static_body_count,
42 dynamicBodyCount: self.dynamic_body_count,
43 contactCount: self.contact_count,
44 }
45 }
46}
47
48#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50#[derive(Copy, Clone, Debug, Default, PartialEq)]
51pub struct Profile {
52 pub step: f32,
54 pub pairs: f32,
56 pub collide: f32,
58 pub solve: f32,
60 pub solver_setup: f32,
62 pub constraints: f32,
64 pub prepare_constraints: f32,
66 pub integrate_velocities: f32,
68 pub warm_start: f32,
70 pub solve_impulses: f32,
72 pub integrate_positions: f32,
74 pub relax_impulses: f32,
76 pub apply_restitution: f32,
78 pub store_impulses: f32,
80 pub split_islands: f32,
82 pub transforms: f32,
84 pub sensor_hits: f32,
86 pub joint_events: f32,
88 pub hit_events: f32,
90 pub refit: f32,
92 pub bullets: f32,
94 pub sleep_islands: f32,
96 pub sensors: f32,
98}
99
100impl Profile {
101 #[inline]
103 pub const fn from_raw(raw: ffi::b3Profile) -> Self {
104 Self {
105 step: raw.step,
106 pairs: raw.pairs,
107 collide: raw.collide,
108 solve: raw.solve,
109 solver_setup: raw.solverSetup,
110 constraints: raw.constraints,
111 prepare_constraints: raw.prepareConstraints,
112 integrate_velocities: raw.integrateVelocities,
113 warm_start: raw.warmStart,
114 solve_impulses: raw.solveImpulses,
115 integrate_positions: raw.integratePositions,
116 relax_impulses: raw.relaxImpulses,
117 apply_restitution: raw.applyRestitution,
118 store_impulses: raw.storeImpulses,
119 split_islands: raw.splitIslands,
120 transforms: raw.transforms,
121 sensor_hits: raw.sensorHits,
122 joint_events: raw.jointEvents,
123 hit_events: raw.hitEvents,
124 refit: raw.refit,
125 bullets: raw.bullets,
126 sleep_islands: raw.sleepIslands,
127 sensors: raw.sensors,
128 }
129 }
130}
131
132#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
134#[derive(Copy, Clone, Debug, PartialEq, Eq)]
135pub struct Counters {
136 pub body_count: i32,
138 pub shape_count: i32,
140 pub contact_count: i32,
142 pub joint_count: i32,
144 pub island_count: i32,
146 pub stack_used: i32,
148 pub arena_capacity: i32,
150 pub static_tree_height: i32,
152 pub tree_height: i32,
154 pub sat_call_count: i32,
156 pub sat_cache_hit_count: i32,
158 pub byte_count: i32,
160 pub task_count: i32,
162 pub color_counts: [i32; 24],
164 pub manifold_counts: [i32; 8],
166 pub awake_contact_count: i32,
168 pub recycled_contact_count: i32,
170 pub distance_iterations: i32,
172 pub push_back_iterations: i32,
174 pub root_iterations: i32,
176}
177
178impl Counters {
179 #[inline]
181 pub const fn from_raw(raw: ffi::b3Counters) -> Self {
182 Self {
183 body_count: raw.bodyCount,
184 shape_count: raw.shapeCount,
185 contact_count: raw.contactCount,
186 joint_count: raw.jointCount,
187 island_count: raw.islandCount,
188 stack_used: raw.stackUsed,
189 arena_capacity: raw.arenaCapacity,
190 static_tree_height: raw.staticTreeHeight,
191 tree_height: raw.treeHeight,
192 sat_call_count: raw.satCallCount,
193 sat_cache_hit_count: raw.satCacheHitCount,
194 byte_count: raw.byteCount,
195 task_count: raw.taskCount,
196 color_counts: raw.colorCounts,
197 manifold_counts: raw.manifoldCounts,
198 awake_contact_count: raw.awakeContactCount,
199 recycled_contact_count: raw.recycledContactCount,
200 distance_iterations: raw.distanceIterations,
201 push_back_iterations: raw.pushBackIterations,
202 root_iterations: raw.rootIterations,
203 }
204 }
205}
206
207impl Default for Counters {
208 fn default() -> Self {
209 Self {
210 body_count: 0,
211 shape_count: 0,
212 contact_count: 0,
213 joint_count: 0,
214 island_count: 0,
215 stack_used: 0,
216 arena_capacity: 0,
217 static_tree_height: 0,
218 tree_height: 0,
219 sat_call_count: 0,
220 sat_cache_hit_count: 0,
221 byte_count: 0,
222 task_count: 0,
223 color_counts: [0; 24],
224 manifold_counts: [0; 8],
225 awake_contact_count: 0,
226 recycled_contact_count: 0,
227 distance_iterations: 0,
228 push_back_iterations: 0,
229 root_iterations: 0,
230 }
231 }
232}
233
234#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
236#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
237pub struct Version {
238 pub major: i32,
240 pub minor: i32,
242 pub revision: i32,
244}
245
246impl Version {
247 #[inline]
249 pub const fn from_raw(raw: ffi::b3Version) -> Self {
250 Self {
251 major: raw.major,
252 minor: raw.minor,
253 revision: raw.revision,
254 }
255 }
256}