forked from 1b-agent/opencadstudio-upstream
entity_wires() returns the memoized Arc instead of a per-call deep copy; MESH entities over 50k vertices ship no per-vertex snap/key tables (matching PolyfaceMesh/PolygonMesh); the Face3D/other render split caches a None marker and uses the base set directly when there is no Face3D wire; test fix for the depth-map BlockCache::build signature. Reviewed: correctness sound — wire AABB comes from entity_aabb (not key_vertices) so large meshes stay selectable; snap consumers are empty-guarded; the Arc/strong_count reasoning for try_resident_patch holds. One consistent pre-existing quirk noted (auto_fit_viewport centroid excludes tableless meshes, as Poly*Mesh already do).
This commit is contained in:
commit
1803f10264
6 files changed
+70
-34
No files matched your search
+17
-6
@@ -685,12 +685,23 @@ impl TruckConvertible for Mesh {
|
||||
}
|
||||
}
|
||||
|
||||
let snap_pts: Vec<(glam::DVec3, SnapHint)> = self
|
||||
.vertices
|
||||
.iter()
|
||||
.map(|v| (glam::DVec3::new(v.x, v.y, v.z), SnapHint::Node))
|
||||
.collect();
|
||||
let key_vertices: Vec<[f64; 3]> = self.vertices.iter().map(|v| [v.x, v.y, v.z]).collect();
|
||||
// Per-vertex snap tables cost ~56 B/vertex and are retained in every
|
||||
// copy of the wire set. On NWD-scale imports (#358: tens of millions
|
||||
// of mesh vertices) that is GBs for snap targets far too dense to
|
||||
// pick apart on screen — so past this size ship none, which is what
|
||||
// PolyfaceMesh / PolygonMesh already do at any size.
|
||||
const SNAP_TABLE_MAX_VERTICES: usize = 50_000;
|
||||
let (snap_pts, key_vertices) = if self.vertices.len() > SNAP_TABLE_MAX_VERTICES {
|
||||
(Vec::new(), Vec::new())
|
||||
} else {
|
||||
(
|
||||
self.vertices
|
||||
.iter()
|
||||
.map(|v| (glam::DVec3::new(v.x, v.y, v.z), SnapHint::Node))
|
||||
.collect(),
|
||||
self.vertices.iter().map(|v| [v.x, v.y, v.z]).collect(),
|
||||
)
|
||||
};
|
||||
|
||||
Some(TruckEntity {
|
||||
pick_tris: Vec::new(),
|
||||
|
||||
Reference in new issue
Block a user