fix extra lights-related work in world.set_chunk_data
This commit is contained in:
parent
b12982655d
commit
9c8e4e813c
@ -4,6 +4,7 @@
|
|||||||
#include "typedefs.hpp"
|
#include "typedefs.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
inline constexpr int LIGHTMAP_DATA_LEN = CHUNK_VOL/2;
|
inline constexpr int LIGHTMAP_DATA_LEN = CHUNK_VOL/2;
|
||||||
|
|
||||||
@ -17,6 +18,10 @@ public:
|
|||||||
|
|
||||||
void set(const light_t* map);
|
void set(const light_t* map);
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
std::memset(map, 0, sizeof(map));
|
||||||
|
}
|
||||||
|
|
||||||
inline unsigned short get(int x, int y, int z) const {
|
inline unsigned short get(int x, int y, int z) const {
|
||||||
return (map[y*CHUNK_D*CHUNK_W+z*CHUNK_W+x]);
|
return (map[y*CHUNK_D*CHUNK_W+z*CHUNK_W+x]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,12 +148,12 @@ static void integrate_chunk_client(Chunk& chunk) {
|
|||||||
int x = chunk.x;
|
int x = chunk.x;
|
||||||
int z = chunk.z;
|
int z = chunk.z;
|
||||||
auto chunksController = controller->getChunksController();
|
auto chunksController = controller->getChunksController();
|
||||||
|
|
||||||
Lighting& lighting = *chunksController->lighting;
|
Lighting& lighting = *chunksController->lighting;
|
||||||
chunk.flags.loadedLights = false;
|
chunk.flags.loadedLights = false;
|
||||||
chunk.flags.lighted = false;
|
chunk.flags.lighted = false;
|
||||||
|
chunk.lightmap.clear();
|
||||||
Lighting::prebuildSkyLight(chunk, *indices);
|
Lighting::prebuildSkyLight(chunk, *indices);
|
||||||
lighting.onChunkLoaded(x, z, true);
|
|
||||||
|
|
||||||
for (int lz = -1; lz <= 1; lz++) {
|
for (int lz = -1; lz <= 1; lz++) {
|
||||||
for (int lx = -1; lx <= 1; lx++) {
|
for (int lx = -1; lx <= 1; lx++) {
|
||||||
@ -162,7 +162,6 @@ static void integrate_chunk_client(Chunk& chunk) {
|
|||||||
}
|
}
|
||||||
if (auto other = level->chunks->getChunk(x + lx, z + lz)) {
|
if (auto other = level->chunks->getChunk(x + lx, z + lz)) {
|
||||||
other->flags.modified = true;
|
other->flags.modified = true;
|
||||||
lighting.onChunkLoaded(x - 1, z, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user