From 1f6a1c2959faa45a64fcfac3154199fefda0e868 Mon Sep 17 00:00:00 2001 From: Meca Date: Fri, 21 Nov 2025 15:27:48 +0100 Subject: [PATCH 1/8] Update setWeightFunc (Ponca v1.4) Signed-off-by: fauberva --- src/dataManager.cpp | 4 ++-- src/drawingPasses/bestFieldFit.h | 10 ++++------ src/drawingPasses/poncaFitField.h | 9 ++++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/dataManager.cpp b/src/dataManager.cpp index 1fc23c4..0b69e30 100644 --- a/src/dataManager.cpp +++ b/src/dataManager.cpp @@ -85,9 +85,9 @@ DataManager::computeNormals(int k){ for (auto& pp : m_points){ VectorType p {pp.x(),pp.y()}; PlaneFit fit; - fit.setWeightFunc(WeightFunc()); + fit.setWeightFunc({p}); // Set the evaluation position - fit.init(p); + fit.init(); // Fit plane (method compute handles multipass fitting if (fit.computeWithIds(m_tree.k_nearest_neighbors(p, k), m_tree.points()) == Ponca::STABLE) { pp.z() = std::acos(fit.primitiveGradient().normalized().x()); diff --git a/src/drawingPasses/bestFieldFit.h b/src/drawingPasses/bestFieldFit.h index a829020..f3598a4 100644 --- a/src/drawingPasses/bestFieldFit.h +++ b/src/drawingPasses/bestFieldFit.h @@ -71,7 +71,6 @@ struct BestFitField : public SingleFitField<_FitType, DrawingPass> { ~BestFitField() override = default; using FitType = _FitType; - using WeightFunc = typename FitType::WeightFunction; /// Method called at the end of the fitting process, only for stable fits virtual void postProcess(FitType& /*fit*/){}; @@ -79,8 +78,8 @@ struct BestFitField : public SingleFitField<_FitType, DrawingPass> { inline float configureAndFit(const KdTree& points, FitType& fit, RenderingContext ctx) override { // Configure computation to be centered on the point cloud coordinates float scale = points.nodes()[0].getAabb()->diagonal().norm(); - fit.setWeightFunc(WeightFunc(scale)); - fit.init(points.nodes()[0].getAabb()->center()); + fit.setWeightFunc({points.nodes()[0].getAabb()->center(), scale}); + fit.init(); // Compute fit fit.compute(points.points()); postProcess(fit); @@ -106,7 +105,6 @@ struct OnePointFitField : public SingleFitField<_FitType, BaseFitField>, public ~OnePointFitField() override = default; using FitType = _FitType; - using WeightFunc = typename FitType::WeightFunction; using Scalar = typename FitType::Scalar; /// Method called at the end of the fitting process, only for stable fits @@ -114,11 +112,11 @@ struct OnePointFitField : public SingleFitField<_FitType, BaseFitField>, public inline float configureAndFit(const KdTree& points, FitType& fit, RenderingContext ctx) override { // Configure computation to be centered on the point cloud coordinates - fit.setWeightFunc(WeightFunc(BaseFitField::params.m_scale)); auto query = points.points()[pointId].pos(); // Compute fit for (int iter = 0; iter != BaseFitField::params.m_iter; ++iter) { - fit.init(query); + fit.setWeightFunc({query, BaseFitField::params.m_scale}); + fit.init(); if (fit.computeWithIds(points.range_neighbors(query, BaseFitField::params.m_scale), points.points()) == Ponca::STABLE) { postProcess(fit); diff --git a/src/drawingPasses/poncaFitField.h b/src/drawingPasses/poncaFitField.h index 78b51ec..bdabfdd 100644 --- a/src/drawingPasses/poncaFitField.h +++ b/src/drawingPasses/poncaFitField.h @@ -10,7 +10,6 @@ struct FitField : public BaseFitField { ~FitField() override = default; using FitType = _FitType; - using WeightFunc = typename FitType::WeightFunction; /// Method called at the end of the fitting process, only for stable fits virtual void postProcess(FitType& /*fit*/){}; @@ -37,10 +36,10 @@ struct FitField : public BaseFitField { FitType fit; // Set a weighting function instance - fit.setWeightFunc(WeightFunc(params.m_scale)); + fit.setWeightFunc({query, params.m_scale}); // Set the evaluation position for (int iter = 0; iter != params.m_iter; ++iter) { - fit.init(query); + fit.init(); // Fit plane (method compute handles multipass fitting if (fit.computeWithIds(points.range_neighbors(query, params.m_scale), points.points()) == Ponca::STABLE) { @@ -82,14 +81,14 @@ struct FitField : public BaseFitField { do { FitType fit; // Set a weighting function instance - fit.setWeightFunc(WeightFunc(params.m_scale)); + fit.setWeightFunc({x, params.m_scale}); // Set the evaluation position for (int iter = 0; iter != params.m_iter; ++iter) { x = nextx; // project to next location and draw - fit.init(x); + fit.init(); if (fit.computeWithIds(points.range_neighbors(x, params.m_scale), points.points()) == Ponca::STABLE) { postProcess(fit); From 2bc01200aac2ada93eb124a19cac915da67fba4d Mon Sep 17 00:00:00 2001 From: Meca Date: Fri, 21 Nov 2025 15:28:04 +0100 Subject: [PATCH 2/8] Update Ponca to v1.4 Signed-off-by: fauberva --- external/ponca | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/ponca b/external/ponca index aa50bfd..40f245e 160000 --- a/external/ponca +++ b/external/ponca @@ -1 +1 @@ -Subproject commit aa50bfdf187919869239c5b44b748842569114c1 +Subproject commit 40f245e28b920cbb763a1c6282156c87c626f24c From 69531909f1f7bec80fa63233ffca61c7dea61ec7 Mon Sep 17 00:00:00 2001 From: fauberva Date: Wed, 26 Nov 2025 10:31:35 +0100 Subject: [PATCH 3/8] [nanogui] Removal of deprecated nanogui submodule Signed-off-by: fauberva --- .gitmodules | 3 --- external/nanogui | 1 - 2 files changed, 4 deletions(-) delete mode 160000 external/nanogui diff --git a/.gitmodules b/.gitmodules index 6d1cff1..d06578a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "external/nanogui"] - path = external/nanogui - url = https://github.com/mitsuba-renderer/nanogui.git [submodule "external/ponca"] path = external/ponca url = https://github.com/poncateam/ponca.git diff --git a/external/nanogui b/external/nanogui deleted file mode 160000 index 2ee903c..0000000 --- a/external/nanogui +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2ee903c96480d4aee54542ea3c340c13cc06dc32 From af1e791b71537e0e5d86389aec1bfa6dcfeecba7 Mon Sep 17 00:00:00 2001 From: fauberva Date: Wed, 26 Nov 2025 10:48:58 +0100 Subject: [PATCH 4/8] [nanogui] Add new nanogui submodule Signed-off-by: fauberva --- .gitmodules | 3 +++ external/nanogui | 1 + 2 files changed, 4 insertions(+) create mode 160000 external/nanogui diff --git a/.gitmodules b/.gitmodules index d06578a..66508a3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "external/stb"] path = external/stb url = https://github.com/nothings/stb.git +[submodule "external/nanogui"] + path = external/nanogui + url = https://github.com/mitsuba-renderer/nanogui diff --git a/external/nanogui b/external/nanogui new file mode 160000 index 0000000..adf7620 --- /dev/null +++ b/external/nanogui @@ -0,0 +1 @@ +Subproject commit adf762084b80816c2925d5044c3b61b09ddced09 From 7965ec8833300b3c4afab78b59273756900d3489 Mon Sep 17 00:00:00 2001 From: fauberva Date: Wed, 26 Nov 2025 13:42:39 +0100 Subject: [PATCH 5/8] [nanogui] Update to new nanogui API Signed-off-by: fauberva --- src/application.cpp | 46 +++++++++++++++++++++++++++------------------ src/main.cpp | 2 +- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/application.cpp b/src/application.cpp index 62323e9..be814be 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -57,20 +57,26 @@ namespace poncaplot { Alignment::Middle, 0, 6)); auto *b = new Button(tools, "Open point cloud"); b->set_callback([&] { - auto path = file_dialog( + auto path = file_dialog( this, nanogui::FileDialogType::Open, {{"dat", "Text file x y nx y"}, - {"txt", "Text file x y nx y"}}, false); - std::cout << "Load file from: " << path << std::endl; - m_dataMgr->loadPointCloud(path); + {"txt", "Text file x y nx y"}}); + if (path.empty() || path[0].empty()) { + std::cerr << "Open point cloud error : Received an empty file name" << std::endl; return; + } + std::cout << "Load file from: " << path[0] << std::endl; + m_dataMgr->loadPointCloud(path[0]); pointIdSelector->set_max_value(m_dataMgr->getPointContainer().size() - 1); }); b = new Button(tools, "Save point cloud"); b->set_callback([&] { - auto path = file_dialog( + auto path = file_dialog( this, nanogui::FileDialogType::Save, {{"dat", "Text file x y nx y"}, - {"txt", "Text file x y nx y"}}, true); - std::cout << "Save file to: " << path << std::endl; - m_dataMgr->savePointCloud(path); + {"txt", "Text file x y nx y"}}); + if (path.empty() || path[0].empty()) { + std::cerr << "Save point cloud error : Received an empty file name" << std::endl; return; + } + std::cout << "Save file to: " << path[0] << std::endl; + m_dataMgr->savePointCloud(path[0]); }); b = new Button(tools, "Fit point cloud view"); b->set_callback([&] { @@ -98,23 +104,27 @@ namespace poncaplot { }); b = new Button(tools, "Save image"); b->set_callback([&] { - auto path = file_dialog( - {{"png", "PNG image"}}, true); - if (path.empty()) return; - std::cout << "Save file to: " << path << std::endl; + auto path = file_dialog(this, nanogui::FileDialogType::Save, + {{"png", "PNG image"}}); + if (path.empty() || path[0].empty()) { + std::cerr << "Save image error : Received an empty file name" << std::endl; return; + } + std::cout << "Save file to: " << path[0] << std::endl; size_t factor = 2; float *texture = new float[factor * tex_width * tex_height * 4]; renderPassesInternal(factor, texture); - write_image(tex_width*factor, tex_height*factor, texture, path); + write_image(tex_width*factor, tex_height*factor, texture, path[0]); delete [] (texture); }); b = new Button(tools, "Save sequence (scale)"); b->set_callback([&] { - auto path = file_dialog( - {{"", "basename"}}, true); - if (path.empty()) return; - std::cout << "Save sequence to: " << path << std::endl; + auto path = file_dialog( this, nanogui::FileDialogType::Save, + {{"", "basename"}}); + if (path.empty() || path[0].empty()) { + std::cerr << "Save sequence (scale) error : Received an empty file name" << std::endl; return; + } + std::cout << "Save sequence to: " << path[0] << std::endl; size_t factor = 2; float *texture = new float[factor * tex_width * tex_height * 4]; @@ -126,7 +136,7 @@ namespace poncaplot { { scaleSlider->callback()(float(start+i)); std::ostringstream oss; - oss << path << std::setfill('0') << std::setw(4) << i << ".png"; + oss << path[0] << std::setfill('0') << std::setw(4) << i << ".png"; renderPassesInternal(factor, texture); write_image(tex_width*factor, tex_height*factor, texture, oss.str()); } diff --git a/src/main.cpp b/src/main.cpp index 1a6d1a5..74a0f71 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ int main(int argc , char ** argv) { app->dec_ref(); app->draw_all(); app->set_visible(true); - nanogui::mainloop(1 / 10.f * 1000); + nanogui::run(nanogui::RunMode::VSync); } nanogui::shutdown(); From 57fe287517795823e7f8425a843395bdc4166f10 Mon Sep 17 00:00:00 2001 From: fauberva Date: Wed, 26 Nov 2025 14:04:22 +0100 Subject: [PATCH 6/8] Adding dependencies for nanogui Signed-off-by: fauberva --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 6250cf0..d6a2edd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Install nanogui dependencies (ubuntu) - run: sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev + run: sudo apt-get update && sudo apt-get install cmake xorg-dev libglu1-mesa-dev libwayland-dev libdbus-1-dev libxkbcommon-dev if: matrix.os == 'ubuntu-latest' - uses: actions/checkout@v3 From a332d3534acc0e02774df2ce9edb7e7587e62734 Mon Sep 17 00:00:00 2001 From: Nicolas Mellado Date: Wed, 3 Dec 2025 11:29:14 -0500 Subject: [PATCH 7/8] Update STB dependency --- external/stb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/stb b/external/stb index f4a71b1..f1c79c0 160000 --- a/external/stb +++ b/external/stb @@ -1 +1 @@ -Subproject commit f4a71b13373436a2866c5d68f8f80ac6f0bc1ffe +Subproject commit f1c79c02822848a9bed4315b12c8c8f3761e1296 From eb7fa4d86942f2e5e767b447356e27e18cf20f81 Mon Sep 17 00:00:00 2001 From: Nicolas Mellado Date: Wed, 3 Dec 2025 11:29:38 -0500 Subject: [PATCH 8/8] Increase cmake_minimum_required to 3.10 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a540c0..14d3ba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.10.0) project("PoncaPlot")