clean up blurring code. remove dead code
[carveJwlIkooP6JGAAIwe30JlM.git] / freecam.c
1 #include "skaterift.h"
2 #include "player.h"
3 #include "player_render.h"
4 #include "player_replay.h"
5 #include "input.h"
6
7 void freecam_preupdate(void)
8 {
9 vg_camera *cam = &player_replay.replay_freecam;
10 v3f angles;
11 v3_copy( cam->angles, angles );
12 player_look( angles, 1.0f );
13
14 f32 decay = vg_maxf(0.0f,1.0f-vg.time_frame_delta*10.0f);
15
16 v3f d;
17 v3_sub( angles, cam->angles, d );
18 v3_muladds( player_replay.freecam_w, d, 20.0f, player_replay.freecam_w );
19 v3_muls( player_replay.freecam_w, decay, player_replay.freecam_w );
20 v3_muladds( cam->angles, player_replay.freecam_w, vg.time_frame_delta,
21 cam->angles );
22 cam->angles[1] = vg_clampf( cam->angles[1], -VG_PIf*0.5f,VG_PIf*0.5f);
23
24 vg_camera_update_transform( cam );
25
26 v3f lookdir = { 0.0f, 0.0f, -1.0f },
27 sidedir = { 1.0f, 0.0f, 0.0f };
28
29 m3x3_mulv( cam->transform, lookdir, lookdir );
30 m3x3_mulv( cam->transform, sidedir, sidedir );
31
32 v2f input;
33 joystick_state( k_srjoystick_steer, input );
34 v2_muls( input, vg.time_frame_delta*6.0f*20.0f, input );
35
36 v3_muladds( player_replay.freecam_v, lookdir, -input[1],
37 player_replay.freecam_v );
38 v3_muladds( player_replay.freecam_v, sidedir, input[0],
39 player_replay.freecam_v );
40
41 v3_muls( player_replay.freecam_v, decay, player_replay.freecam_v );
42 v3_muladds( cam->pos,
43 player_replay.freecam_v, vg.time_frame_delta, cam->pos );
44 }