Renderer · class
DistanceFieldScene
Explained in Hello world.
class DistanceFieldSceneimport { DistanceFieldScene } from '@driftengine/core';Accessors
| Name | Type | Description |
|---|---|---|
lengthget | number | How many placed fields this frame has recorded. |
capacityget | number | How many records are pooled, which a test uses to assert a steady scene stops allocating. |
sourcesget | readonly FieldSource[] | This frame's distinct sources, in the order their samples are packed. |
sampleCountget | number | Floats the packed upload holds — the sum of the distinct sources' fields. |
packingChangedget | boolean | Whether the samples have to be uploaded again, or the placements alone will do.MoreTrue when this frame's distinct sources are not the last frame's in the same order, since the offsets are positional. A scene whose fields never change answers false from its second frame on, which is what keeps a sixteen-megabyte upload out of the frame loop. |
Methods
offsetOf
offsetOf(source: FieldSource): numberWhere a source's samples start in the packed upload, or -1 if it is not in this frame.
| Parameter | Type | Description |
|---|---|---|
source | FieldSource |
record
record(source: FieldSource, model: ReadonlyMat4, albedo?: ArrayLike<number>): voidDeclare a field, placed.
| Parameter | Type | Description |
|---|---|---|
source | FieldSource | |
model | ReadonlyMat4 | |
albedo? | ArrayLike<number> |
More
A source whose samples do not fit is refused whole rather than clipped. Half a field on the device is not a coarser field; it is a field whose far half reads whatever the buffer held, and that composes as surfaces that are not there — the failure Wave 4A already paid for once, where a phantom surface passed 111,907 parity samples and was found by looking at a picture.
replay
replay(each: (instance: DistanceFieldInstance) => void): void| Parameter | Type | Description |
|---|---|---|
each | (instance: DistanceFieldInstance) => void |
reset
reset(): voidEmpty it for the next frame, keeping the storage and remembering what was packed.