summaryrefslogtreecommitdiff
path: root/src/World
diff options
context:
space:
mode:
Diffstat (limited to 'src/World')
-rw-r--r--src/World/BlockType.hpp12
-rw-r--r--src/World/Generation/ChunkMeshing.cpp6
2 files changed, 13 insertions, 5 deletions
diff --git a/src/World/BlockType.hpp b/src/World/BlockType.hpp
index 472523f..82c63d3 100644
--- a/src/World/BlockType.hpp
+++ b/src/World/BlockType.hpp
@@ -26,6 +26,16 @@ public:
operator Value() const { return m_block; }
+ bool is_transparent() const {
+ switch (m_block) {
+ case Air:
+ case Leaves:
+ return true;
+ default:
+ return false;
+ }
+ }
+
static std::vector<BlockType> all() {
return {
Air,
@@ -34,6 +44,8 @@ public:
Stone,
Sand,
Snow,
+ Wood,
+ Leaves,
Water,
};
}
diff --git a/src/World/Generation/ChunkMeshing.cpp b/src/World/Generation/ChunkMeshing.cpp
index 0494da4..e065987 100644
--- a/src/World/Generation/ChunkMeshing.cpp
+++ b/src/World/Generation/ChunkMeshing.cpp
@@ -129,11 +129,7 @@ bool is_face_visible(Chunk& chunk, const ChunkMeshing::ChunkNeighbors& neighbors
}
auto [neighbor] = chunk_to_ask->get(neighbor_pos.x(), neighbor_pos.y(), neighbor_pos.z());
- if (neighbor == BlockType::Air) {
- return true;
- }
-
- return false;
+ return neighbor.is_transparent();
}
GFX::Mesh ChunkMeshing::create_mesh_for_chunk(Chunk& chunk, const ChunkNeighbors& neighbors) {