2010-08-18 08:52:13 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
See file, 'COPYING', for details.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef qfbsp_brush_h
|
|
|
|
#define qfbsp_brush_h
|
|
|
|
|
|
|
|
#include "QF/mathlib.h"
|
|
|
|
|
|
|
|
#include "bsp5.h"
|
|
|
|
#include "map.h"
|
|
|
|
|
2010-09-01 01:06:54 +00:00
|
|
|
/** \defgroup qfbsp_brush Brush Functions
|
|
|
|
\ingroup qfbsp
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
|
2010-08-18 08:52:13 +00:00
|
|
|
#define NUM_HULLS 2 // normal and +16
|
|
|
|
|
|
|
|
#define NUM_CONTENTS 2 // solid and water
|
|
|
|
|
|
|
|
typedef struct brush_s {
|
2010-08-27 13:12:13 +00:00
|
|
|
struct brush_s *next;
|
|
|
|
vec3_t mins, maxs;
|
2010-08-18 08:52:13 +00:00
|
|
|
struct visfacet_s *faces;
|
2010-08-27 13:12:13 +00:00
|
|
|
int contents;
|
2010-08-18 08:52:13 +00:00
|
|
|
} brush_t;
|
|
|
|
|
|
|
|
typedef struct brushset_s {
|
2010-08-27 13:12:13 +00:00
|
|
|
vec3_t mins, maxs;
|
|
|
|
brush_t *brushes; // NULL terminated list
|
2010-08-18 08:52:13 +00:00
|
|
|
} brushset_t;
|
|
|
|
|
2010-08-27 13:12:13 +00:00
|
|
|
extern int numbrushplanes;
|
|
|
|
extern plane_t planes[MAX_MAP_PLANES];
|
2010-08-18 08:52:13 +00:00
|
|
|
|
2010-08-29 03:43:07 +00:00
|
|
|
/** Allocate a new brush.
|
|
|
|
|
|
|
|
\return Pointer to the new brush.
|
|
|
|
*/
|
|
|
|
brush_t *AllocBrush (void);
|
|
|
|
|
2010-10-12 10:33:27 +00:00
|
|
|
/** Load the brushes from the entity.
|
|
|
|
|
|
|
|
\param ent The entity from which to load the brushes.
|
|
|
|
\param hullnum The number of the hull for which to load the brushes.
|
|
|
|
\return The brush set holding the brushes loaded from the entity.
|
|
|
|
*/
|
2010-08-18 08:52:13 +00:00
|
|
|
brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum);
|
2010-08-27 12:46:06 +00:00
|
|
|
|
|
|
|
/** Determine the primary axis of the normal.
|
|
|
|
|
|
|
|
\param normal Must be canonical.
|
|
|
|
*/
|
2010-08-27 12:38:09 +00:00
|
|
|
int PlaneTypeForNormal (const vec3_t normal);
|
2010-08-27 12:46:06 +00:00
|
|
|
|
2010-12-10 03:42:37 +00:00
|
|
|
/** Make the plane canonical.
|
|
|
|
|
|
|
|
A cononical plane is one whose normal points towards +inf on its primary
|
|
|
|
axis. The primary axis is that which has the largest magnitude of the
|
|
|
|
vector's components.
|
|
|
|
|
|
|
|
\param dp The plane to make canonical.
|
2010-12-10 09:13:48 +00:00
|
|
|
\return 1 if the plane was flipped, otherwise 0.
|
2010-12-10 03:42:37 +00:00
|
|
|
*/
|
2010-12-10 09:13:48 +00:00
|
|
|
int NormalizePlane (plane_t *dp);
|
2010-12-10 03:42:37 +00:00
|
|
|
|
2010-08-27 12:46:06 +00:00
|
|
|
/** Add a plane to the global list of planes.
|
|
|
|
|
|
|
|
Make the plane canonical, and add it to the global list of planes if it
|
|
|
|
does not duplicate a plane that is already in the list. If the plane is
|
|
|
|
flipped while being made canonical, side will be set to 1, otherwise side
|
|
|
|
will be 0.
|
|
|
|
|
|
|
|
\param dplane The plane to add.
|
|
|
|
\param side The side of the plane that will be front.
|
|
|
|
\return global plane number.
|
|
|
|
*/
|
2010-09-02 04:01:45 +00:00
|
|
|
int FindPlane (const plane_t *dplane, int *side);
|
2010-08-18 08:52:13 +00:00
|
|
|
|
2010-09-01 01:06:54 +00:00
|
|
|
//@}
|
|
|
|
|
2010-08-18 08:52:13 +00:00
|
|
|
#endif//qfbsp_brush_h
|