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();