projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update vg
[carveJwlIkooP6JGAAIwe30JlM.git]
/
player_common.c
diff --git
a/player_common.c
b/player_common.c
index 432fbaec639b39ab6025b6523997213488def673..21d52aa76871c6f978d10f3bda4334ae614e5671 100644
(file)
--- a/
player_common.c
+++ b/
player_common.c
@@
-4,6
+4,10
@@
#include "player.h"
#include "conf.h"
#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] ),
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
{
float yaw = atan2f( v[0], -v[2] ),
@@
-18,6
+22,7
@@
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
angles[0] = yaw;
angles[1] = pitch;
angles[0] = yaw;
angles[1] = pitch;
+ angles[2] = 0.0f;
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
@@
-84,17
+89,17
@@
VG_STATIC void player__cam_iterate( player_instance *player )
player->cam_velocity_influence_smooth = vg_lerpf(
player->cam_velocity_influence_smooth,
player->cam_velocity_influence,
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,
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,
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;
enum camera_mode target_mode = player->camera_mode;
@@
-104,16
+109,16
@@
VG_STATIC void player__cam_iterate( player_instance *player )
player->camera_type_blend =
vg_lerpf( player->camera_type_blend,
(target_mode == k_cam_firstperson)? 1.0f: 0.0f,
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,
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,
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,
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 ),
/* fov -- simple blend */
float fov_skate = vg_lerpf( 97.0f, 135.0f, cl_fov ),
@@
-134,7
+139,7
@@
VG_STATIC void player__cam_iterate( player_instance *player )
/* angles */
v3f velocity_angles;
/* 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;
player->cam_velocity_smooth );
v3f velocity_local;
@@
-162,7
+167,7
@@
VG_STATIC void player__cam_iterate( player_instance *player )
* it is done in the local basis then transformed back */
v3f future;
* 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 =
m3x3_mulv( player->invbasis, future, future );
v3f camera_follow_dir =
@@
-188,7
+193,7
@@
VG_STATIC void player__cam_iterate( player_instance *player )
v3f pco;
v4f pq;
rb_extrapolate( &player->rb, pco, pq );
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 */
/* now move into world */
@@
-208,8
+213,8
@@
VG_STATIC void player__cam_iterate( player_instance *player )
float Fd = -player->cam_land_punch_v * k_cam_damp,
Fs = -player->cam_land_punch * k_cam_spring;
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.angles[1] += player->cam_land_punch;
/* override camera */