// Shadow depth pass — renders geometry from the light's perspective.
//
// Only outputs depth (no colour attachment). Used for both fill-extrusion
// and model shadow casters. The per-cascade light VP matrix is provided
// via the uniform.
struct ShadowUniforms {
light_view_proj: mat4x4<f32>,
};
@group(0) @binding(0)
var<uniform> shadow: ShadowUniforms;
// -- Fill-extrusion shadow caster ------------------------------------------
struct FillExtrusionVertexInput {
@location(0) position: vec3<f32>,
@location(1) normal: vec3<f32>,
@location(2) color: vec4<f32>,
};
@vertex
fn vs_fill_extrusion(in: FillExtrusionVertexInput) -> @builtin(position) vec4<f32> {
return shadow.light_view_proj * vec4<f32>(in.position, 1.0);
}
// -- Model shadow caster ---------------------------------------------------
struct ModelVertexInput {
@location(0) position: vec3<f32>,
@location(1) normal: vec3<f32>,
@location(2) uv: vec2<f32>,
};
@group(1) @binding(0)
var<uniform> model_transform: mat4x4<f32>;
@vertex
fn vs_model(in: ModelVertexInput) -> @builtin(position) vec4<f32> {
let world_pos = model_transform * vec4<f32>(in.position, 1.0);
return shadow.light_view_proj * world_pos;
}
// No fragment shader needed — depth-only pass.