Header menu logo Mibo

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

checkerSurface heightFn odd even section

Full Usage: checkerSurface heightFn odd even section

Parameters:
    heightFn : 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.

heightFn : int -> int -> int
odd : 'T
even : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

generateSurface heightFn generator section

Full Usage: generateSurface heightFn generator section

Parameters:
    heightFn : 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.

heightFn : int -> int -> int
generator : int -> int -> int -> 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

ground width depth content section

Full Usage: ground width depth content section

Parameters:
    width : 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.

width : 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>

heightmap heightFn content section

Full Usage: heightmap heightFn content section

Parameters:
    heightFn : 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.

heightFn : int -> int -> int

Function that returns height for a given (x, z) coordinate.

content : 'T

Content to fill.

section : GridSection3D<'T>
Returns: GridSection3D<'T>

layeredHeightmap heightFn topLayer midLayer midDepth bottomLayer section

Full Usage: layeredHeightmap heightFn topLayer midLayer midDepth bottomLayer section

Parameters:
    heightFn : 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).

heightFn : 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>

path points width content section

Full Usage: path points width content section

Parameters:
    points : (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.

points : (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>

pit width depth dropHeight section

Full Usage: pit width depth dropHeight section

Parameters:
    width : 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.

width : 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>

plateau width depth height top side section

Full Usage: plateau width depth height top side section

Parameters:
    width : 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.

width : 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>

rampX width depth rise content section

Full Usage: rampX width depth rise content section

Parameters:
    width : 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.

width : 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>

rampZ width depth rise content section

Full Usage: rampZ width depth rise content section

Parameters:
    width : 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.

width : 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>

scatter count seed content section

Full Usage: scatter count seed content section

Parameters:
    count : 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).

count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

scatterAt y count seed content section

Full Usage: scatterAt y count seed content section

Parameters:
    y : 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.

y : int
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

scatterPath points count seed content section

Full Usage: scatterPath points count seed content section

Parameters:
    points : (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).

points : (int * int * int) list
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

scatterStampAt y count seed stamp section

Full Usage: scatterStampAt y count seed stamp section

Parameters:
Returns: GridSection3D<'T>
Modifiers: inline
Type parameters: 'T

Scatters a stamp randomly on an XZ plane at a specific Y level.

y : int
count : int
seed : int
stamp : GridSection3D<'T> -> GridSection3D<'T>
section : GridSection3D<'T>
Returns: GridSection3D<'T>

scatterSurface heightFn count seed content section

Full Usage: scatterSurface heightFn count seed content section

Parameters:
    heightFn : 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.

heightFn : int -> int -> int
count : int
seed : int
content : 'T
section : GridSection3D<'T>
Returns: GridSection3D<'T>

Type something to start searching.