Plasma Engine  2.0
Loading...
Searching...
No Matches
TranslateGizmo.h
1#pragma once
2
3#include <EditorEngineProcessFramework/Gizmos/GizmoHandle.h>
4#include <EditorFramework/Gizmos/GizmoBase.h>
5#include <QPoint>
6#include <ToolsFoundation/ToolsFoundationDLL.h>
7
8class PL_EDITORFRAMEWORK_DLL plTranslateGizmo : public plGizmo
9{
10 PL_ADD_DYNAMIC_REFLECTION(plTranslateGizmo, plGizmo);
11
12public:
14
15 const plVec3 GetStartPosition() const { return m_vStartPosition; }
16 const plVec3 GetTranslationResult() const { return GetTransformation().m_vPosition - m_vStartPosition; }
17 const plVec3 GetTranslationDiff() const { return m_vLastMoveDiff; }
18
19 enum class MovementMode
20 {
21 ScreenProjection,
22 MouseDiff
23 };
24
25 enum class PlaneInteraction
26 {
27 PlaneX,
28 PlaneY,
29 PlaneZ
30 };
31
32 enum class TranslateMode
33 {
34 None,
35 Axis,
36 Plane
37 };
38
39 void SetMovementMode(MovementMode mode);
40 PlaneInteraction GetLastPlaneInteraction() const { return m_LastPlaneInteraction; }
41 TranslateMode GetTranslateMode() const { return m_Mode; }
42
44 void SetCameraSpeed(float fSpeed);
45
46 virtual void UpdateStatusBarText(plQtEngineDocumentWindow* pWindow) override;
47
48protected:
49 virtual void DoFocusLost(bool bCancel) override;
50
51 virtual plEditorInput DoMousePressEvent(QMouseEvent* e) override;
52 virtual plEditorInput DoMouseReleaseEvent(QMouseEvent* e) override;
53 virtual plEditorInput DoMouseMoveEvent(QMouseEvent* e) override;
54
55 virtual void OnSetOwner(plQtEngineDocumentWindow* pOwnerWindow, plQtEngineViewWidget* pOwnerView) override;
56 virtual void OnVisibleChanged(bool bVisible) override;
57 virtual void OnTransformationChanged(const plTransform& transform) override;
58
59 plResult GetPointOnAxis(plInt32 iScreenPosX, plInt32 iScreenPosY, plVec3& out_Result) const;
60 plResult GetPointOnPlane(plInt32 iScreenPosX, plInt32 iScreenPosY, plVec3& out_Result) const;
61
62private:
63 plVec2I32 m_vLastMousePos;
64 plVec2 m_vTotalMouseDiff;
65
66 plVec3 m_vLastMoveDiff;
67
68 MovementMode m_MovementMode;
69 plEngineGizmoHandle m_hAxisX;
70 plEngineGizmoHandle m_hAxisY;
71 plEngineGizmoHandle m_hAxisZ;
72
73 plEngineGizmoHandle m_hPlaneXY;
74 plEngineGizmoHandle m_hPlaneXZ;
75 plEngineGizmoHandle m_hPlaneYZ;
76
77 TranslateMode m_Mode;
78 PlaneInteraction m_LastPlaneInteraction;
79
80 float m_fStartScale;
81 float m_fCameraSpeed;
82
83 plTime m_LastInteraction;
84 plVec3 m_vMoveAxis;
85 plVec3 m_vPlaneAxis[2];
86 plVec3 m_vStartPosition;
87 plMat4 m_mInvViewProj;
88};
Definition GizmoHandle.h:90
Definition GizmoBase.h:25
Base class for all document windows that need a connection to the engine process, and might want to r...
Definition EngineDocumentWindow.moc.h:37
Base class for views that show engine output.
Definition EngineViewWidget.moc.h:34
Definition TranslateGizmo.h:9
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12