examples: add textured-cube example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
f8e7f96a4a
commit
d0d0db8725
6 changed files with 383 additions and 7 deletions
20
examples/textured-cube/vert.wgsl
Normal file
20
examples/textured-cube/vert.wgsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
struct Uniforms {
|
||||
modelViewProjectionMatrix : mat4x4<f32>;
|
||||
};
|
||||
@binding(0) @group(0) var<uniform> uniforms : Uniforms;
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) Position : vec4<f32>;
|
||||
@location(0) fragUV : vec2<f32>;
|
||||
@location(1) fragPosition: vec4<f32>;
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
fn main(@location(0) position : vec4<f32>,
|
||||
@location(1) uv : vec2<f32>) -> VertexOutput {
|
||||
var output : VertexOutput;
|
||||
output.Position = position * uniforms.modelViewProjectionMatrix;
|
||||
output.fragUV = uv;
|
||||
output.fragPosition = 0.5 * (position + vec4<f32>(1.0, 1.0, 1.0, 1.0));
|
||||
return output;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue