1 /*
2 ===========================================================================
3 Copyright (C) 1997-2006 Id Software, Inc.
4 
5 This file is part of Quake 2 Tools source code.
6 
7 Quake 2 Tools 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 2 Tools 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 Quake 2 Tools source code; 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 
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 
42     plane_t		plane;
43 
44 	winding_t  *face_winding;
45 
46 	vec3_t		d_color;
47 	qtexture_t *d_texture;
48 
49 //	int         d_numpoints;
50 //	vec3_t     *d_points;
51 } face_t;
52 
53 #define	MAX_FACES	16
54 typedef struct brush_s
55 {
56 	struct brush_s	*prev, *next;	// links in active/selected
57 	struct brush_s	*oprev, *onext;	// links in entity
58 	struct entity_s	*owner;
59 	vec3_t	mins, maxs;
60 
61 	face_t     *brush_faces;
62 } brush_t;
63 
64 
65 void     Brush_AddToList (brush_t *b, brush_t *list);
66 void     Brush_Build(brush_t *b);
67 void     Brush_BuildWindings( brush_t *b );
68 brush_t *Brush_Clone (brush_t *b);
69 brush_t	*Brush_Create (vec3_t mins, vec3_t maxs, texdef_t *texdef);
70 void     Brush_Draw( brush_t *b );
71 void     Brush_DrawXY( brush_t *b );
72 void     Brush_Free (brush_t *b);
73 void     Brush_MakeSided (int sides);
74 void     Brush_Move (brush_t *b, vec3_t move);
75 brush_t *Brush_Parse (void);
76 face_t  *Brush_Ray (vec3_t origin, vec3_t dir, brush_t *b, float *dist);
77 void     Brush_RemoveFromList (brush_t *b);
78 void     Brush_SelectFaceForDragging (brush_t *b, face_t *f, qboolean shear);
79 void     Brush_SetTexture (brush_t *b, texdef_t *texdef);
80 void     Brush_SideSelect (brush_t *b, vec3_t origin, vec3_t dir, qboolean shear);
81 void     Brush_Write (brush_t *b, FILE *f);
82 void	Brush_RemoveEmptyFaces ( brush_t *b );
83 
84 int        AddPlanept (float *f);
85 face_t	  *Face_Clone (face_t *f);
86 void       Face_Draw( face_t *face );
87 winding_t *MakeFaceWinding (brush_t *b, face_t *face);
88