forked from Shell4026/ShellEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditorControl.h
More file actions
54 lines (43 loc) · 927 Bytes
/
Copy pathEditorControl.h
File metadata and controls
54 lines (43 loc) · 927 Bytes
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
#pragma once
#include "Game/Component/Component.h"
#include "Game/Vector.h"
#include "glm/gtc/quaternion.hpp"
#ifdef None
#undef None
#endif
namespace sh::game
{
class Camera;
class LineRenderer;
class EditorControl : public Component
{
COMPONENT(EditorControl)
private:
enum class Mode
{
None, Move, Rotate, Scale
};
enum class Axis
{
None, X, Y, Z
};
Mode mode = Mode::None;
Axis axis = Axis::None;
PROPERTY(camera)
Camera* camera = nullptr;
PROPERTY(helper, core::PropertyOption::invisible)
LineRenderer* helper = nullptr;
Vec3 posLast, scaleLast;
glm::quat quatLast;
Vec2 clickPos;
Vec3 up, right, forward;
private:
inline void MoveControl();
inline void ScaleControl();
inline void RotateControl();
public:
SH_GAME_API EditorControl(GameObject& owner);
SH_GAME_API void Update() override;
SH_GAME_API void SetCamera(Camera* camera);
};
}//namespace