Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
voxalgo::LightQueue Struct Reference
+ Collaboration diagram for voxalgo::LightQueue:

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.
 

Detailed Description

A fast, priority queue-like container to contain ChangingLights. The ChangingLights are ordered by the given light levels. The brightest ChangingLight is returned first.

Constructor & Destructor Documentation

◆ LightQueue()

voxalgo::LightQueue::LightQueue ( size_t  reserve)
inline

Creates a LightQueue.

Parameters
reservefor each light level that many slots are reserved.

References LIGHT_SUN, lights, and max_light.

Member Function Documentation

◆ clear()

void voxalgo::LightQueue::clear ( )
inline

Clears a LightQueue.

References LIGHT_SUN, lights, and max_light.

Referenced by voxalgo::update_block_border_lighting(), and voxalgo::update_lighting_nodes().

+ Here is the caller graph for this function:

◆ next()

bool voxalgo::LightQueue::next ( u8 &  light,
ChangingLight data 
)
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.

Parameters
lightlight level of the popped ChangingLight
datathe ChangingLight that was popped
Returns
true if there was a ChangingLight in the queue.

References lights, and max_light.

Referenced by voxalgo::spread_light(), and voxalgo::unspread_light().

+ Here is the caller graph for this function:

◆ push()

void voxalgo::LightQueue::push ( u8  light,
relative_v3  rel_pos,
mapblock_v3  block_pos,
MapBlock block,
direction  source_dir 
)
inline

Adds an element to the queue. The parameters are the same as in ChangingLight's constructor.

Parameters
lightlight 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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ lights

std::array<std::vector<ChangingLight>, LIGHT_SUN + 1> voxalgo::LightQueue::lights

◆ max_light

u8 voxalgo::LightQueue::max_light

Light of the brightest ChangingLight in the queue.

Referenced by LightQueue(), clear(), and next().


The documentation for this struct was generated from the following file: