Table of Contents

Method FromHeights

Namespace
Box3D
Assembly
Box3D.NET.dll

FromHeights(ReadOnlySpan<float>, int, int, Vector3, ReadOnlySpan<byte>, float?, float?, bool)

Builds a height field from a grid of heights.

public static HeightField FromHeights(ReadOnlySpan<float> heights, int columnCount, int rowCount, Vector3 scale, ReadOnlySpan<byte> materialIndices = default, float? minimumHeight = null, float? maximumHeight = null, bool clockwiseWinding = false)

Parameters

heights ReadOnlySpan<float>

The height at each grid point, row by row. Must hold exactly columnCount times rowCount values.

columnCount int

The number of grid lines along the x axis.

rowCount int

The number of grid lines along the z axis.

scale Vector3

The size of the field. The x and z components are the cell size; the y component multiplies the heights.

materialIndices ReadOnlySpan<byte>

One material per cell, so (columnCount - 1) * (rowCount - 1) values. Box3D.HeightField.HoleMaterial marks a hole. Leave empty for solid terrain with a single material.

minimumHeight float?

The lowest height used for quantization, or null to take it from the data. Set it explicitly when several fields must line up.

maximumHeight float?

The highest height used for quantization, or null to take it from the data.

clockwiseWinding bool

Whether to flip the surface, so that it faces downwards.

Returns

HeightField

The height field.

Remarks

The inputs are copied, so the arrays may be released once this returns.

Exceptions

ArgumentException

The counts do not agree, or the scale is not positive.