1pub const B2_HASH_INIT: u32 = 5381;
7pub const B2_PI: f64 = 3.14159265359;
8pub const B2_MAX_POLYGON_VERTICES: u32 = 8;
9pub const B2_DEFAULT_CATEGORY_BITS: u32 = 1;
10pub const B2_DEFAULT_MASK_BITS: i32 = -1;
11#[doc = " Prototype for user allocation function\n @param size the allocation size in bytes\n @param alignment the required alignment, guaranteed to be a power of 2"]
12pub type b2AllocFcn = ::std::option::Option<
13 unsafe extern "C" fn(
14 size: ::std::os::raw::c_uint,
15 alignment: ::std::os::raw::c_int,
16 ) -> *mut ::std::os::raw::c_void,
17>;
18#[doc = " Prototype for user free function\n @param mem the memory previously allocated through `b2AllocFcn`\n @param size the allocation size in bytes"]
19pub type b2FreeFcn = ::std::option::Option<
20 unsafe extern "C" fn(mem: *mut ::std::os::raw::c_void, size: ::std::os::raw::c_uint),
21>;
22#[doc = " Prototype for the user assert callback. Return 0 to skip the debugger break."]
23pub type b2AssertFcn = ::std::option::Option<
24 unsafe extern "C" fn(
25 condition: *const ::std::os::raw::c_char,
26 fileName: *const ::std::os::raw::c_char,
27 lineNumber: ::std::os::raw::c_int,
28 ) -> ::std::os::raw::c_int,
29>;
30#[doc = " Prototype for user log callback. Used to log warnings."]
31pub type b2LogFcn =
32 ::std::option::Option<unsafe extern "C" fn(message: *const ::std::os::raw::c_char)>;
33unsafe extern "C" {
34 #[doc = " This allows the user to override the allocation functions. These should be\n set during application startup."]
35 pub fn b2SetAllocator(allocFcn: b2AllocFcn, freeFcn: b2FreeFcn);
36}
37unsafe extern "C" {
38 #[doc = " @return the total bytes allocated by Box2D"]
39 pub fn b2GetByteCount() -> ::std::os::raw::c_int;
40}
41unsafe extern "C" {
42 #[doc = " Override the default assert function\n @param assertFcn a non-null assert callback"]
43 pub fn b2SetAssertFcn(assertFcn: b2AssertFcn);
44}
45unsafe extern "C" {
46 #[doc = " Override the default log function\n @param logFcn a non-null log callback"]
47 pub fn b2SetLogFcn(logFcn: b2LogFcn);
48}
49#[doc = " Version numbering scheme.\n See https://semver.org/"]
50#[repr(C)]
51#[derive(Debug, Copy, Clone)]
52pub struct b2Version {
53 #[doc = " Significant changes"]
54 pub major: ::std::os::raw::c_int,
55 #[doc = " Incremental changes"]
56 pub minor: ::std::os::raw::c_int,
57 #[doc = " Bug fixes"]
58 pub revision: ::std::os::raw::c_int,
59}
60unsafe extern "C" {
61 #[doc = " Get the current version of Box2D"]
62 pub fn b2GetVersion() -> b2Version;
63}
64unsafe extern "C" {
65 pub fn b2InternalAssertFcn(
66 condition: *const ::std::os::raw::c_char,
67 fileName: *const ::std::os::raw::c_char,
68 lineNumber: ::std::os::raw::c_int,
69 ) -> ::std::os::raw::c_int;
70}
71unsafe extern "C" {
72 #[doc = " Get the absolute number of system ticks. The value is platform specific."]
73 pub fn b2GetTicks() -> u64;
74}
75unsafe extern "C" {
76 #[doc = " Get the milliseconds passed from an initial tick value."]
77 pub fn b2GetMilliseconds(ticks: u64) -> f32;
78}
79unsafe extern "C" {
80 #[doc = " Get the milliseconds passed from an initial tick value. Resets the passed in\n value to the current tick value."]
81 pub fn b2GetMillisecondsAndReset(ticks: *mut u64) -> f32;
82}
83unsafe extern "C" {
84 #[doc = " Yield to be used in a busy loop."]
85 pub fn b2Yield();
86}
87unsafe extern "C" {
88 pub fn b2Hash(hash: u32, data: *const u8, count: ::std::os::raw::c_int) -> u32;
89}
90#[doc = " 2D vector\n This can be used to represent a point or free vector"]
91#[repr(C)]
92#[derive(Debug, Copy, Clone)]
93pub struct b2Vec2 {
94 #[doc = " coordinates"]
95 pub x: f32,
96 #[doc = " coordinates"]
97 pub y: f32,
98}
99#[doc = " Cosine and sine pair\n This uses a custom implementation designed for cross-platform determinism"]
100#[repr(C)]
101#[derive(Debug, Copy, Clone)]
102pub struct b2CosSin {
103 #[doc = " cosine and sine"]
104 pub cosine: f32,
105 pub sine: f32,
106}
107#[doc = " 2D rotation\n This is similar to using a complex number for rotation"]
108#[repr(C)]
109#[derive(Debug, Copy, Clone)]
110pub struct b2Rot {
111 #[doc = " cosine and sine"]
112 pub c: f32,
113 #[doc = " cosine and sine"]
114 pub s: f32,
115}
116#[doc = " A 2D rigid transform"]
117#[repr(C)]
118#[derive(Debug, Copy, Clone)]
119pub struct b2Transform {
120 pub p: b2Vec2,
121 pub q: b2Rot,
122}
123#[doc = " A 2-by-2 Matrix"]
124#[repr(C)]
125#[derive(Debug, Copy, Clone)]
126pub struct b2Mat22 {
127 #[doc = " columns"]
128 pub cx: b2Vec2,
129 #[doc = " columns"]
130 pub cy: b2Vec2,
131}
132#[doc = " Axis-aligned bounding box"]
133#[repr(C)]
134#[derive(Debug, Copy, Clone)]
135pub struct b2AABB {
136 pub lowerBound: b2Vec2,
137 pub upperBound: b2Vec2,
138}
139#[doc = " separation = dot(normal, point) - offset"]
140#[repr(C)]
141#[derive(Debug, Copy, Clone)]
142pub struct b2Plane {
143 pub normal: b2Vec2,
144 pub offset: f32,
145}
146unsafe extern "C" {
147 #[doc = " Is this a valid number? Not NaN or infinity."]
148 pub fn b2IsValidFloat(a: f32) -> bool;
149}
150unsafe extern "C" {
151 #[doc = " Is this a valid vector? Not NaN or infinity."]
152 pub fn b2IsValidVec2(v: b2Vec2) -> bool;
153}
154unsafe extern "C" {
155 #[doc = " Is this a valid rotation? Not NaN or infinity. Is normalized."]
156 pub fn b2IsValidRotation(q: b2Rot) -> bool;
157}
158unsafe extern "C" {
159 #[doc = " Is this a valid transform? Not NaN or infinity. Rotation is normalized."]
160 pub fn b2IsValidTransform(t: b2Transform) -> bool;
161}
162unsafe extern "C" {
163 #[doc = " Is this a valid bounding box? Not Nan or infinity. Upper bound greater than or equal to lower bound."]
164 pub fn b2IsValidAABB(aabb: b2AABB) -> bool;
165}
166unsafe extern "C" {
167 #[doc = " Is this a valid plane? Normal is a unit vector. Not Nan or infinity."]
168 pub fn b2IsValidPlane(a: b2Plane) -> bool;
169}
170unsafe extern "C" {
171 #[doc = " Compute an approximate arctangent in the range [-pi, pi]\n This is hand coded for cross-platform determinism. The atan2f\n function in the standard library is not cross-platform deterministic.\n\tAccurate to around 0.0023 degrees"]
172 pub fn b2Atan2(y: f32, x: f32) -> f32;
173}
174unsafe extern "C" {
175 #[doc = " Compute the cosine and sine of an angle in radians. Implemented\n for cross-platform determinism."]
176 pub fn b2ComputeCosSin(radians: f32) -> b2CosSin;
177}
178unsafe extern "C" {
179 #[doc = " Compute the rotation between two unit vectors"]
180 pub fn b2ComputeRotationBetweenUnitVectors(v1: b2Vec2, v2: b2Vec2) -> b2Rot;
181}
182unsafe extern "C" {
183 #[doc = " Box2D bases all length units on meters, but you may need different units for your game.\n You can set this value to use different units. This should be done at application startup\n and only modified once. Default value is 1.\n For example, if your game uses pixels for units you can use pixels for all length values\n sent to Box2D. There should be no extra cost. However, Box2D has some internal tolerances\n and thresholds that have been tuned for meters. By calling this function, Box2D is able\n to adjust those tolerances and thresholds to improve accuracy.\n A good rule of thumb is to pass the height of your player character to this function. So\n if your player character is 32 pixels high, then pass 32 to this function. Then you may\n confidently use pixels for all the length values sent to Box2D. All length values returned\n from Box2D will also be pixels because Box2D does not do any scaling internally.\n However, you are now on the hook for coming up with good values for gravity, density, and\n forces.\n @warning This must be modified before any calls to Box2D"]
184 pub fn b2SetLengthUnitsPerMeter(lengthUnits: f32);
185}
186unsafe extern "C" {
187 #[doc = " Get the current length units per meter."]
188 pub fn b2GetLengthUnitsPerMeter() -> f32;
189}
190#[doc = " Low level ray cast input data"]
191#[repr(C)]
192#[derive(Debug, Copy, Clone)]
193pub struct b2RayCastInput {
194 #[doc = " Start point of the ray cast"]
195 pub origin: b2Vec2,
196 #[doc = " Translation of the ray cast"]
197 pub translation: b2Vec2,
198 #[doc = " The maximum fraction of the translation to consider, typically 1"]
199 pub maxFraction: f32,
200}
201#[doc = " A distance proxy is used by the GJK algorithm. It encapsulates any shape.\n You can provide between 1 and B2_MAX_POLYGON_VERTICES and a radius."]
202#[repr(C)]
203#[derive(Debug, Copy, Clone)]
204pub struct b2ShapeProxy {
205 #[doc = " The point cloud"]
206 pub points: [b2Vec2; 8usize],
207 #[doc = " The number of points. Must be greater than 0."]
208 pub count: ::std::os::raw::c_int,
209 #[doc = " The external radius of the point cloud. May be zero."]
210 pub radius: f32,
211}
212#[doc = " Low level shape cast input in generic form. This allows casting an arbitrary point\n cloud wrap with a radius. For example, a circle is a single point with a non-zero radius.\n A capsule is two points with a non-zero radius. A box is four points with a zero radius."]
213#[repr(C)]
214#[derive(Debug, Copy, Clone)]
215pub struct b2ShapeCastInput {
216 #[doc = " A generic shape"]
217 pub proxy: b2ShapeProxy,
218 #[doc = " The translation of the shape cast"]
219 pub translation: b2Vec2,
220 #[doc = " The maximum fraction of the translation to consider, typically 1"]
221 pub maxFraction: f32,
222 #[doc = " Allow shape cast to encroach when initially touching. This only works if the radius is greater than zero."]
223 pub canEncroach: bool,
224}
225#[doc = " Low level ray cast or shape-cast output data. Returns a zero fraction and normal in the case of initial overlap."]
226#[repr(C)]
227#[derive(Debug, Copy, Clone)]
228pub struct b2CastOutput {
229 #[doc = " The surface normal at the hit point"]
230 pub normal: b2Vec2,
231 #[doc = " The surface hit point"]
232 pub point: b2Vec2,
233 #[doc = " The fraction of the input translation at collision"]
234 pub fraction: f32,
235 #[doc = " The number of iterations used"]
236 pub iterations: ::std::os::raw::c_int,
237 #[doc = " Did the cast hit?"]
238 pub hit: bool,
239}
240#[doc = " This holds the mass data computed for a shape."]
241#[repr(C)]
242#[derive(Debug, Copy, Clone)]
243pub struct b2MassData {
244 #[doc = " The mass of the shape, usually in kilograms."]
245 pub mass: f32,
246 #[doc = " The position of the shape's centroid relative to the shape's origin."]
247 pub center: b2Vec2,
248 #[doc = " The rotational inertia of the shape about the shape center."]
249 pub rotationalInertia: f32,
250}
251#[doc = " A solid circle"]
252#[repr(C)]
253#[derive(Debug, Copy, Clone)]
254pub struct b2Circle {
255 #[doc = " The local center"]
256 pub center: b2Vec2,
257 #[doc = " The radius"]
258 pub radius: f32,
259}
260#[doc = " A solid capsule can be viewed as two semicircles connected\n by a rectangle."]
261#[repr(C)]
262#[derive(Debug, Copy, Clone)]
263pub struct b2Capsule {
264 #[doc = " Local center of the first semicircle"]
265 pub center1: b2Vec2,
266 #[doc = " Local center of the second semicircle"]
267 pub center2: b2Vec2,
268 #[doc = " The radius of the semicircles"]
269 pub radius: f32,
270}
271#[doc = " A solid convex polygon. It is assumed that the interior of the polygon is to\n the left of each edge.\n Polygons have a maximum number of vertices equal to B2_MAX_POLYGON_VERTICES.\n In most cases you should not need many vertices for a convex polygon.\n @warning DO NOT fill this out manually, instead use a helper function like\n b2MakePolygon or b2MakeBox."]
272#[repr(C)]
273#[derive(Debug, Copy, Clone)]
274pub struct b2Polygon {
275 #[doc = " The polygon vertices"]
276 pub vertices: [b2Vec2; 8usize],
277 #[doc = " The outward normal vectors of the polygon sides"]
278 pub normals: [b2Vec2; 8usize],
279 #[doc = " The centroid of the polygon"]
280 pub centroid: b2Vec2,
281 #[doc = " The external radius for rounded polygons"]
282 pub radius: f32,
283 #[doc = " The number of polygon vertices"]
284 pub count: ::std::os::raw::c_int,
285}
286#[doc = " A line segment with two-sided collision."]
287#[repr(C)]
288#[derive(Debug, Copy, Clone)]
289pub struct b2Segment {
290 #[doc = " The first point"]
291 pub point1: b2Vec2,
292 #[doc = " The second point"]
293 pub point2: b2Vec2,
294}
295#[doc = " A line segment with one-sided collision. Only collides on the right side.\n Several of these are generated for a chain shape.\n ghost1 -> point1 -> point2 -> ghost2"]
296#[repr(C)]
297#[derive(Debug, Copy, Clone)]
298pub struct b2ChainSegment {
299 #[doc = " The tail ghost vertex"]
300 pub ghost1: b2Vec2,
301 #[doc = " The line segment"]
302 pub segment: b2Segment,
303 #[doc = " The head ghost vertex"]
304 pub ghost2: b2Vec2,
305 #[doc = " The owning chain shape index (internal usage only)"]
306 pub chainId: ::std::os::raw::c_int,
307}
308unsafe extern "C" {
309 #[doc = " Validate ray cast input data (NaN, etc)"]
310 pub fn b2IsValidRay(input: *const b2RayCastInput) -> bool;
311}
312unsafe extern "C" {
313 #[doc = " Make a convex polygon from a convex hull. This will assert if the hull is not valid.\n @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull"]
314 pub fn b2MakePolygon(hull: *const b2Hull, radius: f32) -> b2Polygon;
315}
316unsafe extern "C" {
317 #[doc = " Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.\n @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull"]
318 pub fn b2MakeOffsetPolygon(hull: *const b2Hull, position: b2Vec2, rotation: b2Rot)
319 -> b2Polygon;
320}
321unsafe extern "C" {
322 #[doc = " Make an offset convex polygon from a convex hull. This will assert if the hull is not valid.\n @warning Do not manually fill in the hull data, it must come directly from b2ComputeHull"]
323 pub fn b2MakeOffsetRoundedPolygon(
324 hull: *const b2Hull,
325 position: b2Vec2,
326 rotation: b2Rot,
327 radius: f32,
328 ) -> b2Polygon;
329}
330unsafe extern "C" {
331 #[doc = " Make a square polygon, bypassing the need for a convex hull.\n @param halfWidth the half-width"]
332 pub fn b2MakeSquare(halfWidth: f32) -> b2Polygon;
333}
334unsafe extern "C" {
335 #[doc = " Make a box (rectangle) polygon, bypassing the need for a convex hull.\n @param halfWidth the half-width (x-axis)\n @param halfHeight the half-height (y-axis)"]
336 pub fn b2MakeBox(halfWidth: f32, halfHeight: f32) -> b2Polygon;
337}
338unsafe extern "C" {
339 #[doc = " Make a rounded box, bypassing the need for a convex hull.\n @param halfWidth the half-width (x-axis)\n @param halfHeight the half-height (y-axis)\n @param radius the radius of the rounded extension"]
340 pub fn b2MakeRoundedBox(halfWidth: f32, halfHeight: f32, radius: f32) -> b2Polygon;
341}
342unsafe extern "C" {
343 #[doc = " Make an offset box, bypassing the need for a convex hull.\n @param halfWidth the half-width (x-axis)\n @param halfHeight the half-height (y-axis)\n @param center the local center of the box\n @param rotation the local rotation of the box"]
344 pub fn b2MakeOffsetBox(
345 halfWidth: f32,
346 halfHeight: f32,
347 center: b2Vec2,
348 rotation: b2Rot,
349 ) -> b2Polygon;
350}
351unsafe extern "C" {
352 #[doc = " Make an offset rounded box, bypassing the need for a convex hull.\n @param halfWidth the half-width (x-axis)\n @param halfHeight the half-height (y-axis)\n @param center the local center of the box\n @param rotation the local rotation of the box\n @param radius the radius of the rounded extension"]
353 pub fn b2MakeOffsetRoundedBox(
354 halfWidth: f32,
355 halfHeight: f32,
356 center: b2Vec2,
357 rotation: b2Rot,
358 radius: f32,
359 ) -> b2Polygon;
360}
361unsafe extern "C" {
362 #[doc = " Transform a polygon. This is useful for transferring a shape from one body to another."]
363 pub fn b2TransformPolygon(transform: b2Transform, polygon: *const b2Polygon) -> b2Polygon;
364}
365unsafe extern "C" {
366 #[doc = " Compute mass properties of a circle"]
367 pub fn b2ComputeCircleMass(shape: *const b2Circle, density: f32) -> b2MassData;
368}
369unsafe extern "C" {
370 #[doc = " Compute mass properties of a capsule"]
371 pub fn b2ComputeCapsuleMass(shape: *const b2Capsule, density: f32) -> b2MassData;
372}
373unsafe extern "C" {
374 #[doc = " Compute mass properties of a polygon"]
375 pub fn b2ComputePolygonMass(shape: *const b2Polygon, density: f32) -> b2MassData;
376}
377unsafe extern "C" {
378 #[doc = " Compute the bounding box of a transformed circle"]
379 pub fn b2ComputeCircleAABB(shape: *const b2Circle, transform: b2Transform) -> b2AABB;
380}
381unsafe extern "C" {
382 #[doc = " Compute the bounding box of a transformed capsule"]
383 pub fn b2ComputeCapsuleAABB(shape: *const b2Capsule, transform: b2Transform) -> b2AABB;
384}
385unsafe extern "C" {
386 #[doc = " Compute the bounding box of a transformed polygon"]
387 pub fn b2ComputePolygonAABB(shape: *const b2Polygon, transform: b2Transform) -> b2AABB;
388}
389unsafe extern "C" {
390 #[doc = " Compute the bounding box of a transformed line segment"]
391 pub fn b2ComputeSegmentAABB(shape: *const b2Segment, transform: b2Transform) -> b2AABB;
392}
393unsafe extern "C" {
394 #[doc = " Test a point for overlap with a circle in local space"]
395 pub fn b2PointInCircle(shape: *const b2Circle, point: b2Vec2) -> bool;
396}
397unsafe extern "C" {
398 #[doc = " Test a point for overlap with a capsule in local space"]
399 pub fn b2PointInCapsule(shape: *const b2Capsule, point: b2Vec2) -> bool;
400}
401unsafe extern "C" {
402 #[doc = " Test a point for overlap with a convex polygon in local space"]
403 pub fn b2PointInPolygon(shape: *const b2Polygon, point: b2Vec2) -> bool;
404}
405unsafe extern "C" {
406 #[doc = " Ray cast versus circle shape in local space."]
407 pub fn b2RayCastCircle(shape: *const b2Circle, input: *const b2RayCastInput) -> b2CastOutput;
408}
409unsafe extern "C" {
410 #[doc = " Ray cast versus capsule shape in local space."]
411 pub fn b2RayCastCapsule(shape: *const b2Capsule, input: *const b2RayCastInput) -> b2CastOutput;
412}
413unsafe extern "C" {
414 #[doc = " Ray cast versus segment shape in local space. Optionally treat the segment as one-sided with hits from\n the left side being treated as a miss."]
415 pub fn b2RayCastSegment(
416 shape: *const b2Segment,
417 input: *const b2RayCastInput,
418 oneSided: bool,
419 ) -> b2CastOutput;
420}
421unsafe extern "C" {
422 #[doc = " Ray cast versus polygon shape in local space."]
423 pub fn b2RayCastPolygon(shape: *const b2Polygon, input: *const b2RayCastInput) -> b2CastOutput;
424}
425unsafe extern "C" {
426 #[doc = " Shape cast versus a circle."]
427 pub fn b2ShapeCastCircle(
428 shape: *const b2Circle,
429 input: *const b2ShapeCastInput,
430 ) -> b2CastOutput;
431}
432unsafe extern "C" {
433 #[doc = " Shape cast versus a capsule."]
434 pub fn b2ShapeCastCapsule(
435 shape: *const b2Capsule,
436 input: *const b2ShapeCastInput,
437 ) -> b2CastOutput;
438}
439unsafe extern "C" {
440 #[doc = " Shape cast versus a line segment."]
441 pub fn b2ShapeCastSegment(
442 shape: *const b2Segment,
443 input: *const b2ShapeCastInput,
444 ) -> b2CastOutput;
445}
446unsafe extern "C" {
447 #[doc = " Shape cast versus a convex polygon."]
448 pub fn b2ShapeCastPolygon(
449 shape: *const b2Polygon,
450 input: *const b2ShapeCastInput,
451 ) -> b2CastOutput;
452}
453#[doc = " A convex hull. Used to create convex polygons.\n @warning Do not modify these values directly, instead use b2ComputeHull()"]
454#[repr(C)]
455#[derive(Debug, Copy, Clone)]
456pub struct b2Hull {
457 #[doc = " The final points of the hull"]
458 pub points: [b2Vec2; 8usize],
459 #[doc = " The number of points"]
460 pub count: ::std::os::raw::c_int,
461}
462unsafe extern "C" {
463 #[doc = " Compute the convex hull of a set of points. Returns an empty hull if it fails.\n Some failure cases:\n - all points very close together\n - all points on a line\n - less than 3 points\n - more than B2_MAX_POLYGON_VERTICES points\n This welds close points and removes collinear points.\n @warning Do not modify a hull once it has been computed"]
464 pub fn b2ComputeHull(points: *const b2Vec2, count: ::std::os::raw::c_int) -> b2Hull;
465}
466unsafe extern "C" {
467 #[doc = " This determines if a hull is valid. Checks for:\n - convexity\n - collinear points\n This is expensive and should not be called at runtime."]
468 pub fn b2ValidateHull(hull: *const b2Hull) -> bool;
469}
470#[doc = " Result of computing the distance between two line segments"]
471#[repr(C)]
472#[derive(Debug, Copy, Clone)]
473pub struct b2SegmentDistanceResult {
474 #[doc = " The closest point on the first segment"]
475 pub closest1: b2Vec2,
476 #[doc = " The closest point on the second segment"]
477 pub closest2: b2Vec2,
478 #[doc = " The barycentric coordinate on the first segment"]
479 pub fraction1: f32,
480 #[doc = " The barycentric coordinate on the second segment"]
481 pub fraction2: f32,
482 #[doc = " The squared distance between the closest points"]
483 pub distanceSquared: f32,
484}
485unsafe extern "C" {
486 #[doc = " Compute the distance between two line segments, clamping at the end points if needed."]
487 pub fn b2SegmentDistance(
488 p1: b2Vec2,
489 q1: b2Vec2,
490 p2: b2Vec2,
491 q2: b2Vec2,
492 ) -> b2SegmentDistanceResult;
493}
494#[doc = " Used to warm start the GJK simplex. If you call this function multiple times with nearby\n transforms this might improve performance. Otherwise you can zero initialize this.\n The distance cache must be initialized to zero on the first call.\n Users should generally just zero initialize this structure for each call."]
495#[repr(C)]
496#[derive(Debug, Copy, Clone)]
497pub struct b2SimplexCache {
498 #[doc = " The number of stored simplex points"]
499 pub count: u16,
500 #[doc = " The cached simplex indices on shape A"]
501 pub indexA: [u8; 3usize],
502 #[doc = " The cached simplex indices on shape B"]
503 pub indexB: [u8; 3usize],
504}
505#[doc = " Input for b2ShapeDistance"]
506#[repr(C)]
507#[derive(Debug, Copy, Clone)]
508pub struct b2DistanceInput {
509 #[doc = " The proxy for shape A"]
510 pub proxyA: b2ShapeProxy,
511 #[doc = " The proxy for shape B"]
512 pub proxyB: b2ShapeProxy,
513 #[doc = " The world transform for shape A"]
514 pub transformA: b2Transform,
515 #[doc = " The world transform for shape B"]
516 pub transformB: b2Transform,
517 #[doc = " Should the proxy radius be considered?"]
518 pub useRadii: bool,
519}
520#[doc = " Output for b2ShapeDistance"]
521#[repr(C)]
522#[derive(Debug, Copy, Clone)]
523pub struct b2DistanceOutput {
524 #[doc = "< Closest point on shapeA"]
525 pub pointA: b2Vec2,
526 #[doc = "< Closest point on shapeB"]
527 pub pointB: b2Vec2,
528 #[doc = "< Normal vector that points from A to B. Invalid if distance is zero."]
529 pub normal: b2Vec2,
530 #[doc = "< The final distance, zero if overlapped"]
531 pub distance: f32,
532 #[doc = "< Number of GJK iterations used"]
533 pub iterations: ::std::os::raw::c_int,
534 #[doc = "< The number of simplexes stored in the simplex array"]
535 pub simplexCount: ::std::os::raw::c_int,
536}
537#[doc = " Simplex vertex for debugging the GJK algorithm"]
538#[repr(C)]
539#[derive(Debug, Copy, Clone)]
540pub struct b2SimplexVertex {
541 #[doc = "< support point in proxyA"]
542 pub wA: b2Vec2,
543 #[doc = "< support point in proxyB"]
544 pub wB: b2Vec2,
545 #[doc = "< wB - wA"]
546 pub w: b2Vec2,
547 #[doc = "< barycentric coordinate for closest point"]
548 pub a: f32,
549 #[doc = "< wA index"]
550 pub indexA: ::std::os::raw::c_int,
551 #[doc = "< wB index"]
552 pub indexB: ::std::os::raw::c_int,
553}
554#[doc = " Simplex from the GJK algorithm"]
555#[repr(C)]
556#[derive(Debug, Copy, Clone)]
557pub struct b2Simplex {
558 #[doc = "< vertices"]
559 pub v1: b2SimplexVertex,
560 #[doc = "< vertices"]
561 pub v2: b2SimplexVertex,
562 #[doc = "< vertices"]
563 pub v3: b2SimplexVertex,
564 #[doc = "< number of valid vertices"]
565 pub count: ::std::os::raw::c_int,
566}
567unsafe extern "C" {
568 #[doc = " Compute the closest points between two shapes represented as point clouds.\n b2SimplexCache cache is input/output. On the first call set b2SimplexCache.count to zero.\n The underlying GJK algorithm may be debugged by passing in debug simplexes and capacity. You may pass in NULL and 0 for these."]
569 pub fn b2ShapeDistance(
570 input: *const b2DistanceInput,
571 cache: *mut b2SimplexCache,
572 simplexes: *mut b2Simplex,
573 simplexCapacity: ::std::os::raw::c_int,
574 ) -> b2DistanceOutput;
575}
576#[doc = " Input parameters for b2ShapeCast"]
577#[repr(C)]
578#[derive(Debug, Copy, Clone)]
579pub struct b2ShapeCastPairInput {
580 #[doc = "< The proxy for shape A"]
581 pub proxyA: b2ShapeProxy,
582 #[doc = "< The proxy for shape B"]
583 pub proxyB: b2ShapeProxy,
584 #[doc = "< The world transform for shape A"]
585 pub transformA: b2Transform,
586 #[doc = "< The world transform for shape B"]
587 pub transformB: b2Transform,
588 #[doc = "< The translation of shape B"]
589 pub translationB: b2Vec2,
590 #[doc = "< The fraction of the translation to consider, typically 1"]
591 pub maxFraction: f32,
592 #[doc = "< Allows shapes with a radius to move slightly closer if already touching"]
593 pub canEncroach: bool,
594}
595unsafe extern "C" {
596 #[doc = " Perform a linear shape cast of shape B moving and shape A fixed. Determines the hit point, normal, and translation fraction.\n Initially touching shapes are treated as a miss."]
597 pub fn b2ShapeCast(input: *const b2ShapeCastPairInput) -> b2CastOutput;
598}
599unsafe extern "C" {
600 #[doc = " Make a proxy for use in overlap, shape cast, and related functions. This is a deep copy of the points."]
601 pub fn b2MakeProxy(
602 points: *const b2Vec2,
603 count: ::std::os::raw::c_int,
604 radius: f32,
605 ) -> b2ShapeProxy;
606}
607unsafe extern "C" {
608 #[doc = " Make a proxy with a transform. This is a deep copy of the points."]
609 pub fn b2MakeOffsetProxy(
610 points: *const b2Vec2,
611 count: ::std::os::raw::c_int,
612 radius: f32,
613 position: b2Vec2,
614 rotation: b2Rot,
615 ) -> b2ShapeProxy;
616}
617#[doc = " This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin,\n which may not coincide with the center of mass. However, to support dynamics we must interpolate the center of mass\n position."]
618#[repr(C)]
619#[derive(Debug, Copy, Clone)]
620pub struct b2Sweep {
621 #[doc = "< Local center of mass position"]
622 pub localCenter: b2Vec2,
623 #[doc = "< Starting center of mass world position"]
624 pub c1: b2Vec2,
625 #[doc = "< Ending center of mass world position"]
626 pub c2: b2Vec2,
627 #[doc = "< Starting world rotation"]
628 pub q1: b2Rot,
629 #[doc = "< Ending world rotation"]
630 pub q2: b2Rot,
631}
632unsafe extern "C" {
633 #[doc = " Evaluate the transform sweep at a specific time."]
634 pub fn b2GetSweepTransform(sweep: *const b2Sweep, time: f32) -> b2Transform;
635}
636#[doc = " Time of impact input"]
637#[repr(C)]
638#[derive(Debug, Copy, Clone)]
639pub struct b2TOIInput {
640 #[doc = "< The proxy for shape A"]
641 pub proxyA: b2ShapeProxy,
642 #[doc = "< The proxy for shape B"]
643 pub proxyB: b2ShapeProxy,
644 #[doc = "< The movement of shape A"]
645 pub sweepA: b2Sweep,
646 #[doc = "< The movement of shape B"]
647 pub sweepB: b2Sweep,
648 #[doc = "< Defines the sweep interval [0, maxFraction]"]
649 pub maxFraction: f32,
650}
651pub const b2TOIState_b2_toiStateUnknown: b2TOIState = 0;
652pub const b2TOIState_b2_toiStateFailed: b2TOIState = 1;
653pub const b2TOIState_b2_toiStateOverlapped: b2TOIState = 2;
654pub const b2TOIState_b2_toiStateHit: b2TOIState = 3;
655pub const b2TOIState_b2_toiStateSeparated: b2TOIState = 4;
656#[doc = " Describes the TOI output"]
657pub type b2TOIState = ::std::os::raw::c_uint;
658#[doc = " Time of impact output"]
659#[repr(C)]
660#[derive(Debug, Copy, Clone)]
661pub struct b2TOIOutput {
662 #[doc = " The type of result"]
663 pub state: b2TOIState,
664 #[doc = " The hit point"]
665 pub point: b2Vec2,
666 #[doc = " The hit normal"]
667 pub normal: b2Vec2,
668 #[doc = " The sweep time of the collision"]
669 pub fraction: f32,
670}
671unsafe extern "C" {
672 #[doc = " Compute the upper bound on time before two shapes penetrate. Time is represented as\n a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,\n non-tunneling collisions. If you change the time interval, you should call this function\n again."]
673 pub fn b2TimeOfImpact(input: *const b2TOIInput) -> b2TOIOutput;
674}
675#[doc = " A manifold point is a contact point belonging to a contact manifold.\n It holds details related to the geometry and dynamics of the contact points.\n Box2D uses speculative collision so some contact points may be separated.\n You may use the totalNormalImpulse to determine if there was an interaction during\n the time step."]
676#[repr(C)]
677#[derive(Debug, Copy, Clone)]
678pub struct b2ManifoldPoint {
679 #[doc = " Location of the contact point in world space. Subject to precision loss at large coordinates.\n @note Should only be used for debugging."]
680 pub point: b2Vec2,
681 #[doc = " Location of the contact point relative to shapeA's origin in world space\n @note When used internally to the Box2D solver, this is relative to the body center of mass."]
682 pub anchorA: b2Vec2,
683 #[doc = " Location of the contact point relative to shapeB's origin in world space\n @note When used internally to the Box2D solver, this is relative to the body center of mass."]
684 pub anchorB: b2Vec2,
685 #[doc = " The separation of the contact point, negative if penetrating"]
686 pub separation: f32,
687 #[doc = " The impulse along the manifold normal vector."]
688 pub normalImpulse: f32,
689 #[doc = " The friction impulse"]
690 pub tangentImpulse: f32,
691 #[doc = " The total normal impulse applied across sub-stepping and restitution. This is important\n to identify speculative contact points that had an interaction in the time step.\n This includes the warm starting impulse, the sub-step delta impulse, and the restitution\n impulse."]
692 pub totalNormalImpulse: f32,
693 #[doc = " Relative normal velocity pre-solve. Used for hit events. If the normal impulse is\n zero then there was no hit. Negative means shapes are approaching."]
694 pub normalVelocity: f32,
695 #[doc = " Uniquely identifies a contact point between two shapes"]
696 pub id: u16,
697 #[doc = " Did this contact point exist the previous step?"]
698 pub persisted: bool,
699}
700#[doc = " A contact manifold describes the contact points between colliding shapes.\n @note Box2D uses speculative collision so some contact points may be separated."]
701#[repr(C)]
702#[derive(Debug, Copy, Clone)]
703pub struct b2Manifold {
704 #[doc = " The unit normal vector in world space, points from shape A to bodyB"]
705 pub normal: b2Vec2,
706 #[doc = " Angular impulse applied for rolling resistance. N * m * s = kg * m^2 / s"]
707 pub rollingImpulse: f32,
708 #[doc = " The manifold points, up to two are possible in 2D"]
709 pub points: [b2ManifoldPoint; 2usize],
710 #[doc = " The number of contacts points, will be 0, 1, or 2"]
711 pub pointCount: ::std::os::raw::c_int,
712}
713unsafe extern "C" {
714 #[doc = " Compute the contact manifold between two circles"]
715 pub fn b2CollideCircles(
716 circleA: *const b2Circle,
717 xfA: b2Transform,
718 circleB: *const b2Circle,
719 xfB: b2Transform,
720 ) -> b2Manifold;
721}
722unsafe extern "C" {
723 #[doc = " Compute the contact manifold between a capsule and circle"]
724 pub fn b2CollideCapsuleAndCircle(
725 capsuleA: *const b2Capsule,
726 xfA: b2Transform,
727 circleB: *const b2Circle,
728 xfB: b2Transform,
729 ) -> b2Manifold;
730}
731unsafe extern "C" {
732 #[doc = " Compute the contact manifold between an segment and a circle"]
733 pub fn b2CollideSegmentAndCircle(
734 segmentA: *const b2Segment,
735 xfA: b2Transform,
736 circleB: *const b2Circle,
737 xfB: b2Transform,
738 ) -> b2Manifold;
739}
740unsafe extern "C" {
741 #[doc = " Compute the contact manifold between a polygon and a circle"]
742 pub fn b2CollidePolygonAndCircle(
743 polygonA: *const b2Polygon,
744 xfA: b2Transform,
745 circleB: *const b2Circle,
746 xfB: b2Transform,
747 ) -> b2Manifold;
748}
749unsafe extern "C" {
750 #[doc = " Compute the contact manifold between a capsule and circle"]
751 pub fn b2CollideCapsules(
752 capsuleA: *const b2Capsule,
753 xfA: b2Transform,
754 capsuleB: *const b2Capsule,
755 xfB: b2Transform,
756 ) -> b2Manifold;
757}
758unsafe extern "C" {
759 #[doc = " Compute the contact manifold between an segment and a capsule"]
760 pub fn b2CollideSegmentAndCapsule(
761 segmentA: *const b2Segment,
762 xfA: b2Transform,
763 capsuleB: *const b2Capsule,
764 xfB: b2Transform,
765 ) -> b2Manifold;
766}
767unsafe extern "C" {
768 #[doc = " Compute the contact manifold between a polygon and capsule"]
769 pub fn b2CollidePolygonAndCapsule(
770 polygonA: *const b2Polygon,
771 xfA: b2Transform,
772 capsuleB: *const b2Capsule,
773 xfB: b2Transform,
774 ) -> b2Manifold;
775}
776unsafe extern "C" {
777 #[doc = " Compute the contact manifold between two polygons"]
778 pub fn b2CollidePolygons(
779 polygonA: *const b2Polygon,
780 xfA: b2Transform,
781 polygonB: *const b2Polygon,
782 xfB: b2Transform,
783 ) -> b2Manifold;
784}
785unsafe extern "C" {
786 #[doc = " Compute the contact manifold between an segment and a polygon"]
787 pub fn b2CollideSegmentAndPolygon(
788 segmentA: *const b2Segment,
789 xfA: b2Transform,
790 polygonB: *const b2Polygon,
791 xfB: b2Transform,
792 ) -> b2Manifold;
793}
794unsafe extern "C" {
795 #[doc = " Compute the contact manifold between a chain segment and a circle"]
796 pub fn b2CollideChainSegmentAndCircle(
797 segmentA: *const b2ChainSegment,
798 xfA: b2Transform,
799 circleB: *const b2Circle,
800 xfB: b2Transform,
801 ) -> b2Manifold;
802}
803unsafe extern "C" {
804 #[doc = " Compute the contact manifold between a chain segment and a capsule"]
805 pub fn b2CollideChainSegmentAndCapsule(
806 segmentA: *const b2ChainSegment,
807 xfA: b2Transform,
808 capsuleB: *const b2Capsule,
809 xfB: b2Transform,
810 cache: *mut b2SimplexCache,
811 ) -> b2Manifold;
812}
813unsafe extern "C" {
814 #[doc = " Compute the contact manifold between a chain segment and a rounded polygon"]
815 pub fn b2CollideChainSegmentAndPolygon(
816 segmentA: *const b2ChainSegment,
817 xfA: b2Transform,
818 polygonB: *const b2Polygon,
819 xfB: b2Transform,
820 cache: *mut b2SimplexCache,
821 ) -> b2Manifold;
822}
823#[doc = " The dynamic tree structure. This should be considered private data.\n It is placed here for performance reasons."]
824#[repr(C)]
825#[derive(Debug, Copy, Clone)]
826pub struct b2DynamicTree {
827 #[doc = " The tree nodes"]
828 pub nodes: *mut b2TreeNode,
829 #[doc = " The root index"]
830 pub root: ::std::os::raw::c_int,
831 #[doc = " The number of nodes"]
832 pub nodeCount: ::std::os::raw::c_int,
833 #[doc = " The allocated node space"]
834 pub nodeCapacity: ::std::os::raw::c_int,
835 #[doc = " Node free list"]
836 pub freeList: ::std::os::raw::c_int,
837 #[doc = " Number of proxies created"]
838 pub proxyCount: ::std::os::raw::c_int,
839 #[doc = " Leaf indices for rebuild"]
840 pub leafIndices: *mut ::std::os::raw::c_int,
841 #[doc = " Leaf bounding boxes for rebuild"]
842 pub leafBoxes: *mut b2AABB,
843 #[doc = " Leaf bounding box centers for rebuild"]
844 pub leafCenters: *mut b2Vec2,
845 #[doc = " Bins for sorting during rebuild"]
846 pub binIndices: *mut ::std::os::raw::c_int,
847 #[doc = " Allocated space for rebuilding"]
848 pub rebuildCapacity: ::std::os::raw::c_int,
849}
850#[doc = " These are performance results returned by dynamic tree queries."]
851#[repr(C)]
852#[derive(Debug, Copy, Clone)]
853pub struct b2TreeStats {
854 #[doc = " Number of internal nodes visited during the query"]
855 pub nodeVisits: ::std::os::raw::c_int,
856 #[doc = " Number of leaf nodes visited during the query"]
857 pub leafVisits: ::std::os::raw::c_int,
858}
859unsafe extern "C" {
860 #[doc = " Constructing the tree initializes the node pool."]
861 pub fn b2DynamicTree_Create() -> b2DynamicTree;
862}
863unsafe extern "C" {
864 #[doc = " Destroy the tree, freeing the node pool."]
865 pub fn b2DynamicTree_Destroy(tree: *mut b2DynamicTree);
866}
867unsafe extern "C" {
868 #[doc = " Create a proxy. Provide an AABB and a userData value."]
869 pub fn b2DynamicTree_CreateProxy(
870 tree: *mut b2DynamicTree,
871 aabb: b2AABB,
872 categoryBits: u64,
873 userData: u64,
874 ) -> ::std::os::raw::c_int;
875}
876unsafe extern "C" {
877 #[doc = " Destroy a proxy. This asserts if the id is invalid."]
878 pub fn b2DynamicTree_DestroyProxy(tree: *mut b2DynamicTree, proxyId: ::std::os::raw::c_int);
879}
880unsafe extern "C" {
881 #[doc = " Move a proxy to a new AABB by removing and reinserting into the tree."]
882 pub fn b2DynamicTree_MoveProxy(
883 tree: *mut b2DynamicTree,
884 proxyId: ::std::os::raw::c_int,
885 aabb: b2AABB,
886 );
887}
888unsafe extern "C" {
889 #[doc = " Enlarge a proxy and enlarge ancestors as necessary."]
890 pub fn b2DynamicTree_EnlargeProxy(
891 tree: *mut b2DynamicTree,
892 proxyId: ::std::os::raw::c_int,
893 aabb: b2AABB,
894 );
895}
896unsafe extern "C" {
897 #[doc = " Modify the category bits on a proxy. This is an expensive operation."]
898 pub fn b2DynamicTree_SetCategoryBits(
899 tree: *mut b2DynamicTree,
900 proxyId: ::std::os::raw::c_int,
901 categoryBits: u64,
902 );
903}
904unsafe extern "C" {
905 #[doc = " Get the category bits on a proxy."]
906 pub fn b2DynamicTree_GetCategoryBits(
907 tree: *mut b2DynamicTree,
908 proxyId: ::std::os::raw::c_int,
909 ) -> u64;
910}
911#[doc = " This function receives proxies found in the AABB query.\n @return true if the query should continue"]
912pub type b2TreeQueryCallbackFcn = ::std::option::Option<
913 unsafe extern "C" fn(
914 proxyId: ::std::os::raw::c_int,
915 userData: u64,
916 context: *mut ::std::os::raw::c_void,
917 ) -> bool,
918>;
919unsafe extern "C" {
920 #[doc = " Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.\n\t@return performance data"]
921 pub fn b2DynamicTree_Query(
922 tree: *const b2DynamicTree,
923 aabb: b2AABB,
924 maskBits: u64,
925 callback: b2TreeQueryCallbackFcn,
926 context: *mut ::std::os::raw::c_void,
927 ) -> b2TreeStats;
928}
929unsafe extern "C" {
930 #[doc = " Query an AABB for overlapping proxies. The callback class is called for each proxy that overlaps the supplied AABB.\n No filtering is performed.\n\t@return performance data"]
931 pub fn b2DynamicTree_QueryAll(
932 tree: *const b2DynamicTree,
933 aabb: b2AABB,
934 callback: b2TreeQueryCallbackFcn,
935 context: *mut ::std::os::raw::c_void,
936 ) -> b2TreeStats;
937}
938#[doc = " This function receives clipped ray cast input for a proxy. The function\n returns the new ray fraction.\n - return a value of 0 to terminate the ray cast\n - return a value less than input->maxFraction to clip the ray\n - return a value of input->maxFraction to continue the ray cast without clipping"]
939pub type b2TreeRayCastCallbackFcn = ::std::option::Option<
940 unsafe extern "C" fn(
941 input: *const b2RayCastInput,
942 proxyId: ::std::os::raw::c_int,
943 userData: u64,
944 context: *mut ::std::os::raw::c_void,
945 ) -> f32,
946>;
947unsafe extern "C" {
948 #[doc = " Ray cast against the proxies in the tree. This relies on the callback\n to perform a exact ray cast in the case were the proxy contains a shape.\n The callback also performs the any collision filtering. This has performance\n roughly equal to k * log(n), where k is the number of collisions and n is the\n number of proxies in the tree.\n Bit-wise filtering using mask bits can greatly improve performance in some scenarios.\n\tHowever, this filtering may be approximate, so the user should still apply filtering to results.\n @param tree the dynamic tree to ray cast\n @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1)\n @param maskBits mask bit hint: `bool accept = (maskBits & node->categoryBits) != 0;`\n @param callback a callback class that is called for each proxy that is hit by the ray\n @param context user context that is passed to the callback\n\t@return performance data"]
949 pub fn b2DynamicTree_RayCast(
950 tree: *const b2DynamicTree,
951 input: *const b2RayCastInput,
952 maskBits: u64,
953 callback: b2TreeRayCastCallbackFcn,
954 context: *mut ::std::os::raw::c_void,
955 ) -> b2TreeStats;
956}
957#[doc = " This function receives clipped ray cast input for a proxy. The function\n returns the new ray fraction.\n - return a value of 0 to terminate the ray cast\n - return a value less than input->maxFraction to clip the ray\n - return a value of input->maxFraction to continue the ray cast without clipping"]
958pub type b2TreeShapeCastCallbackFcn = ::std::option::Option<
959 unsafe extern "C" fn(
960 input: *const b2ShapeCastInput,
961 proxyId: ::std::os::raw::c_int,
962 userData: u64,
963 context: *mut ::std::os::raw::c_void,
964 ) -> f32,
965>;
966unsafe extern "C" {
967 #[doc = " Ray cast against the proxies in the tree. This relies on the callback\n to perform a exact ray cast in the case were the proxy contains a shape.\n The callback also performs the any collision filtering. This has performance\n roughly equal to k * log(n), where k is the number of collisions and n is the\n number of proxies in the tree.\n @param tree the dynamic tree to ray cast\n @param input the ray cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1).\n @param maskBits filter bits: `bool accept = (maskBits & node->categoryBits) != 0;`\n @param callback a callback class that is called for each proxy that is hit by the shape\n @param context user context that is passed to the callback\n\t@return performance data"]
968 pub fn b2DynamicTree_ShapeCast(
969 tree: *const b2DynamicTree,
970 input: *const b2ShapeCastInput,
971 maskBits: u64,
972 callback: b2TreeShapeCastCallbackFcn,
973 context: *mut ::std::os::raw::c_void,
974 ) -> b2TreeStats;
975}
976unsafe extern "C" {
977 #[doc = " Get the height of the binary tree."]
978 pub fn b2DynamicTree_GetHeight(tree: *const b2DynamicTree) -> ::std::os::raw::c_int;
979}
980unsafe extern "C" {
981 #[doc = " Get the ratio of the sum of the node areas to the root area."]
982 pub fn b2DynamicTree_GetAreaRatio(tree: *const b2DynamicTree) -> f32;
983}
984unsafe extern "C" {
985 #[doc = " Get the bounding box that contains the entire tree"]
986 pub fn b2DynamicTree_GetRootBounds(tree: *const b2DynamicTree) -> b2AABB;
987}
988unsafe extern "C" {
989 #[doc = " Get the number of proxies created"]
990 pub fn b2DynamicTree_GetProxyCount(tree: *const b2DynamicTree) -> ::std::os::raw::c_int;
991}
992unsafe extern "C" {
993 #[doc = " Rebuild the tree while retaining subtrees that haven't changed. Returns the number of boxes sorted."]
994 pub fn b2DynamicTree_Rebuild(
995 tree: *mut b2DynamicTree,
996 fullBuild: bool,
997 ) -> ::std::os::raw::c_int;
998}
999unsafe extern "C" {
1000 #[doc = " Get the number of bytes used by this tree"]
1001 pub fn b2DynamicTree_GetByteCount(tree: *const b2DynamicTree) -> ::std::os::raw::c_int;
1002}
1003unsafe extern "C" {
1004 #[doc = " Get proxy user data"]
1005 pub fn b2DynamicTree_GetUserData(
1006 tree: *const b2DynamicTree,
1007 proxyId: ::std::os::raw::c_int,
1008 ) -> u64;
1009}
1010unsafe extern "C" {
1011 #[doc = " Get the AABB of a proxy"]
1012 pub fn b2DynamicTree_GetAABB(
1013 tree: *const b2DynamicTree,
1014 proxyId: ::std::os::raw::c_int,
1015 ) -> b2AABB;
1016}
1017unsafe extern "C" {
1018 #[doc = " Validate this tree. For testing."]
1019 pub fn b2DynamicTree_Validate(tree: *const b2DynamicTree);
1020}
1021unsafe extern "C" {
1022 #[doc = " Validate this tree has no enlarged AABBs. For testing."]
1023 pub fn b2DynamicTree_ValidateNoEnlarged(tree: *const b2DynamicTree);
1024}
1025#[doc = " These are the collision planes returned from b2World_CollideMover"]
1026#[repr(C)]
1027#[derive(Debug, Copy, Clone)]
1028pub struct b2PlaneResult {
1029 #[doc = " The collision plane between the mover and a convex shape"]
1030 pub plane: b2Plane,
1031 pub point: b2Vec2,
1032 #[doc = " Did the collision register a hit? If not this plane should be ignored."]
1033 pub hit: bool,
1034}
1035#[doc = " These are collision planes that can be fed to b2SolvePlanes. Normally\n this is assembled by the user from plane results in b2PlaneResult"]
1036#[repr(C)]
1037#[derive(Debug, Copy, Clone)]
1038pub struct b2CollisionPlane {
1039 #[doc = " The collision plane between the mover and some shape"]
1040 pub plane: b2Plane,
1041 #[doc = " Setting this to FLT_MAX makes the plane as rigid as possible. Lower values can\n make the plane collision soft. Usually in meters."]
1042 pub pushLimit: f32,
1043 #[doc = " The push on the mover determined by b2SolvePlanes. Usually in meters."]
1044 pub push: f32,
1045 #[doc = " Indicates if b2ClipVector should clip against this plane. Should be false for soft collision."]
1046 pub clipVelocity: bool,
1047}
1048#[doc = " Result returned by b2SolvePlanes"]
1049#[repr(C)]
1050#[derive(Debug, Copy, Clone)]
1051pub struct b2PlaneSolverResult {
1052 #[doc = " The translation of the mover"]
1053 pub translation: b2Vec2,
1054 #[doc = " The number of iterations used by the plane solver. For diagnostics."]
1055 pub iterationCount: ::std::os::raw::c_int,
1056}
1057unsafe extern "C" {
1058 #[doc = " Solves the position of a mover that satisfies the given collision planes.\n @param targetDelta the desired movement from the position used to generate the collision planes\n @param planes the collision planes\n @param count the number of collision planes"]
1059 pub fn b2SolvePlanes(
1060 targetDelta: b2Vec2,
1061 planes: *mut b2CollisionPlane,
1062 count: ::std::os::raw::c_int,
1063 ) -> b2PlaneSolverResult;
1064}
1065unsafe extern "C" {
1066 #[doc = " Clips the velocity against the given collision planes. Planes with zero push or clipVelocity\n set to false are skipped."]
1067 pub fn b2ClipVector(
1068 vector: b2Vec2,
1069 planes: *const b2CollisionPlane,
1070 count: ::std::os::raw::c_int,
1071 ) -> b2Vec2;
1072}
1073#[doc = " World id references a world instance. This should be treated as an opaque handle."]
1074#[repr(C)]
1075#[derive(Debug, Copy, Clone)]
1076pub struct b2WorldId {
1077 pub index1: u16,
1078 pub generation: u16,
1079}
1080#[doc = " Body id references a body instance. This should be treated as an opaque handle."]
1081#[repr(C)]
1082#[derive(Debug, Copy, Clone)]
1083pub struct b2BodyId {
1084 pub index1: i32,
1085 pub world0: u16,
1086 pub generation: u16,
1087}
1088#[doc = " Shape id references a shape instance. This should be treated as an opaque handle."]
1089#[repr(C)]
1090#[derive(Debug, Copy, Clone)]
1091pub struct b2ShapeId {
1092 pub index1: i32,
1093 pub world0: u16,
1094 pub generation: u16,
1095}
1096#[doc = " Chain id references a chain instances. This should be treated as an opaque handle."]
1097#[repr(C)]
1098#[derive(Debug, Copy, Clone)]
1099pub struct b2ChainId {
1100 pub index1: i32,
1101 pub world0: u16,
1102 pub generation: u16,
1103}
1104#[doc = " Joint id references a joint instance. This should be treated as an opaque handle."]
1105#[repr(C)]
1106#[derive(Debug, Copy, Clone)]
1107pub struct b2JointId {
1108 pub index1: i32,
1109 pub world0: u16,
1110 pub generation: u16,
1111}
1112#[doc = " Contact id references a contact instance. This should be treated as an opaque handled."]
1113#[repr(C)]
1114#[derive(Debug, Copy, Clone)]
1115pub struct b2ContactId {
1116 pub index1: i32,
1117 pub world0: u16,
1118 pub padding: i16,
1119 pub generation: u32,
1120}
1121#[doc = " Task interface\n This is prototype for a Box2D task. Your task system is expected to invoke the Box2D task with these arguments.\n The task spans a range of the parallel-for: [startIndex, endIndex)\n The worker index must correctly identify each worker in the user thread pool, expected in [0, workerCount).\n A worker must only exist on only one thread at a time and is analogous to the thread index.\n The task context is the context pointer sent from Box2D when it is enqueued.\n The startIndex and endIndex are expected in the range [0, itemCount) where itemCount is the argument to b2EnqueueTaskCallback\n below. Box2D expects startIndex < endIndex and will execute a loop like this:\n\n @code{.c}\n for (int i = startIndex; i < endIndex; ++i)\n {\n \tDoWork();\n }\n @endcode\n @ingroup world"]
1122pub type b2TaskCallback = ::std::option::Option<
1123 unsafe extern "C" fn(
1124 startIndex: ::std::os::raw::c_int,
1125 endIndex: ::std::os::raw::c_int,
1126 workerIndex: u32,
1127 taskContext: *mut ::std::os::raw::c_void,
1128 ),
1129>;
1130#[doc = " These functions can be provided to Box2D to invoke a task system. These are designed to work well with enkiTS.\n Returns a pointer to the user's task object. May be nullptr. A nullptr indicates to Box2D that the work was executed\n serially within the callback and there is no need to call b2FinishTaskCallback.\n The itemCount is the number of Box2D work items that are to be partitioned among workers by the user's task system.\n This is essentially a parallel-for. The minRange parameter is a suggestion of the minimum number of items to assign\n per worker to reduce overhead. For example, suppose the task is small and that itemCount is 16. A minRange of 8 suggests\n that your task system should split the work items among just two workers, even if you have more available.\n In general the range [startIndex, endIndex) send to b2TaskCallback should obey:\n endIndex - startIndex >= minRange\n The exception of course is when itemCount < minRange.\n @ingroup world"]
1131pub type b2EnqueueTaskCallback = ::std::option::Option<
1132 unsafe extern "C" fn(
1133 task: b2TaskCallback,
1134 itemCount: ::std::os::raw::c_int,
1135 minRange: ::std::os::raw::c_int,
1136 taskContext: *mut ::std::os::raw::c_void,
1137 userContext: *mut ::std::os::raw::c_void,
1138 ) -> *mut ::std::os::raw::c_void,
1139>;
1140#[doc = " Finishes a user task object that wraps a Box2D task.\n @ingroup world"]
1141pub type b2FinishTaskCallback = ::std::option::Option<
1142 unsafe extern "C" fn(
1143 userTask: *mut ::std::os::raw::c_void,
1144 userContext: *mut ::std::os::raw::c_void,
1145 ),
1146>;
1147#[doc = " Optional friction mixing callback. This intentionally provides no context objects because this is called\n from a worker thread.\n @warning This function should not attempt to modify Box2D state or user application state.\n @ingroup world"]
1148pub type b2FrictionCallback = ::std::option::Option<
1149 unsafe extern "C" fn(
1150 frictionA: f32,
1151 userMaterialIdA: u64,
1152 frictionB: f32,
1153 userMaterialIdB: u64,
1154 ) -> f32,
1155>;
1156#[doc = " Optional restitution mixing callback. This intentionally provides no context objects because this is called\n from a worker thread.\n @warning This function should not attempt to modify Box2D state or user application state.\n @ingroup world"]
1157pub type b2RestitutionCallback = ::std::option::Option<
1158 unsafe extern "C" fn(
1159 restitutionA: f32,
1160 userMaterialIdA: u64,
1161 restitutionB: f32,
1162 userMaterialIdB: u64,
1163 ) -> f32,
1164>;
1165#[doc = " Result from b2World_RayCastClosest\n If there is initial overlap the fraction and normal will be zero while the point is an arbitrary point in the overlap region.\n @ingroup world"]
1166#[repr(C)]
1167#[derive(Debug, Copy, Clone)]
1168pub struct b2RayResult {
1169 pub shapeId: b2ShapeId,
1170 pub point: b2Vec2,
1171 pub normal: b2Vec2,
1172 pub fraction: f32,
1173 pub nodeVisits: ::std::os::raw::c_int,
1174 pub leafVisits: ::std::os::raw::c_int,
1175 pub hit: bool,
1176}
1177#[doc = " World definition used to create a simulation world.\n Must be initialized using b2DefaultWorldDef().\n @ingroup world"]
1178#[repr(C)]
1179#[derive(Debug, Copy, Clone)]
1180pub struct b2WorldDef {
1181 #[doc = " Gravity vector. Box2D has no up-vector defined."]
1182 pub gravity: b2Vec2,
1183 #[doc = " Restitution speed threshold, usually in m/s. Collisions above this\n speed have restitution applied (will bounce)."]
1184 pub restitutionThreshold: f32,
1185 #[doc = " Threshold speed for hit events. Usually meters per second."]
1186 pub hitEventThreshold: f32,
1187 #[doc = " Contact stiffness. Cycles per second. Increasing this increases the speed of overlap recovery, but can introduce jitter."]
1188 pub contactHertz: f32,
1189 #[doc = " Contact bounciness. Non-dimensional. You can speed up overlap recovery by decreasing this with\n the trade-off that overlap resolution becomes more energetic."]
1190 pub contactDampingRatio: f32,
1191 #[doc = " This parameter controls how fast overlap is resolved and usually has units of meters per second. This only\n puts a cap on the resolution speed. The resolution speed is increased by increasing the hertz and/or\n decreasing the damping ratio."]
1192 pub contactSpeed: f32,
1193 #[doc = " Maximum linear speed. Usually meters per second."]
1194 pub maximumLinearSpeed: f32,
1195 #[doc = " Optional mixing callback for friction. The default uses sqrt(frictionA * frictionB)."]
1196 pub frictionCallback: b2FrictionCallback,
1197 #[doc = " Optional mixing callback for restitution. The default uses max(restitutionA, restitutionB)."]
1198 pub restitutionCallback: b2RestitutionCallback,
1199 #[doc = " Can bodies go to sleep to improve performance"]
1200 pub enableSleep: bool,
1201 #[doc = " Enable continuous collision"]
1202 pub enableContinuous: bool,
1203 #[doc = " Contact softening when mass ratios are large. Experimental."]
1204 pub enableContactSoftening: bool,
1205 #[doc = " Number of workers to use with the provided task system. Box2D performs best when using only\n performance cores and accessing a single L2 cache. Efficiency cores and hyper-threading provide\n little benefit and may even harm performance.\n @note Box2D does not create threads. This is the number of threads your applications has created\n that you are allocating to b2World_Step.\n @warning Do not modify the default value unless you are also providing a task system and providing\n task callbacks (enqueueTask and finishTask)."]
1206 pub workerCount: ::std::os::raw::c_int,
1207 #[doc = " Function to spawn tasks"]
1208 pub enqueueTask: b2EnqueueTaskCallback,
1209 #[doc = " Function to finish a task"]
1210 pub finishTask: b2FinishTaskCallback,
1211 #[doc = " User context that is provided to enqueueTask and finishTask"]
1212 pub userTaskContext: *mut ::std::os::raw::c_void,
1213 #[doc = " User data"]
1214 pub userData: *mut ::std::os::raw::c_void,
1215 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1216 pub internalValue: ::std::os::raw::c_int,
1217}
1218unsafe extern "C" {
1219 #[doc = " Use this to initialize your world definition\n @ingroup world"]
1220 pub fn b2DefaultWorldDef() -> b2WorldDef;
1221}
1222#[doc = " zero mass, zero velocity, may be manually moved"]
1223pub const b2BodyType_b2_staticBody: b2BodyType = 0;
1224#[doc = " zero mass, velocity set by user, moved by solver"]
1225pub const b2BodyType_b2_kinematicBody: b2BodyType = 1;
1226#[doc = " positive mass, velocity determined by forces, moved by solver"]
1227pub const b2BodyType_b2_dynamicBody: b2BodyType = 2;
1228#[doc = " number of body types"]
1229pub const b2BodyType_b2_bodyTypeCount: b2BodyType = 3;
1230#[doc = " The body simulation type.\n Each body is one of these three types. The type determines how the body behaves in the simulation.\n @ingroup body"]
1231pub type b2BodyType = ::std::os::raw::c_uint;
1232#[doc = " Motion locks to restrict the body movement"]
1233#[repr(C)]
1234#[derive(Debug, Copy, Clone)]
1235pub struct b2MotionLocks {
1236 #[doc = " Prevent translation along the x-axis"]
1237 pub linearX: bool,
1238 #[doc = " Prevent translation along the y-axis"]
1239 pub linearY: bool,
1240 #[doc = " Prevent rotation around the z-axis"]
1241 pub angularZ: bool,
1242}
1243#[doc = " A body definition holds all the data needed to construct a rigid body.\n You can safely re-use body definitions. Shapes are added to a body after construction.\n Body definitions are temporary objects used to bundle creation parameters.\n Must be initialized using b2DefaultBodyDef().\n @ingroup body"]
1244#[repr(C)]
1245#[derive(Debug, Copy, Clone)]
1246pub struct b2BodyDef {
1247 #[doc = " The body type: static, kinematic, or dynamic."]
1248 pub type_: b2BodyType,
1249 #[doc = " The initial world position of the body. Bodies should be created with the desired position.\n @note Creating bodies at the origin and then moving them nearly doubles the cost of body creation, especially\n if the body is moved after shapes have been added."]
1250 pub position: b2Vec2,
1251 #[doc = " The initial world rotation of the body. Use b2MakeRot() if you have an angle."]
1252 pub rotation: b2Rot,
1253 #[doc = " The initial linear velocity of the body's origin. Usually in meters per second."]
1254 pub linearVelocity: b2Vec2,
1255 #[doc = " The initial angular velocity of the body. Radians per second."]
1256 pub angularVelocity: f32,
1257 #[doc = " Linear damping is used to reduce the linear velocity. The damping parameter\n can be larger than 1 but the damping effect becomes sensitive to the\n time step when the damping parameter is large.\n Generally linear damping is undesirable because it makes objects move slowly\n as if they are floating."]
1258 pub linearDamping: f32,
1259 #[doc = " Angular damping is used to reduce the angular velocity. The damping parameter\n can be larger than 1.0f but the damping effect becomes sensitive to the\n time step when the damping parameter is large.\n Angular damping can be use slow down rotating bodies."]
1260 pub angularDamping: f32,
1261 #[doc = " Scale the gravity applied to this body. Non-dimensional."]
1262 pub gravityScale: f32,
1263 #[doc = " Sleep speed threshold, default is 0.05 meters per second"]
1264 pub sleepThreshold: f32,
1265 #[doc = " Optional body name for debugging. Up to 31 characters (excluding null termination)"]
1266 pub name: *const ::std::os::raw::c_char,
1267 #[doc = " Use this to store application specific body data."]
1268 pub userData: *mut ::std::os::raw::c_void,
1269 #[doc = " Motions locks to restrict linear and angular movement.\n Caution: may lead to softer constraints along the locked direction"]
1270 pub motionLocks: b2MotionLocks,
1271 #[doc = " Set this flag to false if this body should never fall asleep."]
1272 pub enableSleep: bool,
1273 #[doc = " Is this body initially awake or sleeping?"]
1274 pub isAwake: bool,
1275 #[doc = " Treat this body as a high speed object that performs continuous collision detection\n against dynamic and kinematic bodies, but not other bullet bodies.\n @warning Bullets should be used sparingly. They are not a solution for general dynamic-versus-dynamic\n continuous collision. They do not guarantee accurate collision if both bodies are fast moving because\n the bullet does a continuous check after all non-bullet bodies have moved. You could get unlucky and have\n the bullet body end a time step very close to a non-bullet body and the non-bullet body then moves over\n the bullet body. In continuous collision, initial overlap is ignored to avoid freezing bodies in place.\n I do not recommend using them for game projectiles if precise collision timing is needed. Instead consider\n using a ray or shape cast. You can use a marching ray or shape cast for projectile that moves over time.\n If you want a fast moving projectile to collide with a fast moving target, you need to consider the relative\n movement in your ray or shape cast. This is out of the scope of Box2D.\n So what are good use cases for bullets? Pinball games or games with dynamic containers that hold other objects.\n It should be a use case where it doesn't break the game if there is a collision missed, but the having them\n captured improves the quality of the game."]
1276 pub isBullet: bool,
1277 #[doc = " Used to disable a body. A disabled body does not move or collide."]
1278 pub isEnabled: bool,
1279 #[doc = " This allows this body to bypass rotational speed limits. Should only be used\n for circular objects, like wheels."]
1280 pub allowFastRotation: bool,
1281 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1282 pub internalValue: ::std::os::raw::c_int,
1283}
1284unsafe extern "C" {
1285 #[doc = " Use this to initialize your body definition\n @ingroup body"]
1286 pub fn b2DefaultBodyDef() -> b2BodyDef;
1287}
1288#[doc = " This is used to filter collision on shapes. It affects shape-vs-shape collision\n and shape-versus-query collision (such as b2World_CastRay).\n @ingroup shape"]
1289#[repr(C)]
1290#[derive(Debug, Copy, Clone)]
1291pub struct b2Filter {
1292 #[doc = " The collision category bits. Normally you would just set one bit. The category bits should\n represent your application object types. For example:\n @code{.cpp}\n enum MyCategories\n {\n Static = 0x00000001,\n Dynamic = 0x00000002,\n Debris = 0x00000004,\n Player = 0x00000008,\n // etc\n };\n @endcode"]
1293 pub categoryBits: u64,
1294 #[doc = " The collision mask bits. This states the categories that this\n shape would accept for collision.\n For example, you may want your player to only collide with static objects\n and other players.\n @code{.c}\n maskBits = Static | Player;\n @endcode"]
1295 pub maskBits: u64,
1296 #[doc = " Collision groups allow a certain group of objects to never collide (negative)\n or always collide (positive). A group index of zero has no effect. Non-zero group filtering\n always wins against the mask bits.\n For example, you may want ragdolls to collide with other ragdolls but you don't want\n ragdoll self-collision. In this case you would give each ragdoll a unique negative group index\n and apply that group index to all shapes on the ragdoll."]
1297 pub groupIndex: ::std::os::raw::c_int,
1298}
1299unsafe extern "C" {
1300 #[doc = " Use this to initialize your filter\n @ingroup shape"]
1301 pub fn b2DefaultFilter() -> b2Filter;
1302}
1303#[doc = " The query filter is used to filter collisions between queries and shapes. For example,\n you may want a ray-cast representing a projectile to hit players and the static environment\n but not debris.\n @ingroup shape"]
1304#[repr(C)]
1305#[derive(Debug, Copy, Clone)]
1306pub struct b2QueryFilter {
1307 #[doc = " The collision category bits of this query. Normally you would just set one bit."]
1308 pub categoryBits: u64,
1309 #[doc = " The collision mask bits. This states the shape categories that this\n query would accept for collision."]
1310 pub maskBits: u64,
1311}
1312unsafe extern "C" {
1313 #[doc = " Use this to initialize your query filter\n @ingroup shape"]
1314 pub fn b2DefaultQueryFilter() -> b2QueryFilter;
1315}
1316#[doc = " A circle with an offset"]
1317pub const b2ShapeType_b2_circleShape: b2ShapeType = 0;
1318#[doc = " A capsule is an extruded circle"]
1319pub const b2ShapeType_b2_capsuleShape: b2ShapeType = 1;
1320#[doc = " A line segment"]
1321pub const b2ShapeType_b2_segmentShape: b2ShapeType = 2;
1322#[doc = " A convex polygon"]
1323pub const b2ShapeType_b2_polygonShape: b2ShapeType = 3;
1324#[doc = " A line segment owned by a chain shape"]
1325pub const b2ShapeType_b2_chainSegmentShape: b2ShapeType = 4;
1326#[doc = " The number of shape types"]
1327pub const b2ShapeType_b2_shapeTypeCount: b2ShapeType = 5;
1328#[doc = " Shape type\n @ingroup shape"]
1329pub type b2ShapeType = ::std::os::raw::c_uint;
1330#[doc = " Surface materials allow chain shapes to have per segment surface properties.\n @ingroup shape"]
1331#[repr(C)]
1332#[derive(Debug, Copy, Clone)]
1333pub struct b2SurfaceMaterial {
1334 #[doc = " The Coulomb (dry) friction coefficient, usually in the range [0,1]."]
1335 pub friction: f32,
1336 #[doc = " The coefficient of restitution (bounce) usually in the range [0,1].\n https://en.wikipedia.org/wiki/Coefficient_of_restitution"]
1337 pub restitution: f32,
1338 #[doc = " The rolling resistance usually in the range [0,1]."]
1339 pub rollingResistance: f32,
1340 #[doc = " The tangent speed for conveyor belts"]
1341 pub tangentSpeed: f32,
1342 #[doc = " User material identifier. This is passed with query results and to friction and restitution\n combining functions. It is not used internally."]
1343 pub userMaterialId: u64,
1344 #[doc = " Custom debug draw color."]
1345 pub customColor: u32,
1346}
1347unsafe extern "C" {
1348 #[doc = " Use this to initialize your surface material\n @ingroup shape"]
1349 pub fn b2DefaultSurfaceMaterial() -> b2SurfaceMaterial;
1350}
1351#[doc = " Used to create a shape.\n This is a temporary object used to bundle shape creation parameters. You may use\n the same shape definition to create multiple shapes.\n Must be initialized using b2DefaultShapeDef().\n @ingroup shape"]
1352#[repr(C)]
1353#[derive(Debug, Copy, Clone)]
1354pub struct b2ShapeDef {
1355 #[doc = " Use this to store application specific shape data."]
1356 pub userData: *mut ::std::os::raw::c_void,
1357 #[doc = " The surface material for this shape."]
1358 pub material: b2SurfaceMaterial,
1359 #[doc = " The density, usually in kg/m^2.\n This is not part of the surface material because this is for the interior, which may have\n other considerations, such as being hollow. For example a wood barrel may be hollow or full of water."]
1360 pub density: f32,
1361 #[doc = " Collision filtering data."]
1362 pub filter: b2Filter,
1363 #[doc = " Enable custom filtering. Only one of the two shapes needs to enable custom filtering. See b2WorldDef."]
1364 pub enableCustomFiltering: bool,
1365 #[doc = " A sensor shape generates overlap events but never generates a collision response.\n Sensors do not have continuous collision. Instead, use a ray or shape cast for those scenarios.\n Sensors still contribute to the body mass if they have non-zero density.\n @note Sensor events are disabled by default.\n @see enableSensorEvents"]
1366 pub isSensor: bool,
1367 #[doc = " Enable sensor events for this shape. This applies to sensors and non-sensors. False by default, even for sensors."]
1368 pub enableSensorEvents: bool,
1369 #[doc = " Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default."]
1370 pub enableContactEvents: bool,
1371 #[doc = " Enable hit events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors. False by default."]
1372 pub enableHitEvents: bool,
1373 #[doc = " Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive\n and must be carefully handled due to multithreading. Ignored for sensors."]
1374 pub enablePreSolveEvents: bool,
1375 #[doc = " When shapes are created they will scan the environment for collision the next time step. This can significantly slow down\n static body creation when there are many static shapes.\n This is flag is ignored for dynamic and kinematic shapes which always invoke contact creation."]
1376 pub invokeContactCreation: bool,
1377 #[doc = " Should the body update the mass properties when this shape is created. Default is true.\n Warning: if this is true, you MUST call b2Body_ApplyMassFromShapes before simulating the world."]
1378 pub updateBodyMass: bool,
1379 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1380 pub internalValue: ::std::os::raw::c_int,
1381}
1382unsafe extern "C" {
1383 #[doc = " Use this to initialize your shape definition\n @ingroup shape"]
1384 pub fn b2DefaultShapeDef() -> b2ShapeDef;
1385}
1386#[doc = " Used to create a chain of line segments. This is designed to eliminate ghost collisions with some limitations.\n - chains are one-sided\n - chains have no mass and should be used on static bodies\n - chains have a counter-clockwise winding order (normal points right of segment direction)\n - chains are either a loop or open\n - a chain must have at least 4 points\n - the distance between any two points must be greater than B2_LINEAR_SLOP\n - a chain shape should not self intersect (this is not validated)\n - an open chain shape has NO COLLISION on the first and final edge\n - you may overlap two open chains on their first three and/or last three points to get smooth collision\n - a chain shape creates multiple line segment shapes on the body\n https://en.wikipedia.org/wiki/Polygonal_chain\n Must be initialized using b2DefaultChainDef().\n @warning Do not use chain shapes unless you understand the limitations. This is an advanced feature.\n @ingroup shape"]
1387#[repr(C)]
1388#[derive(Debug, Copy, Clone)]
1389pub struct b2ChainDef {
1390 #[doc = " Use this to store application specific shape data."]
1391 pub userData: *mut ::std::os::raw::c_void,
1392 #[doc = " An array of at least 4 points. These are cloned and may be temporary."]
1393 pub points: *const b2Vec2,
1394 #[doc = " The point count, must be 4 or more."]
1395 pub count: ::std::os::raw::c_int,
1396 #[doc = " Surface materials for each segment. These are cloned."]
1397 pub materials: *const b2SurfaceMaterial,
1398 #[doc = " The material count. Must be 1 or count. This allows you to provide one\n material for all segments or a unique material per segment. For open\n chains, the material on the ghost segments are place holders."]
1399 pub materialCount: ::std::os::raw::c_int,
1400 #[doc = " Contact filtering data."]
1401 pub filter: b2Filter,
1402 #[doc = " Indicates a closed chain formed by connecting the first and last points"]
1403 pub isLoop: bool,
1404 #[doc = " Enable sensors to detect this chain. False by default."]
1405 pub enableSensorEvents: bool,
1406 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1407 pub internalValue: ::std::os::raw::c_int,
1408}
1409unsafe extern "C" {
1410 #[doc = " Use this to initialize your chain definition\n @ingroup shape"]
1411 pub fn b2DefaultChainDef() -> b2ChainDef;
1412}
1413#[doc = "! @cond\n Profiling data. Times are in milliseconds."]
1414#[repr(C)]
1415#[derive(Debug, Copy, Clone)]
1416pub struct b2Profile {
1417 pub step: f32,
1418 pub pairs: f32,
1419 pub collide: f32,
1420 pub solve: f32,
1421 pub prepareStages: f32,
1422 pub solveConstraints: f32,
1423 pub prepareConstraints: f32,
1424 pub integrateVelocities: f32,
1425 pub warmStart: f32,
1426 pub solveImpulses: f32,
1427 pub integratePositions: f32,
1428 pub relaxImpulses: f32,
1429 pub applyRestitution: f32,
1430 pub storeImpulses: f32,
1431 pub splitIslands: f32,
1432 pub transforms: f32,
1433 pub sensorHits: f32,
1434 pub jointEvents: f32,
1435 pub hitEvents: f32,
1436 pub refit: f32,
1437 pub bullets: f32,
1438 pub sleepIslands: f32,
1439 pub sensors: f32,
1440}
1441#[doc = " Counters that give details of the simulation size."]
1442#[repr(C)]
1443#[derive(Debug, Copy, Clone)]
1444pub struct b2Counters {
1445 pub bodyCount: ::std::os::raw::c_int,
1446 pub shapeCount: ::std::os::raw::c_int,
1447 pub contactCount: ::std::os::raw::c_int,
1448 pub jointCount: ::std::os::raw::c_int,
1449 pub islandCount: ::std::os::raw::c_int,
1450 pub stackUsed: ::std::os::raw::c_int,
1451 pub staticTreeHeight: ::std::os::raw::c_int,
1452 pub treeHeight: ::std::os::raw::c_int,
1453 pub byteCount: ::std::os::raw::c_int,
1454 pub taskCount: ::std::os::raw::c_int,
1455 pub colorCounts: [::std::os::raw::c_int; 24usize],
1456}
1457pub const b2JointType_b2_distanceJoint: b2JointType = 0;
1458pub const b2JointType_b2_filterJoint: b2JointType = 1;
1459pub const b2JointType_b2_motorJoint: b2JointType = 2;
1460pub const b2JointType_b2_prismaticJoint: b2JointType = 3;
1461pub const b2JointType_b2_revoluteJoint: b2JointType = 4;
1462pub const b2JointType_b2_weldJoint: b2JointType = 5;
1463pub const b2JointType_b2_wheelJoint: b2JointType = 6;
1464#[doc = " Joint type enumeration\n\n This is useful because all joint types use b2JointId and sometimes you\n want to get the type of a joint.\n @ingroup joint"]
1465pub type b2JointType = ::std::os::raw::c_uint;
1466#[doc = " Base joint definition used by all joint types.\n The local frames are measured from the body's origin rather than the center of mass because:\n 1. you might not know where the center of mass will be\n 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken"]
1467#[repr(C)]
1468#[derive(Debug, Copy, Clone)]
1469pub struct b2JointDef {
1470 #[doc = " User data pointer"]
1471 pub userData: *mut ::std::os::raw::c_void,
1472 #[doc = " The first attached body"]
1473 pub bodyIdA: b2BodyId,
1474 #[doc = " The second attached body"]
1475 pub bodyIdB: b2BodyId,
1476 #[doc = " The first local joint frame"]
1477 pub localFrameA: b2Transform,
1478 #[doc = " The second local joint frame"]
1479 pub localFrameB: b2Transform,
1480 #[doc = " Force threshold for joint events"]
1481 pub forceThreshold: f32,
1482 #[doc = " Torque threshold for joint events"]
1483 pub torqueThreshold: f32,
1484 #[doc = " Constraint hertz (advanced feature)"]
1485 pub constraintHertz: f32,
1486 #[doc = " Constraint damping ratio (advanced feature)"]
1487 pub constraintDampingRatio: f32,
1488 #[doc = " Debug draw scale"]
1489 pub drawScale: f32,
1490 #[doc = " Set this flag to true if the attached bodies should collide"]
1491 pub collideConnected: bool,
1492}
1493#[doc = " Distance joint definition\n Connects a point on body A with a point on body B by a segment.\n Useful for ropes and springs.\n @ingroup distance_joint"]
1494#[repr(C)]
1495#[derive(Debug, Copy, Clone)]
1496pub struct b2DistanceJointDef {
1497 #[doc = " Base joint definition"]
1498 pub base: b2JointDef,
1499 #[doc = " The rest length of this joint. Clamped to a stable minimum value."]
1500 pub length: f32,
1501 #[doc = " Enable the distance constraint to behave like a spring. If false\n then the distance joint will be rigid, overriding the limit and motor."]
1502 pub enableSpring: bool,
1503 #[doc = " The lower spring force controls how much tension it can sustain"]
1504 pub lowerSpringForce: f32,
1505 #[doc = " The upper spring force controls how much compression it an sustain"]
1506 pub upperSpringForce: f32,
1507 #[doc = " The spring linear stiffness Hertz, cycles per second"]
1508 pub hertz: f32,
1509 #[doc = " The spring linear damping ratio, non-dimensional"]
1510 pub dampingRatio: f32,
1511 #[doc = " Enable/disable the joint limit"]
1512 pub enableLimit: bool,
1513 #[doc = " Minimum length for limit. Clamped to a stable minimum value."]
1514 pub minLength: f32,
1515 #[doc = " Maximum length for limit. Must be greater than or equal to the minimum length."]
1516 pub maxLength: f32,
1517 #[doc = " Enable/disable the joint motor"]
1518 pub enableMotor: bool,
1519 #[doc = " The maximum motor force, usually in newtons"]
1520 pub maxMotorForce: f32,
1521 #[doc = " The desired motor speed, usually in meters per second"]
1522 pub motorSpeed: f32,
1523 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1524 pub internalValue: ::std::os::raw::c_int,
1525}
1526unsafe extern "C" {
1527 #[doc = " Use this to initialize your joint definition\n @ingroup distance_joint"]
1528 pub fn b2DefaultDistanceJointDef() -> b2DistanceJointDef;
1529}
1530#[doc = " A motor joint is used to control the relative velocity and or transform between two bodies.\n With a velocity of zero this acts like top-down friction.\n @ingroup motor_joint"]
1531#[repr(C)]
1532#[derive(Debug, Copy, Clone)]
1533pub struct b2MotorJointDef {
1534 #[doc = " Base joint definition"]
1535 pub base: b2JointDef,
1536 #[doc = " The desired linear velocity"]
1537 pub linearVelocity: b2Vec2,
1538 #[doc = " The maximum motor force in newtons"]
1539 pub maxVelocityForce: f32,
1540 #[doc = " The desired angular velocity"]
1541 pub angularVelocity: f32,
1542 #[doc = " The maximum motor torque in newton-meters"]
1543 pub maxVelocityTorque: f32,
1544 #[doc = " Linear spring hertz for position control"]
1545 pub linearHertz: f32,
1546 #[doc = " Linear spring damping ratio"]
1547 pub linearDampingRatio: f32,
1548 #[doc = " Maximum spring force in newtons"]
1549 pub maxSpringForce: f32,
1550 #[doc = " Angular spring hertz for position control"]
1551 pub angularHertz: f32,
1552 #[doc = " Angular spring damping ratio"]
1553 pub angularDampingRatio: f32,
1554 #[doc = " Maximum spring torque in newton-meters"]
1555 pub maxSpringTorque: f32,
1556 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1557 pub internalValue: ::std::os::raw::c_int,
1558}
1559unsafe extern "C" {
1560 #[doc = " Use this to initialize your joint definition\n @ingroup motor_joint"]
1561 pub fn b2DefaultMotorJointDef() -> b2MotorJointDef;
1562}
1563#[doc = " A filter joint is used to disable collision between two specific bodies.\n\n @ingroup filter_joint"]
1564#[repr(C)]
1565#[derive(Debug, Copy, Clone)]
1566pub struct b2FilterJointDef {
1567 #[doc = " Base joint definition"]
1568 pub base: b2JointDef,
1569 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1570 pub internalValue: ::std::os::raw::c_int,
1571}
1572unsafe extern "C" {
1573 #[doc = " Use this to initialize your joint definition\n @ingroup filter_joint"]
1574 pub fn b2DefaultFilterJointDef() -> b2FilterJointDef;
1575}
1576#[doc = " Prismatic joint definition\n Body B may slide along the x-axis in local frame A. Body B cannot rotate relative to body A.\n The joint translation is zero when the local frame origins coincide in world space.\n @ingroup prismatic_joint"]
1577#[repr(C)]
1578#[derive(Debug, Copy, Clone)]
1579pub struct b2PrismaticJointDef {
1580 #[doc = " Base joint definition"]
1581 pub base: b2JointDef,
1582 #[doc = " Enable a linear spring along the prismatic joint axis"]
1583 pub enableSpring: bool,
1584 #[doc = " The spring stiffness Hertz, cycles per second"]
1585 pub hertz: f32,
1586 #[doc = " The spring damping ratio, non-dimensional"]
1587 pub dampingRatio: f32,
1588 #[doc = " The target translation for the joint in meters. The spring-damper will drive\n to this translation."]
1589 pub targetTranslation: f32,
1590 #[doc = " Enable/disable the joint limit"]
1591 pub enableLimit: bool,
1592 #[doc = " The lower translation limit"]
1593 pub lowerTranslation: f32,
1594 #[doc = " The upper translation limit"]
1595 pub upperTranslation: f32,
1596 #[doc = " Enable/disable the joint motor"]
1597 pub enableMotor: bool,
1598 #[doc = " The maximum motor force, typically in newtons"]
1599 pub maxMotorForce: f32,
1600 #[doc = " The desired motor speed, typically in meters per second"]
1601 pub motorSpeed: f32,
1602 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1603 pub internalValue: ::std::os::raw::c_int,
1604}
1605unsafe extern "C" {
1606 #[doc = " Use this to initialize your joint definition\n @ingroup prismatic_joint"]
1607 pub fn b2DefaultPrismaticJointDef() -> b2PrismaticJointDef;
1608}
1609#[doc = " Revolute joint definition\n A point on body B is fixed to a point on body A. Allows relative rotation.\n @ingroup revolute_joint"]
1610#[repr(C)]
1611#[derive(Debug, Copy, Clone)]
1612pub struct b2RevoluteJointDef {
1613 #[doc = " Base joint definition"]
1614 pub base: b2JointDef,
1615 #[doc = " The target angle for the joint in radians. The spring-damper will drive\n to this angle."]
1616 pub targetAngle: f32,
1617 #[doc = " Enable a rotational spring on the revolute hinge axis"]
1618 pub enableSpring: bool,
1619 #[doc = " The spring stiffness Hertz, cycles per second"]
1620 pub hertz: f32,
1621 #[doc = " The spring damping ratio, non-dimensional"]
1622 pub dampingRatio: f32,
1623 #[doc = " A flag to enable joint limits"]
1624 pub enableLimit: bool,
1625 #[doc = " The lower angle for the joint limit in radians. Minimum of -0.99*pi radians."]
1626 pub lowerAngle: f32,
1627 #[doc = " The upper angle for the joint limit in radians. Maximum of 0.99*pi radians."]
1628 pub upperAngle: f32,
1629 #[doc = " A flag to enable the joint motor"]
1630 pub enableMotor: bool,
1631 #[doc = " The maximum motor torque, typically in newton-meters"]
1632 pub maxMotorTorque: f32,
1633 #[doc = " The desired motor speed in radians per second"]
1634 pub motorSpeed: f32,
1635 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1636 pub internalValue: ::std::os::raw::c_int,
1637}
1638unsafe extern "C" {
1639 #[doc = " Use this to initialize your joint definition.\n @ingroup revolute_joint"]
1640 pub fn b2DefaultRevoluteJointDef() -> b2RevoluteJointDef;
1641}
1642#[doc = " Weld joint definition\n Connects two bodies together rigidly. This constraint provides springs to mimic\n soft-body simulation.\n @note The approximate solver in Box2D cannot hold many bodies together rigidly\n @ingroup weld_joint"]
1643#[repr(C)]
1644#[derive(Debug, Copy, Clone)]
1645pub struct b2WeldJointDef {
1646 #[doc = " Base joint definition"]
1647 pub base: b2JointDef,
1648 #[doc = " Linear stiffness expressed as Hertz (cycles per second). Use zero for maximum stiffness."]
1649 pub linearHertz: f32,
1650 #[doc = " Angular stiffness as Hertz (cycles per second). Use zero for maximum stiffness."]
1651 pub angularHertz: f32,
1652 #[doc = " Linear damping ratio, non-dimensional. Use 1 for critical damping."]
1653 pub linearDampingRatio: f32,
1654 #[doc = " Linear damping ratio, non-dimensional. Use 1 for critical damping."]
1655 pub angularDampingRatio: f32,
1656 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1657 pub internalValue: ::std::os::raw::c_int,
1658}
1659unsafe extern "C" {
1660 #[doc = " Use this to initialize your joint definition\n @ingroup weld_joint"]
1661 pub fn b2DefaultWeldJointDef() -> b2WeldJointDef;
1662}
1663#[doc = " Wheel joint definition\n Body B is a wheel that may rotate freely and slide along the local x-axis in frame A.\n The joint translation is zero when the local frame origins coincide in world space.\n @ingroup wheel_joint"]
1664#[repr(C)]
1665#[derive(Debug, Copy, Clone)]
1666pub struct b2WheelJointDef {
1667 #[doc = " Base joint definition"]
1668 pub base: b2JointDef,
1669 #[doc = " Enable a linear spring along the local axis"]
1670 pub enableSpring: bool,
1671 #[doc = " Spring stiffness in Hertz"]
1672 pub hertz: f32,
1673 #[doc = " Spring damping ratio, non-dimensional"]
1674 pub dampingRatio: f32,
1675 #[doc = " Enable/disable the joint linear limit"]
1676 pub enableLimit: bool,
1677 #[doc = " The lower translation limit"]
1678 pub lowerTranslation: f32,
1679 #[doc = " The upper translation limit"]
1680 pub upperTranslation: f32,
1681 #[doc = " Enable/disable the joint rotational motor"]
1682 pub enableMotor: bool,
1683 #[doc = " The maximum motor torque, typically in newton-meters"]
1684 pub maxMotorTorque: f32,
1685 #[doc = " The desired motor speed in radians per second"]
1686 pub motorSpeed: f32,
1687 #[doc = " Used internally to detect a valid definition. DO NOT SET."]
1688 pub internalValue: ::std::os::raw::c_int,
1689}
1690unsafe extern "C" {
1691 #[doc = " Use this to initialize your joint definition\n @ingroup wheel_joint"]
1692 pub fn b2DefaultWheelJointDef() -> b2WheelJointDef;
1693}
1694#[doc = " The explosion definition is used to configure options for explosions. Explosions\n consider shape geometry when computing the impulse.\n @ingroup world"]
1695#[repr(C)]
1696#[derive(Debug, Copy, Clone)]
1697pub struct b2ExplosionDef {
1698 #[doc = " Mask bits to filter shapes"]
1699 pub maskBits: u64,
1700 #[doc = " The center of the explosion in world space"]
1701 pub position: b2Vec2,
1702 #[doc = " The radius of the explosion"]
1703 pub radius: f32,
1704 #[doc = " The falloff distance beyond the radius. Impulse is reduced to zero at this distance."]
1705 pub falloff: f32,
1706 #[doc = " Impulse per unit length. This applies an impulse according to the shape perimeter that\n is facing the explosion. Explosions only apply to circles, capsules, and polygons. This\n may be negative for implosions."]
1707 pub impulsePerLength: f32,
1708}
1709unsafe extern "C" {
1710 #[doc = " Use this to initialize your explosion definition\n @ingroup world"]
1711 pub fn b2DefaultExplosionDef() -> b2ExplosionDef;
1712}
1713#[doc = " A begin touch event is generated when a shape starts to overlap a sensor shape."]
1714#[repr(C)]
1715#[derive(Debug, Copy, Clone)]
1716pub struct b2SensorBeginTouchEvent {
1717 #[doc = " The id of the sensor shape"]
1718 pub sensorShapeId: b2ShapeId,
1719 #[doc = " The id of the shape that began touching the sensor shape"]
1720 pub visitorShapeId: b2ShapeId,
1721}
1722#[doc = " An end touch event is generated when a shape stops overlapping a sensor shape.\n\tThese include things like setting the transform, destroying a body or shape, or changing\n\ta filter. You will also get an end event if the sensor or visitor are destroyed.\n\tTherefore you should always confirm the shape id is valid using b2Shape_IsValid."]
1723#[repr(C)]
1724#[derive(Debug, Copy, Clone)]
1725pub struct b2SensorEndTouchEvent {
1726 #[doc = " The id of the sensor shape\n\t@warning this shape may have been destroyed\n\t@see b2Shape_IsValid"]
1727 pub sensorShapeId: b2ShapeId,
1728 #[doc = " The id of the shape that stopped touching the sensor shape\n\t@warning this shape may have been destroyed\n\t@see b2Shape_IsValid"]
1729 pub visitorShapeId: b2ShapeId,
1730}
1731#[doc = " Sensor events are buffered in the world and are available\n as begin/end overlap event arrays after the time step is complete.\n Note: these may become invalid if bodies and/or shapes are destroyed"]
1732#[repr(C)]
1733#[derive(Debug, Copy, Clone)]
1734pub struct b2SensorEvents {
1735 #[doc = " Array of sensor begin touch events"]
1736 pub beginEvents: *mut b2SensorBeginTouchEvent,
1737 #[doc = " Array of sensor end touch events"]
1738 pub endEvents: *mut b2SensorEndTouchEvent,
1739 #[doc = " The number of begin touch events"]
1740 pub beginCount: ::std::os::raw::c_int,
1741 #[doc = " The number of end touch events"]
1742 pub endCount: ::std::os::raw::c_int,
1743}
1744#[doc = " A begin touch event is generated when two shapes begin touching."]
1745#[repr(C)]
1746#[derive(Debug, Copy, Clone)]
1747pub struct b2ContactBeginTouchEvent {
1748 #[doc = " Id of the first shape"]
1749 pub shapeIdA: b2ShapeId,
1750 #[doc = " Id of the second shape"]
1751 pub shapeIdB: b2ShapeId,
1752 #[doc = " The transient contact id. This contact maybe destroyed automatically when the world is modified or simulated.\n Used b2Contact_IsValid before using this id."]
1753 pub contactId: b2ContactId,
1754}
1755#[doc = " An end touch event is generated when two shapes stop touching.\n\tYou will get an end event if you do anything that destroys contacts previous to the last\n\tworld step. These include things like setting the transform, destroying a body\n\tor shape, or changing a filter or body type."]
1756#[repr(C)]
1757#[derive(Debug, Copy, Clone)]
1758pub struct b2ContactEndTouchEvent {
1759 #[doc = " Id of the first shape\n\t@warning this shape may have been destroyed\n\t@see b2Shape_IsValid"]
1760 pub shapeIdA: b2ShapeId,
1761 #[doc = " Id of the second shape\n\t@warning this shape may have been destroyed\n\t@see b2Shape_IsValid"]
1762 pub shapeIdB: b2ShapeId,
1763 #[doc = " Id of the contact.\n\t@warning this contact may have been destroyed\n\t@see b2Contact_IsValid"]
1764 pub contactId: b2ContactId,
1765}
1766#[doc = " A hit touch event is generated when two shapes collide with a speed faster than the hit speed threshold.\n This may be reported for speculative contacts that have a confirmed impulse."]
1767#[repr(C)]
1768#[derive(Debug, Copy, Clone)]
1769pub struct b2ContactHitEvent {
1770 #[doc = " Id of the first shape"]
1771 pub shapeIdA: b2ShapeId,
1772 #[doc = " Id of the second shape"]
1773 pub shapeIdB: b2ShapeId,
1774 #[doc = " Id of the contact.\n\t@warning this contact may have been destroyed\n\t@see b2Contact_IsValid"]
1775 pub contactId: b2ContactId,
1776 #[doc = " Point where the shapes hit at the beginning of the time step.\n This is a mid-point between the two surfaces. It could be at speculative\n point where the two shapes were not touching at the beginning of the time step."]
1777 pub point: b2Vec2,
1778 #[doc = " Normal vector pointing from shape A to shape B"]
1779 pub normal: b2Vec2,
1780 #[doc = " The speed the shapes are approaching. Always positive. Typically in meters per second."]
1781 pub approachSpeed: f32,
1782}
1783#[doc = " Contact events are buffered in the Box2D world and are available\n as event arrays after the time step is complete.\n Note: these may become invalid if bodies and/or shapes are destroyed"]
1784#[repr(C)]
1785#[derive(Debug, Copy, Clone)]
1786pub struct b2ContactEvents {
1787 #[doc = " Array of begin touch events"]
1788 pub beginEvents: *mut b2ContactBeginTouchEvent,
1789 #[doc = " Array of end touch events"]
1790 pub endEvents: *mut b2ContactEndTouchEvent,
1791 #[doc = " Array of hit events"]
1792 pub hitEvents: *mut b2ContactHitEvent,
1793 #[doc = " Number of begin touch events"]
1794 pub beginCount: ::std::os::raw::c_int,
1795 #[doc = " Number of end touch events"]
1796 pub endCount: ::std::os::raw::c_int,
1797 #[doc = " Number of hit events"]
1798 pub hitCount: ::std::os::raw::c_int,
1799}
1800#[doc = " Body move events triggered when a body moves.\n Triggered when a body moves due to simulation. Not reported for bodies moved by the user.\n This also has a flag to indicate that the body went to sleep so the application can also\n sleep that actor/entity/object associated with the body.\n On the other hand if the flag does not indicate the body went to sleep then the application\n can treat the actor/entity/object associated with the body as awake.\n This is an efficient way for an application to update game object transforms rather than\n calling functions such as b2Body_GetTransform() because this data is delivered as a contiguous array\n and it is only populated with bodies that have moved.\n @note If sleeping is disabled all dynamic and kinematic bodies will trigger move events."]
1801#[repr(C)]
1802#[derive(Debug, Copy, Clone)]
1803pub struct b2BodyMoveEvent {
1804 pub userData: *mut ::std::os::raw::c_void,
1805 pub transform: b2Transform,
1806 pub bodyId: b2BodyId,
1807 pub fellAsleep: bool,
1808}
1809#[doc = " Body events are buffered in the Box2D world and are available\n as event arrays after the time step is complete.\n Note: this data becomes invalid if bodies are destroyed"]
1810#[repr(C)]
1811#[derive(Debug, Copy, Clone)]
1812pub struct b2BodyEvents {
1813 #[doc = " Array of move events"]
1814 pub moveEvents: *mut b2BodyMoveEvent,
1815 #[doc = " Number of move events"]
1816 pub moveCount: ::std::os::raw::c_int,
1817}
1818#[doc = " Joint events report joints that are awake and have a force and/or torque exceeding the threshold\n The observed forces and torques are not returned for efficiency reasons."]
1819#[repr(C)]
1820#[derive(Debug, Copy, Clone)]
1821pub struct b2JointEvent {
1822 #[doc = " The joint id"]
1823 pub jointId: b2JointId,
1824 #[doc = " The user data from the joint for convenience"]
1825 pub userData: *mut ::std::os::raw::c_void,
1826}
1827#[doc = " Joint events are buffered in the world and are available\n as event arrays after the time step is complete.\n Note: this data becomes invalid if joints are destroyed"]
1828#[repr(C)]
1829#[derive(Debug, Copy, Clone)]
1830pub struct b2JointEvents {
1831 #[doc = " Array of events"]
1832 pub jointEvents: *mut b2JointEvent,
1833 #[doc = " Number of events"]
1834 pub count: ::std::os::raw::c_int,
1835}
1836#[doc = " The contact data for two shapes. By convention the manifold normal points\n from shape A to shape B.\n @see b2Shape_GetContactData() and b2Body_GetContactData()"]
1837#[repr(C)]
1838#[derive(Debug, Copy, Clone)]
1839pub struct b2ContactData {
1840 pub contactId: b2ContactId,
1841 pub shapeIdA: b2ShapeId,
1842 pub shapeIdB: b2ShapeId,
1843 pub manifold: b2Manifold,
1844}
1845#[doc = " Prototype for a contact filter callback.\n This is called when a contact pair is considered for collision. This allows you to\n perform custom logic to prevent collision between shapes. This is only called if\n one of the two shapes has custom filtering enabled.\n Notes:\n - this function must be thread-safe\n - this is only called if one of the two shapes has enabled custom filtering\n - this may be called for awake dynamic bodies and sensors\n Return false if you want to disable the collision\n @see b2ShapeDef\n @warning Do not attempt to modify the world inside this callback\n @ingroup world"]
1846pub type b2CustomFilterFcn = ::std::option::Option<
1847 unsafe extern "C" fn(
1848 shapeIdA: b2ShapeId,
1849 shapeIdB: b2ShapeId,
1850 context: *mut ::std::os::raw::c_void,
1851 ) -> bool,
1852>;
1853#[doc = " Prototype for a pre-solve callback.\n This is called after a contact is updated. This allows you to inspect a\n contact before it goes to the solver. If you are careful, you can modify the\n contact manifold (e.g. modify the normal).\n Notes:\n - this function must be thread-safe\n - this is only called if the shape has enabled pre-solve events\n - this is called only for awake dynamic bodies\n - this is not called for sensors\n - the supplied manifold has impulse values from the previous step\n Return false if you want to disable the contact this step\n @warning Do not attempt to modify the world inside this callback\n @ingroup world"]
1854pub type b2PreSolveFcn = ::std::option::Option<
1855 unsafe extern "C" fn(
1856 shapeIdA: b2ShapeId,
1857 shapeIdB: b2ShapeId,
1858 point: b2Vec2,
1859 normal: b2Vec2,
1860 context: *mut ::std::os::raw::c_void,
1861 ) -> bool,
1862>;
1863#[doc = " Prototype callback for overlap queries.\n Called for each shape found in the query.\n @see b2World_OverlapABB\n @return false to terminate the query.\n @ingroup world"]
1864pub type b2OverlapResultFcn = ::std::option::Option<
1865 unsafe extern "C" fn(shapeId: b2ShapeId, context: *mut ::std::os::raw::c_void) -> bool,
1866>;
1867#[doc = " Prototype callback for ray and shape casts.\n Called for each shape found in the query. You control how the ray cast\n proceeds by returning a float:\n return -1: ignore this shape and continue\n return 0: terminate the ray cast\n return fraction: clip the ray to this point\n return 1: don't clip the ray and continue\n A cast with initial overlap will return a zero fraction and a zero normal.\n @param shapeId the shape hit by the ray\n @param point the point of initial intersection\n @param normal the normal vector at the point of intersection, zero for a shape cast with initial overlap\n @param fraction the fraction along the ray at the point of intersection, zero for a shape cast with initial overlap\n @param context the user context\n @return -1 to filter, 0 to terminate, fraction to clip the ray for closest hit, 1 to continue\n @see b2World_CastRay\n @ingroup world"]
1868pub type b2CastResultFcn = ::std::option::Option<
1869 unsafe extern "C" fn(
1870 shapeId: b2ShapeId,
1871 point: b2Vec2,
1872 normal: b2Vec2,
1873 fraction: f32,
1874 context: *mut ::std::os::raw::c_void,
1875 ) -> f32,
1876>;
1877pub type b2PlaneResultFcn = ::std::option::Option<
1878 unsafe extern "C" fn(
1879 shapeId: b2ShapeId,
1880 plane: *const b2PlaneResult,
1881 context: *mut ::std::os::raw::c_void,
1882 ) -> bool,
1883>;
1884pub const b2HexColor_b2_colorAliceBlue: b2HexColor = 15792383;
1885pub const b2HexColor_b2_colorAntiqueWhite: b2HexColor = 16444375;
1886pub const b2HexColor_b2_colorAqua: b2HexColor = 65535;
1887pub const b2HexColor_b2_colorAquamarine: b2HexColor = 8388564;
1888pub const b2HexColor_b2_colorAzure: b2HexColor = 15794175;
1889pub const b2HexColor_b2_colorBeige: b2HexColor = 16119260;
1890pub const b2HexColor_b2_colorBisque: b2HexColor = 16770244;
1891pub const b2HexColor_b2_colorBlack: b2HexColor = 0;
1892pub const b2HexColor_b2_colorBlanchedAlmond: b2HexColor = 16772045;
1893pub const b2HexColor_b2_colorBlue: b2HexColor = 255;
1894pub const b2HexColor_b2_colorBlueViolet: b2HexColor = 9055202;
1895pub const b2HexColor_b2_colorBrown: b2HexColor = 10824234;
1896pub const b2HexColor_b2_colorBurlywood: b2HexColor = 14596231;
1897pub const b2HexColor_b2_colorCadetBlue: b2HexColor = 6266528;
1898pub const b2HexColor_b2_colorChartreuse: b2HexColor = 8388352;
1899pub const b2HexColor_b2_colorChocolate: b2HexColor = 13789470;
1900pub const b2HexColor_b2_colorCoral: b2HexColor = 16744272;
1901pub const b2HexColor_b2_colorCornflowerBlue: b2HexColor = 6591981;
1902pub const b2HexColor_b2_colorCornsilk: b2HexColor = 16775388;
1903pub const b2HexColor_b2_colorCrimson: b2HexColor = 14423100;
1904pub const b2HexColor_b2_colorCyan: b2HexColor = 65535;
1905pub const b2HexColor_b2_colorDarkBlue: b2HexColor = 139;
1906pub const b2HexColor_b2_colorDarkCyan: b2HexColor = 35723;
1907pub const b2HexColor_b2_colorDarkGoldenRod: b2HexColor = 12092939;
1908pub const b2HexColor_b2_colorDarkGray: b2HexColor = 11119017;
1909pub const b2HexColor_b2_colorDarkGreen: b2HexColor = 25600;
1910pub const b2HexColor_b2_colorDarkKhaki: b2HexColor = 12433259;
1911pub const b2HexColor_b2_colorDarkMagenta: b2HexColor = 9109643;
1912pub const b2HexColor_b2_colorDarkOliveGreen: b2HexColor = 5597999;
1913pub const b2HexColor_b2_colorDarkOrange: b2HexColor = 16747520;
1914pub const b2HexColor_b2_colorDarkOrchid: b2HexColor = 10040012;
1915pub const b2HexColor_b2_colorDarkRed: b2HexColor = 9109504;
1916pub const b2HexColor_b2_colorDarkSalmon: b2HexColor = 15308410;
1917pub const b2HexColor_b2_colorDarkSeaGreen: b2HexColor = 9419919;
1918pub const b2HexColor_b2_colorDarkSlateBlue: b2HexColor = 4734347;
1919pub const b2HexColor_b2_colorDarkSlateGray: b2HexColor = 3100495;
1920pub const b2HexColor_b2_colorDarkTurquoise: b2HexColor = 52945;
1921pub const b2HexColor_b2_colorDarkViolet: b2HexColor = 9699539;
1922pub const b2HexColor_b2_colorDeepPink: b2HexColor = 16716947;
1923pub const b2HexColor_b2_colorDeepSkyBlue: b2HexColor = 49151;
1924pub const b2HexColor_b2_colorDimGray: b2HexColor = 6908265;
1925pub const b2HexColor_b2_colorDodgerBlue: b2HexColor = 2003199;
1926pub const b2HexColor_b2_colorFireBrick: b2HexColor = 11674146;
1927pub const b2HexColor_b2_colorFloralWhite: b2HexColor = 16775920;
1928pub const b2HexColor_b2_colorForestGreen: b2HexColor = 2263842;
1929pub const b2HexColor_b2_colorFuchsia: b2HexColor = 16711935;
1930pub const b2HexColor_b2_colorGainsboro: b2HexColor = 14474460;
1931pub const b2HexColor_b2_colorGhostWhite: b2HexColor = 16316671;
1932pub const b2HexColor_b2_colorGold: b2HexColor = 16766720;
1933pub const b2HexColor_b2_colorGoldenRod: b2HexColor = 14329120;
1934pub const b2HexColor_b2_colorGray: b2HexColor = 8421504;
1935pub const b2HexColor_b2_colorGreen: b2HexColor = 32768;
1936pub const b2HexColor_b2_colorGreenYellow: b2HexColor = 11403055;
1937pub const b2HexColor_b2_colorHoneyDew: b2HexColor = 15794160;
1938pub const b2HexColor_b2_colorHotPink: b2HexColor = 16738740;
1939pub const b2HexColor_b2_colorIndianRed: b2HexColor = 13458524;
1940pub const b2HexColor_b2_colorIndigo: b2HexColor = 4915330;
1941pub const b2HexColor_b2_colorIvory: b2HexColor = 16777200;
1942pub const b2HexColor_b2_colorKhaki: b2HexColor = 15787660;
1943pub const b2HexColor_b2_colorLavender: b2HexColor = 15132410;
1944pub const b2HexColor_b2_colorLavenderBlush: b2HexColor = 16773365;
1945pub const b2HexColor_b2_colorLawnGreen: b2HexColor = 8190976;
1946pub const b2HexColor_b2_colorLemonChiffon: b2HexColor = 16775885;
1947pub const b2HexColor_b2_colorLightBlue: b2HexColor = 11393254;
1948pub const b2HexColor_b2_colorLightCoral: b2HexColor = 15761536;
1949pub const b2HexColor_b2_colorLightCyan: b2HexColor = 14745599;
1950pub const b2HexColor_b2_colorLightGoldenRodYellow: b2HexColor = 16448210;
1951pub const b2HexColor_b2_colorLightGray: b2HexColor = 13882323;
1952pub const b2HexColor_b2_colorLightGreen: b2HexColor = 9498256;
1953pub const b2HexColor_b2_colorLightPink: b2HexColor = 16758465;
1954pub const b2HexColor_b2_colorLightSalmon: b2HexColor = 16752762;
1955pub const b2HexColor_b2_colorLightSeaGreen: b2HexColor = 2142890;
1956pub const b2HexColor_b2_colorLightSkyBlue: b2HexColor = 8900346;
1957pub const b2HexColor_b2_colorLightSlateGray: b2HexColor = 7833753;
1958pub const b2HexColor_b2_colorLightSteelBlue: b2HexColor = 11584734;
1959pub const b2HexColor_b2_colorLightYellow: b2HexColor = 16777184;
1960pub const b2HexColor_b2_colorLime: b2HexColor = 65280;
1961pub const b2HexColor_b2_colorLimeGreen: b2HexColor = 3329330;
1962pub const b2HexColor_b2_colorLinen: b2HexColor = 16445670;
1963pub const b2HexColor_b2_colorMagenta: b2HexColor = 16711935;
1964pub const b2HexColor_b2_colorMaroon: b2HexColor = 8388608;
1965pub const b2HexColor_b2_colorMediumAquaMarine: b2HexColor = 6737322;
1966pub const b2HexColor_b2_colorMediumBlue: b2HexColor = 205;
1967pub const b2HexColor_b2_colorMediumOrchid: b2HexColor = 12211667;
1968pub const b2HexColor_b2_colorMediumPurple: b2HexColor = 9662683;
1969pub const b2HexColor_b2_colorMediumSeaGreen: b2HexColor = 3978097;
1970pub const b2HexColor_b2_colorMediumSlateBlue: b2HexColor = 8087790;
1971pub const b2HexColor_b2_colorMediumSpringGreen: b2HexColor = 64154;
1972pub const b2HexColor_b2_colorMediumTurquoise: b2HexColor = 4772300;
1973pub const b2HexColor_b2_colorMediumVioletRed: b2HexColor = 13047173;
1974pub const b2HexColor_b2_colorMidnightBlue: b2HexColor = 1644912;
1975pub const b2HexColor_b2_colorMintCream: b2HexColor = 16121850;
1976pub const b2HexColor_b2_colorMistyRose: b2HexColor = 16770273;
1977pub const b2HexColor_b2_colorMoccasin: b2HexColor = 16770229;
1978pub const b2HexColor_b2_colorNavajoWhite: b2HexColor = 16768685;
1979pub const b2HexColor_b2_colorNavy: b2HexColor = 128;
1980pub const b2HexColor_b2_colorOldLace: b2HexColor = 16643558;
1981pub const b2HexColor_b2_colorOlive: b2HexColor = 8421376;
1982pub const b2HexColor_b2_colorOliveDrab: b2HexColor = 7048739;
1983pub const b2HexColor_b2_colorOrange: b2HexColor = 16753920;
1984pub const b2HexColor_b2_colorOrangeRed: b2HexColor = 16729344;
1985pub const b2HexColor_b2_colorOrchid: b2HexColor = 14315734;
1986pub const b2HexColor_b2_colorPaleGoldenRod: b2HexColor = 15657130;
1987pub const b2HexColor_b2_colorPaleGreen: b2HexColor = 10025880;
1988pub const b2HexColor_b2_colorPaleTurquoise: b2HexColor = 11529966;
1989pub const b2HexColor_b2_colorPaleVioletRed: b2HexColor = 14381203;
1990pub const b2HexColor_b2_colorPapayaWhip: b2HexColor = 16773077;
1991pub const b2HexColor_b2_colorPeachPuff: b2HexColor = 16767673;
1992pub const b2HexColor_b2_colorPeru: b2HexColor = 13468991;
1993pub const b2HexColor_b2_colorPink: b2HexColor = 16761035;
1994pub const b2HexColor_b2_colorPlum: b2HexColor = 14524637;
1995pub const b2HexColor_b2_colorPowderBlue: b2HexColor = 11591910;
1996pub const b2HexColor_b2_colorPurple: b2HexColor = 8388736;
1997pub const b2HexColor_b2_colorRebeccaPurple: b2HexColor = 6697881;
1998pub const b2HexColor_b2_colorRed: b2HexColor = 16711680;
1999pub const b2HexColor_b2_colorRosyBrown: b2HexColor = 12357519;
2000pub const b2HexColor_b2_colorRoyalBlue: b2HexColor = 4286945;
2001pub const b2HexColor_b2_colorSaddleBrown: b2HexColor = 9127187;
2002pub const b2HexColor_b2_colorSalmon: b2HexColor = 16416882;
2003pub const b2HexColor_b2_colorSandyBrown: b2HexColor = 16032864;
2004pub const b2HexColor_b2_colorSeaGreen: b2HexColor = 3050327;
2005pub const b2HexColor_b2_colorSeaShell: b2HexColor = 16774638;
2006pub const b2HexColor_b2_colorSienna: b2HexColor = 10506797;
2007pub const b2HexColor_b2_colorSilver: b2HexColor = 12632256;
2008pub const b2HexColor_b2_colorSkyBlue: b2HexColor = 8900331;
2009pub const b2HexColor_b2_colorSlateBlue: b2HexColor = 6970061;
2010pub const b2HexColor_b2_colorSlateGray: b2HexColor = 7372944;
2011pub const b2HexColor_b2_colorSnow: b2HexColor = 16775930;
2012pub const b2HexColor_b2_colorSpringGreen: b2HexColor = 65407;
2013pub const b2HexColor_b2_colorSteelBlue: b2HexColor = 4620980;
2014pub const b2HexColor_b2_colorTan: b2HexColor = 13808780;
2015pub const b2HexColor_b2_colorTeal: b2HexColor = 32896;
2016pub const b2HexColor_b2_colorThistle: b2HexColor = 14204888;
2017pub const b2HexColor_b2_colorTomato: b2HexColor = 16737095;
2018pub const b2HexColor_b2_colorTurquoise: b2HexColor = 4251856;
2019pub const b2HexColor_b2_colorViolet: b2HexColor = 15631086;
2020pub const b2HexColor_b2_colorWheat: b2HexColor = 16113331;
2021pub const b2HexColor_b2_colorWhite: b2HexColor = 16777215;
2022pub const b2HexColor_b2_colorWhiteSmoke: b2HexColor = 16119285;
2023pub const b2HexColor_b2_colorYellow: b2HexColor = 16776960;
2024pub const b2HexColor_b2_colorYellowGreen: b2HexColor = 10145074;
2025pub const b2HexColor_b2_colorBox2DRed: b2HexColor = 14430514;
2026pub const b2HexColor_b2_colorBox2DBlue: b2HexColor = 3190463;
2027pub const b2HexColor_b2_colorBox2DGreen: b2HexColor = 9226532;
2028pub const b2HexColor_b2_colorBox2DYellow: b2HexColor = 16772748;
2029#[doc = " These colors are used for debug draw and mostly match the named SVG colors.\n See https://www.rapidtables.com/web/color/index.html\n https://johndecember.com/html/spec/colorsvg.html\n https://upload.wikimedia.org/wikipedia/commons/2/2b/SVG_Recognized_color_keyword_names.svg"]
2030pub type b2HexColor = ::std::os::raw::c_uint;
2031#[doc = " This struct holds callbacks you can implement to draw a Box2D world.\n This structure should be zero initialized.\n @ingroup world"]
2032#[repr(C)]
2033#[derive(Debug, Copy, Clone)]
2034pub struct b2DebugDraw {
2035 #[doc = " Draw a closed polygon provided in CCW order."]
2036 pub DrawPolygonFcn: ::std::option::Option<
2037 unsafe extern "C" fn(
2038 vertices: *const b2Vec2,
2039 vertexCount: ::std::os::raw::c_int,
2040 color: b2HexColor,
2041 context: *mut ::std::os::raw::c_void,
2042 ),
2043 >,
2044 #[doc = " Draw a solid closed polygon provided in CCW order."]
2045 pub DrawSolidPolygonFcn: ::std::option::Option<
2046 unsafe extern "C" fn(
2047 transform: b2Transform,
2048 vertices: *const b2Vec2,
2049 vertexCount: ::std::os::raw::c_int,
2050 radius: f32,
2051 color: b2HexColor,
2052 context: *mut ::std::os::raw::c_void,
2053 ),
2054 >,
2055 #[doc = " Draw a circle."]
2056 pub DrawCircleFcn: ::std::option::Option<
2057 unsafe extern "C" fn(
2058 center: b2Vec2,
2059 radius: f32,
2060 color: b2HexColor,
2061 context: *mut ::std::os::raw::c_void,
2062 ),
2063 >,
2064 #[doc = " Draw a solid circle."]
2065 pub DrawSolidCircleFcn: ::std::option::Option<
2066 unsafe extern "C" fn(
2067 transform: b2Transform,
2068 radius: f32,
2069 color: b2HexColor,
2070 context: *mut ::std::os::raw::c_void,
2071 ),
2072 >,
2073 #[doc = " Draw a solid capsule."]
2074 pub DrawSolidCapsuleFcn: ::std::option::Option<
2075 unsafe extern "C" fn(
2076 p1: b2Vec2,
2077 p2: b2Vec2,
2078 radius: f32,
2079 color: b2HexColor,
2080 context: *mut ::std::os::raw::c_void,
2081 ),
2082 >,
2083 #[doc = " Draw a line segment."]
2084 pub DrawLineFcn: ::std::option::Option<
2085 unsafe extern "C" fn(
2086 p1: b2Vec2,
2087 p2: b2Vec2,
2088 color: b2HexColor,
2089 context: *mut ::std::os::raw::c_void,
2090 ),
2091 >,
2092 #[doc = " Draw a transform. Choose your own length scale."]
2093 pub DrawTransformFcn: ::std::option::Option<
2094 unsafe extern "C" fn(transform: b2Transform, context: *mut ::std::os::raw::c_void),
2095 >,
2096 #[doc = " Draw a point."]
2097 pub DrawPointFcn: ::std::option::Option<
2098 unsafe extern "C" fn(
2099 p: b2Vec2,
2100 size: f32,
2101 color: b2HexColor,
2102 context: *mut ::std::os::raw::c_void,
2103 ),
2104 >,
2105 #[doc = " Draw a string in world space"]
2106 pub DrawStringFcn: ::std::option::Option<
2107 unsafe extern "C" fn(
2108 p: b2Vec2,
2109 s: *const ::std::os::raw::c_char,
2110 color: b2HexColor,
2111 context: *mut ::std::os::raw::c_void,
2112 ),
2113 >,
2114 #[doc = " World bounds to use for debug draw"]
2115 pub drawingBounds: b2AABB,
2116 #[doc = " Scale to use when drawing forces"]
2117 pub forceScale: f32,
2118 #[doc = " Global scaling for joint drawing"]
2119 pub jointScale: f32,
2120 #[doc = " Option to draw shapes"]
2121 pub drawShapes: bool,
2122 #[doc = " Option to draw joints"]
2123 pub drawJoints: bool,
2124 #[doc = " Option to draw additional information for joints"]
2125 pub drawJointExtras: bool,
2126 #[doc = " Option to draw the bounding boxes for shapes"]
2127 pub drawBounds: bool,
2128 #[doc = " Option to draw the mass and center of mass of dynamic bodies"]
2129 pub drawMass: bool,
2130 #[doc = " Option to draw body names"]
2131 pub drawBodyNames: bool,
2132 #[doc = " Option to draw contact points"]
2133 pub drawContactPoints: bool,
2134 #[doc = " Option to visualize the graph coloring used for contacts and joints"]
2135 pub drawGraphColors: bool,
2136 #[doc = " Option to draw contact feature ids"]
2137 pub drawContactFeatures: bool,
2138 #[doc = " Option to draw contact normals"]
2139 pub drawContactNormals: bool,
2140 #[doc = " Option to draw contact normal forces"]
2141 pub drawContactForces: bool,
2142 #[doc = " Option to draw contact friction forces"]
2143 pub drawFrictionForces: bool,
2144 #[doc = " Option to draw islands as bounding boxes"]
2145 pub drawIslands: bool,
2146 #[doc = " User context that is passed as an argument to drawing callback functions"]
2147 pub context: *mut ::std::os::raw::c_void,
2148}
2149unsafe extern "C" {
2150 #[doc = " Use this to initialize your drawing interface. This allows you to implement a sub-set\n of the drawing functions."]
2151 pub fn b2DefaultDebugDraw() -> b2DebugDraw;
2152}
2153unsafe extern "C" {
2154 #[doc = " Create a world for rigid body simulation. A world contains bodies, shapes, and constraints. You make create\n up to 128 worlds. Each world is completely independent and may be simulated in parallel.\n @return the world id."]
2155 pub fn b2CreateWorld(def: *const b2WorldDef) -> b2WorldId;
2156}
2157unsafe extern "C" {
2158 #[doc = " Destroy a world"]
2159 pub fn b2DestroyWorld(worldId: b2WorldId);
2160}
2161unsafe extern "C" {
2162 #[doc = " World id validation. Provides validation for up to 64K allocations."]
2163 pub fn b2World_IsValid(id: b2WorldId) -> bool;
2164}
2165unsafe extern "C" {
2166 #[doc = " Simulate a world for one time step. This performs collision detection, integration, and constraint solution.\n @param worldId The world to simulate\n @param timeStep The amount of time to simulate, this should be a fixed number. Usually 1/60.\n @param subStepCount The number of sub-steps, increasing the sub-step count can increase accuracy. Usually 4."]
2167 pub fn b2World_Step(worldId: b2WorldId, timeStep: f32, subStepCount: ::std::os::raw::c_int);
2168}
2169unsafe extern "C" {
2170 #[doc = " Call this to draw shapes and other debug draw data"]
2171 pub fn b2World_Draw(worldId: b2WorldId, draw: *mut b2DebugDraw);
2172}
2173unsafe extern "C" {
2174 #[doc = " Get the body events for the current time step. The event data is transient. Do not store a reference to this data."]
2175 pub fn b2World_GetBodyEvents(worldId: b2WorldId) -> b2BodyEvents;
2176}
2177unsafe extern "C" {
2178 #[doc = " Get sensor events for the current time step. The event data is transient. Do not store a reference to this data."]
2179 pub fn b2World_GetSensorEvents(worldId: b2WorldId) -> b2SensorEvents;
2180}
2181unsafe extern "C" {
2182 #[doc = " Get contact events for this current time step. The event data is transient. Do not store a reference to this data."]
2183 pub fn b2World_GetContactEvents(worldId: b2WorldId) -> b2ContactEvents;
2184}
2185unsafe extern "C" {
2186 #[doc = " Get the joint events for the current time step. The event data is transient. Do not store a reference to this data."]
2187 pub fn b2World_GetJointEvents(worldId: b2WorldId) -> b2JointEvents;
2188}
2189unsafe extern "C" {
2190 #[doc = " Overlap test for all shapes that *potentially* overlap the provided AABB"]
2191 pub fn b2World_OverlapAABB(
2192 worldId: b2WorldId,
2193 aabb: b2AABB,
2194 filter: b2QueryFilter,
2195 fcn: b2OverlapResultFcn,
2196 context: *mut ::std::os::raw::c_void,
2197 ) -> b2TreeStats;
2198}
2199unsafe extern "C" {
2200 #[doc = " Overlap test for all shapes that overlap the provided shape proxy."]
2201 pub fn b2World_OverlapShape(
2202 worldId: b2WorldId,
2203 proxy: *const b2ShapeProxy,
2204 filter: b2QueryFilter,
2205 fcn: b2OverlapResultFcn,
2206 context: *mut ::std::os::raw::c_void,
2207 ) -> b2TreeStats;
2208}
2209unsafe extern "C" {
2210 #[doc = " Cast a ray into the world to collect shapes in the path of the ray.\n Your callback function controls whether you get the closest point, any point, or n-points.\n @note The callback function may receive shapes in any order\n @param worldId The world to cast the ray against\n @param origin The start point of the ray\n @param translation The translation of the ray from the start point to the end point\n @param filter Contains bit flags to filter unwanted shapes from the results\n @param fcn A user implemented callback function\n @param context A user context that is passed along to the callback function\n\t@return traversal performance counters"]
2211 pub fn b2World_CastRay(
2212 worldId: b2WorldId,
2213 origin: b2Vec2,
2214 translation: b2Vec2,
2215 filter: b2QueryFilter,
2216 fcn: b2CastResultFcn,
2217 context: *mut ::std::os::raw::c_void,
2218 ) -> b2TreeStats;
2219}
2220unsafe extern "C" {
2221 #[doc = " Cast a ray into the world to collect the closest hit. This is a convenience function. Ignores initial overlap.\n This is less general than b2World_CastRay() and does not allow for custom filtering."]
2222 pub fn b2World_CastRayClosest(
2223 worldId: b2WorldId,
2224 origin: b2Vec2,
2225 translation: b2Vec2,
2226 filter: b2QueryFilter,
2227 ) -> b2RayResult;
2228}
2229unsafe extern "C" {
2230 #[doc = " Cast a shape through the world. Similar to a cast ray except that a shape is cast instead of a point.\n\t@see b2World_CastRay"]
2231 pub fn b2World_CastShape(
2232 worldId: b2WorldId,
2233 proxy: *const b2ShapeProxy,
2234 translation: b2Vec2,
2235 filter: b2QueryFilter,
2236 fcn: b2CastResultFcn,
2237 context: *mut ::std::os::raw::c_void,
2238 ) -> b2TreeStats;
2239}
2240unsafe extern "C" {
2241 #[doc = " Cast a capsule mover through the world. This is a special shape cast that handles sliding along other shapes while reducing\n clipping."]
2242 pub fn b2World_CastMover(
2243 worldId: b2WorldId,
2244 mover: *const b2Capsule,
2245 translation: b2Vec2,
2246 filter: b2QueryFilter,
2247 ) -> f32;
2248}
2249unsafe extern "C" {
2250 #[doc = " Collide a capsule mover with the world, gathering collision planes that can be fed to b2SolvePlanes. Useful for\n kinematic character movement."]
2251 pub fn b2World_CollideMover(
2252 worldId: b2WorldId,
2253 mover: *const b2Capsule,
2254 filter: b2QueryFilter,
2255 fcn: b2PlaneResultFcn,
2256 context: *mut ::std::os::raw::c_void,
2257 );
2258}
2259unsafe extern "C" {
2260 #[doc = " Enable/disable sleep. If your application does not need sleeping, you can gain some performance\n by disabling sleep completely at the world level.\n @see b2WorldDef"]
2261 pub fn b2World_EnableSleeping(worldId: b2WorldId, flag: bool);
2262}
2263unsafe extern "C" {
2264 #[doc = " Is body sleeping enabled?"]
2265 pub fn b2World_IsSleepingEnabled(worldId: b2WorldId) -> bool;
2266}
2267unsafe extern "C" {
2268 #[doc = " Enable/disable continuous collision between dynamic and static bodies. Generally you should keep continuous\n collision enabled to prevent fast moving objects from going through static objects. The performance gain from\n disabling continuous collision is minor.\n @see b2WorldDef"]
2269 pub fn b2World_EnableContinuous(worldId: b2WorldId, flag: bool);
2270}
2271unsafe extern "C" {
2272 #[doc = " Is continuous collision enabled?"]
2273 pub fn b2World_IsContinuousEnabled(worldId: b2WorldId) -> bool;
2274}
2275unsafe extern "C" {
2276 #[doc = " Adjust the restitution threshold. It is recommended not to make this value very small\n because it will prevent bodies from sleeping. Usually in meters per second.\n @see b2WorldDef"]
2277 pub fn b2World_SetRestitutionThreshold(worldId: b2WorldId, value: f32);
2278}
2279unsafe extern "C" {
2280 #[doc = " Get the the restitution speed threshold. Usually in meters per second."]
2281 pub fn b2World_GetRestitutionThreshold(worldId: b2WorldId) -> f32;
2282}
2283unsafe extern "C" {
2284 #[doc = " Adjust the hit event threshold. This controls the collision speed needed to generate a b2ContactHitEvent.\n Usually in meters per second.\n @see b2WorldDef::hitEventThreshold"]
2285 pub fn b2World_SetHitEventThreshold(worldId: b2WorldId, value: f32);
2286}
2287unsafe extern "C" {
2288 #[doc = " Get the the hit event speed threshold. Usually in meters per second."]
2289 pub fn b2World_GetHitEventThreshold(worldId: b2WorldId) -> f32;
2290}
2291unsafe extern "C" {
2292 #[doc = " Register the custom filter callback. This is optional."]
2293 pub fn b2World_SetCustomFilterCallback(
2294 worldId: b2WorldId,
2295 fcn: b2CustomFilterFcn,
2296 context: *mut ::std::os::raw::c_void,
2297 );
2298}
2299unsafe extern "C" {
2300 #[doc = " Register the pre-solve callback. This is optional."]
2301 pub fn b2World_SetPreSolveCallback(
2302 worldId: b2WorldId,
2303 fcn: b2PreSolveFcn,
2304 context: *mut ::std::os::raw::c_void,
2305 );
2306}
2307unsafe extern "C" {
2308 #[doc = " Set the gravity vector for the entire world. Box2D has no concept of an up direction and this\n is left as a decision for the application. Usually in m/s^2.\n @see b2WorldDef"]
2309 pub fn b2World_SetGravity(worldId: b2WorldId, gravity: b2Vec2);
2310}
2311unsafe extern "C" {
2312 #[doc = " Get the gravity vector"]
2313 pub fn b2World_GetGravity(worldId: b2WorldId) -> b2Vec2;
2314}
2315unsafe extern "C" {
2316 #[doc = " Apply a radial explosion\n @param worldId The world id\n @param explosionDef The explosion definition"]
2317 pub fn b2World_Explode(worldId: b2WorldId, explosionDef: *const b2ExplosionDef);
2318}
2319unsafe extern "C" {
2320 #[doc = " Adjust contact tuning parameters\n @param worldId The world id\n @param hertz The contact stiffness (cycles per second)\n @param dampingRatio The contact bounciness with 1 being critical damping (non-dimensional)\n @param pushSpeed The maximum contact constraint push out speed (meters per second)\n @note Advanced feature"]
2321 pub fn b2World_SetContactTuning(
2322 worldId: b2WorldId,
2323 hertz: f32,
2324 dampingRatio: f32,
2325 pushSpeed: f32,
2326 );
2327}
2328unsafe extern "C" {
2329 #[doc = " Set the maximum linear speed. Usually in m/s."]
2330 pub fn b2World_SetMaximumLinearSpeed(worldId: b2WorldId, maximumLinearSpeed: f32);
2331}
2332unsafe extern "C" {
2333 #[doc = " Get the maximum linear speed. Usually in m/s."]
2334 pub fn b2World_GetMaximumLinearSpeed(worldId: b2WorldId) -> f32;
2335}
2336unsafe extern "C" {
2337 #[doc = " Enable/disable constraint warm starting. Advanced feature for testing. Disabling\n warm starting greatly reduces stability and provides no performance gain."]
2338 pub fn b2World_EnableWarmStarting(worldId: b2WorldId, flag: bool);
2339}
2340unsafe extern "C" {
2341 #[doc = " Is constraint warm starting enabled?"]
2342 pub fn b2World_IsWarmStartingEnabled(worldId: b2WorldId) -> bool;
2343}
2344unsafe extern "C" {
2345 #[doc = " Get the number of awake bodies."]
2346 pub fn b2World_GetAwakeBodyCount(worldId: b2WorldId) -> ::std::os::raw::c_int;
2347}
2348unsafe extern "C" {
2349 #[doc = " Get the current world performance profile"]
2350 pub fn b2World_GetProfile(worldId: b2WorldId) -> b2Profile;
2351}
2352unsafe extern "C" {
2353 #[doc = " Get world counters and sizes"]
2354 pub fn b2World_GetCounters(worldId: b2WorldId) -> b2Counters;
2355}
2356unsafe extern "C" {
2357 #[doc = " Set the user data pointer."]
2358 pub fn b2World_SetUserData(worldId: b2WorldId, userData: *mut ::std::os::raw::c_void);
2359}
2360unsafe extern "C" {
2361 #[doc = " Get the user data pointer."]
2362 pub fn b2World_GetUserData(worldId: b2WorldId) -> *mut ::std::os::raw::c_void;
2363}
2364unsafe extern "C" {
2365 #[doc = " Set the friction callback. Passing NULL resets to default."]
2366 pub fn b2World_SetFrictionCallback(worldId: b2WorldId, callback: b2FrictionCallback);
2367}
2368unsafe extern "C" {
2369 #[doc = " Set the restitution callback. Passing NULL resets to default."]
2370 pub fn b2World_SetRestitutionCallback(worldId: b2WorldId, callback: b2RestitutionCallback);
2371}
2372unsafe extern "C" {
2373 #[doc = " Dump memory stats to box2d_memory.txt"]
2374 pub fn b2World_DumpMemoryStats(worldId: b2WorldId);
2375}
2376unsafe extern "C" {
2377 #[doc = " This is for internal testing"]
2378 pub fn b2World_RebuildStaticTree(worldId: b2WorldId);
2379}
2380unsafe extern "C" {
2381 #[doc = " This is for internal testing"]
2382 pub fn b2World_EnableSpeculative(worldId: b2WorldId, flag: bool);
2383}
2384unsafe extern "C" {
2385 #[doc = " Create a rigid body given a definition. No reference to the definition is retained. So you can create the definition\n on the stack and pass it as a pointer.\n @code{.c}\n b2BodyDef bodyDef = b2DefaultBodyDef();\n b2BodyId myBodyId = b2CreateBody(myWorldId, &bodyDef);\n @endcode\n @warning This function is locked during callbacks."]
2386 pub fn b2CreateBody(worldId: b2WorldId, def: *const b2BodyDef) -> b2BodyId;
2387}
2388unsafe extern "C" {
2389 #[doc = " Destroy a rigid body given an id. This destroys all shapes and joints attached to the body.\n Do not keep references to the associated shapes and joints."]
2390 pub fn b2DestroyBody(bodyId: b2BodyId);
2391}
2392unsafe extern "C" {
2393 #[doc = " Body identifier validation. A valid body exists in a world and is non-null.\n This can be used to detect orphaned ids. Provides validation for up to 64K allocations."]
2394 pub fn b2Body_IsValid(id: b2BodyId) -> bool;
2395}
2396unsafe extern "C" {
2397 #[doc = " Get the body type: static, kinematic, or dynamic"]
2398 pub fn b2Body_GetType(bodyId: b2BodyId) -> b2BodyType;
2399}
2400unsafe extern "C" {
2401 #[doc = " Change the body type. This is an expensive operation. This automatically updates the mass\n properties regardless of the automatic mass setting."]
2402 pub fn b2Body_SetType(bodyId: b2BodyId, type_: b2BodyType);
2403}
2404unsafe extern "C" {
2405 #[doc = " Set the body name. Up to 31 characters excluding 0 termination."]
2406 pub fn b2Body_SetName(bodyId: b2BodyId, name: *const ::std::os::raw::c_char);
2407}
2408unsafe extern "C" {
2409 #[doc = " Get the body name."]
2410 pub fn b2Body_GetName(bodyId: b2BodyId) -> *const ::std::os::raw::c_char;
2411}
2412unsafe extern "C" {
2413 #[doc = " Set the user data for a body"]
2414 pub fn b2Body_SetUserData(bodyId: b2BodyId, userData: *mut ::std::os::raw::c_void);
2415}
2416unsafe extern "C" {
2417 #[doc = " Get the user data stored in a body"]
2418 pub fn b2Body_GetUserData(bodyId: b2BodyId) -> *mut ::std::os::raw::c_void;
2419}
2420unsafe extern "C" {
2421 #[doc = " Get the world position of a body. This is the location of the body origin."]
2422 pub fn b2Body_GetPosition(bodyId: b2BodyId) -> b2Vec2;
2423}
2424unsafe extern "C" {
2425 #[doc = " Get the world rotation of a body as a cosine/sine pair (complex number)"]
2426 pub fn b2Body_GetRotation(bodyId: b2BodyId) -> b2Rot;
2427}
2428unsafe extern "C" {
2429 #[doc = " Get the world transform of a body."]
2430 pub fn b2Body_GetTransform(bodyId: b2BodyId) -> b2Transform;
2431}
2432unsafe extern "C" {
2433 #[doc = " Set the world transform of a body. This acts as a teleport and is fairly expensive.\n @note Generally you should create a body with then intended transform.\n @see b2BodyDef::position and b2BodyDef::rotation"]
2434 pub fn b2Body_SetTransform(bodyId: b2BodyId, position: b2Vec2, rotation: b2Rot);
2435}
2436unsafe extern "C" {
2437 #[doc = " Get a local point on a body given a world point"]
2438 pub fn b2Body_GetLocalPoint(bodyId: b2BodyId, worldPoint: b2Vec2) -> b2Vec2;
2439}
2440unsafe extern "C" {
2441 #[doc = " Get a world point on a body given a local point"]
2442 pub fn b2Body_GetWorldPoint(bodyId: b2BodyId, localPoint: b2Vec2) -> b2Vec2;
2443}
2444unsafe extern "C" {
2445 #[doc = " Get a local vector on a body given a world vector"]
2446 pub fn b2Body_GetLocalVector(bodyId: b2BodyId, worldVector: b2Vec2) -> b2Vec2;
2447}
2448unsafe extern "C" {
2449 #[doc = " Get a world vector on a body given a local vector"]
2450 pub fn b2Body_GetWorldVector(bodyId: b2BodyId, localVector: b2Vec2) -> b2Vec2;
2451}
2452unsafe extern "C" {
2453 #[doc = " Get the linear velocity of a body's center of mass. Usually in meters per second."]
2454 pub fn b2Body_GetLinearVelocity(bodyId: b2BodyId) -> b2Vec2;
2455}
2456unsafe extern "C" {
2457 #[doc = " Get the angular velocity of a body in radians per second"]
2458 pub fn b2Body_GetAngularVelocity(bodyId: b2BodyId) -> f32;
2459}
2460unsafe extern "C" {
2461 #[doc = " Set the linear velocity of a body. Usually in meters per second."]
2462 pub fn b2Body_SetLinearVelocity(bodyId: b2BodyId, linearVelocity: b2Vec2);
2463}
2464unsafe extern "C" {
2465 #[doc = " Set the angular velocity of a body in radians per second"]
2466 pub fn b2Body_SetAngularVelocity(bodyId: b2BodyId, angularVelocity: f32);
2467}
2468unsafe extern "C" {
2469 #[doc = " Set the velocity to reach the given transform after a given time step.\n The result will be close but maybe not exact. This is meant for kinematic bodies.\n The target is not applied if the velocity would be below the sleep threshold and\n the body is currently asleep.\n @param bodyId The body id\n @param target The target transform for the body\n @param timeStep The time step of the next call to b2World_Step\n @param wake Option to wake the body or not"]
2470 pub fn b2Body_SetTargetTransform(
2471 bodyId: b2BodyId,
2472 target: b2Transform,
2473 timeStep: f32,
2474 wake: bool,
2475 );
2476}
2477unsafe extern "C" {
2478 #[doc = " Get the linear velocity of a local point attached to a body. Usually in meters per second."]
2479 pub fn b2Body_GetLocalPointVelocity(bodyId: b2BodyId, localPoint: b2Vec2) -> b2Vec2;
2480}
2481unsafe extern "C" {
2482 #[doc = " Get the linear velocity of a world point attached to a body. Usually in meters per second."]
2483 pub fn b2Body_GetWorldPointVelocity(bodyId: b2BodyId, worldPoint: b2Vec2) -> b2Vec2;
2484}
2485unsafe extern "C" {
2486 #[doc = " Apply a force at a world point. If the force is not applied at the center of mass,\n it will generate a torque and affect the angular velocity. This optionally wakes up the body.\n The force is ignored if the body is not awake.\n @param bodyId The body id\n @param force The world force vector, usually in newtons (N)\n @param point The world position of the point of application\n @param wake Option to wake up the body"]
2487 pub fn b2Body_ApplyForce(bodyId: b2BodyId, force: b2Vec2, point: b2Vec2, wake: bool);
2488}
2489unsafe extern "C" {
2490 #[doc = " Apply a force to the center of mass. This optionally wakes up the body.\n The force is ignored if the body is not awake.\n @param bodyId The body id\n @param force the world force vector, usually in newtons (N).\n @param wake also wake up the body"]
2491 pub fn b2Body_ApplyForceToCenter(bodyId: b2BodyId, force: b2Vec2, wake: bool);
2492}
2493unsafe extern "C" {
2494 #[doc = " Apply a torque. This affects the angular velocity without affecting the linear velocity.\n This optionally wakes the body. The torque is ignored if the body is not awake.\n @param bodyId The body id\n @param torque about the z-axis (out of the screen), usually in N*m.\n @param wake also wake up the body"]
2495 pub fn b2Body_ApplyTorque(bodyId: b2BodyId, torque: f32, wake: bool);
2496}
2497unsafe extern "C" {
2498 #[doc = " Clear the force and torque on this body. Forces and torques are automatically cleared after each world\n step. So this only needs to be called if the application wants to remove the effect of previous\n calls to apply forces and torques before the world step is called.\n @param bodyId The body id"]
2499 pub fn b2Body_ClearForces(bodyId: b2BodyId);
2500}
2501unsafe extern "C" {
2502 #[doc = " Apply an impulse at a point. This immediately modifies the velocity.\n It also modifies the angular velocity if the point of application\n is not at the center of mass. This optionally wakes the body.\n The impulse is ignored if the body is not awake.\n @param bodyId The body id\n @param impulse the world impulse vector, usually in N*s or kg*m/s.\n @param point the world position of the point of application.\n @param wake also wake up the body\n @warning This should be used for one-shot impulses. If you need a steady force,\n use a force instead, which will work better with the sub-stepping solver."]
2503 pub fn b2Body_ApplyLinearImpulse(bodyId: b2BodyId, impulse: b2Vec2, point: b2Vec2, wake: bool);
2504}
2505unsafe extern "C" {
2506 #[doc = " Apply an impulse to the center of mass. This immediately modifies the velocity.\n The impulse is ignored if the body is not awake. This optionally wakes the body.\n @param bodyId The body id\n @param impulse the world impulse vector, usually in N*s or kg*m/s.\n @param wake also wake up the body\n @warning This should be used for one-shot impulses. If you need a steady force,\n use a force instead, which will work better with the sub-stepping solver."]
2507 pub fn b2Body_ApplyLinearImpulseToCenter(bodyId: b2BodyId, impulse: b2Vec2, wake: bool);
2508}
2509unsafe extern "C" {
2510 #[doc = " Apply an angular impulse. The impulse is ignored if the body is not awake.\n This optionally wakes the body.\n @param bodyId The body id\n @param impulse the angular impulse, usually in units of kg*m*m/s\n @param wake also wake up the body\n @warning This should be used for one-shot impulses. If you need a steady torque,\n use a torque instead, which will work better with the sub-stepping solver."]
2511 pub fn b2Body_ApplyAngularImpulse(bodyId: b2BodyId, impulse: f32, wake: bool);
2512}
2513unsafe extern "C" {
2514 #[doc = " Get the mass of the body, usually in kilograms"]
2515 pub fn b2Body_GetMass(bodyId: b2BodyId) -> f32;
2516}
2517unsafe extern "C" {
2518 #[doc = " Get the rotational inertia of the body, usually in kg*m^2"]
2519 pub fn b2Body_GetRotationalInertia(bodyId: b2BodyId) -> f32;
2520}
2521unsafe extern "C" {
2522 #[doc = " Get the center of mass position of the body in local space"]
2523 pub fn b2Body_GetLocalCenterOfMass(bodyId: b2BodyId) -> b2Vec2;
2524}
2525unsafe extern "C" {
2526 #[doc = " Get the center of mass position of the body in world space"]
2527 pub fn b2Body_GetWorldCenterOfMass(bodyId: b2BodyId) -> b2Vec2;
2528}
2529unsafe extern "C" {
2530 #[doc = " Override the body's mass properties. Normally this is computed automatically using the\n shape geometry and density. This information is lost if a shape is added or removed or if the\n body type changes."]
2531 pub fn b2Body_SetMassData(bodyId: b2BodyId, massData: b2MassData);
2532}
2533unsafe extern "C" {
2534 #[doc = " Get the mass data for a body"]
2535 pub fn b2Body_GetMassData(bodyId: b2BodyId) -> b2MassData;
2536}
2537unsafe extern "C" {
2538 #[doc = " This updates the mass properties to the sum of the mass properties of the shapes.\n This normally does not need to be called unless you called SetMassData to override\n the mass and you later want to reset the mass.\n You may also use this when automatic mass computation has been disabled.\n You should call this regardless of body type.\n Note that sensor shapes may have mass."]
2539 pub fn b2Body_ApplyMassFromShapes(bodyId: b2BodyId);
2540}
2541unsafe extern "C" {
2542 #[doc = " Adjust the linear damping. Normally this is set in b2BodyDef before creation."]
2543 pub fn b2Body_SetLinearDamping(bodyId: b2BodyId, linearDamping: f32);
2544}
2545unsafe extern "C" {
2546 #[doc = " Get the current linear damping."]
2547 pub fn b2Body_GetLinearDamping(bodyId: b2BodyId) -> f32;
2548}
2549unsafe extern "C" {
2550 #[doc = " Adjust the angular damping. Normally this is set in b2BodyDef before creation."]
2551 pub fn b2Body_SetAngularDamping(bodyId: b2BodyId, angularDamping: f32);
2552}
2553unsafe extern "C" {
2554 #[doc = " Get the current angular damping."]
2555 pub fn b2Body_GetAngularDamping(bodyId: b2BodyId) -> f32;
2556}
2557unsafe extern "C" {
2558 #[doc = " Adjust the gravity scale. Normally this is set in b2BodyDef before creation.\n @see b2BodyDef::gravityScale"]
2559 pub fn b2Body_SetGravityScale(bodyId: b2BodyId, gravityScale: f32);
2560}
2561unsafe extern "C" {
2562 #[doc = " Get the current gravity scale"]
2563 pub fn b2Body_GetGravityScale(bodyId: b2BodyId) -> f32;
2564}
2565unsafe extern "C" {
2566 #[doc = " @return true if this body is awake"]
2567 pub fn b2Body_IsAwake(bodyId: b2BodyId) -> bool;
2568}
2569unsafe extern "C" {
2570 #[doc = " Wake a body from sleep. This wakes the entire island the body is touching.\n @warning Putting a body to sleep will put the entire island of bodies touching this body to sleep,\n which can be expensive and possibly unintuitive."]
2571 pub fn b2Body_SetAwake(bodyId: b2BodyId, awake: bool);
2572}
2573unsafe extern "C" {
2574 #[doc = " Wake bodies touching this body. Works for static bodies."]
2575 pub fn b2Body_WakeTouching(bodyId: b2BodyId);
2576}
2577unsafe extern "C" {
2578 #[doc = " Enable or disable sleeping for this body. If sleeping is disabled the body will wake."]
2579 pub fn b2Body_EnableSleep(bodyId: b2BodyId, enableSleep: bool);
2580}
2581unsafe extern "C" {
2582 #[doc = " Returns true if sleeping is enabled for this body"]
2583 pub fn b2Body_IsSleepEnabled(bodyId: b2BodyId) -> bool;
2584}
2585unsafe extern "C" {
2586 #[doc = " Set the sleep threshold, usually in meters per second"]
2587 pub fn b2Body_SetSleepThreshold(bodyId: b2BodyId, sleepThreshold: f32);
2588}
2589unsafe extern "C" {
2590 #[doc = " Get the sleep threshold, usually in meters per second."]
2591 pub fn b2Body_GetSleepThreshold(bodyId: b2BodyId) -> f32;
2592}
2593unsafe extern "C" {
2594 #[doc = " Returns true if this body is enabled"]
2595 pub fn b2Body_IsEnabled(bodyId: b2BodyId) -> bool;
2596}
2597unsafe extern "C" {
2598 #[doc = " Disable a body by removing it completely from the simulation. This is expensive."]
2599 pub fn b2Body_Disable(bodyId: b2BodyId);
2600}
2601unsafe extern "C" {
2602 #[doc = " Enable a body by adding it to the simulation. This is expensive."]
2603 pub fn b2Body_Enable(bodyId: b2BodyId);
2604}
2605unsafe extern "C" {
2606 #[doc = " Set the motion locks on this body."]
2607 pub fn b2Body_SetMotionLocks(bodyId: b2BodyId, locks: b2MotionLocks);
2608}
2609unsafe extern "C" {
2610 #[doc = " Get the motion locks for this body."]
2611 pub fn b2Body_GetMotionLocks(bodyId: b2BodyId) -> b2MotionLocks;
2612}
2613unsafe extern "C" {
2614 #[doc = " Set this body to be a bullet. A bullet does continuous collision detection\n against dynamic bodies (but not other bullets)."]
2615 pub fn b2Body_SetBullet(bodyId: b2BodyId, flag: bool);
2616}
2617unsafe extern "C" {
2618 #[doc = " Is this body a bullet?"]
2619 pub fn b2Body_IsBullet(bodyId: b2BodyId) -> bool;
2620}
2621unsafe extern "C" {
2622 #[doc = " Enable/disable contact events on all shapes.\n @see b2ShapeDef::enableContactEvents\n @warning changing this at runtime may cause mismatched begin/end touch events"]
2623 pub fn b2Body_EnableContactEvents(bodyId: b2BodyId, flag: bool);
2624}
2625unsafe extern "C" {
2626 #[doc = " Enable/disable hit events on all shapes\n @see b2ShapeDef::enableHitEvents"]
2627 pub fn b2Body_EnableHitEvents(bodyId: b2BodyId, flag: bool);
2628}
2629unsafe extern "C" {
2630 #[doc = " Get the world that owns this body"]
2631 pub fn b2Body_GetWorld(bodyId: b2BodyId) -> b2WorldId;
2632}
2633unsafe extern "C" {
2634 #[doc = " Get the number of shapes on this body"]
2635 pub fn b2Body_GetShapeCount(bodyId: b2BodyId) -> ::std::os::raw::c_int;
2636}
2637unsafe extern "C" {
2638 #[doc = " Get the shape ids for all shapes on this body, up to the provided capacity.\n @returns the number of shape ids stored in the user array"]
2639 pub fn b2Body_GetShapes(
2640 bodyId: b2BodyId,
2641 shapeArray: *mut b2ShapeId,
2642 capacity: ::std::os::raw::c_int,
2643 ) -> ::std::os::raw::c_int;
2644}
2645unsafe extern "C" {
2646 #[doc = " Get the number of joints on this body"]
2647 pub fn b2Body_GetJointCount(bodyId: b2BodyId) -> ::std::os::raw::c_int;
2648}
2649unsafe extern "C" {
2650 #[doc = " Get the joint ids for all joints on this body, up to the provided capacity\n @returns the number of joint ids stored in the user array"]
2651 pub fn b2Body_GetJoints(
2652 bodyId: b2BodyId,
2653 jointArray: *mut b2JointId,
2654 capacity: ::std::os::raw::c_int,
2655 ) -> ::std::os::raw::c_int;
2656}
2657unsafe extern "C" {
2658 #[doc = " Get the maximum capacity required for retrieving all the touching contacts on a body"]
2659 pub fn b2Body_GetContactCapacity(bodyId: b2BodyId) -> ::std::os::raw::c_int;
2660}
2661unsafe extern "C" {
2662 #[doc = " Get the touching contact data for a body.\n @note Box2D uses speculative collision so some contact points may be separated.\n @returns the number of elements filled in the provided array\n @warning do not ignore the return value, it specifies the valid number of elements"]
2663 pub fn b2Body_GetContactData(
2664 bodyId: b2BodyId,
2665 contactData: *mut b2ContactData,
2666 capacity: ::std::os::raw::c_int,
2667 ) -> ::std::os::raw::c_int;
2668}
2669unsafe extern "C" {
2670 #[doc = " Get the current world AABB that contains all the attached shapes. Note that this may not encompass the body origin.\n If there are no shapes attached then the returned AABB is empty and centered on the body origin."]
2671 pub fn b2Body_ComputeAABB(bodyId: b2BodyId) -> b2AABB;
2672}
2673unsafe extern "C" {
2674 #[doc = " Create a circle shape and attach it to a body. The shape definition and geometry are fully cloned.\n Contacts are not created until the next time step.\n @return the shape id for accessing the shape"]
2675 pub fn b2CreateCircleShape(
2676 bodyId: b2BodyId,
2677 def: *const b2ShapeDef,
2678 circle: *const b2Circle,
2679 ) -> b2ShapeId;
2680}
2681unsafe extern "C" {
2682 #[doc = " Create a line segment shape and attach it to a body. The shape definition and geometry are fully cloned.\n Contacts are not created until the next time step.\n @return the shape id for accessing the shape"]
2683 pub fn b2CreateSegmentShape(
2684 bodyId: b2BodyId,
2685 def: *const b2ShapeDef,
2686 segment: *const b2Segment,
2687 ) -> b2ShapeId;
2688}
2689unsafe extern "C" {
2690 #[doc = " Create a capsule shape and attach it to a body. The shape definition and geometry are fully cloned.\n Contacts are not created until the next time step.\n @return the shape id for accessing the shape, this will be b2_nullShapeId if the length is too small."]
2691 pub fn b2CreateCapsuleShape(
2692 bodyId: b2BodyId,
2693 def: *const b2ShapeDef,
2694 capsule: *const b2Capsule,
2695 ) -> b2ShapeId;
2696}
2697unsafe extern "C" {
2698 #[doc = " Create a polygon shape and attach it to a body. The shape definition and geometry are fully cloned.\n Contacts are not created until the next time step.\n @return the shape id for accessing the shape"]
2699 pub fn b2CreatePolygonShape(
2700 bodyId: b2BodyId,
2701 def: *const b2ShapeDef,
2702 polygon: *const b2Polygon,
2703 ) -> b2ShapeId;
2704}
2705unsafe extern "C" {
2706 #[doc = " Destroy a shape. You may defer the body mass update which can improve performance if several shapes on a\n\tbody are destroyed at once.\n\t@see b2Body_ApplyMassFromShapes"]
2707 pub fn b2DestroyShape(shapeId: b2ShapeId, updateBodyMass: bool);
2708}
2709unsafe extern "C" {
2710 #[doc = " Shape identifier validation. Provides validation for up to 64K allocations."]
2711 pub fn b2Shape_IsValid(id: b2ShapeId) -> bool;
2712}
2713unsafe extern "C" {
2714 #[doc = " Get the type of a shape"]
2715 pub fn b2Shape_GetType(shapeId: b2ShapeId) -> b2ShapeType;
2716}
2717unsafe extern "C" {
2718 #[doc = " Get the id of the body that a shape is attached to"]
2719 pub fn b2Shape_GetBody(shapeId: b2ShapeId) -> b2BodyId;
2720}
2721unsafe extern "C" {
2722 #[doc = " Get the world that owns this shape"]
2723 pub fn b2Shape_GetWorld(shapeId: b2ShapeId) -> b2WorldId;
2724}
2725unsafe extern "C" {
2726 #[doc = " Returns true if the shape is a sensor. It is not possible to change a shape\n from sensor to solid dynamically because this breaks the contract for\n sensor events."]
2727 pub fn b2Shape_IsSensor(shapeId: b2ShapeId) -> bool;
2728}
2729unsafe extern "C" {
2730 #[doc = " Set the user data for a shape"]
2731 pub fn b2Shape_SetUserData(shapeId: b2ShapeId, userData: *mut ::std::os::raw::c_void);
2732}
2733unsafe extern "C" {
2734 #[doc = " Get the user data for a shape. This is useful when you get a shape id\n from an event or query."]
2735 pub fn b2Shape_GetUserData(shapeId: b2ShapeId) -> *mut ::std::os::raw::c_void;
2736}
2737unsafe extern "C" {
2738 #[doc = " Set the mass density of a shape, usually in kg/m^2.\n This will optionally update the mass properties on the parent body.\n @see b2ShapeDef::density, b2Body_ApplyMassFromShapes"]
2739 pub fn b2Shape_SetDensity(shapeId: b2ShapeId, density: f32, updateBodyMass: bool);
2740}
2741unsafe extern "C" {
2742 #[doc = " Get the density of a shape, usually in kg/m^2"]
2743 pub fn b2Shape_GetDensity(shapeId: b2ShapeId) -> f32;
2744}
2745unsafe extern "C" {
2746 #[doc = " Set the friction on a shape"]
2747 pub fn b2Shape_SetFriction(shapeId: b2ShapeId, friction: f32);
2748}
2749unsafe extern "C" {
2750 #[doc = " Get the friction of a shape"]
2751 pub fn b2Shape_GetFriction(shapeId: b2ShapeId) -> f32;
2752}
2753unsafe extern "C" {
2754 #[doc = " Set the shape restitution (bounciness)"]
2755 pub fn b2Shape_SetRestitution(shapeId: b2ShapeId, restitution: f32);
2756}
2757unsafe extern "C" {
2758 #[doc = " Get the shape restitution"]
2759 pub fn b2Shape_GetRestitution(shapeId: b2ShapeId) -> f32;
2760}
2761unsafe extern "C" {
2762 #[doc = " Set the user material identifier"]
2763 pub fn b2Shape_SetUserMaterial(shapeId: b2ShapeId, material: u64);
2764}
2765unsafe extern "C" {
2766 #[doc = " Get the user material identifier"]
2767 pub fn b2Shape_GetUserMaterial(shapeId: b2ShapeId) -> u64;
2768}
2769unsafe extern "C" {
2770 #[doc = " Set the shape surface material"]
2771 pub fn b2Shape_SetSurfaceMaterial(
2772 shapeId: b2ShapeId,
2773 surfaceMaterial: *const b2SurfaceMaterial,
2774 );
2775}
2776unsafe extern "C" {
2777 #[doc = " Get the shape surface material"]
2778 pub fn b2Shape_GetSurfaceMaterial(shapeId: b2ShapeId) -> b2SurfaceMaterial;
2779}
2780unsafe extern "C" {
2781 #[doc = " Get the shape filter"]
2782 pub fn b2Shape_GetFilter(shapeId: b2ShapeId) -> b2Filter;
2783}
2784unsafe extern "C" {
2785 #[doc = " Set the current filter. This is almost as expensive as recreating the shape. This may cause\n contacts to be immediately destroyed. However contacts are not created until the next world step.\n Sensor overlap state is also not updated until the next world step.\n @see b2ShapeDef::filter"]
2786 pub fn b2Shape_SetFilter(shapeId: b2ShapeId, filter: b2Filter);
2787}
2788unsafe extern "C" {
2789 #[doc = " Enable sensor events for this shape.\n @see b2ShapeDef::enableSensorEvents"]
2790 pub fn b2Shape_EnableSensorEvents(shapeId: b2ShapeId, flag: bool);
2791}
2792unsafe extern "C" {
2793 #[doc = " Returns true if sensor events are enabled."]
2794 pub fn b2Shape_AreSensorEventsEnabled(shapeId: b2ShapeId) -> bool;
2795}
2796unsafe extern "C" {
2797 #[doc = " Enable contact events for this shape. Only applies to kinematic and dynamic bodies. Ignored for sensors.\n @see b2ShapeDef::enableContactEvents\n @warning changing this at run-time may lead to lost begin/end events"]
2798 pub fn b2Shape_EnableContactEvents(shapeId: b2ShapeId, flag: bool);
2799}
2800unsafe extern "C" {
2801 #[doc = " Returns true if contact events are enabled"]
2802 pub fn b2Shape_AreContactEventsEnabled(shapeId: b2ShapeId) -> bool;
2803}
2804unsafe extern "C" {
2805 #[doc = " Enable pre-solve contact events for this shape. Only applies to dynamic bodies. These are expensive\n and must be carefully handled due to multithreading. Ignored for sensors.\n @see b2PreSolveFcn"]
2806 pub fn b2Shape_EnablePreSolveEvents(shapeId: b2ShapeId, flag: bool);
2807}
2808unsafe extern "C" {
2809 #[doc = " Returns true if pre-solve events are enabled"]
2810 pub fn b2Shape_ArePreSolveEventsEnabled(shapeId: b2ShapeId) -> bool;
2811}
2812unsafe extern "C" {
2813 #[doc = " Enable contact hit events for this shape. Ignored for sensors.\n @see b2WorldDef.hitEventThreshold"]
2814 pub fn b2Shape_EnableHitEvents(shapeId: b2ShapeId, flag: bool);
2815}
2816unsafe extern "C" {
2817 #[doc = " Returns true if hit events are enabled"]
2818 pub fn b2Shape_AreHitEventsEnabled(shapeId: b2ShapeId) -> bool;
2819}
2820unsafe extern "C" {
2821 #[doc = " Test a point for overlap with a shape"]
2822 pub fn b2Shape_TestPoint(shapeId: b2ShapeId, point: b2Vec2) -> bool;
2823}
2824unsafe extern "C" {
2825 #[doc = " Ray cast a shape directly"]
2826 pub fn b2Shape_RayCast(shapeId: b2ShapeId, input: *const b2RayCastInput) -> b2CastOutput;
2827}
2828unsafe extern "C" {
2829 #[doc = " Get a copy of the shape's circle. Asserts the type is correct."]
2830 pub fn b2Shape_GetCircle(shapeId: b2ShapeId) -> b2Circle;
2831}
2832unsafe extern "C" {
2833 #[doc = " Get a copy of the shape's line segment. Asserts the type is correct."]
2834 pub fn b2Shape_GetSegment(shapeId: b2ShapeId) -> b2Segment;
2835}
2836unsafe extern "C" {
2837 #[doc = " Get a copy of the shape's chain segment. These come from chain shapes.\n Asserts the type is correct."]
2838 pub fn b2Shape_GetChainSegment(shapeId: b2ShapeId) -> b2ChainSegment;
2839}
2840unsafe extern "C" {
2841 #[doc = " Get a copy of the shape's capsule. Asserts the type is correct."]
2842 pub fn b2Shape_GetCapsule(shapeId: b2ShapeId) -> b2Capsule;
2843}
2844unsafe extern "C" {
2845 #[doc = " Get a copy of the shape's convex polygon. Asserts the type is correct."]
2846 pub fn b2Shape_GetPolygon(shapeId: b2ShapeId) -> b2Polygon;
2847}
2848unsafe extern "C" {
2849 #[doc = " Allows you to change a shape to be a circle or update the current circle.\n This does not modify the mass properties.\n @see b2Body_ApplyMassFromShapes"]
2850 pub fn b2Shape_SetCircle(shapeId: b2ShapeId, circle: *const b2Circle);
2851}
2852unsafe extern "C" {
2853 #[doc = " Allows you to change a shape to be a capsule or update the current capsule.\n This does not modify the mass properties.\n @see b2Body_ApplyMassFromShapes"]
2854 pub fn b2Shape_SetCapsule(shapeId: b2ShapeId, capsule: *const b2Capsule);
2855}
2856unsafe extern "C" {
2857 #[doc = " Allows you to change a shape to be a segment or update the current segment."]
2858 pub fn b2Shape_SetSegment(shapeId: b2ShapeId, segment: *const b2Segment);
2859}
2860unsafe extern "C" {
2861 #[doc = " Allows you to change a shape to be a polygon or update the current polygon.\n This does not modify the mass properties.\n @see b2Body_ApplyMassFromShapes"]
2862 pub fn b2Shape_SetPolygon(shapeId: b2ShapeId, polygon: *const b2Polygon);
2863}
2864unsafe extern "C" {
2865 #[doc = " Get the parent chain id if the shape type is a chain segment, otherwise\n returns b2_nullChainId."]
2866 pub fn b2Shape_GetParentChain(shapeId: b2ShapeId) -> b2ChainId;
2867}
2868unsafe extern "C" {
2869 #[doc = " Get the maximum capacity required for retrieving all the touching contacts on a shape"]
2870 pub fn b2Shape_GetContactCapacity(shapeId: b2ShapeId) -> ::std::os::raw::c_int;
2871}
2872unsafe extern "C" {
2873 #[doc = " Get the touching contact data for a shape. The provided shapeId will be either shapeIdA or shapeIdB on the contact data.\n @note Box2D uses speculative collision so some contact points may be separated.\n @returns the number of elements filled in the provided array\n @warning do not ignore the return value, it specifies the valid number of elements"]
2874 pub fn b2Shape_GetContactData(
2875 shapeId: b2ShapeId,
2876 contactData: *mut b2ContactData,
2877 capacity: ::std::os::raw::c_int,
2878 ) -> ::std::os::raw::c_int;
2879}
2880unsafe extern "C" {
2881 #[doc = " Get the maximum capacity required for retrieving all the overlapped shapes on a sensor shape.\n This returns 0 if the provided shape is not a sensor.\n @param shapeId the id of a sensor shape\n @returns the required capacity to get all the overlaps in b2Shape_GetSensorOverlaps"]
2882 pub fn b2Shape_GetSensorCapacity(shapeId: b2ShapeId) -> ::std::os::raw::c_int;
2883}
2884unsafe extern "C" {
2885 #[doc = " Get the overlap data for a sensor shape.\n @param shapeId the id of a sensor shape\n @param visitorIds a user allocated array that is filled with the overlapping shapes (visitors)\n @param capacity the capacity of overlappedShapes\n @returns the number of elements filled in the provided array\n @warning do not ignore the return value, it specifies the valid number of elements\n @warning overlaps may contain destroyed shapes so use b2Shape_IsValid to confirm each overlap"]
2886 pub fn b2Shape_GetSensorData(
2887 shapeId: b2ShapeId,
2888 visitorIds: *mut b2ShapeId,
2889 capacity: ::std::os::raw::c_int,
2890 ) -> ::std::os::raw::c_int;
2891}
2892unsafe extern "C" {
2893 #[doc = " Get the current world AABB"]
2894 pub fn b2Shape_GetAABB(shapeId: b2ShapeId) -> b2AABB;
2895}
2896unsafe extern "C" {
2897 #[doc = " Compute the mass data for a shape"]
2898 pub fn b2Shape_ComputeMassData(shapeId: b2ShapeId) -> b2MassData;
2899}
2900unsafe extern "C" {
2901 #[doc = " Get the closest point on a shape to a target point. Target and result are in world space.\n todo need sample"]
2902 pub fn b2Shape_GetClosestPoint(shapeId: b2ShapeId, target: b2Vec2) -> b2Vec2;
2903}
2904unsafe extern "C" {
2905 #[doc = " Apply a wind force to the body for this shape using the density of air. This considers\n the projected area of the shape in the wind direction. This also considers\n the relative velocity of the shape.\n @param shapeId the shape id\n @param wind the wind velocity in world space\n @param drag the drag coefficient, the force that opposes the relative velocity\n @param lift the lift coefficient, the force that is perpendicular to the relative velocity\n @param wake should this wake the body"]
2906 pub fn b2Shape_ApplyWind(shapeId: b2ShapeId, wind: b2Vec2, drag: f32, lift: f32, wake: bool);
2907}
2908unsafe extern "C" {
2909 #[doc = " Create a chain shape\n @see b2ChainDef for details"]
2910 pub fn b2CreateChain(bodyId: b2BodyId, def: *const b2ChainDef) -> b2ChainId;
2911}
2912unsafe extern "C" {
2913 #[doc = " Destroy a chain shape"]
2914 pub fn b2DestroyChain(chainId: b2ChainId);
2915}
2916unsafe extern "C" {
2917 #[doc = " Get the world that owns this chain shape"]
2918 pub fn b2Chain_GetWorld(chainId: b2ChainId) -> b2WorldId;
2919}
2920unsafe extern "C" {
2921 #[doc = " Get the number of segments on this chain"]
2922 pub fn b2Chain_GetSegmentCount(chainId: b2ChainId) -> ::std::os::raw::c_int;
2923}
2924unsafe extern "C" {
2925 #[doc = " Fill a user array with chain segment shape ids up to the specified capacity. Returns\n the actual number of segments returned."]
2926 pub fn b2Chain_GetSegments(
2927 chainId: b2ChainId,
2928 segmentArray: *mut b2ShapeId,
2929 capacity: ::std::os::raw::c_int,
2930 ) -> ::std::os::raw::c_int;
2931}
2932unsafe extern "C" {
2933 #[doc = " Get the number of materials used on this chain. Must be 1 or the number of segments."]
2934 pub fn b2Chain_GetSurfaceMaterialCount(chainId: b2ChainId) -> ::std::os::raw::c_int;
2935}
2936unsafe extern "C" {
2937 #[doc = " Set a chain material. If the chain has only one material, this material is applied to all\n segments. Otherwise it is applied to a single segment."]
2938 pub fn b2Chain_SetSurfaceMaterial(
2939 chainId: b2ChainId,
2940 material: *const b2SurfaceMaterial,
2941 materialIndex: ::std::os::raw::c_int,
2942 );
2943}
2944unsafe extern "C" {
2945 #[doc = " Get a chain material by index."]
2946 pub fn b2Chain_GetSurfaceMaterial(
2947 chainId: b2ChainId,
2948 materialIndex: ::std::os::raw::c_int,
2949 ) -> b2SurfaceMaterial;
2950}
2951unsafe extern "C" {
2952 #[doc = " Chain identifier validation. Provides validation for up to 64K allocations."]
2953 pub fn b2Chain_IsValid(id: b2ChainId) -> bool;
2954}
2955unsafe extern "C" {
2956 #[doc = " Destroy a joint. Optionally wake attached bodies."]
2957 pub fn b2DestroyJoint(jointId: b2JointId, wakeAttached: bool);
2958}
2959unsafe extern "C" {
2960 #[doc = " Joint identifier validation. Provides validation for up to 64K allocations."]
2961 pub fn b2Joint_IsValid(id: b2JointId) -> bool;
2962}
2963unsafe extern "C" {
2964 #[doc = " Get the joint type"]
2965 pub fn b2Joint_GetType(jointId: b2JointId) -> b2JointType;
2966}
2967unsafe extern "C" {
2968 #[doc = " Get body A id on a joint"]
2969 pub fn b2Joint_GetBodyA(jointId: b2JointId) -> b2BodyId;
2970}
2971unsafe extern "C" {
2972 #[doc = " Get body B id on a joint"]
2973 pub fn b2Joint_GetBodyB(jointId: b2JointId) -> b2BodyId;
2974}
2975unsafe extern "C" {
2976 #[doc = " Get the world that owns this joint"]
2977 pub fn b2Joint_GetWorld(jointId: b2JointId) -> b2WorldId;
2978}
2979unsafe extern "C" {
2980 #[doc = " Set the local frame on bodyA"]
2981 pub fn b2Joint_SetLocalFrameA(jointId: b2JointId, localFrame: b2Transform);
2982}
2983unsafe extern "C" {
2984 #[doc = " Get the local frame on bodyA"]
2985 pub fn b2Joint_GetLocalFrameA(jointId: b2JointId) -> b2Transform;
2986}
2987unsafe extern "C" {
2988 #[doc = " Set the local frame on bodyB"]
2989 pub fn b2Joint_SetLocalFrameB(jointId: b2JointId, localFrame: b2Transform);
2990}
2991unsafe extern "C" {
2992 #[doc = " Get the local frame on bodyB"]
2993 pub fn b2Joint_GetLocalFrameB(jointId: b2JointId) -> b2Transform;
2994}
2995unsafe extern "C" {
2996 #[doc = " Toggle collision between connected bodies"]
2997 pub fn b2Joint_SetCollideConnected(jointId: b2JointId, shouldCollide: bool);
2998}
2999unsafe extern "C" {
3000 #[doc = " Is collision allowed between connected bodies?"]
3001 pub fn b2Joint_GetCollideConnected(jointId: b2JointId) -> bool;
3002}
3003unsafe extern "C" {
3004 #[doc = " Set the user data on a joint"]
3005 pub fn b2Joint_SetUserData(jointId: b2JointId, userData: *mut ::std::os::raw::c_void);
3006}
3007unsafe extern "C" {
3008 #[doc = " Get the user data on a joint"]
3009 pub fn b2Joint_GetUserData(jointId: b2JointId) -> *mut ::std::os::raw::c_void;
3010}
3011unsafe extern "C" {
3012 #[doc = " Wake the bodies connect to this joint"]
3013 pub fn b2Joint_WakeBodies(jointId: b2JointId);
3014}
3015unsafe extern "C" {
3016 #[doc = " Get the current constraint force for this joint. Usually in Newtons."]
3017 pub fn b2Joint_GetConstraintForce(jointId: b2JointId) -> b2Vec2;
3018}
3019unsafe extern "C" {
3020 #[doc = " Get the current constraint torque for this joint. Usually in Newton * meters."]
3021 pub fn b2Joint_GetConstraintTorque(jointId: b2JointId) -> f32;
3022}
3023unsafe extern "C" {
3024 #[doc = " Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters."]
3025 pub fn b2Joint_GetLinearSeparation(jointId: b2JointId) -> f32;
3026}
3027unsafe extern "C" {
3028 #[doc = " Get the current angular separation error for this joint. Does not consider admissible movement. Usually in meters."]
3029 pub fn b2Joint_GetAngularSeparation(jointId: b2JointId) -> f32;
3030}
3031unsafe extern "C" {
3032 #[doc = " Set the joint constraint tuning. Advanced feature.\n @param jointId the joint\n @param hertz the stiffness in Hertz (cycles per second)\n @param dampingRatio the non-dimensional damping ratio (one for critical damping)"]
3033 pub fn b2Joint_SetConstraintTuning(jointId: b2JointId, hertz: f32, dampingRatio: f32);
3034}
3035unsafe extern "C" {
3036 #[doc = " Get the joint constraint tuning. Advanced feature."]
3037 pub fn b2Joint_GetConstraintTuning(jointId: b2JointId, hertz: *mut f32, dampingRatio: *mut f32);
3038}
3039unsafe extern "C" {
3040 #[doc = " Set the force threshold for joint events (Newtons)"]
3041 pub fn b2Joint_SetForceThreshold(jointId: b2JointId, threshold: f32);
3042}
3043unsafe extern "C" {
3044 #[doc = " Get the force threshold for joint events (Newtons)"]
3045 pub fn b2Joint_GetForceThreshold(jointId: b2JointId) -> f32;
3046}
3047unsafe extern "C" {
3048 #[doc = " Set the torque threshold for joint events (N-m)"]
3049 pub fn b2Joint_SetTorqueThreshold(jointId: b2JointId, threshold: f32);
3050}
3051unsafe extern "C" {
3052 #[doc = " Get the torque threshold for joint events (N-m)"]
3053 pub fn b2Joint_GetTorqueThreshold(jointId: b2JointId) -> f32;
3054}
3055unsafe extern "C" {
3056 #[doc = " Create a distance joint\n @see b2DistanceJointDef for details"]
3057 pub fn b2CreateDistanceJoint(worldId: b2WorldId, def: *const b2DistanceJointDef) -> b2JointId;
3058}
3059unsafe extern "C" {
3060 #[doc = " Set the rest length of a distance joint\n @param jointId The id for a distance joint\n @param length The new distance joint length"]
3061 pub fn b2DistanceJoint_SetLength(jointId: b2JointId, length: f32);
3062}
3063unsafe extern "C" {
3064 #[doc = " Get the rest length of a distance joint"]
3065 pub fn b2DistanceJoint_GetLength(jointId: b2JointId) -> f32;
3066}
3067unsafe extern "C" {
3068 #[doc = " Enable/disable the distance joint spring. When disabled the distance joint is rigid."]
3069 pub fn b2DistanceJoint_EnableSpring(jointId: b2JointId, enableSpring: bool);
3070}
3071unsafe extern "C" {
3072 #[doc = " Is the distance joint spring enabled?"]
3073 pub fn b2DistanceJoint_IsSpringEnabled(jointId: b2JointId) -> bool;
3074}
3075unsafe extern "C" {
3076 #[doc = " Set the force range for the spring."]
3077 pub fn b2DistanceJoint_SetSpringForceRange(
3078 jointId: b2JointId,
3079 lowerForce: f32,
3080 upperForce: f32,
3081 );
3082}
3083unsafe extern "C" {
3084 #[doc = " Get the force range for the spring."]
3085 pub fn b2DistanceJoint_GetSpringForceRange(
3086 jointId: b2JointId,
3087 lowerForce: *mut f32,
3088 upperForce: *mut f32,
3089 );
3090}
3091unsafe extern "C" {
3092 #[doc = " Set the spring stiffness in Hertz"]
3093 pub fn b2DistanceJoint_SetSpringHertz(jointId: b2JointId, hertz: f32);
3094}
3095unsafe extern "C" {
3096 #[doc = " Set the spring damping ratio, non-dimensional"]
3097 pub fn b2DistanceJoint_SetSpringDampingRatio(jointId: b2JointId, dampingRatio: f32);
3098}
3099unsafe extern "C" {
3100 #[doc = " Get the spring Hertz"]
3101 pub fn b2DistanceJoint_GetSpringHertz(jointId: b2JointId) -> f32;
3102}
3103unsafe extern "C" {
3104 #[doc = " Get the spring damping ratio"]
3105 pub fn b2DistanceJoint_GetSpringDampingRatio(jointId: b2JointId) -> f32;
3106}
3107unsafe extern "C" {
3108 #[doc = " Enable joint limit. The limit only works if the joint spring is enabled. Otherwise the joint is rigid\n and the limit has no effect."]
3109 pub fn b2DistanceJoint_EnableLimit(jointId: b2JointId, enableLimit: bool);
3110}
3111unsafe extern "C" {
3112 #[doc = " Is the distance joint limit enabled?"]
3113 pub fn b2DistanceJoint_IsLimitEnabled(jointId: b2JointId) -> bool;
3114}
3115unsafe extern "C" {
3116 #[doc = " Set the minimum and maximum length parameters of a distance joint"]
3117 pub fn b2DistanceJoint_SetLengthRange(jointId: b2JointId, minLength: f32, maxLength: f32);
3118}
3119unsafe extern "C" {
3120 #[doc = " Get the distance joint minimum length"]
3121 pub fn b2DistanceJoint_GetMinLength(jointId: b2JointId) -> f32;
3122}
3123unsafe extern "C" {
3124 #[doc = " Get the distance joint maximum length"]
3125 pub fn b2DistanceJoint_GetMaxLength(jointId: b2JointId) -> f32;
3126}
3127unsafe extern "C" {
3128 #[doc = " Get the current length of a distance joint"]
3129 pub fn b2DistanceJoint_GetCurrentLength(jointId: b2JointId) -> f32;
3130}
3131unsafe extern "C" {
3132 #[doc = " Enable/disable the distance joint motor"]
3133 pub fn b2DistanceJoint_EnableMotor(jointId: b2JointId, enableMotor: bool);
3134}
3135unsafe extern "C" {
3136 #[doc = " Is the distance joint motor enabled?"]
3137 pub fn b2DistanceJoint_IsMotorEnabled(jointId: b2JointId) -> bool;
3138}
3139unsafe extern "C" {
3140 #[doc = " Set the distance joint motor speed, usually in meters per second"]
3141 pub fn b2DistanceJoint_SetMotorSpeed(jointId: b2JointId, motorSpeed: f32);
3142}
3143unsafe extern "C" {
3144 #[doc = " Get the distance joint motor speed, usually in meters per second"]
3145 pub fn b2DistanceJoint_GetMotorSpeed(jointId: b2JointId) -> f32;
3146}
3147unsafe extern "C" {
3148 #[doc = " Set the distance joint maximum motor force, usually in newtons"]
3149 pub fn b2DistanceJoint_SetMaxMotorForce(jointId: b2JointId, force: f32);
3150}
3151unsafe extern "C" {
3152 #[doc = " Get the distance joint maximum motor force, usually in newtons"]
3153 pub fn b2DistanceJoint_GetMaxMotorForce(jointId: b2JointId) -> f32;
3154}
3155unsafe extern "C" {
3156 #[doc = " Get the distance joint current motor force, usually in newtons"]
3157 pub fn b2DistanceJoint_GetMotorForce(jointId: b2JointId) -> f32;
3158}
3159unsafe extern "C" {
3160 #[doc = " Create a motor joint\n @see b2MotorJointDef for details"]
3161 pub fn b2CreateMotorJoint(worldId: b2WorldId, def: *const b2MotorJointDef) -> b2JointId;
3162}
3163unsafe extern "C" {
3164 #[doc = " Set the desired relative linear velocity in meters per second"]
3165 pub fn b2MotorJoint_SetLinearVelocity(jointId: b2JointId, velocity: b2Vec2);
3166}
3167unsafe extern "C" {
3168 #[doc = " Get the desired relative linear velocity in meters per second"]
3169 pub fn b2MotorJoint_GetLinearVelocity(jointId: b2JointId) -> b2Vec2;
3170}
3171unsafe extern "C" {
3172 #[doc = " Set the desired relative angular velocity in radians per second"]
3173 pub fn b2MotorJoint_SetAngularVelocity(jointId: b2JointId, velocity: f32);
3174}
3175unsafe extern "C" {
3176 #[doc = " Get the desired relative angular velocity in radians per second"]
3177 pub fn b2MotorJoint_GetAngularVelocity(jointId: b2JointId) -> f32;
3178}
3179unsafe extern "C" {
3180 #[doc = " Set the motor joint maximum force, usually in newtons"]
3181 pub fn b2MotorJoint_SetMaxVelocityForce(jointId: b2JointId, maxForce: f32);
3182}
3183unsafe extern "C" {
3184 #[doc = " Get the motor joint maximum force, usually in newtons"]
3185 pub fn b2MotorJoint_GetMaxVelocityForce(jointId: b2JointId) -> f32;
3186}
3187unsafe extern "C" {
3188 #[doc = " Set the motor joint maximum torque, usually in newton-meters"]
3189 pub fn b2MotorJoint_SetMaxVelocityTorque(jointId: b2JointId, maxTorque: f32);
3190}
3191unsafe extern "C" {
3192 #[doc = " Get the motor joint maximum torque, usually in newton-meters"]
3193 pub fn b2MotorJoint_GetMaxVelocityTorque(jointId: b2JointId) -> f32;
3194}
3195unsafe extern "C" {
3196 #[doc = " Set the spring linear hertz stiffness"]
3197 pub fn b2MotorJoint_SetLinearHertz(jointId: b2JointId, hertz: f32);
3198}
3199unsafe extern "C" {
3200 #[doc = " Get the spring linear hertz stiffness"]
3201 pub fn b2MotorJoint_GetLinearHertz(jointId: b2JointId) -> f32;
3202}
3203unsafe extern "C" {
3204 #[doc = " Set the spring linear damping ratio. Use 1.0 for critical damping."]
3205 pub fn b2MotorJoint_SetLinearDampingRatio(jointId: b2JointId, damping: f32);
3206}
3207unsafe extern "C" {
3208 #[doc = " Get the spring linear damping ratio."]
3209 pub fn b2MotorJoint_GetLinearDampingRatio(jointId: b2JointId) -> f32;
3210}
3211unsafe extern "C" {
3212 #[doc = " Set the spring angular hertz stiffness"]
3213 pub fn b2MotorJoint_SetAngularHertz(jointId: b2JointId, hertz: f32);
3214}
3215unsafe extern "C" {
3216 #[doc = " Get the spring angular hertz stiffness"]
3217 pub fn b2MotorJoint_GetAngularHertz(jointId: b2JointId) -> f32;
3218}
3219unsafe extern "C" {
3220 #[doc = " Set the spring angular damping ratio. Use 1.0 for critical damping."]
3221 pub fn b2MotorJoint_SetAngularDampingRatio(jointId: b2JointId, damping: f32);
3222}
3223unsafe extern "C" {
3224 #[doc = " Get the spring angular damping ratio."]
3225 pub fn b2MotorJoint_GetAngularDampingRatio(jointId: b2JointId) -> f32;
3226}
3227unsafe extern "C" {
3228 #[doc = " Set the maximum spring force in newtons."]
3229 pub fn b2MotorJoint_SetMaxSpringForce(jointId: b2JointId, maxForce: f32);
3230}
3231unsafe extern "C" {
3232 #[doc = " Get the maximum spring force in newtons."]
3233 pub fn b2MotorJoint_GetMaxSpringForce(jointId: b2JointId) -> f32;
3234}
3235unsafe extern "C" {
3236 #[doc = " Set the maximum spring torque in newtons * meters"]
3237 pub fn b2MotorJoint_SetMaxSpringTorque(jointId: b2JointId, maxTorque: f32);
3238}
3239unsafe extern "C" {
3240 #[doc = " Get the maximum spring torque in newtons * meters"]
3241 pub fn b2MotorJoint_GetMaxSpringTorque(jointId: b2JointId) -> f32;
3242}
3243unsafe extern "C" {
3244 #[doc = " Create a filter joint.\n @see b2FilterJointDef for details"]
3245 pub fn b2CreateFilterJoint(worldId: b2WorldId, def: *const b2FilterJointDef) -> b2JointId;
3246}
3247unsafe extern "C" {
3248 #[doc = " Create a prismatic (slider) joint.\n @see b2PrismaticJointDef for details"]
3249 pub fn b2CreatePrismaticJoint(worldId: b2WorldId, def: *const b2PrismaticJointDef)
3250 -> b2JointId;
3251}
3252unsafe extern "C" {
3253 #[doc = " Enable/disable the joint spring."]
3254 pub fn b2PrismaticJoint_EnableSpring(jointId: b2JointId, enableSpring: bool);
3255}
3256unsafe extern "C" {
3257 #[doc = " Is the prismatic joint spring enabled or not?"]
3258 pub fn b2PrismaticJoint_IsSpringEnabled(jointId: b2JointId) -> bool;
3259}
3260unsafe extern "C" {
3261 #[doc = " Set the prismatic joint stiffness in Hertz.\n This should usually be less than a quarter of the simulation rate. For example, if the simulation\n runs at 60Hz then the joint stiffness should be 15Hz or less."]
3262 pub fn b2PrismaticJoint_SetSpringHertz(jointId: b2JointId, hertz: f32);
3263}
3264unsafe extern "C" {
3265 #[doc = " Get the prismatic joint stiffness in Hertz"]
3266 pub fn b2PrismaticJoint_GetSpringHertz(jointId: b2JointId) -> f32;
3267}
3268unsafe extern "C" {
3269 #[doc = " Set the prismatic joint damping ratio (non-dimensional)"]
3270 pub fn b2PrismaticJoint_SetSpringDampingRatio(jointId: b2JointId, dampingRatio: f32);
3271}
3272unsafe extern "C" {
3273 #[doc = " Get the prismatic spring damping ratio (non-dimensional)"]
3274 pub fn b2PrismaticJoint_GetSpringDampingRatio(jointId: b2JointId) -> f32;
3275}
3276unsafe extern "C" {
3277 #[doc = " Set the prismatic joint spring target angle, usually in meters"]
3278 pub fn b2PrismaticJoint_SetTargetTranslation(jointId: b2JointId, translation: f32);
3279}
3280unsafe extern "C" {
3281 #[doc = " Get the prismatic joint spring target translation, usually in meters"]
3282 pub fn b2PrismaticJoint_GetTargetTranslation(jointId: b2JointId) -> f32;
3283}
3284unsafe extern "C" {
3285 #[doc = " Enable/disable a prismatic joint limit"]
3286 pub fn b2PrismaticJoint_EnableLimit(jointId: b2JointId, enableLimit: bool);
3287}
3288unsafe extern "C" {
3289 #[doc = " Is the prismatic joint limit enabled?"]
3290 pub fn b2PrismaticJoint_IsLimitEnabled(jointId: b2JointId) -> bool;
3291}
3292unsafe extern "C" {
3293 #[doc = " Get the prismatic joint lower limit"]
3294 pub fn b2PrismaticJoint_GetLowerLimit(jointId: b2JointId) -> f32;
3295}
3296unsafe extern "C" {
3297 #[doc = " Get the prismatic joint upper limit"]
3298 pub fn b2PrismaticJoint_GetUpperLimit(jointId: b2JointId) -> f32;
3299}
3300unsafe extern "C" {
3301 #[doc = " Set the prismatic joint limits"]
3302 pub fn b2PrismaticJoint_SetLimits(jointId: b2JointId, lower: f32, upper: f32);
3303}
3304unsafe extern "C" {
3305 #[doc = " Enable/disable a prismatic joint motor"]
3306 pub fn b2PrismaticJoint_EnableMotor(jointId: b2JointId, enableMotor: bool);
3307}
3308unsafe extern "C" {
3309 #[doc = " Is the prismatic joint motor enabled?"]
3310 pub fn b2PrismaticJoint_IsMotorEnabled(jointId: b2JointId) -> bool;
3311}
3312unsafe extern "C" {
3313 #[doc = " Set the prismatic joint motor speed, usually in meters per second"]
3314 pub fn b2PrismaticJoint_SetMotorSpeed(jointId: b2JointId, motorSpeed: f32);
3315}
3316unsafe extern "C" {
3317 #[doc = " Get the prismatic joint motor speed, usually in meters per second"]
3318 pub fn b2PrismaticJoint_GetMotorSpeed(jointId: b2JointId) -> f32;
3319}
3320unsafe extern "C" {
3321 #[doc = " Set the prismatic joint maximum motor force, usually in newtons"]
3322 pub fn b2PrismaticJoint_SetMaxMotorForce(jointId: b2JointId, force: f32);
3323}
3324unsafe extern "C" {
3325 #[doc = " Get the prismatic joint maximum motor force, usually in newtons"]
3326 pub fn b2PrismaticJoint_GetMaxMotorForce(jointId: b2JointId) -> f32;
3327}
3328unsafe extern "C" {
3329 #[doc = " Get the prismatic joint current motor force, usually in newtons"]
3330 pub fn b2PrismaticJoint_GetMotorForce(jointId: b2JointId) -> f32;
3331}
3332unsafe extern "C" {
3333 #[doc = " Get the current joint translation, usually in meters."]
3334 pub fn b2PrismaticJoint_GetTranslation(jointId: b2JointId) -> f32;
3335}
3336unsafe extern "C" {
3337 #[doc = " Get the current joint translation speed, usually in meters per second."]
3338 pub fn b2PrismaticJoint_GetSpeed(jointId: b2JointId) -> f32;
3339}
3340unsafe extern "C" {
3341 #[doc = " Create a revolute joint\n @see b2RevoluteJointDef for details"]
3342 pub fn b2CreateRevoluteJoint(worldId: b2WorldId, def: *const b2RevoluteJointDef) -> b2JointId;
3343}
3344unsafe extern "C" {
3345 #[doc = " Enable/disable the revolute joint spring"]
3346 pub fn b2RevoluteJoint_EnableSpring(jointId: b2JointId, enableSpring: bool);
3347}
3348unsafe extern "C" {
3349 #[doc = " It the revolute angular spring enabled?"]
3350 pub fn b2RevoluteJoint_IsSpringEnabled(jointId: b2JointId) -> bool;
3351}
3352unsafe extern "C" {
3353 #[doc = " Set the revolute joint spring stiffness in Hertz"]
3354 pub fn b2RevoluteJoint_SetSpringHertz(jointId: b2JointId, hertz: f32);
3355}
3356unsafe extern "C" {
3357 #[doc = " Get the revolute joint spring stiffness in Hertz"]
3358 pub fn b2RevoluteJoint_GetSpringHertz(jointId: b2JointId) -> f32;
3359}
3360unsafe extern "C" {
3361 #[doc = " Set the revolute joint spring damping ratio, non-dimensional"]
3362 pub fn b2RevoluteJoint_SetSpringDampingRatio(jointId: b2JointId, dampingRatio: f32);
3363}
3364unsafe extern "C" {
3365 #[doc = " Get the revolute joint spring damping ratio, non-dimensional"]
3366 pub fn b2RevoluteJoint_GetSpringDampingRatio(jointId: b2JointId) -> f32;
3367}
3368unsafe extern "C" {
3369 #[doc = " Set the revolute joint spring target angle, radians"]
3370 pub fn b2RevoluteJoint_SetTargetAngle(jointId: b2JointId, angle: f32);
3371}
3372unsafe extern "C" {
3373 #[doc = " Get the revolute joint spring target angle, radians"]
3374 pub fn b2RevoluteJoint_GetTargetAngle(jointId: b2JointId) -> f32;
3375}
3376unsafe extern "C" {
3377 #[doc = " Get the revolute joint current angle in radians relative to the reference angle\n @see b2RevoluteJointDef::referenceAngle"]
3378 pub fn b2RevoluteJoint_GetAngle(jointId: b2JointId) -> f32;
3379}
3380unsafe extern "C" {
3381 #[doc = " Enable/disable the revolute joint limit"]
3382 pub fn b2RevoluteJoint_EnableLimit(jointId: b2JointId, enableLimit: bool);
3383}
3384unsafe extern "C" {
3385 #[doc = " Is the revolute joint limit enabled?"]
3386 pub fn b2RevoluteJoint_IsLimitEnabled(jointId: b2JointId) -> bool;
3387}
3388unsafe extern "C" {
3389 #[doc = " Get the revolute joint lower limit in radians"]
3390 pub fn b2RevoluteJoint_GetLowerLimit(jointId: b2JointId) -> f32;
3391}
3392unsafe extern "C" {
3393 #[doc = " Get the revolute joint upper limit in radians"]
3394 pub fn b2RevoluteJoint_GetUpperLimit(jointId: b2JointId) -> f32;
3395}
3396unsafe extern "C" {
3397 #[doc = " Set the revolute joint limits in radians. It is expected that lower <= upper\n and that -0.99 * B2_PI <= lower && upper <= -0.99 * B2_PI."]
3398 pub fn b2RevoluteJoint_SetLimits(jointId: b2JointId, lower: f32, upper: f32);
3399}
3400unsafe extern "C" {
3401 #[doc = " Enable/disable a revolute joint motor"]
3402 pub fn b2RevoluteJoint_EnableMotor(jointId: b2JointId, enableMotor: bool);
3403}
3404unsafe extern "C" {
3405 #[doc = " Is the revolute joint motor enabled?"]
3406 pub fn b2RevoluteJoint_IsMotorEnabled(jointId: b2JointId) -> bool;
3407}
3408unsafe extern "C" {
3409 #[doc = " Set the revolute joint motor speed in radians per second"]
3410 pub fn b2RevoluteJoint_SetMotorSpeed(jointId: b2JointId, motorSpeed: f32);
3411}
3412unsafe extern "C" {
3413 #[doc = " Get the revolute joint motor speed in radians per second"]
3414 pub fn b2RevoluteJoint_GetMotorSpeed(jointId: b2JointId) -> f32;
3415}
3416unsafe extern "C" {
3417 #[doc = " Get the revolute joint current motor torque, usually in newton-meters"]
3418 pub fn b2RevoluteJoint_GetMotorTorque(jointId: b2JointId) -> f32;
3419}
3420unsafe extern "C" {
3421 #[doc = " Set the revolute joint maximum motor torque, usually in newton-meters"]
3422 pub fn b2RevoluteJoint_SetMaxMotorTorque(jointId: b2JointId, torque: f32);
3423}
3424unsafe extern "C" {
3425 #[doc = " Get the revolute joint maximum motor torque, usually in newton-meters"]
3426 pub fn b2RevoluteJoint_GetMaxMotorTorque(jointId: b2JointId) -> f32;
3427}
3428unsafe extern "C" {
3429 #[doc = " Create a weld joint\n @see b2WeldJointDef for details"]
3430 pub fn b2CreateWeldJoint(worldId: b2WorldId, def: *const b2WeldJointDef) -> b2JointId;
3431}
3432unsafe extern "C" {
3433 #[doc = " Set the weld joint linear stiffness in Hertz. 0 is rigid."]
3434 pub fn b2WeldJoint_SetLinearHertz(jointId: b2JointId, hertz: f32);
3435}
3436unsafe extern "C" {
3437 #[doc = " Get the weld joint linear stiffness in Hertz"]
3438 pub fn b2WeldJoint_GetLinearHertz(jointId: b2JointId) -> f32;
3439}
3440unsafe extern "C" {
3441 #[doc = " Set the weld joint linear damping ratio (non-dimensional)"]
3442 pub fn b2WeldJoint_SetLinearDampingRatio(jointId: b2JointId, dampingRatio: f32);
3443}
3444unsafe extern "C" {
3445 #[doc = " Get the weld joint linear damping ratio (non-dimensional)"]
3446 pub fn b2WeldJoint_GetLinearDampingRatio(jointId: b2JointId) -> f32;
3447}
3448unsafe extern "C" {
3449 #[doc = " Set the weld joint angular stiffness in Hertz. 0 is rigid."]
3450 pub fn b2WeldJoint_SetAngularHertz(jointId: b2JointId, hertz: f32);
3451}
3452unsafe extern "C" {
3453 #[doc = " Get the weld joint angular stiffness in Hertz"]
3454 pub fn b2WeldJoint_GetAngularHertz(jointId: b2JointId) -> f32;
3455}
3456unsafe extern "C" {
3457 #[doc = " Set weld joint angular damping ratio, non-dimensional"]
3458 pub fn b2WeldJoint_SetAngularDampingRatio(jointId: b2JointId, dampingRatio: f32);
3459}
3460unsafe extern "C" {
3461 #[doc = " Get the weld joint angular damping ratio, non-dimensional"]
3462 pub fn b2WeldJoint_GetAngularDampingRatio(jointId: b2JointId) -> f32;
3463}
3464unsafe extern "C" {
3465 #[doc = " Create a wheel joint\n @see b2WheelJointDef for details"]
3466 pub fn b2CreateWheelJoint(worldId: b2WorldId, def: *const b2WheelJointDef) -> b2JointId;
3467}
3468unsafe extern "C" {
3469 #[doc = " Enable/disable the wheel joint spring"]
3470 pub fn b2WheelJoint_EnableSpring(jointId: b2JointId, enableSpring: bool);
3471}
3472unsafe extern "C" {
3473 #[doc = " Is the wheel joint spring enabled?"]
3474 pub fn b2WheelJoint_IsSpringEnabled(jointId: b2JointId) -> bool;
3475}
3476unsafe extern "C" {
3477 #[doc = " Set the wheel joint stiffness in Hertz"]
3478 pub fn b2WheelJoint_SetSpringHertz(jointId: b2JointId, hertz: f32);
3479}
3480unsafe extern "C" {
3481 #[doc = " Get the wheel joint stiffness in Hertz"]
3482 pub fn b2WheelJoint_GetSpringHertz(jointId: b2JointId) -> f32;
3483}
3484unsafe extern "C" {
3485 #[doc = " Set the wheel joint damping ratio, non-dimensional"]
3486 pub fn b2WheelJoint_SetSpringDampingRatio(jointId: b2JointId, dampingRatio: f32);
3487}
3488unsafe extern "C" {
3489 #[doc = " Get the wheel joint damping ratio, non-dimensional"]
3490 pub fn b2WheelJoint_GetSpringDampingRatio(jointId: b2JointId) -> f32;
3491}
3492unsafe extern "C" {
3493 #[doc = " Enable/disable the wheel joint limit"]
3494 pub fn b2WheelJoint_EnableLimit(jointId: b2JointId, enableLimit: bool);
3495}
3496unsafe extern "C" {
3497 #[doc = " Is the wheel joint limit enabled?"]
3498 pub fn b2WheelJoint_IsLimitEnabled(jointId: b2JointId) -> bool;
3499}
3500unsafe extern "C" {
3501 #[doc = " Get the wheel joint lower limit"]
3502 pub fn b2WheelJoint_GetLowerLimit(jointId: b2JointId) -> f32;
3503}
3504unsafe extern "C" {
3505 #[doc = " Get the wheel joint upper limit"]
3506 pub fn b2WheelJoint_GetUpperLimit(jointId: b2JointId) -> f32;
3507}
3508unsafe extern "C" {
3509 #[doc = " Set the wheel joint limits"]
3510 pub fn b2WheelJoint_SetLimits(jointId: b2JointId, lower: f32, upper: f32);
3511}
3512unsafe extern "C" {
3513 #[doc = " Enable/disable the wheel joint motor"]
3514 pub fn b2WheelJoint_EnableMotor(jointId: b2JointId, enableMotor: bool);
3515}
3516unsafe extern "C" {
3517 #[doc = " Is the wheel joint motor enabled?"]
3518 pub fn b2WheelJoint_IsMotorEnabled(jointId: b2JointId) -> bool;
3519}
3520unsafe extern "C" {
3521 #[doc = " Set the wheel joint motor speed in radians per second"]
3522 pub fn b2WheelJoint_SetMotorSpeed(jointId: b2JointId, motorSpeed: f32);
3523}
3524unsafe extern "C" {
3525 #[doc = " Get the wheel joint motor speed in radians per second"]
3526 pub fn b2WheelJoint_GetMotorSpeed(jointId: b2JointId) -> f32;
3527}
3528unsafe extern "C" {
3529 #[doc = " Set the wheel joint maximum motor torque, usually in newton-meters"]
3530 pub fn b2WheelJoint_SetMaxMotorTorque(jointId: b2JointId, torque: f32);
3531}
3532unsafe extern "C" {
3533 #[doc = " Get the wheel joint maximum motor torque, usually in newton-meters"]
3534 pub fn b2WheelJoint_GetMaxMotorTorque(jointId: b2JointId) -> f32;
3535}
3536unsafe extern "C" {
3537 #[doc = " Get the wheel joint current motor torque, usually in newton-meters"]
3538 pub fn b2WheelJoint_GetMotorTorque(jointId: b2JointId) -> f32;
3539}
3540unsafe extern "C" {
3541 #[doc = " Contact identifier validation. Provides validation for up to 2^32 allocations."]
3542 pub fn b2Contact_IsValid(id: b2ContactId) -> bool;
3543}
3544unsafe extern "C" {
3545 #[doc = " Get the data for a contact. The manifold may have no points if the contact is not touching."]
3546 pub fn b2Contact_GetData(contactId: b2ContactId) -> b2ContactData;
3547}
3548#[doc = " The tree nodes"]
3549#[repr(C)]
3550#[derive(Debug, Copy, Clone)]
3551pub struct b2TreeNode {
3552 pub _address: u8,
3553}