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_functions::{get_world_from_local, mesh_position_local_to_clip}
3struct CustomMaterial {
4 color: vec4<f32>,
5};
6@group(2) @binding(0) var<uniform> material: CustomMaterial;
8struct Vertex {
9 @builtin(instance_index) instance_index: u32,
10 @location(0) position: vec3<f32>,
11 @location(1) blend_color: vec4<f32>,
12};
14struct VertexOutput {
15 @builtin(position) clip_position: vec4<f32>,
16 @location(0) blend_color: vec4<f32>,
17};
19@vertex
20fn vertex(vertex: Vertex) -> VertexOutput {
21 var out: VertexOutput;
22 out.clip_position = mesh_position_local_to_clip(
23 get_world_from_local(vertex.instance_index),
24 vec4<f32>(vertex.position, 1.0),
25 );
26 out.blend_color = vertex.blend_color;
27 return out;
30struct FragmentInput {
31 @location(0) blend_color: vec4<f32>,
32};
34@fragment
35fn fragment(input: FragmentInput) -> @location(0) vec4<f32> {
36 return material.color * input.blend_color;
Contents