Skylicht Engine
Loading...
Searching...
No Matches
CTransformEuler.h
1/*
2!@
3MIT License
4
5Copyright (c) 2019 Skylicht Technology CO., LTD
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20This file is part of the "Skylicht Engine".
21https://github.com/skylicht-lab/skylicht-engine
22!#
23*/
24
25#pragma once
26
27#include "CTransform.h"
28
29namespace Skylicht
30{
46 class SKYLICHT_API CTransformEuler : public CTransform
47 {
48 protected:
49 core::vector3df m_position;
50 core::vector3df m_rotation;
51 core::vector3df m_scale;
52
53 core::matrix4 m_transform;
54
55 bool m_matrixChanged;
56
57 public:
58 CTransformEuler();
59
60 virtual ~CTransformEuler();
61
62 virtual void reset();
63
64 virtual void initComponent();
65
66 virtual void updateComponent();
67
68 public:
69
70 virtual core::vector3df getRelativePosition()
71 {
72 return m_position;
73 }
74
75 inline const core::vector3df& getPosition()
76 {
77 return m_position;
78 }
79
80 inline void setPosition(const core::vector3df& pos)
81 {
82 m_position = pos;
83 m_hasChanged = true;
84 m_matrixChanged = true;
85 }
86
87 inline const core::vector3df& getRotation()
88 {
89 return m_rotation;
90 }
91
92 inline const core::vector3df& getScale()
93 {
94 return m_scale;
95 }
96
97 inline void setScale(const core::vector3df& scale)
98 {
99 m_scale = scale;
100 m_hasChanged = true;
101 m_matrixChanged = true;
102 }
103
104 inline void setRotation(const core::vector3df& eulerDeg)
105 {
106 m_rotation = eulerDeg;
107 m_hasChanged = true;
108 m_matrixChanged = true;
109 }
110
111 void setRotation(const core::quaternion& q);
112
113 inline float getYaw()
114 {
115 return m_rotation.Y;
116 }
117
118 inline void setYaw(float deg)
119 {
120 m_rotation.Y = deg;
121 m_hasChanged = true;
122 m_matrixChanged = true;
123 }
124
125 inline float getPitch()
126 {
127 return m_rotation.X;
128 }
129
130 inline void setPitch(float deg)
131 {
132 m_rotation.X = deg;
133 m_hasChanged = true;
134 m_matrixChanged = true;
135 }
136
137 inline float getRoll()
138 {
139 return m_rotation.Z;
140 }
141
142 inline void setRoll(float deg)
143 {
144 m_rotation.Z = deg;
145 m_hasChanged = true;
146 m_matrixChanged = true;
147 }
148
149 void setOrientation(const core::vector3df& front, const core::vector3df& up);
150
151 void lookAt(const core::vector3df& position);
152
153 void getRotation(core::quaternion& q);
154
155 core::quaternion getRotationQuaternion();
156
157 void getFront(core::vector3df& front);
158
159 core::vector3df getFront();
160
161 void getUp(core::vector3df& up);
162
163 core::vector3df getUp();
164
165 void getRight(core::vector3df& right);
166
167 core::vector3df getRight();
168
169 virtual void setRelativeTransform(const core::matrix4& mat);
170
171 virtual const core::matrix4& getRelativeTransform();
172
173 virtual void getRelativeTransform(core::matrix4& matrix);
174
175 virtual CObjectSerializable* createSerializable();
176
177 virtual void loadSerializable(CObjectSerializable* object);
178
179 DECLARE_GETTYPENAME(CTransformEuler)
180 };
181}
Definition CObjectSerializable.h:36
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29