Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

GCE::Camera Class Reference

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

#include <Camera.h>

Inheritance diagram for GCE::Camera:

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

Collaboration graph
[legend]
List of all members.

Public Slots

virtual void setFrame (OpenGLFrame *frame)
virtual void setForm (GCS::GForm *form)
virtual void startCamera ()
virtual void stopCamera ()
virtual void setViewDistance (int new_distance_percent)

Public Member Functions

 Camera (OpenGLFrame *frame=NULL, GCS::GForm *form=NULL, QObject *parent=0, const char *name=0)
 ~Camera ()

Protected Member Functions

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

Protected Attributes

QTime KeyUpdateTime
OpenGLFrame * Frame
GFormForm
double ViewDistancePercent
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 OpenGLFrame 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 OpenGLFrame.


Constructor & Destructor Documentation

GCE::Camera::Camera OpenGLFrame *  frame = NULL,
GCS::GForm form = NULL,
QObject *  parent = 0,
const char *  name = 0
 

Constructor.

GCE::Camera::~Camera  ) 
 

Destructor.


Member Function Documentation

bool GCE::Camera::eventFilter QObject *  watched,
QEvent *  e
[protected, virtual]
 

Filters user input.

void GCE::Camera::run  )  [protected, virtual]
 

Periodically updates the view settings.

void GCE::Camera::setForm GCS::GForm form  )  [virtual, slot]
 

Sets the Form that will be followed with camera position.

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

void GCE::Camera::setFrame OpenGLFrame *  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::Camera::setViewDistance int  new_distance_percent  )  [virtual, slot]
 

Sets the ViewDistancePercent attribute.

See also:
ViewDistancePercent.

void GCE::Camera::startCamera  )  [virtual, slot]
 

Starts the camera thread.

void GCE::Camera::stopCamera  )  [virtual, slot]
 

Stops the camera thread.

Note:
Blocking call until camera thread is stopped.


Member Data Documentation

GForm* GCE::Camera::Form [protected]
 

The camera will track exactly this form in terms of position.

OpenGLFrame* GCE::Camera::Frame [protected]
 

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

QTime GCE::Camera::KeyUpdateTime [protected]
 

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

bool GCE::Camera::shutdown [protected]
 

If true then the thread will stop executing.

double GCE::Camera::speedx [protected]
 

Positive value means right.

double GCE::Camera::speedy [protected]
 

Positive value means up.

double GCE::Camera::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 Oct 21 21:18:18 2004 for G System by doxygen 1.3.6