GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::resource::AtlasPacker Class Reference

Axis-aligned rectangle packer for expandable square texture atlases. More...

#include <GREM/resource/AtlasPacker.hpp>

Classes

struct  InsertRectangleResult
 Result of the insertRectangle() function. More...

Public Member Functions

 AtlasPacker () noexcept
 Construct an atlas packer with the default options.
 AtlasPacker (const AtlasPackerOptions &options)
 Construct an atlas packer.
InsertRectangleResult insertRectangle (Extent2D size)
 Find and reserve a suitable space for a new axis-aligned rectangle to be inserted into the atlas.
uint32_t getResolution () const noexcept
 Get the current required resolution of the atlas.

Detailed Description

Axis-aligned rectangle packer for expandable square texture atlases.

Constructor & Destructor Documentation

◆ AtlasPacker() [1/2]

grem::resource::AtlasPacker::AtlasPacker ( )
inlinenoexcept

Construct an atlas packer with the default options.

◆ AtlasPacker() [2/2]

grem::resource::AtlasPacker::AtlasPacker ( const AtlasPackerOptions & options)
inlineexplicit

Construct an atlas packer.

Parameters
optionsatlas packer options, see AtlasPackerOptions.

Member Function Documentation

◆ insertRectangle()

InsertRectangleResult grem::resource::AtlasPacker::insertRectangle ( Extent2D size)
inlinenodiscard

Find and reserve a suitable space for a new axis-aligned rectangle to be inserted into the atlas.

Parameters
sizesize of the new rectangle, in pixels.
Returns
see InsertRectangleResult.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ getResolution()

uint32_t grem::resource::AtlasPacker::getResolution ( ) const
inlinenodiscardnoexcept

Get the current required resolution of the atlas.

Returns
the width of the square atlas region, in pixels.

The documentation for this class was generated from the following file: