next(self: any) → number
| arg | type | description |
|---|
| self | any | |
range(self: any, a: number, b: number) → number
| arg | type | description |
|---|
| self | any | |
| a | number | |
| b | number | |
int(self: any, a: number, b: number) → number
| arg | type | description |
|---|
| self | any | |
| a | number | |
| b | number | |
pick(self: any, t: { any }) → any
| arg | type | description |
|---|
| self | any | |
| t | { any } | |
rng(seed: number) → Rng
| arg | type | description |
|---|
| seed | number | |
fbm(x: number, y: number, z: number, octaves: number?) → number
fractal noise in [-1, 1]-ish
| arg | type | description |
|---|
| x | number | |
| y | number | |
| z | number | |
| octaves | number? | |
tri(g: Geo, a: number, b: number, c: number) → void
| arg | type | description |
|---|
| g | Geo | |
| a | number | |
| b | number | |
| c | number | |
count(g: Geo) → number return
triCount(g: Geo) → number return
norm3(x: number, y: number, z: number) → void
| arg | type | description |
|---|
| x | number | |
| y | number | |
| z | number | |
cross(ax: number, ay: number, az: number, bx: number, by: number, bz: number) → void
| arg | type | description |
|---|
| ax | number | |
| ay | number | |
| az | number | |
| bx | number | |
| by | number | |
| bz | number | |
rot(yaw: number, pitch: number?, roll: number?) → Mat
rotation matrix from yaw (about Y), pitch (about X), roll (about Z): R = Ry * Rx * Rz
| arg | type | description |
|---|
| yaw | number | |
| pitch | number? | |
| roll | number? | |
mulv(m: Mat, x: number, y: number, z: number) → void
| arg | type | description |
|---|
| m | Mat | |
| x | number | |
| y | number | |
| z | number | |
append(dst: Geo, src: Geo, xf: Xf?, tint: Vec?, alphaMul: number?, alphaAdd: number?) → Geo
Copy src into dst through a transform (scale, then rotate, then translate).
`tint` multiplies vertex RGB; `alphaMul`/`alphaAdd` remap the sway weight.
| arg | type | description |
|---|
| dst | Geo | |
| src | Geo | |
| xf | Xf? | |
| tint | Vec? | |
| alphaMul | number? | |
| alphaAdd | number? | |
recomputeNormals(g: Geo) → Geo
Area-weighted smooth normals rebuilt from the triangles.
weldNormals(g: Geo, eps: number?) → Geo
Smooth normals across seams: vertices sharing a position (within eps) get the
same averaged normal, so a tube's UV seam does not show as a crease.
| arg | type | description |
|---|
| g | Geo | |
| eps | number? | |
bendNormalsUp(g: Geo, k: number) → Geo
Bend each normal toward +Y by `k` (0..1): soft, sky-lit shading for foliage cards.
| arg | type | description |
|---|
| g | Geo | |
| k | number | |
strip(spine: { Vec }, o: StripOpts) → Geo
| arg | type | description |
|---|
| spine | { Vec } | |
| o | StripOpts | |
arcSpine(len: number, yaw: number, lean: number, droop: number, segs: number, twist: number?) → void
A blade/frond spine: rises from origin along `dir` (yaw, lean from vertical),
arching over under gravity. Returns `segs`+1 points.
| arg | type | description |
|---|
| len | number | |
| yaw | number | |
| lean | number | |
| droop | number | |
| segs | number | |
| twist | number? | |
tube(pts: { Vec }, radii: { number }, sides: number, o: TubeOpts?) → void
| arg | type | description |
|---|
| pts | { Vec } | |
| radii | { number } | |
| sides | number | |
| o | TubeOpts? | |
geosphere(level: number) → void
A geodesic sphere (subdivided octahedron, even triangles, no poles) pushed by
`shape(dx, dy, dz) -> radius`, then squashed below `floorY` to a flat base.
| arg | type | description |
|---|
| level | number | |
mid(a: number, b: number) → number
| arg | type | description |
|---|
| a | number | |
| b | number | |
blob(o: BlobOpts) → Geo
Positions come from shape(); UVs are a box projection (by the dominant normal
axis of the base direction) scaled by uvScale per metre.
| arg | type | description |
|---|
| o | BlobOpts | |
mossSkin(src: Geo, mask: (x: number, y: number, z: number, nx: number, ny: number, nz: number) → void
A layer of moss grown over the parts of `src` where mask(x,y,z,nx,ny,nz) > 0:
the covered triangles are copied and pushed out along their normals by up to
`thick` metres (thinning toward the mask's edge), tinted by `tint`. The result
is a second draw (a moss material) that sits on the bark or stone below.
| arg | type | description |
|---|
| src | Geo | |
| mask | (x: number, y: number, z: number, nx: number, ny: number, nz: number | |
vert(i: number) → number
| arg | type | description |
|---|
| i | number | |
orient(g: Geo, ref: (x: number, y: number, z: number) → void
Flip any triangle whose face normal disagrees with ref(cx,cy,cz) -> dx,dy,dz
(a direction it should face, judged at the triangle's centre).
| arg | type | description |
|---|
| g | Geo | |
| ref | (x: number, y: number, z: number | |
isEmpty(g: Geo) → boolean return
Merge vertices that share a position (so a displaced shape stays closed).
q(v: number, s: number) → number
Round to keep baked files small and bake output byte-stable across runs.
| arg | type | description |
|---|
| v | number | |
| s | number | |