Skip to main content

SplatData

A struct in Root.Township, Alta.Forests.

Terrain texture blend for one point: two layer indices and how far to blend from the first to the second. Stored in a colour (red, green, blue).

Constructors​

MemberWhat it is
SplatData(int layer1, int layer2, float lerp)Creates a SplatData from layer1, layer2 and lerp.

Fields​

MemberWhat it is
int layer1First texture layer index (0 to 255).
int layer2Second texture layer index (0 to 255).
float lerpBlend from layer 1 (0) to layer 2 (1).

Methods​

MemberWhat it is
void Serialize(Stream stream)Reads or writes both layers and the blend.
void SetLayer1(int texture, float strength)Sets layer 1 with a strength, so the blend leans that way.
void SetLayer1IfStronger(int texture, float strength)Sets layer 1 only if it would be stronger than now.
void SetLayer2(int texture, float strength)Sets layer 2 with a strength.
void SetLayer2IfStronger(int texture, float strength)Sets layer 2 only if it would be stronger than now.
Color ToColor()Packs into a colour, or packs a whole grid into a colour array.
static Color[] ToColor(SplatData[,] splatDatas)Packs into a colour, or packs a whole grid into a colour array.
static void ToSplat(Color[] color, SplatData[,] splatDatas)Unpacks a colour array into a grid.

Used in​

Members of other types that take, return or hold a SplatData: