Class TerrainAssert
Assertions over terrain compiler doubles. Each throws TerrainAssertException naming the first offending vertices.
public static class TerrainAssert
- Inheritance
-
objectTerrainAssert
Methods
OnlyChangedWithin(TerrainSnapshot, TerrainComp, Func<float, float, bool>, string, bool)
Every change since the snapshot lies where allowed (world x, z) says a change may be; the
rest of the zone, flags included, is exactly as it was. Also fails when nothing changed at all, since a check
that passes on an untouched zone cannot tell a write from no write; pass requireChange false
when no change is the expectation.
public static void OnlyChangedWithin(TerrainSnapshot before, TerrainComp after, Func<float, float, bool> allowed, string what = "zone", bool requireChange = true)
Parameters
beforeTerrainSnapshotafterTerrainCompallowedFunc<float, float, bool>whatstringrequireChangebool
SeamAgrees(Heightmap, Heightmap, float)
Two loaded neighbouring zones agree on the vertices they share: rendered heights within
tolerance metres (rebuild both first) and identical paint. A zone written without its
neighbour shows a step or a paint edge along the seam.
public static void SeamAgrees(Heightmap a, Heightmap b, float tolerance = 0.001)
Parameters
aHeightmapbHeightmaptolerancefloat
Unchanged(TerrainSnapshot, TerrainComp, string)
The compiler is exactly as it was in the snapshot.
public static void Unchanged(TerrainSnapshot before, TerrainComp after, string what = "zone")
Parameters
beforeTerrainSnapshotafterTerrainCompwhatstring
VertexPosition(Heightmap, int, int)
The world x, z of a compiler vertex (row-major, (width + 1) per row, centred on the heightmap).
public static (float X, float Z) VertexPosition(Heightmap heightmap, int width, int index)
Parameters
heightmapHeightmapwidthintindexint
Returns
- (float X, float Z)