load near chunks first
This commit is contained in:
parent
6e47e9cd0a
commit
5175232b6d
7
index.js
7
index.js
@ -445,8 +445,9 @@ function updateWorldGeometry(gl, world, z, x, timeLimit = 10000) {
|
||||
const start = performance.now();
|
||||
|
||||
// k. Now, generate buffers for all chunks
|
||||
for (let i = ic - 8; i < ic + 8; i++) {
|
||||
for (let j = jc - 8; j < jc + 8; j++) {
|
||||
for (let radius = 0; radius < 8; radius++) {
|
||||
for (let i = ic - radius; i < ic + radius; i++) {
|
||||
for (let j = jc - radius; j < jc + radius; j++) {
|
||||
const chunk = world.chunkMap.get(i, j);
|
||||
|
||||
if (chunk.buffer !== undefined) {
|
||||
@ -465,6 +466,8 @@ function updateWorldGeometry(gl, world, z, x, timeLimit = 10000) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollision(curPos, newPos, world) {
|
||||
|
Loading…
Reference in New Issue
Block a user