#include <cWorld.h>
Classes | |
struct | rGroup |
Object Group - as for now intended for messaging maillist-groups. More... | |
struct | rMessage |
Sent messages. More... | |
Public Member Functions | |
OID | getOID () |
Returns the Object ID valid for this instant's time & deltacycle. | |
void | sendMessage (OID sender, OID groupid, const char *format,...) |
void | sendMessageT (OID sender, OID groupid, const char *text, void *blob=NULL) |
void | spawnObject (cObject *object) |
void | fragObject (cObject *object) |
void | bagFragged () |
void | advanceTime (int deltamsec) |
Advance simulation time for one frame. | |
void | clusterObjects () |
Re-build spatial clustering of objects. | |
void | dispatchMessages () |
Deliver overdue messages to objects. | |
void | animateObjects () |
Let all objects process input, adjust pose and calculate physics. | |
void | transformObjects () |
Let all objects calculate transformation matrices etc. | |
void | drawBack () |
Draws background (skybox) by calling mBackground drawing method. | |
void | drawSolid (cObject *camera, std::list< cObject * > *objects=NULL) |
Draw all Object's solid surfaces (calls their drawSolid method). | |
void | drawEffect (cObject *camera, std::list< cObject * > *objects=NULL) |
Draw all Object's effects (calls their drawEffect method). | |
std::string | getNames (std::list< cObject * > *objects=NULL) |
std::list< cObject * > * | filterByRole (cObject *ex, unsigned long rolemask, bool all, int maxamount, std::list< cObject * > *objects=NULL) |
std::list< cObject * > * | filterByRange (cObject *ex, float *origin, float minrange, float maxrange, int maxamount, std::list< cObject * > *objects=NULL) |
std::list< cObject * > * | filterByName (cObject *ex, char *name, int maxamount, std::list< cObject * > *objectlist=NULL) |
std::list< cObject * > * | filterByBeam (cObject *ex, float *pointa, float *pointb, float radius, int maxamount, std::list< cObject * > *objects=NULL) |
Public Attributes | |
std::priority_queue< rMessage *, std::vector< rMessage * > , cWorld::rMessage > | mMessages |
Not yet dispatched messages (because they are not yet overdue). | |
std::list< rMessage * > | mDispatchedMessages |
std::map< OID, rGroup * > | mGroups |
cBackground * | mBackground |
Background Object. | |
cMission * | mMission |
Mission Setup and Objective-Controller. | |
std::vector< float > | mGravity |
Gravity acceleration vector [m/s²]. space = (0,0,0), earth = (0,-9.8,0). | |
float | mAirdensity |
Air density in kg per cubic meter (default 1.204 kg/m3 Air at 20°C). | |
float | mGndfriction |
Velocity "damping" when on ground (0.14 ok). | |
std::map< OID, cObject * > | mIndex |
Object-ID (OID) to Object-Reference (non-fragged). | |
std::list< cObject * > | mObjects |
Contains non-fragged objects. | |
std::list< cObject * > | mCorpses |
Contains fragged objects. | |
kdtree< cObject * > * | mCluster |
Allows searching the world in a structured manner. | |
float | mViewdistance |
Render only objects that far away. | |
unsigned int | mYear |
Counts years of simulation universe. | |
unsigned int | mDay |
Counts 366-Days of simulation year (0-365). | |
unsigned int | mHour |
Counts 24-Hours of simulation day (0-23). | |
unsigned int | mMinute |
Counts minutes of simulation hour. | |
unsigned int | mSecond |
Counts seconds of simulation minute. | |
unsigned int | mMSec |
Micro-Seconds, incremented by delta at every simulation timestep. | |
unsigned int | mFrame |
Incremented at every simulation timestep and reset on each second. | |
unsigned int | mDeltacycle |
Incremented for noteable events (eg. OID consumption). Reset each frame. | |
float | mSPF |
seconds per frame = 1.0f/mFPS. | |
float | mFPS |
frames per second = 1.0f/mSPF. | |
Static Public Attributes | |
static cWorld * | instance = NULL |
The Game-Object-Managing World-Database-Class. Cares about spawning, indexing, searching, messaging, updating, rendering.
void cWorld::bagFragged | ( | ) |
Deletes fragged objects from Corpse-List. Possibly called very rarely within a Mission at transitional moments. This is like garbage collection on demand.
std::list< cObject * > * cWorld::filterByBeam | ( | cObject * | ex, | |
float * | pointa, | |||
float * | pointb, | |||
float | radius, | |||
int | maxamount, | |||
std::list< cObject * > * | objects = NULL | |||
) |
Returns a List of objects whose bounding volume (approximately) intersects with the cylinder described by the volume of a certain diameter around a line. The returned list is fresh allocated - caller delete responsibility.
std::list< cObject * > * cWorld::filterByName | ( | cObject * | ex, | |
char * | name, | |||
int | maxamount, | |||
std::list< cObject * > * | objectlist = NULL | |||
) |
Returns a List of objects which have the specified name. The returned list is fresh allocated - caller delete responsibility.
std::list< cObject * > * cWorld::filterByRange | ( | cObject * | ex, | |
float * | origin, | |||
float | minrange, | |||
float | maxrange, | |||
int | maxamount, | |||
std::list< cObject * > * | objects = NULL | |||
) |
Returns a List of objects which are within minimum and maximum range (excluding ex Object). The returned list is fresh allocated - caller delete responsibility.
std::list< cObject * > * cWorld::filterByRole | ( | cObject * | ex, | |
unsigned long | rolemask, | |||
bool | all, | |||
int | maxamount, | |||
std::list< cObject * > * | objects = NULL | |||
) |
Filters the given objectlist (or all mObjects if NULL) by roles (ORed Bitmask) (excluding ex Object). There is the option to match all roles (true=AND) or to select any given role (false=OR). The returned list is fresh allocated - caller delete responsibility.
void cWorld::fragObject | ( | cObject * | object | ) |
Removes object from active world (mObjects & mIndex), adds object to Corpse-List, adds cObject::FRAGGED role to object, finally object->onFragged() is called. Note that FRAGGED != DEAD objects: Dead objects are still part of the world but fragged objects are removed from the perceptible world. Fragged == removed and scheduled for deletion.
string cWorld::getNames | ( | std::list< cObject * > * | objects = NULL |
) |
Debug function to print out an object-list. With a parameter of NULL/no parameter at all prints all objects within the world. Warning: Printing all objects could lead to massive load on the console.
void cWorld::sendMessage | ( | OID | sender, | |
OID | groupid, | |||
const char * | format, | |||
... | ||||
) |
Messaging is not fully implemented at this point. Sent messages are currently collected with an attached timestamp.
sender | a value of 0 is anonymous. | |
group | is the group the message is sent to - 0 default group. | |
format | c printf formatted string format. | |
... | aditional parameters for formatted printing. |
void cWorld::sendMessageT | ( | OID | sender, | |
OID | groupid, | |||
const char * | text, | |||
void * | blob = NULL | |||
) |
Messaging is not fully implemented at this point. Sent messages are currently collected with an attached timestamp.
sender | a value of 0 currently defines a broadcast. | |
group | is the group the message is sent to - 0 default group. | |
text | the message subject/text to send, will be copied to string. | |
blob | binary data, you give away ownership may be deleted by world. |
void cWorld::spawnObject | ( | cObject * | object | ) |
Pastes object into active world (mObjects & mIndex), assigns serial OID, increments delta cycle, finally calls object->onSpawn().
cWorld * cWorld::instance = NULL [static] |
The current World instance (singleton) other objects may only affect that current instance.
std::map<OID, rGroup*> cWorld::mGroups |
Maps groupid to group - note that objectids "may" be used as "owners". Group 0 is initialized as default or broadcast group.