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
41
42
43
44
45
46
47
@id(0) override NUM_LIGHTS: i32 = 4;
@id(1) override BRIGHTNESS: f32 = 1.0;
@id(2) override USE_GAMMA: bool = true;
struct _vs_main_Input {
@location(0) position: vec3<f32>,
}
struct VertexOutput {
@builtin(position) position: vec4<f32>,
}
struct _fs_main_Input {
@location(0) frag_coord: vec4<f32>,
}
struct _fs_main_Output {
@location(0) color: vec4<f32>,
}
struct Uniforms {
base_color: vec3<f32>,
ambient: f32,
}
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn vs_main(input: _vs_main_Input) -> VertexOutput {
var __luma_output: VertexOutput;
__luma_output.position = vec4<f32>(input.position, 1.0);
return __luma_output;
}
@fragment
fn fs_main(input: _fs_main_Input) -> _fs_main_Output {
var __luma_output: _fs_main_Output;
let color = (uniforms.base_color * uniforms.ambient);
let i = 0;
while ((i < NUM_LIGHTS)) {
color = (color + vec3<f32>(0.1, 0.1, 0.1));
i = (i + 1);
}
color = (color * BRIGHTNESS);
__luma_output.color = vec4<f32>(color, 1.0);
return __luma_output;
}