mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
make chunk lightmap optional
This commit is contained in:
parent
64f7c19766
commit
5250c748be
12 changed files with 103 additions and 73 deletions
|
|
@ -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++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue