|
libdonut 2.3.6
Application framework for cross-platform game development in C++20
|
Axis-aligned rectangle packer for expandable square texture atlases. More...
#include <donut/AtlasPacker.hpp>
Classes | |
| struct | InsertRectangleResult |
| Result of the insertRectangle() function. More... | |
Public Member Functions | |
| InsertRectangleResult | insertRectangle (std::size_t width, std::size_t height) |
| Find and reserve a suitable space for a new axis-aligned rectangle to be inserted into the atlas. | |
| std::size_t | getResolution () const noexcept |
| Get the current required resolution of the atlas. | |
Static Public Attributes | |
| static constexpr std::size_t | INITIAL_RESOLUTION = InitialResolution |
| The initial resolution that was passed to the InitialResolution template parameter. | |
| 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. | |
| static constexpr std::size_t | PADDING = Padding |
| The padding that was passed to the Padding template parameter. | |
| 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. | |
Axis-aligned rectangle packer for expandable square texture atlases.
| InitialResolution | initial width of the square atlas region, in pixels. |
| Padding | empty space to reserve between inserted rectangles, in pixels. |
|
inline |
Find and reserve a suitable space for a new axis-aligned rectangle to be inserted into the atlas.
| width | width of the new rectangle, in pixels. |
| height | height of the new rectangle, in pixels. |
| std::bad_alloc | on allocation failure. |
|
inlinenoexcept |
Get the current required resolution of the atlas.
|
staticconstexpr |
The initial resolution that was passed to the InitialResolution template parameter.
|
staticconstexpr |
The factor by which the resolution of the atlas will grow when it needs to make more space for a new rectangle.
|
staticconstexpr |
The padding that was passed to the Padding template parameter.
|
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.