diff options
| author | Mel <einebeere@gmail.com> | 2023-07-29 03:31:42 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-07-29 03:31:42 +0200 |
| commit | 6b69d4b5b648253f894707723af0e2eae9f71445 (patch) | |
| tree | 0cd0b6c7b18c30abbb2618f553f144d1d06dacba /src/World/Generation/Lighting.cpp | |
| parent | 2eef7cf49b7a15559ee7bb6719411bcf67386213 (diff) | |
| download | meowcraft-6b69d4b5b648253f894707723af0e2eae9f71445.tar.zst meowcraft-6b69d4b5b648253f894707723af0e2eae9f71445.zip | |
Move chunk reification to worker threads and set stage for chunk-unbound lighting
Diffstat (limited to 'src/World/Generation/Lighting.cpp')
| -rw-r--r-- | src/World/Generation/Lighting.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/World/Generation/Lighting.cpp b/src/World/Generation/Lighting.cpp index 39d8320..f7c7bbf 100644 --- a/src/World/Generation/Lighting.cpp +++ b/src/World/Generation/Lighting.cpp @@ -23,12 +23,12 @@ void Lighting::add_block(Chunk& chunk, Position::BlockLocal position, U8 light) enqueue(chunk.index(), position, light); } -void Lighting::illuminate(ChunkRegistry& chunks) { +void Lighting::illuminate(Chunk& chunk) { while (!m_queue.empty()) { auto op = m_queue.front(); m_queue.pop(); - process(chunks, op); + process(chunk, op); } } @@ -36,10 +36,7 @@ void Lighting::enqueue(ChunkIndex chunk, Position::BlockLocal position, U8 origi m_queue.push({chunk, position, origin}); } -void Lighting::process(ChunkRegistry& chunks, Operation op) { - auto& chunk_data = chunks.get(op.chunk); - auto& chunk = chunk_data.chunk.value(); - +void Lighting::process(Chunk& chunk, Operation op) { for (auto direction : Position::axis_directions) { auto neighbor_pos = op.position.offset(direction); if (!neighbor_pos.fits_within_chunk()) continue; |
