src/core: move mach-core@9a4d09707d9f1cb6ea5602bdf58caeefc46146be package to here
Helps hexops/mach#1165 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
fa3f6161ad
commit
38f296ecce
157 changed files with 28383 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
struct Uniforms {
|
||||
modelMatrix : mat4x4<f32>,
|
||||
normalModelMatrix : mat4x4<f32>,
|
||||
}
|
||||
struct Camera {
|
||||
viewProjectionMatrix : mat4x4<f32>,
|
||||
invViewProjectionMatrix : mat4x4<f32>,
|
||||
}
|
||||
@group(0) @binding(0) var<uniform> uniforms : Uniforms;
|
||||
@group(0) @binding(1) var<uniform> camera : Camera;
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) Position : vec4<f32>,
|
||||
@location(0) fragNormal: vec3<f32>, // normal in world space
|
||||
@location(1) fragUV: vec2<f32>,
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn main(
|
||||
@location(0) position : vec3<f32>,
|
||||
@location(1) normal : vec3<f32>,
|
||||
@location(2) uv : vec2<f32>
|
||||
) -> VertexOutput {
|
||||
var output : VertexOutput;
|
||||
let worldPosition = (uniforms.modelMatrix * vec4(position, 1.0)).xyz;
|
||||
output.Position = camera.viewProjectionMatrix * vec4(worldPosition, 1.0);
|
||||
output.fragNormal = normalize((uniforms.normalModelMatrix * vec4(normal, 1.0)).xyz);
|
||||
output.fragUV = uv;
|
||||
return output;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue