Fix panic if mesh has unused vertex indices.

This commit is contained in:
Robin KAY 2023-03-31 20:09:54 +01:00
parent 8dac08d7a5
commit 5d49ad8f3c
1 changed files with 7 additions and 1 deletions

View File

@ -86,7 +86,13 @@ impl OutlineMeshExt for Mesh {
let mut outlines = Vec::with_capacity(positions.len());
for p in positions.iter() {
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(
ATTRIBUTE_OUTLINE_NORMAL,