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
32
33
34
35
36
37
38
39
40
struct MaterialUniform {
base_colour: vec4<f32>,
metallic: f32,
roughness: f32,
normal_scale: f32,
emissive_factor: vec3<f32>,
emissive_strength: f32,
occlusion_strength: f32,
uv_tiling: vec2<f32>,
uv_offset: vec2<f32>,
alpha_cutoff: f32,
alpha_mode: u32,
has_normal_texture: u32,
has_emissive_texture: u32,
has_metallic_texture: u32,
has_occlusion_texture: u32,
}
const ALPHAMODE_OPAQUE: u32 = 1;
const ALPHAMODE_MASK: u32 = 2;
const ALPHAMODE_BLEND: u32 = 3;
@group(1) @binding(0) var<uniform> u_material: MaterialUniform;
@group(1) @binding(1) var t_diffuse: texture_2d<f32>;
@group(1) @binding(2) var s_diffuse: sampler;
@group(1) @binding(3) var t_normal: texture_2d<f32>;
@group(1) @binding(4) var s_normal: sampler;
@group(1) @binding(5) var t_emissive: texture_2d<f32>;
@group(1) @binding(6) var s_emissive: sampler;
@group(1) @binding(7) var t_metallic: texture_2d<f32>;
@group(1) @binding(8) var s_metallic: sampler;
@group(1) @binding(9) var t_occlusion: texture_2d<f32>;
@group(1) @binding(10) var s_occlusion: sampler;