From d8286c76afe859e084c2d45677424d7ae32ad2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Lescaudey=20de=20Maneville?= Date: Sun, 18 Feb 2024 11:39:25 +0100 Subject: [PATCH] Fixes --- src/components/cloth_builder.rs | 7 ++++--- src/components/cloth_rendering.rs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/cloth_builder.rs b/src/components/cloth_builder.rs index 8ded66d..f04e420 100644 --- a/src/components/cloth_builder.rs +++ b/src/components/cloth_builder.rs @@ -331,14 +331,15 @@ impl ClothBuilder { mesh.attribute(Mesh::ATTRIBUTE_COLOR) .and_then(|attr| match attr { VertexAttributeValues::Float32x3(v) => { - Some(v.iter().copied().map(Color::from).collect()) + Some(v.iter().copied().map(Color::rgb_from_array).collect()) } VertexAttributeValues::Float32x4(v) => { - Some(v.iter().copied().map(Color::from).collect()) + Some(v.iter().copied().map(Color::rgba_from_array).collect()) } VertexAttributeValues::Uint8x4(v) => Some( v.iter() - .map(|c| Color::rgba_u8(c[0], c[1], c[2], c[3])) + .copied() + .map(|[r, g, b, a]| Color::rgba_u8(r, g, b, a)) .collect(), ), _ => None, diff --git a/src/components/cloth_rendering.rs b/src/components/cloth_rendering.rs index 3672432..c7a3a08 100644 --- a/src/components/cloth_rendering.rs +++ b/src/components/cloth_rendering.rs @@ -265,7 +265,7 @@ impl ClothRendering { Mesh::ATTRIBUTE_NORMAL, Self::vec3_vertex_attr(&vertex_normals), ); - mesh.set_indices(Some(Indices::U32(new_self.indices))); + mesh.insert_indices(Indices::U32(new_self.indices)); } } }