From e0af8462c38ddc7d8a3498467e24324513f72bb3 Mon Sep 17 00:00:00 2001 From: MelchiorSchuh Date: Thu, 4 Jun 2026 15:10:13 +0200 Subject: [PATCH] fix(PolyAroundVertex): Fixed issue where cached value contained nothing but was not updated --- include/geode/basic/cached_value.hpp | 2 +- src/geode/mesh/core/solid_mesh.cpp | 1 + src/geode/mesh/core/surface_mesh.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/geode/basic/cached_value.hpp b/include/geode/basic/cached_value.hpp index d5fb4a3b9..f17648c8a 100644 --- a/include/geode/basic/cached_value.hpp +++ b/include/geode/basic/cached_value.hpp @@ -93,7 +93,7 @@ namespace geode return false; } - void reset() + void reset() const { computed_ = false; } diff --git a/src/geode/mesh/core/solid_mesh.cpp b/src/geode/mesh/core/solid_mesh.cpp index ca65f1aed..c5a06d876 100644 --- a/src/geode/mesh/core/solid_mesh.cpp +++ b/src/geode/mesh/core/solid_mesh.cpp @@ -699,6 +699,7 @@ namespace geode { return cached.value(); } + cached.reset(); cached( compute_polyhedra_around_vertex, mesh, vertex_id, first_polyhedron ); return cached.value(); diff --git a/src/geode/mesh/core/surface_mesh.cpp b/src/geode/mesh/core/surface_mesh.cpp index 6ec4f1a06..465292ae0 100644 --- a/src/geode/mesh/core/surface_mesh.cpp +++ b/src/geode/mesh/core/surface_mesh.cpp @@ -537,13 +537,13 @@ namespace geode const std::optional< PolygonVertex >& first_polygon ) const { const auto& cached = polygons_around_vertex_->value( vertex_id ); - if( cached.computed() - && ( first_polygon - && absl::c_contains( - cached.value().polygons, first_polygon.value() ) ) ) + if( cached.computed() && first_polygon + && absl::c_contains( + cached.value().polygons, first_polygon.value() ) ) { return cached.value(); } + cached.reset(); cached( compute_polygons_around_vertex, mesh, vertex_id, first_polygon ); return cached.value();