chunk stuff and camera smoothing

This commit is contained in:
Halbear
2026-02-14 01:21:57 +00:00
parent f617f799c2
commit 70acbd2526
3 changed files with 53 additions and 17 deletions

View File

@@ -1059,11 +1059,12 @@ namespace VoxelIsometricRenderer
}
public void GenerateLightMap()
{
Chunk ChunkAbove = ChunkRegistry.FetchChunk(String.Format("x={0};y={1};z={2}", ChunkPos[0], ChunkPos[1] +1, ChunkPos[2]));
for (int x = 0;x < SkyLightHeightMap.GetLength(0); x++)
{
for(int z = 0; z < SkyLightHeightMap.GetLength(1); z++)
{
int Y = 1;
int Y = ChunkAbove != null ? ChunkAbove.SkyLightHeightMap[x,1,z] != 0 ? ChunkAbove.SkyLightHeightMap[x, 1, z] : 1 : 1;
for (int y = SkyLightHeightMap.GetLength(1) - 1; y > 0; y--)
{
SkyLightHeightMap[x, y, z] = Y;
@@ -1087,7 +1088,7 @@ namespace VoxelIsometricRenderer
{
if (BlockReg[x, y, z] != -1 && Culled[x, y, z] == false)
{
BlockRegistry.RenderBlock(g, BlockReg[x, y, z], x + ChunkPos[0] * ChunkRegistry.FetchDimensions()[0], y + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], z + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], SkyLightHeightMap[x, y, z]);
BlockRegistry.RenderBlock(g, BlockReg[x, y, z], x + ChunkPos[0] * ChunkRegistry.FetchDimensions()[0], y + ChunkPos[1] * ChunkRegistry.FetchDimensions()[1], z + ChunkPos[2] * ChunkRegistry.FetchDimensions()[2], SkyLightHeightMap[x, y, z]);
}
}
}
@@ -1153,6 +1154,10 @@ namespace VoxelIsometricRenderer
static int ChunkLength = 16;
static List<Chunk> Chunks = new List<Chunk>();
static List<string> Chunk_Pos_Lookup = new List<string>();
public static int FetchChunkCount()
{
return Chunks.Count;
}
public static Chunk IndexChunk(int x, int y, int z)
{
Chunk newChunk = new Chunk(x, y, z, ChunkWidth, ChunkHeight, ChunkLength, Chunks.Count);