geom
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
geom
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->TODO: describe this module.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2house.geom — the mesh lathe of the Odeon Marisol. Every wall, arch, cove and seat in this theatre is built here out of one accumulator: a builder collects positions / normals / uvs / indices and hands them to `asset.create("mesh", ...)`. Nothing in this module knows what a theatre is; it knows quads, boxes, arcs, lathes and extrusions. local Geom = require("house.geom") local b = Geom.builder() b.box(-1, 0, -1, 1, 3, 1) local mesh = Geom.mesh("pillar", b, "house/meshes") UVs come out in METRES so a material's uv_scale reads as a real-world tile.
sub(a: P3, c: P3) → P3
| arg | type | description |
|---|---|---|
| a | P3 | |
| c | P3 |
cross(a: P3, c: P3) → P3
| arg | type | description |
|---|---|---|
| a | P3 | |
| c | P3 |
norm(a: P3) → P3
| arg | type | description |
|---|---|---|
| a | P3 |
builder( ) → void
A builder. Closure-based so every method is a plain field the checker sees.
paint(fn: ((number, number, number) → void
Every vertex pushed from here on carries the colour this returns, multiplied into the material's base colour by the shader. It is how the room gets its dirt: soot climbing the plaster, damp running down from the cornice, tarnish crawling over the gilt — all of it in the geometry, at no extra draw call and with no texture to author.
| arg | type | description |
|---|---|---|
| fn | ((number, number, number |
vert(x: number, y: number, z: number, nx: number, ny: number, nz: number, u: number, v: number) → number
Push one vertex, return its 0-based index.
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number | |
| nx | number | |
| ny | number | |
| nz | number | |
| u | number | |
| v | number |
tri(a: number, c: number, d: number) → void
| arg | type | description |
|---|---|---|
| a | number | |
| c | number | |
| d | number |
quad(p0: P3, p1: P3, p2: P3, p3: P3, uscale: number?, vscale: number?) → void
A quad from four corners wound counter-clockwise as seen from its front. The normal is the face's own; UVs run in metres along the two edges.
| arg | type | description |
|---|---|---|
| p0 | P3 | |
| p1 | P3 | |
| p2 | P3 | |
| p3 | P3 | |
| uscale | number? | |
| vscale | number? |
face(p0: P3, p1: P3, p2: P3, p3: P3, dir: P3, uscale: number?, vscale: number?) → void
A quad that must end up facing `dir`, whichever way its corners were listed. Stating the direction a surface faces is the whole difference between a room and a room turned inside out, so every surface in this theatre is authored through here rather than through raw winding.
| arg | type | description |
|---|---|---|
| p0 | P3 | |
| p1 | P3 | |
| p2 | P3 | |
| p3 | P3 | |
| dir | P3 | |
| uscale | number? | |
| vscale | number? |
box(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, inward: boolean?) → void
An axis-aligned box. `inward` turns every face around so the box reads as a room seen from inside.
| arg | type | description |
|---|---|---|
| x0 | number | |
| y0 | number | |
| z0 | number | |
| x1 | number | |
| y1 | number | |
| z1 | number | |
| inward | boolean? |
q(p0: P3, p1: P3, p2: P3, p3: P3) → void
| arg | type | description |
|---|---|---|
| p0 | P3 | |
| p1 | P3 | |
| p2 | P3 | |
| p3 | P3 |
stitch(ringA: { P3 }, ringB: { P3 }, close: boolean?, flip: boolean?) → void
Two rings of the same length stitched into a tube. Each ring is a list of {x,y,z}. `close` joins the last pair back to the first.
| arg | type | description |
|---|---|---|
| ringA | { P3 } | |
| ringB | { P3 } | |
| close | boolean? | |
| flip | boolean? |
fan(ring: { P3 }, n: P3, flip: boolean?) → void
A convex fan over one ring, facing `n`.
| arg | type | description |
|---|---|---|
| ring | { P3 } | |
| n | P3 | |
| flip | boolean? |
sweep(profile: { { number } }, path: { P3 }, right: P3, up: P3, capEnds: boolean?) → void
Sweep a closed 2D profile (list of {u, v} in the sweep's local frame) along a polyline `path` of {x,y,z}, where the profile's u runs along `right` and its v along `up`. The frame is fixed, which is what a moulding running round an arch in one plane wants.
| arg | type | description |
|---|---|---|
| profile | { { number } } | |
| path | { P3 } | |
| right | P3 | |
| up | P3 | |
| capEnds | boolean? |
count( ) → number
data( ) → void
bounds( ) → void
The axis-aligned extent of everything pushed so far, as { x0, y0, z0, x1, y1, z1 } — the read that answers "is this piece where I meant to put it" without a capture.
arc(cx: number, cy: number, r: number, a0: number, a1: number, steps: number, z: number) → void
Points along an arc in the XY plane, centre (cx, cy), from a0 to a1 radians.
| arg | type | description |
|---|---|---|
| cx | number | |
| cy | number | |
| r | number | |
| a0 | number | |
| a1 | number | |
| steps | number | |
| z | number |
circleXZ(cx: number, cz: number, r: number, y: number, steps: number) → void
A circle of points in the XZ plane at height y.
| arg | type | description |
|---|---|---|
| cx | number | |
| cz | number | |
| r | number | |
| y | number | |
| steps | number |
mesh(name: string, b: Builder, folder: string) → void
Register a builder's geometry as a mesh asset and return its ref.
| arg | type | description |
|---|---|---|
| name | string | |
| b | Builder | |
| folder | string |
rand(seed: number) → number
Deterministic scalar hash in 0..1 — the same seed gives the same number on every playthrough, which is what a film that must be identical twice needs.
| arg | type | description |
|---|---|---|
| seed | number |
hash3(i: number, j: number, k: number) → number
| arg | type | description |
|---|---|---|
| i | number | |
| j | number | |
| k | number |
fade(t: number) → number
| arg | type | description |
|---|---|---|
| t | number |
noise3(x: number, y: number, z: number) → number
Smooth value noise in 0..1. Deterministic in the same way `rand` is.
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
lerp(a: number, c: number, t: number) → number
| arg | type | description |
|---|---|---|
| a | number | |
| c | number | |
| t | number |
fbm(x: number, y: number, z: number) → number
Two octaves, which is all a wall needs: a large blotch and a fine grain.
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| z | number |
P3 = { number }Builder = typeof(Geom.builder())Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.