implement world generator, frustum culling and rebuild queue

This commit is contained in:
LabyStudio
2022-02-01 10:17:03 +01:00
parent ed49c9f776
commit a3c21b3727
16 changed files with 481 additions and 35 deletions
+15 -1
View File
@@ -8,16 +8,22 @@ window.Chunk = class {
this.group = new THREE.Object3D();
this.group.matrixAutoUpdate = false;
this.loaded = false;
// Initialize sections
this.sections = [];
for (let y = 0; y < 16; y++) {
let section = new ChunkSection(world, x, y, z);
let section = new ChunkSection(world, this, x, y, z);
this.sections[y] = section;
this.group.add(section.group);
}
}
setBlockAt(x, y, z, typeId) {
this.getSection(y >> 4).setBlockAt(x, y & 15, z, typeId);
}
getSection(y) {
return this.sections[y];
}
@@ -34,4 +40,12 @@ window.Chunk = class {
}
}
load() {
this.loaded = true;
}
isLoaded() {
return this.loaded;
}
}