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
heightsReadOnlySpan<float>-
The height at each grid point, row by row. Must hold exactly
columnCounttimesrowCountvalues. columnCountint-
The number of grid lines along the x axis.
rowCountint-
The number of grid lines along the z axis.
scaleVector3-
The size of the field. The x and z components are the cell size; the y component multiplies the heights.
materialIndicesReadOnlySpan<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. minimumHeightfloat?-
The lowest height used for quantization, or null to take it from the data. Set it explicitly when several fields must line up.
maximumHeightfloat?-
The highest height used for quantization, or null to take it from the data.
clockwiseWindingbool-
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.