Skip to main content

LakeGenerator

A class in Root.Township, Alta.Forests.

Editor test tool that builds lake meshes where rivers end in a basin. Not part of normal generation.

Constructors​

MemberWhat it is
LakeGenerator()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private List<List<Vector3>> allDebugEdgesShorelines traced, for gizmos.
private bool btnRegenerateInspector button for Regenerate.
private Material materialMaterial for lake meshes.
private RiverGenerator riverGeneratorRiver generator to read nodes from.
private float thresholdLeast river volume that makes a lake.

Methods​

4 private and internal methods
MemberWhat it is
private List<Path> EvaluateWaterEdge(float waterHeight, ref Path path)Walks the shoreline at the water height. Returns null if it doesn't close within 100 steps.
private void GenerateLake(RiverNode center, float waterHeight)Builds a flat lake mesh object inside the shoreline at the water height.
private void OnDrawGizmos()Draws the traced shorelines.
private void Regenerate()Editor button: finds river end nodes with enough volume, works out how high they'd fill and makes lakes.