X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=physics_test.h;h=243de364933859c3d08881c5584fcf9295cfba08;hb=be5e25dee2c54c2a22ca3bbb5bbe0eb6149343be;hp=d3b9f0640b97f035acfa5253e4660afe9bcb2c63;hpb=be0f28b651e5c39943e476c0cd68c146e9952857;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/physics_test.h b/physics_test.h index d3b9f06..243de36 100644 --- a/physics_test.h +++ b/physics_test.h @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved + */ + #ifndef PHYSICS_TEST_H #define PHYSICS_TEST_H @@ -19,6 +23,26 @@ rigidbody blocky = .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, @@ -100,6 +124,30 @@ static void physics_test_start(void) rb_init( &ball1 ); rb_init( &jeff1 ); rb_init( &blocky ); + + scene_init( &epic_scene ); + + mdl_header *mdl = mdl_load( "models/epic_scene.mdl" ); + + m4x3f transform; + m4x3_identity( transform ); + + 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 ); + } + } + + vg_free( mdl ); + scene_bh_create( &epic_scene ); + + rb_init( &epic_scene_rb ); + rb_init( &marko ); } static void physics_test_update(void) @@ -107,7 +155,6 @@ 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 ); @@ -117,20 +164,11 @@ static void physics_test_update(void) rb_debug( &blocky, 0xffcccccc ); rb_debug( &jeff1, 0xff00ffff ); - for( int i=0; i