-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathComponentTransform.h
More file actions
70 lines (51 loc) · 1.63 KB
/
ComponentTransform.h
File metadata and controls
70 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef __COMPONENT_TRANSFORM_H__
#define __COMPONENT_TRANSFORM_H__
#include "Component.h"
#include "MathGeoLib\include\MathGeoLib.h"
enum GuizmoOperation
{
TRANSLATE,
ROTATION,
SCALE
};
class ComponentTransform : public Component
{
public:
ComponentTransform(ComponentType type, GameObject* game_object, math::float4x4** global_matrix);
~ComponentTransform();
void Update();
void OnInspector(bool debug);
void SetPosition(const math::float3& pos);
void SetRotation(const math::float3 &rot_euler);
void SetRotation(const math::Quat& rot);
void SetScale(const math::float3& scale);
void Set(math::float4x4 matrix);
void SetGlobal(float4x4 global);
math::float3 GetPosition()const;
math::float3 GetRotationEuler()const;
math::Quat GetRotation()const;
math::float3 GetScale()const;
void Rotate(const math::Quat& quaternion);
math::float4x4 GetLocalTransformMatrix()const;
// Returns the final transformation matrix. Not the local one!
math::float4x4 GetTransformMatrix()const;
math::float4x4 GetGlobalMatrix()const;
math::float3 GetForward() const;
void Save(Data& file)const;
void Load(Data& conf);
void Reset();
void Remove();
void SaveAsPrefab(Data& file)const;
void UpdateMatrix();
private:
void CalculateFinalTransform();
private:
math::float3 position = math::float3::zero;
math::Quat rotation = math::Quat::identity;
math::float3 scale = math::float3::one;
math::float3 rotation_euler = math::float3::zero;
math::float4x4 transform_matrix = math::float4x4::identity;
math::float4x4 final_transform_matrix = math::float4x4::identity;
bool transform_modified = false;
};
#endif // !__COMPONENT_TRANSFORM_H__