From 225d48f1d8a44681fa84272976b0e291211ef677 Mon Sep 17 00:00:00 2001 From: shg8 Date: Wed, 13 Mar 2024 19:34:17 -0700 Subject: [PATCH] Various fixes --- 3dgs/GUIManager.cpp | 8 ++++---- 3dgs/GUIManager.h | 28 ++++++++++++++-------------- 3dgs/Renderer.cpp | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/3dgs/GUIManager.cpp b/3dgs/GUIManager.cpp index dfcc5b8..e168d9a 100644 --- a/3dgs/GUIManager.cpp +++ b/3dgs/GUIManager.cpp @@ -27,9 +27,9 @@ void GUIManager::buildGui() { ImPlot::SetupAxisLimits(ImAxis_Y1, 0, 1); ImPlot::SetNextFillStyle(IMPLOT_AUTO_COL, 0.5f); for (auto& [name, values]: *metricsMap) { - if (!values.Data.empty()) { - ImPlot::PlotLine(name.c_str(), &values.Data[0].x, &values.Data[0].y, values.Data.size(), 0, - values.Offset, 2 * sizeof(float)); + if (!values.data.empty()) { + ImPlot::PlotLine(name.c_str(), &values.data[0].x, &values.data[0].y, values.data.size(), 0, + values.offset, 2 * sizeof(float)); } } ImPlot::EndPlot(); @@ -47,7 +47,7 @@ void GUIManager::buildGui() { void GUIManager::pushMetric(const std::string& name, float value) { int maxSize = 600; if (!metricsMap->contains(name)) { - metricsMap->insert({name, ScrollingBuffer(maxSize)}); + metricsMap->insert({name, ScrollingBuffer{}}); } metricsMap->at(name).addPoint(ImGui::GetTime(), value); } diff --git a/3dgs/GUIManager.h b/3dgs/GUIManager.h index 0bbd4c3..a1270f0 100644 --- a/3dgs/GUIManager.h +++ b/3dgs/GUIManager.h @@ -9,26 +9,26 @@ #include "implot/implot.h" struct ScrollingBuffer { - int MaxSize; - int Offset; - ImVector Data; - ScrollingBuffer(int max_size = 2000) { - MaxSize = max_size; - Offset = 0; - Data.reserve(MaxSize); + int maxSize; + int offset; + ImVector data; + explicit ScrollingBuffer(const int max_size = 10000) { + maxSize = max_size; + offset = 0; + data.reserve(maxSize); } void addPoint(float x, float y) { - if (Data.size() < MaxSize) - Data.push_back(ImVec2(x,y)); + if (data.size() < maxSize) + data.push_back(ImVec2(x,y)); else { - Data[Offset] = ImVec2(x,y); - Offset = (Offset + 1) % MaxSize; + data[offset] = ImVec2(x,y); + offset = (offset + 1) % maxSize; } } void clear() { - if (Data.size() > 0) { - Data.shrink(0); - Offset = 0; + if (data.size() > 0) { + data.shrink(0); + offset = 0; } } }; diff --git a/3dgs/Renderer.cpp b/3dgs/Renderer.cpp index 2b0952c..c59531b 100644 --- a/3dgs/Renderer.cpp +++ b/3dgs/Renderer.cpp @@ -81,7 +81,7 @@ void Renderer::retrieveTimestamps() { void Renderer::initializeVulkan() { spdlog::debug("Initializing Vulkan"); - window = std::make_shared("Vulkan Splatting", 800, 600); + window = std::make_shared("Vulkan Splatting", 1920, 1080); context = std::make_shared(Window::getRequiredInstanceExtensions(), std::vector{}, configuration.enableVulkanValidationLayers); @@ -640,7 +640,7 @@ void Renderer::updateUniforms() { auto view = glm::inverse(translation * rotation); data.view_mat = view; - data.proj_mat = glm::perspective(glm::radians(camera.fov), static_cast(width) / static_cast(height), + data.proj_mat = glm::perspective(glm::radians(camera.fov) / 2.0f, static_cast(width) / static_cast(height), camera.nearPlane, camera.farPlane) * view;