码迷,mamicode.com
首页 > 其他好文 > 详细

BSP地图文件格式

时间:2015-04-11 06:41:56      阅读:383      评论:0      收藏:0      [点我收藏+]

标签:quake3 bsp地图文件

参考:http://www.cnblogs.com/zengqh/archive/2012/08/03/2621307.html 及irrlicht0.1源代码CQ3LevelMesh

struct tBSPHeader
{
    s32 strID;         // This should always be ‘IBSP‘
    s32 version;       // This should be 0x2e for Quake 3 files
};

Entities(实体)

存储了地图相关的信息,包括地图名称、武器、盔甲、HP等,这个块只包含一条信息,即一个包含以上所有信息的字符串string,字符串长度即lump 结构体的length。

Textures

存储了依次和face、brush、brushside相关的表面、体积信息


string[64] name纹理名称
int flagsSurface flags.
int contentsContent flags.
Planes(平面)


存储了依次与node、brushside相关的平面集合


float[3] normal平面法向量
float dist从原点到平面的距离
Nodes


存储了地图BSP树的所有内部节点,第一个节点是根节点


int plane平面的索引
int[2] children左、右孩子节点的索引,负值表示叶子节点:-(leaf+1)
int[3] minsInteger bounding box min coord.
int[3] maxsInteger bounding box max coord.
Leafs


存储了地图BSP数的所有叶子节点,是一个凸区域,其中包含了可视性cluster、需要渲染的表面列表、用于碰撞检测的brush.


int clusterVisdata cluster index.
int areaAreaportal area.
int[3] minsInteger bounding box min coord.
int[3] maxsInteger bounding box max coord.
int leafface第一个面在叶面数组中的索引
int n_leaffaces包含的面数量
int leafbrush第一个叶brush在叶brush数组中的索引
int n_leafbrushes包含的brush数量
Leaffaces


存储了面索引的列表,一个叶子一个列表

int faceFace index.

Leafbrushes

存储了brush索引的列表,一个叶子一个列表

int brushBrush index.

Models

存储了所有的几何体,第一模型是地图的基本部分,其余为地图中可以移动部分,如门、平台、按钮


float[3] minsBounding box min coord.
float[3] maxsBounding box max coord.
int face第一个面的索引
int n_faces面数
int brush第一个brush的索引
int n_brushesbrush数
Brushes


每一个brush描述了一个由包围面定义的凸面体


int brushside第一个包围面的索引
int n_brushsides包围面数
int textureTexture index.
Brushsides


定义了brush的包围面

int planePlane index.
int textureTexture index.

Vertexes

存储了描述面的顶点信息

float[3] positionVertex position.
float[2][2] texcoordVertex texture coordinates. 0=surface, 1=lightmap.
float[3] normalVertex normal.
ubyte[4] colorVertex color. RGBA.

Meshverts

存储用于描述三角形网格的顶点偏移列表


int offsetVertex index offset, relative to first vertex of corresponding face.

Effects

存储凸面体的着色器

string[64] nameEffect shader.
int brushBrush that generated this effect.
int unknownAlways 5, except in q3dm8, which has one effect with -1.

Faces

存储了地图中所有的表面信息

int textureTexture index.
int effect效果文件, or -1.
int type面类型. 1=polygon, 2=patch, 3=mesh, 4=billboard
int vertex面第一个顶点的索引
int n_vertexes顶点数
int meshvertIndex of first meshvert.
int n_meshvertsNumber of meshverts.
int lm_indexLightmap index.
int[2] lm_startCorner of this face‘s lightmap image in lightmap.(面lightmap在lightmap中的左下角)
int[2] lm_sizeSize of this face‘s lightmap image in lightmap.(面lightmap的宽高)
float[3] lm_originWorld space origin of lightmap.
float[2][3] lm_vecsWorld space lightmap s and t unit vectors.
float[3] normalSurface normal.
int[2] sizePatch dimensions.

Lightmaps

存储了光线映射纹理数据

ubyte[128][128][3] mapLightmap color data. RGB.

Lightvols

存储了光照信息

ubyte[3] ambientAmbient color component. RGB.
ubyte[3] directionalDirectional color component. RGB.
ubyte[2] dirDirection to light. 0=phi, 1=theta.

Visdata

存储了用位向量表示的cluster到cluster的可视信息。

int n_vecsNumber of vectors.
int sz_vecsSize of each vector, in bytes.
ubyte[n_vecs * sz_vecsvecsVisibility data. One bit per cluster per vector.




BSP地图文件格式

标签:quake3 bsp地图文件

原文地址:http://4902717.blog.51cto.com/4892717/1631105

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!