[ChunkBuilder] Fixed AO anisotropy issue. [SettingsMenuState] Ambient occlusion is now available again.

This commit is contained in:
Quentin Bazin 2020-02-01 16:12:49 +09:00
parent aebe996397
commit 0b36dabb5e
2 changed files with 11 additions and 11 deletions

View File

@ -114,7 +114,7 @@ void SettingsMenuState::addGraphicsButtons() {
addToggleButton("Torch Smooth Lighting", Config::isTorchSmoothLightingEnabled, true);
addToggleButton("Sun Smooth Lighting", Config::isSunSmoothLightingEnabled, true);
addToggleButton("Ambient Occlusion", Config::isAmbientOcclusionEnabled, true).setEnabled(false);
addToggleButton("Ambient Occlusion", Config::isAmbientOcclusionEnabled, false);
addToggleButton("Wireframe Mode", Config::isWireframeModeEnabled, false);
m_menuWidget.addButton("GUI Scale: " + std::to_string(GUI_SCALE), [] (TextButton &button) {

View File

@ -191,15 +191,15 @@ inline void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const ClientChunk &chu
vertices[j].lightValue[1] = chunk.lightmap().getTorchlight(
surroundingBlockPos[0], surroundingBlockPos[1], surroundingBlockPos[2]);
if (Config::isAmbientOcclusionEnabled)
vertices[j].ambientOcclusion = getAmbientOcclusion(x, y, z, i, j, chunk);
else
vertices[j].ambientOcclusion = 5;
vertices[j].ambientOcclusion = getAmbientOcclusion(x, y, z, i, j, chunk);
vertices[j].blockType = block->id();
}
auto addVertex = [&](u8 j) {
if (!Config::isAmbientOcclusionEnabled)
vertices[j].ambientOcclusion = 5;
if (block->id() == BlockType::Water)
m_vertices[Layer::Liquid].emplace_back(vertices[j]);
else if (block->id() == BlockType::Leaves)
@ -213,17 +213,17 @@ inline void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const ClientChunk &chu
vertices[1].ambientOcclusion + vertices[3].ambientOcclusion) {
addVertex(0);
addVertex(1);
addVertex(3);
addVertex(3);
addVertex(1);
addVertex(2);
addVertex(2);
addVertex(3);
addVertex(0);
} else {
addVertex(0);
addVertex(1);
addVertex(2);
addVertex(2);
addVertex(3);
addVertex(0);
addVertex(3);
addVertex(1);
addVertex(2);
}
}