Skip to content

eulerjs API / @eulerjs/marine / WaterLod

WaterLod ​

Defined in: packages/marine/src/three/waterLod.ts:7

Level of detail of the water mesh: a square grid of chunks that get coarser away from the centre. Every chunk's vertex count is a multiple of one unit, so moving the whole mesh by snapStep lands every vertex back on a position some vertex had before and the triangles don't crawl while the mesh follows the camera target.

Properties ​

PropertyModifierTypeDescriptionDefined in
baseSpacingreadonlynumberVertex spacing of the centre chunks, in metres.packages/marine/src/three/waterLod.ts:11
countsreadonlyreadonly (readonly number[])[]Grid segments across each chunk, indexed [row][column].packages/marine/src/three/waterLod.ts:9
growthreadonlynumberThe shader grows the spacing continuously as baseSpacing * growth^(distance / chunkSize), which never undershoots any chunk's real spacing; neighbouring chunks therefore agree on which waves exist along their shared edge.packages/marine/src/three/waterLod.ts:17
snapStepreadonlynumberDistance the mesh moves in when following, in metres.packages/marine/src/three/waterLod.ts:19

Released under the MIT License.