Foray Library
rapid prototyping framework for crossplatform development of vulkan hardware ray tracing applications
Loading...
Searching...
No Matches
foray_transform.hpp
Go to the documentation of this file.
1#pragma once
2#include "../../foray_glm.hpp"
3#include "../foray_component.hpp"
4
5namespace foray::scene::ncomp {
6
8 class Transform : public NodeComponent
9 {
10 public:
11 inline Transform() {}
12
16 FORAY_GETTER_R(LocalMatrix)
17 FORAY_PROPERTY_V(Static)
18 FORAY_PROPERTY_V(LocalMatrixFixed)
19 FORAY_GETTER_V(Dirty)
20
21 const glm::mat4& GetGlobalMatrix();
22
23 void RecalculateIfDirty(bool recursive = false);
24
25 void SetTranslation(const glm::vec3& translation);
26 void SetRotation(const glm::quat& rotation);
27 void SetScale(const glm::vec3& scale);
28 void SetLocalMatrix(const glm::mat4& matrix);
29
30 protected:
34
35
36 glm::vec3 mTranslation = {};
37 glm::quat mRotation = {};
38 glm::vec3 mScale = glm::vec3(1.f);
39 glm::mat4 mLocalMatrix = glm::mat4(1.f);
40 glm::mat4 mGlobalMatrix = glm::mat4(1.f);
41 bool mStatic = false;
42 bool mLocalMatrixFixed = false;
43 bool mDirty = true;
44 };
45} // namespace foray::scene::ncomp
Definition foray_component.hpp:82
Defines a nodes transform relative to its parent (or world origin, if no parent is set)
Definition foray_transform.hpp:9
glm::mat4 mLocalMatrix
Definition foray_transform.hpp:39
bool mDirty
Definition foray_transform.hpp:43
void SetLocalMatrix(const glm::mat4 &matrix)
bool mLocalMatrixFixed
Definition foray_transform.hpp:42
glm::mat4 mGlobalMatrix
Definition foray_transform.hpp:40
const glm::mat4 & GetGlobalMatrix()
void SetScale(const glm::vec3 &scale)
void SetTranslation(const glm::vec3 &translation)
glm::quat mRotation
Definition foray_transform.hpp:37
glm::vec3 mTranslation
Definition foray_transform.hpp:36
void SetRotation(const glm::quat &rotation)
bool mStatic
Definition foray_transform.hpp:41
void RecalculateIfDirty(bool recursive=false)
Transform()
Definition foray_transform.hpp:11
glm::vec3 mScale
Definition foray_transform.hpp:38
#define FORAY_GETTER_V(member)
Return value.
Definition foray_basics.hpp:39
#define FORAY_GETTER_R(member)
Shorthand for mutable & constant reference getters.
Definition foray_basics.hpp:75
#define FORAY_PROPERTY_V(member)
Getter+Setter shorthand for value types.
Definition foray_basics.hpp:81
Definition foray_scene_declares.hpp:10