mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
|
Contains a list of loaded 3d objects in the game world and loads more objects. More...
#include <Objects.h>
Public Member Functions | |
~Objects (void) | |
The destructor clears the object list. | |
void | freeObject (unsigned int object) |
Frees one object. | |
void | loadObject (unsigned int object, std::string filename, float factor) |
Loads an object from a file to a given position into the object list. | |
void | reserve (unsigned int count) |
Reserves space for some objects. | |
GLuint | getDisplayList (unsigned int object) |
Returns the display list that was created for an object. | |
Vector3 | getObjectView (unsigned int object) |
Returns the view assigned to an object. | |
Static Public Member Functions | |
static Objects * | getObjects (void) |
The public access for the singleton object. | |
Contains a list of loaded 3d objects in the game world and loads more objects.
Can load objects from 3d studio files. The objects are loaded and then stored in an OpenGL display list. The class acts as a singleton because each object file has to be loaded only once, regardless how often the object is used in the actual scene.
Objects::~Objects | ( | void | ) |
The destructor clears the object list.
Definition at line 45 of file Objects.cpp.
void Objects::freeObject | ( | unsigned int | object | ) |
Frees one object.
Reset the object to the initial values, that means the object is set to an object named '1-'. This value should be used to test if the object exists the display list can't be set to an invalid value and it's not easy to check if the view is invalid. Same for the string.
object | the object that is to be deleted |
Definition at line 107 of file Objects.cpp.
GLuint Objects::getDisplayList | ( | unsigned int | object | ) |
Returns the display list that was created for an object.
object | the object |
Definition at line 150 of file Objects.cpp.
|
static |
The public access for the singleton object.
If accessed the first time a new instance is created, otherwise the old instance is returned.
Definition at line 29 of file Objects.cpp.
Vector3 Objects::getObjectView | ( | unsigned int | object | ) |
Returns the view assigned to an object.
object | the object |
Definition at line 161 of file Objects.cpp.
void Objects::loadObject | ( | unsigned int | object, |
std::string | filename, | ||
float | factor | ||
) |
Loads an object from a file to a given position into the object list.
object | number of the object |
filename | filename of the object file |
factor | the factor by which the loaded object is stretched |
Definition at line 56 of file Objects.cpp.
void Objects::reserve | ( | unsigned int | objectCount | ) |
Reserves space for some objects.
Reserves space in order to save objects and spare some time because the vector does not need to resize itself. The objects are initialized with the * ball object.
objectCount | maximal count of objects |
Definition at line 130 of file Objects.cpp.