commit d2dfca98b7ae276484a1ee03848e927421aefac2 parent 880eb059c952bf96bf7c276d9587ed5c562c2995 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Nov 27 11:32:41 +0200 VERTICAL_FOV Diffstat:
bsp.cc | | | 2 | +- |
game.h | | | 2 | ++ |
hm.cc | | | 2 | +- |
mod_btt.cc | | | 2 | +- |
shadow_map.cc | | | 2 | +- |
skybox.cc | | | 2 | +- |
diff --git a/bsp.cc b/bsp.cc @@ -332,7 +332,7 @@ extern "C" GAME_INIT( game_init ) { } static m4 camera_to_vp( v3 position, v3 angles ) { - const m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); + const m4 P = m4_perspective( VERTICAL_FOV, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); return m4_translation( -position ) * m4_rotz( -angles.y ) * m4_rotx( -angles.x ) * P; } diff --git a/game.h b/game.h @@ -26,6 +26,8 @@ const int HEIGHT = 768; const float NEAR_PLANE_DEPTH = 0.1f; const float FAR_PLANE_DEPTH = 10000.0f; +const float VERTICAL_FOV = 120.0f; + struct GameState { v3 pos; v3 angles; diff --git a/hm.cc b/hm.cc @@ -269,7 +269,7 @@ extern "C" GAME_FRAME( game_frame ) { terrain_update( &game->tm, game->pos ); - m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); + m4 P = m4_perspective( VERTICAL_FOV, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); m4 V = camera_to_view( game->pos, game->angles ); skybox_render( &game->skybox, game->angles, game->test_sun ); diff --git a/mod_btt.cc b/mod_btt.cc @@ -197,7 +197,7 @@ extern "C" GAME_INIT( game_init ) { } static m4 camera_to_vp( v3 position, v3 angles ) { - const m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); + const m4 P = m4_perspective( VERTICAL_FOV, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); return m4_translation( -position ) * m4_rotz( -angles.y ) * m4_rotx( -angles.x ) * P; } diff --git a/shadow_map.cc b/shadow_map.cc @@ -124,7 +124,7 @@ static void update_camera( } static m4 camera_to_vp( v3 position, v3 angles ) { - const m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, 25.0f ); + const m4 P = m4_perspective( VERTICAL_FOV, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, 25.0f ); return m4_translation( -position ) * m4_rotz( -angles.y ) * m4_rotx( -angles.x ) * P; } diff --git a/skybox.cc b/skybox.cc @@ -86,7 +86,7 @@ static m4 angles_to_view( v3 angles ) { } void skybox_render( const Skybox * skybox, v3 view_angles, float sun ) { - m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); + m4 P = m4_perspective( VERTICAL_FOV, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, FAR_PLANE_DEPTH ); m4 V = angles_to_view( view_angles ); VSData vsdata = { V, P };