Axis-aligned rectangle packer for expandable square texture atlases.
More...
#include <donut/AtlasPacker.hpp>
|
static constexpr std::size_t | INITIAL_RESOLUTION = InitialResolution |
| The initial resolution that was passed to the InitialResolution template parameter. More...
|
|
static constexpr std::size_t | GROWTH_FACTOR = 2 |
| The factor by which the resolution of the atlas will grow when it needs to make more space for a new rectangle. More...
|
|
static constexpr std::size_t | PADDING = Padding |
| The padding that was passed to the Padding template parameter. More...
|
|
static constexpr float | MINIMUM_ROW_HEIGHT_RATIO = 0.7f |
| The minimum ratio between the height of a new rectangle and the size of an existing row in the atlas for the new rectangle to be considered large enough to deserve a space in that row. More...
|
|
template<std::size_t InitialResolution, std::size_t Padding>
class donut::AtlasPacker< InitialResolution, Padding >
Axis-aligned rectangle packer for expandable square texture atlases.
- Template Parameters
-
InitialResolution | initial width of the square atlas region, in pixels. |
Padding | empty space to reserve between inserted rectangles, in pixels. |
◆ insertRectangle()
template<std::size_t InitialResolution, std::size_t Padding>
Find and reserve a suitable space for a new axis-aligned rectangle to be inserted into the atlas.
- Parameters
-
width | width of the new rectangle, in pixels. |
height | height of the new rectangle, in pixels. |
- Returns
- see InsertRectangleResult.
- Exceptions
-
std::bad_alloc | on allocation failure. |
◆ getResolution()
template<std::size_t InitialResolution, std::size_t Padding>
Get the current required resolution of the atlas.
- Returns
- the width of the square atlas region, in pixels.
◆ INITIAL_RESOLUTION
template<std::size_t InitialResolution, std::size_t Padding>
constexpr std::size_t donut::AtlasPacker< InitialResolution, Padding >::INITIAL_RESOLUTION = InitialResolution |
|
staticconstexpr |
The initial resolution that was passed to the InitialResolution template parameter.
◆ GROWTH_FACTOR
template<std::size_t InitialResolution, std::size_t Padding>
The factor by which the resolution of the atlas will grow when it needs to make more space for a new rectangle.
◆ PADDING
template<std::size_t InitialResolution, std::size_t Padding>
The padding that was passed to the Padding template parameter.
◆ MINIMUM_ROW_HEIGHT_RATIO
template<std::size_t InitialResolution, std::size_t Padding>
constexpr float donut::AtlasPacker< InitialResolution, Padding >::MINIMUM_ROW_HEIGHT_RATIO = 0.7f |
|
staticconstexpr |
The minimum ratio between the height of a new rectangle and the size of an existing row in the atlas for the new rectangle to be considered large enough to deserve a space in that row.
The documentation for this class was generated from the following file: