#include "player.h"
#include "conf.h"
+VG_STATIC float
+ k_cam_spring = 20.0f,
+ k_cam_damp = 6.7f;
+
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
{
float yaw = atan2f( v[0], -v[2] ),
angles[0] = yaw;
angles[1] = pitch;
+ angles[2] = 0.0f;
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
player->cam_velocity_influence_smooth = vg_lerpf(
player->cam_velocity_influence_smooth,
player->cam_velocity_influence,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
player->cam_velocity_coefficient_smooth = vg_lerpf(
player->cam_velocity_coefficient_smooth,
player->cam_velocity_coefficient,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
player->cam_velocity_constant_smooth = vg_lerpf(
player->cam_velocity_constant_smooth,
player->cam_velocity_constant,
- vg.frame_delta * 8.0f );
+ vg.time_frame_delta * 8.0f );
enum camera_mode target_mode = player->camera_mode;
player->camera_type_blend =
vg_lerpf( player->camera_type_blend,
(target_mode == k_cam_firstperson)? 1.0f: 0.0f,
- 5.0f * vg.frame_delta );
+ 5.0f * vg.time_frame_delta );
v3_lerp( player->fpv_viewpoint_smooth, player->fpv_viewpoint,
- vg.frame_delta * 8.0f, player->fpv_viewpoint_smooth );
+ vg.time_frame_delta * 8.0f, player->fpv_viewpoint_smooth );
v3_lerp( player->fpv_offset_smooth, player->fpv_offset,
- vg.frame_delta * 8.0f, player->fpv_offset_smooth );
+ vg.time_frame_delta * 8.0f, player->fpv_offset_smooth );
v3_lerp( player->tpv_offset_smooth, player->tpv_offset,
- vg.frame_delta * 8.0f, player->tpv_offset_smooth );
+ vg.time_frame_delta * 8.0f, player->tpv_offset_smooth );
/* fov -- simple blend */
float fov_skate = vg_lerpf( 97.0f, 135.0f, cl_fov ),
/* angles */
v3f velocity_angles;
- v3_lerp( player->cam_velocity_smooth, player->rb.v, 4.0f*vg.frame_delta,
+ v3_lerp( player->cam_velocity_smooth, player->rb.v, 4.0f*vg.time_frame_delta,
player->cam_velocity_smooth );
v3f velocity_local;
* it is done in the local basis then transformed back */
v3f future;
- v3_muls( player->rb.v, 0.4f*vg.frame_delta, future );
+ v3_muls( player->rb.v, 0.4f*vg.time_frame_delta, future );
m3x3_mulv( player->invbasis, future, future );
v3f camera_follow_dir =
v3f pco;
v4f pq;
rb_extrapolate( &player->rb, pco, pq );
- v3_lerp( player->tpv_lpf, pco, 20.0f*vg.frame_delta, player->tpv_lpf );
+ v3_lerp( player->tpv_lpf, pco, 20.0f*vg.time_frame_delta, player->tpv_lpf );
/* now move into world */
float Fd = -player->cam_land_punch_v * k_cam_damp,
Fs = -player->cam_land_punch * k_cam_spring;
- player->cam_land_punch += player->cam_land_punch_v * vg.frame_delta;
- player->cam_land_punch_v += ( Fd + Fs ) * vg.frame_delta;
+ player->cam_land_punch += player->cam_land_punch_v * vg.time_frame_delta;
+ player->cam_land_punch_v += ( Fd + Fs ) * vg.time_frame_delta;
player->cam.angles[1] += player->cam_land_punch;
/* override camera */
player->cam_override_strength );
v3_lerp( player->cam.pos, player->cam_override_pos,
player->cam_override_strength, player->cam.pos );
+ player->cam.fov = vg_lerpf( player->cam.fov, player->cam_override_fov,
+ player->cam_override_strength );
/* portal transitions */
player_camera_portal_correction( player );