Builtin Library
README.md
water_surfaces
The water surfaces a scene holds, gathered from the systems that make them.
A system with water — a terrain's lakes, rivers and seas, an ocean — registers
a provider here, and whatever stands things on water asks every provider at
once. A procedural graph reads them all through scene.water.
A provider is a table of two functions:
-
version()names what its water is now. A surface that moves every frame answers differently every frame, which is what makes a reader stand its points again. -
stand(request)puts points on its water on the device.requestholds:run: the points' GPU positions, in the graph's space;count: how many points there are;out: theP,normal,slopeandwetGPU columns to write;place/unplace: graph to world and back, 16 numbers each;offset: metres above the surface;keepY: whether a point's own height rides on the surface's.
It writes the points over its water, leaves the rest as they are, and returns the names of the kernels it dispatched.
local water = require("@builtin::modules.water_surfaces")
water.register("myWater", { version = versionNow, stand = standOnMyWater })
for _, p in water.list() do
print(p.name, p.provider.version())
end