Builtin Library
README.md
core.raster.cells (procNode)
Name the cells of a raster as a flat run, x fastest then z: the position of each cell's centre, and the place in a layer's tiled storage that holds it, optionally at an offset of whole cells.
Built from g.element.id and math operators over the raster's layout members. Every node that reads or writes a layer cell by cell calls it.
Inputs
raster(Raster). The raster whose cells are named.dx(Number). Default0. Cells along x the stored place is offset by; the read is held to the edge of the field.dz(Number). Default0. Cells along z the stored place is offset by.held(Bool). Defaultfalse. Name every cell the tiles hold rather than the cells of the field:heldXcells across andheldZdown, the run startingaproncells before the field's first cell. An offset is then held to the edge of what the tiles hold.
Outputs
count: the cells of the field,cellsXtimescellsZ; withheld,heldXtimesheldZ.position: a Vec3 field: the world position of each cell's centre (a cell past the field has the position it has in the field's grid).index: an Int field: the place in a layer's stored column that holds each cell, offset bydx,dzand held to the field (or to what the tiles hold, withheld). A cell past the field is addressed in the border tile beside it.
Example
local raster = g.core.raster.new({ size = { x = 8, z = 8 }, resolution = 1, layers = { "height" } })
local cells = g.core.raster.cells({ raster = raster })
cells.count is 64; cells.position and cells.index are fields over those cells.