Simple rectangle packer for atlas allocation.
More...
#include <texture_atlas.hpp>
|
| | AtlasPacker (int width, int height) |
| bool | allocate (int w, int h, Region &out) |
| | Try to allocate a region of the given size. Returns false if full.
|
| void | reset () |
| int | width () const |
| int | height () const |
| std::size_t | capacity () const |
| | Area of the atlas surface (width × height), in texels.
|
| std::size_t | used_area () const |
| | Texels consumed by the shelf allocator so far.
|
| float | occupancy () const |
| | Fraction of the atlas the shelf allocator has consumed, in [0, 1].
|
Simple rectangle packer for atlas allocation.
Uses a shelf-based algorithm (row-by-row packing).
◆ AtlasPacker()
| pulp::render::AtlasPacker::AtlasPacker |
( |
int | width, |
|
|
int | height ) |
|
inlineexplicit |
◆ allocate()
| bool pulp::render::AtlasPacker::allocate |
( |
int | w, |
|
|
int | h, |
|
|
Region & | out ) |
Try to allocate a region of the given size. Returns false if full.
◆ capacity()
| std::size_t pulp::render::AtlasPacker::capacity |
( |
| ) |
const |
|
inline |
Area of the atlas surface (width × height), in texels.
Read-only introspection — used by the inspector's atlas viewer.
◆ height()
| int pulp::render::AtlasPacker::height |
( |
| ) |
const |
|
inline |
◆ occupancy()
| float pulp::render::AtlasPacker::occupancy |
( |
| ) |
const |
|
inline |
Fraction of the atlas the shelf allocator has consumed, in [0, 1].
Returns 0 for a degenerate (zero-area) atlas.
◆ reset()
| void pulp::render::AtlasPacker::reset |
( |
| ) |
|
|
inline |
◆ used_area()
| std::size_t pulp::render::AtlasPacker::used_area |
( |
| ) |
const |
|
inline |
Texels consumed by the shelf allocator so far.
This is the shelf-packed footprint — every completed shelf counts its full height across the atlas width, plus the in-progress shelf counts up to its current write cursor. It is an upper bound on the live pixel area (shelf packing leaves gaps), which is exactly the number that answers "how close is this atlas to full?".
◆ width()
| int pulp::render::AtlasPacker::width |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following file: