Update implot to 1.0

This commit is contained in:
Guillaume Meunier
2026-08-17 20:43:56 +02:00
parent 16bb157163
commit 84bd79a736
3 changed files with 28 additions and 17 deletions
+2 -2
View File
@@ -248,8 +248,8 @@ set(KTX_VERSION_FULL "v${KTX_VERSION}")
FetchContent_Declare(libktx EXCLUDE_FROM_ALL SYSTEM URL https://github.com/KhronosGroup/KTX-Software/archive/refs/tags/${KTX_VERSION_FULL}.tar.gz
URL_HASH SHA256=9412cb45045a503005acd47d98f9e8b47154634a50b4df21e17a1dfa8971d323
)
FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/archive/3da8bd34299965d3b0ab124df743fe3e076fa222.zip
URL_HASH SHA256=e9b439a94aa6f09fcf12ed9c2cd784efe5e99e96242122aa683e690b29f7a59f)
FetchContent_Declare(implot EXCLUDE_FROM_ALL SYSTEM URL https://github.com/epezent/implot/releases/download/v1.0/implot-v1.0.tar.gz
URL_HASH SHA256=20ca14d5a46f36a650746096c74eba8bea99c9432cd3c877343b96b17a6ae566)
file(GLOB IMGUI_PATCHES CONFIGURE_DEPENDS patches/imgui/*)
FetchContent_Declare(imgui EXCLUDE_FROM_ALL SYSTEM URL https://github.com/ocornut/imgui/archive/refs/tags/v1.92.9.tar.gz
URL_HASH SHA256=af97ed649182c39314320514a672b82008ab462b9293fe23d37b30bfa5d05519
+17 -8
View File
@@ -733,13 +733,18 @@ void scenes::lobby::gui_debug()
if (ImPlot::BeginPlot(_S("CPU time"), plot_size, ImPlotFlags_CanvasOnly))
{
auto col = ImPlot::GetColormapColor(0);
auto color = ImPlot::GetColormapColor(0);
ImPlot::SetupAxes(nullptr, _S("CPU time [ms]"), ImPlotAxisFlags_NoDecorations, 0);
ImPlot::SetupAxesLimits(0, cpu_time.size() - 1, min_v, max_v, ImGuiCond_Always);
ImPlot::SetNextLineStyle(col);
ImPlot::SetNextFillStyle(col, 0.25);
ImPlot::PlotLine(_S("CPU time"), cpu_time.data(), cpu_time.size(), 1, 0, ImPlotLineFlags_Shaded, offset);
ImPlotSpec spec;
spec.LineColor = color;
spec.FillColor = color;
spec.FillAlpha = 0.25;
spec.Flags = ImPlotLineFlags_Shaded;
spec.Offset = offset;
ImPlot::PlotLine(_S("CPU time"), cpu_time.data(), cpu_time.size(), 1, 0, spec);
ImPlot::EndPlot();
}
@@ -747,13 +752,17 @@ void scenes::lobby::gui_debug()
if (ImPlot::BeginPlot(_S("GPU time"), plot_size, ImPlotFlags_CanvasOnly))
{
auto col = ImPlot::GetColormapColor(1);
auto color = ImPlot::GetColormapColor(1);
ImPlot::SetupAxes(nullptr, _S("GPU time [ms]"), ImPlotAxisFlags_NoDecorations, 0);
ImPlot::SetupAxesLimits(0, gpu_time.size() - 1, min_v, max_v, ImGuiCond_Always);
ImPlot::SetNextLineStyle(col);
ImPlot::SetNextFillStyle(col, 0.25);
ImPlot::PlotLine(_S("GPU time"), gpu_time.data(), gpu_time.size(), 1, 0, ImPlotLineFlags_Shaded, offset);
ImPlotSpec spec;
spec.LineColor = color;
spec.FillColor = color;
spec.FillAlpha = 0.25;
spec.Flags = ImPlotLineFlags_Shaded;
spec.Offset = offset;
ImPlot::PlotLine(_S("GPU time"), gpu_time.data(), gpu_time.size(), 1, 0, spec);
ImPlot::EndPlot();
}
ImPlot::PopStyleColor(5);
+9 -7
View File
@@ -227,8 +227,11 @@ void scenes::stream::gui_performance_metrics()
std::string title_with_units = std::string(title) + " [" + prefix + unit + "]";
ImPlot::SetupAxes(nullptr, title_with_units.c_str(), ImPlotAxisFlags_NoDecorations, 0);
ImPlot::SetupAxesLimits(0, global_metrics.size() - 1, min_v * multiplier, axis_scale[n] * multiplier, ImGuiCond_Always);
ImPlot::SetNextLineStyle(color);
ImPlot::SetNextFillStyle(color, 0.25);
ImPlotSpec spec;
spec.LineColor = color;
spec.FillColor = color;
spec.FillAlpha = 0.25;
spec.Flags = ImPlotLineFlags_Shaded;
for (const auto & [subtitle, data]: subplots)
{
@@ -237,12 +240,12 @@ void scenes::stream::gui_performance_metrics()
.stride = sizeof(global_metric),
.multiplier = multiplier,
};
ImPlot::PlotLineG(subtitle.c_str(), getter, &gdata, global_metrics.size(), ImPlotLineFlags_Shaded);
ImPlot::PlotLineG(subtitle.c_str(), getter, &gdata, global_metrics.size(), spec);
double x[] = {double(metrics_offset), double(metrics_offset)};
double y[] = {0, axis_scale[n] * multiplier};
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
ImPlot::PlotLine("", x, y, 2);
spec.LineColor = ImVec4(1, 1, 1, 1);
ImPlot::PlotLine("", x, y, 2, spec);
}
ImPlot::EndPlot();
}
@@ -336,8 +339,7 @@ void scenes::stream::gui_performance_metrics()
double x[] = {double(metrics_offset), double(metrics_offset)};
double y[] = {0, 1e9};
ImPlot::SetNextLineStyle(ImVec4(1, 1, 1, 1));
ImPlot::PlotLine("", x, y, 2);
ImPlot::PlotLine("", x, y, 2, {ImPlotProp_LineColor, ImVec4(1, 1, 1, 1)});
ImPlot::EndPlot();
}