Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

part.merge (procNode)

Pack several parts into one part, each piece keeping what it is: a terrain stays a terrain, instanced rocks stay instances, a mesh stays its own mesh. Nothing is joined; the pieces stand side by side under one name, and part.unpack gives any piece back by its name. Use it when one graph output must stand several different kinds of thing; geometry.merge joins geometries into one instead.

A Generator realizes each piece as its own root named <root>_<piece>, <root> being the name the output stands under (the graph's name when it has one output), and builds a piece again only when that piece changes. An empty parts, a piece keyed by anything but a non-empty name, and a domain other than "point", "primitive" or "mesh" are errors.

Inputs

  • parts (Record). The pieces by name, each a node's output wired in: { lake = lake, spikes = spikes }. The name is the piece's own: the realized piece is called <graph>_<name>, and part.unpack gives it back by it.
  • domains (Record, optional). How a geometry piece stands in the scene, by piece name: "point" or "primitive" makes each element of that domain a scene thing, "mesh" draws the whole geometry as one mesh. Left out, a piece whose points or primitives carry a component stands as those elements, and any other geometry is one mesh.

Outputs

  • part (Part). The pieces under their names.
local part = g.part.merge({ parts = { body = g.mesh.box({}), spots = g.points.grid({ countX = 2, countZ = 2 }) } })