Skip to content

Commit 8f1eaa6

Browse files
Julian HeinkenJulian Heinken
authored andcommitted
glTF: added color attribute support (#1775)
1 parent 0fce6f0 commit 8f1eaa6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/bevy_gltf/src/loader.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ async fn load_gltf<'a, 'b>(
142142
mesh.set_attribute(Mesh::ATTRIBUTE_UV_0, vertex_attribute);
143143
}
144144

145+
if let Some(vertex_attribute) = reader
146+
.read_colors(0)
147+
.map(|v| VertexAttributeValues::Float4(v.into_rgba_f32().collect()))
148+
{
149+
mesh.set_attribute(Mesh::ATTRIBUTE_COLOR, vertex_attribute);
150+
}
151+
145152
if let Some(indices) = reader.read_indices() {
146153
mesh.set_indices(Some(Indices::U32(indices.into_u32().collect())));
147154
};

0 commit comments

Comments
 (0)