shapes
Flat-shaded geometry builders. Every triangle carries its own three vertices and its own face normal, so what comes out reads as crisp low-poly facets rather than a smoothed blob — the register this game is drawn in, where silhouette and facet do the work and the material carries…
shapes
Flat-shaded geometry builders. Every triangle carries its own three vertices and its own face normal, so what comes out reads as crisp low-poly facets rather than a smoothed blob — the register this game is drawn in, where silhouette and facet do the work and the material carries the colour.
local Shapes = require("game.hero.shapes")
local g = Shapes.new()
Shapes.lathe(g, { profile = { { r = 0.5, y = 0 }, { r = 0.2, y = 1 } }, segments = 11 })
Shapes.transform(g, { translate = { 0, 1, 0 }, yaw = 30 })
new() | An empty { positions, normals, uvs, indices } — the flat arrays asset.create("mesh", …) and renderer.mesh.create take. |
tri / quad | One triangle or one planar quad, wound as given. |
lathe(g, opts) | Revolve a profile around +Y. Each ring carries its own centre offset, scallop, lobe count and squash, which is what turns a cylinder into a cloak, a cowl or a lantern roof. skip leaves quads out — an opening in the wall, like the mouth of a hood, is a lathe with a few quads missing rather than a second mesh. |
box / prism / spike | An axis-aligned box, a closed n-sided frustum, and a bipyramid with uneven points. |
append / part / transform | Merge one geometry into another, optionally placed. part is the two together, and is how every composite here is assembled. |
measure(g) | Triangle count and the local AABB — so a shape can be checked without rendering it. |
Conventions follow the engine's: indices count from 0, a front face turns counter-clockwise, +X right, +Y up, and an entity's forward is −Z.
Scoped to this part · feeds back into the world's score.