Renderer · interface
ShadowCasterSink
Explained in Hello world.
interface ShadowCasterSinkimport type { ShadowCasterSink } from '@driftengine/core';Methods
mesh
mesh(mesh: MeshHandle, model: ReadonlyMat4, material?: SceneCasterMaterial): voidA rigid mesh at a model transform: the world, a prop, a static piece of scenery.
| Parameter | Type | Description |
|---|---|---|
mesh | MeshHandle | |
model | ReadonlyMat4 | |
material? | SceneCasterMaterial |
skinnedMesh
skinnedMesh(mesh: MeshHandle, model: ReadonlyMat4, palette: Float32Array, material?: SceneCasterMaterial, /** * The cloth the visible draw places this mesh by, if any — for the reason the palette is not * optional in spirit: a garment cast from its skinning alone throws a shadow that does not * move as the cloth does. */ cloth?: ShadowCasterCloth): voidA skinned mesh, deformed by the same palette the visible draw uses.
| Parameter | Type | Description |
|---|---|---|
mesh | MeshHandle | |
model | ReadonlyMat4 | |
palette | Float32Array | |
material? | SceneCasterMaterial | |
/** * The cloth the visible draw places this mesh by | | |
if any — for the reason the palette is not * optional in spirit: a garment cast from its skinning alone throws a shadow that does not * move as the cloth does. */ cloth?: ShadowCasterCloth | |
More
The palette is not optional in spirit, for the reason scatter below states about the
wind: handing the depth pass a different deformation from the colour pass is how a shadow
comes loose from its caster. A skinned character submitted through mesh does not drift
slightly — it casts its bind pose, so a running figure throws the shadow of a statue.
Sixteen floats a joint, column-major, exactly as Skeleton.palette produces.
instancedoptional
instanced?(batch: InstancedHandle, data: MeshInstances, material?: SceneCasterMaterial): voidAn instanced batch of rigid meshes, placed by the same matrices the visible draw uses.
| Parameter | Type | Description |
|---|---|---|
batch | InstancedHandle | |
data | MeshInstances | |
material? | SceneCasterMaterial |
More
Not optional in spirit, for the reason scatter gives about the wind: a batch whose
depth pass read a different placement casts shadows that have come loose from the things
casting them — and a batch submitted through mesh instead casts one shadow, from
whichever matrix happened to be bound, with the other twenty-nine missing entirely.
Optional in the type, and only because this interface is implemented outwards. A
consumer's own sinks and its test doubles satisfy this type, so a required member added in a
minor stops every one of them compiling — which is what happened: 3.29.0 broke three test
doubles in a consumer that has no instanced batches at all. The renderer always supplies
it, so sink.instanced?.(batch, data) never actually skips, and a consumer written before
instanced draws existed has nothing to declare through it.
scatter
scatter(scatter: ScatterHandle, data: InstanceData, windX: number, windZ: number, windGust: number, timeSeconds: number, trample?: Float32Array | null): voidA scatter batch, deformed exactly as the visible draw deforms it.
| Parameter | Type | Description |
|---|---|---|
scatter | ScatterHandle | |
data | InstanceData | |
windX | number | |
windZ | number | |
windGust | number | |
timeSeconds | number | |
trample? | Float32Array | null |
More
The wind and press arguments are the same values the matching drawScatter
receives, and they are not optional in spirit: handing the depth pass a
different gust from the colour pass is how a shadow comes loose from its
caster. Positional rather than a bundled object, so a per-frame call site
allocates nothing.