-
-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathmap.h
More file actions
190 lines (155 loc) · 4.06 KB
/
Copy pathmap.h
File metadata and controls
190 lines (155 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* Copyright(c) 1997-2001 id Software, Inc.
* Copyright(c) 2002 The Quakeforge Project.
* Copyright(c) 2006 Quetoo.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
#include "brush.h"
#include "entity.h"
/**
* @brief The map file representation of a plane.
*/
typedef struct plane_s {
/**
* @brief The plane normal vector.
*/
vec3_t normal;
/**
* @brief The plane distance, with full double precision.
*/
double dist;
/**
* @brief The plane type, for axial optimizations.
*/
int32_t type;
/**
* @brief The plane hash chain, for fast plane lookups.
*/
struct plane_s *hash_chain;
} plane_t;
/**
* @brief The map file reprensetation of a brush side.
* @details Beyond the original sides defined in the .map file, additional brush sides
* may be allocated to provide axial clipping planes for all brushes. These are known as
* bevels. Bevels should not be used for BSP splitting and face generation. They are
* only used for collision detection.
*/
typedef struct brush_side_s {
/**
* @brief The texture name.
*/
char texture[MAX_QPATH];
/**
* @brief The texture shift, in pixels.
*/
vec2_t shift;
/**
* @brief The texture rotation, in Euler degrees.
*/
float rotate;
/**
* @brief The texture scale.
*/
vec2_t scale;
/**
* @brief True if this brush side uses Valve-220 explicit texture axes.
*/
bool valve;
/**
* @brief The texture axis for S and T, in xyz + offset notation.
*/
vec4_t axis[2];
/**
* @brief The `CONTENTS_`* mask.
*/
int32_t contents;
/**
* @brief The `SURF_`* mask.
*/
int32_t surface;
/**
* @brief The value, for e.g. `SURF_PHONG`.
*/
int32_t value;
/**
* @brief The BSP plane number.
*/
int32_t plane;
/**
* @brief The BSP material number.
*/
int32_t material;
/**
* @brief All brush sides will have a valid winding.
*/
cm_winding_t *winding;
/**
* @brief Points to the original side from which this split side was derived.
*/
const struct brush_side_s *original;
/**
* @brief The BSP brush side emitted from this map brush side.
*/
bsp_brush_side_t *out;
} brush_side_t;
/**
* @brief The map file representation of a brush.
*/
typedef struct brush_s {
/**
* @brief The entity number within the map.
*/
int32_t entity;
/**
* @brief The brush number within the entity.
*/
int32_t brush;
/**
* @brief The combined `CONTENTS_`* mask (bitwise OR) of all sides of this brush.
*/
int32_t contents;
/**
* @brief The brush bounds, calculated by clipping all side planes against each other.
*/
box3_t bounds;
/**
* @brief The brush sides (pointer to a statically allocated global array).
*/
brush_side_t *brush_sides;
/**
* @brief The number of brush sides.
*/
int32_t num_brush_sides;
/**
* @brief The BSP brush emitted from this map brush.
*/
bsp_brush_t *out;
} brush_t;
extern int32_t num_entities;
extern entity_t entities[MAX_BSP_ENTITIES];
extern plane_t planes[MAX_BSP_PLANES];
extern int32_t num_planes;
extern int32_t num_brushes;
extern brush_t brushes[MAX_BSP_BRUSHES];
extern int32_t num_brush_sides;
extern brush_side_t brush_sides[MAX_BSP_BRUSH_SIDES];
extern box3_t map_bounds;
int32_t FindPlane(const vec3_t normal, double dist);
void MakeBrushWindings(brush_t *brush);
void AddBrushBevels(brush_t *b);
void LoadMapFile(const char *filename);