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
struct _fs_main_Input {
@location(0) uv: vec2<f32>,
@location(1) shadow_uv: vec2<f32>,
}
struct _fs_main_Output {
@location(0) _value: vec4<f32>,
}
struct Params {
bias: f32,
}
@group(0) @binding(0) var<uniform> params: Params;
@group(0) @binding(0) var diffuse_tex_tex: texture_2d<f32>;
@group(0) @binding(1) var diffuse_tex_samp: sampler;
@group(0) @binding(2) var shadow_map_tex: texture_2d<f32>;
@group(0) @binding(3) var shadow_map_samp: sampler;
@fragment
fn fs_main(input: _fs_main_Input) -> _fs_main_Output {
var __luma_output: _fs_main_Output;
let mip_color = textureSampleLevel(diffuse_tex_tex, diffuse_tex_samp, input.uv, params.bias);
let shadow = textureSampleCompare(shadow_map_tex, shadow_map_samp, input.shadow_uv, 0.5);
__luma_output._value = vec4<f32>((mip_color.rgb * shadow), mip_color.a);
return __luma_output;
}