public static class TerrainStoreReading and writing a whole terrain: its description, its edit layers, its paint channels and its holes.
Remarks
[docs/plan/31 § T3]'s owed .vxterrain. TerrainMode.Created hands a Terrain to whoever asked for one and deliberately does not write it — a mode has no asset database. This is the format it would be written in, and it is binary for [§ D2]'s reason: a 4 km² terrain is tens of megabytes of samples, and a scene file is the one two people touch every day.
⚠ The layers are stored and the composite is not. A composite is a cache — the layer stack is the definition, and writing both would be writing a number twice and guaranteeing they disagree the first time somebody edits the file by hand. Reading calls Resolve, which is the same code the editor runs.
⚠ Only the samples a layer has touched. An edit layer over a 4 km² terrain that somebody sculpted one hill into is sixteen million zeroes and a hundred thousand numbers; storing its occupied chunks makes the file the size of the edit rather than the size of the world, which is what makes a stack of layers affordable at all.
⚠ A version, first, and it is checked. A heightfield read with the wrong field order is not a parse error — it is a terrain that loads and looks like static, and the person seeing it has no reason to suspect the format.
Fields and properties (2)
public static ReadOnlySpan<byte> MagicWhat every file starts with.
public const int VersionThe format this build writes.
Methods (3)
public static byte[] Write(Terrain terrain)Writes a terrain.
public static Terrain Read(ReadOnlySpan<byte> data)Reads a terrain.
public static long BaseByteCount(in TerrainDescription description)How many bytes a terrain would be, before its layers and paint.
Used by (3)
- TerrainStoreTestsVixen.Terrain.Tests
- TerrainModuleVixen.Editor.Terrain
- TerrainSessionTestsVixen.Editor.App.Tests