Renderer · interface

GpuDrivenView

What the pass needs told once a frame, before beginFrame.

Explained in Hello world.

interface GpuDrivenView
import type { GpuDrivenView } from '@driftengine/core';

Properties

NameTypeDescription
viewProjreadonlyArrayLike<number>The camera's view-projection, built the way the forward path builds one.
eyereadonlyreadonly [number, number, number]
lightDirreadonlyreadonly [number, number, number]Toward the light, normalised, as Environment.directionalDir is.
lightColourreadonlyreadonly [number, number, number]
ambientreadonlyreadonly [number, number, number]
ambientGroundreadonlyreadonly [number, number, number]
fogreadonlyoptionalFogOptionsThe medium between the camera and everything this pass draws. Absent is no fog at all.
More

Absent means a density of zero and the medium mode, which makes mediumFog exactly zero at every distance — arithmetically the frame this pipeline drew before it had a haze, which is the promise every term here has made since it was four lines. The three rigs pass nothing.

It is the same expression the forward path fogs with, held to render/fog.ts by scripts/gpu-parity.mjs; a scene drawing through both pipelines at once — which is what the voxel sandbox's port is — would otherwise have its terrain recede at a different rate than its mobs do.

lodThresholdreadonlynumberThe projected error a cluster may carry before its children are drawn instead, in pixels.
More

Larger keeps coarser clusters and draws fewer triangles. lodCut.ts is what reads it.

fovYreadonlynumberThe vertical field of view in radians, which the cut needs to project an error.
shadowStrengthreadonlyoptionalnumberHow much of the directional light the shadow map may take away. 0 is off and 1 is the whole of it.
More

Off is exact rather than nearly: shadowFactor returns 1 before any arithmetic at zero, so a frame that asks for none is the frame this pipeline drew before it had a map. Defaults to 1, because a pipeline that renders a map and then ignores it is a cost with no picture.

timereadonlyoptionalnumberThe simulation's clock, in seconds, which an animated DriftTexture reads. Never a wall clock: a flipbook read off one would replay differently. Defaults to 0.
emissiveGainreadonlyoptionalnumberThe frame's emissive gain and night factor, as Environment carries them. Both default to 1, which is the glow this pipeline drew before it read either.
More

flat/main.ts scales every emission by their product, so a forward frame whose clock says it is day glows nowhere. A caller drawing both pipelines from one Environment passes its two numbers here, or the second pipeline glows where the first does not.

nightFactorreadonlyoptionalnumber