Renderer · class

GiFieldPass

Explained in Hello world.

class GiFieldPass implements PassDefinition
import { GiFieldPass } from '@driftengine/core';

Constructor

new

constructor(options?: GiFieldOptions)
ParameterTypeDescription
options?GiFieldOptions

Methods

setView

setView(eye: ReadonlyVec3, invViewProj: ReadonlyMat4): void

Where the camera is and how to unproject from it, for this frame.

ParameterTypeDescription
eyeReadonlyVec3
invViewProjReadonlyMat4
More

Taken rather than derived, which is the contributed-pass contract: a pass gets its camera from its caller and never sees the renderer's. invViewProj is column-major, as gl-matrix stores one, and a caller that inverts the same matrix it drew the scene with gets rays that land on the same pixels.

init

init(device: PassDevice): void
ParameterTypeDescription
devicePassDevice

prepare

prepare(ctx: PrepareContext): void

Bind whatever field the renderer composed, and tell the march where to look.

ParameterTypeDescription
ctxPrepareContext
More

The bind group is rebuilt only when the field it was built against is a different object. The renderer replaces its samples buffer when a scene's fields grow, and a group holding a destroyed buffer is a validation error at the next draw rather than a wrong picture — but rebuilding one every frame is the per-frame allocation the house rules are about.

draw

draw(ctx: PassContext): void

March the field into the frame. Nothing is written where the ray found nothing.

ParameterTypeDescription
ctxPassContext

dispose

dispose(): void

Signatures

label = "driftengine.gi-field"readonly

readonly label = "driftengine.gi-field"