Builtin Library
README.md
proc.fields
The value types of the procedural-generation type system beside the Geometry: Field<T>, PointCloud,
Population, Texture, Material, Prefab (also Template), Bundle and Ramp. Part of
@builtin::systems.procgen.proc; each is re-exported on proc (proc.Field, proc.Texture, ...).
Field<T>: a lazy per-element value.Field.constant(t, values),Field.fn(t, stride, f),Field.buffer(t, stride, buf),Field.context(t, stride, class, name)(an attribute of the domain it is evaluated over) andField.gpu(...)(backed by a GPU buffer);:sample(id)answers thestridecomponents,:materialize(count)a flatcount*stridearray, and:release()frees a GPU-backed field.Field.transform(offset, orient, scale)is a per-element transform whose three parts are fields of their own, so each compiles to the device;:transformParts()hands them back.fields.over(domain, fn, ...)runsfnwithdomainas the domain fields are evaluated over.PointCloud: the value a.procNodeinput declaredPointCloudreceives (proc.substrate.toPointCloud); every other input, and every op, takes points as aGeometry(proc.geometry.new).PointCloud.new(positions)(flat stride-3 array);:count(),:position(id),:setAttribute(name, field)/:getAttribute(name)/:attributeNames(), and detail attributes through:setDetail/:getDetail.Population: live instanced-draw registrations (Population.new({ draws, recipe }));:count(),:setParent(entity),:bytes()and:destroy().Texture: an RGBA image:Texture.new(width, height, data),Texture.solid(width, height, rgba),Texture.bytes(...), orTexture.gpu(...)for one the device holds;:dimensions(),:pixel(id),:cpu().Material: a record of a shader, its property values and its texture slots:Material.pbr(opts),Material.shader(opts),:setTexture(slot, ref).Prefab/Bundle: entity records (Prefab.new(records),Bundle.new(records),:count()).Ramp: values keyed along [0, 1] (Ramp.new(t, positions, values, interpolation?),:sample(t)).
Every value carries a __proc_type tag that proc.types.typeOf reads ("Field<Vec3>", "PointCloud",
"Population", "Texture", ...).