mirror of
https://github.com/guilhermewerner/wgpu-renderer
synced 2025-06-15 21:34:21 +00:00
Update project
This commit is contained in:
28
Shaders/Triangle.wgsl
Normal file
28
Shaders/Triangle.wgsl
Normal file
@ -0,0 +1,28 @@
|
||||
// Vertex
|
||||
|
||||
struct VertexInput {
|
||||
[[location(0)]] position: vec3<f32>;
|
||||
[[location(1)]] color: vec3<f32>;
|
||||
};
|
||||
|
||||
struct VertexOutput {
|
||||
[[builtin(position)]] clip_position: vec4<f32>;
|
||||
[[location(0)]] color: vec3<f32>;
|
||||
};
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main(
|
||||
model: VertexInput,
|
||||
) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.color = model.color;
|
||||
out.clip_position = vec4<f32>(model.position, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
// Fragment
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main(in: VertexOutput) -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(in.color, 1.0);
|
||||
}
|
Reference in New Issue
Block a user