Class HeightmapParser
Heightmap parser for terrain elevation data Typically uses grayscale values where darker = lower elevation
public static class HeightmapParser
- Inheritance
-
objectHeightmapParser
Methods
CalculateStats(HeightmapResult)
Calculate heightmap statistics
public static HeightmapParser.HeightmapStats CalculateStats(HeightmapParser.HeightmapResult heightmap)
Parameters
heightmapHeightmapParser.HeightmapResult
Returns
ParseHeightmap(NativeArray<byte>, Allocator)
Parse heightmap from grayscale BMP data
public static HeightmapParser.HeightmapResult ParseHeightmap(NativeArray<byte> bmpFileData, Allocator allocator)
Parameters
bmpFileDataNativeArray<byte>allocatorAllocator
Returns
ParseHeightmap(NativeSlice<byte>, Allocator)
Parse heightmap from grayscale BMP data
public static HeightmapParser.HeightmapResult ParseHeightmap(NativeSlice<byte> bmpFileData, Allocator allocator)
Parameters
bmpFileDataNativeSlice<byte>allocatorAllocator
Returns
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
heightmapHeightmapParser.HeightmapResultxintyintabsoluteHeightfloat
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
heightmapHeightmapParser.HeightmapResultxintyintheightfloat
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
heightmapHeightmapParser.HeightmapResultxfloatyfloatheightfloat
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
heightmapHeightmapParser.HeightmapResultxintyintslopefloat
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
heightmapHeightmapParser.HeightmapResultxintyintterrainTypeHeightmapParser.TerrainType
Returns
- bool