@@ -20,7 +20,7 @@ use gltf::{
20
20
Primitive ,
21
21
} ;
22
22
use image:: { GenericImageView , ImageFormat } ;
23
- use std:: { borrow :: Cow , path:: Path } ;
23
+ use std:: path:: Path ;
24
24
use thiserror:: Error ;
25
25
26
26
/// An error that occurs when loading a GLTF file
@@ -90,28 +90,25 @@ async fn load_gltf<'a, 'b>(
90
90
. read_positions ( )
91
91
. map ( |v| VertexAttributeValues :: Float3 ( v. collect ( ) ) )
92
92
{
93
- mesh. attributes
94
- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_POSITION ) , vertex_attribute) ;
93
+ mesh. set_attribute ( Mesh :: ATTRIBUTE_POSITION , vertex_attribute) ;
95
94
}
96
95
97
96
if let Some ( vertex_attribute) = reader
98
97
. read_normals ( )
99
98
. map ( |v| VertexAttributeValues :: Float3 ( v. collect ( ) ) )
100
99
{
101
- mesh. attributes
102
- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_NORMAL ) , vertex_attribute) ;
100
+ mesh. set_attribute ( Mesh :: ATTRIBUTE_NORMAL , vertex_attribute) ;
103
101
}
104
102
105
103
if let Some ( vertex_attribute) = reader
106
104
. read_tex_coords ( 0 )
107
105
. map ( |v| VertexAttributeValues :: Float2 ( v. into_f32 ( ) . collect ( ) ) )
108
106
{
109
- mesh. attributes
110
- . insert ( Cow :: Borrowed ( Mesh :: ATTRIBUTE_UV_0 ) , vertex_attribute) ;
107
+ mesh. set_attribute ( Mesh :: ATTRIBUTE_UV_0 , vertex_attribute) ;
111
108
}
112
109
113
110
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 ( ) ) ) ) ;
115
112
} ;
116
113
117
114
load_context. set_labeled_asset ( & primitive_label, LoadedAsset :: new ( mesh) ) ;
0 commit comments