Builtin Library
README.md
Ocean
Puts a live sea on an entity. The component's fields ARE the sea state — wind speed and direction, choppiness, swell, foam, extent and detail — and the wave simulation, the GPU surface mesh and the material bound to the simulation are all rebuilt from them whenever the component wakes.
That rebuild is what makes the ocean persistable. The simulation lives entirely in GPU buffers and a runtime mesh, none of which survive an engine restart; the component's settings do, and the whole sea is reconstructed from them. A scene with an ocean in it reloads into the same sea.
The surface follows the viewer and covers extent metres around them, so one
ocean is the whole sea however far anyone sails. sampleHeight(x, z) and
sampleDisplacement(x, z) report where the water is — the same waves that are
drawn — which is what a boat, a buoy or a swimmer floats on.
Start from a preset (calmClear, darkChop, darkRolling, heavySwell,
whitecapped, murkyGrey, paleSwell, glassyDark and gale) and override
whatever the scene needs. Wind speed does most of the work:
significant wave height goes as its square.