Table of Contents

Class HeightmapParser

Namespace
Map.Loading.Images
Assembly
MapAssembly.dll

Heightmap parser for terrain elevation data Typically uses grayscale values where darker = lower elevation

public static class HeightmapParser
Inheritance
object
HeightmapParser

Methods

CalculateStats(HeightmapResult)

Calculate heightmap statistics

public static HeightmapParser.HeightmapStats CalculateStats(HeightmapParser.HeightmapResult heightmap)

Parameters

heightmap HeightmapParser.HeightmapResult

Returns

HeightmapParser.HeightmapStats

ParseHeightmap(NativeArray<byte>, Allocator)

Parse heightmap from grayscale BMP data

public static HeightmapParser.HeightmapResult ParseHeightmap(NativeArray<byte> bmpFileData, Allocator allocator)

Parameters

bmpFileData NativeArray<byte>
allocator Allocator

Returns

HeightmapParser.HeightmapResult

ParseHeightmap(NativeSlice<byte>, Allocator)

Parse heightmap from grayscale BMP data

public static HeightmapParser.HeightmapResult ParseHeightmap(NativeSlice<byte> bmpFileData, Allocator allocator)

Parameters

bmpFileData NativeSlice<byte>
allocator Allocator

Returns

HeightmapParser.HeightmapResult

TryGetAbsoluteHeightAt(HeightmapResult, int, int, out float)

Get absolute height at specific coordinates (in original scale)

public static bool TryGetAbsoluteHeightAt(HeightmapParser.HeightmapResult heightmap, int x, int y, out float absoluteHeight)

Parameters

heightmap HeightmapParser.HeightmapResult
x int
y int
absoluteHeight float

Returns

bool

TryGetHeightAt(HeightmapResult, int, int, out float)

Get normalized height at specific coordinates (0.0 - 1.0)

public static bool TryGetHeightAt(HeightmapParser.HeightmapResult heightmap, int x, int y, out float height)

Parameters

heightmap HeightmapParser.HeightmapResult
x int
y int
height float

Returns

bool

TryGetInterpolatedHeight(HeightmapResult, float, float, out float)

Sample height with bilinear interpolation for smooth values

public static bool TryGetInterpolatedHeight(HeightmapParser.HeightmapResult heightmap, float x, float y, out float height)

Parameters

heightmap HeightmapParser.HeightmapResult
x float
y float
height float

Returns

bool

TryGetSlope(HeightmapResult, int, int, out float)

Calculate terrain slope at specific coordinates Returns slope magnitude (0 = flat, 1+ = steep)

public static bool TryGetSlope(HeightmapParser.HeightmapResult heightmap, int x, int y, out float slope)

Parameters

heightmap HeightmapParser.HeightmapResult
x int
y int
slope float

Returns

bool

TryGetTerrainType(HeightmapResult, int, int, out TerrainType)

Classify terrain type at specific coordinates

public static bool TryGetTerrainType(HeightmapParser.HeightmapResult heightmap, int x, int y, out HeightmapParser.TerrainType terrainType)

Parameters

heightmap HeightmapParser.HeightmapResult
x int
y int
terrainType HeightmapParser.TerrainType

Returns

bool