Skip to content

Commit

Permalink
glTF: added color attribute support (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Heinken authored and Julian Heinken committed Apr 13, 2021
1 parent 0fce6f0 commit 8f1eaa6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ async fn load_gltf<'a, 'b>(
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vertex_attribute);
}

if let Some(vertex_attribute) = reader
.read_colors(0)
.map(|v| VertexAttributeValues::Float4(v.into_rgba_f32().collect()))
{
mesh.set_attribute(Mesh::ATTRIBUTE_COLOR, vertex_attribute);
}

if let Some(indices) = reader.read_indices() {
mesh.set_indices(Some(Indices::U32(indices.into_u32().collect())));
};
Expand Down

0 comments on commit 8f1eaa6

Please sign in to comment.