Vertex colour is now chosen from the true, unrounded surface height and faded between adjacent materials across a tunable band, instead of switching at one rounded integer depth. This removes the horizontal contour banding. Colour path only: density field, Marching Cubes interpolation/welding, chunk dimensions, the .dat contract and all road logic are untouched. BlockID classification is unchanged and still drives non-visual use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
44 lines
2.1 KiB
C#
44 lines
2.1 KiB
C#
using Godot;
|
|
|
|
namespace IslaApocalypse.Core
|
|
{
|
|
public class ChunkData
|
|
{
|
|
public Vector2I ChunkPosition; // The X/Z coordinate of this chunk (e.g., 0,0 or 1,0)
|
|
|
|
// We need Width+1 and Depth+1 so the Marching Cubes mesh connects seamlessly to the neighbor chunks!
|
|
// public float[,,] Densities = new float[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_HEIGHT, Constants.CHUNK_SIZE_Z + 1];
|
|
// public byte[,,] BlockIDs = new byte[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_HEIGHT, Constants.CHUNK_SIZE_Z + 1];
|
|
// OLD:
|
|
// Densities = new float[Constants.CHUNK_SIZE_X, Constants.CHUNK_HEIGHT, Constants.CHUNK_SIZE_Z];
|
|
// BlockIDs = new int[Constants.CHUNK_SIZE_X, Constants.CHUNK_HEIGHT, Constants.CHUNK_SIZE_Z];
|
|
|
|
// NEW (Fix 3): We expand by 1 to sample the neighbor's border perfectly without seams!
|
|
public float[,,] Densities = new float[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_HEIGHT + 1, Constants.CHUNK_SIZE_Z + 1];
|
|
public byte[,,] BlockIDs = new byte[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_HEIGHT + 1, Constants.CHUNK_SIZE_Z + 1];
|
|
|
|
// --- PER-COLUMN DATA, FOR VERTEX COLOURING ONLY ----------------------
|
|
// One entry per X/Z column of this chunk (same +1 padding as above).
|
|
//
|
|
// Why these exist: BlockIDs are classified against a ROUNDED surface
|
|
// height, which is fine for storage but makes the rendered colour jump
|
|
// in whole-metre steps (the "contour band" artefact). The renderer
|
|
// instead reads the TRUE, unrounded surface height from here, so the
|
|
// material fade follows the real ground.
|
|
//
|
|
// These are read by the mesher only. Nothing about geometry, collision
|
|
// or storage depends on them.
|
|
public float[,] SurfaceHeights = new float[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_SIZE_Z + 1];
|
|
public Biome[,] ColumnBiomes = new Biome[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_SIZE_Z + 1];
|
|
public bool[,] ColumnIsRoad = new bool[Constants.CHUNK_SIZE_X + 1, Constants.CHUNK_SIZE_Z + 1];
|
|
|
|
// For our future delta-save system
|
|
public bool IsPlayerProtected = false;
|
|
public bool NeedsSaving = false;
|
|
|
|
public ChunkData(Vector2I position)
|
|
{
|
|
ChunkPosition = position;
|
|
}
|
|
}
|
|
}
|