Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
EngineCore::Transform Class Reference

#include <Transform.h>

Inheritance diagram for EngineCore::Transform:
Collaboration diagram for EngineCore::Transform:

Classes

struct  MatrixTransformComponent
class  serial

Public Member Functions

 Transform ()
 Transform (glm::vec3 location)
 Transform (glm::vec3 location, glm::vec3 rotation)
 Transform (glm::vec3 location, glm::vec3 rotation, glm::vec3 scale)
 Transform (glm::mat4 matrix)
 Transform (nlohmann::json object)
 ~Transform ()
glm::mat4 getInverse () const
MatrixTransformComponent getComponents () const
glm::vec3 getLocation () const
void setLocation (const glm::vec3 &newLocation)
glm::vec3 getRotation () const
void setRotation (const glm::vec3 &newRotationEuler)
void setRotationQuat (glm::quat newQuaternion)
glm::quat getRotationQuat () const
glm::vec3 getScale () const
void setScale (const glm::vec3 &newScale)
Transform matrixToTransform (glm::mat4 matrix) const
void overrideMatrix (glm::mat4 matrix)
Transform combine (const Transform &parent) const
glm::mat4 toMatrix () const
std::string toString () const
void Serialize (nlohmann::json &archive) override
void Deserialize (nlohmann::json &archive) override
std::string getClassName () const override
bool isTransformDirty () const
Transform operator* (const Transform &other) const
void markDirty () const
void markClean () const
Public Member Functions inherited from EngineCore::Serializable
virtual ~Serializable ()=default

Private Member Functions

MatrixTransformComponent generateTransformComponentsFromMatrix (const glm::mat4 &matrix) const
void regenerateTransformComponents () const

Private Attributes

Transform::MatrixTransformComponent transform_components = {}
bool needsComponentRebuild = true
bool isDirty = true
bool inverseNeedsUpdate = true
glm::mat4 cachedInverse = glm::mat4(1.0f)
glm::mat4 transform = glm::mat4(1.0f)

Static Private Attributes

static EngineCore::Registrar< Transformregistrar_Transform

Friends

class SceneGraph

Additional Inherited Members

Static Public Member Functions inherited from EngineCore::Serializable
static std::unique_ptr< Serializablecreate (const std::string &typeName)
static nlohmann::json createDefaultJson (const std::string &typeName)
static const std::vector< std::string > & getRegisteredClasses ()
Static Public Attributes inherited from EngineCore::Serializable
static const std::string classNameKey = "ClassName"

Detailed Description

Definition at line 42 of file Transform.h.

Constructor & Destructor Documentation

◆ Transform() [1/6]

EngineCore::Transform::Transform ( )
default

Referenced by combine(), matrixToTransform(), and operator*().

Here is the caller graph for this function:

◆ Transform() [2/6]

EngineCore::Transform::Transform ( glm::vec3 location)
explicit

Definition at line 19 of file Transform.cpp.

References setLocation().

Here is the call graph for this function:

◆ Transform() [3/6]

EngineCore::Transform::Transform ( glm::vec3 location,
glm::vec3 rotation )

Definition at line 24 of file Transform.cpp.

References setLocation(), and setRotation().

Here is the call graph for this function:

◆ Transform() [4/6]

EngineCore::Transform::Transform ( glm::vec3 location,
glm::vec3 rotation,
glm::vec3 scale )

Definition at line 29 of file Transform.cpp.

References setLocation(), setRotation(), and setScale().

Here is the call graph for this function:

◆ Transform() [5/6]

EngineCore::Transform::Transform ( glm::mat4 matrix)
explicit

Definition at line 36 of file Transform.cpp.

References markDirty(), and overrideMatrix().

Here is the call graph for this function:

◆ Transform() [6/6]

EngineCore::Transform::Transform ( nlohmann::json object)
explicit

Definition at line 42 of file Transform.cpp.

References Deserialize().

Here is the call graph for this function:

◆ ~Transform()

EngineCore::Transform::~Transform ( )
default

Member Function Documentation

◆ combine()

Transform EngineCore::Transform::combine ( const Transform & parent) const

Definition at line 197 of file Transform.cpp.

