ShadowReceiverUniforms

class ShadowReceiverUniforms(enabled: Boolean, depthBiasMeters: Float = ShadowReceiverGlsl.PRIMITIVE_DEPTH_BIAS_METERS)

The GL uniform-location + upload machinery every ShadowReceiverProgram needs, factored out of the receiver programs (triangle / basic-texture / surface-texture / 3D-Tiles mesh + points) that would each copy-paste the identical field block, init resolution loop, and loadEnabled/loadDisabled bodies. A program owns one instance, resolves it in initProgram, and forwards its interface methods to it (see ShadowReceiverProgram).

enabled mirrors the program's shadowsEnabled flag and gates every method, so the no-shadow program variants stay inert: init skips resolution (locations remain KglUniformLocation.NONE) and the load methods early-return — behaviourally identical to per-program code where the same calls hit NONE locations as silent no-ops.

Constructors

Link copied to clipboard
constructor(enabled: Boolean, depthBiasMeters: Float = ShadowReceiverGlsl.PRIMITIVE_DEPTH_BIAS_METERS)

Properties

Link copied to clipboard

Frame stamp of the last uploaded ShadowState — backs ShadowReceiverProgram.shadowUploadStamp.

Functions

Link copied to clipboard
fun init(gl: Kgl, program: KglProgram)

Resolve the receiver uniforms and seed their defaults. Call from the owning program's initProgram after the program links. No-op for the no-shadow variant.

Link copied to clipboard
fun loadDisabled(gl: Kgl)
Link copied to clipboard
fun loadEnabled(gl: Kgl, state: ShadowState)
Link copied to clipboard
fun loadTerrainRelief(gl: Kgl, strength: Float, lightDirection: Vec3?)

Sets the Lambertian terrain relief strength (see ShadowLayer.terrainLambert) for the next draw. Per-drawable state - callers must reset to 0 after a relief draw so other draws through the same program stay unshaded. Relief is cascade-independent, so lightDirection re-uploads the sun for frames where the depth pipeline is disabled and loadEnabled never ran.