forked from 1b-agent/opencadstudio-upstream
fix(render): share repeated block meshes
Keep placement transforms and bounds separate from immutable mesh data to prevent large drawings from exhausting memory or stalling selection.
This commit is contained in:
1 parent
5e773fbcce
commit
7b4af0aa75
6 files changed
+408
-399
No files matched your search
@@ -221,8 +221,12 @@ impl MeshMaterial {
|
||||
}
|
||||
|
||||
pub fn apply_to(&self, set: &mut super::mesh_model::MeshLodSet) {
|
||||
for lod in &mut set.lods {
|
||||
lod.color = self.diffuse;
|
||||
if set.instance_source.is_some() {
|
||||
set.instance_color = Some(self.diffuse);
|
||||
} else {
|
||||
for lod in &mut set.lods {
|
||||
lod.color = self.diffuse;
|
||||
}
|
||||
}
|
||||
set.material = Some(self.clone());
|
||||
}
|
||||
@@ -236,7 +240,7 @@ impl MeshMaterial {
|
||||
self.apply_to(set);
|
||||
set.face_materials.clear();
|
||||
let handles: rustc_hash::FxHashSet<Handle> = set
|
||||
.lods
|
||||
.geometry_lods()
|
||||
.iter()
|
||||
.flat_map(|lod| lod.triangle_material_handles.iter().flatten().copied())
|
||||
.collect();
|
||||
|
||||
Reference in new issue
Block a user