implement new terrain generator, cave generator, tree generator, implement big tree generator, improve light update performance
This commit is contained in:
@@ -68,6 +68,9 @@ export default class BlockRenderer {
|
||||
this.tessellator.setColor(color, color, color);
|
||||
}
|
||||
|
||||
// Set opacity of block
|
||||
this.tessellator.setAlpha(1 - block.getTransparency());
|
||||
|
||||
// Add face to tessellator
|
||||
this.addFace(world, face, ambientOcclusion, minX, minY, minZ, maxX, maxY, maxZ, minU, minV, maxU, maxV);
|
||||
}
|
||||
@@ -129,7 +132,7 @@ export default class BlockRenderer {
|
||||
let color = brightness * face.getShading();
|
||||
|
||||
// Set color with shading
|
||||
this.tessellator.setColor(color, color, color);
|
||||
this.tessellator.setColorRGB(color, color, color);
|
||||
}
|
||||
|
||||
getAverageLightLevelAt(world, x, y, z) {
|
||||
|
||||
@@ -25,10 +25,18 @@ export default class Tessellator {
|
||||
this.colors = [];
|
||||
}
|
||||
|
||||
setColor(red, green, blue, alpha = 1) {
|
||||
setColorRGB(red, green, blue) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
setColor(red, green, blue, alpha = 1) {
|
||||
this.setColorRGB(red, green, blue);
|
||||
this.setAlpha(alpha);
|
||||
}
|
||||
|
||||
setAlpha(alpha) {
|
||||
this.alpha = alpha;
|
||||
}
|
||||
|
||||
|
||||
@@ -540,8 +540,8 @@ export default class WorldRenderer {
|
||||
let renderDistance = WorldRenderer.RENDER_DISTANCE;
|
||||
|
||||
// Load chunks
|
||||
for (let x = -renderDistance; x <= renderDistance; x++) {
|
||||
for (let z = -renderDistance; z <= renderDistance; z++) {
|
||||
for (let x = -renderDistance + 1; x < renderDistance; x++) {
|
||||
for (let z = -renderDistance + 1; z < renderDistance; z++) {
|
||||
world.getChunkAt(cameraChunkX + x, cameraChunkZ + z);
|
||||
}
|
||||
}
|
||||
@@ -580,6 +580,16 @@ export default class WorldRenderer {
|
||||
} else {
|
||||
// Hide chunk
|
||||
chunk.group.visible = false;
|
||||
|
||||
// Unload chunk
|
||||
if (chunk.loaded) {
|
||||
chunk.unload();
|
||||
|
||||
// TODO Implement chunk unloading
|
||||
//let index = chunk.x + (chunk.z << 16);
|
||||
//world.chunks.delete(index);
|
||||
//world.group.add(chunk.group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user