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

#include <GREM/core/extents.hpp>

Public Member Functions

constexpr operator Offset< 3 > () const noexcept
 Convert this offset to a 3D offset.
constexpr operator vec2 () const noexcept
 Convert this offset to a floating-point 2D vector.
constexpr operator dvec2 () const noexcept
 Convert this offset to a double-precision floating-point 2D vector.
constexpr operator ivec2 () const noexcept
 Convert this offset to an integer 2D vector.
constexpr operator u32vec2 () const noexcept
 Convert this offset to an unsigned integer 2D vector.
constexpr bool operator== (const Offset< 2 > &other) const =default
 Compare this offset to another for equality.

Static Public Member Functions

static constexpr Offset< 2 > from (i32vec2 v) noexcept
 Create an offset from a vector of integers.
static Offset< 2 > round (vec2 v)
 Create an offset from a vector of floating-point numbers, rounded to their nearest integer values before conversion.
static Offset< 2 > floor (vec2 v)
 Create an offset from a vector of floating-point numbers, rounded down to their floor integer values before conversion.
static Offset< 2 > ceil (vec2 v)
 Create an offset from a vector of floating-point numbers, rounded up to their ceiling integer values before conversion.
static Offset< 2 > trunc (vec2 v)
 Create an offset from a vector of floating-point numbers, rounded to their truncated integer values before conversion.

Public Attributes

int32_t x
 Horizontal offset.
int32_t y
 Vertical offset.

Member Function Documentation

◆ from()

constexpr Offset< 2 > grem::Offset< 2 >::from ( i32vec2 v)
inlinestaticnodiscardconstexprnoexcept

Create an offset from a vector of integers.

Parameters
vvector to convert.
Returns
the corresponding offset.

◆ round()

Offset< 2 > grem::Offset< 2 >::round ( vec2 v)
inlinestaticnodiscard

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

Parameters
vvector to convert.
Returns
the rounded offset.

◆ floor()

Offset< 2 > grem::Offset< 2 >::floor ( vec2 v)
inlinestaticnodiscard

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

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

◆ ceil()

Offset< 2 > grem::Offset< 2 >::ceil ( vec2 v)
inlinestaticnodiscard

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

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

◆ trunc()

Offset< 2 > grem::Offset< 2 >::trunc ( vec2 v)
inlinestaticnodiscard

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

Parameters
vvector to convert.
Returns
the truncated offset.

◆ operator Offset< 3 >()

grem::Offset< 2 >::operator Offset< 3 > ( ) const
inlineconstexprnoexcept

Convert this offset to a 3D offset.

Returns
the equivalent 3D offset, with a depth offset of 0.

◆ operator vec2()

grem::Offset< 2 >::operator vec2 ( ) const
inlineconstexprnoexcept

Convert this offset to a floating-point 2D vector.

Returns
a 2D vector representing the offset.

◆ operator dvec2()

grem::Offset< 2 >::operator dvec2 ( ) const
inlineconstexprnoexcept

Convert this offset to a double-precision floating-point 2D vector.

Returns
a 2D vector representing the offset.

◆ operator ivec2()

grem::Offset< 2 >::operator ivec2 ( ) const
inlineconstexprnoexcept

Convert this offset to an integer 2D vector.

Returns
a 2D vector representing the offset.

◆ operator u32vec2()

grem::Offset< 2 >::operator u32vec2 ( ) const
inlineconstexprnoexcept

Convert this offset to an unsigned integer 2D vector.

Returns
a 2D vector representing the offset.

◆ operator==()

bool grem::Offset< 2 >::operator== ( const Offset< 2 > & other) const
nodiscardconstexprdefault

Compare this offset to another for equality.

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

Member Data Documentation

◆ x

int32_t grem::Offset< 2 >::x

Horizontal offset.

◆ y

int32_t grem::Offset< 2 >::y

Vertical offset.


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