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 | Static Public Member Functions | List of all members
Objects Class Reference

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 ObjectsgetObjects (void)
 The public access for the singleton object.
 

Detailed Description

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.

Definition at line 26 of file Objects.h.

Constructor & Destructor Documentation

Objects::~Objects ( void  )

The destructor clears the object list.

Definition at line 45 of file Objects.cpp.

Member Function Documentation

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.

Parameters
objectthe 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.

Parameters
objectthe object

Definition at line 150 of file Objects.cpp.

Objects * Objects::getObjects ( void  )
static

The public access for the singleton object.

If accessed the first time a new instance is created, otherwise the old instance is returned.

Returns
the singleton instance

Definition at line 29 of file Objects.cpp.

Vector3 Objects::getObjectView ( unsigned int  object)

Returns the view assigned to an object.

Parameters
objectthe 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.

Parameters
objectnumber of the object
filenamefilename of the object file
factorthe 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.

Parameters
objectCountmaximal count of objects

Definition at line 130 of file Objects.cpp.


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