Renderer · class
DecalProjector
A projector a consumer holds and moves.
Explained in Hello world.
class DecalProjectorimport { DecalProjector } from '@driftengine/core';In depth
Held rather than passed per call, because that is what the row is for: a mark that follows something is a pose written every frame, and rebuilding two matrices from four vectors is the whole of that. Both matrices live in the object and are rewritten in place, so a scene with a hundred marks allocates on the frame it creates them and never again.
Constructor
new
constructor(options: DecalProjectorOptions)| Parameter | Type | Description |
|---|---|---|
options | DecalProjectorOptions |
Properties
| Name | Type | Description |
|---|---|---|
worldToDecalreadonly | Float32Array<ArrayBuffer> | World space into the unit box. Rewritten in place by setPose and setSize. |
decalToWorldreadonly | Float32Array<ArrayBuffer> | The unit box back into the world, for the scissor bound. |
axisreadonly | Float32Array<ArrayBuffer> | The projection axis, normalised, which the facing test compares a surface normal against. |
colorreadonly | Float32Array<ArrayBuffer> | What the mark multiplies the surface by. |
opacity | number | |
facingCos | number | |
softness | number |
Methods
setPose
setPose(center: ReadonlyVec3, forward: ReadonlyVec3, up: ReadonlyVec3): voidMove the projector. Allocation-free, so a mark may follow something every frame.
| Parameter | Type | Description |
|---|---|---|
center | ReadonlyVec3 | |
forward | ReadonlyVec3 | |
up | ReadonlyVec3 |
setSize
setSize(halfExtents: ReadonlyVec3): voidResize the box, on the same terms.
| Parameter | Type | Description |
|---|---|---|
halfExtents | ReadonlyVec3 |
setColor
setColor(color: ReadonlyVec3): void| Parameter | Type | Description |
|---|---|---|
color | ReadonlyVec3 |