Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
Transform Struct Reference

Represents the position, rotation, and scale of an entity in 3D space. More...

#include <Transform.hpp>

Public Member Functions

glm::quat rotationQuat () const
 Converts the Euler rotation angles to a quaternion.
glm::vec3 forward () const
 Gets the forward direction vector in local space.
glm::vec3 right () const
 Gets the right direction vector in local space.
glm::vec3 up () const
 Gets the up direction vector in local space.
glm::mat4 matrix () const
 Computes the model matrix representing the transform.
 Transform ()=default
 Default constructor for Transform.
 Transform (glm::vec3 pos, glm::vec3 rot=glm::vec3(0.f), glm::vec3 s=glm::vec3(1.f))
 Construct a new Transform object.

Public Attributes

glm::vec3 position { 0.0f }
RotationField rotation
glm::vec3 scale { 1.0f }

Detailed Description

Represents the position, rotation, and scale of an entity in 3D space.

Constructor & Destructor Documentation

◆ Transform() [1/2]

Transform::Transform ( )
default

Default constructor for Transform.

◆ Transform() [2/2]

Transform::Transform ( glm::vec3 pos,
glm::vec3 rot = glm::vec3(0.f),
glm::vec3 s = glm::vec3(1.f) )
inline

Construct a new Transform object.

Parameters
posInitial position.
rotInitial rotation.
sInitial scale.

Member Function Documentation

◆ forward()

glm::vec3 Transform::forward ( ) const
inline

Gets the forward direction vector in local space.

Returns
Normalized forward vector.

◆ matrix()

glm::mat4 Transform::matrix ( ) const
inline

Computes the model matrix representing the transform.

Returns
The 4x4 transform matrix.

◆ right()

glm::vec3 Transform::right ( ) const
inline

Gets the right direction vector in local space.

Returns
Normalized right vector.

◆ rotationQuat()

glm::quat Transform::rotationQuat ( ) const
inline

Converts the Euler rotation angles to a quaternion.

Returns
The rotation quaternion.

◆ up()

glm::vec3 Transform::up ( ) const
inline

Gets the up direction vector in local space.

Returns
Normalized up vector.

Member Data Documentation

◆ position

glm::vec3 Transform::position { 0.0f }

◆ rotation

RotationField Transform::rotation

◆ scale

glm::vec3 Transform::scale { 1.0f }

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