C# Класс Axiom.SceneManagers.Bsp.Quake3Level

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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
options BspOptions

Открытые методы

Метод Описание
DumpContents ( ) : void

Debug method.

ExtractLightmaps ( ) : void

Extracts the embedded lightmap texture data and loads them as textures.

Calling this method makes the lightmap texture data embedded in the .bsp file available to the renderer. Lightmaps are extracted and loaded as Texture objects (subclass specific to RenderSystem subclass) and are named "@lightmap1", "@lightmap2" etc.

Initialize ( ) : void

Utility function read the header.

Initialize ( bool headerOnly ) : void
LoadFromStream ( Stream inChunk ) : void

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.

LoadHeaderFromStream ( Stream inStream ) : void
Quake3Level ( BspOptions options ) : System

Защищенные методы

Метод Описание
InitializeCounts ( BinaryReader reader ) : void
InitializeData ( BinaryReader reader ) : void

Приватные методы

Метод Описание
ReadBrushSides ( InternalBspLump lump, BinaryReader reader ) : void
ReadBrushes ( InternalBspLump lump, BinaryReader reader ) : void
ReadElements ( InternalBspLump lump, BinaryReader reader ) : void
ReadEntities ( InternalBspLump lump, BinaryReader reader ) : void
ReadFaces ( InternalBspLump lump, BinaryReader reader ) : void
ReadLeafBrushes ( InternalBspLump lump, BinaryReader reader ) : void
ReadLeafFaces ( InternalBspLump lump, BinaryReader reader ) : void
ReadLeaves ( InternalBspLump lump, BinaryReader reader ) : void
ReadModels ( InternalBspLump lump, BinaryReader reader ) : void
ReadNodes ( InternalBspLump lump, BinaryReader reader ) : void
ReadPlanes ( InternalBspLump lump, BinaryReader reader ) : void
ReadShaders ( InternalBspLump lump, BinaryReader reader ) : void
ReadVertices ( InternalBspLump lump, BinaryReader reader ) : void
ReadVisData ( InternalBspLump lump, BinaryReader reader ) : void
Swap ( float &num1, float &num2 ) : void
Swap ( int &num1, int &num2 ) : void
TransformBoundingBox ( float bb ) : void
TransformBoundingBox ( int bb ) : void
TransformPlane ( float norm, float &dist ) : void
TransformVector ( float v ) : void
TransformVector ( float v, bool isNormal ) : void
TransformVector ( float v, bool isNormal, int pos ) : void
TransformVector ( float v, int pos ) : void

Описание методов

DumpContents() публичный метод

Debug method.
public DumpContents ( ) : void
Результат void

ExtractLightmaps() публичный метод

Extracts the embedded lightmap texture data and loads them as textures.
Calling this method makes the lightmap texture data embedded in the .bsp file available to the renderer. Lightmaps are extracted and loaded as Texture objects (subclass specific to RenderSystem subclass) and are named "@lightmap1", "@lightmap2" etc.
public ExtractLightmaps ( ) : void
Результат void

Initialize() публичный метод

Utility function read the header.
public Initialize ( ) : void
Результат void

Initialize() публичный метод

public Initialize ( bool headerOnly ) : void
headerOnly bool
Результат void

InitializeCounts() защищенный метод

protected InitializeCounts ( BinaryReader reader ) : void
reader System.IO.BinaryReader
Результат void

InitializeData() защищенный метод

protected InitializeData ( BinaryReader reader ) : void
reader System.IO.BinaryReader
Результат void

LoadFromStream() публичный метод

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.

public LoadFromStream ( Stream inChunk ) : void
inChunk Stream
Результат void

LoadHeaderFromStream() публичный метод

public LoadHeaderFromStream ( Stream inStream ) : void
inStream Stream
Результат void

Quake3Level() публичный метод

public Quake3Level ( BspOptions options ) : System
options BspOptions
Результат System

Описание свойств

options защищенное свойство

protected BspOptions,Axiom.SceneManagers.Bsp options
Результат BspOptions