mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
Implements a simple spinning object. More...
#include <SpinningObject.h>
Public Member Functions | |
SpinningObject () | |
SpinningObject (Vector3 position) | |
SpinningObject (GLfloat x, GLfloat y, GLfloat z) | |
~SpinningObject (void) | |
void | setAxis (Vector3 axis) |
void | setAxis (float x, float y, float z) |
void | setSpeed (float speed) |
void | spin (void) |
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. | |
Implements a simple spinning object.
It has a position since it is derived from GameObject. To allow rotating it has an axis around which the object can rotate and a speed.
Definition at line 18 of file SpinningObject.h.
SpinningObject::SpinningObject | ( | ) |
Initializes the object with position in the origin and y-axis as axis of rotation.
Definition at line 12 of file SpinningObject.cpp.
SpinningObject::SpinningObject | ( | Vector3 | position | ) |
Initializes the object at given position and with y-axis as axis of rotation
position | position as Vector3 |
Definition at line 23 of file SpinningObject.cpp.
SpinningObject::SpinningObject | ( | GLfloat | x, |
GLfloat | y, | ||
GLfloat | z | ||
) |
Initializes the object at given position and with y-axis as axis of rotation
x | the x-position |
y | the y-position |
z | the z-position |
Definition at line 36 of file SpinningObject.cpp.
SpinningObject::~SpinningObject | ( | void | ) |
Destructor
Definition at line 46 of file SpinningObject.cpp.
void SpinningObject::setAxis | ( | Vector3 | axis | ) |
Sets the spin axis.
axis | the axis of rotation |
Definition at line 53 of file SpinningObject.cpp.
void SpinningObject::setAxis | ( | float | x, |
float | y, | ||
float | z | ||
) |
Sets the spin axis.
x | the x-coordinate of the axis of rotation |
y | the y-coordinate of the axis of rotation |
z | the z-coordinate of the axis of rotation |
Definition at line 63 of file SpinningObject.cpp.
void SpinningObject::setSpeed | ( | float | speed | ) |
void SpinningObject::spin | ( | void | ) |
Rotates the object using the glRotate*() function.
Definition at line 80 of file SpinningObject.cpp.