Ocular Engine
EditorCameraController.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_EDITOR_ROUTINE_EDITOR_CAMERA_CONTROLLER__H__
19 #define __H__OCULAR_EDITOR_ROUTINE_EDITOR_CAMERA_CONTROLLER__H__
20 
21 #include "Scene/ARoutine.hpp"
22 
23 //------------------------------------------------------------------------------------------
24 
29 namespace Ocular
30 {
31  namespace Core
32  {
33  class MouseScrollInputEvent;
34  }
35 
40  namespace Editor
41  {
42  class SceneObjectFocusedEvent;
43 
56  {
57  public:
58 
60  virtual ~EditorCameraController();
61 
62  //------------------------------------------------------------
63  // Inherited Methods
64  //------------------------------------------------------------
65 
66  virtual void onUpdate(float const delta) override;
67  virtual bool onEvent(std::shared_ptr<Core::AEvent> event) override;
68 
69  //------------------------------------------------------------
70  // Controller Specific Methods
71  //------------------------------------------------------------
72 
73  void setLookSensitivity(float sensitivity);
74  float getLookSensitivity() const;
75 
76  void setPanSensitivity(float sensitivity);
77  float getPanSensitivity() const;
78 
79  void setZoomSensitivity(float sensitivity);
80  float getZoomSensitivity() const;
81 
82  protected:
83 
84  void updateFocusMove(float const delta);
85  void updateCameraMode();
86 
87  void handleEventMouseScroll(Core::MouseScrollInputEvent* event);
88  void handleEventObjectFocused(SceneObjectFocusedEvent* event);
89 
90  void handleMouseMovement();
91  void handleMousePan();
92  void handleMouseDrag();
93  void handleMouseLook();
94  void handleMouseOrbit();
95 
96  private:
97 
98  int8_t m_Mode;
99 
100  float m_PanSensitivity;
101  float m_ZoomSensitivity;
102  float m_LookSensitivity;
103  float m_OrbitSensitivity;
104 
105  Math::Vector2i m_LastMousePos;
106  Math::Vector3f m_DeltaVector;
107  Math::Vector3f m_LookEuler;
108 
109  //------------------------------------------------------------
110  // Focus Update Variables
111 
112  bool m_IsMovingFocus;
113  float m_FocusElapsed;
114 
115  Math::Vector3f m_FocusStartPos;
116  Math::Vector3f m_FocusEndPos;
117 
118  float m_OrbitDistance;
119  };
120  }
124 }
129 //------------------------------------------------------------------------------------------
130 
131 #endif
virtual void onUpdate(float const delta) override
Definition: EditorCameraController.cpp:82
Definition: SceneObjectFocusedEvent.hpp:49
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
Definition: ARoutine.hpp:59
Definition: MouseScrollInputEvent.hpp:46
Definition: Vector2.hpp:44
Definition: EditorCameraController.hpp:55