2021-05-18 09:24:18 +00:00
|
|
|
struct Uniforms {
|
2022-03-28 14:31:22 +00:00
|
|
|
modelViewProjectionMatrix : mat4x4<f32>,
|
2022-01-19 18:11:17 +00:00
|
|
|
}
|
2021-05-18 09:24:18 +00:00
|
|
|
|
2022-01-19 22:46:57 +00:00
|
|
|
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
2021-05-18 09:24:18 +00:00
|
|
|
|
|
|
|
struct VertexInput {
|
2022-01-19 22:46:57 +00:00
|
|
|
@location(0)
|
2022-03-28 14:31:22 +00:00
|
|
|
cur_position : vec4<f32>,
|
2022-01-19 22:46:57 +00:00
|
|
|
@location(1)
|
2022-03-28 14:31:22 +00:00
|
|
|
color : vec4<f32>,
|
2022-01-19 18:11:17 +00:00
|
|
|
}
|
2021-05-18 09:24:18 +00:00
|
|
|
|
|
|
|
struct VertexOutput {
|
2022-01-19 22:46:57 +00:00
|
|
|
@location(0)
|
2022-03-28 14:31:22 +00:00
|
|
|
vtxFragColor : vec4<f32>,
|
2022-01-19 22:46:57 +00:00
|
|
|
@builtin(position)
|
2022-03-28 14:31:22 +00:00
|
|
|
Position : vec4<f32>,
|
2022-01-19 18:11:17 +00:00
|
|
|
}
|
2021-05-18 09:24:18 +00:00
|
|
|
|
2022-01-19 22:46:57 +00:00
|
|
|
@stage(vertex)
|
2021-05-18 09:24:18 +00:00
|
|
|
fn vtx_main(input : VertexInput) -> VertexOutput {
|
|
|
|
var output : VertexOutput;
|
|
|
|
output.Position = (uniforms.modelViewProjectionMatrix * input.cur_position);
|
|
|
|
output.vtxFragColor = input.color;
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2022-01-19 22:46:57 +00:00
|
|
|
@stage(fragment)
|
|
|
|
fn frag_main(@location(0) fragColor : vec4<f32>) -> @location(0) vec4<f32> {
|
2021-05-18 09:24:18 +00:00
|
|
|
return fragColor;
|
|
|
|
}
|