Log inGet started
World

PYRAMID — Tower Defense

Branchmain
Branchesmain
Commit82c25f40b2

README.md

solids

The geometry kit every model in pyramid.models.models is cut from: flat-shaded, per-vertex coloured triangle soup, written straight into the flat arrays asset.create("mesh", ...) takes.

It exists so that a model is described in the world's terms — a plinth course, a tapered shaft, an ear, a folded forepaw, a flame tongue — instead of in vertices. Each primitive is handed an outward hint and orients its own triangles against it, so winding is never something a model author has to think about.

Conventions: +Y is up, the face a model looks with is +Z, a model stands with its base at y = 0.

CallWhat it makes
S.new()an empty builder
S.poly(b, pts, out, c)one flat polygon, wound toward out
S.box(b, cx, cy, cz, sx, sy, sz, c)a block from a centre and a size
S.frustum(b, cx, cz, y0, y1, hx0, hz0, hx1, hz1, c)a block whose top differs from its base — a shaft, a course, a limb
S.spike(b, cx, cz, y0, y1, hx, hz, dx, dz, c)a block closing to a leaning point — an ear, a flame tip
S.cyl(b, cx, cz, y0, y1, r0, r1, seg, c, cTop, caps)a round shaft or a cone
S.sphere(b, cx, cy, cz, rx, ry, rz, seg, rings, c)a faceted ellipsoid
S.slabXY(b, pts, z0, z1, c)a flat polygon given thickness — a blade, a cloth panel
S.ribbonXY(b, spine, halfWidth, z0, z1, c)a curved strip swept from a spine — a sickle, a hanging bandage
S.tube(b, path, radii, seg, c0, c1, capStart)a tube swept along a path, radius and colour varying — an arm, a flame tongue
S.geometry(b)the { positions, indices, normals, colors } the mesh takes

Colour is per vertex and multiplies the material's base colour, so one mesh can carry stone and its inlay and its gilding at once. Values are linear: 0.72 reads as a sun-bleached 0.87 on screen.