The runtime
Maths
29 symbols, imported from @driftengine/core.
Explained in Coordinates and units.
Interfaces
Bounds- How big a piece of geometry is, and where it sits.
Functions
angleDelta- Signed shortest angular distance from
atob, in (-π, π]. boundsOfBox- Bounds for a box the caller names itself, into bounds the caller owns.
boundsOfPositions- Measure a vertex array, into bounds the caller owns.
boxInFrustum- Whether an axis-aligned box is anywhere inside the frustum, by the same question the sphere test asks: outside only when wholly beyond one plane.
clampcreateBoundscreateFrustumdamp- Framerate-independent exponential approach of
atowardb.lambdais the convergence rate in 1/seconds (higher = snappier). dampAngledampalong the shortest arc between two angles.dampTracking- Exponential approach of
atoward a target that is itself moving, atvelocity. frustumFromViewProjection- Pull the six planes out of a view-projection matrix.
hslToRgb- hue in degrees (any range), saturation/lightness in [0, 1].
lerplerpAnglelerpalong the shortest arc — the angular counterpart for render interpolation.mixColormixColorInto- In-place
mixColorfor per-frame use — allocating here would be a hot-path bug. rayClosestOnLine- The closest approach between a ray and an infinite line, written into
out. rayPlane- Where a ray meets an infinite plane, or
-1. raySphere- The nearest positive distance along a ray to a sphere's surface, or
-1. scaleColorsmoothstep- Hermite interpolation between two edges: 0 below
a, 1 aboveb. sphereInFrustum- Whether a world-space sphere is anywhere inside the frustum.
wrapAngle- Fold an angle into (-π, π]. Simulation state uses this so a long session cannot accumulate an unbounded angle and lose float precision. Anything replaying a recorded session depends on staying bit-stable over its length.
Types
Frustum- The six planes bounding what a camera can see, and whether a sphere is among them.
FrustumPlanes- Planes in either precision. Double precision is for a world past 2^24 units, where a plane's offset is a number a single float cannot hold to the metre;
cellsInFrustumasks for it. Vec3- RGB triplet, each channel in [0, 1]. Mutable tuple for direct uniform upload.