Public Member Functions | |
LightQueue (size_t reserve) | |
void | clear () |
Clears a LightQueue. | |
bool | next (u8 &light, ChangingLight &data) |
void | push (u8 light, relative_v3 rel_pos, mapblock_v3 block_pos, MapBlock *block, direction source_dir) |
Public Attributes | |
std::array< std::vector< ChangingLight >, LIGHT_SUN+1 > | lights |
For each light level there is a vector. | |
u8 | max_light |
Light of the brightest ChangingLight in the queue. | |
A fast, priority queue-like container to contain ChangingLights. The ChangingLights are ordered by the given light levels. The brightest ChangingLight is returned first.
|
inline |
Creates a LightQueue.
reserve | for each light level that many slots are reserved. |
|
inline |
Clears a LightQueue.
References LIGHT_SUN, lights, and max_light.
Referenced by voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
|
inline |
Returns the next brightest ChangingLight and removes it from the queue. If there were no elements in the queue, the given parameters remain unmodified.
light | light level of the popped ChangingLight |
data | the ChangingLight that was popped |
References lights, and max_light.
Referenced by voxalgo::spread_light(), and voxalgo::unspread_light().
|
inline |
Adds an element to the queue. The parameters are the same as in ChangingLight's constructor.
light | light level of the ChangingLight |
References LIGHT_SUN, and lights.
Referenced by voxalgo::blit_back_with_light(), voxalgo::finish_bulk_light_update(), voxalgo::propagate_block_sunlight(), voxalgo::repair_block_light(), voxalgo::spread_light(), voxalgo::unspread_light(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
std::array<std::vector<ChangingLight>, LIGHT_SUN + 1> voxalgo::LightQueue::lights |
For each light level there is a vector.
Referenced by LightQueue(), clear(), voxalgo::finish_bulk_light_update(), next(), push(), voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().
u8 voxalgo::LightQueue::max_light |
Light of the brightest ChangingLight in the queue.
Referenced by LightQueue(), clear(), and next().