geo
The geometry builder every cropsKit drawing uses: a turtle-style transform stack, vertex colours given in sRGB, and the primitives plants and props are made of (boxes, voxels, ellipsoids with lobes and noise, cones, tubes along curves, lathes, leaves and blades, cards, discs, tor…
geo
The geometry builder every cropsKit drawing uses: a turtle-style transform stack, vertex colours given in sRGB, and the primitives plants and props are made of (boxes, voxels, ellipsoids with lobes and noise, cones, tubes along curves, lathes, leaves and blades, cards, discs, torus arcs, crystal prisms). It groups geometry by material slot and uploads each slot as a runtime mesh. Called by the art modules and plotArt.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2nonstrict
ident( ) → void
3x4 affine matrices as flat arrays { a,b,c,tx, d,e,f,ty, g,h,i,tz }
mul(m: ?, n: ?) → void
| arg | type | description |
|---|---|---|
| m | ? | |
| n | ? |
lin(c: ?) → void
| arg | type | description |
|---|---|---|
| c | ? |
newPart( ) → void
new(seed: ?) → void
A new, empty builder. `seed` seeds `g:rand()` so the same seed builds the same plant.
| arg | type | description |
|---|---|---|
| seed | ? |
rand(a: ?, b: ?) → void
A random number in [a, b) (or [0, 1) with no arguments) from the builder's seed.
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? |
slot(name: ?) → void
Choose the material slot the next geometry goes in.
| arg | type | description |
|---|---|---|
| name | ? |
color(r: ?, g: ?, b: ?, a: ?) → void
Set the vertex colour for the next geometry, written as you would pick it (sRGB, 0-1 each); the builder stores it linear, which is what the renderer reads.
| arg | type | description |
|---|---|---|
| r | ? | |
| g | ? | |
| b | ? | |
| a | ? |
getColor( ) → void
The current vertex colour as { r, g, b, a } in sRGB (as passed to `color`).
push( ) → void
pop( ) → void
recomputeNormal(self: ?) → void
| arg | type | description |
|---|---|---|
| self | ? |
apply(n: ?) → void
| arg | type | description |
|---|---|---|
| n | ? |
translate(x: ?, y: ?, z: ?) → void
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? |
scale(x: ?, y: ?, z: ?) → void
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? |
rotateX(a: ?) → void
| arg | type | description |
|---|---|---|
| a | ? |
rotateY(a: ?) → void
| arg | type | description |
|---|---|---|
| a | ? |
rotateZ(a: ?) → void
| arg | type | description |
|---|---|---|
| a | ? |
alignY(dx: ?, dy: ?, dz: ?) → void
Turn the local frame so +Y points along (dx, dy, dz) (used to grow along a direction).
| arg | type | description |
|---|---|---|
| dx | ? | |
| dy | ? | |
| dz | ? |
point(x: ?, y: ?, z: ?) → void
World-space (builder-space) position of a local point.
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? |
vert(x: ?, y: ?, z: ?, nx: ?, ny: ?, nz: ?, u: ?, v: ?) → void
Add one vertex (local position, local normal, uv). Returns its index.
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? | |
| nx | ? | |
| ny | ? | |
| nz | ? | |
| u | ? | |
| v | ? |
tri(a: ?, b: ?, c: ?) → void
Add a triangle by vertex indices (counter-clockwise = front, in local space).
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? | |
| c | ? |
quad(a: ?, b: ?, c: ?, d: ?) → void
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? | |
| c | ? | |
| d | ? |
box(w: ?, h: ?, d: ?) → void
A box w x h x d, centred on x and z, standing on y = 0. Flat-shaded.
| arg | type | description |
|---|---|---|
| w | ? | |
| h | ? | |
| d | ? |
voxel(x: ?, y: ?, z: ?, s: ?) → void
A voxel: a cube of side `s` whose minimum corner is at grid cell (x, y, z) * s. For pixel looks.
| arg | type | description |
|---|---|---|
| x | ? | |
| y | ? | |
| z | ? | |
| s | ? |
ellipsoid(rx: ?, ry: ?, rz: ?, opts: ?) → void
An ellipsoid centred on the origin. `opts`: seg (around, 10), rings (8), noise (0-0.3 lumpiness), lobes (vertical ribs, pumpkin), lobeDepth, flatTop / flatBottom (0-1 squash of that half), colorTop ({r,g,b} blended towards the top).
| arg | type | description |
|---|---|---|
| rx | ? | |
| ry | ? | |
| rz | ? | |
| opts | ? |
sphere(r: ?, opts: ?) → void
A sphere of radius r centred on the origin (see ellipsoid for opts).
| arg | type | description |
|---|---|---|
| r | ? | |
| opts | ? |
cone(r0: ?, r1: ?, h: ?, opts: ?) → void
A cone or frustum from radius r0 at y = 0 to r1 at y = h. `opts`: seg (8), cap (close the ends, default true).
| arg | type | description |
|---|---|---|
| r0 | ? | |
| r1 | ? | |
| h | ? | |
| opts | ? |
cylinder(r: ?, h: ?, opts: ?) → void
A cylinder of radius r and height h standing on y = 0.
| arg | type | description |
|---|---|---|
| r | ? | |
| h | ? | |
| opts | ? |
tube(points: ?, radii: ?, opts: ?) → void
A tube swept along a polyline of points { {x,y,z}, ... } with a radius per point (number = constant). `opts`: seg (6), cap (close the tip), colors (one {r,g,b} per point).
| arg | type | description |
|---|---|---|
| points | ? | |
| radii | ? | |
| opts | ? |
rad(i: ?) → void
| arg | type | description |
|---|---|---|
| i | ? |
curve(h: ?, lean: ?, curl: ?, steps: ?, dirAngle: ?) → void
Points along a curve from the origin that rises `h`, leans `lean` sideways along +X and curls `curl` (0-1) at the tip. Returns { {x,y,z} } with `steps`+1 points.
| arg | type | description |
|---|---|---|
| h | ? | |
| lean | ? | |
| curl | ? | |
| steps | ? | |
| dirAngle | ? |
lathe(profile: ?, opts: ?) → void
A surface of revolution: `profile` is { {radius, y}, ... } from bottom to top. `opts`: seg (12), lobes, lobeDepth (ribbing), capTop, capBottom.
| arg | type | description |
|---|---|---|
| profile | ? | |
| opts | ? |
leaf(len: ?, w: ?, opts: ?) → void
A leaf from the origin along +Z: length `len`, width `w`, face up (+Y), double sided. `opts`: bend (droop of the tip, metres per metre), fold (V-fold 0-1), segs (5), shape ("oval" | "lance" | "heart" | "round" | "blade"), tipColor ({r,g,b}).
| arg | type | description |
|---|---|---|
| len | ? | |
| w | ? | |
| opts | ? |
width(t: ?) → void
| arg | type | description |
|---|---|---|
| t | ? |
blade(h: ?, w: ?, arch: ?, opts: ?) → void
A grass-like blade from the origin rising along +Y and arching towards +Z: height h, base width w, `arch` 0-1.
| arg | type | description |
|---|---|---|
| h | ? | |
| w | ? | |
| arch | ? | |
| opts | ? |
card(w: ?, h: ?) → void
A flat card w wide and h tall standing on the origin, facing +Z and -Z, uv 0-1 (for cut-out textures).
| arg | type | description |
|---|---|---|
| w | ? | |
| h | ? |
disc(r: ?, opts: ?) → void
A flat disc of radius r at y = 0 facing up. `opts`: seg (12), r0 (inner radius for a ring), down (face down too).
| arg | type | description |
|---|---|---|
| r | ? | |
| opts | ? |
torusArc(R: ?, r: ?, a0: ?, a1: ?, opts: ?) → void
A torus arc in the XZ plane around the origin: ring radius R, tube radius r, from angle a0 to a1 (radians, 0 = +X, counter-clockwise seen from above).
| arg | type | description |
|---|---|---|
| R | ? | |
| r | ? | |
| a0 | ? | |
| a1 | ? | |
| opts | ? |
crystal(r: ?, h: ?, tip: ?, sides: ?) → void
A pointed crystal prism standing on the origin: `sides` faces, radius r, body height h, tip height tip. Flat-shaded.
| arg | type | description |
|---|---|---|
| r | ? | |
| h | ? | |
| tip | ? | |
| sides | ? |
triangles( ) → void
Count of triangles over every slot.
build( ) → void
The geometry by slot: { [slot] = { positions, normals, uvs, colors, indices } }, empty slots left out.
top( ) → void
The height of the geometry's highest vertex (all slots).
upload(src: ?) → void
Upload one slot's source as a runtime mesh. Returns the mesh handle.
| arg | type | description |
|---|---|---|
| src | ? |
mix(a: ?, b: ?, t: ?) → void
Blend two colours: a + (b - a) * t.
| arg | type | description |
|---|---|---|
| a | ? | |
| b | ? | |
| t | ? |
hex(s: ?) → void
A colour from a hex string "#a3c45f".
| arg | type | description |
|---|---|---|
| s | ? |
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.