GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::Extent< 3 > Struct Reference

#include <GREM/core/extents.hpp>

Public Member Functions

constexpr operator Offset< 3 > () const noexcept
 Convert this extent to an offset.
constexpr operator vec3 () const noexcept
 Convert this extent to a floating-point 3D vector.
constexpr operator dvec3 () const noexcept
 Convert this extent to a double-precision floating-point 3D vector.
constexpr operator ivec3 () const noexcept
 Convert this extent to an integer 3D vector.
constexpr operator u32vec3 () const noexcept
 Convert this extent to an unsigned integer 3D vector.
constexpr bool operator== (const Extent< 3 > &other) const =default
 Compare this extent to another for equality.
uint32_t fitIntegerScaled (Extent targetSize)
 Fit the extents into a target size at the largest positive integer scale of its original size that still fits within the target.

Static Public Member Functions

static constexpr Extent< 3 > from (u32vec3 v) noexcept
 Create an extent from a vector of integers.
static Extent< 3 > round (vec3 v)
 Create an extent from a vector of floating-point numbers, rounded to their nearest integer values before conversion.
static Extent< 3 > floor (vec3 v)
 Create an extent from a vector of floating-point numbers, rounded down to their floor integer values before conversion.
static Extent< 3 > ceil (vec3 v)
 Create an extent from a vector of floating-point numbers, rounded up to their ceiling integer values before conversion.
static Extent< 3 > trunc (vec3 v)
 Create an extent from a vector of floating-point numbers, rounded to their truncated integer values before conversion.

Public Attributes

uint32_t width
 Horizontal extent.
uint32_t height = width
 Vertical extent.
uint32_t depth = 1
 Number of layers.

Member Function Documentation

◆ from()

constexpr Extent< 3 > grem::Extent< 3 >::from ( u32vec3 v)
inlinestaticnodiscardconstexprnoexcept

Create an extent from a vector of integers.

Parameters
vvector to convert.
Returns
the corresponding extent.

◆ round()

Extent< 3 > grem::Extent< 3 >::round ( vec3 v)
inlinestaticnodiscard

Create an extent from a vector of floating-point numbers, rounded to their nearest integer values before conversion.

Parameters
vvector to convert.
Returns
the rounded extent.

◆ floor()

Extent< 3 > grem::Extent< 3 >::floor ( vec3 v)
inlinestaticnodiscard

Create an extent from a vector of floating-point numbers, rounded down to their floor integer values before conversion.

Parameters
vvector to convert.
Returns
the floor-rounded extent.

◆ ceil()

Extent< 3 > grem::Extent< 3 >::ceil ( vec3 v)
inlinestaticnodiscard

Create an extent from a vector of floating-point numbers, rounded up to their ceiling integer values before conversion.

Parameters
vvector to convert.
Returns
the ceiling-rounded extent.

◆ trunc()

Extent< 3 > grem::Extent< 3 >::trunc ( vec3 v)
inlinestaticnodiscard

Create an extent from a vector of floating-point numbers, rounded to their truncated integer values before conversion.

Parameters
vvector to convert.
Returns
the truncated extent.

◆ operator Offset< 3 >()

grem::Extent< 3 >::operator Offset< 3 > ( ) const
inlineexplicitconstexprnoexcept

Convert this extent to an offset.

Returns
an offset with the width, height and depth of the extent as its x, y and z components, respectively.

◆ operator vec3()

grem::Extent< 3 >::operator vec3 ( ) const
inlineconstexprnoexcept

Convert this extent to a floating-point 3D vector.

Returns
a 3D vector holding the width, height and depth of the extent in its x, y and z components, respectively.

◆ operator dvec3()

grem::Extent< 3 >::operator dvec3 ( ) const
inlineconstexprnoexcept

Convert this extent to a double-precision floating-point 3D vector.

Returns
a 3D vector holding the width, height and depth of the extent in its x, y and z components, respectively.

◆ operator ivec3()

grem::Extent< 3 >::operator ivec3 ( ) const
inlineconstexprnoexcept

Convert this extent to an integer 3D vector.

Returns
a 3D vector holding the width, height and depth of the extent in its x, y and z components, respectively.

◆ operator u32vec3()

grem::Extent< 3 >::operator u32vec3 ( ) const
inlineconstexprnoexcept

Convert this extent to an unsigned integer 3D vector.

Returns
a 3D vector holding the width, height and depth of the extent in its x, y and z components, respectively.

◆ operator==()

bool grem::Extent< 3 >::operator== ( const Extent< 3 > & other) const
nodiscardconstexprdefault

Compare this extent to another for equality.

Parameters
otherthe extent to compare this one to.
Returns
true if the extents are equal, false otherwise.

◆ fitIntegerScaled()

uint32_t grem::Extent< 3 >::fitIntegerScaled ( Extent< 3 > targetSize)
inline

Fit the extents into a target size at the largest positive integer scale of its original size that still fits within the target.

Parameters
targetSizetarget size to fit the extents into.
Returns
the integer scale that was chosen.
Note
If the original size cannot fit within the target, then the chosen scale will be 1.

Member Data Documentation

◆ width

uint32_t grem::Extent< 3 >::width

Horizontal extent.

◆ height

uint32_t grem::Extent< 3 >::height = width

Vertical extent.

◆ depth

uint32_t grem::Extent< 3 >::depth = 1

Number of layers.


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