- build system has to use 32bit (the code is not 64bit safe)
[genesis3d.git] / GBSPLib / BRUSH2.H
1 /****************************************************************************************/\r
2 /*  Brush2.h                                                                            */\r
3 /*                                                                                      */\r
4 /*  Author: John Pollard                                                                */\r
5 /*  Description: Code to load, csg, and split brushes, etc...                           */\r
6 /*                                                                                      */\r
7 /*  The contents of this file are subject to the Genesis3D Public License               */\r
8 /*  Version 1.01 (the "License"); you may not use this file except in                   */\r
9 /*  compliance with the License. You may obtain a copy of the License at                */\r
10 /*  http://www.genesis3d.com                                                            */\r
11 /*                                                                                      */\r
12 /*  Software distributed under the License is distributed on an "AS IS"                 */\r
13 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */\r
14 /*  the License for the specific language governing rights and limitations              */\r
15 /*  under the License.                                                                  */\r
16 /*                                                                                      */\r
17 /*  The Original Code is Genesis3D, released March 25, 1999.                            */\r
18 /*  Genesis3D Version 1.1 released November 15, 1999                                 */\r
19 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */\r
20 /*                                                                                      */\r
21 /****************************************************************************************/\r
22 #ifndef BRUSH2_H\r
23 #define BRUSH2_H\r
24 \r
25 #include <Windows.h>\r
26 \r
27 #include "Mathlib.h"\r
28 #include "Map.h"\r
29 \r
30 #include "VFile.h"\r
31 #include "Vec3d.h"\r
32 \r
33 #define NUM_BRUSH_DEFAULT_SIDES         6\r
34 \r
35 typedef struct MAP_Brush\r
36 {\r
37         MAP_Brush       *Next;\r
38 \r
39         int32           EntityNum;\r
40         int32           BrushNum;\r
41 \r
42         int32           Contents;\r
43 \r
44         geVec3d         Mins, Maxs;\r
45 \r
46         int32           OrderID;\r
47 \r
48         int32           NumSides;\r
49         GBSP_Side       OriginalSides[NUM_BRUSH_DEFAULT_SIDES]; \r
50 } MAP_Brush;\r
51 \r
52 typedef struct GBSP_Brush\r
53 {\r
54         GBSP_Brush      *Next;\r
55         geVec3d         Mins, Maxs;\r
56         int32           Side, TestSide; \r
57         MAP_Brush       *Original;\r
58         int32           NumSides;\r
59         GBSP_Side       Sides[NUM_BRUSH_DEFAULT_SIDES];\r
60 \r
61 } GBSP_Brush;\r
62 \r
63 extern int32    gTotalBrushes;\r
64 extern int32    gPeekBrushes;\r
65 \r
66 MAP_Brush       *AllocMapBrush(int32 NumSides);\r
67 void            FreeMapBrush(MAP_Brush *Brush);\r
68 MAP_Brush       *LoadMapBrush(geVFile *VFile);\r
69 void            FreeMapBrushList(MAP_Brush *Brushes);\r
70 geBoolean       MakeMapBrushPolys(MAP_Brush *ob);\r
71 MAP_Brush       *CopyMapBrush(MAP_Brush *Brush);\r
72 int32           CountMapBrushList(MAP_Brush *Brushes);\r
73 \r
74 GBSP_Brush      *AllocBrush(int32 NumSides);\r
75 void            FreeBrush(GBSP_Brush *Brush);\r
76 void            FreeBrushList(GBSP_Brush *Brushes);\r
77 void            ShowBrushHeap(void);\r
78 GBSP_Brush      *CopyBrush(GBSP_Brush *Brush);\r
79 void            BoundBrush(GBSP_Brush *Brush);\r
80 GBSP_Brush      *AddBrushListToTail(GBSP_Brush *List, GBSP_Brush *Tail);\r
81 int32           CountBrushList(GBSP_Brush *Brushes);\r
82 GBSP_Brush      *RemoveBrushList(GBSP_Brush *List, GBSP_Brush *Remove);\r
83 geFloat         BrushVolume (GBSP_Brush *Brush);\r
84 void            CreateBrushPolys(GBSP_Brush *Brush);\r
85 GBSP_Brush      *BrushFromBounds (geVec3d *Mins, geVec3d *Maxs);\r
86 geBoolean       CheckBrush(GBSP_Brush *Brush);\r
87 void            SplitBrush(GBSP_Brush *Brush, int32 PNum, int32 PSide, uint8 MidFlags, geBoolean Visible, GBSP_Brush **Front, GBSP_Brush **Back);\r
88 GBSP_Brush      *SubtractBrush(GBSP_Brush *a, GBSP_Brush *b);\r
89 GBSP_Brush      *CSGBrushes(GBSP_Brush *Head);\r
90 \r
91 geBoolean       OutputBrushes(char *FileName, GBSP_Brush *Brushes);\r
92 geBoolean       OutputMapBrushes(char *FileName, MAP_Brush *Brushes);\r
93 \r
94 #endif