Builtin Library
- ..
- README.md1.9 KB
- basics.luau6.4 KB
- bevel.luau22.8 KB
- deform.luau4.1 KB
- init.luau2.4 KB
- merge.luau1.4 KB
- subdivide.luau7.1 KB
- topology.luau2.5 KB
- weld.luau6.4 KB
README.md
proc.compiled
Array kernels for the ops a quick-geometry model is built from. A kernel runs once over the flat arrays of a piece and answers the arrays the op's node cooks, so a piece comes out of Luau loops over arrays and not out of a graph of device dispatches.
A piece is { positions, normals?, uvs?, indices }: three numbers a point for positions and normals, two for uvs, and the 0-based point numbers of each triangle in indices. A kernel is (piece, params) -> (piece, info?); geometry.merge takes a list of pieces.
Kernels: geometry.merge; deform.taper, deform.twist and deform.bend (the deformers a model graph states as a field over P); core.weld (points within a distance merge, the lowest-numbered of each group standing for it); geometry.subdivide (linear and loop, one to three levels); geometry.bevel (the steps its node's README states, answering the node's info record with the piece: bevelledEdges, pairedEdges, cornerPatches, width, requestedWidth, maxWidth, clamped, segments, vertexCount, triangleCount).
Every kernel writes its output through f32, the precision a mesh stores, and takes sine and cosine from trig.sincos, one function of arithmetic alone, so the arrays are the same on every target.
register(op, kernel)andkernel(op): the kernel table, by the op's name.f32(array)andround(x): round to the nearestf32.trig.sincos(angle)andtrig.acos(x): the sine and the cosine of an angle in radians, and an inverse cosine, from arithmetic alone.normals(piece): the vertex normals of a piece, each triangle weighted by its area, summed in triangle order with every operation anf32one.faceScaled(a, b, c): the direction a triangle's corners (vectors) wind around, scaled by twice its area.
Part of @builtin::systems.procgen.proc; required as @builtin::systems.procgen.proc.compiled.