Terrain Module
A domain module providing standard layout stamps for outdoor 3D terrain. These functions generate landscapes, paths, and terrain features. They are agnostic to content type, allowing flexible reuse.
Functions and values
| Function or value |
Description
|
Full Usage:
checkerSurface heightFn odd even section
Parameters:
int -> int -> int
odd : 'T
even : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Fills the terrain surface with a checkerboard pattern following the height function.
|
Full Usage:
generateSurface heightFn generator section
Parameters:
int -> int -> int
generator : int -> int -> int -> 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates content for the terrain surface using a generator function. The generator is called for each (x, z) coordinate at the height determined by heightFn.
|
Full Usage:
ground width depth content section
Parameters:
int
-
Width of the ground (X axis).
depth : int
-
Depth of the ground (Z axis).
content : 'T
-
Content for the ground tiles.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates a flat ground plane at Y = 0.
|
Full Usage:
heightmap heightFn content section
Parameters:
int -> int -> int
-
Function that returns height for a given (x, z) coordinate.
content : 'T
-
Content to fill.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates terrain using a height function. For each (x, z), calls heightFn to get the Y height, then fills from Y=0 to that height.
|
Full Usage:
layeredHeightmap heightFn topLayer midLayer midDepth bottomLayer section
Parameters:
int -> int -> int
-
Function that returns total height for (x, z).
topLayer : 'T
-
Content for top layer (depth 1).
midLayer : 'T
-
Content for middle layer.
midDepth : int
-
Depth of middle layer from top.
bottomLayer : 'T
-
Content for everything below.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates terrain with distinct layers (e.g., grass on top, dirt below, stone at bottom).
|
Full Usage:
path points width content section
Parameters:
(int * int * int) list
-
List of (x, y, z) waypoints.
width : int
-
Width of the path (expands perpendicular to direction).
content : 'T
-
Content for the path.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates a path/road connecting waypoints at ground level (Y = 0). Uses 3D line rasterization between consecutive points.
|
Full Usage:
pit width depth dropHeight section
Parameters:
int
-
Width of the pit (X axis).
depth : int
-
Depth of the pit (Z axis).
dropHeight : int
-
How deep the pit goes (Y levels to clear).
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Clears a pit/depression below ground level. Position the section where the pit should be carved.
|
Full Usage:
plateau width depth height top side section
Parameters:
int
-
Width of the plateau (X axis).
depth : int
-
Depth of the plateau (Z axis).
height : int
-
Height of the plateau (Y axis).
top : 'T
-
Content for the top surface.
side : 'T
-
Content for the vertical sides.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates an elevated plateau with a flat top and vertical sides.
|
Full Usage:
rampX width depth rise content section
Parameters:
int
-
Width of the ramp (Z axis, perpendicular to slope).
depth : int
-
Depth of the ramp (X axis, direction of slope).
rise : int
-
Height change from start to end (Y axis).
content : 'T
-
Content for the ramp surface.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates a ramp rising along the X axis.
|
Full Usage:
rampZ width depth rise content section
Parameters:
int
-
Width of the ramp (X axis, perpendicular to slope).
depth : int
-
Depth of the ramp (Z axis, direction of slope).
rise : int
-
Height change from start to end (Y axis).
content : 'T
-
Content for the ramp surface.
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Generates a ramp rising along the Z axis.
|
Full Usage:
scatter count seed content section
Parameters:
int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Scatters content randomly on the ground plane (Y = 0).
|
Full Usage:
scatterAt y count seed content section
Parameters:
int
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Scatters content randomly on a plane at a specific Y level. Useful for placing items on plateaus or different floor levels.
|
Full Usage:
scatterPath points count seed content section
Parameters:
(int * int * int) list
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Scatters content randomly along a multi-point path at ground level (Y=0).
|
Full Usage:
scatterStampAt y count seed stamp section
Parameters:
int
count : int
seed : int
stamp : GridSection3D<'T> -> GridSection3D<'T>
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Scatters a stamp randomly on an XZ plane at a specific Y level.
|
Full Usage:
scatterSurface heightFn count seed content section
Parameters:
int -> int -> int
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>
Modifiers: inline Type parameters: 'T |
Scatters content randomly across a varying surface defined by a height function. Perfect for placing trees, rocks, or grass on hills and valleys.
|
Mibo