]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/DBrush.h
misc nix
[xonotic/netradiant.git] / contrib / bobtoolz / DBrush.h
1 /*
2 BobToolz plugin for GtkRadiant
3 Copyright (C) 2001 Gordon Biggans
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20 // DBrush.h: interface for the DBrush class.
21 //
22 //////////////////////////////////////////////////////////////////////
23
24 #if !defined(AFX_DBRUSH_H__35B2C522_F0A7_11D4_ACF7_004095A18133__INCLUDED_)
25 #define AFX_DBRUSH_H__35B2C522_F0A7_11D4_ACF7_004095A18133__INCLUDED_
26
27 #include "DPlane.h"
28
29 #define POINT_IN_BRUSH  0
30 #define POINT_ON_BRUSH  1
31 #define POINT_OUT_BRUSH 2
32
33 #if _MSC_VER > 1000
34 #pragma once
35 #endif // _MSC_VER > 1000
36
37 class DBrush  
38 {
39 public:
40         DPlane* AddFace(vec3_t va, vec3_t vb, vec3_t vc, const char* textureName, bool bDetail);
41         void SaveToFile(FILE* pFile);
42
43         void Rotate(vec3_t vOrigin, vec3_t vRotation);
44         void RotateAboutCentre(vec3_t vRotation);
45
46         DPlane* HasPlaneInverted(DPlane* chkPlane);
47         DPlane* HasPlane(DPlane* chkPlane);
48         DPlane* AddFace(vec3_t va, vec3_t vb, vec3_t vc, _QERFaceData* texData);
49
50         bool ResetTextures(const char* textureName, float fScale[2], float fShift[2], int rotation, const char* newTextureName, int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation);
51         bool IsDetail();
52         bool HasTexture(const char* textureName);
53         bool IntersectsWith(DBrush *chkBrush);
54         bool IntersectsWith(DPlane* p1, DPlane* p2, vec3_t v);
55         bool IsCutByPlane(DPlane* cuttingPlane);
56         bool GetBounds(vec3_t min, vec3_t max); 
57         bool HasPoint(vec3_t pnt);
58         bool BBoxCollision(DBrush* chkBrush);
59         bool BBoxTouch(DBrush* chkBrush);
60
61         int BuildPoints();
62         void BuildBounds();
63         void BuildFromWinding(DWinding* w);
64         brush_t* BuildInRadiant(bool allowDestruction, int* changeCnt, entity_t* entity = NULL);
65
66         void ResetChecks(list<Str>* exclusionList);
67
68         void ClearFaces();
69         void ClearPoints();
70         
71         int RemoveRedundantPlanes( void );
72         void RemovePlane( DPlane* plane );
73         int PointPosition(vec3_t pnt);
74         void RemoveFromRadiant( void );
75
76         
77         void CutByPlane(DPlane* cutPlane, DBrush** newBrush1, DBrush** newBrush2);
78
79         void LoadFromBrush_t(brush_t* brush, bool textured);
80         void AddPoint(vec3_t pnt);
81
82         DPlane* FindPlaneWithClosestNormal( vec_t* normal );
83         int FindPointsForPlane( DPlane* plane, DPoint** pnts, int maxpnts );
84
85         DBrush(int ID = -1);
86         virtual ~DBrush();
87
88         bool operator== (DBrush* other);
89
90 //      members
91         brush_t* QER_brush;
92         list<DPlane*> faceList;
93         list<DPoint*> pointList;
94         int m_nBrushID;
95         vec3_t bbox_min, bbox_max;
96         bool bBoundsBuilt;
97 };
98
99 //typedef CList<DBrush*, DBrush*> DBrushList;
100
101 #endif // !defined(AFX_DBRUSH_H__35B2C522_F0A7_11D4_ACF7_004095A18133__INCLUDED_)