From bc1073a020c99ed89967a6b00a9eeb4ab2e160dc Mon Sep 17 00:00:00 2001 From: ladevieq Date: Thu, 18 Mar 2021 23:28:20 +0100 Subject: Display frame time & add aabb ray hit function for future BVH implementation --- src/main.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 56e924d..553191a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,24 +19,6 @@ #include #endif -void gui(input_data* mapped_input_data, bool &reset_accumulation) { - ImGui::NewFrame(); - - ImGui::SetNextWindowPos({ 0.f, 0.f }); - ImGui::SetNextWindowSize({ 0.f, 0.f }); - ImGui::Begin("Debug", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar); - - if (ImGui::SliderInt("samples per pixel", (int32_t*)&mapped_input_data->samples_per_pixel, 1, 1000)) { - reset_accumulation = true; - } - - ImGui::SliderInt("bounces", (int32_t*)&mapped_input_data->max_bounce, 2, 250); - - ImGui::End(); - - ImGui::EndFrame(); -} - int main() { RENDERDOC_API_1_1_2 *rdoc_api = NULL; @@ -185,7 +167,24 @@ int main() { wnd.events.clear(); - gui((input_data*)renderer.compute_shader_buffer.alloc_info.pMappedData, reset_accumulation); + // GUI + ImGui::NewFrame(); + + ImGui::SetNextWindowPos({ 0.f, 0.f }); + ImGui::SetNextWindowSize({ 0.f, 0.f }); + ImGui::Begin("Debug", NULL, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoTitleBar); + + 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::SliderInt("bounces", (int32_t*)&((input_data*) renderer.compute_shader_buffer.alloc_info.pMappedData)->max_bounce, 2, 250); + + ImGui::End(); + + ImGui::EndFrame(); // To start a frame capture, call StartFrameCapture. // You can specify NULL, NULL for the device to capture on if you have only one device and -- cgit v1.3