optimized faces
This commit is contained in:
5
World.cs
5
World.cs
@@ -10,6 +10,7 @@ namespace Voxel
|
||||
|
||||
private (int x, int z) _lastCenter = (0, 0);
|
||||
private int _loadDistance = 4;
|
||||
bool chunkLoadingInitialized = false;
|
||||
|
||||
private static readonly Dictionary<Orientation, (int x, int y)> _neighborOffsets = new()
|
||||
{
|
||||
@@ -62,7 +63,7 @@ namespace Voxel
|
||||
int centerZ = (int)Math.Floor(playerPosition.Z / Chunk.Size);
|
||||
|
||||
// Quick check - skip if still in same chunk
|
||||
if (centerX == _lastCenter.x && centerZ == _lastCenter.z)
|
||||
if ((centerX == _lastCenter.x && centerZ == _lastCenter.z) && chunkLoadingInitialized)
|
||||
return;
|
||||
|
||||
_lastCenter = (centerX, centerZ);
|
||||
@@ -78,6 +79,8 @@ namespace Voxel
|
||||
|
||||
// Load chunks inside range
|
||||
LoadChunksInRange(minX, maxX, minZ, maxZ);
|
||||
|
||||
chunkLoadingInitialized = true;
|
||||
}
|
||||
|
||||
private void UnloadDistantChunks(int minX, int maxX, int minZ, int maxZ)
|
||||
|
||||
Reference in New Issue
Block a user