[ChunkBuilder] Fixed smooth lighting issues with torchlight.

This commit is contained in:
Quentin Bazin 2020-01-04 16:25:10 +09:00
parent 64fe451741
commit 90ab911840
2 changed files with 7 additions and 4 deletions

3
TODO
View File

@ -14,12 +14,13 @@ TODO
• DONE: A mix of pickaxe + axe recipes gives a pickaxe?!
• DONE: Lighting doesnt propagate between chunks
• DONE: Pressing `Esc` key in `SettingsMenuState` should just quit the category, not the state
• DONE: Chunks are sent too many times to client on login
• TODO: Lighting issues
◦ DONE: Sunlight doesnt propagate correctly
◦ DONE: When loading chunks with smooth lighting enabled, they have black borders
◦ DONE: Flower lighting is weird
◦ TODO: Trees should block light
• TODO: Chunks are sent too many times to client on login
• TODO: `ServerWorld::sendWorldData` is useless and should be replaced by `sendSpawnData`
• TODO: Shapeless recipe code isnt working
• TODO: GUI scale issues
◦ TODO: `HUD` doesnt update when GUI scale is changed

View File

@ -183,11 +183,13 @@ void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const ClientChunk &chunk, con
vertices[j].lightValue[0] = chunk.lightmap().getSunlight(
surroundingBlockPos[0], surroundingBlockPos[1], surroundingBlockPos[2]);
if (Config::isTorchSmoothLightingEnabled)
int torchlight = chunk.lightmap().getTorchlight(
surroundingBlockPos[0], surroundingBlockPos[1], surroundingBlockPos[2]);
if (Config::isTorchSmoothLightingEnabled && torchlight == 0)
vertices[j].lightValue[1] = getLightForVertex(Light::Torch, x, y, z, i, j, normal, chunk);
else
vertices[j].lightValue[1] = chunk.lightmap().getTorchlight(
surroundingBlockPos[0], surroundingBlockPos[1], surroundingBlockPos[2]);
vertices[j].lightValue[1] = torchlight;
if (Config::isAmbientOcclusionEnabled)
vertices[j].ambientOcclusion = getAmbientOcclusion(x, y, z, i, j, chunk);