Builtin Library
README.md
ModelGraph
The graph a scene's parts are drawn by. The nouns record a scene's tree; at the end of the build one Generator is spawned on this graph, and the tree is its two plain inputs:
objects: the objects of the tree, parents before their children. Each is{ name, parent, pose or channel and values, components?, leaves }:parentis the number of its parent object (0 for the first),poseis its position, rotation quaternion and scale as ten numbers (an object that stands still),channelandvaluesname a formula ofchannelsand the constants it puts in it (an object whose pose follows the clock), and each leaf is{ shape, material, matrix }:shapeis{ op, args, ops? }, whereopnames ag.shapenode,argsare its inputs andopsare the modifiers applied in order (bevel, subdivide, taper, twist, bend, boolean),materialis{ color, metallic, roughness, emissive, opacity?, doubleSided? }andmatrixplaces the leaf in its object (row-major 4x4). A shape whoseopisloftcarries its cross-sections inargs.sections.channels: the formulas of the poses that follow the clock, each{ nodes, out, width }.
The graph composes the tree into the parts that stay where they are, each an entity with its parent and local pose, and the parts that move, grouped by formula and shape and drawn as instances, one population per group, the formula running on the device every frame. A graph that states a program (g:program) is stood by that program where it takes the tree, and cooked as this graph where it does not.
The graph's clock runs forward and loops. A material is one node per distinct colour, metalness, roughness, emissive, opacity and sidedness, shared by the parts that state it. Opacity below 1 or a double-sided material is made from the pbr shader with a transparent blend.
Modifiers run through procgen's own nodes: geometry.bevel, geometry.subdivide (points joined first), geometry.boolean and geometry.loft; taper, twist and bend are field arithmetic on the point positions.