Skip to content

Commit

Permalink
glTF: added color attribute support (bevyengine#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Heinken authored and jihiggins committed Apr 18, 2021
1 parent 124a4b0 commit 9c67dde
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 9c67dde

Please sign in to comment.