commit 7fcdf2ccca64629b437bc90ba25b4473ca8a462d parent b59078bcc297c7f29267e907aaeb51853f91a68a Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Jul 9 11:23:19 +0300 Some missed sun changes Diffstat:
hm.cc | | | 15 | +++++++-------- |
diff --git a/hm.cc b/hm.cc @@ -69,7 +69,7 @@ GAME_INIT( game_init ) { terrain_init( &game->tm, "terrains/gta16.png.parts", &mem->persistent_arena, &game->background_tasks ); terrain_teleport( &game->tm, game->pos ); - game->test_sun = 0.3f; + game->sun_angle = 0.3f; ub_view = renderer_new_ub(); ub_model = renderer_new_ub(); @@ -174,9 +174,8 @@ GAME_FRAME( game_frame ) { game->pitch = clamp( game->pitch + dpitch * dt * 100, -89.9f, 89.9f ); game->yaw += dyaw * dt * 100; - const float dsun = ( input->keys[ KEY_EQUALS ] - input->keys[ KEY_MINUS ] ) * dt; - game->test_sun += dsun; - if( dsun != 0 ) printf( "sun: %.4f\n", game->test_sun ); + const float dsun = ( input->keys[ KEY_EQUALS ] - input->keys[ KEY_MINUS ] ) * dt * 0.25f; + game->sun_angle += dsun; const float speed = 100.0f; @@ -198,8 +197,8 @@ GAME_FRAME( game_frame ) { m4 V = m4_view( forward, right, up, game->pos ); m4 Vsky = m4_view( forward, right, up, v3( 0 ) ); - skybox_render( &game->skybox, Vsky, P, game->test_sun ); - terrain_render( &game->tm, V, P, game->test_sun, current_time ); + skybox_render( &game->skybox, Vsky, P, sun_dir ); + terrain_render( &game->tm, V, P, game->sun_angle, sun_dir, current_time ); struct { m4 V; m4 P; } uniforms = { V, P }; renderer_ub_data( ub_view, &uniforms, sizeof( uniforms ) ); @@ -209,10 +208,10 @@ GAME_FRAME( game_frame ) { render_state.shader = get_shader( SHADER_TREE ); render_state.ubs[ UB_VIEW ] = ub_view; render_state.ubs[ UB_MODEL ] = ub_model; - render_state.ubs[ UB_FS_HOT ] = ub_sun; + render_state.ubs[ UB_SUN ] = ub_sun; render_state.cull_face = CULLFACE_FRONT; - renderer_ub_easy( ub_sun, game->test_sun ); + renderer_ub_easy( ub_sun, sun_dir ); renderer_draw_instances( tree_mesh, render_state, num_trees, instance_data ); }