mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
Provides the basic functions for an moving object. More...
#include <MovingObject.h>
Public Member Functions | |
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. | |
Provides the basic functions for an moving object.
The provided functionalitys are speed controlling, advancing and rotating in some directions (yaw, pith, roll).
Definition at line 16 of file MovingObject.h.
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.
Definition at line 14 of file MovingObject.cpp.
MovingObject::MovingObject | ( | Vector3 | position | ) |
Constructor initializing to a given position as Vector3.
position | the eye position |
Definition at line 27 of file MovingObject.cpp.
MovingObject::MovingObject | ( | float | x, |
float | y, | ||
float | z | ||
) |
Constructor, the startposition is (x,y,z).
x | x-coordinate vor eye point |
y | y-coordinate for eye point |
z | z-coordinate for eye point |
Definition at line 42 of file MovingObject.cpp.
MovingObject::~MovingObject | ( | void | ) |
Destructor.
Definition at line 54 of file MovingObject.cpp.
void MovingObject::accelerate | ( | float | step | ) |
Sets the speed.
Positive values for acceleration, negative to decrease speed. Minimal and maximal speed are defined through the variables maxspeed and minspeed.
step | determines the value to accelerate, a length of stride factor |
Definition at line 115 of file MovingObject.cpp.
void MovingObject::advance | ( | float | t | ) |
Move the camera depending on the current speed and line of vision.
t | sets the time in milliseconds |
Definition at line 127 of file MovingObject.cpp.
float MovingObject::getMaxSpeed | ( | void | ) |
Returns the maximal speed.
Definition at line 134 of file MovingObject.cpp.
float MovingObject::getMinSpeed | ( | void | ) |
Returns the minimal speed.
Definition at line 141 of file MovingObject.cpp.
Vector3 MovingObject::getRight | ( | void | ) |
Returns the vector indiciating what is 'right' of the eye.
Definition at line 83 of file MovingObject.cpp.
float MovingObject::getSpeed | ( | void | ) |
Returns the vector indicating the direction 'right'.
Definition at line 148 of file MovingObject.cpp.
Vector3 MovingObject::getUp | ( | void | ) |
Returns the vector indication what is 'up'.
Definition at line 90 of file MovingObject.cpp.
Vector3 MovingObject::getView | ( | void | ) |
Returns the current viewing vector.
Definition at line 97 of file MovingObject.cpp.
void MovingObject::pitch | ( | float | angle | ) |
Pitches the line of vision.
Rotates it along the x-axis to look up or down.
angle | the angle of the rotation |
Definition at line 63 of file MovingObject.cpp.
void MovingObject::roll | ( | float | angle | ) |
Rolls the eye.
The up vector is rotated around the viewing vector.
angle | the angle of the rotation |
Definition at line 76 of file MovingObject.cpp.
void MovingObject::setMaxSpeed | ( | float | speed | ) |
Sets the maximal speed.
speed | determines the speed |
Definition at line 156 of file MovingObject.cpp.
void MovingObject::setMinSpeed | ( | float | speed | ) |
Sets the minimal speed.
speed | determines the speed |
Definition at line 164 of file MovingObject.cpp.
void MovingObject::setSpeed | ( | float | speed | ) |
void MovingObject::setStep | ( | float | step | ) |
Sets the value that is advanced in one step.
step | the stride |
Definition at line 185 of file MovingObject.cpp.
void MovingObject::setView | ( | Vector3 | v | ) |
Sets the current viewing vector.
Definition at line 104 of file MovingObject.cpp.