diff options
author | Mattes D <github@xoft.cz> | 2020-04-03 08:57:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 08:57:01 +0200 |
commit | 01b8ed5295875262a91b60af878bf2a18c1b7aae (patch) | |
tree | 52171974791a7529a3a69f9fe20d906158765954 /src/LightingThread.cpp | |
parent | Update Core (diff) | |
download | cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.gz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.bz2 cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.lz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.xz cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.tar.zst cuberite-01b8ed5295875262a91b60af878bf2a18c1b7aae.zip |
Diffstat (limited to 'src/LightingThread.cpp')
-rw-r--r-- | src/LightingThread.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp index 53f6b2d86..426de86ac 100644 --- a/src/LightingThread.cpp +++ b/src/LightingThread.cpp @@ -7,6 +7,7 @@ #include "LightingThread.h" #include "ChunkMap.h" #include "World.h" +#include "BlockInfo.h" @@ -541,6 +542,33 @@ void cLightingThread::CompressLight(NIBBLETYPE * a_LightArray, NIBBLETYPE * a_Ch +void cLightingThread::PropagateLight( + NIBBLETYPE * a_Light, + unsigned int a_SrcIdx, unsigned int a_DstIdx, + size_t & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut +) +{ + ASSERT(a_SrcIdx < ARRAYCOUNT(m_SkyLight)); + ASSERT(a_DstIdx < ARRAYCOUNT(m_BlockTypes)); + + if (a_Light[a_SrcIdx] <= a_Light[a_DstIdx] + cBlockInfo::GetSpreadLightFalloff(m_BlockTypes[a_DstIdx])) + { + // We're not offering more light than the dest block already has + return; + } + + a_Light[a_DstIdx] = a_Light[a_SrcIdx] - cBlockInfo::GetSpreadLightFalloff(m_BlockTypes[a_DstIdx]); + if (!a_IsSeedOut[a_DstIdx]) + { + a_IsSeedOut[a_DstIdx] = true; + a_SeedIdxOut[a_NumSeedsOut++] = a_DstIdx; + } +} + + + + + void cLightingThread::QueueChunkStay(cLightingChunkStay & a_ChunkStay) { // Move the ChunkStay from the Pending queue to the lighting queue. |