diff --git a/src/d3d12/d3d12_renderer.cpp b/src/d3d12/d3d12_renderer.cpp index 2342d50e..4a6270b8 100644 --- a/src/d3d12/d3d12_renderer.cpp +++ b/src/d3d12/d3d12_renderer.cpp @@ -115,7 +115,7 @@ namespace wr SetName(m_compute_queue, L"Default D3D12 Compute Command Queue"); SetName(m_copy_queue, L"Default D3D12 Copy Command Queue"); - if (window.has_value()) + if (window.has_value() && window.value()->HasPhysicalWindow()) { m_render_window = d3d12::CreateRenderWindow(m_device, window.value()->GetWindowHandle(), m_direct_queue, d3d12::settings::num_back_buffers); } @@ -159,7 +159,7 @@ namespace wr m_raytracing_offset_sb_pool = CreateStructuredBufferPool(rt_offset_align_size); // Begin Recording - auto frame_idx = m_render_window.has_value() ? m_render_window.value()->m_frame_idx : 0; + auto frame_idx = GetFrameIdx(); d3d12::Begin(m_direct_cmd_list, frame_idx); // Stage fullscreen quad @@ -304,6 +304,8 @@ namespace wr // Optional CPU-visible copy of the render target pixel data const auto cpu_output_texture = frame_graph.GetOutputTexture(); + ++frame_counter; + // Optional CPU-visible copy of the render target pixel and/or depth data return frame_graph.GetOutputTexture(); } @@ -997,13 +999,6 @@ namespace wr { d3d12::Begin(m_direct_cmd_list, frame_idx); - if (clear_frame_buffer) - { - CD3DX12_CPU_DESCRIPTOR_HANDLE rtv_descriptor(m_render_window.value()->m_rtv_descriptor_heap->GetCPUDescriptorHandleForHeapStart()); - - rtv_descriptor.Offset(frame_idx, m_render_window.value()->m_rtv_descriptor_increment_size); - } - for (int i = 0; i < m_structured_buffer_pools.size(); ++i) { m_structured_buffer_pools[i]->UpdateBuffers(m_direct_cmd_list, frame_idx); @@ -1285,8 +1280,7 @@ namespace wr } else { - LOGW("Called `D3D12RenderSystem::GetFrameIdx` without a window!"); - return 0; + return frame_counter % d3d12::settings::num_back_buffers; } } diff --git a/src/d3d12/d3d12_renderer.hpp b/src/d3d12/d3d12_renderer.hpp index aba212cc..e06f0e32 100644 --- a/src/d3d12/d3d12_renderer.hpp +++ b/src/d3d12/d3d12_renderer.hpp @@ -305,6 +305,7 @@ namespace wr MaterialHandle m_last_material = { nullptr, 0 }; bool m_skybox_changed = false; + std::uint32_t frame_counter = 0; }; diff --git a/src/render_tasks/d3d12_cubemap_convolution.hpp b/src/render_tasks/d3d12_cubemap_convolution.hpp index 081f802e..f086b67c 100644 --- a/src/render_tasks/d3d12_cubemap_convolution.hpp +++ b/src/render_tasks/d3d12_cubemap_convolution.hpp @@ -138,11 +138,10 @@ namespace wr if (radiance->m_is_staged) { - if (n_render_system.m_render_window.has_value()) { auto cmd_list = fg.GetCommandList(handle); const auto viewport = d3d12::CreateViewport(static_cast(irradiance->m_width), static_cast(irradiance->m_height)); - const auto frame_idx = n_render_system.GetRenderWindow()->m_frame_idx; + const auto frame_idx = n_render_system.GetFrameIdx(); d3d12::BindViewport(cmd_list, viewport); d3d12::BindPipeline(cmd_list, data.in_pipeline); diff --git a/src/render_tasks/d3d12_deferred_composition.cpp b/src/render_tasks/d3d12_deferred_composition.cpp index e49e5fd5..bafe5c5f 100644 --- a/src/render_tasks/d3d12_deferred_composition.cpp +++ b/src/render_tasks/d3d12_deferred_composition.cpp @@ -251,7 +251,6 @@ namespace wr } } - if (n_render_system.m_render_window.has_value()) { const auto viewport = n_render_system.m_viewport; const auto frame_idx = n_render_system.GetFrameIdx(); diff --git a/src/render_tasks/d3d12_deferred_main.hpp b/src/render_tasks/d3d12_deferred_main.hpp index b081e0cc..7643926b 100644 --- a/src/render_tasks/d3d12_deferred_main.hpp +++ b/src/render_tasks/d3d12_deferred_main.hpp @@ -58,10 +58,9 @@ namespace wr auto& data = fg.GetData(handle); auto cmd_list = fg.GetCommandList(handle); - if (n_render_system.m_render_window.has_value()) { const auto viewport = n_render_system.m_viewport; - const auto frame_idx = n_render_system.GetRenderWindow()->m_frame_idx; + const auto frame_idx = n_render_system.GetFrameIdx(); d3d12::BindViewport(cmd_list, viewport); d3d12::BindPipeline(cmd_list, data.in_pipeline); diff --git a/src/render_tasks/d3d12_equirect_to_cubemap.hpp b/src/render_tasks/d3d12_equirect_to_cubemap.hpp index c05b091f..a0cc1579 100644 --- a/src/render_tasks/d3d12_equirect_to_cubemap.hpp +++ b/src/render_tasks/d3d12_equirect_to_cubemap.hpp @@ -209,11 +209,10 @@ namespace wr d3d12::TextureResource* equirect_text = static_cast(data.in_equirect.m_pool->GetTextureResource(data.in_equirect)); d3d12::TextureResource* cubemap_text = static_cast(data.out_cubemap.m_pool->GetTextureResource(data.out_cubemap)); - if (n_render_system.m_render_window.has_value()) { auto cmd_list = fg.GetCommandList(handle); const auto viewport = d3d12::CreateViewport(static_cast(cubemap_text->m_width), static_cast(cubemap_text->m_height)); - const auto frame_idx = n_render_system.GetRenderWindow()->m_frame_idx; + const auto frame_idx = n_render_system.GetFrameIdx(); d3d12::BindViewport(cmd_list, viewport); d3d12::BindPipeline(cmd_list, data.in_pipeline); diff --git a/src/render_tasks/d3d12_imgui_render_task.hpp b/src/render_tasks/d3d12_imgui_render_task.hpp index 8971d2b6..11ec6407 100644 --- a/src/render_tasks/d3d12_imgui_render_task.hpp +++ b/src/render_tasks/d3d12_imgui_render_task.hpp @@ -41,7 +41,7 @@ namespace wr { auto& n_render_system = static_cast(rs); - if (!n_render_system.m_window.has_value()) + if (!n_render_system.m_window.has_value() || !n_render_system.m_window.value()->HasPhysicalWindow()) { LOGC("Tried using imgui without a window!"); } @@ -91,7 +91,6 @@ namespace wr auto cmd_list = fg.GetCommandList(handle); // Temp rendering - if (n_render_system.m_render_window.has_value()) { auto frame_idx = n_render_system.GetFrameIdx(); diff --git a/src/render_tasks/d3d12_path_tracer.hpp b/src/render_tasks/d3d12_path_tracer.hpp index f760c525..b99c855c 100644 --- a/src/render_tasks/d3d12_path_tracer.hpp +++ b/src/render_tasks/d3d12_path_tracer.hpp @@ -39,9 +39,9 @@ namespace wr d3d12::AccelerationStructure out_tlas = {}; // Shader tables - std::array out_raygen_shader_table = { nullptr, nullptr, nullptr }; - std::array out_miss_shader_table = { nullptr, nullptr, nullptr }; - std::array out_hitgroup_shader_table = { nullptr, nullptr, nullptr }; + std::array out_raygen_shader_table = { }; + std::array out_miss_shader_table = { }; + std::array out_hitgroup_shader_table = { }; // Pipeline objects d3d12::StateObject* out_state_object = nullptr; @@ -195,10 +195,9 @@ namespace wr auto& rt_registry = RTPipelineRegistry::Get(); data.out_state_object = static_cast(rt_registry.Find(state_objects::path_tracer_state_object)); - // Create Shader Tables - CreateShaderTables(device, data, 0); - CreateShaderTables(device, data, 1); - CreateShaderTables(device, data, 2); + // Create Shader Tables + for (int i = 0; i < d3d12::settings::num_back_buffers; ++i) + CreateShaderTables(device, data, i); } } @@ -246,7 +245,6 @@ namespace wr // Wait for AS to be built d3d12::UAVBarrierAS(cmd_list, as_build_data.out_tlas, frame_idx); - if (n_render_system.m_render_window.has_value()) { d3d12::BindRaytracingPipeline(cmd_list, data.out_state_object, d3d12::GetRaytracingType(device) == RaytracingType::FALLBACK); diff --git a/src/render_tasks/d3d12_raytracing_task.hpp b/src/render_tasks/d3d12_raytracing_task.hpp index 0841d770..fda51381 100644 --- a/src/render_tasks/d3d12_raytracing_task.hpp +++ b/src/render_tasks/d3d12_raytracing_task.hpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#pragma once + #pragma once #include "../d3d12/d3d12_renderer.hpp" #include "../d3d12/d3d12_functions.hpp" @@ -38,9 +38,9 @@ namespace wr { d3d12::AccelerationStructure out_tlas; - std::array out_raygen_shader_table = { nullptr, nullptr, nullptr }; - std::array out_miss_shader_table = { nullptr, nullptr, nullptr }; - std::array out_hitgroup_shader_table = { nullptr, nullptr, nullptr }; + std::array out_raygen_shader_table = { }; + std::array out_miss_shader_table = { }; + std::array out_hitgroup_shader_table = { }; d3d12::StateObject* out_state_object = nullptr; d3d12::RootSignature* out_root_signature = nullptr; D3D12ConstantBufferHandle* out_cb_camera_handle = nullptr; @@ -151,15 +151,13 @@ namespace wr data.tlas_requires_init = true; - CreateShaderTables(device, data, 0); - CreateShaderTables(device, data, 1); - CreateShaderTables(device, data, 2); + for(int i = 0; i < d3d12::settings::num_back_buffers; ++i) + CreateShaderTables(device, data, i); } - for (auto frame_idx = 0; frame_idx < 1; frame_idx++) { d3d12::DescHeapCPUHandle desc_handle = data.out_uav_from_rtv.GetDescriptorHandle(); - d3d12::CreateUAVFromSpecificRTV(n_render_target, desc_handle, frame_idx, n_render_target->m_create_info.m_rtv_formats[frame_idx]); + d3d12::CreateUAVFromSpecificRTV(n_render_target, desc_handle, 0, n_render_target->m_create_info.m_rtv_formats[0]); } } @@ -184,7 +182,6 @@ namespace wr d3d12::UAVBarrierAS(cmd_list, as_build_data.out_tlas, frame_idx); } - if (n_render_system.m_render_window.has_value()) { d3d12::BindRaytracingPipeline(cmd_list, data.out_state_object, d3d12::GetRaytracingType(device) == RaytracingType::FALLBACK); @@ -334,6 +331,7 @@ namespace wr //#ifdef _DEBUG CreateShaderTables(device, data, frame_idx); //#endif + d3d12::DispatchRays(cmd_list, data.out_hitgroup_shader_table[frame_idx], data.out_miss_shader_table[frame_idx], diff --git a/src/render_tasks/d3d12_rt_hybrid_helpers.hpp b/src/render_tasks/d3d12_rt_hybrid_helpers.hpp index be1918d2..d0865adb 100644 --- a/src/render_tasks/d3d12_rt_hybrid_helpers.hpp +++ b/src/render_tasks/d3d12_rt_hybrid_helpers.hpp @@ -40,9 +40,9 @@ namespace wr d3d12::AccelerationStructure out_tlas = {}; // Shader tables - std::array out_raygen_shader_table = { nullptr, nullptr, nullptr }; - std::array out_miss_shader_table = { nullptr, nullptr, nullptr }; - std::array out_hitgroup_shader_table = { nullptr, nullptr, nullptr }; + std::array out_raygen_shader_table = { }; + std::array out_miss_shader_table = { }; + std::array out_hitgroup_shader_table = { }; // Pipeline objects diff --git a/src/render_tasks/d3d12_rt_reflection_task.hpp b/src/render_tasks/d3d12_rt_reflection_task.hpp index b3a473b9..a0142b44 100644 --- a/src/render_tasks/d3d12_rt_reflection_task.hpp +++ b/src/render_tasks/d3d12_rt_reflection_task.hpp @@ -112,7 +112,6 @@ namespace wr d3d12::UAVBarrierAS(cmd_list, as_build_data.out_tlas, frame_idx); } - if (n_render_system.m_render_window.has_value()) { d3d12::BindRaytracingPipeline(cmd_list, data.base_data.out_state_object, d3d12::GetRaytracingType(device) == RaytracingType::FALLBACK); diff --git a/src/render_tasks/d3d12_rt_shadow_task.hpp b/src/render_tasks/d3d12_rt_shadow_task.hpp index 4b380e2d..09e86879 100644 --- a/src/render_tasks/d3d12_rt_shadow_task.hpp +++ b/src/render_tasks/d3d12_rt_shadow_task.hpp @@ -127,7 +127,6 @@ namespace wr d3d12::UAVBarrierAS(cmd_list, as_build_data.out_tlas, frame_idx); } - if (n_render_system.m_render_window.has_value()) { d3d12::BindRaytracingPipeline(cmd_list, data.base_data.out_state_object, d3d12::GetRaytracingType(device) == RaytracingType::FALLBACK); diff --git a/src/render_tasks/d3d12_rtao_task.hpp b/src/render_tasks/d3d12_rtao_task.hpp index 48416a36..f3529386 100644 --- a/src/render_tasks/d3d12_rtao_task.hpp +++ b/src/render_tasks/d3d12_rtao_task.hpp @@ -50,9 +50,9 @@ namespace wr d3d12::AccelerationStructure out_tlas = {}; // Shader tables - std::array in_raygen_shader_table = { nullptr, nullptr, nullptr }; - std::array in_miss_shader_table = { nullptr, nullptr, nullptr }; - std::array in_hitgroup_shader_table = { nullptr, nullptr, nullptr }; + std::array in_raygen_shader_table = { }; + std::array in_miss_shader_table = { }; + std::array in_hitgroup_shader_table = { }; // Pipeline objects d3d12::StateObject* in_state_object; @@ -66,7 +66,6 @@ namespace wr DescriptorAllocation in_depthbuffer; bool tlas_requires_init = false; - }; namespace internal @@ -165,9 +164,8 @@ namespace wr data.in_root_signature = static_cast(rs_registry.Find(root_signatures::rt_ao_global)); // Create Shader Tables - CreateShaderTables(device, data, 0); - CreateShaderTables(device, data, 1); - CreateShaderTables(device, data, 2); + for (int i = 0; i < d3d12::settings::num_back_buffers; ++i) + CreateShaderTables(device, data, i); } } @@ -186,7 +184,6 @@ namespace wr fg.WaitForPredecessorTask(); float scalar = 1.0f; - if (n_render_system.m_render_window.has_value()) { d3d12::BindRaytracingPipeline(cmd_list, data.in_state_object, false); diff --git a/src/render_tasks/d3d12_shadow_denoiser_task.hpp b/src/render_tasks/d3d12_shadow_denoiser_task.hpp index ca8dfd22..f76e5c1d 100644 --- a/src/render_tasks/d3d12_shadow_denoiser_task.hpp +++ b/src/render_tasks/d3d12_shadow_denoiser_task.hpp @@ -571,7 +571,6 @@ namespace wr data.m_constant_buffer_pool->Update(data.m_denoiser_settings_buffer[i], sizeof(temp::ShadowDenoiserSettings_CBData), 0, n_render_system.GetFrameIdx(), (uint8_t*)& data.m_denoiser_settings); } - if (n_render_system.m_render_window.has_value()) { const auto viewport = n_render_system.m_viewport; const auto frame_idx = n_render_system.GetFrameIdx(); diff --git a/src/window.cpp b/src/window.cpp index 48fcdca8..63e1406f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -26,7 +26,7 @@ namespace wr { - Window::Window(HINSTANCE instance, int show_cmd, std::string const & name, std::uint32_t width, std::uint32_t height) + Window::Window(HINSTANCE instance, std::string const &name, std::uint32_t width, std::uint32_t height, bool show) : m_title(name), m_instance(instance) { WNDCLASSEX wc; @@ -85,26 +85,53 @@ namespace wr SetWindowLongPtr(m_handle, GWLP_USERDATA, (LONG_PTR)this); - ShowWindow(m_handle, show_cmd); + ShowWindow(m_handle, show ? SW_SHOWNORMAL : SW_HIDE); UpdateWindow(m_handle); - - m_running = true; } - - Window::Window(HINSTANCE instance, std::string const& name, std::uint32_t width, std::uint32_t height, bool show) - : Window(instance, show ? SW_SHOWNORMAL : SW_HIDE, name, width, height) - { + + Window::Window( std::string const &name, std::uint32_t width, std::uint32_t height) + : m_title(name), m_window_width(width), m_window_height(height) { } Window::~Window() { Stop(); - UnregisterClassA(m_title.c_str(), m_instance); + + if (m_instance) + { + UnregisterClassA(m_title.c_str(), m_instance); + } } void Window::PollEvents() { + //Handle virtual window + + if(!m_handle) + { + if (m_render_func) + { + float dt = std::chrono::duration(std::chrono::high_resolution_clock::now() - m_prev_time).count(); + + if (!m_has_time_point) { + dt = 0; + m_has_time_point = true; + + if (m_resize_callback) { + m_resize_callback(m_window_width, m_window_height); + } + } + + m_prev_time = std::chrono::high_resolution_clock::now(); + m_render_func(dt); + } + + return; + } + + //Handle physical window + MSG msg; if (PeekMessage(&msg, m_handle, 0, 0, PM_REMOVE)) { @@ -118,15 +145,25 @@ namespace wr void Window::Show() { - ShowWindow(m_handle, SW_SHOW); + if(m_handle) + { + ShowWindow(m_handle, SW_SHOW); + } + else + { + LOGW("Window::show called on virtual window"); + } } void Window::Stop() { - DestroyWindow(m_handle); + if (m_handle) + { + DestroyWindow(m_handle); + } } - void Window::SetRenderLoop(std::function render_func) + void Window::SetRenderLoop(std::function render_func) { m_render_func = std::move(render_func); } @@ -138,22 +175,38 @@ namespace wr PollEvents(); } - UnregisterClassA(m_title.c_str(), m_instance); + if(m_instance) + { + UnregisterClassA(m_title.c_str(), m_instance); + } } void Window::SetKeyCallback(KeyCallback callback) { m_key_callback = std::move(callback); + + if(!m_handle) + { + LOGW("Window::SetKeyCallback called on virtual window"); + } } void Window::SetMouseCallback(MouseCallback callback) { m_mouse_callback = std::move(callback); + + if (!m_handle) { + LOGW("Window::SetMouseCallback called on virtual window"); + } } void Window::SetMouseWheelCallback(MouseWheelCallback callback) { m_mouse_wheel_callback = std::move(callback); + + if (!m_handle) { + LOGW("Window::SetMouseWheelCallback called on virtual window"); + } } void Window::SetResizeCallback(ResizeCallback callback) @@ -168,6 +221,11 @@ namespace wr std::int32_t Window::GetWidth() const { + if (!m_handle) + { + return m_window_width; + } + RECT r; GetClientRect(m_handle, &r); return static_cast(r.right - r.left); @@ -175,6 +233,10 @@ namespace wr std::int32_t Window::GetHeight() const { + if (!m_handle) { + return m_window_height; + } + RECT r; GetClientRect(m_handle, &r); return static_cast(r.bottom - r.top); @@ -190,8 +252,18 @@ namespace wr return m_handle; } + bool Window::HasPhysicalWindow() const + { + return m_handle; + } + bool Window::IsFullscreen() const { + if(!m_handle) + { + return true; + } + RECT a, b; GetWindowRect(m_handle, &a); GetWindowRect(GetDesktopWindow(), &b); @@ -220,7 +292,15 @@ namespace wr case WM_PAINT: if (m_render_func) { - m_render_func(); + float dt = std::chrono::duration(std::chrono::high_resolution_clock::now() - m_prev_time).count(); + + if (!m_has_time_point) { + dt = 0; + m_has_time_point = true; + } + + m_prev_time = std::chrono::high_resolution_clock::now(); + m_render_func(dt); } return 0; case WM_DESTROY: diff --git a/src/window.hpp b/src/window.hpp index bff54367..cbae11a5 100644 --- a/src/window.hpp +++ b/src/window.hpp @@ -17,6 +17,7 @@ #include #include +#include namespace wr { @@ -28,7 +29,9 @@ namespace wr using ResizeCallback = std::function; using MouseWheelCallback = std::function; public: + /*! + Creates a physical window * @param instance A handle to the current instance of the application. * @param name Window title. * @param width Initial window width. @@ -36,7 +39,15 @@ namespace wr * @param show Controls whether the window will be shown. Default is true. */ Window(HINSTANCE instance, std::string const& name, std::uint32_t width, std::uint32_t height, bool show = true); - Window(HINSTANCE instance, int show_cmd, std::string const& name, std::uint32_t width, std::uint32_t height); + + /*! + Creates a non-physical window + * @param name Window title. + * @param width Initial window width. + * @param height Initial window height. + */ + Window(std::string const &name, std::uint32_t width, std::uint32_t height); + ~Window(); Window(const Window&) = delete; @@ -52,7 +63,7 @@ namespace wr void Stop(); /*! Give the window a function to call on repaint */ - void SetRenderLoop(std::function render_func); + void SetRenderLoop(std::function render_func); /*! Start a loop that runs until the window is closed. */ void StartRenderLoop(); @@ -77,6 +88,8 @@ namespace wr HWND GetWindowHandle() const; /*! Checks whether the window is fullscreen */ bool IsFullscreen() const; + /*! Checks whether the window is OS backed or not */ + bool HasPhysicalWindow() const; private: /*! WindowProc that calls `WindowProc_Impl` */ @@ -89,16 +102,19 @@ namespace wr ResizeCallback m_resize_callback; MouseWheelCallback m_mouse_wheel_callback; - std::function m_render_func; + std::function m_render_func; std::string m_title; - bool m_running; - HWND m_handle; - HINSTANCE m_instance; + bool m_running = true; + HWND m_handle = nullptr; + HINSTANCE m_instance = nullptr; std::int32_t m_window_width = 0; std::int32_t m_window_height = 0; + + decltype(std::chrono::high_resolution_clock::now()) m_prev_time; + bool m_has_time_point = false; }; } /* wr */ diff --git a/tests/common/scene.hpp b/tests/common/scene.hpp index 96bb7851..ebecc38d 100644 --- a/tests/common/scene.hpp +++ b/tests/common/scene.hpp @@ -30,7 +30,7 @@ class Scene virtual ~Scene(); virtual void Init(wr::D3D12RenderSystem* rs, unsigned int width, unsigned int height, void* extra = nullptr); - virtual void Update(float delta = 0) = 0; + virtual void Update(float delta_time) = 0; std::shared_ptr GetSceneGraph(); template std::shared_ptr GetCamera(); diff --git a/tests/demo/demo.cpp b/tests/demo/demo.cpp index d1719c77..e8ebd03a 100644 --- a/tests/demo/demo.cpp +++ b/tests/demo/demo.cpp @@ -130,6 +130,7 @@ int WispEntry() wr::ModelLoader* assimp_model_loader = new wr::AssimpModelLoader(); wr::ModelLoader* gltf_model_loader = new wr::TinyGLTFModelLoader(); + TRY_M(CoInitialize(nullptr), "Couldn't CoInitialize"); render_system->Init(window.get()); phys_engine.CreatePhysicsWorld(); @@ -151,12 +152,10 @@ int WispEntry() auto file_watcher = new util::FileWatcher("resources/shaders", std::chrono::milliseconds(100)); file_watcher->StartAsync(&ShaderDirChangeDetected); - window->SetRenderLoop([&]() { - // Find delta - float delta = ImGui::GetIO().DeltaTime; - bool capture_frame = engine::recorder.ShouldCaptureAndIncrement(delta); - if (capture_frame) - { + window->SetRenderLoop([&](float dt) { + + bool capture_frame = engine::recorder.ShouldCaptureAndIncrement(dt); + if (capture_frame) { fg_manager::Get()->SaveTaskToDisc(engine::recorder.GetNextFilename(".tga"), 0); } @@ -170,7 +169,7 @@ int WispEntry() fg_manager::Get()->SetShouldExecute(true); } - current_scene->Update(delta); + current_scene->Update(dt); #ifdef ENABLE_PHYSICS phys_engine.UpdateSim(delta, *current_scene->GetSceneGraph()); diff --git a/tests/demo/scene_emibl.cpp b/tests/demo/scene_emibl.cpp index 6cbce68f..5a84286d 100644 --- a/tests/demo/scene_emibl.cpp +++ b/tests/demo/scene_emibl.cpp @@ -321,7 +321,7 @@ void EmiblScene::BuildScene(unsigned int width, unsigned int height, void* extra dir_light->SetDirectional({ 360_deg - 136_deg, 0, 0 }, { 4, 4, 4 }); } -void EmiblScene::Update(float delta) +void EmiblScene::Update(float dt) { - m_camera->Update(delta); + m_camera->Update(dt); } \ No newline at end of file diff --git a/tests/demo/scene_emibl.hpp b/tests/demo/scene_emibl.hpp index c0dccae8..991adfdf 100644 --- a/tests/demo/scene_emibl.hpp +++ b/tests/demo/scene_emibl.hpp @@ -29,7 +29,7 @@ class EmiblScene : public Scene EmiblScene(); ~EmiblScene(); - void Update(float delta = 0) final; + void Update(float delta_time) final; protected: void LoadResources() final; diff --git a/tests/demo/scene_sponza.cpp b/tests/demo/scene_sponza.cpp index 659f2bcd..f409a3bc 100644 --- a/tests/demo/scene_sponza.cpp +++ b/tests/demo/scene_sponza.cpp @@ -136,8 +136,8 @@ void SponzaScene::BuildScene(unsigned int width, unsigned int height, void* extr LoadLightsFromJSON(); } -void SponzaScene::Update(float delta) +void SponzaScene::Update(float dt) { - m_camera->Update(delta); - m_camera_spline_node->UpdateSplineNode(delta, m_camera); + m_camera->Update(dt); + m_camera_spline_node->UpdateSplineNode(dt, m_camera); } \ No newline at end of file diff --git a/tests/demo/scene_sponza.hpp b/tests/demo/scene_sponza.hpp index 5cf5034e..3ca4fe0b 100644 --- a/tests/demo/scene_sponza.hpp +++ b/tests/demo/scene_sponza.hpp @@ -31,7 +31,7 @@ class SponzaScene : public Scene SponzaScene(); ~SponzaScene(); - void Update(float delta = 0) final; + void Update(float delta_time) final; protected: void LoadResources() final; diff --git a/tests/demo/scene_viknell.cpp b/tests/demo/scene_viknell.cpp index f9d6f4f0..06e8a72a 100644 --- a/tests/demo/scene_viknell.cpp +++ b/tests/demo/scene_viknell.cpp @@ -140,8 +140,8 @@ void ViknellScene::BuildScene(unsigned int width, unsigned int height, void* ext LoadLightsFromJSON(); } -void ViknellScene::Update(float delta) +void ViknellScene::Update(float dt) { - m_camera->Update(delta); - m_camera_spline_node->UpdateSplineNode(ImGui::GetIO().DeltaTime, m_camera); + m_camera->Update(dt); + m_camera_spline_node->UpdateSplineNode(dt, m_camera); } \ No newline at end of file diff --git a/tests/demo/scene_viknell.hpp b/tests/demo/scene_viknell.hpp index a8efc6ae..d68269b5 100644 --- a/tests/demo/scene_viknell.hpp +++ b/tests/demo/scene_viknell.hpp @@ -31,7 +31,7 @@ class ViknellScene : public Scene ViknellScene(); ~ViknellScene(); - void Update(float delta = 0) final; + void Update(float delta_time) final; protected: void LoadResources() final; diff --git a/tests/graphics_benchmark/spheres_scene.cpp b/tests/graphics_benchmark/spheres_scene.cpp index 1c41ade0..a9a1fd7b 100644 --- a/tests/graphics_benchmark/spheres_scene.cpp +++ b/tests/graphics_benchmark/spheres_scene.cpp @@ -61,7 +61,7 @@ void SpheresScene::BuildScene(unsigned int width, unsigned int height) dir_light->SetDirectional({ 136._deg, 0, 0 }, { 4, 4, 4 }); } -void SpheresScene::Update() +void SpheresScene::Update(float dt) { } diff --git a/tests/graphics_benchmark/spheres_scene.hpp b/tests/graphics_benchmark/spheres_scene.hpp index c4f12a98..03e4adca 100644 --- a/tests/graphics_benchmark/spheres_scene.hpp +++ b/tests/graphics_benchmark/spheres_scene.hpp @@ -7,7 +7,7 @@ class SpheresScene : public Scene public: SpheresScene(); - void Update() final; + void Update(float dt) final; protected: void LoadResources() final;