class ShadowAtlas

This class manages the shadow atlas. It handles finding and reserving space for new shadow maps.

Inheritance diagram

Inheritance diagram of ShadowAtlas

ShadowAtlas(std::size_t size, std::size_t tile_size = 32)
ShadowAtlas(ShadowAtlas const&) = default

This constructs a new shadow atlas with the given size and tile size.

The size determines the total size of the atlas in pixels. It should be a power-of-two to favour the GPU.

The tile_size determines the smallest unit of tiles the atlas can store. If, for example, a tile_size of 32 is used, then every entry stored must have a resolution of 32 or greater, and the resolution must be a multiple of 32. This is to optimize the search in the atlas, so the atlas does not have to check every pixel, and instead can just check whole tiles.

If you want to disable the use of tiles, set the tile_size to 1, which will make the shadow atlas use pixels instead of tiles.

float get_coverage(void) const

This returns in percentage from 0 to 1 how much space of the atlas is used right now. A value of 1 means the atlas is completely full, whereas a value of 0 means the atlas is completely free.

int get_num_used_tiles(void) const

Returns the amount of used tiles in the atlas