Renderer · class
GiFieldPass
Explained in Hello world.
class GiFieldPass implements PassDefinitionimport { GiFieldPass } from '@driftengine/core';Constructor
new
constructor(options?: GiFieldOptions)| Parameter | Type | Description |
|---|---|---|
options? | GiFieldOptions |
Methods
setView
setView(eye: ReadonlyVec3, invViewProj: ReadonlyMat4): voidWhere the camera is and how to unproject from it, for this frame.
| Parameter | Type | Description |
|---|---|---|
eye | ReadonlyVec3 | |
invViewProj | ReadonlyMat4 |
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| Parameter | Type | Description |
|---|---|---|
device | PassDevice |
prepare
prepare(ctx: PrepareContext): voidBind whatever field the renderer composed, and tell the march where to look.
| Parameter | Type | Description |
|---|---|---|
ctx | PrepareContext |
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): voidMarch the field into the frame. Nothing is written where the ray found nothing.
| Parameter | Type | Description |
|---|---|---|
ctx | PassContext |
dispose
dispose(): voidSignatures
label = "driftengine.gi-field"readonly
readonly label = "driftengine.gi-field"