7 #ifndef CAFU_GENERIC_3D_WINDOW_HPP_INCLUDED
8 #define CAFU_GENERIC_3D_WINDOW_HPP_INCLUDED
10 #include "Math3D/Plane3.hpp"
11 #include "wx/glcanvas.h"
29 enum StateT { NOT_ACTIVE, ACTIVE_NORMAL, ACTIVE_ORBIT };
37 void Activate(StateT NewState,
const wxPoint& RefPt=wxDefaultPosition);
46 bool IsActive()
const {
return m_State!=NOT_ACTIVE; }
114 virtual Vector3fT GetRefPtWorld(
const wxPoint& RefPtWin)
const=0;
115 virtual void InfoCameraChanged()=0;
116 virtual void InfoRightMouseClick(wxMouseEvent& ME)=0;
118 enum RightMBStateT { RMB_UP_IDLE, RMB_DOWN_UNDECIDED, RMB_DOWN_DRAGGING };
122 MouseControlT m_MouseControl;
123 RightMBStateT m_RightMBState;
124 wxPoint m_RDownPosWin;
127 void OnKeyDown (wxKeyEvent& ME);
128 void OnKeyUp (wxKeyEvent& ME);
129 void OnMouseMiddleDown (wxMouseEvent& ME);
130 void OnMouseMiddleUp (wxMouseEvent& ME);
131 void OnMouseRightDown (wxMouseEvent& ME);
132 void OnMouseRightUp (wxMouseEvent& ME);
133 void OnMouseWheel (wxMouseEvent& ME);
134 void OnMouseMove (wxMouseEvent& ME);
135 void OnKillFocus (wxFocusEvent& FE);
136 void OnMouseCaptureLost(wxMouseCaptureLostEvent& ME);
138 DECLARE_EVENT_TABLE()
bool IsActive() const
Returns whether the mouse control is active; a shortcut for GetState()!=NOT_ACTIVE.
Definition: Generic3DWindow.hpp:46
const Vector3fT & GetRefPtWorld() const
Return the position of the reference point in world coordinates as set when the mouse control was act...
Definition: Generic3DWindow.hpp:52
Vector3fT WindowToWorld(const wxPoint &Pixel) const
Transforms (unprojects) the given pixel from window space to the related point in world space...
Definition: Generic3DWindow.cpp:415
const CameraT & GetCamera() const
Returns the camera that is currently associated with this window.
Definition: Generic3DWindow.hpp:74
const wxPoint & GetRefPtWin() const
Return the position of the reference point in window coordinates as set when the mouse control was ac...
Definition: Generic3DWindow.hpp:49
void GetViewFrustum(Plane3fT *Planes, unsigned int NumPlanes=6) const
Returns the view frustum for this window, based on its current window dimensions and camera setting...
Definition: Generic3DWindow.cpp:372
This class implements a camera.
Definition: Camera.hpp:17
wxPoint WorldToWindow(const Vector3fT &v, bool CheckFrustum) const
Transforms (projects) the given point from world space to the related pixel in the 3D window...
Definition: Generic3DWindow.cpp:443
Generic3DWindowT(wxWindow *Parent, CameraT *InitialCamera)
The constructor.
Definition: Generic3DWindow.cpp:80
This class defines if and how the camera of the associated window is currently being controlled with ...
Definition: Generic3DWindow.hpp:25
StateT GetState() const
Returns the state that the mouse control is currently in.
Definition: Generic3DWindow.hpp:43
void MoveCamera(const Vector3fT &NewPos)
Moves the camera that is currently associated with this window to the given new position.
Definition: Generic3DWindow.cpp:150
AxesInfoT GetAxesInfo() const
Returns the set of axes that the camera orientation is currently the closest to.
Definition: Generic3DWindow.cpp:134
void SetCamera(CameraT *Camera)
Sets Camera as the new camera to use for this window.
Definition: Generic3DWindow.cpp:143
This class describes how the three world-space axes are mapped to the two screen- or window-space axe...
Definition: AxesInfo.hpp:15
void Deactivate()
Deactivates the mouse control.
Definition: Generic3DWindow.cpp:49
const MouseControlT & GetMouseControl() const
Returns the mouse control instance of this window.
Definition: Generic3DWindow.hpp:86
This class implements a generic 3D window.
Definition: Generic3DWindow.hpp:20
void Activate(StateT NewState, const wxPoint &RefPt=wxDefaultPosition)
Activates the mouse control in the given state.
Definition: Generic3DWindow.cpp:30
~Generic3DWindowT()
The destructor.
Definition: Generic3DWindow.cpp:92
void ProcessInput(float FrameTime)
Processes the user input for the (last) frame with the given duration and updates the camera accordin...
Definition: Generic3DWindow.cpp:157