Plasma Engine  2.0
Loading...
Searching...
No Matches
GizmoHandle.h
1#pragma once
2
3#include <Core/World/GameObject.h>
4#include <EditorEngineProcessFramework/IPC/SyncObject.h>
5#include <Foundation/Math/Mat4.h>
6#include <ToolsFoundation/ToolsFoundationDLL.h>
7
8class plWorld;
10class plGizmo;
11
12class PL_EDITORENGINEPROCESSFRAMEWORK_DLL plGizmoHandle : public plEditorEngineSyncObject
13{
14 PL_ADD_DYNAMIC_REFLECTION(plGizmoHandle, plEditorEngineSyncObject);
15
16public:
18
19 plGizmo* GetOwnerGizmo() const { return m_pParentGizmo; }
20
21 void SetVisible(bool bVisible);
22
23 void SetTransformation(const plTransform& m);
24 void SetTransformation(const plMat4& m);
25
26 const plTransform& GetTransformation() const { return m_Transformation; }
27
28protected:
29 bool m_bVisible = false;
30 plTransform m_Transformation;
31
32 void SetParentGizmo(plGizmo* pParentGizmo) { m_pParentGizmo = pParentGizmo; }
33
34private:
35 plGizmo* m_pParentGizmo = nullptr;
36};
37
38
39enum plEngineGizmoHandleType
40{
41 Arrow,
42 Ring,
43 Rect,
44 LineRect,
45 Box,
46 Piston,
47 HalfPiston,
48 Sphere,
49 CylinderZ,
50 HalfSphereZ,
51 BoxCorners,
52 BoxEdges,
53 BoxFaces,
54 LineBox,
55 Cone,
56 Frustum,
57 FromFile,
58};
59
61{
62 using StorageType = plUInt8;
63
64 enum Enum
65 {
66 Default = 0,
67
68 ConstantSize = PL_BIT(0),
69 OnTop = PL_BIT(1),
70 Visualizer = PL_BIT(2),
71 ShowInOrtho = PL_BIT(3),
72 Pickable = PL_BIT(4),
73 FaceCamera = PL_BIT(5),
74 };
75
76 struct Bits
77 {
78 StorageType ConstantSize : 1;
79 StorageType OnTop : 1;
80 StorageType Visualizer : 1;
81 StorageType ShowInOrtho : 1;
82 StorageType Pickable : 1;
83 StorageType FaceCamera : 1;
84 };
85};
86
87PL_DECLARE_FLAGS_OPERATORS(plGizmoFlags);
88
89class PL_EDITORENGINEPROCESSFRAMEWORK_DLL plEngineGizmoHandle : public plGizmoHandle
90{
91 PL_ADD_DYNAMIC_REFLECTION(plEngineGizmoHandle, plGizmoHandle);
92
93public:
96
97 void ConfigureHandle(plGizmo* pParentGizmo, plEngineGizmoHandleType type, const plColor& col, plBitflags<plGizmoFlags> flags, const char* szCustomMesh = nullptr);
98
99 virtual bool SetupForEngine(plWorld* pWorld, plUInt32 uiNextComponentPickingID) override;
100 virtual void UpdateForEngine(plWorld* pWorld) override;
101
102 void SetColor(const plColor& col);
103
104protected:
105 bool m_bConstantSize = true;
106 bool m_bAlwaysOnTop = false;
107 bool m_bVisualizer = false;
108 bool m_bShowInOrtho = false;
109 bool m_bIsPickable = true;
110 bool m_bFaceCamera = false;
111 plInt32 m_iHandleType = -1;
112 plString m_sGizmoHandleMesh;
113 plGameObjectHandle m_hGameObject;
114 plGizmoComponent* m_pGizmoComponent = nullptr;
115 plColor m_Color = plColor::CornflowerBlue; /* The Original! */
116 plWorld* m_pWorld = nullptr;
117};
plColor represents an RGBA color in linear color space. Values are stored as float,...
Definition Color.h:44
static const plColor CornflowerBlue
#6495ED The original!
Definition Color.h:67
Definition SyncObject.h:11
Definition GizmoHandle.h:90
Used by the editor to render gizmo meshes.
Definition GizmoComponent.h:29
Definition GizmoHandle.h:13
Definition GizmoBase.h:25
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
The plBitflags class allows you to work with type-safe bitflags.
Definition Bitflags.h:82
A handle to a game object.
Definition Declarations.h:76
Definition GizmoHandle.h:77
Definition GizmoHandle.h:61