typedef struct rb_constr_pos rb_constr_pos;
typedef struct rb_constr_swingtwist rb_constr_swingtwist;
typedef struct rb_constr_pos rb_constr_pos;
typedef struct rb_constr_swingtwist rb_constr_swingtwist;
v3f p1;
v3_muladds( ct->co, ct->n, 0.05f, p1 );
v3f p1;
v3_muladds( ct->co, ct->n, 0.05f, p1 );
if( obj->type == k_rb_shape_box ){
v3f *box = obj->rb.bbx;
vg_line_boxf_transformed( obj->rb.to_world, obj->rb.bbx, colour );
if( obj->type == k_rb_shape_box ){
v3f *box = obj->rb.bbx;
vg_line_boxf_transformed( obj->rb.to_world, obj->rb.bbx, colour );
box_init_inf( rb->bbx_world );
m4x3_expand_aabb_aabb( rb->to_world, rb->bbx_world, rb->bbx );
}
box_init_inf( rb->bbx_world );
m4x3_expand_aabb_aabb( rb->to_world, rb->bbx_world, rb->bbx );
}
{
float substep = vg.time_fixed_extrapolate;
v3_muladds( rb->co, rb->v, k_rb_delta*substep, co );
{
float substep = vg.time_fixed_extrapolate;
v3_muladds( rb->co, rb->v, k_rb_delta*substep, co );
if( v3_dist2( ci->co, cj->co ) < r*r ){
cj->type = k_contact_type_disabled;
ci->p = (ci->p + cj->p) * 0.5f;
if( v3_dist2( ci->co, cj->co ) < r*r ){
cj->type = k_contact_type_disabled;
ci->p = (ci->p + cj->p) * 0.5f;
* Expand a line manifold with a new pair. t value is the time along segment
* on the oriented object which created this pair.
*/
* Expand a line manifold with a new pair. t value is the time along segment
* on the oriented object which created this pair.
*/
-VG_STATIC void rb_capsule_manifold( v3f pa, v3f pb, float t, float r,
+static void rb_capsule_manifold( v3f pa, v3f pb, float t, float r,
rigidbody *rba = &obja->rb, *rbb = &objb->rb;
float h = obja->inf.capsule.height,
ra = obja->inf.capsule.radius,
rigidbody *rba = &obja->rb, *rbb = &objb->rb;
float h = obja->inf.capsule.height,
ra = obja->inf.capsule.radius,
return rb_capsule__manifold_done( mtxA, ca, &manifold, buf );
}
return rb_capsule__manifold_done( mtxA, ca, &manifold, buf );
}
rigidbody *rba = &obja->rb, *rbb = &objb->rb;
v3f delta;
v3_sub( rba->co, rbb->co, delta );
rigidbody *rba = &obja->rb, *rbb = &objb->rb;
v3f delta;
v3_sub( rba->co, rbb->co, delta );
v3f tri[3], rb_ct *buf ){
v3f delta, co;
enum contact_type type = closest_on_triangle_1( mtxA[3], tri, co );
v3f tri[3], rb_ct *buf ){
v3f delta, co;
enum contact_type type = closest_on_triangle_1( mtxA[3], tri, co );
-VG_STATIC int rb_sphere__scene( m4x3f mtxA, rb_sphere *b,
- m4x3f mtxB, rb_scene *s, rb_ct *buf ){
+static int rb_sphere__scene( m4x3f mtxA, rb_sphere *b,
+ m4x3f mtxB, rb_scene *s, rb_ct *buf,
+ u16 ignore ){
-VG_STATIC int rb_box__scene( m4x3f mtxA, boxf bbx,
- m4x3f mtxB, rb_scene *s, rb_ct *buf ){
+static int rb_box__scene( m4x3f mtxA, boxf bbx,
+ m4x3f mtxB, rb_scene *s, rb_ct *buf, u16 ignore ){
while( bh_next( s->bh_scene, &it, &idx ) ){
u32 *ptri = &sc->arrindices[ idx*3 ];
while( bh_next( s->bh_scene, &it, &idx ) ){
u32 *ptri = &sc->arrindices[ idx*3 ];
v3f tri[3], rb_ct *buf ){
v3f pc, p0w, p1w;
v3_muladds( mtxA[3], mtxA[1], -c->height*0.5f+c->radius, p0w );
v3f tri[3], rb_ct *buf ){
v3f pc, p0w, p1w;
v3_muladds( mtxA[3], mtxA[1], -c->height*0.5f+c->radius, p0w );
i32 idx;
while( bh_next( s->bh_scene, &it, &idx ) ){
u32 *ptri = &sc->arrindices[ idx*3 ];
i32 idx;
while( bh_next( s->bh_scene, &it, &idx ) ){
u32 *ptri = &sc->arrindices[ idx*3 ];
ct->bias = -0.2f * (timestep*3600.0f)
* vg_minf( 0.0f, -ct->p+k_penetration_slop );
ct->bias = -0.2f * (timestep*3600.0f)
* vg_minf( 0.0f, -ct->p+k_penetration_slop );
for( int i=0; i<len; i++ ){
rb_ct *ct = &buffer[i];
rb_prepare_contact( ct, k_rb_delta );
for( int i=0; i<len; i++ ){
rb_ct *ct = &buffer[i];
rb_prepare_contact( ct, k_rb_delta );
-VG_STATIC void rb_rcv( rigidbody *rba, rigidbody *rbb, v3f ra, v3f rb, v3f rv ){
+static void rb_rcv( rigidbody *rba, rigidbody *rbb, v3f ra, v3f rb, v3f rv ){
v3f rva, rvb;
v3_cross( rba->w, ra, rva );
v3_add( rba->v, rva, rva );
v3f rva, rvb;
v3_cross( rba->w, ra, rva );
v3_add( rba->v, rva, rva );
v3f rv, ra, rb;
v3_sub( ct->co, ct->rba->co, ra );
v3_sub( ct->co, ct->rbb->co, rb );
v3f rv, ra, rb;
v3_sub( ct->co, ct->rba->co, ra );
v3_sub( ct->co, ct->rbb->co, rb );
/* linear */
v3_muladds( rb->v, impulse, rb->inv_mass, rb->v );
/* linear */
v3_muladds( rb->v, impulse, rb->inv_mass, rb->v );
for( int i=0; i<len; i++ ){
rb_constr_pos *constr = &buffer[i];
rigidbody *rba = constr->rba, *rbb = constr->rbb;
for( int i=0; i<len; i++ ){
rb_constr_pos *constr = &buffer[i];
rigidbody *rba = constr->rba, *rbb = constr->rbb;
for( int i=0; i<len; i++ ){
rb_constr_pos *constr = &buf[i];
rigidbody *rba = constr->rba, *rbb = constr->rbb;
for( int i=0; i<len; i++ ){
rb_constr_pos *constr = &buf[i];
rigidbody *rba = constr->rba, *rbb = constr->rbb;
v3f ra, v3f rb ){
m3x3f ssra, ssrb, ssrat, ssrbt;
m3x3f cma, cmb;
v3f ra, v3f rb ){
m3x3f ssra, ssrb, ssrat, ssrbt;
m3x3f cma, cmb;
for( int i=0; i<len; i++ ){
rb_ct *ct = &buf[i];
rigidbody *rba = ct->rba,
for( int i=0; i<len; i++ ){
rb_ct *ct = &buf[i];
rigidbody *rba = ct->rba,
-VG_STATIC void rb_effect_spring_target_vector( rigidbody *rba, v3f ra, v3f rt,
+static void rb_effect_spring_target_vector( rigidbody *rba, v3f ra, v3f rt,
float spring, float dampening,
float timestep ){
float d = v3_dot( rt, ra );
float spring, float dampening,
float timestep ){
float d = v3_dot( rt, ra );