limit chunks non-unloading zone to a circle

This commit is contained in:
MihailRis
2025-07-13 15:57:57 +03:00
parent b02b454573
commit 15a778299c
6 changed files with 68 additions and 6 deletions
+10 -2
View File
@@ -270,6 +270,7 @@ void Hud::updateHotbarControl() {
void Hud::updateWorldGenDebug() {
auto& level = frontend.getLevel();
const auto& chunks = *player.chunks;
uint padding = engine.getSettings().chunks.padding.get();
auto generator =
frontend.getController()->getChunksController()->getGenerator();
auto debugInfo = generator->createDebugInfo();
@@ -291,8 +292,15 @@ void Hud::updateWorldGenDebug() {
int ax = x - (width - areaWidth) / 2;
int az = z - (height - areaHeight) / 2;
data[(flippedZ * width + x) * 4 + 1] =
chunks.getChunk(ax + ox, az + oz) ? 255 : 0;
bool isInLoadingZone =
frontend.getController()
->getChunksController()
->isInLoadingZone(player, padding, ax + ox, az + oz);
data[(flippedZ * width + x) * 4 + 1] =
chunks.getChunk(ax + ox, az + oz)
? (isInLoadingZone ? 255 : 128)
: 0;
data[(flippedZ * width + x) * 4 + 0] =
level.chunks->fetch(ax + ox, az + oz) ? 255 : 0;