This class implements a generic 3D window. More...
#include "Generic3DWindow.hpp"
Classes | |
class | MouseControlT |
This class defines if and how the camera of the associated window is currently being controlled with the mouse. More... | |
Public Member Functions | |
Generic3DWindowT (wxWindow *Parent, CameraT *InitialCamera) | |
The constructor. More... | |
~Generic3DWindowT () | |
The destructor. More... | |
AxesInfoT | GetAxesInfo () const |
Returns the set of axes that the camera orientation is currently the closest to. More... | |
const CameraT & | GetCamera () const |
Returns the camera that is currently associated with this window. More... | |
void | SetCamera (CameraT *Camera) |
Sets Camera as the new camera to use for this window. More... | |
void | MoveCamera (const Vector3fT &NewPos) |
Moves the camera that is currently associated with this window to the given new position. More... | |
void | ProcessInput (float FrameTime) |
Processes the user input for the (last) frame with the given duration and updates the camera accordingly. More... | |
const MouseControlT & | GetMouseControl () const |
Returns the mouse control instance of this window. More... | |
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. More... | |
Vector3fT | WindowToWorld (const wxPoint &Pixel) const |
Transforms (unprojects) the given pixel from window space to the related point in world space. More... | |
wxPoint | WorldToWindow (const Vector3fT &v, bool CheckFrustum) const |
Transforms (projects) the given point from world space to the related pixel in the 3D window. More... | |
This class implements a generic 3D window.
It provides basic, common 3D window functionality that is independent from any editor.
Generic3DWindowT::Generic3DWindowT | ( | wxWindow * | Parent, |
CameraT * | InitialCamera | ||
) |
The constructor.
Generic3DWindowT::~Generic3DWindowT | ( | ) |
The destructor.
AxesInfoT Generic3DWindowT::GetAxesInfo | ( | ) | const |
Returns the set of axes that the camera orientation is currently the closest to.
|
inline |
Returns the camera that is currently associated with this window.
|
inline |
Returns the mouse control instance of this window.
void Generic3DWindowT::GetViewFrustum | ( | Plane3fT * | Planes, |
unsigned int | NumPlanes = 6 |
||
) | const |
Returns the view frustum for this window, based on its current window dimensions and camera setting.
void Generic3DWindowT::MoveCamera | ( | const Vector3fT & | NewPos | ) |
Moves the camera that is currently associated with this window to the given new position.
void Generic3DWindowT::ProcessInput | ( | float | FrameTime | ) |
Processes the user input for the (last) frame with the given duration and updates the camera accordingly.
void Generic3DWindowT::SetCamera | ( | CameraT * | Camera | ) |
Sets Camera as the new camera to use for this window.
Vector3fT Generic3DWindowT::WindowToWorld | ( | const wxPoint & | Pixel | ) | const |
Transforms (unprojects) the given pixel from window space to the related point in world space.
The returned point is located on the near clipping plane of this windows view pyramid/frustum. Therefore, "camera rays" are conveniently built through the two points GetCamera().Pos and WindowToWorld(Pixel). This method is "roughly" the inverse of WorldToWindow().
Pixel | The pixel to convert from window to world space. |
wxPoint Generic3DWindowT::WorldToWindow | ( | const Vector3fT & | v, |
bool | CheckFrustum | ||
) | const |
Transforms (projects) the given point from world space to the related pixel in the 3D window.
The transformation is not always reasonably possible, and therefore, if CheckFrustum is true (recommended), the method checks whether v is inside the view frustum first and returns (-1, -1) otherwise. If CheckFrustum is false, no view-frustum check is performed, with the potential negative consequences that can occur when performing the transformation stubbornly (divisions-by-zero, point behind the viewer yields valid window coordinates, etc.). This method is "roughly" the inverse of WindowToWorld().
v | The point to be transformed from world to window coordinates. |
CheckFrustum | Whether v should be tested against the current view frustum before the transformation. |