Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shg8 committed Mar 14, 2024
1 parent 39497fe commit 225d48f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions 3dgs/GUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down
28 changes: 14 additions & 14 deletions 3dgs/GUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@
#include "implot/implot.h"

struct ScrollingBuffer {
int MaxSize;
int Offset;
ImVector<ImVec2> Data;
ScrollingBuffer(int max_size = 2000) {
MaxSize = max_size;
Offset = 0;
Data.reserve(MaxSize);
int maxSize;
int offset;
ImVector<ImVec2> 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;
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions 3dgs/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void Renderer::retrieveTimestamps() {

void Renderer::initializeVulkan() {
spdlog::debug("Initializing Vulkan");
window = std::make_shared<Window>("Vulkan Splatting", 800, 600);
window = std::make_shared<Window>("Vulkan Splatting", 1920, 1080);
context = std::make_shared<VulkanContext>(Window::getRequiredInstanceExtensions(), std::vector<std::string>{},
configuration.enableVulkanValidationLayers);

Expand Down Expand Up @@ -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<float>(width) / static_cast<float>(height),
data.proj_mat = glm::perspective(glm::radians(camera.fov) / 2.0f, static_cast<float>(width) / static_cast<float>(height),
camera.nearPlane,
camera.farPlane) * view;

Expand Down

0 comments on commit 225d48f

Please sign in to comment.