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

Helper class used in Texture constructors. More...

Public Member Functions

constexpr Size () noexcept=default
 Constructs a null size. More...
 
constexpr Size (int width) noexcept
 Constructs a Size instance with the given width.
 
constexpr Size (int width, int height) noexcept
 Constructs a Size instance with the given width and height.
 
constexpr Size (int width, int height, int depth) noexcept
 Constructs a Size instance with the given width, height and depth.
 
constexpr bool isNull () const noexcept
 This property holds if the Size instance is null. More...
 
constexpr bool isValid () const noexcept
 This property holds if the Size instance is valid. More...
 
constexpr int width () const noexcept
 Returns the width. More...
 
constexpr void setWidth (int w) noexcept
 Sets the width. More...
 
constexpr int height () const
 Returns the height. More...
 
constexpr void setHeight (int h) noexcept
 Sets the height. More...
 
constexpr int depth () const
 Returns the height. More...
 
constexpr void setDepth (int d) noexcept
 Sets the depth. More...
 

Detailed Description

Helper class used in Texture constructors.

This class simplifies construction of the Texture instances by encapsulating 1D, 2D and 3D sizes in a single parameter passed to a constructor.

So, the texture can be created as follows.

auto format = TextureFormat::ARGB8_Unorm;
auto width = 256, height = 256, depth = 256;
auto texture1D = Texture(format, {width}); // create a 1D texture
auto texture2D = Texture(format, {width, heigth}); // create a 2D texture
auto texture3D = Texture(format, {width, heigth, depth}); // create a 3D texture

Or, in a more verbose way

auto texture = Texture(TextureFormat::ARGB8_Unorm, size);

Constructor & Destructor Documentation

◆ Size()

Texture::Size::Size ( )
inlinedefaultnoexcept

Constructs a null size.

See also
isNull(), isValid()

Member Function Documentation

◆ depth()

bool Texture::Size::depth ( ) const
inline

Returns the height.

See also
Texture::Size::width, Texture::Size::heigth

◆ height()

bool Texture::Size::height ( ) const
inline

Returns the height.

See also
Texture::Size::width, Texture::Size::depth

◆ isNull()

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

This property holds if the Size instance is null.

A null instance has zero width, height and depth.

◆ isValid()

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

This property holds if the Size instance is valid.

A valid instance has width, height and depth greater than zero.

◆ setDepth()

void Texture::Size::setDepth ( int  d)
inlinenoexcept

◆ setHeight()

void Texture::Size::setHeight ( int  h)
inlinenoexcept

◆ setWidth()

void Texture::Size::setWidth ( int  w)
inlinenoexcept

◆ width()

bool Texture::Size::width ( ) const
inlinenoexcept