Support for loading and extracting data from a Quake3 level file. More...
#include <OgreQuake3Level.h>
Public Member Functions | |
Quake3Level () | |
void | dumpContents (void) |
Debug method. More... | |
void | extractLightmaps (void) const |
void * | getLump (int lumpType) |
Utility function to return a pointer to a lump. More... | |
int | getLumpSize (int lumpType) |
void | initialise (bool headerOnly=false) |
Utility function read the header and set up pointers. More... | |
void | initialiseCounts (void) |
Utility function read the header and set up counters. More... | |
void | initialisePointers (void) |
Utility function read the header and set up pointers. More... | |
void | loadFromStream (DataStreamPtr &inStream) |
Reads Quake3 bsp data from a stream as read from the file. More... | |
void | loadHeaderFromStream (DataStreamPtr &inStream) |
Load just the header information from a Quake3 file. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
Public Attributes | |
bsp_brush_t * | mBrushes |
bsp_brushside_t * | mBrushSides |
MemoryDataStreamPtr | mChunk |
int * | mElements |
void * | mEntities |
bsp_face_t * | mFaces |
bsp_header_t * | mHeader |
int * | mLeafBrushes |
int * | mLeafFaces |
bsp_leaf_t * | mLeaves |
unsigned char * | mLightmaps |
unsigned char * | mLumpStart |
bsp_model_t * | mModels |
bsp_node_t * | mNodes |
int | mNumBrushes |
int | mNumBrushSides |
int | mNumElements |
int | mNumEntities |
int | mNumFaces |
int | mNumLeafBrushes |
int | mNumLeafFaces |
int | mNumLeaves |
int | mNumLightmaps |
int | mNumModels |
int | mNumNodes |
int | mNumPlanes |
int | mNumShaders |
int | mNumVertices |
bsp_plane_t * | mPlanes |
bsp_shader_t * | mShaders |
bsp_vertex_t * | mVertices |
bsp_vis_t * | mVis |
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 necessarily 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.
Definition at line 62 of file OgreQuake3Level.h.
Ogre::Quake3Level::Quake3Level | ( | ) |
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 | ( | bool | headerOnly = false | ) |
Utility function read the header and set up pointers.
void Ogre::Quake3Level::initialiseCounts | ( | void | ) |
Utility function read the header and set up counters.
void Ogre::Quake3Level::initialisePointers | ( | void | ) |
Utility function read the header and set up pointers.
void Ogre::Quake3Level::loadFromStream | ( | DataStreamPtr & | inStream | ) |
Reads Quake3 bsp data from a stream 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)
inStream | Stream containing Quake3 data |
void Ogre::Quake3Level::loadHeaderFromStream | ( | DataStreamPtr & | inStream | ) |
Load just the header information from a Quake3 file.
|
inlineinherited |
Definition at line 96 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 102 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 108 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 113 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 119 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 68 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 73 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 79 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 86 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 91 of file OgreMemoryAllocatedObject.h.
bsp_brush_t* Ogre::Quake3Level::mBrushes |
Definition at line 152 of file OgreQuake3Level.h.
bsp_brushside_t* Ogre::Quake3Level::mBrushSides |
Definition at line 155 of file OgreQuake3Level.h.
MemoryDataStreamPtr Ogre::Quake3Level::mChunk |
Definition at line 111 of file OgreQuake3Level.h.
int* Ogre::Quake3Level::mElements |
Definition at line 117 of file OgreQuake3Level.h.
void* Ogre::Quake3Level::mEntities |
Definition at line 120 of file OgreQuake3Level.h.
bsp_face_t* Ogre::Quake3Level::mFaces |
Definition at line 138 of file OgreQuake3Level.h.
bsp_header_t* Ogre::Quake3Level::mHeader |
Definition at line 114 of file OgreQuake3Level.h.
int* Ogre::Quake3Level::mLeafBrushes |
Definition at line 158 of file OgreQuake3Level.h.
int* Ogre::Quake3Level::mLeafFaces |
Definition at line 132 of file OgreQuake3Level.h.
bsp_leaf_t* Ogre::Quake3Level::mLeaves |
Definition at line 129 of file OgreQuake3Level.h.
unsigned char* Ogre::Quake3Level::mLightmaps |
Definition at line 147 of file OgreQuake3Level.h.
unsigned char* Ogre::Quake3Level::mLumpStart |
Definition at line 115 of file OgreQuake3Level.h.
bsp_model_t* Ogre::Quake3Level::mModels |
Definition at line 123 of file OgreQuake3Level.h.
bsp_node_t* Ogre::Quake3Level::mNodes |
Definition at line 126 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumBrushes |
Definition at line 153 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumBrushSides |
Definition at line 156 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumElements |
Definition at line 118 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumEntities |
Definition at line 121 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumFaces |
Definition at line 139 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumLeafBrushes |
Definition at line 159 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumLeafFaces |
Definition at line 133 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumLeaves |
Definition at line 130 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumLightmaps |
Definition at line 148 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumModels |
Definition at line 124 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumNodes |
Definition at line 127 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumPlanes |
Definition at line 136 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumShaders |
Definition at line 145 of file OgreQuake3Level.h.
int Ogre::Quake3Level::mNumVertices |
Definition at line 142 of file OgreQuake3Level.h.
bsp_plane_t* Ogre::Quake3Level::mPlanes |
Definition at line 135 of file OgreQuake3Level.h.
bsp_shader_t* Ogre::Quake3Level::mShaders |
Definition at line 144 of file OgreQuake3Level.h.
bsp_vertex_t* Ogre::Quake3Level::mVertices |
Definition at line 141 of file OgreQuake3Level.h.
bsp_vis_t* Ogre::Quake3Level::mVis |
Definition at line 150 of file OgreQuake3Level.h.