dot(a: V3, b: V3) → number return a
| arg | type | description |
|---|
| a | V3 | |
| b | V3 | |
cross(a: V3, b: V3) → V3
| arg | type | description |
|---|
| a | V3 | |
| b | V3 | |
color(c: { number }, onTop: boolean?) → any
An unlit flat-colour material {r,g,b}; `onTop` draws it over everything (no depth test, overlay queue). Cached.
| arg | type | description |
|---|
| c | { number } | |
| onTop | boolean? | |
pbr(c: { number }, rough: number, metal: number) → any
A lit PBR colour (for the stand-in parts and the stand). Cached.
| arg | type | description |
|---|
| c | { number } | |
| rough | number | |
| metal | number | |
lines( ) → Lines
A new, empty line/triangle builder.
vert(b: Lines, p: V3, n: V3) → number
| arg | type | description |
|---|
| b | Lines | |
| p | V3 | |
| n | V3 | |
tri(b: Lines, a: number, c: number, d: number) → void
| arg | type | description |
|---|
| b | Lines | |
| a | number | |
| c | number | |
| d | number | |
seg(b: Lines, a: V3, c: V3, w: number) → void
A line from a to b, `w` metres thick (a square prism, drawn two-sided).
| arg | type | description |
|---|
| b | Lines | |
| a | V3 | |
| c | V3 | |
| w | number | |
circle(b: Lines, c: V3, axis: V3, r: number, seg: number, w: number) → void
A circle of `seg` line pieces about `axis` through `c`.
| arg | type | description |
|---|
| b | Lines | |
| c | V3 | |
| axis | V3 | |
| r | number | |
| seg | number | |
| w | number | |
cone(b: Lines, a: V3, c: V3, r: number, seg: number) → void
A solid cone from base centre `a` (radius r) to tip `c`.
| arg | type | description |
|---|
| b | Lines | |
| a | V3 | |
| c | V3 | |
| r | number | |
| seg | number | |
box(b: Lines, mn: V3, mx: V3) → void
A solid axis-aligned box from mn to mx.
| arg | type | description |
|---|
| b | Lines | |
| mn | V3 | |
| mx | V3 | |
q(p1: V3, p2: V3, p3: V3, p4: V3, n: V3) → void
| arg | type | description |
|---|
| p1 | V3 | |
| p2 | V3 | |
| p3 | V3 | |
| p4 | V3 | |
| n | V3 | |
quad(b: Lines, p1: V3, p2: V3, p3: V3, p4: V3) → void
A flat quad a-b-c-d (two-sided through the material).
| arg | type | description |
|---|
| b | Lines | |
| p1 | V3 | |
| p2 | V3 | |
| p3 | V3 | |
| p4 | V3 | |
wireBox(b: Lines, hx: number, hy: number, hz: number, w: number) → void
The 12 edges of a box (half extents hx, hy, hz about the origin) as lines `w` thick.
| arg | type | description |
|---|
| b | Lines | |
| hx | number | |
| hy | number | |
| hz | number | |
| w | number | |
mesh(b: Lines, key: string?) → any
Turn a builder into a mesh handle (nil when empty). `key` caches it for reuse.
| arg | type | description |
|---|
| b | Lines | |
| key | string? | |
cached(key: string, fn: (Lines) → void
A cached mesh built by `fn(builder)` under `key`.
| arg | type | description |
|---|
| key | string | |
| fn | (Lines | |
spawnMesh(name: string, parent: any, mesh: any, mat: any, shadows: boolean?) → any
Spawn a temporary child entity drawing `mesh` (a handle or a primitive name) with `mat`.
| arg | type | description |
|---|
| name | string | |
| parent | any | |
| mesh | any | |
| mat | any | |
| shadows | boolean? | |
setModel(e: any, mesh: any, mat: any) → void
Replace the Model mesh/material an entity draws (adds the Model when missing).
| arg | type | description |
|---|
| e | any | |
| mesh | any | |
| mat | any | |