mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
move Lighting instance to ChunksController
This commit is contained in:
parent
c5049d0e24
commit
b7664b4188
14 changed files with 60 additions and 61 deletions
|
|
@ -25,7 +25,7 @@ const uint MIN_SURROUNDING = 9;
|
|||
ChunksController::ChunksController(Level& level, uint padding)
|
||||
: level(level),
|
||||
chunks(*level.chunks),
|
||||
lighting(*level.lighting),
|
||||
lighting(std::make_unique<Lighting>(level.content, level.chunks.get())),
|
||||
padding(padding),
|
||||
generator(std::make_unique<WorldGenerator>(
|
||||
level.content->generators.require(level.getWorld()->getGenerator()),
|
||||
|
|
@ -107,9 +107,9 @@ bool ChunksController::buildLights(const std::shared_ptr<Chunk>& chunk) {
|
|||
if (surrounding == MIN_SURROUNDING) {
|
||||
bool lightsCache = chunk->flags.loadedLights;
|
||||
if (!lightsCache) {
|
||||
lighting.buildSkyLight(chunk->x, chunk->z);
|
||||
lighting->buildSkyLight(chunk->x, chunk->z);
|
||||
}
|
||||
lighting.onChunkLoaded(chunk->x, chunk->z, !lightsCache);
|
||||
lighting->onChunkLoaded(chunk->x, chunk->z, !lightsCache);
|
||||
chunk->flags.lighted = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue