2023-12-23 12:52:36 -08:00
|
|
|
// Vertex shader
|
2023-12-23 11:01:27 -08:00
|
|
|
struct InstanceInput {
|
2023-12-23 14:07:12 -08:00
|
|
|
@location(2) position: vec2<f32>,
|
2023-12-23 11:01:27 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct VertexOutput {
|
|
|
|
@builtin(position) clip_position: vec4<f32>,
|
|
|
|
}
|
|
|
|
|
|
|
|
@vertex
|
|
|
|
fn vertex_shader_main(
|
|
|
|
instance: InstanceInput,
|
|
|
|
) -> VertexOutput {
|
2023-12-23 12:52:36 -08:00
|
|
|
// Stars consist of only one vertex, so we don't need to pass a buffer into this shader.
|
|
|
|
// We need one instance per star, and that's it!
|
2023-12-23 11:01:27 -08:00
|
|
|
var out: VertexOutput;
|
2023-12-23 14:07:12 -08:00
|
|
|
out.clip_position = vec4<f32>(instance.position, 0.0, 1.0);
|
2023-12-23 11:01:27 -08:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2023-12-23 12:52:36 -08:00
|
|
|
// Fragment shader
|
2023-12-23 11:01:27 -08:00
|
|
|
@fragment
|
|
|
|
fn fragment_shader_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
|
|
|
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
|
|
|
}
|