feat(headless): hydrate isolated collision worlds
This commit is contained in:
parent
9569dadb57
commit
b6547ff38c
20 changed files with 1960 additions and 101 deletions
|
|
@ -56,9 +56,25 @@ public sealed class TerrainSurface
|
|||
public TerrainSurface(byte[] heights, float[] heightTable,
|
||||
uint landblockX = 0, uint landblockY = 0,
|
||||
byte[]? terrainTypes = null)
|
||||
: this(
|
||||
heights,
|
||||
(heightTable
|
||||
?? throw new ArgumentNullException(nameof(heightTable)))
|
||||
.AsSpan(),
|
||||
landblockX,
|
||||
landblockY,
|
||||
terrainTypes)
|
||||
{
|
||||
}
|
||||
|
||||
public TerrainSurface(
|
||||
byte[] heights,
|
||||
ReadOnlySpan<float> heightTable,
|
||||
uint landblockX = 0,
|
||||
uint landblockY = 0,
|
||||
byte[]? terrainTypes = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(heights);
|
||||
ArgumentNullException.ThrowIfNull(heightTable);
|
||||
if (heights.Length < 81)
|
||||
throw new ArgumentException("heights must have 81 entries", nameof(heights));
|
||||
if (heightTable.Length < 256)
|
||||
|
|
@ -191,8 +207,25 @@ public sealed class TerrainSurface
|
|||
uint landblockX, uint landblockY,
|
||||
float localX, float localY)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(heights);
|
||||
ArgumentNullException.ThrowIfNull(heightTable);
|
||||
return SampleZFromHeightmap(
|
||||
heights,
|
||||
heightTable.AsSpan(),
|
||||
landblockX,
|
||||
landblockY,
|
||||
localX,
|
||||
localY);
|
||||
}
|
||||
|
||||
public static float SampleZFromHeightmap(
|
||||
byte[] heights,
|
||||
ReadOnlySpan<float> heightTable,
|
||||
uint landblockX,
|
||||
uint landblockY,
|
||||
float localX,
|
||||
float localY)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(heights);
|
||||
if (heights.Length < 81)
|
||||
throw new ArgumentException("heights must have 81 entries", nameof(heights));
|
||||
if (heightTable.Length < 256)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue