mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
Represents a basic drawable object. More...
#include <GraphicsObject.h>
Public Member Functions | |
GraphicsObject (void) | |
The constructor creates the object. | |
GraphicsObject (GLfloat r) | |
The constructor creates the object. | |
GraphicsObject (Vector3 position, float r) | |
Creates an graphical object. | |
GraphicsObject (float x, float y, float z, float r) | |
Creates a graphical object. | |
~GraphicsObject (void) | |
Destructor. | |
virtual void | draw (void)=0 |
float | getRadius (void) |
Returns the radius of the object, usable for view frustum culling. | |
float | getCollisionRadius (void) |
Returns the radius of the object, usable for collision detection. | |
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. | |
Represents a basic drawable object.
It's derived from GameObject and so has a position. A pure virtual function draw() is provided to use in drawing procedures. Also graphical objects have a radius which is supposed to be used in some tests, such as visibility and collision testing.
Definition at line 19 of file GraphicsObject.h.
GraphicsObject::GraphicsObject | ( | void | ) |
The constructor creates the object.
The position and radius are set to 0 by default.
Definition at line 14 of file GraphicsObject.cpp.
GraphicsObject::GraphicsObject | ( | GLfloat | r | ) |
The constructor creates the object.
The position is set to zero by default.
r | the objects radius |
Definition at line 23 of file GraphicsObject.cpp.
GraphicsObject::GraphicsObject | ( | Vector3 | position, |
float | r | ||
) |
Creates an graphical object.
Needed is the position and the radius. The radius is used for collision detection and the view frustum culling.
position | the position of the object in 3-dimensional space |
r | the radius of the object |
Definition at line 35 of file GraphicsObject.cpp.
GraphicsObject::GraphicsObject | ( | float | x, |
float | y, | ||
float | z, | ||
float | r | ||
) |
Creates a graphical object.
Needed is the position and the radius. The radius is used for collision detection and the view frustum culling.
x | the x-position of the object |
y | the x-position of the object |
z | the x-position of the object |
r | the radius of the object |
Definition at line 48 of file GraphicsObject.cpp.
GraphicsObject::~GraphicsObject | ( | void | ) |
Destructor.
Definition at line 55 of file GraphicsObject.cpp.
|
pure virtual |
Implemented in ModelObject, SpaceShip, SpaceStation, Planet, and abstract.
float GraphicsObject::getCollisionRadius | ( | void | ) |
Returns the radius of the object, usable for collision detection.
Definition at line 62 of file GraphicsObject.cpp.
float GraphicsObject::getRadius | ( | void | ) |
Returns the radius of the object, usable for view frustum culling.
This function is basically the same as getCollisionRadius( void ). It is used, because some objects (as Planet) have two kinds of radius which allows to have collisions in another area than the actual object's size.
Definition at line 73 of file GraphicsObject.cpp.