X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=physics_test.h;h=243de364933859c3d08881c5584fcf9295cfba08;hb=HEAD;hp=33a6b6b7f8c56b70a75470da8e96ea55b3d9eb90;hpb=d57b7661518800479c00300ce57407378696eec9;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/physics_test.h b/physics_test.h deleted file mode 100644 index 33a6b6b..0000000 --- a/physics_test.h +++ /dev/null @@ -1,286 +0,0 @@ -#ifndef PHYSICS_TEST_H -#define PHYSICS_TEST_H - -#include "rigidbody.h" -#include "player.h" - -rigidbody ground = { .type = k_rb_shape_box, - .bbx = {{-100.0f,-1.0f,-100.0f},{100.0f,0.0f,100.0f}}, - .co = {0.0f, 0.0f, 0.0f}, - .q = {0.0f,0.0f,0.0f,1.0f}, - .is_world = 1 }; - -rigidbody blocky = - { - .type = k_rb_shape_box, - .bbx = {{-2.0f,-1.0f,-3.0f},{2.0f,1.0f,2.0f}}, - .co = {30.0f,2.0f,30.0f}, - .q = {0.0f,0.0f,0.0f,1.0f}, - .is_world = 1 - }; - -rigidbody marko = -{ - .type = k_rb_shape_box, - .bbx = {{-0.5f,-0.5f,-0.5f},{0.5f,0.5f,0.5f}}, - .co = {-36.0f,8.0f,-36.0f}, - .q = {0.0f,0.0f,0.0f,1.0f}, - .is_world = 0 -}; - -scene epic_scene; - -rigidbody epic_scene_rb = -{ - .type = k_rb_shape_scene, - .co = {0.0f,0.0f,0.0f}, - .q = {0.0f,0.0f,0.0f,1.0f}, - .is_world = 1, - .inf.scene = { .pscene = &epic_scene } -}; - -rigidbody funnel[4] = { - { - .type = k_rb_shape_box, - .bbx = {{-20.0f,-1.0f,-20.0f},{20.0f,1.0f,20.0f}}, - .co = {-10.0f,5.0f,0.0f}, - .is_world = 1 - }, - { - .type = k_rb_shape_box, - .bbx = {{-20.0f,-1.0f,-20.0f},{20.0f,1.0f,20.0f}}, - .co = { 10.0f,5.0f,0.0f}, - .is_world = 1 - }, - { - .type = k_rb_shape_box, - .bbx = {{-20.0f,-1.0f,-20.0f},{20.0f,1.0f,20.0f}}, - .co = { 0.0f,5.0f,10.0f}, - .is_world = 1 - }, - { - .type = k_rb_shape_box, - .bbx = {{-20.0f,-1.0f,-20.0f},{20.0f,1.0f,20.0f}}, - .co = {0.0f,5.0f,-10.0f}, - .is_world = 1 - } -}; - -rigidbody jeff1 = { .type = k_rb_shape_capsule, - .inf.capsule = { .radius = 0.75f, .height = 3.0f }, - .co = {30.0f, 4.0f, 30.0f }, - .q = {1.0f,0.0f,0.0f,0.0f} -}; - -rigidbody ball = { .type = k_rb_shape_sphere, - .inf.sphere = { .radius = 2.0f }, - .co = {0.0f,20.0f,2.0f}, - .q = {0.0f,0.0f,0.0f,1.0f}}, - - ball1= { .type = k_rb_shape_sphere, - .inf.sphere = { .radius = 2.0f }, - .co = {0.1f,25.0f,0.2f}, - .q = {0.0f,0.0f,0.0f,1.0f}}; - -rigidbody jeffs[16]; - -static void reorg_jeffs(void) -{ - for( int i=0; inode_count; i++ ) - { - mdl_node *pnode = mdl_node_from_id( mdl, i ); - - for( int j=0; jsubmesh_count; j++ ) - { - mdl_submesh *sm = mdl_node_submesh( mdl, pnode, j ); - scene_add_submesh( &epic_scene, mdl, sm, transform ); - } - } - - free( mdl ); - scene_bh_create( &epic_scene ); - - rb_init( &epic_scene_rb ); - rb_init( &marko ); -} - -static void physics_test_update(void) -{ - player_freecam(); - player_camera_update(); - - for( int i=0; i<4; i++ ) - rb_debug( &funnel[i], 0xff0060e0 ); - rb_debug( &ground, 0xff00ff00 ); - rb_debug( &ball, 0xffe00040 ); - rb_debug( &ball1, 0xff00e050 ); - - rb_debug( &blocky, 0xffcccccc ); - rb_debug( &jeff1, 0xff00ffff ); - - rb_debug( &epic_scene_rb, 0xffcccccc ); - rb_debug( &marko, 0xffffcc00 ); - - { - - rb_solver_reset(); - - for( int i=0; i<4; i++ ) - { - rigidbody *fn = &funnel[i]; - rb_collide( &ball, fn ); - rb_collide( &ball1, fn ); - rb_collide( &jeff1, fn ); - - for( int i=0; i