Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit098ece8e9e

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) and kernel(op): the kernel table, by the op's name.
  • f32(array) and round(x): round to the nearest f32.
  • trig.sincos(angle) and trig.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 an f32 one.
  • 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.