Texture Viewer
Public Member Functions | List of all members
Texture::ArrayIndex Class Reference

Helper class used in Texture::imageData() function. More...

Public Member Functions

constexpr ArrayIndex (int level=0, int layer=0) noexcept
 Constructs an ArrayIndex instance with the given level and layer.
 
constexpr ArrayIndex (Side side, int level=0, int layer=0) noexcept
 Constructs an ArrayIndex instance with the given side, level and layer. More...
 
constexpr bool isNull () const noexcept
 Returns true if the ArrayIndex instance is null. More...
 
constexpr bool isValid () const noexcept
 Returns true if the ArrayIndex instance is valid. More...
 
constexpr Side side () const noexcept
 Returns the side.
 
constexpr void setSide (Side side) noexcept
 Sets the side.
 
constexpr int face () const
 Returns the face.
 
constexpr int level () const noexcept
 Returns the level.
 
constexpr void setLevel (int level) noexcept
 Sets the level.
 
constexpr int layer () const noexcept
 Returns the layer.
 
constexpr void setLayer (int layer) noexcept
 Sets the layer.
 

Detailed Description

Helper class used in Texture::imageData() function.

This class simplifies access to the raw data of the texture by encapsulating level, layer and face dimensions in a single parameter. This allows to have only 2 overloads of the Texture::imageData() function.

Constructor & Destructor Documentation

◆ ArrayIndex()

Texture::ArrayIndex::ArrayIndex ( Texture::Side  side,
int  level = 0,
int  layer = 0 
)
inlinenoexcept

Constructs an ArrayIndex instance with the given side, level and layer.

Passing side that is out of Texture::Side enum results to undefined behavior.

Member Function Documentation

◆ isNull()

bool Texture::ArrayIndex::isNull ( ) const
inlinenoexcept

Returns true if the ArrayIndex instance is null.

A null instance has zero face, level and layer.

◆ isValid()

bool Texture::ArrayIndex::isValid ( ) const
inlinenoexcept

Returns true if the ArrayIndex instance is valid.

A valid instance has face, level and layer greater than or equal to zero.