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

Helper class used in Texture constructors. More...

Public Member Functions

constexpr ArraySize () noexcept
 Constructs a null size. More...
 
constexpr ArraySize (int levels, int layers=1) noexcept
 Constructs an ArraySize instance with the given levels and layers.
 
constexpr ArraySize (IsCubemap isCumemap, int levels=1, int layers=1) noexcept
 Constructs an ArraySize instance with the given isCumemap, levels and layers.
 
constexpr bool isNull () const noexcept
 This property holds if the ArraySize instance is null. More...
 
constexpr bool isValid () const noexcept
 This property holds if the ArraySize instance is valid. More...
 
constexpr int faces () const noexcept
 Return the faces count.
 
constexpr int levels () const noexcept
 Returns the levels count.
 
constexpr void setLevels (int levels) noexcept
 Sets the levels count.
 
constexpr int layers () const noexcept
 Returns the layers count.
 
constexpr void setLayers (int layers) noexcept
 Sets the layers count.
 

Detailed Description

Helper class used in Texture constructors.

This class simplifies construction of the Texture instances by encapsulating levels, layers and faces dimensions in a single parameter passed to a constructor.

So, the texture can be created as follows.

auto format = TextureFormat::ARGB8_Unorm;
auto size = Texture::Size(256, 256);
auto levels = 8, layers = 10;
auto mipmaps = Texture(format, size, {levels});
auto array = Texture(format, size, {1, layers});
auto mipmapsAndArray = Texture(format, size, {levels, layers});

Constructor & Destructor Documentation

◆ ArraySize()

Texture::ArraySize::ArraySize ( )
inlinenoexcept

Constructs a null size.

See also
isNull(), isValid()

Member Function Documentation

◆ isNull()

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

This property holds if the ArraySize instance is null.

A null instance has zero faces, levels and layers.

◆ isValid()

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

This property holds if the ArraySize instance is valid.

A valid instance has faces, levels and layers greater than zero.