Class which manages distributing shadow maps in an atlas. More...
Public Member Functions | |
__init__ (const ShadowAtlas) | |
__init__ (int size, int tile_size) | |
Constructs a new shadow atlas. More... | |
float | getCoverage () |
Returns the amount of used tiles in percentage. More... | |
int | getNumUsedTiles () |
Returns the amount of used tiles. More... | |
Public Attributes | |
float | coverage |
Returns the amount of used tiles in percentage. More... | |
int | num_used_tiles |
Returns the amount of used tiles. More... | |
Class which manages distributing shadow maps in an atlas.
This class manages the shadow atlas. It handles finding and reserving space for new shadow maps.
__init__ | ( | const | ShadowAtlas | ) |
__init__ | ( | int | size, |
int | tile_size | ||
) |
Constructs a new shadow atlas.
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.
size | Atlas-size in pixels |
tile_size | tile-size in pixels, or 1 to use no tiles. |
float getCoverage | ( | ) |
Returns the amount of used tiles in percentage.
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 getNumUsedTiles | ( | ) |
Returns the amount of used tiles.
Returns the amount of used tiles in the atlas
float coverage |
Returns the amount of used tiles in percentage.
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 num_used_tiles |
Returns the amount of used tiles.
Returns the amount of used tiles in the atlas