seperation of body initialization, glider model
[carveJwlIkooP6JGAAIwe30JlM.git] / testing.c
index b5b4cecd9c9f19937e42632682011667c23c4155..ad98cce5e3c051f73972dd59254dd6abd2e9aa6d 100644 (file)
--- a/testing.c
+++ b/testing.c
@@ -1,10 +1,13 @@
 #include "rigidbody.h"
 
-static rb_object baller = {
-   .type = k_rb_shape_box,
-   .rb.bbx = {{ -0.1f, -0.2f, -0.1f },
-              {  0.1f,  1.0f,  0.1f }},
+struct {
+   rigidbody rb;
+   boxf box;
+}
+static baller = { 
    .rb.q = { 0,0,0,1 },
+   .box = {{ -0.1f, -0.2f, -0.1f },
+           {  0.1f,  1.0f,  0.1f }},
 };
 
 static void testing_update(void){
@@ -13,20 +16,24 @@ static void testing_update(void){
       v3_zero( baller.rb.w );
       v3_zero( baller.rb.v );
       q_identity( baller.rb.q );
-      rb_update_transform( &baller.rb );
+      rb_update_matrices( &baller.rb );
    }
-   rb_object_debug( &baller, VG__RED );
+   vg_line_boxf_transformed( baller.rb.to_world, baller.box, VG__RED );
 
    world_instance *world = world_current_instance();
 
+   rigidbody _null = {0};
+   _null.inv_mass = 0.0f;
+   m3x3_zero( _null.iI );
+
    rb_solver_reset();
    rb_ct *buf = rb_global_buffer();
-   rb_contact_count += rb_box__scene( baller.rb.to_world, baller.rb.bbx,
-                          NULL, &world->rb_geo.inf.scene, buf,
+   rb_contact_count += rb_box__scene( baller.rb.to_world, baller.box,
+                          NULL, world->geo_bh, buf,
                           k_material_flag_ghosts );
    for( u32 j=0; j<rb_contact_count; j++ ){
       buf[j].rba = &baller.rb;
-      buf[j].rbb = &world->rb_geo.rb;
+      buf[j].rbb = &_null;
    }
 
    rb_presolve_contacts( rb_contact_buffer, rb_contact_count );
@@ -35,9 +42,9 @@ static void testing_update(void){
       rb_solve_contacts( rb_contact_buffer, rb_contact_count );
 
    rb_iter( &baller.rb );
-   rb_update_transform( &baller.rb );
+   rb_update_matrices( &baller.rb );
 }
 
 static void testing_init(void){
-   rb_init_object( &baller, 1.0f );
+   rb_setbody_box( &baller.rb, baller.box, 8.0f, 1.0f );
 }