MAGE  v0.171.0
Matthias Advanced Game Engine
mage::TextureTransform2D Class Reference

#include <texture_transform.hpp>

Public Member Functions

 TextureTransform2D (F32x2 translation={ 0.0f, 0.0f }, F32 rotation=0.0f, F32x2 rotation_origin={ 0.0f, 0.0f }, F32x2 scale={ 1.0f, 1.0f }) noexcept
 
 TextureTransform2D (FXMVECTOR translation, F32 rotation, FXMVECTOR rotation_origin, FXMVECTOR scale) noexcept
 
 TextureTransform2D (const TextureTransform2D &transform) noexcept=default
 
 TextureTransform2D (TextureTransform2D &&transform) noexcept=default
 
 ~TextureTransform2D ()=default
 
TextureTransform2Doperator= (const TextureTransform2D &transform) noexcept=default
 
TextureTransform2Doperator= (TextureTransform2D &&transform) noexcept=default
 
void SetTranslationX (F32 x) noexcept
 
void SetTranslationY (F32 y) noexcept
 
void SetTranslation (F32 x, F32 y) noexcept
 
void SetTranslation (F32x2 translation) noexcept
 
void XM_CALLCONV SetTranslation (FXMVECTOR translation) noexcept
 
void AddTranslationX (F32 x) noexcept
 
void AddTranslationY (F32 y) noexcept
 
void AddTranslation (F32 x, F32 y) noexcept
 
void AddTranslation (const F32x2 &translation) noexcept
 
void XM_CALLCONV AddTranslation (FXMVECTOR translation) noexcept
 
F32 GetTranslationX () const noexcept
 
F32 GetTranslationY () const noexcept
 
const F32x2 GetTranslationView () const noexcept
 
const XMVECTOR XM_CALLCONV GetTranslation () const noexcept
 
void SetRotation (F32 rotation) noexcept
 
void AddRotation (F32 rotation) noexcept
 
void AddRotation (F32 rotation, F32 min_angle, F32 max_angle) noexcept
 
F32 GetRotation () const noexcept
 
void SetRotationOriginX (F32 x) noexcept
 
void SetRotationOriginY (F32 y) noexcept
 
void SetRotationOrigin (F32 x, F32 y) noexcept
 
void SetRotationOrigin (F32x2 rotation_origin) noexcept
 
void XM_CALLCONV SetRotationOrigin (FXMVECTOR rotation_origin) noexcept
 
void AddRotationOriginX (F32 x) noexcept
 
void AddRotationOriginY (F32 y) noexcept
 
void AddRotationOrigin (F32 x, F32 y) noexcept
 
void AddRotationOrigin (const F32x2 &offset) noexcept
 
void XM_CALLCONV AddRotationOrigin (FXMVECTOR offset) noexcept
 
F32 GetRotationOriginX () const noexcept
 
F32 GetRotationOriginY () const noexcept
 
const F32x2 GetRotationOriginView () const noexcept
 
const XMVECTOR XM_CALLCONV GetRotationOrigin () const noexcept
 
void SetScaleX (F32 x) noexcept
 
void SetScaleY (F32 y) noexcept
 
void SetScale (F32 s) noexcept
 
void SetScale (F32 x, F32 y) noexcept
 
void SetScale (F32x2 scale) noexcept
 
void XM_CALLCONV SetScale (FXMVECTOR scale) noexcept
 
void AddScaleX (F32 x) noexcept
 
void AddScaleY (F32 y) noexcept
 
void AddScale (F32 s) noexcept
 
void AddScale (F32 x, F32 y) noexcept
 
void AddScale (const F32x2 &scale) noexcept
 
void XM_CALLCONV AddScale (FXMVECTOR scale) noexcept
 
F32 GetScaleX () const noexcept
 
F32 GetScaleY () const noexcept
 
const F32x2 GetScaleView () const noexcept
 
