vprops — the things standing in Amagiri, as geometry.
Every prop in the valley is emitted into a mesh builder rather than spawned
as its own entity: a torii is forty quads, and eighty torii, houses, posts
and lanterns sharing one material become one mesh and one draw. The builder
carries a transform, so a shape is written once in its own local space and
placed anywhere.
Nothing here knows about Amagiri. It is boxes, cylinders, roofs, torii,
lanterns and grass; `valley` decides where they go.
builder( ) → any
A fresh mesh under construction.
at(x: number, y: number, z: number, yaw: number?, pitch: number?, roll: number?) → void
Place everything emitted from now on. Rotation order is roll, pitch, yaw.
| arg | type | description |
|---|
| x | number | |
| y | number | |
| z | number | |
| yaw | number? | |
| pitch | number? | |
| roll | number? | |
_rot(x: number, y: number, z: number) → void
| arg | type | description |
|---|
| x | number | |
| y | number | |
| z | number | |
_vert(x: ?, y: ?, z: ?, nx: ?, ny: ?, nz: ?, u: ?, v: ?) → number
| arg | type | description |
|---|
| x | ? | |
| y | ? | |
| z | ? | |
| nx | ? | |
| ny | ? | |
| nz | ? | |
| u | ? | |
| v | ? | |
quad(a: ?, b: ?, c: ?, d: ?, uvs: ?) → void
Four local-space corners in counter-clockwise order seen from outside.
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
| d | ? | |
| uvs | ? | |
tri(a: ?, b: ?, c: ?) → void
| arg | type | description |
|---|
| a | ? | |
| b | ? | |
| c | ? | |
box(cx: ?, cy: ?, cz: ?, hx: ?, hy: ?, hz: ?) → void
An axis-aligned box in the builder's local space, centred on (cx, cy, cz).
| arg | type | description |
|---|
| cx | ? | |
| cy | ? | |
| cz | ? | |
| hx | ? | |
| hy | ? | |
| hz | ? | |
cylinder(cx: ?, cz: ?, y0: ?, y1: ?, r0: ?, r1: ?, seg: ?, caps: ?) → void
A vertical cylinder from y0 to y1, tapering from r0 to r1.
| arg | type | description |
|---|
| cx | ? | |
| cz | ? | |
| y0 | ? | |
| y1 | ? | |
| r0 | ? | |
| r1 | ? | |
| seg | ? | |
| caps | ? | |
gableRoof(cx: ?, cy: ?, cz: ?, hx: ?, hz: ?, rise: ?, thick: ?) → void
A gable roof: two slopes meeting on a ridge running along local X, with the
eaves overhanging the walls below it.
| arg | type | description |
|---|
| cx | ? | |
| cy | ? | |
| cz | ? | |
| hx | ? | |
| hz | ? | |
| rise | ? | |
| thick | ? | |
hipRoof(cx: ?, cy: ?, cz: ?, hx: ?, hz: ?, rise: ?) → void
A hipped pyramid roof over a rectangle, apex above the centre.
| arg | type | description |
|---|
| cx | ? | |
| cy | ? | |
| cz | ? | |
| hx | ? | |
| hz | ? | |
| rise | ? | |
torii(b: any, width: number, height: number, sink: number?) → void
Named props
A torii. `width` is the span between the pillars, `height` the pillar top.
The lintel overhangs, the tie-beam sits low, and the pillars lean inward,
which is what makes the silhouette read as a torii rather than a doorframe.
| arg | type | description |
|---|
| b | any | |
| width | number | |
| height | number | |
| sink | number? | |
lantern(b: any, scale: number) → void
A stone lantern: plinth, shaft, light box, flared cap, finial.
| arg | type | description |
|---|
| b | any | |
| scale | number | |
houseBody(b: any, w: number, d: number, wallH: number, sink: number) → void
A village house, in three material parts so the walls, the frame and the
roof can each go into the mesh of the material they are made of.
`sink` drops the whole thing so the water takes the doorway.
| arg | type | description |
|---|
| b | any | |
| w | number | |
| d | number | |
| wallH | number | |
| sink | number | |
houseFrame(b: any, w: number, d: number, wallH: number, sink: number) → void
| arg | type | description |
|---|
| b | any | |
| w | number | |
| d | number | |
| wallH | number | |
| sink | number | |
houseRoof(b: any, w: number, d: number, wallH: number, rise: number, sink: number) → void
| arg | type | description |
|---|
| b | any | |
| w | number | |
| d | number | |
| wallH | number | |
| rise | number | |
| sink | number | |
beam(b: any, p0: { number }, p1: { number }, r: number) → void
A four-sided beam between two local-space points — a branch, a rafter, a
span of a bridge arch.
| arg | type | description |
|---|
| b | any | |
| p0 | { number } | |
| p1 | { number } | |
| r | number | |
corner(p: ?, su: ?, sv: ?) → void
| arg | type | description |
|---|
| p | ? | |
| su | ? | |
| sv | ? | |
deadTree(b: any, height: number, seed: number) → void
A bare tree: a leaning trunk and a handful of branches.
| arg | type | description |
|---|
| b | any | |
| height | number | |
| seed | number | |
boulder(b: any, rx: number, ry: number, rz: number, seed: number) → void
A rough boulder: a box hacked into an irregular solid by a per-corner jitter.
| arg | type | description |
|---|
| b | any | |
| rx | number | |
| ry | number | |
| rz | number | |
| seed | number | |
grassTuft(b: any, height: number, width: number, blades: number, seed: number) → void
A tuft of grass: crossed tapered blades, each emitted on both faces so a
back-face-culled material still shows every blade from every side.
uv.y runs 0 at the root to 1 at the tip, which is what the grass material's
vertex stage bends the blade by.
| arg | type | description |
|---|
| b | any | |
| height | number | |
| width | number | |
| blades | number | |
| seed | number | |
merge(dst: any, src: any) → void
Finishing
Append one builder's geometry to another, indices rebased.
| arg | type | description |
|---|
| dst | any | |
| src | any | |
geometry(b: any, name: string) → any
The geometry table `renderer.mesh.create` takes.
| arg | type | description |
|---|
| b | any | |
| name | string | |
isEmpty(b: any) → boolean