implement water fog

This commit is contained in:
LabyStudio
2022-02-01 11:06:34 +01:00
parent a3c21b3727
commit cc3da60a6e
9 changed files with 27 additions and 19 deletions
@@ -31,7 +31,7 @@ window.ChunkSection = class {
}
}
render(renderLayer) {
render() {
}
@@ -68,6 +68,10 @@ window.World = class {
return chunkSection == null ? 0 : chunkSection.getBlockAt(x & 15, y & 15, z & 15);
}
getBlockAtFace(x, y, z, face) {
return this.getBlockAt(x + face.x, y + face.y, z + face.z);
}
getChunkSectionAt(chunkX, layerY, chunkZ) {
return this.getChunkAt(chunkX, chunkZ).getSection(layerY);
}
@@ -35,7 +35,7 @@ window.Block = class {
}
shouldRenderFace(world, x, y, z, face) {
let typeId = world.getBlockAt(x + face.x, y + face.y, z + face.z);
let typeId = world.getBlockAtFace(x, y, z, face);
return typeId === 0 || Block.getById(typeId).isTransparent();
}
@@ -4,7 +4,6 @@ window.BlockWater = class extends Block {
super(id, textureSlotId);
}
getOpacity() {
return 0.3;
}
@@ -14,7 +13,7 @@ window.BlockWater = class extends Block {
}
shouldRenderFace(world, x, y, z, face) {
let typeId = world.getBlockAt(x + face.x, y + face.y, z + face.z);
let typeId = world.getBlockAtFace(x, y, z, face);
return typeId === 0 || typeId !== this.id && Block.getById(typeId).isTransparent();
}