quakeforge/tools/qfbsp/include/bsp5.h

142 lines
3.9 KiB
C
Raw Normal View History

2002-09-19 18:51:19 +00:00
/*
Copyright (C) 1996-1997 Id Software, Inc.
2002-09-19 18:51:19 +00:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
2002-09-19 18:51:19 +00:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
2002-09-19 18:51:19 +00:00
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2002-09-19 18:51:19 +00:00
See file, 'COPYING', for details.
2002-09-23 16:27:17 +00:00
$Id$
*/
#ifndef qfbsp_bsp5_h
#define qfbsp_bsp5_h
/** \defgroup qfbsp QuakeForge BSP Compiler
*/
#include "QF/mathlib.h"
#include "QF/bspfile.h"
/** \defgroup qfbsp_general General functions
\ingroup qfbsp
*/
//@{
typedef struct plane_s {
2010-08-27 13:12:13 +00:00
vec3_t normal;
vec_t dist;
int type;
} plane_t;
2010-08-27 13:12:13 +00:00
#define MAX_THREADS 4
2010-08-27 13:12:13 +00:00
#define ON_EPSILON 0.05
#define BOGUS_RANGE 18000
// the exact bounding box of the brushes is expanded some for the headnode
// volume. is this still needed?
2010-08-27 13:12:13 +00:00
#define SIDESPACE 24
#define TEX_SKIP -1
#define TEX_HINT -2
typedef struct visfacet_s {
2010-08-27 13:12:13 +00:00
struct visfacet_s *next;
int planenum;
2010-08-30 07:08:04 +00:00
int planeside; ///< which side is the front of the face
2010-08-27 13:12:13 +00:00
int texturenum;
2010-08-30 07:08:04 +00:00
int contents[2]; ///< 0 = front side
2010-08-27 13:12:13 +00:00
2010-08-30 07:08:04 +00:00
struct visfacet_s *original;///< face on node
int outputnumber; ///< valid only for original faces after
///< write surfaces
qboolean detail; ///< is a detail face
struct winding_s *points;
2010-08-27 13:12:13 +00:00
int *edges;
} face_t;
typedef struct surface_s {
2010-08-27 13:12:13 +00:00
struct surface_s *next;
2010-08-30 07:08:04 +00:00
struct surface_s *original; ///< before BSP cuts it up
2010-08-27 13:12:13 +00:00
int planenum;
2010-08-30 07:08:04 +00:00
int outputplanenum; ///< valid only after WriteSurfacePlanes
2010-08-27 13:12:13 +00:00
vec3_t mins, maxs;
2010-08-30 07:08:04 +00:00
qboolean onnode; ///< true if surface has already been used
///< as a splitting node
qboolean has_detail; ///< true if the surface has detail brushes
qboolean has_struct; ///< true if the surface has non-detail
///< brushes
face_t *faces; ///< links to all the faces on either side
///< of the surf
} surface_t;
// there is a node_t structure for every node and leaf in the bsp tree
2010-08-27 13:12:13 +00:00
#define PLANENUM_LEAF -1
typedef struct node_s {
vec3_t mins,maxs; ///< bounding volume, not just points inside
2010-08-30 07:08:04 +00:00
// information for decision nodes
int planenum; ///< -1 = leaf node
int outputplanenum; ///< valid only after WriteNodePlanes
int firstface; ///< decision node only
int numfaces; ///< decision node only
struct node_s *children[2]; ///< valid only for decision nodes
face_t *faces; ///< decision nodes only, list for both sides
2010-08-27 13:12:13 +00:00
// information for leafs
int contents; ///< leaf nodes (0 for decision nodes)
face_t **markfaces; ///< leaf nodes only, point to node faces
2010-08-30 07:08:04 +00:00
struct portal_s *portals; ///< portals on this leaf
int visleafnum; ///< -1 = solid
int valid; ///< for flood filling
int occupied; ///< light number in leaf for outside filling
int o_dist; ///< distance to nearest entity
int detail; ///< 1 if created by detail split
} node_t;
2010-08-27 13:12:13 +00:00
extern struct brushset_s *brushset;
/** Formatted printing with verbosity control.
Behaves the same as printf except it prints only when verbose is true.
*/
void qprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
2010-08-27 13:12:13 +00:00
extern int valid;
2010-08-27 13:12:13 +00:00
extern qboolean worldmodel;
// misc functions
/** Allocate a new node.
\return Pointer to the new node.
*/
node_t *AllocNode (void);
//=============================================================================
extern bsp_t *bsp;
//@}
#endif//qfbsp_bsp5_h