projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
f
[carveJwlIkooP6JGAAIwe30JlM.git]
/
physics_test.h
diff --git
a/physics_test.h
b/physics_test.h
index 8187b914ab39c5ddf5e19c6fed7a28b33212b946..bd8bc073acaf68a392495b40ceac7765a12aa173 100644
(file)
--- a/
physics_test.h
+++ b/
physics_test.h
@@
-9,6
+9,16
@@
rigidbody ground = { .type = k_rb_shape_box,
.co = {0.0f, 0.0f, 0.0f},
.q = {0.0f,0.0f,0.0f,1.0f},
.is_world = 1 };
.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 funnel[4] = {
{
.type = k_rb_shape_box,
rigidbody funnel[4] = {
{
.type = k_rb_shape_box,
@@
-36,6
+46,11
@@
rigidbody funnel[4] = {
}
};
}
};
+rigidbody jeff1 = { .type = k_rb_shape_capsule,
+ .inf.capsule = { .radius = 0.75f, .height = 3.0f },
+ .co = {30.0f, 4.0f, 30.0f },
+ .q = {0.0f,0.0f,0.0f,1.0f}
+};
rigidbody ball = { .type = k_rb_shape_sphere,
.inf.sphere = { .radius = 2.0f },
rigidbody ball = { .type = k_rb_shape_sphere,
.inf.sphere = { .radius = 2.0f },
@@
-60,6
+75,8
@@
static void physics_test_start(void)
rb_init( &ground );
rb_init( &ball );
rb_init( &ball1 );
rb_init( &ground );
rb_init( &ball );
rb_init( &ball1 );
+ rb_init( &jeff1 );
+ rb_init( &blocky );
}
static void physics_test_update(void)
}
static void physics_test_update(void)
@@
-71,6
+88,7
@@
static void physics_test_update(void)
rb_iter( &ball );
rb_iter( &ball1 );
rb_iter( &ball );
rb_iter( &ball1 );
+ rb_iter( &jeff1 );
rb_solver_reset();
rb_solver_reset();
@@
-84,21
+102,25
@@
static void physics_test_update(void)
rb_contact_count += rb_sphere_vs_box( &ball1, &ground, rb_global_ct() );
rb_contact_count += rb_sphere_vs_sphere( &ball, &ball1, rb_global_ct() );
rb_contact_count += rb_sphere_vs_box( &ball1, &ground, rb_global_ct() );
rb_contact_count += rb_sphere_vs_sphere( &ball, &ball1, rb_global_ct() );
- rb_presolve_contacts();
+ rb_contact_count += rb_capsule_vs_box( &jeff1, &ground, rb_global_ct() );
+ rb_contact_count += rb_capsule_vs_box( &jeff1, &blocky, rb_global_ct() );
+
+ rb_presolve_contacts( rb_contact_buffer, rb_contact_count );
for( int i=0; i<5; i++ )
for( int i=0; i<5; i++ )
- rb_solve_contacts();
+ rb_solve_contacts(
rb_contact_buffer, rb_contact_count
);
rb_update_transform( &ball );
rb_update_transform( &ball1 );
rb_update_transform( &ball );
rb_update_transform( &ball1 );
+ rb_update_transform( &jeff1 );
}
if(glfwGetKey( vg_window, GLFW_KEY_L ))
{
}
if(glfwGetKey( vg_window, GLFW_KEY_L ))
{
- v3_copy( player.camera_pos,
ball
.co );
- v3_zero(
ball
.v );
- v3_zero(
ball
.w );
+ v3_copy( player.camera_pos,
jeff1
.co );
+ v3_zero(
jeff1
.v );
+ v3_zero(
jeff1
.w );
}
for( int i=0; i<4; i++ )
}
for( int i=0; i<4; i++ )
@@
-106,6
+128,9
@@
static void physics_test_update(void)
rb_debug( &ground, 0xff00ff00 );
rb_debug( &ball, 0xffe00040 );
rb_debug( &ball1, 0xff00e050 );
rb_debug( &ground, 0xff00ff00 );
rb_debug( &ball, 0xffe00040 );
rb_debug( &ball1, 0xff00e050 );
+
+ rb_debug( &blocky, 0xffcccccc );
+ rb_debug( &jeff1, 0xff00ffff );
}
static void physics_test_render(void)
}
static void physics_test_render(void)
@@
-113,7
+138,7
@@
static void physics_test_render(void)
m4x4f world_4x4;
m4x3_expand( player.camera_inverse, world_4x4 );
m4x4f world_4x4;
m4x3_expand( player.camera_inverse, world_4x4 );
- gpipeline.fov =
freecam? 60.0f: 135.0f; /* 120 */
+ gpipeline.fov =
60.0f;
m4x4_projection( vg_pv, gpipeline.fov,
(float)vg_window_x / (float)vg_window_y,
0.1f, 2100.0f );
m4x4_projection( vg_pv, gpipeline.fov,
(float)vg_window_x / (float)vg_window_y,
0.1f, 2100.0f );