diff options
| author | Micha White <botahamec@outlook.com> | 2022-09-18 15:30:56 -0400 |
|---|---|---|
| committer | Micha White <botahamec@outlook.com> | 2022-09-18 15:30:56 -0400 |
| commit | d613b20803f41eeb4f6ae27003d5bfa371502930 (patch) | |
| tree | 233f1906d0150b4fce80af3fb63dceeb70f308da /shaders | |
| parent | ffee09ada476b3a350f331718d60fa806b564bad (diff) | |
Created a vertex buffer
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/sprite.wgsl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/shaders/sprite.wgsl b/shaders/sprite.wgsl index 7d2c5ce..d126cae 100644 --- a/shaders/sprite.wgsl +++ b/shaders/sprite.wgsl @@ -1,14 +1,16 @@ +struct VertexInput { + @location(0) position: vec2<f32> +} + struct VertexOutput { @builtin(position) clip_position: vec4<f32> } @vertex -fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> VertexOutput { +fn vs_main(model: VertexInput) -> VertexOutput { var out: VertexOutput; - let x = (1.0 * f32(in_vertex_index % u32(2))) + -0.5; - let y = (1.0 * f32(in_vertex_index / u32(2))) + -0.5; - out.clip_position = vec4<f32>(x, y, 0.0, 1.0); + out.clip_position = vec4<f32>(model.position, 0.0, 1.0); return out; } |