References matrixToTransform(), toMatrix(), and Transform().

Here is the call graph for this function:

◆ Deserialize()

void EngineCore::Transform::Deserialize ( nlohmann::json & archive)
overridevirtual

Implements EngineCore::Serializable.

Definition at line 237 of file Transform.cpp.

References EngineCore::GlmSerialize::deserialize(), EngineCore::Transform::serial::LOCATION, regenerateTransformComponents(), EngineCore::Transform::serial::ROTATION, EngineCore::Transform::serial::SCALE, setLocation(), setRotationQuat(), and setScale().

Referenced by Transform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateTransformComponentsFromMatrix()

Transform::MatrixTransformComponent EngineCore::Transform::generateTransformComponentsFromMatrix ( const glm::mat4 & matrix) const
private

◆ getClassName()

std::string EngineCore::Transform::getClassName ( ) const
nodiscardoverridevirtual

Reimplemented from EngineCore::Serializable.

Definition at line 254 of file Transform.cpp.

◆ getComponents()

Transform::MatrixTransformComponent EngineCore::Transform::getComponents ( ) const

Definition at line 93 of file Transform.cpp.

References needsComponentRebuild, regenerateTransformComponents(), and transform_components.

Referenced by getLocation(), getRotation(), getRotationQuat(), getScale(), Serialize(), setRotation(), setRotationQuat(), and setScale().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInverse()

glm::mat4 EngineCore::Transform::getInverse ( ) const

Definition at line 85 of file Transform.cpp.

References cachedInverse, inverseNeedsUpdate, and transform.

◆ getLocation()

glm::vec3 EngineCore::Transform::getLocation ( ) const
nodiscard

Definition at line 104 of file Transform.cpp.

References getComponents(), and EngineCore::Transform::MatrixTransformComponent::translation.

Referenced by toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRotation()

glm::vec3 EngineCore::Transform::getRotation ( ) const
nodiscard

Definition at line 115 of file Transform.cpp.

References getComponents().

Referenced by toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRotationQuat()

glm::quat EngineCore::Transform::getRotationQuat ( ) const

Definition at line 138 of file Transform.cpp.

References getComponents(), and EngineCore::Transform::MatrixTransformComponent::rotation.

Here is the call graph for this function:

◆ getScale()

glm::vec3 EngineCore::Transform::getScale ( ) const
nodiscard

Definition at line 164 of file Transform.cpp.

References getComponents(), and EngineCore::Transform::MatrixTransformComponent::scale.

Referenced by toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isTransformDirty()

bool EngineCore::Transform::isTransformDirty ( ) const

Definition at line 258 of file Transform.cpp.

References isDirty.

Referenced by toMatrix().

Here is the caller graph for this function:

◆ markClean()

void EngineCore::Transform::markClean ( ) const

Definition at line 274 of file Transform.cpp.

References isDirty.

◆ markDirty()

void EngineCore::Transform::markDirty ( ) const

Definition at line 268 of file Transform.cpp.

References inverseNeedsUpdate, isDirty, and needsComponentRebuild.

Referenced by setLocation(), setRotation(), setRotationQuat(), setScale(), and Transform().

Here is the caller graph for this function:

◆ matrixToTransform()

Transform EngineCore::Transform::matrixToTransform ( glm::mat4 matrix) const

Definition at line 209 of file Transform.cpp.

References generateTransformComponentsFromMatrix(), EngineCore::Transform::MatrixTransformComponent::rotation, EngineCore::Transform::MatrixTransformComponent::scale, Transform(), transform, and EngineCore::Transform::MatrixTransformComponent::translation.

Referenced by combine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator*()

Transform EngineCore::Transform::operator* ( const Transform & other) const

Definition at line 263 of file Transform.cpp.

References toMatrix(), and Transform().

Here is the call graph for this function:

◆ overrideMatrix()

void EngineCore::Transform::overrideMatrix ( glm::mat4 matrix)

Definition at line 220 of file Transform.cpp.

References transform.

Referenced by Transform().

Here is the caller graph for this function:

◆ regenerateTransformComponents()

void EngineCore::Transform::regenerateTransformComponents ( ) const
private

Definition at line 80 of file Transform.cpp.

