@@ -62,7 +62,7 @@ fn main() {
62
62
#[ derive( Copy , Clone , Debug , bytemuck:: Pod , bytemuck:: Zeroable ) ]
63
63
struct Vertex {
64
64
position : [ f32 ; 3 ] ,
65
- color : [ f32 ; 3 ] ,
65
+ tex_coords : [ f32 ; 2 ] ,
66
66
}
67
67
68
68
impl Vertex {
@@ -79,21 +79,22 @@ impl Vertex {
79
79
wgpu:: VertexAttribute {
80
80
offset : std:: mem:: size_of :: < [ f32 ; 3 ] > ( ) as wgpu:: BufferAddress ,
81
81
shader_location : 1 ,
82
- format : wgpu:: VertexFormat :: Float32x3 ,
82
+ format : wgpu:: VertexFormat :: Float32x2 ,
83
83
}
84
84
]
85
85
}
86
86
}
87
87
}
88
88
89
89
const VERTICES : & [ Vertex ] = & [
90
- Vertex { position : [ -0.0868241 , 0.49240386 , 0.0 ] , color : [ 0.5 , 0.0 , 0.5 ] } , // A
91
- Vertex { position : [ -0.49513406 , 0.06958647 , 0.0 ] , color : [ 0.5 , 0.0 , 0.5 ] } , // B
92
- Vertex { position : [ -0.21918549 , -0.44939706 , 0.0 ] , color : [ 0.5 , 0.0 , 0.5 ] } , // C
93
- Vertex { position : [ 0.35966998 , -0.3473291 , 0.0 ] , color : [ 0.5 , 0.0 , 0.5 ] } , // D
94
- Vertex { position : [ 0.44147372 , 0.2347359 , 0.0 ] , color : [ 0.5 , 0.0 , 0.5 ] } , // E
90
+ Vertex { position : [ -0.0868241 , 0.49240386 , 0.0 ] , tex_coords : [ 0.4131759 , 0.99240386 ] , } , // A
91
+ Vertex { position : [ -0.49513406 , 0.06958647 , 0.0 ] , tex_coords : [ 0.0048659444 , 0.56958646 ] , } , // B
92
+ Vertex { position : [ -0.21918549 , -0.44939706 , 0.0 ] , tex_coords : [ 0.28081453 , 0.050602943 ] , } , // C
93
+ Vertex { position : [ 0.35966998 , -0.3473291 , 0.0 ] , tex_coords : [ 0.85967 , 0.15267089 ] , } , // D
94
+ Vertex { position : [ 0.44147372 , 0.2347359 , 0.0 ] , tex_coords : [ 0.9414737 , 0.7347359 ] , } , // E
95
95
] ;
96
96
97
+
97
98
const INDICES : & [ u16 ] = & [
98
99
0 , 1 , 4 ,
99
100
1 , 2 , 4 ,
@@ -153,7 +154,7 @@ impl State {
153
154
154
155
let diffuse_bytes = include_bytes ! ( "happy-tree.png" ) ;
155
156
let diffuse_image = image:: load_from_memory ( diffuse_bytes) . unwrap ( ) ;
156
- let diffuse_rgba = diffuse_image. as_bgra8 ( ) . unwrap ( ) ;
157
+ let diffuse_rgba = diffuse_image. as_rgba8 ( ) . unwrap ( ) ;
157
158
158
159
use image:: GenericImageView ;
159
160
let dimensions = diffuse_image. dimensions ( ) ;
0 commit comments