Renderer · class

ReflectiveSurface

A box a consumer declares, inside which surfaces reflect what the frame drew.

Explained in Hello world.

class ReflectiveSurface
import { ReflectiveSurface } from '@driftengine/core';

In depth

Held and moved, like DecalProjector and for the same reason: a wet patch follows the rain and a polished floor does not move at all, and rebuilding two matrices from four vectors is the whole of a pose. Both matrices live in the object and are rewritten in place.

Constructor

new

constructor(options: ReflectiveSurfaceOptions)
ParameterTypeDescription
optionsReflectiveSurfaceOptions

Properties

NameTypeDescription
worldToSurfacereadonlyFloat32Array<ArrayBuffer>World space into the box, [-1, 1] on each axis.
surfaceToWorldreadonlyFloat32Array<ArrayBuffer>The box back into the world, for the scissor bound.
axisreadonlyFloat32Array<ArrayBuffer>Which way the reflective surfaces inside the box face, normalised and pointing into them.
tintreadonlyFloat32Array<ArrayBuffer>
strengthnumber
fresnelbooleanSee ReflectiveSurfaceOptions.fresnel.
roughnessnumber
reachMnumber
thicknessMnumber
stepsnumber
facingCosnumber

Methods

setPose

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

Move the box. Allocation-free, so a wet patch may follow the weather every frame.

ParameterTypeDescription
centerReadonlyVec3
forwardReadonlyVec3
upReadonlyVec3

setSize

setSize(halfExtents: ReadonlyVec3): void
ParameterTypeDescription
halfExtentsReadonlyVec3