From a8a2440b5d854aa23dfd7548749acaf85b25b53b Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Tue, 11 Feb 2020 16:42:54 +0900 Subject: [PATCH] [ClientChunk] Water is now visible from the inside. --- TODO | 5 ----- client/source/world/ChunkBuilder.cpp | 3 ++- client/source/world/ClientChunk.cpp | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index e916032ee..bef8eac7c 100644 --- a/TODO +++ b/TODO @@ -21,11 +21,6 @@ TODO • TODO: Blocks can be placed inside the player (check for AABB?) • TODO: Sometimes it’s possible to aim between two blocks and right-clicking will replace one -# Code improvements - -• TODO: If possible, `Cube` should inherit from `ItemWidget` or `Widget` -• TODO: Unify cube coords in `BlockCursor`, `Cube`, `ChunkBuilder` - # Refactorings • TODO: Add a mesh system, either here or in `GameKit` diff --git a/client/source/world/ChunkBuilder.cpp b/client/source/world/ChunkBuilder.cpp index d8b774c2c..a006f24d5 100644 --- a/client/source/world/ChunkBuilder.cpp +++ b/client/source/world/ChunkBuilder.cpp @@ -135,7 +135,8 @@ inline void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const ClientChunk &chu // Skip hidden faces if (surroundingBlock && surroundingBlock->id() && ((block->drawType() == BlockDrawType::Solid && surroundingBlock->drawType() == BlockDrawType::Solid && surroundingBlock->isOpaque()) - || (block->id() == surroundingBlock->id() && (block->drawType() == BlockDrawType::Liquid || block->drawType() == BlockDrawType::Glass)))) + || (block->id() == surroundingBlock->id() && (block->drawType() == BlockDrawType::Liquid || block->drawType() == BlockDrawType::Glass)) + || (block->drawType() == BlockDrawType::Liquid && surroundingBlock->drawType() == BlockDrawType::Solid))) return; static glm::vec3 a, b, c, v1, v2, normal; diff --git a/client/source/world/ClientChunk.cpp b/client/source/world/ClientChunk.cpp index 75f93925f..da14f42a5 100644 --- a/client/source/world/ClientChunk.cpp +++ b/client/source/world/ClientChunk.cpp @@ -38,7 +38,7 @@ void ClientChunk::drawLayer(gk::RenderTarget &target, gk::RenderStates states, u states.texture = &m_textureAtlas.texture(); - if (layer == ChunkBuilder::Layer::Flora) + if (layer == ChunkBuilder::Layer::Flora || (layer == ChunkBuilder::Layer::Liquid && areAllNeighboursInitialized())) glCheck(glDisable(GL_CULL_FACE)); else glCheck(glEnable(GL_CULL_FACE));