const XMVECTOR XM_CALLCONV GetScale () const noexcept
 
const XMMATRIX XM_CALLCONV GetTransformMatrix () const noexcept
 

Private Attributes

F32x2 m_translation
 
F32 m_padding
 
F32 m_rotation
 
F32x2 m_rotation_origin
 
F32x2 m_scale
 

Detailed Description

A class of 2D texture transforms supporting non-uniform scaling, rotation and translation.

Constructor & Destructor Documentation

◆ TextureTransform2D() [1/4]

mage::TextureTransform2D::TextureTransform2D ( F32x2  translation = { 0.0f, 0.0f },
F32  rotation = 0.0f,
F32x2  rotation_origin = { 0.0f, 0.0f },
F32x2  scale = { 1.0f, 1.0f } 
)
explicitnoexcept

Constructs a texture transform from the given translation, depth, rotation, rotation origin and scale component.

Parameters
[in]translationThe translation component.
[in]rotationThe rotation component.
[in]rotation_originThe rotation component.
[in]scaleThe scale component.

◆ TextureTransform2D() [2/4]

mage::TextureTransform2D::TextureTransform2D ( FXMVECTOR  translation,
F32  rotation,
FXMVECTOR  rotation_origin,
FXMVECTOR  scale 
)
explicitnoexcept

Constructs a texture transform from the given translation, depth, rotation, rotation origin and scale component.

Parameters
[in]translationThe translation component.
[in]rotationThe rotation component.
[in]rotation_originThe rotation component.
[in]scaleThe scale component.

◆ TextureTransform2D() [3/4]

mage::TextureTransform2D::TextureTransform2D ( const TextureTransform2D transform)
defaultnoexcept

Constructs a texture transform from the given texture transform.

Parameters
[in]transformA reference to the texture transform to copy.

◆ TextureTransform2D() [4/4]

mage::TextureTransform2D::TextureTransform2D ( TextureTransform2D &&  transform)
defaultnoexcept

Constructs a texture transform by moving the given texture transform.

Parameters
[in]transformA reference to the texture transform to move.

◆ ~TextureTransform2D()

mage::TextureTransform2D::~TextureTransform2D ( )
default

Destructs this texture transform.

Member Function Documentation

◆ AddRotation() [1/2]

void mage::TextureTransform2D::AddRotation ( F32  rotation)
noexcept

Adds the given rotation component to the rotation component of this texture transform.

Parameters
[in]rotationThe rotation component to add.

◆ AddRotation() [2/2]

void mage::TextureTransform2D::AddRotation ( F32  rotation,
F32  min_angle,
F32  max_angle 
)
noexcept

Adds the given rotation component to the rotation component of this texture transform and clamps the resulting rotation component of this texture transform between the given values.

Precondition
min_angle lies in [-pi, pi].
max_angle lies in [-pi, pi].
min_angle is not greater than max_angle.
Parameters
[in]rotationThe rotation component to add.
[in]min_angleThe minimum angle (in radians).
[in]max_angleThe maximum angle (in radians).

◆ AddRotationOrigin() [1/3]

void mage::TextureTransform2D::AddRotationOrigin ( F32  x,
F32  y 
)
noexcept

Adds the given offsets to the rotation origin of this texture transform.

Parameters
[in]xThe x-value of the offset to add.
[in]yThe y-value of the offset to add.

◆ AddRotationOrigin() [2/3]

void mage::TextureTransform2D::AddRotationOrigin ( const F32x2 offset)
noexcept

Adds the given offset to the rotation origin of this texture transform.

Parameters
[in]offsetThe offset to add.

◆ AddRotationOrigin() [3/3]

void XM_CALLCONV mage::TextureTransform2D::AddRotationOrigin ( FXMVECTOR  offset)
noexcept

Adds the given offset to the rotation origin of this texture transform.

Parameters
[in]offsetThe offset to add.

◆ AddRotationOriginX()

