refactor: Optimize rendering with chunk canvas caching and performance improvements
This commit is contained in:
@@ -528,11 +528,11 @@ function generateChunksAroundPlayer() {
|
||||
const key = getChunkKey(chunkX, chunkY);
|
||||
|
||||
// Always generate stone layer chunks
|
||||
const isNewChunk = !chunks.has(key);
|
||||
getOrCreateChunk(chunkX, chunkY);
|
||||
|
||||
// Mark as dirty only if it's a new chunk or if it's visible
|
||||
if (!chunks.has(key) || visibleChunks.some(chunk =>
|
||||
chunk.chunkX === chunkX && chunk.chunkY === chunkY && chunk.isVisible)) {
|
||||
// Mark as dirty only if it's a new chunk
|
||||
if (isNewChunk) {
|
||||
dirtyChunks.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user