Fix panic if mesh has unused vertex indices.
This commit is contained in:
parent
8dac08d7a5
commit
5d49ad8f3c
@ -86,7 +86,13 @@ impl OutlineMeshExt for Mesh {
|
|||||||
let mut outlines = Vec::with_capacity(positions.len());
|
let mut outlines = Vec::with_capacity(positions.len());
|
||||||
for p in positions.iter() {
|
for p in positions.iter() {
|
||||||
let key = [FloatOrd(p[0]), FloatOrd(p[1]), FloatOrd(p[2])];
|
let key = [FloatOrd(p[0]), FloatOrd(p[1]), FloatOrd(p[2])];
|
||||||
outlines.push(map.get(&key).unwrap().normalize_or_zero().to_array());
|
outlines.push(
|
||||||
|
map.get(&key)
|
||||||
|
.copied()
|
||||||
|
.unwrap_or(Vec3::ZERO)
|
||||||
|
.normalize_or_zero()
|
||||||
|
.to_array(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
self.insert_attribute(
|
self.insert_attribute(
|
||||||
ATTRIBUTE_OUTLINE_NORMAL,
|
ATTRIBUTE_OUTLINE_NORMAL,
|
||||||
|
Loading…
Reference in New Issue
Block a user