void mage::TextureTransform2D::AddRotationOriginX ( F32  x)
noexcept

Adds the given x-value to the rotation origin of this texture transform.

Parameters
[in]xThe x-value of the offset to add.

◆ AddRotationOriginY()

void mage::TextureTransform2D::AddRotationOriginY ( F32  y)
noexcept

Adds the given y-value to the rotation origin of this texture transform.

Parameters
[in]yThe y-value of the offset to add.

◆ AddScale() [1/4]

void mage::TextureTransform2D::AddScale ( F32  s)
noexcept

Adds the given scale component to the scale component of this texture transform.

Parameters
[in]sThe scale component to add.

◆ AddScale() [2/4]

void mage::TextureTransform2D::AddScale ( F32  x,
F32  y 
)
noexcept

Adds the given scale component to the scale component of this texture transform.

Parameters
[in]xThe x-value of the scale component to add.
[in]yThe y-value of the scale component to add.

◆ AddScale() [3/4]

void mage::TextureTransform2D::AddScale ( const F32x2 scale)
noexcept

Adds the given scale component to the scale component of this texture transform.

Parameters
[in]scaleA reference to the scale component to add.

◆ AddScale() [4/4]

void XM_CALLCONV mage::TextureTransform2D::AddScale ( FXMVECTOR  scale)
noexcept

Adds the given scale component to the scale component of this texture transform.

Parameters
[in]scaleThe scale component to add.

◆ AddScaleX()

void mage::TextureTransform2D::AddScaleX ( F32  x)
noexcept

Adds the given x-value to the scale component of this texture transform.

Parameters
[in]xThe x-value of the scale component to add.

◆ AddScaleY()

void mage::TextureTransform2D::AddScaleY ( F32  y)
noexcept

Adds the given y-value to the scale component of this texture transform.

Parameters
[in]yThe y-value of the scale component to add.

◆ AddTranslation() [1/3]

void mage::TextureTransform2D::AddTranslation ( F32  x,
F32  y 
)
noexcept

Adds the given translation component to the translation component of this texture transform.

Parameters
[in]xThe x-value of the translation component to add.
[in]yThe y-value of the translation component to add.

◆ AddTranslation() [2/3]

void mage::TextureTransform2D::AddTranslation ( const F32x2 translation)
noexcept

Adds the given translation component to the translation component of this texture transform.

Parameters
[in]translationA reference to the translation component to add.

◆ AddTranslation() [3/3]

void XM_CALLCONV mage::TextureTransform2D::AddTranslation ( FXMVECTOR  translation)
noexcept

Adds the given translation component to the translation component of this texture transform.

Parameters
[in]translationThe translation component to add.

◆ AddTranslationX()

void mage::TextureTransform2D::AddTranslationX ( F32  x)
noexcept

Adds the given x-value to the translation component of this texture transform.

Parameters
[in]xThe x-value of the translation component to add.

◆ AddTranslationY()

void mage::TextureTransform2D::AddTranslationY ( F32  y)
noexcept

Adds the given y-value to the translation component of this texture transform.

Parameters
[in]yThe y-value of the translation component to add.

◆ GetRotation()

F32 mage::TextureTransform2D::GetRotation ( ) const
noexcept

Returns the rotation component of this texture transform.

Returns
The rotation component of this texture transform.

◆ GetRotationOrigin()

const XMVECTOR XM_CALLCONV mage::TextureTransform2D::GetRotationOrigin ( ) const
noexcept

Returns the rotation origin of this texture transform.

Returns
The rotation origin of this texture transform.

◆ GetRotationOriginView()

const F32x2 mage::TextureTransform2D::GetRotationOriginView ( ) const
noexcept

Returns the rotation origin of this texture transform.

Returns
The rotation origin of this texture transform.

◆ GetRotationOriginX()

F32 mage::TextureTransform2D::GetRotationOriginX ( ) const
noexcept