References generateTransformComponentsFromMatrix(), needsComponentRebuild, transform, and transform_components.

Referenced by Deserialize(), getComponents(), and toMatrix().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Serialize()

void EngineCore::Transform::Serialize ( nlohmann::json & archive)
overridevirtual

Reimplemented from EngineCore::Serializable.

Definition at line 230 of file Transform.cpp.

References getComponents(), EngineCore::Transform::serial::LOCATION, EngineCore::Transform::serial::ROTATION, EngineCore::Transform::serial::SCALE, EngineCore::GlmSerialize::Serialize(), and EngineCore::Serializable::Serialize().

Here is the call graph for this function:

◆ setLocation()

void EngineCore::Transform::setLocation ( const glm::vec3 & newLocation)

Definition at line 109 of file Transform.cpp.

References markDirty(), and transform.

Referenced by Deserialize(), Transform(), Transform(), and Transform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRotation()

void EngineCore::Transform::setRotation ( const glm::vec3 & newRotationEuler)

Definition at line 143 of file Transform.cpp.

References getComponents(), markDirty(), EngineCore::Transform::MatrixTransformComponent::scale, transform, and EngineCore::Transform::MatrixTransformComponent::translation.

Referenced by Transform(), and Transform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRotationQuat()

void EngineCore::Transform::setRotationQuat ( glm::quat newQuaternion)

Definition at line 120 of file Transform.cpp.

References getComponents(), markDirty(), EngineCore::Transform::MatrixTransformComponent::scale, transform, and EngineCore::Transform::MatrixTransformComponent::translation.

Referenced by Deserialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setScale()

void EngineCore::Transform::setScale ( const glm::vec3 & newScale)

Definition at line 169 of file Transform.cpp.

References getComponents(), markDirty(), EngineCore::Transform::MatrixTransformComponent::rotation, transform, and EngineCore::Transform::MatrixTransformComponent::translation.

Referenced by Deserialize(), and Transform().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toMatrix()

glm::mat4 EngineCore::Transform::toMatrix ( ) const
nodiscard

Definition at line 187 of file Transform.cpp.

References isTransformDirty(), regenerateTransformComponents(), TRACY_ZONE_SCOPED_FUNCTION, and transform.

Referenced by combine(), and operator*().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string EngineCore::Transform::toString ( ) const
nodiscard

Definition at line 224 of file Transform.cpp.

References getLocation(), getRotation(), and getScale().

Here is the call graph for this function:

◆ SceneGraph

friend class SceneGraph
friend

Definition at line 43 of file Transform.h.

References SceneGraph.

Referenced by SceneGraph.

Member Data Documentation

◆ cachedInverse

glm::mat4 EngineCore::Transform::cachedInverse = glm::mat4(1.0f)
mutableprivate

Definition at line 74 of file Transform.h.

Referenced by getInverse().

◆ inverseNeedsUpdate

bool EngineCore::Transform::inverseNeedsUpdate = true
mutableprivate

Definition at line 69 of file Transform.h.

Referenced by getInverse(), and markDirty().

◆ isDirty

bool EngineCore::Transform::isDirty = true
mutableprivate

Definition at line 68 of file Transform.h.

Referenced by isTransformDirty(), markClean(), and markDirty().

◆ needsComponentRebuild

bool EngineCore::Transform::needsComponentRebuild = true
mutableprivate

Definition at line 67 of file Transform.h.

Referenced by getComponents(), markDirty(), and regenerateTransformComponents().

◆ registrar_Transform

EngineCore::Registrar<Transform> EngineCore::Transform::registrar_Transform
inlinestaticprivate

Definition at line 121 of file Transform.h.

◆ transform

glm::mat4 EngineCore::Transform::transform = glm::mat4(1.0f)
private

◆ transform_components

Transform::MatrixTransformComponent EngineCore::Transform::transform_components = {}
mutableprivate

Definition at line 66 of file Transform.h.

Referenced by getComponents(), and regenerateTransformComponents().


The documentation for this class was generated from the following files:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/World/Transform.h
  • /home/magerbeton/Documents/gl3-vulkan/Engine/src/Engine/World/Transform.cpp