62 void QueueChunk(
int a_ChunkX,
int a_ChunkZ, std::unique_ptr<cChunkCoordCallback> a_CallbackAfter);
135 virtual void Execute(
void)
override;
155 size_t a_NumSeedsIn,
unsigned char * a_IsSeedIn,
unsigned int * a_SeedIdxIn,
156 size_t & a_NumSeedsOut,
unsigned char * a_IsSeedOut,
unsigned int * a_SeedIdxOut
164 unsigned int a_SrcIdx,
unsigned int a_DstIdx,
165 size_t & a_NumSeedsOut,
unsigned char * a_IsSeedOut,
unsigned int * a_SeedIdxOut
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char HEIGHTTYPE
The type used by the heightmap.
unsigned char BLOCKTYPE
The datatype used by blockdata.
Makes chunks stay loaded until this object is cleared or destroyed Works by setting internal flags in...
HEIGHTTYPE m_MaxHeight
The highest block in the current 3x3 chunk data.
void CalcLight(NIBBLETYPE *a_Light)
Calculates light in the light array specified, using stored seeds.
void ReadChunks(int a_ChunkX, int a_ChunkZ)
Prepares m_BlockTypes and m_HeightMap data; zeroes out the light arrays.
virtual ~cLightingThread() override
virtual void Execute(void) override
This function, overloaded by the descendants, is called in the new thread.
cChunkStays m_Queue
The ChunkStays that are loaded and are waiting to be lit.
unsigned int m_SeedIdx2[BlocksPerYLayer *cChunkDef::Height]
void PropagateLight(NIBBLETYPE *a_Light, unsigned int a_SrcIdx, unsigned int a_DstIdx, size_t &a_NumSeedsOut, unsigned char *a_IsSeedOut, unsigned int *a_SeedIdxOut)
unsigned char m_IsSeed1[BlocksPerYLayer *cChunkDef::Height]
void CalcLightStep(NIBBLETYPE *a_Light, size_t a_NumSeedsIn, unsigned char *a_IsSeedIn, unsigned int *a_SeedIdxIn, size_t &a_NumSeedsOut, unsigned char *a_IsSeedOut, unsigned int *a_SeedIdxOut)
Does one step in the light calculation - one seed propagation and seed recalculation.
unsigned int m_SeedIdx1[BlocksPerYLayer *cChunkDef::Height]
cChunkStays m_PendingQueue
The ChunkStays that are waiting for load.
void LightChunk(cLightingChunkStay &a_Item)
Lights the entire chunk.
void PrepareSkyLight(void)
Uses m_HeightMap to initialize the m_SkyLight[] data; fills in seeds for the skylight.
NIBBLETYPE m_SkyLight[BlocksPerYLayer *cChunkDef::Height]
void CompressLight(NIBBLETYPE *a_LightArray, NIBBLETYPE *a_ChunkLight)
Compresses from 1-block-per-byte (faster calc) into 2-blocks-per-byte (MC storage):
void WaitForQueueEmpty(void)
Blocks until the queue is empty or the thread is terminated.
size_t GetQueueLength(void)
void QueueChunk(int a_ChunkX, int a_ChunkZ, std::unique_ptr< cChunkCoordCallback > a_CallbackAfter)
Queues the entire chunk for lighting.
cCriticalSection m_CS
The mutex to protect m_Queue and m_PendingQueue.
NIBBLETYPE m_BlockLight[BlocksPerYLayer *cChunkDef::Height]
HEIGHTTYPE m_HeightMap[BlocksPerYLayer]
unsigned char m_IsSeed2[BlocksPerYLayer *cChunkDef::Height]
std::list< cChunkStay * > cChunkStays
BLOCKTYPE m_BlockTypes[BlocksPerYLayer *cChunkDef::Height]
void QueueChunkStay(cLightingChunkStay &a_ChunkStay)
Queues a chunkstay that has all of its chunks loaded.
cLightingThread(cWorld &a_World)
static const int BlocksPerYLayer
void PrepareBlockLight(void)
Uses m_BlockTypes to initialize the m_BlockLight[] data; fills in seeds for the blocklight.
virtual void OnDisabled(void) override
Called by the ChunkMap when the ChunkStay is disabled.
cLightingChunkStay(cLightingThread &a_LightingThread, int a_ChunkX, int a_ChunkZ, std::unique_ptr< cChunkCoordCallback > a_CallbackAfter)
cLightingThread & m_LightingThread
virtual bool OnAllChunksAvailable(void) override
Called once all of the contained chunks are available.
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override
Called when a specific chunk become available.
std::unique_ptr< cChunkCoordCallback > m_CallbackAfter
cIsThread(AString &&a_ThreadName)