migrate blocks interaction (scripting) to global chunks storage (WIP)

This commit is contained in:
MihailRis
2024-12-13 05:54:41 +03:00
parent 53cc8d3c7b
commit e0b3425eff
16 changed files with 227 additions and 144 deletions
+2 -1
View File
@@ -21,6 +21,7 @@
#include "voxels/Block.hpp"
#include "voxels/Chunk.hpp"
#include "voxels/Chunks.hpp"
#include "voxels/ChunksStorage.hpp"
#include "world/Level.hpp"
#include "world/World.hpp"
@@ -95,7 +96,7 @@ std::shared_ptr<UINode> create_debug_panel(
std::to_wstring(ParticlesRenderer::aliveEmitters);
}));
panel->add(create_label([&]() {
return L"chunks: "+std::to_wstring(level.chunks->getChunksCount())+
return L"chunks: "+std::to_wstring(level.chunksStorage->size())+
L" visible: "+std::to_wstring(ChunksRenderer::visibleChunks);
}));
panel->add(create_label([&]() {
+2 -1
View File
@@ -269,6 +269,7 @@ void Hud::updateHotbarControl() {
void Hud::updateWorldGenDebugVisualization() {
auto& level = frontend.getLevel();
auto& chunks = *level.chunks;
auto generator =
frontend.getController()->getChunksController()->getGenerator();
auto debugInfo = generator->createDebugInfo();
@@ -293,7 +294,7 @@ void Hud::updateWorldGenDebugVisualization() {
int az = z - (height - areaHeight) / 2;
data[(flippedZ * width + x) * 4 + 1] =
level.chunks->getChunk(ax + ox, az + oz) ? 255 : 0;
chunks.getChunk(ax + ox, az + oz) ? 255 : 0;
data[(flippedZ * width + x) * 4 + 0] =
level.chunksStorage->fetch(ax + ox, az + oz) ? 255 : 0;