implement world generator, frustum culling and rebuild queue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user