File tree 2 files changed +45
-3
lines changed
2 files changed +45
-3
lines changed Original file line number Diff line number Diff line change
1
+ #import bevy_pbr ::mesh_types
2
+ #import bevy_pbr ::mesh_view_bindings
3
+
4
+ @group (2 ) @binding (0 )
5
+ var <uniform > mesh : Mesh ;
6
+
7
+ #ifdef SKINNED
8
+ @group (2 ) @binding (1 )
9
+ var <uniform > joint_matrices : SkinnedMesh ;
10
+ #import bevy_pbr ::skinning
11
+ #endif
12
+
13
+ // NOTE: Bindings must come before functions that use them!
14
+ #import bevy_pbr ::mesh_functions
15
+
16
+ struct Vertex {
17
+ @location (0 ) position : vec3 <f32 >,
18
+ #ifdef SKINNED
19
+ @location (4 ) joint_indexes : vec4 <u32 >,
20
+ @location (5 ) joint_weights : vec4 <f32 >,
21
+ #endif
22
+ };
23
+
24
+ struct VertexOutput {
25
+ @builtin (position ) clip_position : vec4 <f32 >,
26
+ };
27
+
28
+ @vertex
29
+ fn vertex (vertex : Vertex ) -> VertexOutput {
30
+ #ifdef SKINNED
31
+ let model = skin_model (vertex . joint_indexes, vertex . joint_weights);
32
+ #else
33
+ let model = mesh . model;
34
+ #endif
35
+
36
+ var out : VertexOutput ;
37
+ out . clip_position = mesh_position_local_to_clip (model , vec4 <f32 >(vertex . position, 1.0 ));
38
+ return out ;
39
+ }
40
+
1
41
@fragment
2
- fn fragment (
3
- #import bevy_pbr ::mesh_vertex_output
4
- ) -> @location (0 ) vec4 <f32 > {
42
+ fn fragment () -> @location (0 ) vec4 <f32 > {
5
43
return vec4 <f32 >(1.0 , 1.0 , 1.0 , 1.0 );
6
44
}
Original file line number Diff line number Diff line change @@ -110,6 +110,10 @@ fn apply_global(
110
110
struct WireframeMaterial { }
111
111
112
112
impl Material for WireframeMaterial {
113
+ fn vertex_shader ( ) -> ShaderRef {
114
+ WIREFRAME_SHADER_HANDLE . typed ( ) . into ( )
115
+ }
116
+
113
117
fn fragment_shader ( ) -> ShaderRef {
114
118
WIREFRAME_SHADER_HANDLE . typed ( ) . into ( )
115
119
}
You can’t perform that action at this time.
0 commit comments