OpenEnroth 0259030
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
AtlasLayout Class Reference

#include <AtlasLayout.h>

Public Member Functions

 AtlasLayout ()=default
 
 AtlasLayout (Sizei gridSize, Sizei cellSize)
 
Recti operator[] (size_t index) const
 
size_t size () const
 
Recti geometry () const
 

Private Attributes

Sizei _gridSize
 
Sizei _cellSize
 

Detailed Description

Describes the layout of a texture atlas as a grid of equally-sized cells.

This class is purely metadata - it doesn't hold any image data. Use it together with a texture to get source rectangles for individual cells.

Constructor & Destructor Documentation

◆ AtlasLayout() [1/2]

AtlasLayout::AtlasLayout ( )
default

◆ AtlasLayout() [2/2]

AtlasLayout::AtlasLayout ( Sizei  gridSize,
Sizei  cellSize 
)
inline
Parameters
gridSizeNumber of columns and rows in the grid.
cellSizeSize of each cell in pixels.

Member Function Documentation

◆ geometry()

Recti AtlasLayout::geometry ( ) const
inline
Returns
Total atlas geometry (bounding rectangle starting at origin).

◆ operator[]()

Recti AtlasLayout::operator[] ( size_t  index) const
inline
Parameters
indexCell index in row-major order.
Returns
Source rectangle for the cell.

◆ size()

size_t AtlasLayout::size ( ) const
inline
Returns
Total number of cells in the atlas.

Member Data Documentation

◆ _cellSize

Sizei AtlasLayout::_cellSize
private

◆ _gridSize

Sizei AtlasLayout::_gridSize
private

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