Dynamic 2D atlas manager. More...
#include <DynamicAtlasManager.hpp>
Classes | |
| struct | Region |
| Structure representing a rectangular region in the atlas. More... | |
Public Member Functions | |
| Region | Allocate (Uint32 Width, Uint32 Height) |
| Allocates a rectangular region in the atlas. | |
| void | Free (Region &&R) |
| Frees a previously allocated region in the atlas. | |
| Uint32 | GetFreeRegionCount () const |
| Returns the number of free regions in the atlas. | |
| Uint32 | GetWidth () const |
| Returns the atlas width. | |
| Uint32 | GetHeight () const |
| Returns the atlas height. | |
| Uint64 | GetTotalFreeArea () const |
| Returns the total free area of the atlas. | |
| bool | IsEmpty () const |
| Checks if the atlas is empty, i.e. if there are no allocated regions. | |
Dynamic 2D atlas manager.
This class manages a 2D atlas of regions. It allows allocating and freeing rectangular regions of the atlas. The regions are represented by the Region structure, which contains the x and y coordinates of the top-left corner, as well as the width and height of the region.
| DynamicAtlasManager::Region Diligent::DynamicAtlasManager::Allocate | ( | Uint32 | Width, |
| Uint32 | Height ) |
Allocates a rectangular region in the atlas.
| Width | - Width of the region to allocate. |
| Height | - Height of the region to allocate. |
If the requested region cannot be allocated, an empty region is returned.
| void Diligent::DynamicAtlasManager::Free | ( | Region && | R | ) |
Frees a previously allocated region in the atlas.
| R | - The region to free. |
|
inline |
Returns the total free area of the atlas.
The total free area is the sum of the areas of all free regions in the atlas, and thus may be fragmented.