Geometry · interface

RibbonOptions

Explained in Hello world, Meshes and geometry.

interface RibbonOptions
import type { RibbonOptions } from '@driftengine/core';

Properties

NameTypeDescription
colorVec3
emissiveoptionalnumber
stepMoptionalnumberDistance between cross-sections. Smaller is smoother and heavier.
thicknessMoptionalnumberDepth of the slab below the surface.
holesoptionalreadonly RibbonHole[]Interruptions: an unbridged track is a jump, and jumps are the point.
shadeoptional(distanceM: number, out: Vec3) => numberCalled per cross-section to vary the surface along the route.
More

Writes the colour into out and returns the emissive strength. The hook exists so a generator can give each stretch its own material without building a separate ribbon per segment — a route in one flat tone reads as a painted strip rather than as something built.

edgeBandMoptionalnumberBuild only a band along one edge instead of the whole surface.
More

For kerbs: a strip this wide, inset from the chosen edge and lifted clear, with the surface's own banking. Doing it as a second ribbon rather than as geometry bolted on afterwards means the kerb follows the bank exactly, and it is the banking that makes an edge hard to read without one.

edgeSideoptional-1 | 1
lateralFromMoptionalnumberBuild a band between two absolute lateral offsets instead of edge-relative ones — for anything painted at a particular place across the surface rather than along its edge.
More

The alternative is to lay a row of small boxes along the route, and it does not work: an axis-aligned box cannot follow a curve, so the row steps into a zigzag and reads as a staircase of holes rather than as a marking. Built as a ribbon it follows the centreline and the bank exactly, for free.

lateralToMoptionalnumber
fromMoptionalnumberRestrict the build to a stretch of the curve.
toMoptionalnumber
liftMoptionalnumberRaise the whole band by this much, so a kerb stands proud of the surface.
colliderGiveMoptionalnumberHow far below the drawn surface the collider hulls' tops sit, metres.
More

A consumer's ground query rides the smooth curve; the hulls are the faceted mesh, and at a crest a facet ridge stands a few centimetres proud of the curve — each ridge a micro-wall under a character's feet if the hulls are exactly flush. The give hands the top few centimetres to the smooth query and everything beneath to the hull: a tolerance between two representations of the same surface, not a hole in the world — the slab's sides and underside stay exactly where they are drawn. Zero means flush.