3 #include "vg_rigidbody.h"
5 /* TODO: Get rid of this! */
6 #define VG_MAX_CONTACTS 256
8 typedef struct rb_ct rb_ct
;
14 float p
, bias
, norm_impulse
, tangent_impulse
[2],
15 normal_mass
, tangent_mass
[2];
19 enum contact_type type
;
21 extern rb_contact_buffer
[VG_MAX_CONTACTS
];
22 extern int rb_contact_count
;
24 int rb_capsule__sphere( m4x3f mtxA
, rb_capsule
*ca
,
25 v3f coB
, f32 rb
, rb_ct
*buf
);
26 int rb_capsule__capsule( m4x3f mtxA
, rb_capsule
*ca
,
27 m4x3f mtxB
, rb_capsule
*cb
, rb_ct
*buf
);
28 int rb_capsule__box( m4x3f mtxA
, rb_capsule
*ca
,
29 m4x3f mtxB
, m4x3f mtxB_inverse
, boxf box
,
31 int rb_sphere__box( v3f coA
, f32 ra
,
32 m4x3f mtxB
, m4x3f mtxB_inverse
, boxf box
,
34 int rb_sphere__sphere( v3f coA
, f32 ra
, v3f coB
, f32 rb
, rb_ct
*buf
);
35 int rb_sphere__triangle( m4x3f mtxA
, f32 r
, v3f tri
[3], rb_ct
*buf
);
36 int rb_capsule__triangle( m4x3f mtxA
, rb_capsule
*c
, v3f tri
[3], rb_ct
*buf
);
37 int rb_global_has_space( void );
38 rb_ct
*rb_global_buffer( void );
39 int rb_manifold_apply_filtered( rb_ct
*man
, int len
);
41 int rb_box_triangle_sat( v3f extent
, v3f center
,
42 m4x3f to_local
, v3f tri_src
[3] );
45 * Merge two contacts if they are within radius(r) of eachother
47 void rb_manifold_contact_weld( rb_ct
*ci
, rb_ct
*cj
, float r
);
48 void rb_manifold_filter_joint_edges( rb_ct
*man
, int len
, float r
);
51 * Resolve overlapping pairs
53 void rb_manifold_filter_pairs( rb_ct
*man
, int len
, float r
);
56 * Remove contacts that are facing away from A
58 void rb_manifold_filter_backface( rb_ct
*man
, int len
);
61 * Filter out duplicate coplanar results. Good for spheres.
63 void rb_manifold_filter_coplanar( rb_ct
*man
, int len
, float w
);
65 void rb_debug_contact( rb_ct
*ct
);
66 void rb_solver_reset(void);
67 rb_ct
*rb_global_ct(void);
68 void rb_prepare_contact( rb_ct
*ct
, f32 dt
);
69 void rb_depenetrate( rb_ct
*manifold
, int len
, v3f dt
);
70 void rb_presolve_contacts( rb_ct
*buffer
, f32 dt
, int len
);
71 void rb_contact_restitution( rb_ct
*ct
, float cr
);
72 void rb_solve_contacts( rb_ct
*buf
, int len
);