load near chunks first

This commit is contained in:
Paul Mathieu 2021-12-12 01:09:47 -08:00
parent 6e47e9cd0a
commit 5175232b6d

View File

@ -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) {