Nui Engine
A game engine framework
Loading...
Searching...
No Matches
Nui::Components::Transform Class Reference

Transform component. More...

#include <TransformComponent.h>

Inheritance diagram for Nui::Components::Transform:
Nui::Components::ComponentBase

Public Member Functions

 Transform ()
 Default constructor.
 
 Transform (Math::Vector3 position, Math::Quaternion rotation=Math::Quaternion::Identity, Math::Vector3 scale=Math::Vector3::One)
 Parametrized constructor.
 
 Transform (const Transform &)=default
 Copy constructor (defaulted)
 
 Transform (Transform &&)=default
 Move constructor (defaulted)
 
 ~Transform ()=default
 Destructor (defaulted)
 
Transformoperator= (const Transform &)=default
 Copy assignment operator.
 
Transformoperator= (Transform &&) noexcept=default
 Move assignment operator.
 
auto operator<=> (const Transform &) const =default
 Comparison operator.
 
NUI_NODISCARD_TRANSFROM_GETTER const Math::Quaternion & GetRotation () const
 Const reference getter for rotation.
 
NUI_NODISCARD_TRANSFROM_GETTER Math::Quaternion GetRotation ()
 Getter for rotation.
 
NUI_NODISCARD_TRANSFROM_GETTER const Math::Vector3 & GetPosition () const
 Const reference getter for position.
 
NUI_NODISCARD_TRANSFROM_GETTER Math::Vector3 GetPosition ()
 Getter for position.
 
NUI_NODISCARD_TRANSFROM_GETTER const Math::Vector3 & GetScale () const
 Const reference getter for scale.
 
NUI_NODISCARD_TRANSFROM_GETTER Math::Vector3 GetScale ()
 Getter for scale.
 
NUI_NODISCARD_TRANSFROM_GETTER Math::Matrix GetWorldMatrix () const
 Getter for world matrix.
 
void SetRotation (const Math::Quaternion &rotation)
 Setter for rotation.
 
void SetPosition (const Math::Vector3 &position)
 Setter for position.
 
void SetScale (const Math::Vector3 &scale)
 Setter for scale.
 
void RecalculateWorldMatrix ()
 Recalculates world matrix (used when transform is dirty)
 
- Public Member Functions inherited from Nui::Components::ComponentBase
 ComponentBase ()
 Constructor (sets dirty flag to true)
 
bool IsDirty () const
 Checks if the component is dirty.
 
bool IsActive () const
 Checks if the component is active.
 
void SetActive (bool isActive)
 Sets the active flag.
 

Additional Inherited Members

- Protected Member Functions inherited from Nui::Components::ComponentBase
void SetDirty (bool isDirty=true)
 Sets the dirty flag.
 
- Protected Attributes inherited from Nui::Components::ComponentBase
std::bitset< ComponentFlags::CF_COUNT > m_flags
 Bitset of component flags.
 

Detailed Description

Transform component.

Constructor & Destructor Documentation

◆ Transform()

Nui::Components::Transform::Transform ( Math::Vector3 position,
Math::Quaternion rotation = Math::Quaternion::Identity,
Math::Vector3 scale = Math::Vector3::One )

Parametrized constructor.

Parameters
positionPosition of the transform
rotationRotation of the transform (defaults to identity rotation)
scaleScale of the transform (defaults to 1, 1, 1)

Member Function Documentation

◆ GetPosition() [1/2]

NUI_NODISCARD_TRANSFROM_GETTER Math::Vector3 Nui::Components::Transform::GetPosition ( )
inline

Getter for position.

Returns
Position of the transform

◆ GetPosition() [2/2]

NUI_NODISCARD_TRANSFROM_GETTER const Math::Vector3 & Nui::Components::Transform::GetPosition ( ) const
inline

Const reference getter for position.

Returns
Position of the transform

◆ GetRotation() [1/2]

NUI_NODISCARD_TRANSFROM_GETTER Math::Quaternion Nui::Components::Transform::GetRotation ( )
inline

Getter for rotation.

Returns
Rotation of the transform

◆ GetRotation() [2/2]

NUI_NODISCARD_TRANSFROM_GETTER const Math::Quaternion & Nui::Components::Transform::GetRotation ( ) const
inline

Const reference getter for rotation.

Returns
Rotation of the transform

◆ GetScale() [1/2]

NUI_NODISCARD_TRANSFROM_GETTER Math::Vector3 Nui::Components::Transform::GetScale ( )
inline

Getter for scale.

Returns
Scale of the transform

◆ GetScale() [2/2]

NUI_NODISCARD_TRANSFROM_GETTER const Math::Vector3 & Nui::Components::Transform::GetScale ( ) const
inline

Const reference getter for scale.

Returns
Scale of the transform

◆ GetWorldMatrix()

NUI_NODISCARD_TRANSFROM_GETTER Math::Matrix Nui::Components::Transform::GetWorldMatrix ( ) const
inline

Getter for world matrix.

Returns
World matrix from position, rotation and scale

◆ operator<=>()

auto Nui::Components::Transform::operator<=> ( const Transform & ) const
default

Comparison operator.

Returns
0 if equal

◆ operator=() [1/2]

Transform & Nui::Components::Transform::operator= ( const Transform & )
default

Copy assignment operator.

Returns
Reference to self

◆ operator=() [2/2]

Transform & Nui::Components::Transform::operator= ( Transform && )
defaultnoexcept

Move assignment operator.

Returns
Reference to self

◆ SetPosition()

void Nui::Components::Transform::SetPosition ( const Math::Vector3 & position)

Setter for position.

Parameters
positionNew position

◆ SetRotation()

void Nui::Components::Transform::SetRotation ( const Math::Quaternion & rotation)

Setter for rotation.

Parameters
rotationNew rotation

◆ SetScale()

void Nui::Components::Transform::SetScale ( const Math::Vector3 & scale)

Setter for scale.

Parameters
scaleNew scale

The documentation for this class was generated from the following files: