GCE::GCamera Class Reference

Listens for user input and changes the view accordingly. More...

#include <GCamera.h>

Inheritance diagram for GCE::GCamera:

Inheritance graph
[legend]
Collaboration diagram for GCE::GCamera:

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void update ()
virtual void setFrame (GOpenGLFrame *frame)
virtual void connectMoveAgent (GBE::GMoveAgent *agent)
virtual void formUpdated (const GCS::GForm &form)
virtual void startCamera ()
virtual void stopCamera ()
virtual void setViewDistance (int new_distance_percent)
virtual void setSpeedFactor (double speed_factor)

Signals

void action (const QString &actionname, QStringList params)

Public Member Functions

 GCamera (GOpenGLFrame *frame=NULL, QObject *parent=0)
 ~GCamera ()

Protected Member Functions

virtual bool eventFilter (QObject *watched, QEvent *e)

Protected Attributes

QTime KeyUpdateTime
GOpenGLFrameFrame
GCS::GForm Form
QMutex FormMutex
double ViewDistancePercent
double SpeedFactor
double speedx
double speedy
bool shutdown
bool left_key_down
bool right_key_down
bool up_key_down
bool down_key_down
bool space_key_down

Detailed Description

Listens for user input and changes the view accordingly.

Author:
Raphael Langerhorst
Listens for user input events and changes view parameters of an GOpenGLFrame object accordingly.

Currently it is very primitive and is intended to just meet the requirements of the demo application.

Todo:
The camera currently only works correctly when the attached form has no transformation from a parent element as the transformation is not recognised. Maybe this needs to be handled in GOpenGLFrame. DONE, but needs testing.
Todo:
do NOT depend / use GOpenGLFrame directly, instead use signals / slots where appropriate. (But how to handle key presses?)


Constructor & Destructor Documentation

GCE::GCamera::GCamera ( GOpenGLFrame frame = NULL,
QObject *  parent = 0 
)

Constructor.

GCE::GCamera::~GCamera (  ) 

Destructor.


Member Function Documentation

void GCE::GCamera::action ( const QString &  actionname,
QStringList  params 
) [signal]

Signal suitable to connect to GBE::GMoveAgent::performAction()

See also:
connectMoveAgent()

void GCE::GCamera::connectMoveAgent ( GBE::GMoveAgent agent  )  [virtual, slot]

Connects movement actions of the camera to the agent through the action interface.

bool GCE::GCamera::eventFilter ( QObject *  watched,
QEvent *  e 
) [protected, virtual]

Filters user input.

void GCE::GCamera::formUpdated ( const GCS::GForm form  )  [virtual, slot]

Updates the form that will be followed with camera position.

void GCE::GCamera::setFrame ( GOpenGLFrame frame  )  [virtual, slot]

Sets the OpenGL frame that the camera uses.

Note:
The Camera thread should NOT be running when changing this attribute.
See also:
Frame.

void GCE::GCamera::setSpeedFactor ( double  speed_factor  )  [virtual, slot]

Sets the speed factor.

See also:
SpeedFactor

void GCE::GCamera::setViewDistance ( int  new_distance_percent  )  [virtual, slot]

Sets the ViewDistancePercent attribute.

See also:
ViewDistancePercent.

void GCE::GCamera::startCamera (  )  [virtual, slot]

Starts the camera thread.

void GCE::GCamera::stopCamera (  )  [virtual, slot]

Stops the camera thread.

Note:
Blocking call until camera thread is stopped.

void GCE::GCamera::update (  )  [virtual, slot]

Updates the view settings.


Member Data Documentation

GCS::GForm GCE::GCamera::Form [protected]

The camera will track exactly this form in terms of position. It is usually updated through the formUpdated(const GCS::GForm&) slot.

QMutex GCE::GCamera::FormMutex [protected]

Used for locking the form to synchronize form updates.

GOpenGLFrame* GCE::GCamera::Frame [protected]

the Camera object will use this frame for setting the viewing properties.

QTime GCE::GCamera::KeyUpdateTime [protected]

Used to determine elapsed time to determine correct speed updates (when keys are pressed)

bool GCE::GCamera::shutdown [protected]

If true then the thread will stop executing.

double GCE::GCamera::SpeedFactor [protected]

Determines the actual speed of the camera.

double GCE::GCamera::speedx [protected]

Positive value means right.

double GCE::GCamera::speedy [protected]

Positive value means up.

double GCE::GCamera::ViewDistancePercent [protected]

This determines where the camera position is placed in relation to the targeted form. the given distance is multiplied with the (max) radius of the form to get the distance between view position and view target. A value of 100 would for example place the camera exactly at the border of the form, a value of 200 should give a nice view.


The documentation for this class was generated from the following files:
Generated on Thu Nov 16 07:49:27 2006 for G System by  doxygen 1.4.7