make chunk lightmap optional

This commit is contained in:
MihailRis
2025-11-23 15:22:18 +03:00
parent 64f7c19766
commit 5250c748be
12 changed files with 103 additions and 73 deletions
+2 -10
View File
@@ -8,7 +8,8 @@
#include "util/data_io.hpp"
#include "voxel.hpp"
Chunk::Chunk(int xpos, int zpos) : x(xpos), z(zpos) {
Chunk::Chunk(int xpos, int zpos, std::shared_ptr<Lightmap> lightmap)
: x(xpos), z(zpos), lightmap(std::move(lightmap)) {
bottom = 0;
top = CHUNK_H;
}
@@ -56,15 +57,6 @@ std::shared_ptr<Inventory> Chunk::getBlockInventory(uint x, uint y, uint z)
return found->second;
}
std::unique_ptr<Chunk> Chunk::clone() const {
auto other = std::make_unique<Chunk>(x, z);
for (uint i = 0; i < CHUNK_VOL; i++) {
other->voxels[i] = voxels[i];
}
other->lightmap.set(&lightmap);
return other;
}
/**
Current chunk format:
- byte-order: little-endian