diff options
| author | ladevieq <ladevie.quentin@gmail.com> | 2021-05-12 23:39:42 +0200 |
|---|---|---|
| committer | ladevieq <ladevie.quentin@gmail.com> | 2021-05-12 23:41:54 +0200 |
| commit | a7707f730cd28853dc750b72ec882f07dba85406 (patch) | |
| tree | 4e219102ae9145bbbd42715e713f5f72a791d80f /src/main.cpp | |
| parent | 085d4c6dd995a4da396ddf3d51b619fafb77af7b (diff) | |
Add light sources, use russian roulette for opti and infinite
accumulation
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0e2911c..071903a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,7 +54,7 @@ int main() { uint64_t frame_count = 0; auto start = std::chrono::high_resolution_clock::now(); auto end = std::chrono::high_resolution_clock::now(); - auto inputs = create_inputs(width, height, samples_per_pixel); + auto inputs = create_inputs(width, height); auto can_render = true; vkrenderer renderer { wnd, inputs }; @@ -179,10 +179,7 @@ int main() { ImGui::Text("frame per second %u\n", static_cast<uint32_t>(1000.f / delta_time)); ImGui::Text("frame time %f ms\n", delta_time); - - if (ImGui::SliderInt("samples per pixel", (int32_t*)&((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->samples_per_pixel, 1, 1000)) { - reset_accumulation = true; - } + ImGui::Text("frame count %u\n", ((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->sample_index); ImGui::SliderInt("bounces", (int32_t*)&((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->max_bounce, 2, 250); @@ -200,12 +197,13 @@ int main() { renderer.begin_frame(); if (reset_accumulation) { + ((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->sample_index = 0; renderer.reset_accumulation(); } renderer.compute(width, height); - ((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->sample_index = frame_count % 1000; + ((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->sample_index++; renderer.ui(); |
