Basic fog lighting, refactoring
This commit is contained in:
parent
5a8dec8d02
commit
1c0b9aa63f
10 changed files with 203 additions and 124 deletions
26
res/shaders/light_debug.wgsl
Normal file
26
res/shaders/light_debug.wgsl
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include globals.wgsl
|
||||
|
||||
struct LightVertexInput {
|
||||
@location(0) position: vec3<f32>,
|
||||
};
|
||||
|
||||
struct LightVertexOutput {
|
||||
@builtin(position) clip_position: vec4<f32>,
|
||||
@location(0) color: vec3<f32>,
|
||||
};
|
||||
|
||||
@vertex
|
||||
fn vs_main(
|
||||
model: LightVertexInput,
|
||||
) -> LightVertexOutput {
|
||||
let scale = 10.0;
|
||||
var out: LightVertexOutput;
|
||||
out.clip_position = camera.proj * camera.view * vec4<f32>(model.position * scale + light.position, 1.0);
|
||||
out.color = light.color.xyz;
|
||||
return out;
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fs_main(in: LightVertexOutput) -> @location(0) vec4<f32> {
|
||||
return vec4<f32>(in.color, 1.0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue