flora
Procedural geometry for the five plants, their three growth stages each, and the Blight's crystal. Pure geometry plus a mesh cache: no game state, no signals, no clock.
game.plants.flora — the bodies of the garden
Procedural geometry for the five plants, their three growth stages each, and the Blight's crystal. Pure geometry plus a mesh cache: no game state, no signals, no clock.
local Flora = require("game.plants.flora")
local body = Flora.build("lightwood", 3)
-- body.main, body.glow -> MeshHandles (glow may be nil)
-- body.material, body.glowMaterial -> material identities
-- body.height -> world height, what line of sight and unit placement read
Every form is ONE runtime mesh carrying per-vertex colour, so a single shared material paints a whole plant from wet-stone root to sunlit tip. A second, optional mesh carries the parts that emit — a bloomstalk's heart, a lightwood's lantern pods, the cold light inside a blight spire, embers on a burnt tile.
Flora.build caches by (kind, stage): eighty tiles cost at most eighteen
meshes. Flora.clearCache() drops them.
What it can build
creepvine · rootknot · thornbed · bloomstalk · lightwood · blight,
each at stage 1–3, plus the tile marks seed, fire and water.
Materials
| identity | on |
|---|---|
game.plants.gardenFlora | every living thing — double-sided, rough, white; the vertex colours carry the colour |
game.plants.blightCrystal | the Blight — near-black violet, glossy, faintly emissive |
game.plants.gardenGlow | bloom hearts and lantern pods |
game.plants.gardenEmber | a burnt tile's embers |
game.plants.gardenWater | a flooded tile's sheet |
game.plants.gardenBark | reserved for opaque woody parts |
Two rules the shapes obey
Footprints are budgeted before the scale pass. A tile is two world units,
so nothing may reach past 1.0 / SCALE[kind] from the centre or the plant
grows over its neighbour's tile. SCALE is at the bottom of the module: forms
are modelled small and grown to the size the SHOT needs, because the tactical
camera sits thirty units out and anything built to look right in the hand
disappears there.
The Blight is flat-shaded and the garden is not. shard and slab emit a
fresh vertex trio per triangle carrying the face normal, so crystal reads hard
and faceted; tube, blob and blade share vertices and read soft. That
contrast, plus the palette, is the whole reason the Blight looks WRONG against
the green.
Scoped to this part · feeds back into the world's score.