Builtin Library
README.md
Built-in primitive meshes
The .mesh assets in this folder are the engine's built-in primitive
geometry — the rough-blockout shapes every world can reference by bare
name ({ model = "cube" }) without authoring or importing anything.
Each <name>.mesh is a loader-folder asset whose primary content is the
engine-native ZMSH geometry binary at <name>.mesh/data.zmsh. The folder
carries a .metadata sidecar tagging it primitive and builtin, and a
committed .meta sidecar pinning its stable guid (authored content
references the guid, never the name).
Each is centred on its local origin, so an entity's scale reads directly as
the size the mesh covers in the world.
| Asset | Shape | Extent (x, y, z) |
|---|---|---|
cube | unit cube | 1 x 1 x 1 |
sphere | UV sphere | 1 x 1 x 1 |
plane | flat quad (XZ) | 1 x 0 x 1 |
cylinder | capped cylinder | 1 x 1 x 1 |
cone | capped cone | 1 x 1 x 1 |
capsule | rounded-end capsule | 0.5 x 1 x 0.5 |
rounded_box | box with rounded edges and corners | 1 x 1 x 1 |
torus | ring | 1 x 0.3 x 1 |
octahedron | 8-faced diamond | 1 x 1 x 1 |
ground_hex | hexagonal ground tile | 1.732 x 0.1 x 2 |
ground_quad | large ground quad | 1 x 0.1 x 1 |
shader_ball | sphere on a pedestal, a quarter of its upper half cut away — what a shader's preview is painted on | 0.933 x 1 x 0.933 |
meshRef:load():getBounds() reads the same numbers back. guides { path = "types/mesh" } carries the winding, index-base, UV and axis conventions the
geometry is authored against.
Publishing the geometry blobs
These meshes resolve their data.zmsh bytes by sha-256 (content
addressing) on targets that don't have the repo's src/lua/lib on disk —
WASM (the browser build) and release native binaries run outside the repo.
That requires each blob to exist in ZeroMind's content store. Publish them
with:
node scripts/publish_builtin_blobs.mjs # upload (skips blobs already present)
node scripts/publish_builtin_blobs.mjs --dry-run
The upload set is derived from the build's BUILTIN_LIB_BINARY_LEAVES, so
build the engine once (cargo build --bin native) before publishing. The
script is idempotent: a blob whose sha already exists in the store is left
untouched.
Primitives are for blockout, not finished work — author or import real geometry for anything shipping.