Returns the x-value of the rotation origin of this texture transform.

Returns
The x-value of the rotation origin of this texture transform.

◆ GetRotationOriginY()

F32 mage::TextureTransform2D::GetRotationOriginY ( ) const
noexcept

Returns the y-value of the rotation origin of this texture transform.

Returns
The y-value of the rotation origin of this texture transform.

◆ GetScale()

const XMVECTOR XM_CALLCONV mage::TextureTransform2D::GetScale ( ) const
noexcept

Returns the scale component of this texture transform.

Returns
The scale component of this texture transform.

◆ GetScaleView()

const F32x2 mage::TextureTransform2D::GetScaleView ( ) const
noexcept

Returns the scale component of this texture transform.

Returns
The scale component of this texture transform.

◆ GetScaleX()

F32 mage::TextureTransform2D::GetScaleX ( ) const
noexcept

Returns the x-value of the scale component of this texture transform.

Returns
The x-value of the scale component of this texture transform.

◆ GetScaleY()

F32 mage::TextureTransform2D::GetScaleY ( ) const
noexcept

Returns the y-value of the scale component of this texture transform.

Returns
The y-value of the scale component of this texture transform.

◆ GetTransformMatrix()

const XMMATRIX XM_CALLCONV mage::TextureTransform2D::GetTransformMatrix ( ) const
noexcept

Returns the transformation matrix of this texture transform.

Returns
The transformation matrix of this texture transform.

◆ GetTranslation()

const XMVECTOR XM_CALLCONV mage::TextureTransform2D::GetTranslation ( ) const
noexcept

Returns the translation component of this texture transform.

Returns
The translation component of this texture transform.

◆ GetTranslationView()

const F32x2 mage::TextureTransform2D::GetTranslationView ( ) const
noexcept

Returns the translation component of this texture transform.

Returns
The translation component of this texture transform.

◆ GetTranslationX()

F32 mage::TextureTransform2D::GetTranslationX ( ) const
noexcept

Returns the x-value of the translation component of this texture transform.

Returns
The x-value of the translation component of this texture transform.

◆ GetTranslationY()

F32 mage::TextureTransform2D::GetTranslationY ( ) const
noexcept

Returns the y-value of the translation component of this texture transform.

Returns
The y-value of the translation component of this texture transform.

◆ operator=() [1/2]

TextureTransform2D& mage::TextureTransform2D::operator= ( const TextureTransform2D transform)
defaultnoexcept

Copies the given texture transform to this texture transform.

Parameters
[in]transformThe texture transform to move.
Returns
A reference to the copy of the given texture transform (i.e. this texture transform).

◆ operator=() [2/2]

TextureTransform2D& mage::TextureTransform2D::operator= ( TextureTransform2D &&  transform)
defaultnoexcept

Moves the given texture transform to this texture transform.

Parameters
[in]transformThe texture transform to copy.
Returns
A reference to the moved texture transform (i.e. this texture transform).

◆ SetRotation()

void mage::TextureTransform2D::SetRotation ( F32  rotation)
noexcept

Sets the rotation component of this texture transform to the given rotation component.

Parameters
[in]rotationThe rotation component.

◆ SetRotationOrigin() [1/3]

void mage::TextureTransform2D::SetRotationOrigin ( F32  x,
F32  y 
)
noexcept

Sets the rotation origin of this texture transform to the given rotation origin.

Parameters
[in]xThe x-value of the rotation origin.
[in]yThe y-value of the rotation origin.

◆ SetRotationOrigin() [2/3]

void mage::TextureTransform2D::SetRotationOrigin ( F32x2  rotation_origin)
noexcept

Sets the rotation origin of this texture transform to the given rotation origin.

Parameters
[in]rotation_originThe rotation origin.

◆ SetRotationOrigin() [3/3]

void XM_CALLCONV mage::TextureTransform2D::SetRotationOrigin ( FXMVECTOR  rotation_origin)
noexcept

