forked from 1b-agent/opencadstudio-upstream
fix: render each transformed wipeout/hatch mask with own boundary instead of sharing source-id GPU batches
This commit is contained in:
1 parent
9e8d07270e
commit
72e97c6f60
1 file changed
+10
-17
@@ -172,23 +172,16 @@ impl WipeoutGpu {
|
|||||||
models: &[HatchModel],
|
models: &[HatchModel],
|
||||||
bgl1: &wgpu::BindGroupLayout,
|
bgl1: &wgpu::BindGroupLayout,
|
||||||
) -> Vec<Self> {
|
) -> Vec<Self> {
|
||||||
let mut slots = rustc_hash::FxHashMap::default();
|
// A source_id only identifies reusable render geometry, not an
|
||||||
let mut groups: Vec<Vec<&HatchModel>> = Vec::new();
|
// interchangeable hatch boundary in world space. Grouping masks by
|
||||||
for (index, model) in models.iter().enumerate() {
|
// source_id can incorrectly reuse the first model's boundary, origin,
|
||||||
let key = model
|
// plane and uniform for later INSERT copies. Unlike wires, a mask's
|
||||||
.render_instance
|
// GPU shader clips against its own boundary, so build each mask from
|
||||||
.map(|instance| (true, instance.source_id))
|
// its actual transformed model until we have a geometry-local,
|
||||||
.unwrap_or((false, index as u64));
|
// translation-safe instancing path.
|
||||||
let slot = *slots.entry(key).or_insert_with(|| {
|
models
|
||||||
let slot = groups.len();
|
.iter()
|
||||||
groups.push(Vec::new());
|
.map(|model| Self::new(device, queue, &[*model], bgl1))
|
||||||
slot
|
|
||||||
});
|
|
||||||
groups[slot].push(model);
|
|
||||||
}
|
|
||||||
groups
|
|
||||||
.into_iter()
|
|
||||||
.map(|group| Self::new(device, queue, &group, bgl1))
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user