Plasma Engine  2.0
Loading...
Searching...
No Matches
OrthoGizmoContext.h
1#pragma once
2
3#include <EditorFramework/Gizmos/GizmoBase.h>
4#include <EditorFramework/InputContexts/EditorInputContext.h>
5#include <QPoint>
6
7class QWidget;
8class plCamera;
9
10class PL_EDITORFRAMEWORK_DLL plOrthoGizmoContext : public plEditorInputContext
11{
12 PL_ADD_DYNAMIC_REFLECTION(plOrthoGizmoContext, plEditorInputContext);
13
14public:
15 plOrthoGizmoContext(plQtEngineDocumentWindow* pOwnerWindow, plQtEngineViewWidget* pOwnerView, const plCamera* pCamera);
16
17 void SetWindowConfig(const plVec2I32& vViewport) { m_vViewport = vViewport; }
18
19 virtual void FocusLost(bool bCancel);
20
21 plEvent<const plGizmoEvent&> m_GizmoEvents;
22
23 const plVec3& GetTranslationResult() const { return m_vTranslationResult; }
24 const plVec3& GetTranslationDiff() const { return m_vTranslationDiff; }
25 const plQuat& GetRotationResult() const { return m_qRotationResult; }
26 float GetScalingResult() const { return m_fScalingResult; }
27
28protected:
29 virtual plEditorInput DoMousePressEvent(QMouseEvent* e) override;
30 virtual plEditorInput DoMouseReleaseEvent(QMouseEvent* e) override;
31 virtual plEditorInput DoMouseMoveEvent(QMouseEvent* e) override;
32
33 virtual void OnSetOwner(plQtEngineDocumentWindow* pOwnerWindow, plQtEngineViewWidget* pOwnerView) override {}
34
35private:
36 bool IsViewInOrthoMode() const;
37
38 plVec2I32 m_vLastMousePos;
39 plVec3 m_vUnsnappedTranslationResult;
40 plVec3 m_vTranslationResult;
41 plVec3 m_vTranslationDiff;
42 plAngle m_UnsnappedRotationResult;
43 plQuat m_qRotationResult;
44 float m_fScaleMouseMove;
45 float m_fScalingResult;
46 float m_fUnsnappedScalingResult;
47 bool m_bCanInteract;
48 const plCamera* m_pCamera;
49 plVec2I32 m_vViewport;
50};
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
A camera class that stores the orientation and some basic camera settings.
Definition Camera.h:41
Definition EditorInputContext.h:22
Definition Event.h:177
Definition OrthoGizmoContext.h:11
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