1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
struct _transform_Input {
@location(0) position: vec3<f32>,
@location(1) normal: vec3<f32>,
@location(2) uv: vec2<f32>,
}
struct _transform_Output {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
@location(1) normal: vec3<f32>,
}
struct Uniforms {
model: mat4x4<f32>,
view_proj: mat4x4<f32>,
normal_mat: mat4x4<f32>,
}
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn transform(input: _transform_Input) -> _transform_Output {
var __luma_output: _transform_Output;
let pos = input.position;
let world_pos = (uniforms.model * vec4<f32>(pos, 1.0));
let clip_pos = (uniforms.view_proj * world_pos);
__luma_output.position = clip_pos;
__luma_output.uv = input.uv;
__luma_output.normal = normalize((uniforms.normal_mat * vec4<f32>(input.normal, 0.0)).xyz);
return __luma_output;
}