📄 cbsplevel.h
字号:
/*
Class Name:
CBspLevel.
Created by:
Allen Sherrod (Programming Ace of www.UltimateGameProgramming.com).
Description:
This class represents a Quake3 3D map that can be rendered in OpenGL
or in Direct3D.
*/
#ifndef _CBSP_LEVEL_H_
#define _CBSP_LEVEL_H_
struct stTexCoord2
{
float tu, tv;
};
struct stPoint3D
{
float x, y, z;
};
enum enQ3LumpOffsets
{
iEnitiesOffset = 0,
iTextureOffset,
iPlanesOffset,
iNodesOffset,
iLeafOffset,
iLeafFacesOffset,
iLeafBrushesOffset,
iModelsOffset,
iBrushesOffset,
iBrushesSidesOffset,
iVerticesOffset,
iMeshVerticesOffset,
iShaderFilesOffset,
iFacesOffset,
iLightMapsOffset,
iLightVolumeOffset,
iVisibleDataOffset,
iMaxLumpsOffset
};
struct stQ3Header
{
char bspID[4];
int version;
};
struct stQ3FileLump
{
int offset;
int length;
};
struct stQ3Texture
{
char file[64];
int flags;
int contents;
};
struct stQ3Face
{
int texID;
int effect;
int type;
int startVertexIndex;
int totalVertices;
int meshVertexIndex;
int totalMeshVertices;
int lightmapID;
int lightMapCorner[2];
int lightMapSize[2];
stPoint3D lightMapPos;
stPoint3D lightMapVectors[2];
stPoint3D normal;
int size[2];
};
struct stQ3Vertex
{
stPoint3D vertex;
stTexCoord2 texCoord;
stTexCoord2 lightmapCoord;
stPoint3D normal;
unsigned char color[4];
};
struct stQ3LightMap
{
unsigned char lightMap[128][128][3];
};
class CBspLevel
{
public:
CBspLevel() : m_totalTextures(0), m_totalVertices(0),
m_totalLightMaps(0), m_totalFaces(0), m_faces(0),
m_vertices(0), m_textures(0), m_lightMaps(0) {}
~CBspLevel()
{
Shutdown();
}
bool LoadLevel(char *filename);
void SwapAxis();
void Shutdown();
int m_totalTextures;
int m_totalLightMaps;
int m_totalVertices;
int m_totalFaces;
stQ3Face *m_faces;
stQ3Vertex *m_vertices;
stQ3Texture *m_textures;
stQ3LightMap *m_lightMaps;
};
#endif
// Copyright December 2004
// All Rights Reserved!
// Allen Sherrod
// ProgrammingAce@UltimateGameProgramming.com
// www.UltimateGameProgramming.com
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -