make chunk lightmap optional
This commit is contained in:
@@ -150,7 +150,7 @@ bool ChunksController::buildLights(
|
||||
}
|
||||
}
|
||||
if (surrounding == MIN_SURROUNDING) {
|
||||
if (lighting) {
|
||||
if (lighting && chunk->lightmap) {
|
||||
bool lightsCache = chunk->flags.loadedLights;
|
||||
if (!lightsCache) {
|
||||
lighting->buildSkyLight(chunk->x, chunk->z);
|
||||
@@ -170,7 +170,7 @@ void ChunksController::createChunk(const Player& player, int x, int z) const {
|
||||
}
|
||||
return;
|
||||
}
|
||||
auto chunk = level.chunks->create(x, z);
|
||||
auto chunk = level.chunks->create(x, z, lighting != nullptr);
|
||||
player.chunks->putChunk(chunk);
|
||||
auto& chunkFlags = chunk->flags;
|
||||
if (!chunkFlags.loaded) {
|
||||
@@ -179,7 +179,7 @@ void ChunksController::createChunk(const Player& player, int x, int z) const {
|
||||
}
|
||||
chunk->updateHeights();
|
||||
level.events->trigger(LevelEventType::CHUNK_PRESENT, chunk.get());
|
||||
if (!chunkFlags.loadedLights) {
|
||||
if (!chunkFlags.loadedLights && chunk->lightmap) {
|
||||
Lighting::prebuildSkyLight(*chunk, *level.content.getIndices());
|
||||
}
|
||||
chunkFlags.loaded = true;
|
||||
|
||||
@@ -153,8 +153,10 @@ static void integrate_chunk_client(Chunk& chunk) {
|
||||
|
||||
chunk.flags.loadedLights = false;
|
||||
chunk.flags.lighted = false;
|
||||
chunk.lightmap.clear();
|
||||
Lighting::prebuildSkyLight(chunk, *indices);
|
||||
if (chunk.lightmap) {
|
||||
chunk.lightmap->clear();
|
||||
Lighting::prebuildSkyLight(chunk, *indices);
|
||||
}
|
||||
|
||||
for (int lz = -1; lz <= 1; lz++) {
|
||||
for (int lx = -1; lx <= 1; lx++) {
|
||||
|
||||
Reference in New Issue
Block a user