Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.
1#import bevy_pbr::mesh_view_types
2#import bevy_pbr::mesh_types
4@group(0) @binding(0)
5var<uniform> view: View;
7@group(1) @binding(0)
8var<uniform> mesh: Mesh;
10#ifdef SKINNED
11@group(1) @binding(1)
12var<uniform> joint_matrices: SkinnedMesh;
13#import bevy_pbr::skinning
14#endif
16// NOTE: Bindings must come before functions that use them!
17#import bevy_pbr::mesh_functions
19struct Vertex {
20 @location(0) position: vec3<f32>,
21#ifdef SKINNED
22 @location(4) joint_indices: vec4<u32>,
23 @location(5) joint_weights: vec4<f32>,
24#endif
25};
27struct VertexOutput {
28 @builtin(position) clip_position: vec4<f32>,
29};
31@vertex
32fn vertex(vertex: Vertex) -> VertexOutput {
33#ifdef SKINNED
34 let model = skin_model(vertex.joint_indices, vertex.joint_weights);
35#else
36 let model = mesh.model;
37#endif
39 var out: VertexOutput;
40 out.clip_position = mesh_position_local_to_clip(model, vec4<f32>(vertex.position, 1.0));
41 return out;
Contents