]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/bobtoolz/DBrush.h
d88bee252cd958a3761d7abcff40ef33705d2720
[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 #if _MSC_VER > 1000
28 #pragma once
29 #endif // _MSC_VER > 1000
30
31 #include <stdio.h>
32 #include <list>
33 #include "mathlib.h"
34 #include "str.h"
35
36 class DPlane;
37
38 class DWinding;
39
40 class DPoint;
41
42 class _QERFaceData;
43
44 namespace scene {
45     class Node;
46
47     class Instance;
48 }
49
50 const int POINT_IN_BRUSH = 0;
51 const int POINT_ON_BRUSH = 1;
52 const int POINT_OUT_BRUSH = 2;
53
54 class DBrush {
55 public:
56     DPlane *AddFace(const vec3_t va, const vec3_t vb, const vec3_t vc, const char *textureName, bool bDetail);
57
58     void SaveToFile(FILE *pFile);
59
60     void Rotate(vec3_t vOrigin, vec3_t vRotation);
61
62     void RotateAboutCentre(vec3_t vRotation);
63
64     DPlane *HasPlaneInverted(DPlane *chkPlane);
65
66     DPlane *HasPlane(DPlane *chkPlane);
67
68     DPlane *AddFace(const vec3_t va, const vec3_t vb, const vec3_t vc, const _QERFaceData *texData);
69
70     bool
71     ResetTextures(const char *textureName, float fScale[2], float fShift[2], int rotation, const char *newTextureName,
72                   int bResetTextureName, int bResetScale[2], int bResetShift[2], int bResetRotation);
73
74     bool IsDetail();
75
76     bool HasTexture(const char *textureName);
77
78     bool IntersectsWith(DBrush *chkBrush);
79
80     bool IntersectsWith(DPlane *p1, DPlane *p2, vec3_t v);
81
82     bool IsCutByPlane(DPlane *cuttingPlane);
83
84     bool GetBounds(vec3_t min, vec3_t max);
85
86     bool HasPoint(vec3_t pnt);
87
88     bool BBoxCollision(DBrush *chkBrush);
89
90     bool BBoxTouch(DBrush *chkBrush);
91
92     int BuildPoints();
93
94     void BuildBounds();
95
96     void BuildFromWinding(DWinding *w);
97
98     scene::Node *BuildInRadiant(bool allowDestruction, int *changeCnt, scene::Node *entity = NULL);
99
100     void ResetChecks(std::list<Str> *exclusionList);
101
102     void ClearFaces();
103
104     void ClearPoints();
105
106     int RemoveRedundantPlanes(void);
107
108     void RemovePlane(DPlane *plane);
109
110     int PointPosition(vec3_t pnt);
111
112
113     void CutByPlane(DPlane *cutPlane, DBrush **newBrush1, DBrush **newBrush2);
114
115     void LoadFromBrush(scene::Instance &brush, bool textured);
116
117     void AddPoint(vec3_t pnt);
118
119     DPlane *FindPlaneWithClosestNormal(vec_t *normal);
120
121     int FindPointsForPlane(DPlane *plane, DPoint **pnts, int maxpnts);
122
123     DBrush(int ID = -1);
124
125     virtual ~DBrush();
126
127     bool operator==(DBrush *other);
128
129 //      members
130     scene::Node *QER_entity;
131     scene::Node *QER_brush;
132     std::list<DPlane *> faceList;
133     std::list<DPoint *> pointList;
134     int m_nBrushID;
135     vec3_t bbox_min, bbox_max;
136     bool bBoundsBuilt;
137 };
138
139 //typedef CList<DBrush*, DBrush*> DBrushList;
140
141 #endif // !defined(AFX_DBRUSH_H__35B2C522_F0A7_11D4_ACF7_004095A18133__INCLUDED_)