X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=camera.h;h=6fcd2fc161e24b42be6701e73971fb8642fb5e9e;hb=a99e5f5d5c16a3e865796a96ad648e3c570d32ac;hp=dbacc26afd7d89f47308781caeef7767ae0f03e4;hpb=ff8fcac9582d07bc1ccbf08421d6ffec1758a755;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/camera.h b/camera.h index dbacc26..6fcd2fc 100644 --- a/camera.h +++ b/camera.h @@ -25,7 +25,14 @@ struct camera mtx, mtx_prev; } -VG_STATIC main_camera; +VG_STATIC main_camera, gate_camera; + +VG_STATIC void camera_lerp_angles( v3f a, v3f b, float t, v3f d ) +{ + d[0] = vg_alerpf( a[0], b[0], t ); + d[1] = vg_lerpf( a[1], b[1], t ); + d[2] = vg_lerpf( a[2], b[2], t ); +} VG_STATIC void camera_lerp( camera *a, camera *b, float t, camera *d ) { @@ -42,7 +49,7 @@ VG_STATIC void camera_lerp( camera *a, camera *b, float t, camera *d ) VG_STATIC void camera_update_transform( camera *cam ) { v4f qyaw, qpitch, qcam; - q_axis_angle( qyaw, (v3f){ 0.0f, 1.0f, 0.0f }, -cam->angles[0] ); + q_axis_angle( qyaw, (v3f){ 0.0f, 1.0f, 0.0f }, -cam->angles[0] ); q_axis_angle( qpitch, (v3f){ 1.0f, 0.0f, 0.0f }, -cam->angles[1] ); q_mul( qyaw, qpitch, qcam );