@@ -20,7 +20,7 @@ use gltf::{
2020 Primitive ,
2121} ;
2222use image:: { GenericImageView , ImageFormat } ;
23- use std:: { borrow :: Cow , path:: Path } ;
23+ use std:: path:: Path ;
2424use thiserror:: Error ;
2525
2626/// An error that occurs when loading a GLTF file
@@ -90,28 +90,25 @@ async fn load_gltf<'a, 'b>(
9090 . read_positions ( )
9191 . map ( |v| VertexAttributeValues :: Float3 ( v. collect ( ) ) )
9292 {
93- mesh. attributes
94- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_POSITION ) , vertex_attribute) ;
93+ mesh. set_attribute ( Mesh :: ATTRIBUTE_POSITION , vertex_attribute) ;
9594 }
9695
9796 if let Some ( vertex_attribute) = reader
9897 . read_normals ( )
9998 . map ( |v| VertexAttributeValues :: Float3 ( v. collect ( ) ) )
10099 {
101- mesh. attributes
102- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_NORMAL ) , vertex_attribute) ;
100+ mesh. set_attribute ( Mesh :: ATTRIBUTE_NORMAL , vertex_attribute) ;
103101 }
104102
105103 if let Some ( vertex_attribute) = reader
106104 . read_tex_coords ( 0 )
107105 . map ( |v| VertexAttributeValues :: Float2 ( v. into_f32 ( ) . collect ( ) ) )
108106 {
109- mesh. attributes
110- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_UV_0 ) , vertex_attribute) ;
107+ mesh. set_attribute ( Mesh :: ATTRIBUTE_UV_0 , vertex_attribute) ;
111108 }
112109
113110 if let Some ( indices) = reader. read_indices ( ) {
114- mesh. indices = Some ( Indices :: U32 ( indices. into_u32 ( ) . collect ( ) ) ) ;
111+ mesh. set_indices ( Some ( Indices :: U32 ( indices. into_u32 ( ) . collect ( ) ) ) ) ;
115112 } ;
116113
117114 load_context. set_labeled_asset ( & primitive_label, LoadedAsset :: new ( mesh) ) ;
0 commit comments