-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathComponentRectTransform.h
More file actions
67 lines (47 loc) · 1.46 KB
/
ComponentRectTransform.h
File metadata and controls
67 lines (47 loc) · 1.46 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
#ifndef __COMPONENTRECTTRANSFORM_H__
#define __COMPONENTRECTTRANSFORM_H__
#include "Component.h"
#include "MathGeoLib\include\MathGeoLib.h"
class ResourceFileMesh;
struct Mesh;
class ComponentRectTransform : public Component
{
private:
float3 global_position; // World position representation
float3 local_position; // Position representation;
float3 local_middle_position;
float2 rect_size; // RectTransform;
float3 size; // Size representation;
bool apply_transformation = false;
public:
ComponentRectTransform(ComponentType type, GameObject* game_object);
void GeneratePlane();
void Update();
void OnInspector(bool debug);
void CalculateFinalTransform();
void OnTransformModified();
math::float4x4 GetFinalTransform();
// Utilities
void Move(const float3 &movement);
Mesh* GetMesh();
bool ContainsPoint(const float2 &point) const;
// Setters / Getters
const float2 GetGlobalPos() const;
const float2 GetLocalPos() const;
void SetLocalPos(const float2 &local_pos);
void SetSize(const float2 &size);
void SetScale(const float2 &size);
void SetZPlane(float z);
float2 GetRectSize()const;
void ResizePlane();
// Save
void Save(Data& file)const;
void Load(Data& conf);
void Remove();
int order = 0; // Range 0 to 7
private:
ResourceFileMesh* plane = nullptr;
math::float4x4 transform_matrix = math::float4x4::identity;
math::float4x4 final_transform_matrix = math::float4x4::identity;
};
#endif __COMPONENTRECTTRANSFORM_H__