Cafu Engine
Generic3DWindowT Class Referenceabstract

This class implements a generic 3D window. More...

#include "Generic3DWindow.hpp"

Inheritance diagram for Generic3DWindowT:

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 CameraTGetCamera () 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 MouseControlTGetMouseControl () 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...
 

Detailed Description

This class implements a generic 3D window.

It provides basic, common 3D window functionality that is independent from any editor.

Constructor & Destructor Documentation

Generic3DWindowT::Generic3DWindowT ( wxWindow *  Parent,
CameraT InitialCamera 
)

The constructor.

Generic3DWindowT::~Generic3DWindowT ( )

The destructor.

Member Function Documentation

AxesInfoT Generic3DWindowT::GetAxesInfo ( ) const

Returns the set of axes that the camera orientation is currently the closest to.

const CameraT& Generic3DWindowT::GetCamera ( ) const
inline

Returns the camera that is currently associated with this window.

const MouseControlT& Generic3DWindowT::GetMouseControl ( ) const
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().

Parameters
PixelThe pixel to convert from window to world space.
Returns
the pixel in world space coordinates.
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().

Parameters
vThe point to be transformed from world to window coordinates.
CheckFrustumWhether v should be tested against the current view frustum before the transformation.
Returns
the transformed point, or (-1, -1) if CheckFrustum was true and the v failed the test.

The documentation for this class was generated from the following files: