Quake-III-Arena

Quake III Arena GPL Source Release
Log | Files | Refs

BRUSH.H (4627B)


      1 /*
      2 ===========================================================================
      3 Copyright (C) 1999-2005 Id Software, Inc.
      4 
      5 This file is part of Quake III Arena source code.
      6 
      7 Quake III Arena source code is free software; you can redistribute it
      8 and/or modify it under the terms of the GNU General Public License as
      9 published by the Free Software Foundation; either version 2 of the License,
     10 or (at your option) any later version.
     11 
     12 Quake III Arena source code is distributed in the hope that it will be
     13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 GNU General Public License for more details.
     16 
     17 You should have received a copy of the GNU General Public License
     18 along with Foobar; if not, write to the Free Software
     19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     20 ===========================================================================
     21 */
     22 
     23 // brush.h
     24 
     25 // all types moved to qertypes.h
     26 //--typedef struct
     27 //--{
     28 //--	int		numpoints;
     29 //--	int		maxpoints;
     30 //--	float 	points[8][5];			// variable sized
     31 //--} winding_t;
     32 
     33 
     34 // the normals on planes point OUT of the brush
     35 //--#define	MAXPOINTS	16
     36 //--typedef struct face_s
     37 //--{
     38 //--	struct face_s	*next;
     39 //--	vec3_t		planepts[3];
     40 //--  texdef_t	texdef;
     41 //--  plane_t		plane;
     42 //--
     43 //--	winding_t  *face_winding;
     44 //--
     45 //--	vec3_t		d_color;
     46 //--	qtexture_t *d_texture;
     47 //--
     48 //--} face_t;
     49 //--
     50 //--typedef struct {
     51 //--	vec3_t	xyz;
     52 //--	float	sideST[2];
     53 //--	float	capST[2];
     54 //--} curveVertex_t;
     55 //--
     56 //--typedef struct {
     57 //--	curveVertex_t	v[2];
     58 //--} sideVertex_t;
     59 //--
     60 //--typedef struct brush_s
     61 //--{
     62 //--	struct brush_s	*prev, *next;	// links in active/selected
     63 //--	struct brush_s	*oprev, *onext;	// links in entity
     64 //--	struct entity_s	*owner;
     65 //--	vec3_t	mins, maxs;
     66 //--	face_t     *brush_faces;
     67 //--
     68 //--	qboolean bModelFailed;
     69 //--	//
     70 //--	// curve brush extensions
     71 //--	// all are derived from brush_faces
     72 //--	qboolean	curveBrush;
     73 //--	qboolean	patchBrush;
     74 //--    int nPatchID;
     75 //--} brush_t;
     76 
     77 void		Brush_AddToList (brush_t *b, brush_t *list);
     78 void		Brush_Build(brush_t *b, bool bSnap = true, bool bMarkMap = true, bool bConvert = false);
     79 void		Brush_BuildWindings( brush_t *b, bool bSnap = true );
     80 brush_t*	Brush_Clone (brush_t *b);
     81 brush_t*	Brush_FullClone(brush_t *b);
     82 brush_t*	Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef);
     83 void		Brush_Draw( brush_t *b );
     84 void		Brush_DrawXY(brush_t *b, int nViewType);
     85 // set bRemoveNode to false to avoid trying to delete the item in group view tree control
     86 void		Brush_Free (brush_t *b, bool bRemoveNode = true);
     87 int			Brush_MemorySize(brush_t *b);
     88 void		Brush_MakeSided (int sides);
     89 void		Brush_MakeSidedCone (int sides);
     90 void		Brush_Move (brush_t *b, const vec3_t move, bool bSnap = true);
     91 int			Brush_MoveVertex(brush_t *b, vec3_t vertex, vec3_t delta, vec3_t end, bool bSnap = true);
     92 void		Brush_ResetFaceOriginals(brush_t *b);
     93 brush_t*	Brush_Parse (void);
     94 face_t*		Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist);
     95 void		Brush_RemoveFromList (brush_t *b);
     96 void		Brush_SplitBrushByFace (brush_t *in, face_t *f, brush_t **front, brush_t **back);
     97 void		Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear);
     98 void		Brush_SetTexture (brush_t *b, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, IPluginTexdef* pPlugTexdef=NULL );
     99 void		Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear);
    100 void		Brush_SnapToGrid(brush_t *pb);
    101 void		Brush_Rotate(brush_t *b, vec3_t vAngle, vec3_t vOrigin, bool bBuild = true);
    102 void		Brush_MakeSidedSphere(int sides);
    103 void		Brush_Write (brush_t *b, FILE *f);
    104 void		Brush_Write (brush_t *b, CMemFile* pMemFile);
    105 void		Brush_RemoveEmptyFaces ( brush_t *b );
    106 winding_t*	Brush_MakeFaceWinding (brush_t *b, face_t *face);
    107 
    108 int			AddPlanept (float *f);
    109 float		SetShadeForPlane (plane_t *p);
    110 
    111 face_t*		Face_Alloc( void );
    112 void		Face_Free( face_t *f );
    113 face_t*		Face_Clone (face_t *f);
    114 void		Face_MakePlane (face_t *f);
    115 void		Face_Draw( face_t *face );
    116 void		Face_TextureVectors (face_t *f, float STfromXYZ[2][4]);
    117 void		SetFaceTexdef (brush_t *b, face_t *f, texdef_t *texdef, brushprimit_texdef_t *brushprimit_texdef, bool bFitScale = false, IPluginTexdef* pPlugTexdef = NULL );
    118 
    119 void Face_FitTexture( face_t * face, int nHeight, int nWidth );
    120 void Brush_FitTexture( brush_t *b, int nHeight, int nWidth );
    121 void Brush_SetEpair(brush_t *b, const char *pKey, const char *pValue);
    122 const char* Brush_GetKeyValue(brush_t *b, const char *pKey);
    123 brush_t *Brush_Alloc();
    124 const char* Brush_Name(brush_t *b);