Skip to main content

Module model_lib

Module model_lib 

Source
Expand description

§weft-model — the Thread’s modeling library

The Weft-equivalent of a scene library, and the answer to “how does an agent make a model?”: not by pasting vertices, and not by hand-placing primitives — by calling functions that compute geometry.

stairs(12, 0.18, 0.28, 1.2)          twelve treads, computed by a fold
column(5.2, 0.44)                    a turned profile, from two numbers
at(ring_of(baluster, 12, 2.0), 0,1,0)   twelve of a thing, around a circle
model1("balustrade", …, marble())    …wearing a full PBR material

Everything here returns plain Weft values — a flat list of carving steps (Node) and the materials its parts wear — which chisel meshes and bakes. That indirection is the point: the model is a verified, content-addressed, deterministic program, so it can be parameterised, cached by hash, exchanged between agents, and replayed byte-identically on any machine. Three.js gives an agent a scene API and hopes; this gives it a proof.

PBR is not an afterthought. Every material constructor returns the full set — base color ramp, normal height, metallic and roughness bands, ambient occlusion — because a model that arrives without them is a model someone still has to finish.

Functions§

package
Build the weft-model package: constructors, transforms, repeaters, parametric parts, and PBR materials.