Character controller, reimplementing shadow pass

This commit is contained in:
2024-10-15 00:02:41 +02:00
parent 55adf0971e
commit a60fe82272
7 changed files with 117 additions and 99 deletions

View File

@@ -60,7 +60,7 @@ coven_run :: (game_update_proc: (float), game_update_post_physics_proc: (float))
time = xx seconds_since_init();
while !quit {
//reset_temporary_storage();
reset_temporary_storage();
frame_index += 1;
@@ -104,7 +104,32 @@ coven_run :: (game_update_proc: (float), game_update_post_physics_proc: (float))
SDL_Quit();
}
update_light_buffer :: () {
scene := current_scene;
light_data : Directional_Light_Buffer_Data;
light_data.direction = scene.directional_light.direction;
light_data.color_and_intensity = scene.directional_light.color_and_intensity;
dir := to_v3(scene.directional_light.direction);
z_near := 1.0;
z_far := 50.5;
width := 10.0;
light_projection := orthographic_lh_projection_matrix(-width, width, -width, width, z_near, z_far);
light_view : Matrix4;
eye := scene.directional_light.view_position - dir * 30.0;
m := look_at_lh(eye, eye + dir * 5.0, .{0,1,0});
light_view = m;
light_data.light_matrix = light_projection * light_view;
upload_data_to_buffer(renderer, directional_light_buffer, *light_data, size_of(Directional_Light_Buffer_Data));
}
sync_engine_buffers :: () {
update_light_buffer();
// Camera buffer
camera := *current_scene.camera;