Renderer · class

DecalProjector

A projector a consumer holds and moves.

Explained in Hello world.

class DecalProjector
import { 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)
ParameterTypeDescription
optionsDecalProjectorOptions

Properties

NameTypeDescription
worldToDecalreadonlyFloat32Array<ArrayBuffer>World space into the unit box. Rewritten in place by setPose and setSize.
decalToWorldreadonlyFloat32Array<ArrayBuffer>The unit box back into the world, for the scissor bound.
axisreadonlyFloat32Array<ArrayBuffer>The projection axis, normalised, which the facing test compares a surface normal against.
colorreadonlyFloat32Array<ArrayBuffer>What the mark multiplies the surface by.
opacitynumber
facingCosnumber
softnessnumber

Methods

setPose

setPose(center: ReadonlyVec3, forward: ReadonlyVec3, up: ReadonlyVec3): void

Move the projector. Allocation-free, so a mark may follow something every frame.

ParameterTypeDescription
centerReadonlyVec3
forwardReadonlyVec3
upReadonlyVec3

setSize

setSize(halfExtents: ReadonlyVec3): void

Resize the box, on the same terms.

ParameterTypeDescription
halfExtentsReadonlyVec3

setColor

setColor(color: ReadonlyVec3): void
ParameterTypeDescription
colorReadonlyVec3