From 6a6504378ff14b3c3e3ae82597ce76fa5ab53ba9 Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:00:01 +0000
Subject: [PATCH 1/6] Add VisibilityExtimator
---
.../windows/projects/Client/Client.vcxproj | 2 +
.../projects/Client/Client.vcxproj.filters | 6 +
.../windows/projects/Common/Common.vcxproj | 3 +
.../projects/Common/Common.vcxproj.filters | 9 +
.../windows/projects/World/World.vcxproj | 1 +
.../projects/World/World.vcxproj.filters | 3 +
.../client/renderer/VisibilityExtimator.cpp | 183 ++++++++++++++++++
.../client/renderer/VisibilityExtimator.hpp | 84 ++++++++
source/common/ByteMask.hpp | 40 ++++
source/common/Stopwatch.cpp | 94 +++++++++
source/common/Stopwatch.hpp | 45 +++++
source/world/Facing.cpp | 10 +
source/world/Facing.hpp | 9 +-
.../level/levelgen/chunk/ChunkTilePos.hpp | 5 +
source/world/tile/Tile.hpp | 5 +
15 files changed, 497 insertions(+), 2 deletions(-)
create mode 100644 source/client/renderer/VisibilityExtimator.cpp
create mode 100644 source/client/renderer/VisibilityExtimator.hpp
create mode 100644 source/common/ByteMask.hpp
create mode 100644 source/common/Stopwatch.cpp
create mode 100644 source/common/Stopwatch.hpp
create mode 100644 source/world/Facing.cpp
diff --git a/platforms/windows/projects/Client/Client.vcxproj b/platforms/windows/projects/Client/Client.vcxproj
index c34a51671..1b5ccb2af 100644
--- a/platforms/windows/projects/Client/Client.vcxproj
+++ b/platforms/windows/projects/Client/Client.vcxproj
@@ -240,6 +240,7 @@
+
@@ -398,6 +399,7 @@
+
diff --git a/platforms/windows/projects/Client/Client.vcxproj.filters b/platforms/windows/projects/Client/Client.vcxproj.filters
index 86807309a..d7bed0682 100644
--- a/platforms/windows/projects/Client/Client.vcxproj.filters
+++ b/platforms/windows/projects/Client/Client.vcxproj.filters
@@ -623,6 +623,9 @@
Header Files\App
+
+ Header Files\Renderer
+
@@ -1093,5 +1096,8 @@
Source Files\GUI\Components
+
+ Source Files\Renderer
+
\ No newline at end of file
diff --git a/platforms/windows/projects/Common/Common.vcxproj b/platforms/windows/projects/Common/Common.vcxproj
index a497af7e0..792e4b430 100644
--- a/platforms/windows/projects/Common/Common.vcxproj
+++ b/platforms/windows/projects/Common/Common.vcxproj
@@ -95,6 +95,7 @@
+
@@ -115,6 +116,8 @@
+
+
diff --git a/platforms/windows/projects/Common/Common.vcxproj.filters b/platforms/windows/projects/Common/Common.vcxproj.filters
index 56d68fb15..cea414b7f 100644
--- a/platforms/windows/projects/Common/Common.vcxproj.filters
+++ b/platforms/windows/projects/Common/Common.vcxproj.filters
@@ -71,6 +71,9 @@
Source Files\Threading
+
+ Source Files
+
@@ -127,5 +130,11 @@
Header Files\Threading
+
+ Header Files
+
+
+ Header Files
+
\ No newline at end of file
diff --git a/platforms/windows/projects/World/World.vcxproj b/platforms/windows/projects/World/World.vcxproj
index 8a8312eca..54eb90b0a 100644
--- a/platforms/windows/projects/World/World.vcxproj
+++ b/platforms/windows/projects/World/World.vcxproj
@@ -228,6 +228,7 @@
+
diff --git a/platforms/windows/projects/World/World.vcxproj.filters b/platforms/windows/projects/World/World.vcxproj.filters
index 18a19e701..6f8587d9d 100644
--- a/platforms/windows/projects/World/World.vcxproj.filters
+++ b/platforms/windows/projects/World/World.vcxproj.filters
@@ -659,6 +659,9 @@
Source Files\Item
+
+ Source Files
+
diff --git a/source/client/renderer/VisibilityExtimator.cpp b/source/client/renderer/VisibilityExtimator.cpp
new file mode 100644
index 000000000..c36abd17b
--- /dev/null
+++ b/source/client/renderer/VisibilityExtimator.cpp
@@ -0,0 +1,183 @@
+#include "client/renderer/VisibilityExtimator.hpp"
+
+VisibilityNode::VisibilityNode(bool empty)
+{
+ if (empty)
+ setEmpty();
+ else
+ setOpaque();
+}
+
+void VisibilityNode::setEmpty()
+{
+ for (int i = 0; i < Facing::MAX; i++)
+ {
+ m_visibility[i].setFull();
+ }
+}
+
+void VisibilityNode::setOpaque()
+{
+ for (int i = 0; i < Facing::MAX; i++)
+ {
+ m_visibility[i].setEmpty();
+ }
+}
+
+void VisibilityNode::connect(const ByteMask& group)
+{
+ for (uint8_t i = 0; i < Facing::MAX; i++)
+ {
+ if (group.contains(1 << i))
+ {
+ connect(i, group);
+ }
+ }
+}
+
+void VisibilityNode::connect(uint8_t A, const ByteMask& connected)
+{
+ for (uint8_t i = 0; i < Facing::MAX; i++)
+ {
+ if (connected.contains(1 << i))
+ {
+ connect(A, i);
+ }
+ }
+}
+
+void VisibilityNode::connect(uint8_t A, uint8_t B)
+{
+ if (A != B)
+ {
+ m_visibility[A].add(1 << B);
+ m_visibility[B].add(1 << A);
+ }
+}
+
+VisibilityExtimator::TileState& VisibilityExtimator::_at(const ChunkTilePos& p)
+{
+ size_t index = p.y + (p.x << 8) + (p.z << 4);
+ assert(index < TILES_SIZE);
+ return m_tiles[index];
+}
+
+VisibilityExtimator::TileState& VisibilityExtimator::_atWorld(const TilePos& t)
+{
+ return _at(t - m_origin);
+}
+
+VisibilityExtimator::TileState* VisibilityExtimator::_at(const ChunkTilePos& pos, ByteMask& set)
+{
+ if (pos.x > 128)
+ {
+ set.add(1 << Facing::WEST);
+ }
+ else if (pos.x > 15)
+ {
+ set.add(1 << Facing::EAST);
+ }
+ else if (pos.y > 128)
+ {
+ set.add(1 << Facing::DOWN);
+ }
+ else if (pos.y > 15)
+ {
+ set.add(1 << Facing::UP);
+ }
+ else if (pos.z > 128)
+ {
+ set.add(1 << Facing::NORTH);
+ }
+ else if (pos.z > 15)
+ {
+ set.add(1 << Facing::SOUTH);
+ }
+ else
+ {
+ return &_at(pos);
+ }
+
+ return nullptr;
+}
+
+void VisibilityExtimator::_visit(const ChunkTilePos& p, ByteMask& set)
+{
+ TileState* tileState = _at(p, set);
+ if (tileState && *tileState == TS_EMPTY)
+ {
+ m_floodQueue.push_back(p);
+ }
+}
+
+ByteMask VisibilityExtimator::_floodFill(const ChunkTilePos& startPos)
+{
+ ByteMask mask;
+
+ m_floodQueue.push_back(startPos);
+
+ while (!m_floodQueue.empty())
+ {
+ const ChunkTilePos& pos = m_floodQueue.front();
+
+ TileState& tileState = _at(pos);
+ if (tileState == TS_EMPTY)
+ {
+ tileState = TS_EMPTY_MARKED;
+
+ for (uint8_t face = 0; face < Facing::MAX; face += 3)
+ {
+ ChunkTilePos checkPos = pos + ChunkTilePos(face, face + 1, face + 2);
+ _visit(checkPos, mask);
+ }
+ }
+
+ m_floodQueue.pop_front();
+ }
+
+ return mask;
+}
+
+void VisibilityExtimator::setTile(const TilePos& pos, const Tile* t)
+{
+ if (t->isSolid())
+ {
+ _atWorld(pos) = TS_OPAQUE;
+ m_emptyTiles--;
+ }
+}
+
+void VisibilityExtimator::start(const RenderChunk& parent)
+{
+ m_origin = parent.m_pos;
+
+ memset(m_tiles, TS_EMPTY, TILES_SIZE);
+ m_emptyTiles = TILES_SIZE;
+}
+
+VisibilityNode VisibilityExtimator::finish()
+{
+ if (isAllEmpty())
+ return VisibilityNode(true);
+
+ VisibilityNode node(false);
+
+ ChunkTilePos p;
+ for (; p.x <= 15; p.x++)
+ {
+ for (; p.z <= 15; p.z++)
+ {
+ for (; p.y <= 15; p.y++)
+ {
+ if (_at(p) != TS_EMPTY)
+ continue;
+
+ ByteMask mask = _floodFill(p);
+ if (mask)
+ node.connect(mask);
+ }
+ }
+ }
+
+ return node;
+}
diff --git a/source/client/renderer/VisibilityExtimator.hpp b/source/client/renderer/VisibilityExtimator.hpp
new file mode 100644
index 000000000..e6f631f55
--- /dev/null
+++ b/source/client/renderer/VisibilityExtimator.hpp
@@ -0,0 +1,84 @@
+#pragma once
+
+#include
+
+#include "common/Stopwatch.hpp"
+#include "common/ByteMask.hpp"
+#include "world/level/TilePos.hpp"
+#include "world/level/levelgen/chunk/ChunkTilePos.hpp"
+#include "world/tile/Tile.hpp"
+#include "client/renderer/RenderChunk.hpp"
+
+class VisibilityNode
+{
+protected:
+ ByteMask m_visibility[Facing::MAX];
+
+public:
+ VisibilityNode(bool empty);
+ void setEmpty();
+ void setOpaque();
+ void connect(const ByteMask& group);
+ void connect(uint8_t A, const ByteMask& connected);
+ void connect(uint8_t A, uint8_t B);
+ const ByteMask& from(uint8_t facing) const
+ {
+ return m_visibility[facing];
+ }
+ bool compare(VisibilityNode& other) const;
+};
+
+class VisibilityExtimator
+{
+protected:
+ static const int TILES_SIZE = 4096;
+ static const int TILE_COUNT_EMPTY_THRESHOLD = 3840;
+
+protected:
+ enum TileState : int8_t
+ {
+ TS_EMPTY,
+ TS_OPAQUE,
+ TS_EMPTY_MARKED
+ };
+
+public:
+ // TODO
+ //static ThreadLocal pool;
+
+public:
+#ifdef _DEBUG
+ Stopwatch m_timer;
+#endif
+protected:
+ TilePos m_origin;
+ int m_emptyTiles;
+ TileState m_tiles[TILES_SIZE];
+ std::deque m_floodQueue;
+
+public:
+ VisibilityExtimator()
+ : m_origin(),
+ m_emptyTiles(0),
+ m_tiles()
+ {
+ }
+public:
+ void start(const RenderChunk& parent);
+ void setTile(const TilePos& pos, const Tile* t);
+ bool isAllOpaque() const
+ {
+ return m_emptyTiles == 0;
+ }
+ bool isAllEmpty() const
+ {
+ return m_emptyTiles >= TILE_COUNT_EMPTY_THRESHOLD;
+ }
+ VisibilityNode finish();
+protected:
+ TileState* _at(const ChunkTilePos& pos, ByteMask& set);
+ TileState& _at(const ChunkTilePos& p);
+ TileState& _atWorld(const TilePos& t);
+ void _visit(const ChunkTilePos& p, ByteMask& set);
+ ByteMask _floodFill(const ChunkTilePos& startPos);
+};
diff --git a/source/common/ByteMask.hpp b/source/common/ByteMask.hpp
new file mode 100644
index 000000000..4f836f297
--- /dev/null
+++ b/source/common/ByteMask.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include
+
+class ByteMask
+{
+protected:
+ uint8_t mask;
+
+public:
+ ByteMask()
+ : mask(0)
+ {
+ }
+public:
+ void setEmpty()
+ {
+ mask = 0;
+ }
+ void setFull()
+ {
+ mask = 0xFF;
+ }
+ void add(const uint8_t bit)
+ {
+ mask |= bit;
+ }
+ bool contains(const uint8_t bit) const
+ {
+ return (mask & bit) != 0;
+ }
+ operator bool() const
+ {
+ return mask != 0;
+ }
+ uint8_t toByte() const
+ {
+ return mask;
+ }
+};
diff --git a/source/common/Stopwatch.cpp b/source/common/Stopwatch.cpp
new file mode 100644
index 000000000..2375b7dcb
--- /dev/null
+++ b/source/common/Stopwatch.cpp
@@ -0,0 +1,94 @@
+#include
+
+#include "Stopwatch.hpp"
+#include "Utils.hpp"
+#include "Logger.hpp"
+
+Stopwatch::Stopwatch()
+ : m_last(0.0),
+ m_count(0),
+ m_printcounter(0)
+{
+ reset();
+}
+
+Stopwatch::~Stopwatch()
+{
+}
+
+void Stopwatch::start()
+{
+ m_st = getTimeS();
+}
+
+double Stopwatch::stop()
+{
+ if (isReset())
+ return 0.0;
+
+ double time = getTimeS();
+ double diff = time - m_st;
+
+ m_last = diff;
+ if (diff > m_max)
+ m_max = diff;
+
+ m_count++;
+ m_st = -1.0;
+ m_tt += diff;
+ return m_tt;
+}
+
+double Stopwatch::stopContinue()
+{
+ if (isReset())
+ return 0.0;
+
+ double time = getTimeS();
+ double diff = time - m_st;
+
+ m_last = diff;
+ if (diff > m_max)
+ m_max = diff;
+
+ m_count++;
+ m_st = time;
+ m_tt += diff;
+ return m_tt;
+}
+
+double Stopwatch::tick() const
+{
+ if (isReset())
+ return 0.0;
+
+ double time = getTimeS();
+ double diff = time - m_st;
+
+ return diff;
+}
+
+void Stopwatch::reset()
+{
+ m_tt = 0.0;
+ m_max = 0.0;
+ m_st = -1.0;
+}
+
+void Stopwatch::print(const std::string& prepend)
+{
+ LOG_I("%s\tTime (AVGms/LTs(MAXs)/TTs, C) : %f/%f(%f)/%f, %d", prepend.c_str(), (m_tt * 1000.0) / m_count, m_last, m_max, m_tt, m_count);
+}
+
+void Stopwatch::printEvery(int n, const std::string& prepend)
+{
+ if ((m_printcounter + 1) >= n)
+ {
+ m_printcounter = 0;
+ print(prepend);
+ }
+ else
+ {
+ m_printcounter += 1;
+ }
+}
diff --git a/source/common/Stopwatch.hpp b/source/common/Stopwatch.hpp
new file mode 100644
index 000000000..9ccea2972
--- /dev/null
+++ b/source/common/Stopwatch.hpp
@@ -0,0 +1,45 @@
+#pragma once
+#include
+
+class Stopwatch
+{
+private:
+ double m_st;
+ double m_tt;
+ double m_last;
+ double m_max;
+ int m_count;
+ int m_printcounter;
+
+public:
+ Stopwatch();
+ virtual ~Stopwatch();
+public:
+ void start();
+ virtual double stop();
+ virtual double stopContinue();
+ double getLast() const
+ {
+ return m_last;
+ }
+ double getTotal() const
+ {
+ return m_tt;
+ }
+ double getMax() const
+ {
+ return m_max;
+ }
+ int getCount() const
+ {
+ return m_count;
+ }
+ double tick() const;
+ bool isReset() const
+ {
+ return m_st == -1.0;
+ }
+ void reset();
+ void printEvery(int n, const std::string& prepend);
+ virtual void print(const std::string& prepend);
+};
diff --git a/source/world/Facing.cpp b/source/world/Facing.cpp
new file mode 100644
index 000000000..b7688893a
--- /dev/null
+++ b/source/world/Facing.cpp
@@ -0,0 +1,10 @@
+#include "world/Facing.hpp"
+
+Facing::Name Facing::DIRECTIONS[Facing::MAX] = {
+ Facing::DOWN,
+ Facing::UP,
+ Facing::NORTH,
+ Facing::SOUTH,
+ Facing::WEST,
+ Facing::EAST
+};
diff --git a/source/world/Facing.hpp b/source/world/Facing.hpp
index 740f1ce37..2458cf742 100644
--- a/source/world/Facing.hpp
+++ b/source/world/Facing.hpp
@@ -1,15 +1,20 @@
#pragma once
+#include
class Facing
{
public:
- enum Name
+ enum Name : uint8_t
{
DOWN, // -Y
UP, // +Y
NORTH, // -Z
SOUTH, // +Z
WEST, // -X
- EAST // +X
+ EAST, // +X
+ MAX
};
+
+public:
+ static Name DIRECTIONS[MAX];
};
diff --git a/source/world/level/levelgen/chunk/ChunkTilePos.hpp b/source/world/level/levelgen/chunk/ChunkTilePos.hpp
index 923a430f3..ea7ff510e 100644
--- a/source/world/level/levelgen/chunk/ChunkTilePos.hpp
+++ b/source/world/level/levelgen/chunk/ChunkTilePos.hpp
@@ -15,6 +15,11 @@ struct ChunkTilePos
ChunkTilePos(uint8_t _x, uint8_t _y, uint8_t _z) { _init(_x, _y, _z); }
ChunkTilePos(const TilePos& pos) { _init(pos.x & 0xF, pos.y, pos.z & 0xF); } // & 0xF on x and y to get them to uint8_t
+ ChunkTilePos operator+(const ChunkTilePos& other) const
+ {
+ return ChunkTilePos(x + other.x, y + other.y, z + other.z);
+ }
+
ChunkTilePos operator+(const TilePos& other) const
{
return ChunkTilePos(x + other.x, y + other.y, z + other.z);
diff --git a/source/world/tile/Tile.hpp b/source/world/tile/Tile.hpp
index aad6af4c2..312466da9 100644
--- a/source/world/tile/Tile.hpp
+++ b/source/world/tile/Tile.hpp
@@ -139,6 +139,11 @@ class Tile
bool containsY(const Vec3&);
bool containsZ(const Vec3&);
+ bool isSolid() const
+ {
+ return solid[m_ID];
+ }
+
public: // static functions
static void initTiles();
static void teardownTiles();
From 76f8fcc149173c7246d4c8086951a9cec761d886 Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:04:03 +0000
Subject: [PATCH 2/6] Update CMakeLists.txt
---
source/CMakeLists.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index c41a4aee5..a60fb33ce 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -12,6 +12,7 @@ add_library(reminecraftpe-core STATIC
common/Random.cpp
common/SmoothFloat.cpp
common/Timer.cpp
+ common/Stopwatch.cpp
common/Util.cpp
common/utility/AlignmentHelper.cpp
common/utility/JsonParser.cpp
@@ -55,6 +56,7 @@ add_library(reminecraftpe-core STATIC
client/renderer/renderer/RenderMaterialGroup.cpp
client/renderer/renderer/ShaderGroup.cpp
client/renderer/renderer/Tesselator.cpp
+ client/renderer/renderer/VisibilityExtimator.cpp
client/renderer/texture/ImageData.cpp
client/renderer/texture/TextureData.cpp
client/renderer/RenderList.cpp
@@ -424,6 +426,7 @@ add_library(reminecraftpe-core STATIC
world/tile/Web.cpp
world/tile/FenceTile.cpp
world/tile/CraftingTableTile.cpp
+ world/Facing.cpp
renderer/GL/GL.cpp
renderer/Attribute.cpp
renderer/ConstantBufferMetaData.cpp
From 988740f2306dd1295cbf42f0efe8632d6633d4bb Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:14:36 +0000
Subject: [PATCH 3/6] Remove enum types
---
source/client/renderer/VisibilityExtimator.cpp | 10 +++++-----
source/client/renderer/VisibilityExtimator.hpp | 10 +++++-----
source/world/Facing.hpp | 3 +--
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/source/client/renderer/VisibilityExtimator.cpp b/source/client/renderer/VisibilityExtimator.cpp
index c36abd17b..f32ef7dc8 100644
--- a/source/client/renderer/VisibilityExtimator.cpp
+++ b/source/client/renderer/VisibilityExtimator.cpp
@@ -55,19 +55,19 @@ void VisibilityNode::connect(uint8_t A, uint8_t B)
}
}
-VisibilityExtimator::TileState& VisibilityExtimator::_at(const ChunkTilePos& p)
+uint8_t& VisibilityExtimator::_at(const ChunkTilePos& p)
{
size_t index = p.y + (p.x << 8) + (p.z << 4);
assert(index < TILES_SIZE);
return m_tiles[index];
}
-VisibilityExtimator::TileState& VisibilityExtimator::_atWorld(const TilePos& t)
+uint8_t& VisibilityExtimator::_atWorld(const TilePos& t)
{
return _at(t - m_origin);
}
-VisibilityExtimator::TileState* VisibilityExtimator::_at(const ChunkTilePos& pos, ByteMask& set)
+uint8_t* VisibilityExtimator::_at(const ChunkTilePos& pos, ByteMask& set)
{
if (pos.x > 128)
{
@@ -103,7 +103,7 @@ VisibilityExtimator::TileState* VisibilityExtimator::_at(const ChunkTilePos& pos
void VisibilityExtimator::_visit(const ChunkTilePos& p, ByteMask& set)
{
- TileState* tileState = _at(p, set);
+ uint8_t* tileState = _at(p, set);
if (tileState && *tileState == TS_EMPTY)
{
m_floodQueue.push_back(p);
@@ -120,7 +120,7 @@ ByteMask VisibilityExtimator::_floodFill(const ChunkTilePos& startPos)
{
const ChunkTilePos& pos = m_floodQueue.front();
- TileState& tileState = _at(pos);
+ uint8_t& tileState = _at(pos);
if (tileState == TS_EMPTY)
{
tileState = TS_EMPTY_MARKED;
diff --git a/source/client/renderer/VisibilityExtimator.hpp b/source/client/renderer/VisibilityExtimator.hpp
index e6f631f55..df4949059 100644
--- a/source/client/renderer/VisibilityExtimator.hpp
+++ b/source/client/renderer/VisibilityExtimator.hpp
@@ -35,7 +35,7 @@ class VisibilityExtimator
static const int TILE_COUNT_EMPTY_THRESHOLD = 3840;
protected:
- enum TileState : int8_t
+ enum TileState
{
TS_EMPTY,
TS_OPAQUE,
@@ -53,7 +53,7 @@ class VisibilityExtimator
protected:
TilePos m_origin;
int m_emptyTiles;
- TileState m_tiles[TILES_SIZE];
+ uint8_t m_tiles[TILES_SIZE];
std::deque m_floodQueue;
public:
@@ -76,9 +76,9 @@ class VisibilityExtimator
}
VisibilityNode finish();
protected:
- TileState* _at(const ChunkTilePos& pos, ByteMask& set);
- TileState& _at(const ChunkTilePos& p);
- TileState& _atWorld(const TilePos& t);
+ uint8_t* _at(const ChunkTilePos& pos, ByteMask& set);
+ uint8_t& _at(const ChunkTilePos& p);
+ uint8_t& _atWorld(const TilePos& t);
void _visit(const ChunkTilePos& p, ByteMask& set);
ByteMask _floodFill(const ChunkTilePos& startPos);
};
diff --git a/source/world/Facing.hpp b/source/world/Facing.hpp
index 2458cf742..fb2873495 100644
--- a/source/world/Facing.hpp
+++ b/source/world/Facing.hpp
@@ -1,10 +1,9 @@
#pragma once
-#include
class Facing
{
public:
- enum Name : uint8_t
+ enum Name
{
DOWN, // -Y
UP, // +Y
From cd327966bed87c62a802460b96e283b0514fcb2c Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:17:21 +0000
Subject: [PATCH 4/6] Update CMakeLists.txt
---
source/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index a60fb33ce..0824e8010 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -56,7 +56,6 @@ add_library(reminecraftpe-core STATIC
client/renderer/renderer/RenderMaterialGroup.cpp
client/renderer/renderer/ShaderGroup.cpp
client/renderer/renderer/Tesselator.cpp
- client/renderer/renderer/VisibilityExtimator.cpp
client/renderer/texture/ImageData.cpp
client/renderer/texture/TextureData.cpp
client/renderer/RenderList.cpp
@@ -83,6 +82,7 @@ add_library(reminecraftpe-core STATIC
client/renderer/FireTexture.cpp
client/renderer/FoliageColor.cpp
client/renderer/GrassColor.cpp
+ client/renderer/VisibilityExtimator.cpp
client/sound/SoundData.cpp
client/sound/SoundPathRepository.cpp
client/sound/SoundStream.cpp
From 2d82efa8a692a84b5e767832777f63a94c7b0651 Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:25:23 +0000
Subject: [PATCH 5/6] Fix switch errors
---
source/world/item/RocketItem.cpp | 1 +
source/world/item/TileItem.cpp | 1 +
source/world/item/TilePlanterItem.cpp | 1 +
source/world/tile/Tile.cpp | 3 +++
source/world/tile/TorchTile.cpp | 3 +++
5 files changed, 9 insertions(+)
diff --git a/source/world/item/RocketItem.cpp b/source/world/item/RocketItem.cpp
index 978973136..5e8590d12 100644
--- a/source/world/item/RocketItem.cpp
+++ b/source/world/item/RocketItem.cpp
@@ -31,6 +31,7 @@ bool RocketItem::useOn(ItemStack* inst, Player* player, Level* level, const Tile
case Facing::SOUTH: tp.z++; break;
case Facing::WEST: tp.x--; break;
case Facing::EAST: tp.x++; break;
+ default: assert(false); return false; break;
}
level->addEntity(new Rocket(level, tp + 0.5f));
diff --git a/source/world/item/TileItem.cpp b/source/world/item/TileItem.cpp
index 0cf37e19c..45827d41d 100644
--- a/source/world/item/TileItem.cpp
+++ b/source/world/item/TileItem.cpp
@@ -43,6 +43,7 @@ bool TileItem::useOn(ItemStack* instance, Player* player, Level* level, const Ti
case Facing::SOUTH: tp.z++; break;
case Facing::WEST: tp.x--; break;
case Facing::EAST: tp.x++; break;
+ default: assert(false); return false; break;
}
if (instance->m_count == 0)
diff --git a/source/world/item/TilePlanterItem.cpp b/source/world/item/TilePlanterItem.cpp
index b4c7e6679..34f6b0b05 100644
--- a/source/world/item/TilePlanterItem.cpp
+++ b/source/world/item/TilePlanterItem.cpp
@@ -31,6 +31,7 @@ bool TilePlanterItem::useOn(ItemStack* instance, Player* player, Level* level, c
case Facing::SOUTH: tp.z++; break;
case Facing::WEST: tp.x--; break;
case Facing::EAST: tp.x++; break;
+ default: assert(false); return false; break;
}
if (!instance->m_count)
diff --git a/source/world/tile/Tile.cpp b/source/world/tile/Tile.cpp
index 7c5646745..95dfc8318 100644
--- a/source/world/tile/Tile.cpp
+++ b/source/world/tile/Tile.cpp
@@ -909,6 +909,9 @@ bool Tile::shouldRenderFace(const LevelSource* pSrc, const TilePos& pos, Facing:
case Facing::UP:
if (m_aabb.max.y < 1.0f) return true;
break;
+ default:
+ assert(false);
+ return false;
}
Tile* pTile = Tile::tiles[pSrc->getTile(pos)];
diff --git a/source/world/tile/TorchTile.cpp b/source/world/tile/TorchTile.cpp
index c423097e9..ebb26c454 100644
--- a/source/world/tile/TorchTile.cpp
+++ b/source/world/tile/TorchTile.cpp
@@ -183,6 +183,9 @@ void TorchTile::setPlacedOnFace(Level* level, const TilePos& pos, Facing::Name f
break;
case Facing::DOWN:
break;
+ default:
+ assert(false);
+ return;
}
level->setData(pos, data);
From da9b662b57c040675ef166ceeaf8fcc654712b8f Mon Sep 17 00:00:00 2001
From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com>
Date: Fri, 13 Feb 2026 23:31:20 +0000
Subject: [PATCH 6/6] Add assertion to VisibilityNode::from
---
source/client/renderer/VisibilityExtimator.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/source/client/renderer/VisibilityExtimator.hpp b/source/client/renderer/VisibilityExtimator.hpp
index df4949059..11243cf11 100644
--- a/source/client/renderer/VisibilityExtimator.hpp
+++ b/source/client/renderer/VisibilityExtimator.hpp
@@ -23,6 +23,7 @@ class VisibilityNode
void connect(uint8_t A, uint8_t B);
const ByteMask& from(uint8_t facing) const
{
+ assert(facing < Facing::MAX);
return m_visibility[facing];
}
bool compare(VisibilityNode& other) const;