diff options
| author | Quentin LADEVIE <qladevie@wanadev.fr> | 2022-02-16 11:47:54 +0100 |
|---|---|---|
| committer | Quentin LADEVIE <qladevie@wanadev.fr> | 2022-02-16 11:47:54 +0100 |
| commit | 0baf9dab1c07c52a956ec4a0969854b7fc46e104 (patch) | |
| tree | 3bbdcd7c125c31d0fbee4e2e5cd88da6681e896f /src/main.cpp | |
| parent | f582eb80d73a1d0b735503c8894636782406228c (diff) | |
Fixes artifacts when moving in the scene
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp index 197c794..45e30a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,14 +116,14 @@ int main() { can_render = true; renderer.recreate_swapchain(); main_scene.meta.cam.set_aspect_ratio((float)event.width / (float)event.height); - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; accumulation_texture = renderer.create_2d_texture(width, height, VK_FORMAT_R32G32B32A32_SFLOAT); output_texture = renderer.create_2d_texture(width, height, VK_FORMAT_R32G32B32A32_SFLOAT); raytracing_pass->set_dispatch_size(event.width / 8 + 1, event.height / 8 + 1, 1); } - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; break; } @@ -154,12 +154,12 @@ int main() { } case KEYS::E: { main_scene.meta.cam.rotate_y(0.001f * delta_time); - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; break; } case KEYS::Q: { main_scene.meta.cam.rotate_y(-0.001f * delta_time); - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; break; } case KEYS::SPACE: { @@ -177,7 +177,7 @@ int main() { main_scene.meta.cam.move(move_vec); if (!move_vec.near_zero()) { - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; } break; @@ -226,17 +226,17 @@ int main() { ImGui::Text("frame count %u\n", main_scene.meta.sample_index); if (ImGui::Checkbox("depth of field", (bool*)&main_scene.meta.enable_dof)) { - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; } ImGui::SliderInt("max bounces", (int32_t*)&main_scene.meta.max_bounce, 1, 250); ImGui::SliderInt("min bounces", (int32_t*)&main_scene.meta.min_bounce, 1, main_scene.meta.max_bounce); if (ImGui::SliderInt("downscale factor", (int32_t*)&main_scene.meta.downscale_factor, 1, 32)) { - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; } if (ImGui::Checkbox("debug bvh", (bool*)&main_scene.meta.debug_bvh)) { - main_scene.meta.sample_index = 0; + main_scene.meta.sample_index = 1; } ImGui::End(); @@ -259,10 +259,10 @@ int main() { raytracing_pass->set_constant(60, accumulation_texture); - main_scene.meta.sample_index++; - renderer.render(); + main_scene.meta.sample_index++; + std::swap(output_texture, accumulation_texture); } |
