wgpu-renderer/res/shaders/light.wgsl

27 lines
606 B
WebGPU Shading Language
Raw Normal View History

2023-01-29 18:57:29 +02:00
#include globals.wgsl
2022-10-03 22:31:01 +03:00
2023-01-29 18:57:29 +02:00
struct LightVertexInput {
2022-10-03 22:31:01 +03:00
@location(0) position: vec3<f32>,
};
2023-01-29 18:57:29 +02:00
struct LightVertexOutput {
2022-10-03 22:31:01 +03:00
@builtin(position) clip_position: vec4<f32>,
@location(0) color: vec3<f32>,
};
@vertex
fn vs_main(
2023-01-29 18:57:29 +02:00
model: LightVertexInput,
) -> LightVertexOutput {
let scale = 10.0;
2023-01-29 18:57:29 +02:00
var out: LightVertexOutput;
2022-10-03 22:31:01 +03:00
out.clip_position = camera.proj * camera.view * vec4<f32>(model.position * scale + light.position, 1.0);
2023-01-29 18:57:29 +02:00
out.color = light.color.xyz;
2022-10-03 22:31:01 +03:00
return out;
}
@fragment
2023-01-29 18:57:29 +02:00
fn fs_main(in: LightVertexOutput) -> @location(0) vec4<f32> {
2022-10-03 22:31:01 +03:00
return vec4<f32>(in.color, 1.0);
}