38 lines
764 B
WebGPU Shading Language
38 lines
764 B
WebGPU Shading Language
struct Configuration {
|
|
viewProj: mat4x4f,
|
|
lightViewProj: mat4x4f,
|
|
lightPosition: vec4f,
|
|
eyePosition: vec4f,
|
|
};
|
|
|
|
@group(0) @binding(0) var<uniform> config: Configuration;
|
|
|
|
struct VertexInput {
|
|
@location(0) position: vec3f,
|
|
@location(1) texture: vec2f,
|
|
@location(2) normal: vec4f,
|
|
@location(3) tangent: vec4f,
|
|
};
|
|
|
|
struct VertexOutput {
|
|
@builtin(position) position: vec4f,
|
|
@location(0) texture: vec2f,
|
|
};
|
|
|
|
@vertex
|
|
fn vertexMain(input: VertexInput) -> VertexOutput
|
|
{
|
|
let position = vec4f(input.position, 1);
|
|
|
|
var output: VertexOutput;
|
|
output.position = config.lightViewProj * position;
|
|
output.texture = input.texture;
|
|
return output;
|
|
}
|
|
|
|
@fragment
|
|
fn fragmentMain(input: VertexOutput) -> @location(0) vec4f
|
|
{
|
|
return vec4(1, 1, 1, 1.0);
|
|
}
|