QuakeForge  0.7.2.210-815cf
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bspfile.h File Reference
This graph shows which files directly or indirectly include this file:

Data Structures

struct  bsp_s
 
struct  dclipnode_s
 
struct  dedge_s
 
struct  dface_s
 
struct  dheader_s
 
struct  dleaf_s
 
struct  dmiptexlump_s
 
struct  dmodel_s
 
struct  dnode_s
 
struct  dplane_s
 
struct  dvertex_s
 
struct  lump_s
 
struct  miptex_s
 
struct  texinfo_s
 

Macros

#define AMBIENT_LAVA   3
 
#define AMBIENT_SKY   1
 
#define AMBIENT_SLIME   2
 
#define AMBIENT_WATER   0
 
#define BSP2VERSION   "BSP2"
 
#define BSPVERSION   29
 
#define CONTENTS_CLIP   -8
 
#define CONTENTS_CURRENT_0   -9
 
#define CONTENTS_CURRENT_180   -11
 
#define CONTENTS_CURRENT_270   -12
 
#define CONTENTS_CURRENT_90   -10
 
#define CONTENTS_CURRENT_DOWN   -14
 
#define CONTENTS_CURRENT_UP   -13
 
#define CONTENTS_EMPTY   -1
 
#define CONTENTS_LAVA   -5
 
#define CONTENTS_ORIGIN   -7
 
#define CONTENTS_SKY   -6
 
#define CONTENTS_SLIME   -4
 
#define CONTENTS_SOLID   -2
 
#define CONTENTS_WATER   -3
 
#define HEADER_LUMPS   15
 
#define LUMP_CLIPNODES   9
 
#define LUMP_EDGES   12
 
#define LUMP_ENTITIES   0
 
#define LUMP_FACES   7
 
#define LUMP_LEAFS   10
 
#define LUMP_LIGHTING   8
 
#define LUMP_MARKSURFACES   11
 
#define LUMP_MODELS   14
 
#define LUMP_NODES   5
 
#define LUMP_PLANES   1
 
#define LUMP_SURFEDGES   13
 
#define LUMP_TEXINFO   6
 
#define LUMP_TEXTURES   2
 
#define LUMP_VERTEXES   3
 
#define LUMP_VISIBILITY   4
 
#define MAX_MAP_CLIPNODES   65520
 
#define MAX_MAP_FACES   65535
 
#define MAX_MAP_HULLS   4
 
#define MAX_MAP_LEAFS   65520
 
#define MAX_MAP_MARKSURFACES   65535
 
#define MAX_MAP_NODES   65520
 
#define MAX_MAP_PLANES   32767
 
#define MAX_MAP_VERTS   65535
 
#define MAXLIGHTMAPS   4
 
#define MIPLEVELS   4
 
#define MIPTEXNAME   16
 
#define NUM_AMBIENTS   4
 
#define PLANE_ANYX   3
 
#define PLANE_ANYY   4
 
#define PLANE_ANYZ   5
 
#define PLANE_X   0
 
#define PLANE_Y   1
 
#define PLANE_Z   2
 
#define Q2BSPVERSION   38
 
#define TEX_MISSING   2
 
#define TEX_SPECIAL   1
 
#define TOOLVERSION   2
 

Typedefs

typedef struct bsp_s bsp_t
 
typedef struct dclipnode_s dclipnode_t
 
typedef struct dedge_s dedge_t
 
typedef struct dface_s dface_t
 
typedef struct dheader_s dheader_t
 
typedef struct dleaf_s dleaf_t
 
typedef struct dmiptexlump_s dmiptexlump_t
 
typedef struct dmodel_s dmodel_t
 
typedef struct dnode_s dnode_t
 
typedef struct dplane_s dplane_t
 
typedef struct dvertex_s dvertex_t
 
typedef struct lump_s lump_t
 
typedef struct miptex_s miptex_t
 
typedef struct texinfo_s texinfo_t
 

Functions

void BSP_AddClipnode (bsp_t *bsp, const dclipnode_t *clipnode)
 
void BSP_AddEdge (bsp_t *bsp, const dedge_t *edge)
 
void BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize)
 
void BSP_AddFace (bsp_t *bsp, const dface_t *face)
 
void BSP_AddLeaf (bsp_t *bsp, const dleaf_t *leaf)
 
void BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize)
 
void BSP_AddMarkSurface (bsp_t *bsp, int marksurface)
 
void BSP_AddModel (bsp_t *bsp, const dmodel_t *model)
 
void BSP_AddNode (bsp_t *bsp, const dnode_t *node)
 
void BSP_AddPlane (bsp_t *bsp, const dplane_t *plane)
 
void BSP_AddSurfEdge (bsp_t *bsp, int surfedge)
 
void BSP_AddTexinfo (bsp_t *bsp, const texinfo_t *texinfo)
 
void BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize)
 
void BSP_AddVertex (bsp_t *bsp, const dvertex_t *vertex)
 
void BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize)
 
void BSP_Free (bsp_t *bsp)
 
bsp_tBSP_New (void)
 
bsp_tLoadBSPFile (QFile *file, size_t size)
 
bsp_tLoadBSPMem (void *mem, size_t size, void(*cb)(const bsp_t *, void *), void *cbdata)
 Create a bsp structure from a memory buffer. More...
 
void WriteBSPFile (const bsp_t *bsp, QFile *file)
 

Macro Definition Documentation

