1 /****************************************************************************************/
\r
4 /* Author: John Pollard */
\r
5 /* Description: Code to load, csg, and split brushes, etc... */
\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
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
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
21 /****************************************************************************************/
\r
25 #include <Windows.h>
\r
27 #include "Mathlib.h"
\r
33 #define NUM_BRUSH_DEFAULT_SIDES 6
\r
35 typedef struct MAP_Brush
\r
49 GBSP_Side OriginalSides[NUM_BRUSH_DEFAULT_SIDES];
\r
52 typedef struct GBSP_Brush
\r
56 int32 Side, TestSide;
\r
57 MAP_Brush *Original;
\r
59 GBSP_Side Sides[NUM_BRUSH_DEFAULT_SIDES];
\r
63 extern int32 gTotalBrushes;
\r
64 extern int32 gPeekBrushes;
\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
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
91 geBoolean OutputBrushes(char *FileName, GBSP_Brush *Brushes);
\r
92 geBoolean OutputMapBrushes(char *FileName, MAP_Brush *Brushes);
\r