Skip to content
Chromatic Coherence

Hue draws · The library

Whole living worlds, grown from code.

A WebGL2 engine with no models, no textures and no asset pipeline. Real light and shadow with a cinematic finish, GPU crowds, water with true reflections, skeletal figures that walk, and scenes that drive themselves toward objectives.

Install

npm i @hue/enginev1.0.0

Zero dependencies. ESM only. Types are in the package.

The public surface

Measured with the TypeScript checker against the published types. The entry point is a barrel of star re-exports, so a search of it finds nothing — the count below is what the compiler resolves through them.

Public exports

961

Values

742

Types

219

Modules

39

Where to start

The entry points, with the signatures the package publishes. Everything else is reachable from the module list below.

Make a world

createWorld
export declare function createWorld(o: WorldOpts): World

THE FRONT DOOR — build a `World` on a canvas. Everything else in this package is reached through the object it returns.

World
export declare class World { private canvas; private gl; private overlay; private og; private opts; private flyMode; private pitchMin; private pitchMax; private renderedPitch; /** The pitch the camera is actually RENDERING with — `cam.pitch` after the user offset, * the parallax nudge and the orbit clamp ([0.18, 0.95]; fly mode ±1.15) are applied. * ⛔ WHY THIS EXISTS (FOREST S1): scenes derived sk…

THE RENDERER AND THE SCENE GRAPH IN ONE OBJECT — build it with {@link createWorld}, never with `new` (the factory is the published surface and keeps the constructor free to change).

WorldOpts
export type WorldOpts = { canvas: HTMLCanvasElement; maxDpr?: number; drift?: number; parallax?: number; /** true = orbit (drag + ctrl-wheel zoom). "fly" (W13) = free flight: drag to look, * wheel to fly forward/back, W/A/S/D to move, shift for speed. */ controls?: boolean | "fly"; /** shadow maps — lights[0] casts. true, or { size (px, default 2048), softness, bias } */ shadows?: boolean | { size…

Everything `createWorld` accepts. Only `canvas` is required; every other field has a stated default and the per-field docs below carry it. Passed once at build time — a world does not re-read these, so a scene that must change one rebuilds.

capturePoster
export declare function capturePoster(o: Omit<WorldOpts, "canvas" | "controls">, build: (w: World) => void, width: number, height: number, t?: number): string | null

Render a recipe's poster frame OFF-SCREEN and return it as a PNG data URL — the placeholder-image pattern: paint it into the window (an <img> beneath the live canvas) at page load, and build the live world only when the window scrolls into view. The scratch world renders on a hidden staged canvas (sizing reads clientWidth, so it must be in the DOM) and its GL context is released before returning — a page can poster every window it owns without spending its live-context budget. Overlay labels (drawLabel) are not part of a poster. Returns null when WebGL is unavailable — callers keep their CSS fallback.

Geometry — meshes you build

box
export declare function box(sx: number, sy: number, sz: number): Mesh

An axis-aligned box centred on the origin (flat-shaded faces).

plane
export declare function plane(sizeX: number, sizeZ: number, nx?: number, nz?: number): Mesh

A flat XZ plane centred on the origin, normal +Y.

icosphere
export declare function icosphere(radius: number, subdiv?: number): Mesh

An icosphere — geodesic subdivision of the icosahedron; normals are exact (radial), so it shades perfectly smooth at any subdivision level.

tube
export declare function tube(path: V3[], radius: number | ((u: number) => number), segments?: number, closed?: boolean, /** * ⛔ **CAP THE TWO OPEN ENDS — optional, absent ⇒ BIT-IDENTICAL (the `flat` precedent).** * * A `tube` is a sleeve: it has a boundary at each end and is not a closed surface. That is * correct for a stem going into the ground or a branch leaving a trunk, where the end is burie…

Sweep a circular cross-section along a polyline path using parallel-transport frames (no twist). `radius` may be a constant or a per-station function of u in 0..1 — taper for free.

lathe
export declare function lathe(profile: { x: number; y: number; }[], segments?: number): Mesh

Revolve a 2D profile (x = radius, y = height; x >= 0) around the Y axis.

extrude
export declare function extrude(shape: { x: number; z: number; }[], height: number): Mesh

Extrude a 2D polygon (CCW, on XZ) straight up by `height` — walls + fan caps.

heightfield
export declare function heightfield(f: (x: number, z: number) => number, sizeX: number, sizeZ: number, nx?: number, nz?: number): Mesh

A heightfield surface: y = f(x, z) sampled on an (nx x nz) grid over [-sizeX/2, sizeX/2] x [-sizeZ/2, sizeZ/2], smooth normals.

parametric
export declare function parametric(f: (u: number, v: number) => V3, nu: number, nv: number, opts?: { wrapU?: boolean; }): Mesh

Grid helper: builds (nx*nz) quads from a parametric surface, smooth normals from central differences. Used by plane, heightfield and lathe alike.

mergeMesh
export declare function mergeMesh(...parts: Mesh[]): Mesh
transformMesh
export declare function transformMesh(m: Mesh, mat: M4): Mesh

Signed distance fields

sphere
sphere: (radius: number) => SDF
boxSDF
export declare function boxSDF(sx: number, sy: number, sz: number, radius?: number): SDF

A box of the given FULL extents. `radius` rounds every edge and corner — the cheapest realism there is, because a razor-perfect edge is the thing eyes read as fake.

torus
torus: (ring: number, tube: number) => SDF

A torus in the XZ plane: `ring` is the centreline radius, `tube` the thickness.

capsule
export declare function capsule(a: V3, b: V3, radius: number): SDF

A capsule (a segment swept by a sphere) — the honest primitive for a limb or a branch.

cone
export declare function cone(height: number, radius: number): SDF

A cone standing on the XZ plane, apex at +height.

cylinder
export declare function cylinder(height: number, radius: number, round?: number): SDF

A Y-axis cylinder of the given full height, optionally round-edged.

union
union: (...fs: SDF[]) => SDF
subtract
subtract: (a: SDF, b: SDF) => SDF

`a` with `b` cut out of it.

intersect
intersect: (...fs: SDF[]) => SDF
smoothUnion
smoothUnion: (a: SDF, b: SDF, k: number) => SDF
sdfMesh
export declare function sdfMesh(field: SDF, opts: SDFMeshOpts): Mesh

The one-liner: field in, Mesh out, ready for `world.mesh()`.

marchSDF
export declare function marchSDF(field: SDF, opts: SDFMeshOpts): SDFMeshResult

Mesh a field. Synchronous: it runs to completion before returning, and at a few tens of thousands of triangles that is a visible pause on the main thread. `marchSDFAsync` is the same algorithm with the pause broken up — see it for when that matters.

Collision and rays

boundingSphere
export declare function boundingSphere(m: Mesh): Sphere

The bounding sphere of a mesh — vertex centroid + max distance. Not the minimal sphere, but stable and cheap; grown once at registration.

boundingCapsuleY
export declare function boundingCapsuleY(m: Mesh): Capsule

The Y-axis capsule of a mesh — radial extent in XZ, segment along Y inset by that radius (so the capsule's round ends stay inside the mesh's own top and bottom). The right auto-collider for anything grown upright: a trunk, a mast, a stem.

raySphere
export declare function raySphere(o: V3, dir: V3, s: Sphere, r?: number, maxDist?: number): number | null

Ray vs sphere: nearest hit distance t ≥ 0 along a UNIT dir, or null. Pass `r` to sweep a moving sphere of that radius instead of a point; a ray starting inside reports the exit hit.

rayCapsule
export declare function rayCapsule(o: V3, dir: V3, c: Capsule, r?: number, maxDist?: number): number | null

Ray vs capsule: nearest hit distance t ≥ 0 along a UNIT dir, or null. Pass `r` to sweep a moving sphere of that radius. A ray starting inside reports the exit hit — the same contract as `raySphere`, kept deliberately so a walker embedded in a trunk can find its way OUT instead of reporting nothing. Cylinder band + two end-sphere caps.

sphereHit
export declare function sphereHit(a: Sphere, b: Sphere): { n: V3; depth: number; } | null

Overlap between two spheres — null when apart; otherwise the contact: `n` points from b to a (the push-out direction for a), `depth` the overlap.

capsuleHit
export declare function capsuleHit(s: Sphere, c: Capsule): { n: V3; depth: number; } | null

Sphere vs capsule — the sphere/sphere contact against the capsule's closest point. `n` points from the capsule to the probe (the push-out direction for the probe), exactly `sphereHit`'s contract.

avoidanceField
export declare function avoidanceField(obstacles: { spheres?: readonly Sphere[]; capsules?: readonly Capsule[]; }, o: { range: number; strength: number; vertical?: number; tangent?: number; }): (p: V3, t: number) => V3

THE STEERING BRIDGE: obstacles, expressed as a field an agent can be steered by.

Scenes that drive themselves

attachObjectives
export declare function attachObjectives(world: World, opts?: ObjectivesOpts): Objectives

Attach the objectives layer to a World. Rides the frame loop as a grow() hook and drives the World through its public verbs — the renderer is untouched.

Objectives
export type Objectives = { define(name: string, spec: ObjectiveSpec): void; retarget(name: string, patch: Partial<ObjectiveSpec>): void; remove(name: string): void; onReading(cb: (r: MovementReading) => void): () => void; readings(): MovementReading[]; }

The user-facing facade returned by attachObjectives().

ObjectiveSpec
export type ObjectiveSpec = { /** rigid-body goal for a named group — interpolated spec, applied via setTransform */ transform?: { group: string; to: TransformSpec; from?: TransformSpec; }; /** morph-weight goal for a named group (meshMorph geometry). Default from: 0. */ morph?: { group: string; to: number; from?: number; }; /** fade goal for a named group. Default from: 1. */ fade?: { group: stri…
ObjectiveCamera
export type ObjectiveCamera = { target?: V3; dist?: number; pitch?: number; yaw?: number; }

What this machine can draw

classifyRenderer
export declare function classifyRenderer(renderer: string): GpuTier

Classify a renderer string. PURE and testable — no GL, no DOM — so the table below can be argued with, extended, and checked against real strings in a unit test rather than discovered on someone's laptop.

GpuTier
export type GpuTier = { tier: "low" | "mid" | "high"; /** the raw renderer string, kept so a caller can log or override on evidence */ renderer: string; /** why this tier was chosen, in words — a classification nobody can interrogate is a magic number */ reason: string; /** * THE SCENE'S **POPULATION** BUDGET, 0..1 — HOW MANY, never how finely. Multiply instance * counts and scatter populations by…

What the engine thinks this GPU is. `detail` is the number a SCENE spends.

FrameGovernor
export declare class FrameGovernor { /** the frame time to aim under, ms. 20 ms ≈ 50 fps, leaving headroom under a 60 Hz vsync. */ readonly targetMs: number; /** how many frames to gather before judging */ readonly window: number; /** the deepest cut allowed */ readonly maxLevel: number; /** * The least improvement a cut must buy to be worth keeping, as a fraction of the frame time * that triggere…
unitsPerMetreOf
export declare function unitsPerMetreOf(s: Scale): number

⚠ A World satisfies `Scale` structurally, so `growQuadruped(FOX, world)` reads correctly and needs no import in either direction — the same trick `FieldSampler` uses between flock and field. Nothing in this file knows what a World is.

Scale
export type Scale = { unitsPerMetre: number; }

What a caller passes instead of a size: "here is how big a metre is in this world."

The colour law

born
export declare function born(hue: number): Held

A colour is born with its identity fixed, fully certain, and entirely unseen.

lighten
export declare function lighten(c: Held, weight: number): Held

One observation's visibility. `L <- L + (1 - L) * weight` — fills toward the ceiling, never past.

drain
export declare function drain(c: Held, weight: number): Held

Disagreement drains certainty. `S <- S * (1 - weight)`. Never rises; never below 0.

observe
export declare function observe(substrate: Held, light: number, ambient?: number): Held

OBSERVE — shade a substrate colour by an amount of light, under the law.

participate
export declare function participate(p: number): number

⛔ **PARTICIPATION AT THE FLOAT32 CROSSING — the CPU sibling of the shader's `participate()` (bug #107, completing #104).** Identity below the knee, so every value the old wall did not touch is byte-identical; above it, strictly increasing forever, approaching 1 and reaching it for no finite input. The knee is `LIGHT_CEILING` — the SAME constant the old `Math.min` walls used, re-pointed from wall to curve exactly as the shader's `L_CEIL` was, so the correction is provably confined to the band the walls were destroying. Use it where `toRgb()` uses it: at the READ-OUT, where a held value becomes a colour a 32-bit pipeline will carry — never on the accumulator, whose bound is `FLOAT64_LAST_BELOW_ONE` above.

toRgb
export declare function toRgb(c: Held): [number, number, number]

The held colour as linear RGB, 0..1. Standard HSL geometry — the LAW is upstream of this, in what may reach the three channels, so the conversion itself has nothing to enforce and does not try.

Held
export type Held = { readonly hue: number; readonly saturation: number; readonly lightness: number; }

One concept's held state. `hue` is degrees; `saturation` and `lightness` are 0..1.

LIGHT_CEILING
LIGHT_CEILING: number

⚠ **KEPT AS AN ALIAS SO EXISTING CALLERS AND THE SHADER CONSTANT STILL RESOLVE**, and renamed in meaning rather than deleted: this corpus corrects by append. It no longer names a ceiling because there is not one — see above.

Every module, mapped

Each module is a subsystem you can import from the package root, and everything it exports is listed under it. The descriptions are the library’s own, where it wrote one.

The world

world26 exports

no description in the package

Functions and values

FRAME_DT_MAX
FRAME_DT_MAX = 0.05
GROUP_LIMIT
GROUP_LIMIT = 8
RAIN_RATIO_CLAMP
RAIN_RATIO_CLAMP: readonly [number, number]
SURFACE_KINDS
SURFACE_KINDS: readonly SurfaceKind[]
World
export declare class World { private canvas; private gl; private overlay; private og; private opts; private flyMode; private pitchMin; private pitchMax; private renderedPitch; /** The pitch the camera is actually RENDERING with — `cam.pitch` after the user offset, * the parallax nudge and the orbit clamp ([0.18, 0.95]; fly mode ±1.15) are applied. * ⛔ WHY THIS EXISTS (FOREST S1): scenes derived sk…
capturePoster
export declare function capturePoster(o: Omit<WorldOpts, "canvas" | "controls">, build: (w: World) => void, width: number, height: number, t?: number): string | null
createWorld
export declare function createWorld(o: WorldOpts): World
frameDelta
export declare function frameDelta(ts: number, tPrev: number): number
rainDropFactor
export declare function rainDropFactor(u: number): number
stateFromMood
export declare function stateFromMood(m: SkyMood, base?: WorldState): WorldState

Types

ColliderCollisionHitFaceOptsGlowOptsGrowFnInstancedHandleLineOptsPointLightProjectedRayHitResultRibbonOptsSkyMoodSurfaceKindSurfaceSpecWindNowWorldOpts
math38 exports

no description in the package

Functions and values

GOLDEN_ANGLE
GOLDEN_ANGLE: number
GOLDEN_FRACTION
GOLDEN_FRACTION: number
TAU
TAU: number
_degenerateWarned
_degenerateWarned: (reset?: boolean) => boolean
add
add: (a: V3, b: V3) => V3
applyM4
export declare function applyM4(m: M4, p: V3): V3
clamp
clamp: (v: number, lo: number, hi: number) => number
cross
cross: (a: V3, b: V3) => V3
dot
dot: (a: V3, b: V3) => number
easeInOut
easeInOut: (u: number) => number
hsl
export declare function hsl(h: number, s: number, l: number): [number, number, number]
hslFrom
export declare function hslFrom(c: [number, number, number]): { hue: number; sat: number; light: number; }
len
len: (a: V3) => number
lerp
lerp: (a: number, b: number, u: number) => number
mCompose
export declare function mCompose(spec: TransformSpec): M4
mIdent
mIdent: () => M4
mInvert
export declare function mInvert(m: M4): M4
mLookAt
export declare function mLookAt(eye: V3, at: V3, up: V3): M4
mMul
export declare function mMul(a: M4, b: M4): M4
mPerspective
export declare function mPerspective(fovy: number, aspect: number, near: number, far: number): M4
mRotX
export declare function mRotX(a: number): M4
mRotY
export declare function mRotY(a: number): M4
mRotZ
export declare function mRotZ(a: number): M4
mScale
mScale: (s: V3) => M4
mTranslate
mTranslate: (t: V3) => M4
mTranspose
export declare function mTranspose(m: M4): M4
mix3
mix3: (a: V3, b: V3, u: number) => V3
norm
norm: (a: V3) => V3
normOr
normOr: (a: V3, fallback: V3, eps?: number) => V3
normOrNull
normOrNull: (a: V3, eps?: number) => V3 | null
normalMat3
export declare function normalMat3(m: M4): Float32Array
rnd
export declare function rnd(i: number, k: number): number
scale
scale: (a: V3, s: number) => V3
sub
sub: (a: V3, b: V3) => V3
v3
v3: (x?: number, y?: number, z?: number) => V3

Types

M4TransformSpecV3
geometry19 exports

no description in the package

Functions and values

UNPAINTED
UNPAINTED: Paint
box
export declare function box(sx: number, sy: number, sz: number): Mesh
checkPaint
export declare function checkPaint(m: Mesh, where: string): Mesh
colourQuery
export declare function colourQuery(mesh: Mesh, cell?: number): (x: number, z: number) => [number, number, number] | null
extrude
export declare function extrude(shape: { x: number; z: number; }[], height: number): Mesh
heightQuery
export declare function heightQuery(mesh: Mesh, cell?: number): (x: number, z: number) => number | null
heightfield
export declare function heightfield(f: (x: number, z: number) => number, sizeX: number, sizeZ: number, nx?: number, nz?: number): Mesh
icosphere
export declare function icosphere(radius: number, subdiv?: number): Mesh
lathe
export declare function lathe(profile: { x: number; y: number; }[], segments?: number): Mesh
mergeMesh
export declare function mergeMesh(...parts: Mesh[]): Mesh
meshVertCount
meshVertCount: (m: Mesh) => number
paintMesh
export declare function paintMesh(m: Mesh, paint: (i: number, x: number, y: number, z: number) => [number, number, number]): Mesh
parametric
export declare function parametric(f: (u: number, v: number) => V3, nu: number, nv: number, opts?: { wrapU?: boolean; }): Mesh
plane
export declare function plane(sizeX: number, sizeZ: number, nx?: number, nz?: number): Mesh
refineGround
export declare function refineGround(mesh: Mesh, o: { targetEdge: (x: number, z: number) => number; heightAt: (x: number, z: number) => number; maxTris?: number; /** central-difference step for the normals, in world units */ eps?: number; }): Mesh
transformMesh
export declare function transformMesh(m: Mesh, mat: M4): Mesh
tube
export declare function tube(path: V3[], radius: number | ((u: number) => number), segments?: number, closed?: boolean, /** * ⛔ **CAP THE TWO OPEN ENDS — optional, absent ⇒ BIT-IDENTICAL (the `flat` precedent).** * * A `tube` is a sleeve: it has a boundary at each end and is not a closed surface. That is * correct for a stem going into the ground or a branch leaving a trunk, where the end is burie…

Types

MeshPaint
sdf36 exports

no description in the package

Functions and values

at
at: (f: SDF, t: V3) => SDF
bend
bend: (f: SDF, k: number) => SDF
boxSDF
export declare function boxSDF(sx: number, sy: number, sz: number, radius?: number): SDF
capsule
export declare function capsule(a: V3, b: V3, radius: number): SDF
cone
export declare function cone(height: number, radius: number): SDF
cylinder
export declare function cylinder(height: number, radius: number, round?: number): SDF
displace
displace: (f: SDF, amp: number, freq: number) => SDF
fbm3
export declare function fbm3(x: number, y: number, z: number, octaves?: number, gain?: number, lacunarity?: number): number
gradient
export declare function gradient(field: SDF, p: V3, eps?: number): V3
intersect
intersect: (...fs: SDF[]) => SDF
marchSDF
export declare function marchSDF(field: SDF, opts: SDFMeshOpts): SDFMeshResult
marchSDFAsync
export declare function marchSDFAsync(field: SDF, opts: SDFMeshOpts, o?: { sliceMs?: number; onProgress?: (fraction: number) => void; }): Promise<SDFMeshResult>
meshArea
export declare function meshArea(m: Mesh): number
meshVolume
export declare function meshVolume(m: Mesh): number
mirrorMeshX
export declare function mirrorMeshX(m: Mesh): Mesh
noise3
export declare function noise3(x: number, y: number, z: number): number
planeSDF
export declare function planeSDF(normal: V3, offset?: number): SDF
repeat
export declare function repeat(f: SDF, period: { x?: number; y?: number; z?: number; }): SDF
rotated
export declare function rotated(f: SDF, r: { x?: number; y?: number; z?: number; }): SDF
roundCone
export declare function roundCone(a: V3, b: V3, ra: number, rb: number): SDF
rounded
rounded: (f: SDF, r: number) => SDF
scaled
scaled: (f: SDF, s: number) => SDF
sdfMesh
export declare function sdfMesh(field: SDF, opts: SDFMeshOpts): Mesh
sdfMeshAsync
export declare function sdfMeshAsync(field: SDF, opts: SDFMeshOpts, o?: { sliceMs?: number; onProgress?: (fraction: number) => void; }): Promise<Mesh>
shell
shell: (f: SDF, thickness: number) => SDF
smoothIntersect
smoothIntersect: (a: SDF, b: SDF, k: number) => SDF
smoothSubtract
smoothSubtract: (a: SDF, b: SDF, k: number) => SDF
smoothUnion
smoothUnion: (a: SDF, b: SDF, k: number) => SDF
sphere
sphere: (radius: number) => SDF
subtract
subtract: (a: SDF, b: SDF) => SDF
torus
torus: (ring: number, tube: number) => SDF
twist
twist: (f: SDF, k: number) => SDF
union
union: (...fs: SDF[]) => SDF

Types

SDFSDFMeshOptsSDFMeshResult

Light, sky and air

atmosphere26 exports

no description in the package

Functions and values

CLOUD_BEAM_TRANSMITTANCE
CLOUD_BEAM_TRANSMITTANCE = 0.3
GROUND_ALBEDO
GROUND_ALBEDO = 0.23
LAMBDA
LAMBDA: RGB
SKY_EXPOSURE
SKY_EXPOSURE = 3.2
TEMPERATE_CLEAR
TEMPERATE_CLEAR: WorldState
aerosolDepth
export declare function aerosolDepth(state: WorldState): RGB
airmass
export declare function airmass(sunElevation: number): number
atmosphereSelfCheck
export declare function atmosphereSelfCheck(): { ok: boolean; note: string; }[]
extinctionPerMetre
export declare function extinctionPerMetre(state: WorldState): RGB
lightSplit
export declare function lightSplit(state: WorldState, groundAlbedo?: number, cloudBeamTransmittance?: number): { ambient: number; diffuse: number; }
miePhase
export declare function miePhase(cosTheta: number, g?: number): number
ozoneDepth
export declare function ozoneDepth(): RGB
rayleighDepth
export declare function rayleighDepth(): RGB
rayleighPhase
export declare function rayleighPhase(cosTheta: number): number
skyColour
export declare function skyColour(state: WorldState): { zenith: RGB; horizon: RGB; }
skyMoodFromState
export declare function skyMoodFromState(state: WorldState, opts?: { glow?: number; satLift?: number; }): { zenith: HSL; horizon: HSL; sun: HSL & { size: number; glow: number; }; sunPitch: number; ambient: number; diffuse: number; fogDistK: number; }
skyRadiance
export declare function skyRadiance(state: WorldState, viewElevation: number, viewAzimuth: number): RGB
sunTransmittance
export declare function sunTransmittance(state: WorldState): RGB
toHSL
export declare function toHSL(c: RGB, exposure?: number): HSL
visibilityMetres
export declare function visibilityMetres(state: WorldState): number
weatherTone
export declare function weatherTone(tone: SurfaceTone, state: WorldState): SurfaceTone
wetSurface
export declare function wetSurface(state: WorldState): { albedoScale: number; gloss: number; }

Types

HSLRGBSurfaceToneWorldState
clouds23 exports

six species, each built its own way — no two clouds alike

Functions and values

CLOUD_BUILDERS
CLOUD_BUILDERS: Record<CloudSpecies, (seed: number, o?: CloudOpts) => CloudMesh>
CLOUD_SPECIES
CLOUD_SPECIES: readonly CloudSpecies[]
altocumulus
export declare function altocumulus(seed: number, o?: AltocumulusOpts): CloudMesh
cirrus
export declare function cirrus(seed: number, o?: CirrusOpts): CloudMesh
cloudDetail
export declare function cloudDetail(r: number, bias?: number): number
cumulonimbus
export declare function cumulonimbus(seed: number, o?: CumulonimbusOpts): CloudMesh
cumulus
export declare function cumulus(seed: number, o?: CumulusOpts): CloudMesh
lenticular
export declare function lenticular(seed: number, o?: LenticularOpts): CloudMesh
splitByNormal
export declare function splitByNormal(m: Mesh, threshold: number, body: Mesh, base: Mesh, /** ⛔ **DROP A TRIANGLE THAT IS INSIDE ANOTHER LUMP.** Optional; absent ⇒ bit-identical. */ buried?: (x: number, y: number, z: number) => boolean): void
stratocumulus
export declare function stratocumulus(seed: number, o?: StratocumulusOpts): CloudMesh

Types

AltocumulusOptsAltocumulusShapeCirrusOptsCirrusShapeCloudMeshCloudOptsCloudSpeciesCumulonimbusOptsCumulusOptsCumulusShapeLenticularOptsStratocumulusOptsStratocumulusShape
cloudphysics8 exports

no description in the package

Functions and values

CLOUD_ASYMMETRY_G
CLOUD_ASYMMETRY_G = 0.85
cloudOpacity
export declare function cloudOpacity(optics: CloudOptics, nDotV: number): number
cloudOptics
export declare function cloudOptics(state: WorldState, depthM?: number): CloudOptics
cloudPhysicsSelfCheck
export declare function cloudPhysicsSelfCheck(): { ok: boolean; note: string; }[]
dewPointC
export declare function dewPointC(temperatureC: number, humidity: number): number
effectiveRadiusM
export declare function effectiveRadiusM(state: WorldState): number
lclMetres
export declare function lclMetres(state: WorldState): number

Types

CloudOptics
skyfield30 exports

the sky as a composition: weather, perspective, drift

Functions and values

KIND_FALLBACK
KIND_FALLBACK: Record<string, readonly string[]>
SKY_CLOUD_KINDS
SKY_CLOUD_KINDS: readonly ["cumulus-humilis", "cumulus", "cumulus-congestus", "cumulonimbus", "stratocumulus", "stratus", "altocumulus", "cirrocumulus", "cirrus"]
SKY_MOODS
SKY_MOODS: { [K in keyof typeof SKY_MOOD_LOOK]: typeof SKY_MOOD_LOOK[K] & { cloudCover: number; }; }
SKY_MOOD_AUTHORED_SPLIT
SKY_MOOD_AUTHORED_SPLIT: Readonly<Record<string, { ambient: number; diffuse: number; }>>
SKY_PRESETS
SKY_PRESETS: Record<string, SkyPreset>
albedoForBounce
export declare function albedoForBounce(target: { hue: number; sat: number; light: number; }, /** ⚠ **A `V3`, BECAUSE THAT IS WHAT `w.ambientGround` IS.** A tuple would have made every call * site convert, and a conversion at a call site is a place to get the channel order wrong. */ ground: V3): { hue: number; sat: number; light: number; }
layoutSky
export declare function layoutSky(spec: SkySpec, make: CloudFactory): SkyLayout
meshExtent
export declare function meshExtent(...parts: (Mesh | undefined)[]): MeshExtent
resolveKind
export declare function resolveKind(kind: CloudKind, vocab?: readonly string[]): { kind: string; substituted: boolean; }
skyCoverage
export declare function skyCoverage(preset: SkyPreset): number
skyDrift
export declare function skyDrift(layout: SkyLayout, t: number): { group: string; transform: TransformSpec; }[]
skyElevationWindow
export declare function skyElevationWindow(o: { pitch: number; halfFovY: number; mirror?: boolean; floor?: number; }): { min: number; max: number; }
skyMaterialsFromOptics
export declare function skyMaterialsFromOptics(optics: { topReflectance: number; baseTransmittance: number; }, hue?: number, /** ⛔ **THE GROUND BOUNCE THE BASE WILL BE MULTIPLIED BY — OPTIONAL, AND ABSENT MEANS UNCHANGED.** * Pass `w.ambientGround` and the base albedo is DERIVED so the delivered underside is the hue * that was authored (`albedoForBounce`, #183 arm B). Omit it and every existing ca…
skySpec
export declare function skySpec(preset: string | SkyPreset, o: Omit<SkySpec, "layers"> & { layers?: readonly SkyLayerSpec[]; drift?: SkyDriftSpec; }): SkySpec
skySummary
export declare function skySummary(layout: SkyLayout): string

Types

AngularDiscCloudFactoryCloudKindCloudPartsCloudPlacementKindPickMeshExtentSkyBatchSkyDriftSpecSkyLayerSpecSkyLayoutSkyMaterialSkyPresetSkySpecWind2
hold10 exports

no description in the package

Functions and values

FLOAT32_LAST_BELOW_ONE
FLOAT32_LAST_BELOW_ONE: number
FLOAT64_LAST_BELOW_ONE
FLOAT64_LAST_BELOW_ONE: number
LIGHT_CEILING
LIGHT_CEILING: number
born
export declare function born(hue: number): Held
drain
export declare function drain(c: Held, weight: number): Held
lighten
export declare function lighten(c: Held, weight: number): Held
observe
export declare function observe(substrate: Held, light: number, ambient?: number): Held
participate
export declare function participate(p: number): number
toRgb
export declare function toRgb(c: Held): [number, number, number]

Types

Held

Water

water15 exports

serpentine lakes, their bed, their shore

Functions and values

LAKES
LAKES: Record<string, LakeSpec>
LONG_WATER
LONG_WATER: LakeSpec
ROUND_POND
ROUND_POND: LakeSpec
lakeBed
export declare function lakeBed(spec: LakeSpec, size: number | Scale, o?: { nu?: number; nv?: number; }): Mesh
lakeBlend
export declare function lakeBlend(spec: LakeSpec, size: number | Scale, x: number, z: number, runOutM?: number): number
lakeBounds
export declare function lakeBounds(spec: LakeSpec, size: number | Scale): { x0: number; z0: number; x1: number; z1: number; }
lakeDepthAt
export declare function lakeDepthAt(spec: LakeSpec, size: number | Scale, x: number, z: number): number
lakeGroundY
export declare function lakeGroundY(spec: LakeSpec, size: number | Scale, x: number, z: number): number
lakeSurface
export declare function lakeSurface(spec: LakeSpec, size: number | Scale, o?: { nu?: number; nv?: number; }): Mesh
prepareLake
export declare function prepareLake(spec: LakeSpec, size: number | Scale): PreparedLake
rainDrop
export declare function rainDrop(rateMmH: number, exposureS?: number): { diameterMm: number; fallMs: number; streakM: number; }
rainVisibleFraction
export declare function rainVisibleFraction(rateMmH: number): number
shoreline
export declare function shoreline(spec: LakeSpec, size: number | Scale, spacing: number): { p: V3; normal: V3; }[]

Types

LakeSpecPreparedLake
caustics22 exports

the light on a shallow floor, driven by the water's own waves

Functions and values

CAUSTIC_DEFAULTS
CAUSTIC_DEFAULTS: Readonly<{ amp: 3; level: 0; depth: 40; eta: 0.75; focus: 1; soften: 0.08; }>
DEFAULT_CHOP
DEFAULT_CHOP: Required<ChopSpec>
DEFAULT_WATER_SIZE
DEFAULT_WATER_SIZE = 4000
ETA_WATER
ETA_WATER = 0.75
REFERENCE_WAVES
REFERENCE_WAVES: readonly CausticWave[]
WATER_GRID_CELLS
WATER_GRID_CELLS = 64
attachCaustics
export declare function attachCaustics(world: World, opts?: CausticSplatOpts): CausticHandle
buildChop
export declare function buildChop(spec?: ChopSpec): CausticWave[]
causticField
export declare function causticField(spec?: CausticsSpec): CausticField
causticLight
export declare function causticLight(field: CausticField, x: number, z: number, t: number, base: number, gain?: number): number
causticSample
causticSample: () => CausticSample
firstFoldLever
export declare function firstFoldLever(trace: number, det: number): number
splatScale
splatScale: (intensity: number) => number
waterGridNyquistK
waterGridNyquistK: (size?: number) => number
waterGridNyquistWavelength
waterGridNyquistWavelength: (size?: number) => number

Types

CausticFieldCausticHandleCausticSampleCausticSplatOptsCausticWaveCausticsSpecChopSpec
aquatic71 exports

fish, frogs, newts, reeds and lilies — the pond's own life

Functions and values

AMPHIBIAN_BONES
AMPHIBIAN_BONES: readonly ["body", "head", "tail", "foreL.up", "foreL.lo", "foreR.up", "foreR.lo", "hindL.up", "hindL.lo", "hindL.ft", "hindR.up", "hindR.lo", "hindR.ft"]
AMPHIBIAN_SPECIES
AMPHIBIAN_SPECIES: Record<string, AmphibianSpec>
AMPHIBIAN_WART
AMPHIBIAN_WART: Record<AmphibianSkin, number>
AQUATIC_DETAIL
AQUATIC_DETAIL = 1
AQUATIC_PLANTS
AQUATIC_PLANTS: Record<string, AquaticPlantSpecies>
CARP
CARP: FishSpecies
COMMON_FROG
COMMON_FROG: AmphibianSpec
COMMON_REED
COMMON_REED: AquaticPlantSpecies
COMMON_TOAD
COMMON_TOAD: AmphibianSpec
DUCKWEED
DUCKWEED: AquaticPlantSpecies
FISH_BONES
FISH_BONES: readonly ["body", "spine1", "spine2", "spine3", "peduncle", "caudal", "dorsal", "anal", "pelvL", "pelvR", "pectL", "pectR"]
FISH_SPECIES
FISH_SPECIES: Record<string, FishSpecies>
FISH_STROUHAL
FISH_STROUHAL = 0.3
FISH_TAIL_AMPLITUDE
FISH_TAIL_AMPLITUDE = 0.2
HORNWORT
HORNWORT: AquaticPlantSpecies
MARSH_MARIGOLD
MARSH_MARIGOLD: AquaticPlantSpecies
MINNOW
MINNOW: FishSpecies
PERCH
PERCH: FishSpecies
PIKE
PIKE: FishSpecies
POND_AMPHIBIANS
POND_AMPHIBIANS: AmphibianSpec[]
POND_FISH
POND_FISH: FishSpecies[]
POND_MARGIN
POND_MARGIN: AquaticPlantSpecies[]
REEDMACE
REEDMACE: AquaticPlantSpecies
ROACH
ROACH: FishSpecies
RUDD
RUDD: FishSpecies
SCALE_GLOSS
SCALE_GLOSS = 0.55
SHOAL_CYCLE
SHOAL_CYCLE: { /** a fish climbs at this share of its cruising speed. It is a real constraint — a rising fish is * still swimming — and it is what makes a carp's rise from two metres take seconds and not a * frame. */ readonly climbShare: 0.8; /** the shoal's own centre mills at this share of cruise, on a slow Lissajous. A shoal wanders; * it does not commute. */ readonly driftShare: 0.15; /** abo…
SMOOTH_NEWT
SMOOTH_NEWT: AmphibianSpec
STICKLEBACK
STICKLEBACK: FishSpecies
TENCH
TENCH: FishSpecies
WATER_LILY
WATER_LILY: AquaticPlantSpecies
WATER_MINT
WATER_MINT: AquaticPlantSpecies
YELLOW_FLAG
YELLOW_FLAG: AquaticPlantSpecies
amphibianPaint
export declare function amphibianPaint(rig: AmphibianRig, spec: AmphibianSpec): (i: number, x: number, y: number, z: number) => [number, number, number]
amphibianUnits
export declare function amphibianUnits(spec: AmphibianSpec, size: number | Scale): AmphibianSize
aquaticSelfCheck
export declare function aquaticSelfCheck(): { ok: boolean; note: string; }[]
fishBandM
export declare function fishBandM(spec: FishSpecies, waterDepthM: number): { topM: number; bottomM: number; }
fishBodyBones
fishBodyBones: readonly number[]
fishBodyCrossSection
export declare function fishBodyCrossSection(rig: FishRig): { z: number; depth: number; width: number; }
fishCruiseBL
export declare function fishCruiseBL(spec: FishSpecies): number
fishPaint
export declare function fishPaint(rig: FishRig, spec: FishSpecies): (i: number, x: number, y: number, z: number) => [number, number, number]
fishPosePair
export declare function fishPosePair(spec: FishSpecies): { from: Pose; to: Pose; }
fishTailHz
export declare function fishTailHz(spec: FishSpecies): number
fishToneUnder
export declare function fishToneUnder(spec: FishSpecies, patch: "flank" | "belly" | "fin", state: WorldState): SurfaceTone
fishUnits
export declare function fishUnits(spec: FishSpecies, size: number | Scale): FishSize
growAmphibian
export declare function growAmphibian(spec: AmphibianSpec, size: number | Scale, o?: AquaticOptions): AmphibianRig
growAquaticPlant
export declare function growAquaticPlant(spec: AquaticPlantSpecies, size: number | Scale, seed: number): Mesh
growFish
export declare function growFish(spec: FishSpecies, size: number | Scale, o?: AquaticOptions): FishRig
pondMarginAt
export declare function pondMarginAt(depthM: number): AquaticPlantSpecies[]
shoalAt
export declare function shoalAt(spec: FishSpecies, t: number, o: { index: number; count: number; home: V3; scale: number | Scale; waterDepthM: number; spreadM?: number; seed?: number; }): FishMoment
shoalSize
export declare function shoalSize(spec: FishSpecies, seed?: number): number
validateAmphibian
export declare function validateAmphibian(spec: AmphibianSpec): void
validateAquaticPlant
export declare function validateAquaticPlant(spec: AquaticPlantSpecies): void
validateFish
export declare function validateFish(spec: FishSpecies): void

Types

AmphibianPostureAmphibianRigAmphibianSizeAmphibianSkinAmphibianSpecAquaticFormAquaticHeadAquaticOptionsAquaticPlantSpeciesCaudalShapeFishActivityFishMomentFishRigFishSizeFishSpeciesWashWaterHabit

Weather and motion

weather31 exports

ONE WEATHER: U10 in, everything derived — gusts, lean, deck wind

Functions and values

EKMAN_VEER_RAD
EKMAN_VEER_RAD: number
GRADIENT_HEIGHT_M
GRADIENT_HEIGHT_M = 270
GUST_LENGTH_M
GUST_LENGTH_M = 100
GUST_REL_AMPS
GUST_REL_AMPS: readonly [0.5, 0.3, 0.2]
GUST_WAVELENGTHS_M
GUST_WAVELENGTHS_M: readonly [100, number, number]
HELLMANN_ALPHA
HELLMANN_ALPHA: number
LEAN_REF_RAD
LEAN_REF_RAD: number
LEAN_REF_U
LEAN_REF_U = 9
MOOD_BLEND_S
MOOD_BLEND_S = 3
SIGMA_FBM4_T1
SIGMA_FBM4_T1 = 0.1692
SIGMA_FBM4_T4
SIGMA_FBM4_T4 = 0.1039
SWAY_EXPONENT
SWAY_EXPONENT = 2
SWAY_F0_HZ
SWAY_F0_HZ = 1.5
SWAY_L0_M
SWAY_L0_M = 0.6
TURBULENCE_INTENSITY
TURBULENCE_INTENSITY: number
TURBULENCE_Z0_M
TURBULENCE_Z0_M = 0.03
VOGEL_B
VOGEL_B = -0.7
WANDER_RMS_RAD
WANDER_RMS_RAD: number
WEATHER_SEED
WEATHER_SEED = 9241
deckWindMs
export declare function deckWindMs(U10Ms: number, heightM: number): number
gustOmegas
gustOmegas: (U10Ms: number) => [number, number, number]
gustPeriodS
export declare function gustPeriodS(U10Ms: number): number
meanLeanRad
export declare function meanLeanRad(UMs: number): number
requireU10
export declare function requireU10(v: unknown, where: string): number
swayOmega
export declare function swayOmega(heightM: number): number
swayOscRad
export declare function swayOscRad(UMs: number): number
switchWind
export declare function switchWind(sw: WindSwitch, oldU10: number, newU10: number, tNow: number): void
travellingGust
export declare function travellingGust(alongM: number, t: number, U10Ms: number, sw: WindSwitch): number
windSample
export declare function windSample(U10Ms: number, seed: number, t: number, sw: WindSwitch): WindSample

Types

WindSampleWindSwitch
field9 exports

one current/wind field everything samples — leaves, kelp, fish, foam

Functions and values

FIELD_PRESETS
FIELD_PRESETS: Record<string, MotionFieldSpec>
MotionField
export declare class MotionField { seed: number; prevailing: V3; gust: Layer; turbulence: Layer; advect: number; surfaceY: number; constructor(spec?: MotionFieldSpec); /** * The largest magnitude `sample` is expected to return, in world units per second. * * The triangle-inequality half IS exact: if each layer's unit field stays in the unit ball then * the sum cannot exceed |prevailing| + the two …
fbm4
export declare function fbm4(seed: number, x: number, y: number, z: number, w: number, octaves?: number, gain?: number, lacunarity?: number): number
gnoise4
export declare function gnoise4(seed: number, x: number, y: number, z: number, w: number): number
gnoise4g
export declare function gnoise4g(seed: number, x: number, y: number, z: number, w: number, out: Float64Array | number[] | null): number
motionField
motionField: (spec?: MotionFieldSpec) => MotionField

Types

FieldLayerFlow2MotionFieldSpec
flock23 exports

separation/alignment/cohesion, so a school IS a school

Functions and values

Flock
export declare class Flock { readonly agents: FlockAgent[]; /** Live — mutate any field between steps (move `goal.p`, drop `bounds`, retune a weight). */ params: FlockParams; /** Optional motion field. Assignable at any time; `params.fieldWeight` decides whether it acts. */ field: FieldSampler | null; readonly seed: number; /** accumulated simulated seconds — what the field sampler and the wander …
agentBasis
export declare function agentBasis(a: FlockAgent): AgentBasis
agentSpec
export declare function agentSpec(a: FlockAgent, size?: number | V3): TransformSpec
createFlock
export declare function createFlock(o: FlockOpts): Flock
defaultFlockParams
export declare function defaultFlockParams(): FlockParams
flockCentre
export declare function flockCentre(f: Flock | FlockAgent[]): V3
flockMeanSpeed
export declare function flockMeanSpeed(f: Flock | FlockAgent[]): number
flockPolarisation
export declare function flockPolarisation(f: Flock | FlockAgent[]): number
resolveFlockParams
export declare function resolveFlockParams(init?: FlockParamsInit): FlockParams

Types

AgentBasisFieldSamplerFlockAgentFlockBoundsFlockBoundsInitFlockGoalFlockGoalInitFlockOptsFlockParamsFlockParamsInitFlockPerchFlockRuleFlockStateFlockWander
collision10 exports

no description in the package

Functions and values

avoidanceField
export declare function avoidanceField(obstacles: { spheres?: readonly Sphere[]; capsules?: readonly Capsule[]; }, o: { range: number; strength: number; vertical?: number; tangent?: number; }): (p: V3, t: number) => V3
boundingCapsuleY
export declare function boundingCapsuleY(m: Mesh): Capsule
boundingSphere
export declare function boundingSphere(m: Mesh): Sphere
capsuleHit
export declare function capsuleHit(s: Sphere, c: Capsule): { n: V3; depth: number; } | null
rayCapsule
export declare function rayCapsule(o: V3, dir: V3, c: Capsule, r?: number, maxDist?: number): number | null
raySphere
export declare function raySphere(o: V3, dir: V3, s: Sphere, r?: number, maxDist?: number): number | null
sphereHit
export declare function sphereHit(a: Sphere, b: Sphere): { n: V3; depth: number; } | null
sumFields
export declare function sumFields(...fields: ((p: V3, t: number) => V3)[]): (p: V3, t: number) => V3

Types

CapsuleSphere

Living things

animals12 exports

THE FRONT DOOR — deer(world), fox(world): one call, one living animal

Functions and values

ANIMALS
ANIMALS: Record<string, (w: World, o?: AnimalOptions) => Animal>
COATS
COATS: Record<string, Pelage>
SPECIES_WITH_A_DOOR
SPECIES_WITH_A_DOOR: string[]
badger
badger: (w: World, o?: AnimalOptions) => Animal
deer
deer: (w: World, o?: AnimalOptions) => Animal
fox
fox: (w: World, o?: AnimalOptions) => Animal
growAnimal
export declare function growAnimal(w: World, spec: QuadrupedSpec, o?: AnimalOptions): Animal
hare
hare: (w: World, o?: AnimalOptions) => Animal
headLiftAt
export declare function headLiftAt(t: number, e: QuadrupedEthology): number
herdCell
export declare function herdCell(w: World, specs: readonly QuadrupedSpec[]): number

Types

AnimalAnimalOptions
people10 exports

no description in the package

Functions and values

FIGURES_WITH_A_DOOR
FIGURES_WITH_A_DOOR: string[]
OUTFITS_A_FIGURE_MAY_WEAR
OUTFITS_A_FIGURE_MAY_WEAR: readonly Outfit[]
PEOPLE
PEOPLE: Record<string, (w: World, o?: PersonOptions) => Person>
WEARS
WEARS: Record<string, Outfit>
adult
adult: (w: World, o?: PersonOptions) => Person
child
child: (w: World, o?: PersonOptions) => Person
growPerson
export declare function growPerson(w: World, spec: BipedSpec, o?: PersonOptions): Person
peopleCell
export declare function peopleCell(w: World, specs: readonly BipedSpec[]): number

Types

PersonPersonOptions
aviary9 exports

no description in the package

Functions and values

BIRD_SKIN_RESOLUTION
BIRD_SKIN_RESOLUTION = 48
aviaryResolution
export declare function aviaryResolution(w: World, specs: readonly BirdSpecies[], o?: { base?: number; floor?: number; }): Map<string, number>
growAviary
export declare function growAviary(w: World, spec: BirdSpecies, o?: AviaryOptions): Aviary
kestrels
kestrels: (w: World, o?: AviaryOptions) => Aviary
robins
robins: (w: World, o?: AviaryOptions) => Aviary
tawnyOwls
tawnyOwls: (w: World, o?: AviaryOptions) => Aviary
woodPigeons
woodPigeons: (w: World, o?: AviaryOptions) => Aviary

Types

AviaryAviaryOptions
creatures52 exports

animals GROWN from proportions — species as data

Functions and values

ADULT
ADULT: BipedSpec
BADGER
BADGER: QuadrupedSpec
BIPEDS
BIPEDS: Record<string, BipedSpec>
CHILD
CHILD: BipedSpec
CREATURE_DETAIL
CREATURE_DETAIL = 1
FOX
FOX: QuadrupedSpec
FROUDE_PENDULUM_MAX
FROUDE_PENDULUM_MAX: number
GRAZE_CROUCH
GRAZE_CROUCH = 0.12
GRAZE_STAGGER
GRAZE_STAGGER = 1.4
HARE
HARE: QuadrupedSpec
QUADRUPEDS
QUADRUPEDS: Record<string, QuadrupedSpec>
REGION
REGION: { /** bare skin or plain fur — the fallback, and never a silent one: every vertex this file emits * is given a region explicitly, and `skin` means "nothing more specific is true here" */ readonly skin: 0; /** the hair-bearing crown and back of the head — where hair goes */ readonly scalp: 1; /** the front of the head below the hairline — where a face goes */ readonly face: 2; /** the muzzl…
REGION_NAMES
REGION_NAMES: readonly string[]
ROE_DEER
ROE_DEER: QuadrupedSpec
SEAT_M_DEFAULT
SEAT_M_DEFAULT = 0.45
assertOnGround
export declare function assertOnGround(rig: Rig, pose: Pose, label: string, tol?: number): void
behaveQuadruped
export declare function behaveQuadruped(spec: QuadrupedSpec, agent: QuadrupedAgent, dt: number, size: number | Scale, near?: readonly QuadrupedNeighbour[]): QuadrupedAgent
couched
export declare function couched(t?: number): Pose
earsBack
export declare function earsBack(t?: number): Pose
growBiped
export declare function growBiped(spec: BipedSpec, size: number | Scale, o?: GrowOptions): CreatureRig
growQuadruped
export declare function growQuadruped(spec: QuadrupedSpec, size: number | Scale, o?: GrowOptions): CreatureRig
headDown
export declare function headDown(t?: number, o?: { rig?: Rig; crouch?: number; }): Pose
headUp
export declare function headUp(turn?: number): Pose
lowestOfBones
export declare function lowestOfBones(rig: Rig, pose: Pose, boneNames: string[]): number
poseFloor
export declare function poseFloor(rig: Rig, pose: Pose): number
quadrupedAgent
export declare function quadrupedAgent(spec: QuadrupedSpec, seed: number, o: { id?: number; x: number; z: number; facing?: number; }): QuadrupedAgent
quadrupedClock
export declare function quadrupedClock(spec: QuadrupedSpec): QuadrupedClock
quadrupedExtent
export declare function quadrupedExtent(spec: QuadrupedSpec): QuadrupedExtent
quadrupedGait
export declare function quadrupedGait(spec: QuadrupedSpec, size: number | Scale): QuadrupedGait
quadrupedMorphPoses
export declare function quadrupedMorphPoses(rig: Rig): { graze: Pose; alert: Pose; }
quadrupedPose
export declare function quadrupedPose(rig: Rig, agent: QuadrupedAgent): Pose
sitting
export declare function sitting(o?: { lean?: number; hold?: number; turn?: number; seatM?: number; rig?: Rig; }): Pose
standing
export declare function standing(shift?: number): Pose
startleQuadruped
export declare function startleQuadruped(spec: QuadrupedSpec, agent: QuadrupedAgent, fromX: number, fromZ: number, size: number | Scale): boolean
walkBiped
export declare function walkBiped(phase: number, stride?: number): Pose
walkBipedKeys
export declare function walkBipedKeys(keys?: number, stride?: number): { phases: number[]; poses: Pose[]; at(phase: number): { pair: number; k: number; }; }
walkQuad
export declare function walkQuad(phase: number, stride?: number): Pose
walkQuadKeys
export declare function walkQuadKeys(keys?: number, stride?: number): { phases: number[]; poses: Pose[]; at(phase: number): { pair: number; k: number; }; }

Types

BipedSpecCreatureRigGrowOptionsQuadrupedActivityQuadrupedAgentQuadrupedClockQuadrupedEthologyQuadrupedExtentQuadrupedGaitQuadrupedGaitPointQuadrupedNeighbourQuadrupedSpecRegionIdRegionRange
birds56 exports

thirteen woodland birds, species as data

Functions and values

BEATS_PER_BOUT
BEATS_PER_BOUT = 4
BIRDS
BIRDS: Record<string, BirdSpecies>
BIRD_ACTIVITIES
BIRD_ACTIVITIES: readonly BirdActivity[]
BIRD_BONES
BIRD_BONES: readonly ["body", "neck", "head", "tail", "wingL.in", "wingL.out", "wingR.in", "wingR.out", "legL", "footL", "legR", "footR"]
BIRD_CYCLE
BIRD_CYCLE: { /** the level-flight coefficient in `birdCruiseMS` — `sqrt(2g / (ρ·C_L))` at ρ 1.225 and a * cruising C_L near 0.6 comes to ≈ 5.2; this is that, rounded. */ readonly cruiseK: 5; /** `birdTakeoffSeconds` = base + per-loading × kg/m². Chosen so the thirteen span 0.26–0.76 s. */ readonly takeoffBaseS: 0.16; readonly takeoffPerLoadingS: 0.055; /** the landing takes this much longer than …
BIRD_HABITATS
BIRD_HABITATS: readonly BirdHabitat[]
BLACKBIRD
BLACKBIRD: BirdSpecies
CHAFFINCH
CHAFFINCH: BirdSpecies
FEATHER_GLOSS
FEATHER_GLOSS = 0.06
GREAT_TIT
GREAT_TIT: BirdSpecies
JAY
JAY: BirdSpecies
KESTREL
KESTREL: BirdSpecies
NUTHATCH
NUTHATCH: BirdSpecies
PHEASANT
PHEASANT: BirdSpecies
ROBIN
ROBIN: BirdSpecies
SWIFT
SWIFT: BirdSpecies
TAWNY_OWL
TAWNY_OWL: BirdSpecies
WOODLAND_BIRDS
WOODLAND_BIRDS: BirdSpecies[]
WOODPECKER
WOODPECKER: BirdSpecies
WOOD_PIGEON
WOOD_PIGEON: BirdSpecies
WREN
WREN: BirdSpecies
birdActivityAt
export declare function birdActivityAt(spec: BirdSpecies, t: number, o: { at: V3; scale: number | Scale; facing?: number; index?: number; seed?: number; state?: "ground" | "air"; circuitM?: number; }): BirdMoment
birdBout
export declare function birdBout(spec: BirdSpecies, t: number): { u: number; period: number; flapTime: number; rest: number; }
birdCruiseMS
export declare function birdCruiseMS(spec: BirdSpecies): number
birdDensity
export declare function birdDensity(spec: BirdSpecies, habitat: BirdHabitat): number
birdFlockSize
export declare function birdFlockSize(spec: BirdSpecies, seed?: number): number
birdFootDropM
export declare function birdFootDropM(spec: BirdSpecies, resolution?: number): number
birdGroundBout
export declare function birdGroundBout(spec: BirdSpecies): BirdGroundBout
birdPaint
export declare function birdPaint(rig: Rig, spec: BirdSpecies): (i: number, x: number, y: number, z: number) => [number, number, number]
birdPeckPose
export declare function birdPeckPose(spec: BirdSpecies, down?: number): Pose
birdPerchable
export declare function birdPerchable(spec: BirdSpecies): boolean
birdPose
export declare function birdPose(spec: BirdSpecies, t: number, o?: { bank?: number; phase?: number; amp?: number; }): Pose
birdPoseSet
export declare function birdPoseSet(spec: BirdSpecies): BirdPosePair[]
birdSolids
export declare function birdSolids(rig: Rig, spec: BirdSpecies, size: number | Scale, resolution?: number): BoneSolid[]
birdStandPose
export declare function birdStandPose(spec: BirdSpecies, settle?: number): Pose
birdTakeoffSeconds
export declare function birdTakeoffSeconds(spec: BirdSpecies): number
birdToneUnder
export declare function birdToneUnder(spec: BirdSpecies, patch: "body" | "belly" | "wing" | "head" | "horn", state: WorldState): SurfaceTone
birdUnits
export declare function birdUnits(spec: BirdSpecies, size: number | Scale): BirdSize
birdWingArea
export declare function birdWingArea(spec: BirdSpecies): number
birdWingLoading
export declare function birdWingLoading(spec: BirdSpecies): number
birdsFor
export declare function birdsFor(habitat: BirdHabitat, o?: { areaHa: number; detail?: number; seed?: number; from?: BirdSpecies[]; }): BirdAssemblage[]
birdsSelfCheck
export declare function birdsSelfCheck(): { ok: boolean; note: string; }[]
growBird
export declare function growBird(spec: BirdSpecies, size: number | Scale): Rig
validateBird
export declare function validateBird(spec: BirdSpecies): void

Types

BirdActivityBirdAssemblageBirdFlightBirdGaitBirdGroundBoutBirdHabitBirdHabitatBirdMomentBirdPosePairBirdSizeBirdSpeciesPlumage
insects23 exports

the small flying life, species as data

Functions and values

CHITIN_GLOSS
CHITIN_GLOSS = 0.1
DRAGONFLY
DRAGONFLY: InsectSpecies
FLIGHT_COLUMN_M
FLIGHT_COLUMN_M: Record<Exclude<InsectFlight, "trundle">, { radius: number; height: number; rate: number; jitter: number; }>
FLIGHT_GIRTH
FLIGHT_GIRTH: Record<InsectFlight, number>
FLIGHT_WING
FLIGHT_WING: Record<InsectFlight, { freq: number; amp: number; }>
HONEY_BEE
HONEY_BEE: InsectSpecies
HOVERFLY
HOVERFLY: InsectSpecies
INSECTS
INSECTS: Record<string, InsectSpecies>
LADYBIRD
LADYBIRD: InsectSpecies
MEADOW_BROWN
MEADOW_BROWN: InsectSpecies
MEADOW_INSECTS
MEADOW_INSECTS: InsectSpecies[]
MIDGE
MIDGE: InsectSpecies
RED_ADMIRAL
RED_ADMIRAL: InsectSpecies
growInsect
export declare function growInsect(spec: InsectSpecies, size: number | Scale, seed?: number): Mesh
growInsectWings
export declare function growInsectWings(spec: InsectSpecies, size: number | Scale): Mesh
insectFlightParams
export declare function insectFlightParams(spec: InsectSpecies, world: Scale): { mode: "swarm"; wing: { freq: number; amp: number; }; swarm: { radius: number; height: number; rate: number; jitter: number; }; }
insectToneUnder
export declare function insectToneUnder(spec: InsectSpecies, patch: "body" | "wing", state: WorldState): SurfaceTone
insectUnits
export declare function insectUnits(spec: InsectSpecies, size: number | Scale): InsectSize
insectsSelfCheck
export declare function insectsSelfCheck(): { ok: boolean; note: string; }[]
validateInsect
export declare function validateInsect(spec: InsectSpecies): void

Types

InsectFlightInsectSizeInsectSpecies
skeletal40 exports

no description in the package

Functions and values

BIPED_FEET
BIPED_FEET: readonly string[]
BONE_LIMIT
BONE_LIMIT = 16
QUADRUPED_FEET
QUADRUPED_FEET: readonly string[]
SKIN_SLOTS
SKIN_SLOTS = 4
alertPose
export declare function alertPose(turn?: number): Pose
autoSkin
export declare function autoSkin(bones: Bone[], mesh: Mesh, boneOf: number[], band?: number): Skin
bakePose
export declare function bakePose(rig: Rig, pose: Pose): Mesh
bakeStanding
export declare function bakeStanding(rig: Rig, pose: Pose, standsOn?: readonly string[]): Mesh
bird
export declare function bird(span?: number): Rig
composePose
export declare function composePose(bones: Bone[], pose: Pose): Float32Array
crouchPose
export declare function crouchPose(t?: number): Pose
deerAlert
export declare function deerAlert(turn?: number): Pose
deerGraze
export declare function deerGraze(t?: number): Pose
deerRig
export declare function deerRig(h?: number): Rig
fish
export declare function fish(len?: number): Rig
flapPose
export declare function flapPose(phase: number, amp?: number): Pose
foldPose
export declare function foldPose(t?: number): Pose
glidePose
export declare function glidePose(bank?: number, dihedral?: number): Pose
grazePose
export declare function grazePose(t?: number): Pose
humanoid
export declare function humanoid(h?: number): Rig
mixPose
export declare function mixPose(a: Pose, b: Pose, t: number): Pose
perchPose
export declare function perchPose(settle?: number): Pose
person
export declare function person(h?: number): Rig
personSit
export declare function personSit(o?: { lean?: number; hold?: number; turn?: number; }): Pose
quadruped
export declare function quadruped(h?: number): Rig
rabbit
export declare function rabbit(L?: number): Rig
rabbitAlert
export declare function rabbitAlert(turn?: number): Pose
rabbitFlat
export declare function rabbitFlat(t?: number): Pose
restrictSkinToHierarchy
export declare function restrictSkinToHierarchy(bones: Bone[], skin: Skin): Skin
sitPose
export declare function sitPose(o?: { lean?: number; hold?: number; turn?: number; }): Pose
swimPose
export declare function swimPose(phase: number, amp?: number, wavelength?: number): Pose
trotPose
export declare function trotPose(phase: number, stride?: number): Pose
validatePose
export declare function validatePose(bones: Bone[], pose: Pose): void
validateRig
export declare function validateRig(rig: Rig): void
walkPose
export declare function walkPose(phase: number, stride?: number): Pose

Types

BonePosePoseRotRigSkin
skin32 exports

no description in the package

Functions and values

CELLS_ACROSS_A_FEATURE
CELLS_ACROSS_A_FEATURE = 8
GARMENT_REACH
GARMENT_REACH = 2.2
SKIN_FILLET
SKIN_FILLET = 0.45
SKIN_REACH
SKIN_REACH = 2.6
bipedFace
export declare function bipedFace(bones: readonly Bone[], spec: BipedSpec, heightUnits: number): (boneName: string, p: V3, n: V3) => number | undefined
bipedHeadCell
export declare function bipedHeadCell(rig: Rig, spec: BipedSpec, heightUnits: number): number
bipedLegCell
export declare function bipedLegCell(rig: Rig, spec: BipedSpec, heightUnits: number): number
bipedSkinResolution
export declare function bipedSkinResolution(rig: Rig, spec: BipedSpec, heightUnits: number, detail?: number, cellUnits?: number): number
bipedSolids
export declare function bipedSolids(rig: Rig, spec: BipedSpec, heightUnits: number): BoneSolid[]
bodyField
export declare function bodyField(solids: readonly BoneSolid[], fillet?: number, bones?: readonly Bone[]): SDF
distToSegment
export declare function distToSegment(p: V3, a: V3, b: V3): number
garmentField
export declare function garmentField(solids: readonly BoneSolid[], covers: readonly GarmentCover[], thickness: number, bones?: readonly Bone[]): SDF
growGarment
export declare function growGarment(bones: readonly Bone[], solids: readonly BoneSolid[], covers: readonly GarmentCover[], thickness: number, o?: { resolution?: number; from?: Rig; regionOf?: (boneName: string, p: V3, n: V3) => number | undefined; }): { /** ⚠ carries `region` so `dress()` takes its DECLARED path — *"when the rig says what each * vertex IS, believe it"* — rather than falling throug…
growGarmentShell
export declare function growGarmentShell(skin: Rig & { region?: number[]; }, solids: readonly BoneSolid[], covers: readonly GarmentCover[], thickness: number, o?: { lift?: number; }): { rig: Rig & { region: number[]; }; /** * For each garment vertex, the SKIN vertex it was lifted from. * * ⛔ **RETURNED BECAUSE WITHOUT IT THE LAYER CANNOT BE HONESTLY MEASURED.** The obvious check — * *is every garm…
growSkin
export declare function growSkin(bones: readonly Bone[], solids: readonly BoneSolid[], o?: { resolution?: number; margin?: number; from?: Rig; regionOf?: (boneName: string, p: V3, n: V3) => number | undefined; }): { /** ⚠ carries `region` so `dress()` takes its DECLARED path — *"when the rig says what each * vertex IS, believe it"* — rather than falling through to a derivation written for the swep…
marchBoxOf
export declare function marchBoxOf(solids: readonly BoneSolid[], margin?: number): { min: V3; max: V3; }
marchSpanOf
export declare function marchSpanOf(solids: readonly BoneSolid[], margin?: number): number
nearestSolidOf
export declare function nearestSolidOf(mesh: Mesh, solids: readonly BoneSolid[]): number[]
nearestVertices
export declare function nearestVertices(mesh: Mesh, o: { /** one point per instance of the feature — two eyes, one nose, two ears */ at: readonly V3[]; /** * How far from a target a vertex may be and still be a candidate. **Omit for no bound** — the * biped's face works that way, taking the K nearest out of the whole head with no ball at all, * and a `reach` it did not ask for would silently chang…
outfitCovers
export declare function outfitCovers(bones: readonly Bone[], outfit: { sleeves: "long" | "short" | "none"; hem: "long" | "short"; }): { top: GarmentCover[]; legs: GarmentCover[]; }
quadrupedLegCell
export declare function quadrupedLegCell(rig: Rig, spec: QuadrupedSpec, withersUnits: number): number
quadrupedSkinResolution
export declare function quadrupedSkinResolution(rig: Rig, spec: QuadrupedSpec, withersUnits: number, detail?: number, cellUnits?: number): number
quadrupedSolids
export declare function quadrupedSolids(rig: Rig, spec: QuadrupedSpec, withersUnits: number): BoneSolid[]
regionsFromSolids
export declare function regionsFromSolids(mesh: Mesh, solids: readonly BoneSolid[], bones: readonly Bone[], o?: { of?: (boneName: string, p: V3, n: V3) => number | undefined; minReach?: number; }): number[]
skinFromSolids
export declare function skinFromSolids(mesh: Mesh, solids: readonly BoneSolid[], minReach?: number): { skin: Skin; boneOf: number[]; }
solidsMirrorX
export declare function solidsMirrorX(solids: readonly BoneSolid[]): boolean
stampBipedFace
export declare function stampBipedFace(rig: Rig & { region?: number[]; }, spec: BipedSpec, heightUnits: number, o?: { eyeFrac?: number; noseFrac?: number; earFrac?: number; }): { eye: number; nose: number; ear: number; }
stampNearest
export declare function stampNearest(rig: Rig & { region?: number[]; }, o: Parameters<typeof nearestVertices>[1] & { region: number; keep?: readonly number[]; }): number[]
stampQuadrupedEyes
export declare function stampQuadrupedEyes(rig: Rig & { region?: number[]; }, spec: QuadrupedSpec, withersUnits: number, o?: { frac?: number; reach?: number; }): number[]
wearLayers
export declare function wearLayers(...layers: readonly (Rig & { region?: number[]; })[]): Rig & { region: number[]; }

Types

BoneSolidGarmentCover
garments29 exports

skin, fur, cloth, shoes — the surface a creature wears

Functions and values

BADGER_PELAGE
BADGER_PELAGE: Pelage
CHILD_PLAY
CHILD_PLAY: Outfit
CLOTH_GLOSS
CLOTH_GLOSS = 0.05
FOX_PELAGE
FOX_PELAGE: Pelage
GARMENT_M
GARMENT_M: { /** the standing band of a collar, above the shoulder line */ readonly collar: 0.03; /** a jacket cuff — the turned band at the wrist */ readonly cuff: 0.025; /** ⛔ HOOD CLOTH DEPTH — a lined hood is thicker than a shirt, and it needs SOME depth or its * opening is a paper edge (31 boundary edges, measured on a seated WINTER_COAT). 12 mm is a * waxed outer plus a lining, which is what…
HARE_PELAGE
HARE_PELAGE: Pelage
HILL_WALKER
HILL_WALKER: Outfit
OUTFITS
OUTFITS: Outfit[]
PELAGES
PELAGES: Pelage[]
REFERENCE_ADULT_M
REFERENCE_ADULT_M = 1.72
ROE_PELAGE
ROE_PELAGE: Pelage
RUNNER
RUNNER: Outfit
SUMMER_WALKER
SUMMER_WALKER: Outfit
WINTER_COAT
WINTER_COAT: Outfit
_unbuiltLayerWarnings
export declare function _unbuiltLayerWarnings(reset?: boolean): string[]
colourCensus
export declare function colourCensus(mesh: Mesh, round?: number): { distinct: number; counts: Map<string, number>; }
dress
export declare function dress(rig: Rig, outfit: Outfit, size: number | Scale): Rig
garmentToneUnder
export declare function garmentToneUnder(p: Palette, outfit: Outfit, state: WorldState): SurfaceTone
garmentsSelfCheck
export declare function garmentsSelfCheck(): { ok: boolean; note: string; }[]
outfitPalettes
export declare function outfitPalettes(outfit: Outfit): Record<string, Palette>
pelageAtDetail
export declare function pelageAtDetail(pelage: Pelage, detail: number): Pelage
pelt
export declare function pelt(rig: Rig, pelage: Pelage, size: number | Scale): Rig
siteMap
export declare function siteMap(rig: Rig): (v: number) => VertexSite

Types

BodyChainOutfitPalettePelagePelageMarkingVertexSite
anthropometry9 exports

no description in the package

Functions and values

ALL
ALL: readonly (readonly [string, Segment])[]
BREADTH
BREADTH: { readonly shoulder: Segment; /** * ⛔ **THE WIDEST THING ON A BODY IS NOT `shoulder`, AND THE FIGURE HAS BEEN JUDGED AGAINST THE * WRONG ROW (#269, 2026-09-01).** `biacromialbreadth` is **bone to bone at the acromion**. The * SILHOUETTE runs over the deltoids, and ANSUR measures that separately: * * biacromial 0.2330 ⇒ 40.1 cm the two acromion processes * **bideltoid 0.2857 ⇒ 49.1 cm** wh…
GIRTH
GIRTH: { readonly neck: Segment; readonly head: Segment; readonly shoulder: Segment; readonly upperArm: Segment; readonly foreArm: Segment; readonly wrist: Segment; readonly thighUpper: Segment; readonly thighLower: Segment; readonly calf: Segment; readonly ankle: Segment; }
HEIGHT
HEIGHT: { readonly crown: Segment; readonly eye: Segment; readonly chin: Segment; readonly shoulder: Segment; /** * ⛔ **THE ARMPIT — WHERE THE ARM STOPS BEING PART OF THE TORSO (added 2026-09-01).** Operator, on * the render: *"you have no collisipon control on the arms"*. They are right, and this row is the * line the rule is written against. * * **ABOVE it the deltoid genuinely OVERLIES the ribc…
RATIO
RATIO: { /** * A skull is taller than it is wide. * * ⛔ **1.30 → 1.464 ON 2026-09-01, AND IT IS A CONSTRAINT BETWEEN TWO OTHER ROWS RATHER THAN A * READING OF ITS OWN.** `SEGMENT.head ÷ BREADTH.head` = 0.1300 / 0.0888 = **1.464**, and the row * said 1.30 — a **12.6 % disagreement created the moment `BREADTH.head` was corrected** by ANSUR * II. *Changing one row of a table silently falsified anothe…
SEGMENT
SEGMENT: { readonly head: Segment; readonly neck: Segment; readonly upperArm: Segment; readonly foreArm: Segment; readonly hand: Segment; readonly thigh: Segment; readonly shank: Segment; readonly foot: Segment; /** ⛔ HEEL TO THE BALL — where a foot is WIDEST, and it is **74 % of the way to the toe**, not * halfway. A single taper aimed at the toe would put the widest point in the wrong place. */ …
tableSelfCheck
export declare function tableSelfCheck(): { ok: boolean; note: string; }[]

Types

ConfidenceSegment

Growing things

wood7 exports

no description in the package

Functions and values

birches
birches: (w: World, o?: WoodOptions) => Wood
growWood
export declare function growWood(w: World, species: TreeSpecies, o?: WoodOptions): Wood
oaks
oaks: (w: World, o?: WoodOptions) => Wood
pines
pines: (w: World, o?: WoodOptions) => Wood

Types

StandingTreeWoodWoodOptions
flowers4 exports

no description in the package

Functions and values

abundanceShare
export declare function abundanceShare(species: readonly FlowerSpecies[], total: number): [FlowerSpecies, number][]
growFlowers
export declare function growFlowers(w: World, species: FlowerSpecies, o?: FlowersOptions): Flowers

Types

FlowersFlowersOptions
turf4 exports

no description in the package

Functions and values

growTurf
export declare function growTurf(w: World, spec: SwardSpec, o?: TurfOptions): Turf

Types

TurfTurfBandTurfOptions
trees13 exports

tree SPECIES — the oak's proven recursion, species as data

Functions and values

BIRCH
BIRCH: TreeSpecies
OAK
OAK: TreeSpecies
PINE
PINE: TreeSpecies
TREE_SPECIES
TREE_SPECIES: Record<string, TreeSpecies>
foliageAnchors
export declare function foliageAnchors(tree: GrownTree, species: TreeSpecies, unitsPerMetre: number): TreeTip[]
growTree
export declare function growTree(species: TreeSpecies, height: number | Scale, o?: { seed?: number; minR?: number; }): GrownTree
limbMesh
export declare function limbMesh(limb: TreeLimb, o?: { barkAmp?: number; barkSeed?: number; }): Mesh
standPlan
export declare function standPlan(o: { seed: number; count: number; radius: number; minGap: number; mix: { species: string; weight: number; }[]; }): { p: { x: number; z: number; }; species: string; seed: number; }[]
treeMesh
export declare function treeMesh(tree: GrownTree, o?: { barkAmp?: number; fromDepth?: number; }): Mesh

Types

GrownTreeTreeLimbTreeSpeciesTreeTip
flora16 exports

leaves, grass, flowers — the vegetation vocabulary

Functions and values

ROOT_SINK
ROOT_SINK = 0.12
STEM_LEAN
STEM_LEAN = 0.1
blade
export declare function blade(h: number, w: number, bendDir: V3, bend: number, seg?: number): Mesh
flowerHead
export declare function flowerHead(h: number, petals: number, seed: number, o?: { centreR?: number; }): Mesh
flowerSpike
export declare function flowerSpike(h: number, florets: number, seed: number): Mesh
flowerStem
export declare function flowerStem(h: number, diameter: number): Mesh
grassTuft
export declare function grassTuft(n: number, h: number, w: number, seed: number, seg?: number, spread?: number, bend?: number): Mesh
leafCard
export declare function leafCard(base: V3, dir: V3, L: number, n: V3): Mesh
leafClump
export declare function leafClump(kind: LeafKind, count: number, r: number, seed: number, leafLen?: number): Mesh
needleTuft
export declare function needleTuft(base: V3, dir: V3, L: number, n: V3): Mesh
rosette
export declare function rosette(n: number, r: number, seed: number): Mesh
seedHead
export declare function seedHead(h: number, seed: number): Mesh
sprig
export declare function sprig(base: V3, dir: V3, L: number, roll: number, n: V3): Mesh
stemAt
export declare function stemAt(h: number, u: number): V3
umbel
export declare function umbel(h: number, rays: number, seed: number): Mesh

Types

LeafKind
meadow40 exports

flower + grass SPECIES — the meadow, askable by name

Functions and values

BLUEBELL
BLUEBELL: FlowerSpecies
BRACKEN
BRACKEN: GrassSpecies
BROAD_DOCK
BROAD_DOCK: GrassSpecies
BUTTERCUP
BUTTERCUP: FlowerSpecies
COW_PARSLEY
COW_PARSLEY: FlowerSpecies
DEAD_THATCH
DEAD_THATCH: GrassSpecies
DRY_STRAW
DRY_STRAW: GrassSpecies
FINE_GRASS
FINE_GRASS: GrassSpecies
FLOWER_SPECIES
FLOWER_SPECIES: Record<string, FlowerSpecies>
FOXGLOVE
FOXGLOVE: FlowerSpecies
GRASS_SPECIES
GRASS_SPECIES: Record<string, GrassSpecies>
GROUND_LITTER
GROUND_LITTER: GrassSpecies[]
LEAF_LITTER
LEAF_LITTER: GrassSpecies
LITTER_SPECIES
LITTER_SPECIES: Record<string, GrassSpecies>
MEADOW_FLOWERS
MEADOW_FLOWERS: FlowerSpecies[]
MEADOW_FOXTAIL
MEADOW_FOXTAIL: GrassSpecies
MEADOW_GRASS
MEADOW_GRASS: GrassSpecies
MEADOW_GROUND
MEADOW_GROUND: GrassSpecies[]
MOSS_CUSHION
MOSS_CUSHION: GrassSpecies
OXEYE_DAISY
OXEYE_DAISY: FlowerSpecies
PETAL_GLOSS
PETAL_GLOSS = 0.03
PIGNUT
PIGNUT: FlowerSpecies
PLANTAIN
PLANTAIN: GrassSpecies
POPPY
POPPY: FlowerSpecies
QUAKING_GRASS
QUAKING_GRASS: GrassSpecies
SCABIOUS
SCABIOUS: FlowerSpecies
TALL_BENT
TALL_BENT: GrassSpecies
YORKSHIRE_FOG
YORKSHIRE_FOG: GrassSpecies
flowerToneUnder
export declare function flowerToneUnder(spec: FlowerSpecies, part: "face" | "stem", state: WorldState): SurfaceTone
groundPlant
export declare function groundPlant(name: string): GrassSpecies
growFlower
export declare function growFlower(species: FlowerSpecies, size: number | Scale, seed: number): { head: Mesh; stem: Mesh; }
growGrass
export declare function growGrass(species: GrassSpecies, size: number | Scale, seed: number): Mesh
meadowSelfCheck
export declare function meadowSelfCheck(): { ok: boolean; note: string; }[]

Types

FlowerFormFlowerSpeciesGrassFormGrassSpeciesSwayToneTuftShape
sward54 exports

ground cover that is good at every distance

Functions and values

BARE_COVER
BARE_COVER: GroundCover
CAM_FOCAL_MUL
CAM_FOCAL_MUL = 1.15
CAM_PITCH_RAD
CAM_PITCH_RAD = 0.5
COVER_BLEND
COVER_BLEND = 0.18
COVER_CALIBRATION_N
COVER_CALIBRATION_N = 4096
COVER_KINDS
COVER_KINDS: readonly CoverKind[]
COVER_SPECS
COVER_SPECS: Record<CoverKind, GroundCover>
DAMP_COVER
DAMP_COVER: GroundCover
DAMP_SWARD
DAMP_SWARD: SwardSpec
FAIRWAY_COVER
FAIRWAY_COVER: GroundCover
GREEN_COVER
GREEN_COVER: GroundCover
GROUND_COVERS
GROUND_COVERS: readonly GroundCover[]
LAWN_SWARD
LAWN_SWARD: SwardSpec
LITTER_MIN_PX2
LITTER_MIN_PX2 = 4
MEADOW_COVER
MEADOW_COVER: GroundCover
MEADOW_SWARD
MEADOW_SWARD: SwardSpec
MOWN_COVER
MOWN_COVER: GroundCover
ROUGH_COVER
ROUGH_COVER: GroundCover
ROUGH_SWARD
ROUGH_SWARD: SwardSpec
SAND_COVER
SAND_COVER: GroundCover
SWARDS
SWARDS: readonly SwardSpec[]
SWARD_SPECS
SWARD_SPECS: Record<string, SwardSpec>
TEE_COVER
TEE_COVER: GroundCover
WORN_COVER
WORN_COVER: GroundCover
WORN_SWARD
WORN_SWARD: SwardSpec
atDetail
export declare function atDetail(covers: readonly GroundCover[], detail: number): GroundCover[]
bandAreaM2
export declare function bandAreaM2(band: SwardBand, radiusM: number): number
bandCount
export declare function bandCount(band: SwardBand, radiusM: number): number
checkCover
export declare function checkCover(cover: GroundCover, fn: string): void
checkSward
export declare function checkSward(spec: SwardSpec, fn: string): void
coverPatchFloorM
export declare function coverPatchFloorM(spacingM: number): number
coverReachM
export declare function coverReachM(patchM: number, spacing: (rM: number) => number, maxRM?: number): number
groundCover
export declare function groundCover(o: { size: number | Scale; seed: number; /** relative AREA weights per cover; keys must be `CoverKind`s and weights positive */ mix: Partial<Record<CoverKind, number>>; /** how big one patch of one cover is at the viewer, in METRES across */ patchM: number; /** the ground mesh's local vertex spacing in metres at a radius of r metres */ spacingM?: (rM: number) =>…
groundPaint
export declare function groundPaint(o: { coverAt: CoverAt; size: number | Scale; seed: number; covers?: readonly GroundCover[]; }): (i: number, x: number, y: number, z: number) => [number, number, number]
groundPerVertexM2
export declare function groundPerVertexM2(band: SwardBand): number
growSwardBand
export declare function growSwardBand(band: SwardBand, size: number | Scale, seed: number): Mesh
litterPlan
export declare function litterPlan(coverAt: CoverAt, size: number | Scale, o: { /** WORLD UNITS */ radius: number; seed: number; screenPx: number; covers?: readonly GroundCover[]; minPx2?: number; focalMul?: number; pitchRad?: number; clearOf?: (x: number, z: number) => boolean; centre?: { x: number; z: number; }; }): LitterPlacement[]
litterReachM
export declare function litterReachM(species: GrassSpecies, o: { screenPx: number; minPx2?: number; focalMul?: number; pitchRad?: number; }): number
mownCover
export declare function mownCover(cutM: number, o?: { common?: string; }): GroundCover
polarGroundSpacing
export declare function polarGroundSpacing(o: { radiusM: number; nu: number; nv: number; power?: number; }): (rM: number) => number
swardBatches
export declare function swardBatches(coverAt: CoverAt, size: number | Scale, o: { /** WORLD UNITS, exactly as `swardPlan`'s */ radius: number; seed: number; covers?: readonly GroundCover[]; clearOf?: (x: number, z: number) => boolean; centre?: { x: number; z: number; }; }): SwardBatch[]
swardPlan
export declare function swardPlan(spec: SwardSpec, size: number | Scale, o: { radius: number; seed: number; clearOf?: (x: number, z: number) => boolean; /** * ⛔ WHERE THE BANDS ARE MEASURED FROM. Defaults to the world origin, which is what this * function always assumed and never said. * * ⚠ IT MATTERS BECAUSE THE BANDS ARE ABOUT APPARENT SIZE. The whole design is "fine near, * wide far" — a state…
swardSelfCheck
export declare function swardSelfCheck(): { ok: boolean; note: string; }[]
swardToneUnder
export declare function swardToneUnder(band: SwardBand, state: WorldState): SurfaceTone

Types

CoverAtCoverKindCoverLitterGroundCoverLitterPlacementSoilSpecSwardBandSwardBatchSwardPlacementSwardSpec

Made things and ground

props21 exports

benches, vessels, stones — the human-made things

Functions and values

BENCHES
BENCHES: Record<string, BenchSpec>
BOTTLE
BOTTLE: VesselSpec
BOULDER
BOULDER: StoneSpec
COBBLE
COBBLE: StoneSpec
LOG_SEAT
LOG_SEAT: BenchSpec
MUG
MUG: VesselSpec
PARK_BENCH
PARK_BENCH: BenchSpec
PICNIC_BENCH
PICNIC_BENCH: BenchSpec
STEPPING_STONE
STEPPING_STONE: StoneSpec
STONES
STONES: Record<string, StoneSpec>
TIN_CUP
TIN_CUP: VesselSpec
VESSELS
VESSELS: Record<string, VesselSpec>
benchFacing
export declare function benchFacing(spec: BenchSpec): number | null
benchSeatX
export declare function benchSeatX(spec: BenchSpec, index: number, count: number, size: number | Scale): number
benchSeatY
export declare function benchSeatY(spec: BenchSpec, size: number | Scale): number
growBench
export declare function growBench(spec: BenchSpec, size: number | Scale): Mesh
growStone
export declare function growStone(spec: StoneSpec, size: number | Scale, o?: { seed?: number; }): Mesh
growVessel
export declare function growVessel(spec: VesselSpec, size: number | Scale): Mesh

Types

BenchSpecStoneSpecVesselSpec
paths32 exports

made ways: routed, graded, draped, and walked

Functions and values

DESIRE_LINE
DESIRE_LINE: PathSpec
MOWN_RIDE
MOWN_RIDE: PathSpec
PARK_FOOTPATH
PARK_FOOTPATH: PathSpec
PATHS
PATHS: Record<string, PathSpec>
PATH_SURFACES
PATH_SURFACES: Record<PathSurface, PathMaterial>
SHARED_PATH
SHARED_PATH: PathSpec
checkPath
export declare function checkPath(spec: PathSpec, fn: string): void
clearOfPath
export declare function clearOfPath(route: PathRoute): (x: number, z: number) => boolean
gaitCycleM
export declare function gaitCycleM(legM: number, strideRad?: number): number
growPath
export declare function growPath(route: PathRoute, o?: { /** 0–1 from `tier.ts`; default 1. Thins CROSS ROWS only — see above. */ detail?: number; /** deterministic surface speckle so the ribbon does not read as flat plastic; default 1 */ seed?: number; /** override the material's own worn-margin tone. The material carries one, so a scene never * has to know what colour the ground beside the path …
onPath
export declare function onPath(route: PathRoute, x: number, z: number): boolean
pathDrapeReport
export declare function pathDrapeReport(route: PathRoute): PathDrape
pathGradeReport
export declare function pathGradeReport(route: PathRoute): PathGrade
pathLateralM
export declare function pathLateralM(route: PathRoute, x: number, z: number): number
pathLengthM
export declare function pathLengthM(route: PathRoute): number
pathPointAt
export declare function pathPointAt(route: PathRoute, t: number): PathPoint
pathRoute
export declare function pathRoute(spec: PathSpec, boundary: BoundaryPoint[], size: number | Scale, o: { /** metres out along each boundary normal. Positive = away from what the boundary bounds. */ offsetM: number; /** the SCENE's own ground, world units in and out. Required — see above. */ groundY: (x: number, z: number) => number; /** does the boundary close into a loop? `water.shoreline` returns…
pathRouteFrom
export declare function pathRouteFrom(spec: PathSpec, points: { x: number; z: number; }[], size: number | Scale, o: { groundY: (x: number, z: number) => number; closed?: boolean; forbid?: (x: number, z: number) => boolean; }): PathRoute
pathSurfaceOf
export declare function pathSurfaceOf(spec: PathSpec): { kind: PathGrain; gloss: number; common: string; }
pathToneUnder
export declare function pathToneUnder(material: PathMaterial, state: WorldState): SurfaceTone
pathsSelfCheck
export declare function pathsSelfCheck(): { ok: boolean; note: string; }[]
strideForStepM
export declare function strideForStepM(legM: number, stepM: number): number
walkPath
export declare function walkPath(route: PathRoute, o: { /** how many walkers at full detail */ count: number; /** deterministic: the same seed must give the same crowd */ seed: number; /** seconds. Walkers advance along the route at `speedMps`. */ time: number; /** metres per second; default 1.4 */ speedMps?: number; /** 0–1 from `tier.ts`; default 1 */ detail?: number; /** one gait cycle's ground…

Types

BoundaryPointPathDrapePathGradePathGrainPathMaterialPathPointPathRoutePathSpecPathSurface
golf75 exports

a nine-hole parkland course, askable by name

Functions and values

BLADE_MOW_MM
BLADE_MOW_MM = 25
COURSES
COURSES: Record<string, CourseSpec>
COURSE_DETAIL
COURSE_DETAIL = 1
COURSE_TURF
COURSE_TURF: readonly TurfSpec[]
CUP_DEPTH_M
CUP_DEPTH_M = 0.102
CUP_DIAMETER_M
CUP_DIAMETER_M = 0.108
FAIRWAY_TURF
FAIRWAY_TURF: TurfSpec
FAIRWAY_WIDTH_M
FAIRWAY_WIDTH_M: readonly [number, number]
FLAGSTICK_M
FLAGSTICK_M = 2.13
GREEN_AREA_M2
GREEN_AREA_M2: readonly [number, number]
GREEN_SURROUND
GREEN_SURROUND = 1.2
GREEN_TURF
GREEN_TURF: TurfSpec
PARKLAND_NINE
PARKLAND_NINE: CourseSpec
PARKLAND_SAND
PARKLAND_SAND: CourseTone
PARK_PAR3_NINE
PARK_PAR3_NINE: CourseSpec
PAR_BAND_M
PAR_BAND_M: Readonly<Record<number, readonly [number, number]>>
PROBE_ACROSS
PROBE_ACROSS = 5
PROBE_STEP_M
PROBE_STEP_M = 4
ROUGH_TURF
ROUGH_TURF: TurfSpec
SAMPLES_PER_STRIPE
SAMPLES_PER_STRIPE = 3
SEMI_ROUGH_TURF
SEMI_ROUGH_TURF: TurfSpec
SEP_SAMPLE_M
SEP_SAMPLE_M = 6
STRIPE_LIGHT_STEP
STRIPE_LIGHT_STEP = 2.3
TEE_TURF
TEE_TURF: TurfSpec
TURF_BY_KIND
TURF_BY_KIND: Record<TurfKind, TurfSpec>
TURF_KINDS
TURF_KINDS: readonly TurfKind[]
TURF_SWARD_REACH_M
TURF_SWARD_REACH_M = 400
TURF_TONE_LAW
TURF_TONE_LAW = "sorted by mowHeightMm ascending, hue / sat / light / gloss must all fall strictly"
bunkerAt
export declare function bunkerAt(plan: CoursePlan, x: number, z: number): { bunker: PlacedBunker; r: number; } | null
checkCourse
export declare function checkCourse(spec: CourseSpec, fn: string): void
courseLengthM
export declare function courseLengthM(spec: CourseSpec): number
coursePar
export declare function coursePar(spec: CourseSpec): number
coursePlan
export declare function coursePlan(spec: CourseSpec, size: number | Scale, o: { /** the ground's edge, with normals pointing INLAND — `water.shoreline`'s return, verbatim */ boundary: { p: V3; normal: V3; }[]; /** the plan is deterministic on this: the same seed must give the same course */ seed: number; /** * Is this ground available for a golf hole? **Return `true` for usable ground.** Called at…
cupDiameter
export declare function cupDiameter(spec: CourseSpec, size: number | Scale): number
flagstickHeight
export declare function flagstickHeight(spec: CourseSpec, size: number | Scale): number
golfSelfCheck
export declare function golfSelfCheck(): { ok: boolean; note: string; }[]
greenRadiusM
export declare function greenRadiusM(hole: HoleSpec): number
growBunker
export declare function growBunker(b: PlacedBunker, spec: CourseSpec, size: number | Scale, o: { groundY: (x: number, z: number) => number; detail?: number; }): Mesh
growCourse
export declare function growCourse(spec: CourseSpec, size: number | Scale, o: { /** the layout, from `coursePlan` */ plan: CoursePlan; /** the scene's OWN ground height, in world units. Required — never defaulted. */ groundY: (x: number, z: number) => number; /** tessellation multiplier — see `COURSE_DETAIL` */ detail?: number; }): GrownCourse
growFairway
export declare function growFairway(pl: HolePlacement, spec: CourseSpec, size: number | Scale, o: { groundY: (x: number, z: number) => number; detail?: number; }): Mesh
growFlag
export declare function growFlag(spec: CourseSpec, size: number | Scale, o?: { detail?: number; }): Mesh
growGreen
export declare function growGreen(pl: HolePlacement, spec: CourseSpec, size: number | Scale, o: { groundY: (x: number, z: number) => number; detail?: number; }): Mesh
growTee
export declare function growTee(pl: HolePlacement, spec: CourseSpec, size: number | Scale, o: { groundY: (x: number, z: number) => number; detail?: number; }): Mesh
growWalk
export declare function growWalk(from: XZ, to: XZ, spec: CourseSpec, size: number | Scale, o: { groundY: (x: number, z: number) => number; detail?: number; }): Mesh
holeApproachYaw
export declare function holeApproachYaw(pl: HolePlacement): number
holeGreen
export declare function holeGreen(pl: HolePlacement): XZ
holeRunM
export declare function holeRunM(hole: HoleSpec): number
holeTee
export declare function holeTee(pl: HolePlacement): XZ
holeTeeBack
export declare function holeTeeBack(pl: HolePlacement): XZ
holeYaw
export declare function holeYaw(pl: HolePlacement): number
parBandM
export declare function parBandM(par: number): [number, number]
roughScatter
export declare function roughScatter(plan: CoursePlan, size: number | Scale, o: { /** which band — `"semi-rough"` or `"rough"`. A mown kind THROWS, as `turfSward` does. */ kind: TurfKind; /** the sward to plant, from `turfSward(TURF_BY_KIND[kind])` */ sward: SwardSpec; /** deterministic on this */ seed: number; /** where the distance bands are measured from, in WORLD UNITS */ centre: { x: number; …
roughScatterEven
export declare function roughScatterEven(plan: CoursePlan, size: number | Scale, o: { /** which band — `"semi-rough"` or `"rough"`. A mown kind THROWS, as `turfSward` does. */ kind: TurfKind; /** the sward to plant, from `turfSward(TURF_BY_KIND[kind])` */ sward: SwardSpec; /** WHICH band supplies the density and the blade. The caller's affordance decision. */ band: number; /** deterministic on thi…
stripeAcross
export declare function stripeAcross(widthM: number, turf: TurfSpec, detail: number): number
stripeLight
export declare function stripeLight(turf: TurfSpec, lateralUnits: number, unitsPerMetre: number): number
turfAt
export declare function turfAt(plan: CoursePlan, x: number, z: number): TurfKind | "sand" | null
turfDrawsBlades
export declare function turfDrawsBlades(turf: TurfSpec): boolean
turfEdgeAt
export declare function turfEdgeAt(plan: CoursePlan, x: number, z: number): { kind: TurfKind | null; outM: number; }
turfFor
export declare function turfFor(spec: CourseSpec, kind: TurfKind): TurfSpec
turfSward
export declare function turfSward(turf: TurfSpec, o?: { reachM?: number; }): SwardSpec
turfToneUnder
export declare function turfToneUnder(spec: CourseSpec, kind: TurfKind, state: WorldState): SurfaceTone

Types

BunkerSpecCourseDropCoursePlanCourseSpecCourseToneGrownCourseHolePlacementHoleSpecMownPatchPlacedBunkerRoughPlacementTurfKindTurfSpecXZ

Governing the frame

tier13 exports

what THIS machine can draw — classify, then govern

Functions and values

FORM_FLOOR
FORM_FLOOR: number
FORM_MIN_SIDES
FORM_MIN_SIDES = 8
FORM_NOMINAL_SIDES
FORM_NOMINAL_SIDES = 12
FORM_RUNGS
FORM_RUNGS: readonly number[]
FORM_SIDE_LADDER
FORM_SIDE_LADDER: readonly number[]
FrameGovernor
export declare class FrameGovernor { /** the frame time to aim under, ms. 20 ms ≈ 50 fps, leaving headroom under a 60 Hz vsync. */ readonly targetMs: number; /** how many frames to gather before judging */ readonly window: number; /** the deepest cut allowed */ readonly maxLevel: number; /** * The least improvement a cut must buy to be worth keeping, as a fraction of the frame time * that triggere…
classifyRenderer
export declare function classifyRenderer(renderer: string): GpuTier
formFloorFor
export declare function formFloorFor(nominalSides: number, minSides?: number): number
nestedCount
export declare function nestedCount(baseSegments: number, dial: number, Lmax?: number): number
sidesAt
export declare function sidesAt(nominalSides: number, form: number): number
silhouetteError
export declare function silhouetteError(sides: number): number
trimmedMean
export declare function trimmedMean(samples: readonly number[]): number

Types

GpuTier
scale5 exports

one place that knows how big a metre is

Functions and values

PLANT_M
PLANT_M: { /** a meadow grass tussock — knee-high at most, and most of a lawn is half this */ readonly grassTussock: 0.42; /** the fine mat between the tussocks */ readonly grassFine: 0.18; /** a tall bent-grass, the stuff that breaks a meadow's flat line */ readonly grassTall: 0.75; /** a grass seed head on its stem */ readonly seedHead: 0.65; /** the small one — quaking grass */ readonly seedHea…
stemDiameterM
export declare function stemDiameterM(heightM: number): number
unitsFor
export declare function unitsFor(size: number | Scale, realMetres: number): number
unitsPerMetreOf
export declare function unitsPerMetreOf(s: Scale): number

Types

Scale
objectives8 exports

no description in the package

Functions and values

ObjectivesCore
export declare class ObjectivesCore { private apply; private objs; private listeners; private floor; private settleAfter; constructor(apply: ChannelAppliers, opts?: ObjectivesOpts); /** Define (or wholly replace) a named objective. The drive starts on the next tick. */ define(name: string, spec: ObjectiveSpec, camNow?: ObjectiveCamera): void; /** Move a live objective's goal — progress restarts FR…
attachObjectives
export declare function attachObjectives(world: World, opts?: ObjectivesOpts): Objectives

Types

ChannelAppliersMovementReadingObjectiveCameraObjectiveSpecObjectivesObjectivesOpts

The charts API rides on top

A chart recipe written against the charts package ports forward by changing one import. That is the reason to start small: nothing is thrown away if a chart later needs a world.

What it costs to run

Both packages carry their own frame-cost gate and publish measured figures with the conditions attached. Those numbers belong with their conditions, so they are not repeated here.

Licence · MIT