Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit61a33237e0

README.md

terrain_apron

Copies a rectangular block of a neighbour tile's stored cells into this tile.

A tile's apron holds a second copy of cells its neighbour owns. An op that is a pure function of world position writes both copies to the same value on its own; an op whose result depends on what the tile already held — erosion above all — leaves the two copies disagreeing, and every neighbourhood read at the seam then sees a different surface depending on which tile it came through. This pass makes the apron read what the neighbour computed.

The block is given in stored-cell coordinates (dstX0, dstZ0, srcX0, srcZ0, blockWidth, blockHeight) rather than as an edge index, so one shader moves an edge band and a corner square. The caller issues one dispatch per neighbour that exists: eight of them tile a tile's apron ring exactly, with no cell written twice.

A block facing off the edge of the field has no neighbour and no dispatch. Its apron keeps whatever the generating op wrote there, which for a world-space op is the correct extrapolation of the landscape past the field boundary.

Run it after any op whose result is not a pure function of world position, and between erosion batches — a droplet may walk at most apron cells before the neighbourhood it is reading is no longer the neighbourhood its neighbour has.