Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

proc.ops.instances

Instancing ops. A population is points carrying a Mesh: instances.on_points stands a source on every point (as each point's Mesh, with the source's material as Material), placed by P, orient and scale; instances.pick_random and instances.pick_by_attribute stand one of several sources on each point, Mesh holding its index into the sources the detail's labels.Mesh lists. instances.randomize_transform computes a per-instance transform on the device, instances.transform and instances.set_material work on the points' columns on the device, and instances.realize stamps the population into a single merged Geometry on the device (proc.substrate Geometry.copyToPoints), every other point attribute standing on its copy's points. instances.spawn spawns one addressable entity per point of a population, and instances.from_bundle spawns a .bundle prefab at every point. A Generator draws a population as one instanced draw per source, placed on the device. ops(geometry, fields, hash) returns the family and procPacks/instances.procPack registers it. Part of @builtin::systems.procgen.proc.

instances.draw registers one hardware-instanced draw per source variant, drawing matrices it composed on the device (several sources: each variant's points gathered there, its rows past them empty), and gives each the material its own source names — the op's material param first (the whole-population override), then the variant's source Geometry's .material, then the population's Material, then the default. A source carrying an in-memory Material value is filed as a runtime material for the live draw and realized to its own .material by population.write.