Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::Quake3Level Class Reference

Support for loading and extracting data from a Quake3 level file. More...

#include <OgreQuake3Level.h>

List of all members.

Public Methods

 Quake3Level ()
void loadFromChunk (DataChunk &inChunk)
 Reads Quake3 bsp data from a chunk of memory as read from the file. More...

void extractLightmaps (void) const
void initialise (void)
 Utility function read the header and set up pointers. More...

void * getLump (int lumpType)
 Utility function to return a pointer to a lump. More...

int getLumpSize (int lumpType)
void dumpContents (void)
 Debug method. More...


Public Attributes

DataChunk mChunk
bsp_header_tmHeader
unsigned char * mLumpStart
int * mElements
int mNumElements
void * mEntities
int mNumEntities
bsp_model_tmModels
int mNumModels
bsp_node_tmNodes
int mNumNodes
bsp_leaf_tmLeaves
int mNumLeaves
int * mLeafFaces
int mNumLeafFaces
bsp_plane_tmPlanes
int mNumPlanes
bsp_face_tmFaces
int mNumFaces
bsp_vertex_tmVertices
int mNumVertices
bsp_shader_tmShaders
int mNumShaders
unsigned char * mLightmaps
int mNumLightmaps
bsp_vis_tmVis


Detailed Description

Support for loading and extracting data from a Quake3 level file.

This class implements the required methods for opening Quake3 level files and extracting the pertinent data within. Ogre supports BSP based levels through it's own BspLevel class, which is not specific to any file format, so this class is here to source that data from the Quake3 format. Quake3 levels include far more than just data for rendering - typically the leaves of the tree are used for rendering, and brushes, are used to define convex hulls made of planes for collision detection. There are also entities which define non-visual elements like player start points, triggers etc and models which are used for movable scenery like doors and platforms. Shaders meanwhile are textures with extra effects and 'content flags' indicating special properties like water or lava. I will try to support as much of this as I can in Ogre, but I won't duplicate the structure or necesarily use the same terminology. Quake3 is designed for a very specific purpose and code structure, whereas Ogre is designed to be more flexible, so for example I'm likely to separate game-related properties like surface flags from the generics of materials in my implementation. This is a utility class only - a single call to loadFromChunk should be enough. You should not expect the state of this object to be consistent between calls, since it uses pointers to memory which may no longer be valid after the original call. This is why it has no accessor methods for reading it's internal state.


Constructor & Destructor Documentation

Ogre::Quake3Level::Quake3Level  
 


Member Function Documentation

void Ogre::Quake3Level::dumpContents void   
 

Debug method.

void Ogre::Quake3Level::extractLightmaps void    const
 

void * Ogre::Quake3Level::getLump int    lumpType
 

Utility function to return a pointer to a lump.

int Ogre::Quake3Level::getLumpSize int    lumpType
 

void Ogre::Quake3Level::initialise void   
 

Utility function read the header and set up pointers.

void Ogre::Quake3Level::loadFromChunk DataChunk   inChunk
 

Reads Quake3 bsp data from a chunk of memory as read from the file.

Since ResourceManagers generally locate data in a variety of places they typically manipulate them as a chunk of data, rather than a file pointer since this is unsupported through compressed archives. Quake3 files are made up of a header (which contains version info and a table of the contents) and 17 'lumps' i.e. sections of data, the offsets to which are kept in the table of contents. The 17 types are predefined (You can find them in OgreQuake3Types.h)

Parameters:
inChunk  Input chunk of memory containing Quake3 data


Member Data Documentation

DataChunk Ogre::Quake3Level::mChunk
 

int* Ogre::Quake3Level::mElements
 

void* Ogre::Quake3Level::mEntities
 

bsp_face_t* Ogre::Quake3Level::mFaces
 

bsp_header_t* Ogre::Quake3Level::mHeader
 

int* Ogre::Quake3Level::mLeafFaces
 

bsp_leaf_t* Ogre::Quake3Level::mLeaves
 

unsigned char* Ogre::Quake3Level::mLightmaps
 

unsigned char* Ogre::Quake3Level::mLumpStart
 

bsp_model_t* Ogre::Quake3Level::mModels
 

bsp_node_t* Ogre::Quake3Level::mNodes
 

int Ogre::Quake3Level::mNumElements
 

int Ogre::Quake3Level::mNumEntities
 

int Ogre::Quake3Level::mNumFaces
 

int Ogre::Quake3Level::mNumLeafFaces
 

int Ogre::Quake3Level::mNumLeaves
 

int Ogre::Quake3Level::mNumLightmaps
 

int Ogre::Quake3Level::mNumModels
 

int Ogre::Quake3Level::mNumNodes
 

int Ogre::Quake3Level::mNumPlanes
 

int Ogre::Quake3Level::mNumShaders
 

int Ogre::Quake3Level::mNumVertices
 

bsp_plane_t* Ogre::Quake3Level::mPlanes
 

bsp_shader_t* Ogre::Quake3Level::mShaders
 

bsp_vertex_t* Ogre::Quake3Level::mVertices
 

bsp_vis_t* Ogre::Quake3Level::mVis
 

Copyright © 2002 by The OGRE Team