Sets the rotation origin of this texture transform to the given rotation origin.

Parameters
[in]rotation_originThe rotation origin.

◆ SetRotationOriginX()

void mage::TextureTransform2D::SetRotationOriginX ( F32  x)
noexcept

Sets the x-value of the rotation origin of this texture transform to the given value.

Parameters
[in]xThe x-value of the rotation origin.

◆ SetRotationOriginY()

void mage::TextureTransform2D::SetRotationOriginY ( F32  y)
noexcept

Sets the y-value of the rotation origin of this texture transform to the given value.

Parameters
[in]yThe y-value of the rotation origin.

◆ SetScale() [1/4]

void mage::TextureTransform2D::SetScale ( F32  s)
noexcept

Sets the scale component of this texture transform to the given scale component.

Parameters
[in]sThe scale component.

◆ SetScale() [2/4]

void mage::TextureTransform2D::SetScale ( F32  x,
F32  y 
)
noexcept

Sets the scale component of this texture transform to the given scale component.

Parameters
[in]xThe x-value of the scale component.
[in]yThe y-value of the scale component.

◆ SetScale() [3/4]

void mage::TextureTransform2D::SetScale ( F32x2  scale)
noexcept

Sets the scale component of this texture transform to the given scale component.

Parameters
[in]scaleThe scale component.

◆ SetScale() [4/4]

void XM_CALLCONV mage::TextureTransform2D::SetScale ( FXMVECTOR  scale)
noexcept

Sets the scale component of this texture transform to the given scale component.

Parameters
[in]scaleThe scale component.

◆ SetScaleX()

void mage::TextureTransform2D::SetScaleX ( F32  x)
noexcept

Sets the x-value of the scale component of this texture transform to the given value.

Parameters
[in]xThe x-value of the scale component.

◆ SetScaleY()

void mage::TextureTransform2D::SetScaleY ( F32  y)
noexcept

Sets the y-value of the scale component of this texture transform to the given value.

Parameters
[in]yThe y-value of the scale component.

◆ SetTranslation() [1/3]

void mage::TextureTransform2D::SetTranslation ( F32  x,
F32  y 
)
noexcept

Sets the translation component of this texture transform to the given translation component.

Parameters
[in]xThe x-value of the translation component.
[in]yThe y-value of the translation component.

◆ SetTranslation() [2/3]

void mage::TextureTransform2D::SetTranslation ( F32x2  translation)
noexcept

Sets the translation component of this texture transform to the given translation component.

Parameters
[in]translationThe translation component.

◆ SetTranslation() [3/3]

void XM_CALLCONV mage::TextureTransform2D::SetTranslation ( FXMVECTOR  translation)
noexcept

Sets the translation component of this texture transform to the given translation component.

Parameters
[in]translationThe translation component.

◆ SetTranslationX()

void mage::TextureTransform2D::SetTranslationX ( F32  x)
noexcept

Sets the x-value of the translation component of this texture transform to the given value.

Parameters
[in]xThe x-value of the translation component.

◆ SetTranslationY()

void mage::TextureTransform2D::SetTranslationY ( F32  y)
noexcept

Sets the y-value of the translation component of this texture transform to the given value.

Parameters
[in]yThe y-value of the translation component.

Member Data Documentation

◆ m_padding

F32 mage::TextureTransform2D::m_padding
private

The padding of this texture transform.

◆ m_rotation

F32 mage::TextureTransform2D::m_rotation
private

The rotation component (in radians) of this texture transform.

◆ m_rotation_origin

F32x2 mage::TextureTransform2D::m_rotation_origin
private

The rotation origin (in UV coordinates) of this texture transform.

◆ m_scale

F32x2 mage::TextureTransform2D::m_scale
private

The scale component of this texture transform.

◆ m_translation

F32x2 mage::TextureTransform2D::m_translation
private

The translation component (in UV coordinates) of this texture transform.