Code:
public static class Constants
{
public const float TileSize = 533.33333333333333333333333333333333333333333333f;
public const float ChunkSize = TileSize / 16.0f;
}
.. in my mapchunk handler ..
Code:
OuterPositions = new Vector3[9,9];
int heightCount = 0;
// Outer heights
const float seperator = Constants.ChunkSize / 8.0f;
for (int y = 0; y < 9; y++)
{
for (int x = 0; x < 9; x++)
{
OuterPositions[x, y] = new Vector3(
Information.Position.X - y * seperator,
Information.Position.Y - x * seperator,
Information.Position.Z + HeightChunk.Heights[heightCount++]);
}
heightCount += 8;
}
heightCount = 9;
// Inner heights
MiddlePositions = new Vector3[8,8];
for (int y = 0; y < 8; y++)
{
for (int x = 0; x < 8; x++)
{
MiddlePositions[x, y] = new Vector3(
Information.Position.X - seperator / 2 - y * seperator,
Information.Position.Y - seperator / 2 - x * seperator,
Information.Position.Z + HeightChunk.Heights[heightCount++]);
}
heightCount += 9;
}
Information is the read struct.