commit 0e4ee1a441fa49cbc54b8d3ceb87d8263ad980e8 parent 67211c8da8c72cb1a68a45dd964538cb50da59f5 Author: Michael Savage <mikejsavage@gmail.com> Date: Mon Nov 7 22:27:42 +0200 Tidying Diffstat:
shadow_map.cc | | | 7 | +++---- |
diff --git a/shadow_map.cc b/shadow_map.cc @@ -126,10 +126,10 @@ static void update_camera( *out_angles = angles + glm::vec3( dt * pitch * angular_speed, dt * yaw * angular_speed, 0 ); } -static void camera_to_vp( glm::vec3 position, glm::vec3 angles, m4 * vp ) { +static m4 camera_to_vp( glm::vec3 position, glm::vec3 angles ) { const m4 P = m4_perspective( 120.0f, ( float ) WIDTH / ( float ) HEIGHT, NEAR_PLANE_DEPTH, 25.0f ); - *vp = m4_translation( -GLMV3( position ) ) * m4_rotz( -angles.y ) * m4_rotx( -angles.x ) * P; + return m4_translation( -GLMV3( position ) ) * m4_rotz( -angles.y ) * m4_rotx( -angles.x ) * P; } const u32 SHADOW_WIDTH = 1024; @@ -180,8 +180,7 @@ extern "C" GAME_INIT( game_init ) { extern "C" GAME_FRAME( game_frame ) { update_camera( input, dt, game->pos, game->angles, &game->pos, &game->angles ); - m4 vp; - camera_to_vp( game->pos, game->angles, &vp ); + m4 vp = camera_to_vp( game->pos, game->angles ); glUseProgram( prog ); glUniformMatrix4fv( un_vp, 1, GL_FALSE, ( float * ) &vp );