mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
CameraObject Class Reference

Extends the functionality of a MovingObject to the ones of a camera, usable in games. More...

#include <CameraObject.h>

Inheritance diagram for CameraObject:
MovingObject GameObject PlayerObject

Public Member Functions

 CameraObject (void)
 Initializes the camera residing in the center of the scene.
 
 CameraObject (Vector3 position)
 Initializes the eye with a given position but standard view direction.
 
 CameraObject (float x, float y, float z)
 Initializes the eye with a given position but standard view direction.
 
 ~CameraObject (void)
 Destructor.
 
bool isRearView (void)
 Checks, if rear view is enabled.
 
void look (void)
 Moves the camera to the position defined by eye and adjusts it to view to the correct position.
 
void toggleRearView (void)
 Switches to rear view and back to normal view.
 
void moveDown (float t)
 Moves the camera position downwards.
 
void moveLeft (float t)
 Moves the camera position to the left.
 
void moveRight (float t)
 Moves the camera position to the right.
 
void moveUp (float t)
 Moves the camera position upwards.
 
void setMoveSpeed (float t)
 Sets the speed for camera movement. speed the speed.
 
- Public Member Functions inherited from MovingObject
 MovingObject ()
 Constructor, initializes to the origin. The line of vision is aligned to the z axis, the up vector is aligned to the y-axis.
 
 MovingObject (Vector3 position)
 Constructor initializing to a given position as Vector3.
 
 MovingObject (float x, float y, float z)
 Constructor, the startposition is (x,y,z).
 
 ~MovingObject (void)
 Destructor.
 
void pitch (float angle)
 Pitches the line of vision.
 
void roll (float angle)
 Rolls the eye.
 
Vector3 getRight (void)
 Returns the vector indiciating what is 'right' of the eye.
 
Vector3 getUp (void)
 Returns the vector indication what is 'up'.
 
Vector3 getView (void)
 Returns the current viewing vector.
 
void setView (Vector3 v)
 Sets the current viewing vector.
 
void accelerate (float step)
 Sets the speed.
 
void advance (float t)
 Move the camera depending on the current speed and line of vision.
 
float getMaxSpeed (void)
 Returns the maximal speed.
 
float getMinSpeed (void)
 Returns the minimal speed.
 
float getSpeed (void)
 Returns the vector indicating the direction 'right'.
 
void setMaxSpeed (float speed)
 Sets the maximal speed.
 
void setMinSpeed (float speed)
 Sets the minimal speed.
 
void setSpeed (float speed)
 Sets the current speed.
 
void setStep (float step)
 Sets the value that is advanced in one step.
 
- Public Member Functions inherited from GameObject
 GameObject (void)
 The constructor creates the object. The position is set to zero by default.
 
 GameObject (Vector3 position)
 The constructor creates the object and gives it a position in the scene.
 
 GameObject (float x, float y, float z)
 The constructor creates the object and gives it a position in the scene.
 
 ~GameObject (void)
 Destructor. Does nothing.
 
virtual Vector3 getPos (void)
 Returns the current position as Vector3 triple.
 
void setPos (float x, float y, float z)
 Sets the current position.
 
void setPos (Vector3 position)
 Sets the current position.
 

Detailed Description

Extends the functionality of a MovingObject to the ones of a camera, usable in games.

It therefore adds a new type of moving: strafing. The camera allows to set up an projection using GLU functions, it also has the ability to change the direction of view dynamically, such as to look backwards. But it does not change anything in the actual displaying of the program, so if view frustum culling or something equivalent is used, the displayed items have to changed outside this class.

Definition at line 19 of file CameraObject.h.

Constructor & Destructor Documentation

CameraObject::CameraObject ( void  )

Initializes the camera residing in the center of the scene.

Start coordinates are (0,0,0) for the eye with view vector (0,0,1) and direction (0,1,0) for up. This equals a position in the center viewing along z-axis with y-axis pointing upwards.

Definition at line 15 of file CameraObject.cpp.

CameraObject::CameraObject ( Vector3  position)

Initializes the eye with a given position but standard view direction.

Start coordinate for the eye is given by position. The view vector is set to (0,0,1) and direction (0,1,0) is set for up. This equals a position in the center viewing along z-axis with y-axis pointing upwards.

Parameters
positionthe initial position of the eye

Definition at line 27 of file CameraObject.cpp.

CameraObject::CameraObject ( float  x,
float  y,
float  z 
)

Initializes the eye with a given position but standard view direction.

Start coordinate for the eye is given by coordinates in 3d space. The view vector is set to (0,0,1) and direction (0,1,0) is set for up. This equals a position in the center viewing along z-axis with y-axis pointing upwards.

Parameters
xx-coordinate for the eye
yy-coordinate for the eye
zz-coordinate for the eye

Definition at line 41 of file CameraObject.cpp.

CameraObject::~CameraObject ( void  )

Destructor.

Definition at line 49 of file CameraObject.cpp.

Member Function Documentation

bool CameraObject::isRearView ( void  )

Checks, if rear view is enabled.

Definition at line 56 of file CameraObject.cpp.

void CameraObject::look ( void  )

Moves the camera to the position defined by eye and adjusts it to view to the correct position.

Definition at line 65 of file CameraObject.cpp.

void CameraObject::moveDown ( float  t)

Moves the camera position downwards.

The factor specifies how much the camera is moved and is multiplicted with the current movement speed. In a dynamic situation it can be used to reflect passed time since the last update occured.

Parameters
ta factor for the distance

Definition at line 85 of file CameraObject.cpp.

void CameraObject::moveLeft ( float  t)

Moves the camera position to the left.

The factor specifies how much the camera is moved and is multiplicted with the current movement speed. In a dynamic situation it can be used to reflect passed time since the last update occured.

Parameters
ta factor for the distance

Definition at line 95 of file CameraObject.cpp.

void CameraObject::moveRight ( float  t)

Moves the camera position to the right.

The factor specifies how much the camera is moved and is multiplicted with the current movement speed. In a dynamic situation it can be used to reflect passed time since the last update occured.

Parameters
ta factor for the distance

Definition at line 105 of file CameraObject.cpp.

void CameraObject::moveUp ( float  t)

Moves the camera position upwards.

The factor specifies how much the camera is moved and is multiplicted with the current movement speed. In a dynamic situation it can be used to reflect passed time since the last update occured.

Parameters
ta factor for the distance

Definition at line 115 of file CameraObject.cpp.

void CameraObject::setMoveSpeed ( float  t)

Sets the speed for camera movement. speed the speed.

Definition at line 123 of file CameraObject.cpp.

void CameraObject::toggleRearView ( void  )

Switches to rear view and back to normal view.

Definition at line 75 of file CameraObject.cpp.


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