1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct Uniforms
model: mat4
view_proj: mat4
normal_mat: mat4
end
uniform uniforms: Uniforms
@entry(vertex)
function transform(position: vec3, normal: vec3, uv: vec2) -> (@builtin(position) position: vec4, uv: vec2, normal: vec3)
let pos = position
let world_pos = uniforms.model * vec4(pos, 1.0)
let clip_pos = uniforms.view_proj * world_pos
return _transform_Output {
position = clip_pos,
uv = uv,
normal = normalize((uniforms.normal_mat * vec4(normal, 0.0)).xyz),
}
end