SLICE: farmland — geometry for the farm.
Everything here returns a plain `renderer.mesh.create` payload
`{ positions, indices, normals, uvs, colors }`. Two families:
buildCropTile one square tile of standing stalks. Vertex colour carries
the per-stalk wind phase (r), dryness (g) and height
scale (b) that crop_blades.shader reads; uv.y is 0 at the
root and 1 at the tip of the full-height stalk.
buildBarn / buildSilo / buildWaterTower / buildFenceRun / buildShed
vertex-coloured props for farm_prop.shader. rgb is the
paint, alpha picks roughness: 0 = metal, 1 = dry timber.
Every face is wound so `cross(p2-p1, p4-p1)` points out of the solid, so the
normals are correct whichever way the rasteriser reads the winding.
buildCropTile(opts: { extent: number?, spacing: number?, height: number?, seed: number? }) → void
The crop
A tile of stalks centred on its own origin, built at FULL maize height. The
fragment stage cuts each one down to whatever is actually standing there.
Returns the geometry and the number of stalks in it.
| arg | type | description |
|---|
| opts | { extent: number?, spacing: number?, height: number?, seed: number? } | |
buildGroundGrid(size: number, segs: number) → void
A flat ground grid, y = 0, centred on the origin. Subdivided so the shadow
cascades and the frustum have something to bite on across 3 km.
| arg | type | description |
|---|
| size | number | |
| segs | number | |
pushVert(a: Acc, x: ?, y: ?, z: ?, nx: ?, ny: ?, nz: ?, u: ?, v: ?, c: ?) → void
| arg | type | description |
|---|
| a | Acc | |
| x | ? | |
| y | ? | |
| z | ? | |
| nx | ? | |
| ny | ? | |
| nz | ? | |
| u | ? | |
| v | ? | |
| c | ? | |
faceNormal(p1: ?, p2: ?, p4: ?) → void
| arg | type | description |
|---|
| p1 | ? | |
| p2 | ? | |
| p4 | ? | |
addQuad(a: Acc, p1: ?, p2: ?, p3: ?, p4: ?, c: ?) → void
| arg | type | description |
|---|
| a | Acc | |
| p1 | ? | |
| p2 | ? | |
| p3 | ? | |
| p4 | ? | |
| c | ? | |
addTri(a: Acc, p1: ?, p2: ?, p3: ?, c: ?) → void
| arg | type | description |
|---|
| a | Acc | |
| p1 | ? | |
| p2 | ? | |
| p3 | ? | |
| c | ? | |
addBox(a: Acc, cx: ?, cy: ?, cz: ?, hx: ?, hy: ?, hz: ?, c: ?) → void
Axis-aligned box, centred on (cx, cy, cz), half-extents (hx, hy, hz).
| arg | type | description |
|---|
| a | Acc | |
| cx | ? | |
| cy | ? | |
| cz | ? | |
| hx | ? | |
| hy | ? | |
| hz | ? | |
| c | ? | |
addCylinder(a: Acc, cx: ?, cy: ?, cz: ?, r: ?, h: ?, seg: ?, cSide: ?, cTop: ?) → void
| arg | type | description |
|---|
| a | Acc | |
| cx | ? | |
| cy | ? | |
| cz | ? | |
| r | ? | |
| h | ? | |
| seg | ? | |
| cSide | ? | |
| cTop | ? | |
addCone(a: Acc, cx: ?, cy: ?, cz: ?, r: ?, h: ?, seg: ?, c: ?) → void
| arg | type | description |
|---|
| a | Acc | |
| cx | ? | |
| cy | ? | |
| cz | ? | |
| r | ? | |
| h | ? | |
| seg | ? | |
| c | ? | |
buildBarn(variant: number?) → void
A barn: gabled timber shed with a tarred roof and a big sliding door,
long axis on +X, standing on y = 0.
| arg | type | description |
|---|
| variant | number? | |
buildSilo(height: number?, radius: number?) → void
A grain silo: corrugated steel drum, banded, with a conical cap and a
discharge chute at the foot.
| arg | type | description |
|---|
| height | number? | |
| radius | number? | |
buildWaterTower( ) → void
A water tower: four legs, a tank, a cap.
buildShed( ) → void
An open-sided implement shed with a lean-to roof.
buildFenceRun(length: number, spacing: number?) → void
A run of post-and-rail fence along +X, starting at the local origin.
| arg | type | description |
|---|
| length | number | |
| spacing | number? | |
buildBale( ) → void
A round straw bale lying on its side, long axis on +X.