#define AMBIENT_LAVA   3
#define AMBIENT_SKY   1
#define AMBIENT_SLIME   2
#define AMBIENT_WATER   0
#define BSP2VERSION   "BSP2"
#define BSPVERSION   29
#define CONTENTS_CLIP   -8
#define CONTENTS_CURRENT_0   -9
#define CONTENTS_CURRENT_180   -11
#define CONTENTS_CURRENT_270   -12
#define CONTENTS_CURRENT_90   -10
#define CONTENTS_CURRENT_DOWN   -14
#define CONTENTS_CURRENT_UP   -13
#define CONTENTS_EMPTY   -1
#define CONTENTS_LAVA   -5
#define CONTENTS_ORIGIN   -7
#define CONTENTS_SKY   -6
#define CONTENTS_SLIME   -4
#define CONTENTS_SOLID   -2
#define CONTENTS_WATER   -3
#define HEADER_LUMPS   15
#define LUMP_CLIPNODES   9
#define LUMP_EDGES   12
#define LUMP_ENTITIES   0
#define LUMP_FACES   7
#define LUMP_LEAFS   10
#define LUMP_LIGHTING   8
#define LUMP_MARKSURFACES   11
#define LUMP_MODELS   14
#define LUMP_NODES   5
#define LUMP_PLANES   1
#define LUMP_SURFEDGES   13
#define LUMP_TEXINFO   6
#define LUMP_TEXTURES   2
#define LUMP_VERTEXES   3
#define LUMP_VISIBILITY   4
#define MAX_MAP_CLIPNODES   65520
#define MAX_MAP_FACES   65535
#define MAX_MAP_HULLS   4
#define MAX_MAP_LEAFS   65520
#define MAX_MAP_MARKSURFACES   65535
#define MAX_MAP_NODES   65520
#define MAX_MAP_PLANES   32767
#define MAX_MAP_VERTS   65535
#define MAXLIGHTMAPS   4
#define MIPLEVELS   4
#define MIPTEXNAME   16
#define NUM_AMBIENTS   4
#define PLANE_ANYX   3
#define PLANE_ANYY   4
#define PLANE_ANYZ   5
#define PLANE_X   0
#define PLANE_Y   1
#define PLANE_Z   2
#define Q2BSPVERSION   38
#define TEX_MISSING   2
#define TEX_SPECIAL   1
#define TOOLVERSION   2

Typedef Documentation

typedef struct bsp_s bsp_t
typedef struct dclipnode_s dclipnode_t
typedef struct dedge_s dedge_t
typedef struct dface_s dface_t
typedef struct dheader_s dheader_t
typedef struct dleaf_s dleaf_t
typedef struct dmiptexlump_s dmiptexlump_t
typedef struct dmodel_s dmodel_t
typedef struct dnode_s dnode_t
typedef struct dplane_s dplane_t
typedef struct dvertex_s dvertex_t
typedef struct lump_s lump_t
typedef struct miptex_s miptex_t
typedef struct texinfo_s texinfo_t

Function Documentation

void BSP_AddClipnode ( bsp_t bsp,
const dclipnode_t clipnode 
)
void BSP_AddEdge ( bsp_t bsp,
const dedge_t edge 
)
void BSP_AddEntities ( bsp_t bsp,
const char *  entdata,
size_t  entdatasize 
)
void BSP_AddFace ( bsp_t bsp,
const dface_t face 
)
void BSP_AddLeaf ( bsp_t bsp,
const dleaf_t leaf 
)
void BSP_AddLighting ( bsp_t bsp,
const byte lightdata,
size_t  lightdatasize 
)
void BSP_AddMarkSurface ( bsp_t bsp,
int  marksurface 
)
void BSP_AddModel ( bsp_t bsp,
const dmodel_t model 
)
void BSP_AddNode ( bsp_t bsp,
const dnode_t node 
)
void BSP_AddPlane ( bsp_t bsp,
const dplane_t plane 
)
void BSP_AddSurfEdge ( bsp_t bsp,
int  surfedge 
)
void BSP_AddTexinfo ( bsp_t bsp,
const texinfo_t texinfo 
)
void BSP_AddTextures ( bsp_t bsp,
const byte texdata,
size_t  texdatasize 
)
void BSP_AddVertex ( bsp_t bsp,
const dvertex_t vertex 
)
void BSP_AddVisibility ( bsp_t bsp,
const byte visdata,
size_t  visdatasize 
)
void BSP_Free ( bsp_t bsp)
bsp_t* BSP_New ( void  )
bsp_t* LoadBSPFile ( QFile file,
size_t  size 
)
bsp_t* LoadBSPMem ( void *  mem,
size_t  size,
void(*)(const bsp_t *, void *)  cb,
void *  cbdata 
)

Create a bsp structure from a memory buffer.

The returned structure will be setup to point into the supplied buffer. All structures within the bsp will be byte-swapped. For this reason, if a callback is provided, the callback be called after byteswapping the header, but before byteswapping any data in the lumps.

Parameters
memThe buffer holding the bsp data.
sizeThe size of the buffer. This is used for sanity checking.
cbPointer to the callback function.
cbdataPointer to extra data for the callback.
Returns
Initialized bsp structure.
Note
The caller maintains ownership of the memory buffer. BSP_Free will free only the bsp structure itself. However, if the caller wishes to relinquish ownership of the buffer, set bsp_t::own_header to true.
void WriteBSPFile ( const bsp_t bsp,
QFile file 
)