diff options
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. |