UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
r_model_brush.h
Go to the documentation of this file.
1
5
6
/*
7
Copyright (C) 1997-2001 Id Software, Inc.
8
9
This program is free software; you can redistribute it and/or
10
modify it under the terms of the GNU General Public License
11
as published by the Free Software Foundation; either version 2
12
of the License, or (at your option) any later version.
13
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18
See the GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with this program; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24
*/
25
26
#pragma once
27
28
/*
29
==============================================================================
30
BRUSH MODELS
31
==============================================================================
32
*/
33
34
36
typedef
struct
mBspVertex_s {
37
vec3_t
position
;
38
vec3_t
normal
;
39
}
mBspVertex_t
;
40
41
typedef
struct
mBspHeader_s {
42
AABB
hBox
;
43
vec3_t
origin
;
44
float
radius
;
45
int
headnode
;
46
int
visleafs
;
47
int
firstface
,
numfaces
;
48
}
mBspHeader_t
;
49
50
#define MSURF_PLANEBACK 1
51
#define MSURF_LIGHTMAP 2
52
53
typedef
struct
mBspEdge_s {
54
unsigned
short
v
[2];
55
}
mBspEdge_t
;
56
65
typedef
struct
mBspTexInfo_s {
66
vec3_t
uv
;
67
float
u_offset
;
68
vec3_t
vv
;
69
float
v_offset
;
70
uint32_t
flags
;
71
image_t
*
image
;
72
}
mBspTexInfo_t
;
73
74
typedef
struct
mBspFlare_s {
75
vec3_t
origin
;
76
float
radius
;
77
const
image_t
*
image
;
78
vec3_t
color
;
79
float
time
;
80
float
alpha
;
81
}
mBspFlare_t
;
82
83
typedef
struct
mBspSurface_s {
84
cBspPlane_t
*
plane
;
85
int
flags
;
86
int
tile
;
87
88
int
frame
;
89
91
int
firstedge
;
92
int
numedges
;
93
94
short
stmins
[2];
95
short
stmaxs
[2];
96
vec2_t
stcenter
;
97
vec2_t
stextents
;
98
99
AABB
mbsBox
;
100
vec3_t
maxs
;
101
102
vec3_t
center
;
103
vec4_t
lightColor
;
104
vec3_t
normal
;
105
106
int
light_s
,
light_t
;
107
int
lightmap_scale
;
108
109
unsigned
int
index
;
110
int
firstTriangle
;
111
unsigned
int
numTriangles
;
112
113
int
tracenum
;
114
115
mBspTexInfo_t
*
texinfo
;
116
117
mBspFlare_t
*
flare
;
118
119
int
lightmap_texnum
;
120
int
deluxemap_texnum
;
121
122
byte
*
samples
;
123
byte
*
lightmap
;
124
125
int
lightframe
;
126
int
lights
;
127
128
bool
isOriginBrushModel
;
132
}
mBspSurface_t
;
133
138
typedef
struct
mBspSurfaces_s {
139
mBspSurface_t
**
surfaces
;
140
int
count
;
141
}
mBspSurfaces_t
;
142
143
typedef
enum
{
144
S_OPAQUE
,
145
S_OPAQUE_WARP
,
146
S_ALPHA_TEST
,
147
S_BLEND
,
148
S_BLEND_WARP
,
149
S_MATERIAL
,
150
S_FLARE
,
151
152
NUM_SURFACES_ARRAYS
153
}
surfaceArrayType_t
;
154
155
#define opaque_surfaces sorted_surfaces[S_OPAQUE]
156
#define opaque_warp_surfaces sorted_surfaces[S_OPAQUE_WARP]
157
#define alpha_test_surfaces sorted_surfaces[S_ALPHA_TEST]
158
#define blend_surfaces sorted_surfaces[S_BLEND]
159
#define blend_warp_surfaces sorted_surfaces[S_BLEND_WARP]
160
#define material_surfaces sorted_surfaces[S_MATERIAL]
161
#define flare_surfaces sorted_surfaces[S_FLARE]
162
163
#define R_AddSurfaceToArray(array, surf)\
164
(array)->surfaces[(array)->count++] = surf
165
166
#define CONTENTS_NODE -1
167
#define CONTENTS_PATHFINDING_NODE -2
168
171
typedef
struct
mBspNode_s {
172
/* common with leaf */
173
int
contents
;
174
AABB
minmaxs
;
175
176
struct
mBspNode_s*
parent
;
177
178
struct
model_s*
model
;
179
180
/* node specific */
181
cBspPlane_t
*
plane
;
182
struct
mBspNode_s*
children
[2];
183
184
unsigned
short
firstsurface
;
185
unsigned
short
numsurfaces
;
186
}
mBspNode_t
;
187
188
typedef
struct
mBspLeaf_s {
189
/* common with mBspNode_t */
190
int
contents
;
191
AABB
minmaxs
;
192
193
mBspNode_t
*
parent
;
194
195
struct
model_s*
model
;
196
}
mBspLeaf_t
;
197
199
typedef
struct
mBspModel_s {
200
/* range of surface numbers in this (sub)model */
201
int
firstmodelsurface
,
nummodelsurfaces
;
202
int
maptile
;
203
204
int
numsubmodels
;
205
mBspHeader_t
*
submodels
;
206
207
int
numplanes
;
208
cBspPlane_t
*
planes
;
209
210
int
numleafs
;
211
mBspLeaf_t
*
leafs
;
212
213
int
numvertexes
;
214
mBspVertex_t
*
vertexes
;
215
216
int
numedges
;
217
mBspEdge_t
*
edges
;
218
219
int
numnodes
;
220
int
firstnode
;
221
mBspNode_t
*
nodes
;
222
223
int
numtexinfo
;
224
mBspTexInfo_t
*
texinfo
;
225
226
int
numsurfaces
;
227
mBspSurface_t
*
surfaces
;
228
229
int
numsurfedges
;
230
int
*
surfedges
;
231
232
/* vertex arrays */
233
float
*
verts
;
234
float
*
texcoords
;
235
float
*
lmtexcoords
;
236
float
*
tangents
;
237
float
*
normals
;
238
glElementIndex_t
*
indexes
;
/*< TODO: on Android glElementIndex_t is unsigned short, which can be only up to 65536 and might overflow */
239
int
numIndexes
;
240
241
/* vertex buffer objects */
242
unsigned
int
vertex_buffer
;
243
unsigned
int
texcoord_buffer
;
244
unsigned
int
lmtexcoord_buffer
;
245
unsigned
int
tangent_buffer
;
246
unsigned
int
normal_buffer
;
247
unsigned
int
index_buffer
;
248
249
byte
lightquant
;
250
byte
*
lightdata
;
251
252
/* sorted surfaces arrays */
253
mBspSurfaces_t
*
sorted_surfaces
[
NUM_SURFACES_ARRAYS
];
254
}
mBspModel_t
;
AABB
Definition
aabb.h:42
glElementIndex_t
GLuint glElementIndex_t
Definition
r_gl.h:57
surfaceArrayType_t
surfaceArrayType_t
Definition
r_model_brush.h:143
NUM_SURFACES_ARRAYS
@ NUM_SURFACES_ARRAYS
Definition
r_model_brush.h:152
S_MATERIAL
@ S_MATERIAL
Definition
r_model_brush.h:149
S_ALPHA_TEST
@ S_ALPHA_TEST
Definition
r_model_brush.h:146
S_BLEND
@ S_BLEND
Definition
r_model_brush.h:147
S_OPAQUE_WARP
@ S_OPAQUE_WARP
Definition
r_model_brush.h:145
S_FLARE
@ S_FLARE
Definition
r_model_brush.h:150
S_OPAQUE
@ S_OPAQUE
Definition
r_model_brush.h:144
S_BLEND_WARP
@ S_BLEND_WARP
Definition
r_model_brush.h:148
cBspPlane_t
plane_t structure
Definition
typedefs.h:20
image_t
Definition
r_image.h:61
mBspEdge_t
Definition
r_model_brush.h:53
mBspEdge_t::v
unsigned short v[2]
Definition
r_model_brush.h:54
mBspFlare_t
Definition
r_model_brush.h:74
mBspFlare_t::origin
vec3_t origin
Definition
r_model_brush.h:75
mBspFlare_t::radius
float radius
Definition
r_model_brush.h:76
mBspFlare_t::color
vec3_t color
Definition
r_model_brush.h:78
mBspFlare_t::alpha
float alpha
Definition
r_model_brush.h:80
mBspFlare_t::image
const image_t * image
Definition
r_model_brush.h:77
mBspFlare_t::time
float time
Definition
r_model_brush.h:79
mBspHeader_t
Definition
r_model_brush.h:41
mBspHeader_t::headnode
int headnode
Definition
r_model_brush.h:45
mBspHeader_t::firstface
int firstface
Definition
r_model_brush.h:47
mBspHeader_t::origin
vec3_t origin
Definition
r_model_brush.h:43
mBspHeader_t::numfaces
int numfaces
Definition
r_model_brush.h:47
mBspHeader_t::hBox
AABB hBox
Definition
r_model_brush.h:42
mBspHeader_t::visleafs
int visleafs
Definition
r_model_brush.h:46
mBspHeader_t::radius
float radius
Definition
r_model_brush.h:44
mBspLeaf_t
Definition
r_model_brush.h:188
mBspLeaf_t::parent
mBspNode_t * parent
Definition
r_model_brush.h:193
mBspLeaf_t::contents
int contents
Definition
r_model_brush.h:190
mBspLeaf_t::minmaxs
AABB minmaxs
Definition
r_model_brush.h:191
mBspLeaf_t::model
struct model_s * model
Definition
r_model_brush.h:195
mBspModel_t
brush model
Definition
r_model_brush.h:199
mBspModel_t::indexes
glElementIndex_t * indexes
Definition
r_model_brush.h:238
mBspModel_t::nummodelsurfaces
int nummodelsurfaces
Definition
r_model_brush.h:201
mBspModel_t::tangent_buffer
unsigned int tangent_buffer
Definition
r_model_brush.h:245
mBspModel_t::numvertexes
int numvertexes
Definition
r_model_brush.h:213
mBspModel_t::firstnode
int firstnode
Definition
r_model_brush.h:220
mBspModel_t::numleafs
int numleafs
Definition
r_model_brush.h:210
mBspModel_t::normal_buffer
unsigned int normal_buffer
Definition
r_model_brush.h:246
mBspModel_t::vertexes
mBspVertex_t * vertexes
Definition
r_model_brush.h:214
mBspModel_t::numsubmodels
int numsubmodels
Definition
r_model_brush.h:204
mBspModel_t::planes
cBspPlane_t * planes
Definition
r_model_brush.h:208
mBspModel_t::firstmodelsurface
int firstmodelsurface
Definition
r_model_brush.h:201
mBspModel_t::maptile
int maptile
Definition
r_model_brush.h:202
mBspModel_t::sorted_surfaces
mBspSurfaces_t * sorted_surfaces[NUM_SURFACES_ARRAYS]
Definition
r_model_brush.h:253
mBspModel_t::lightdata
byte * lightdata
Definition
r_model_brush.h:250
mBspModel_t::numtexinfo
int numtexinfo
Definition
r_model_brush.h:223
mBspModel_t::texinfo
mBspTexInfo_t * texinfo
Definition
r_model_brush.h:224
mBspModel_t::normals
float * normals
Definition
r_model_brush.h:237
mBspModel_t::index_buffer
unsigned int index_buffer
Definition
r_model_brush.h:247
mBspModel_t::vertex_buffer
unsigned int vertex_buffer
Definition
r_model_brush.h:242
mBspModel_t::numsurfaces
int numsurfaces
Definition
r_model_brush.h:226
mBspModel_t::surfedges
int * surfedges
Definition
r_model_brush.h:230
mBspModel_t::texcoord_buffer
unsigned int texcoord_buffer
Definition
r_model_brush.h:243
mBspModel_t::lmtexcoord_buffer
unsigned int lmtexcoord_buffer
Definition
r_model_brush.h:244
mBspModel_t::numnodes
int numnodes
Definition
r_model_brush.h:219
mBspModel_t::lmtexcoords
float * lmtexcoords
Definition
r_model_brush.h:235
mBspModel_t::texcoords
float * texcoords
Definition
r_model_brush.h:234
mBspModel_t::surfaces
mBspSurface_t * surfaces
Definition
r_model_brush.h:227
mBspModel_t::numIndexes
int numIndexes
Definition
r_model_brush.h:239
mBspModel_t::lightquant
byte lightquant
Definition
r_model_brush.h:249
mBspModel_t::numsurfedges
int numsurfedges
Definition
r_model_brush.h:229
mBspModel_t::tangents
float * tangents
Definition
r_model_brush.h:236
mBspModel_t::numedges
int numedges
Definition
r_model_brush.h:216
mBspModel_t::verts
float * verts
Definition
r_model_brush.h:233
mBspModel_t::edges
mBspEdge_t * edges
Definition
r_model_brush.h:217
mBspModel_t::leafs
mBspLeaf_t * leafs
Definition
r_model_brush.h:211
mBspModel_t::submodels
mBspHeader_t * submodels
Definition
r_model_brush.h:205
mBspModel_t::nodes
mBspNode_t * nodes
Definition
r_model_brush.h:221
mBspModel_t::numplanes
int numplanes
Definition
r_model_brush.h:207
mBspNode_t
Definition
r_model_brush.h:171
mBspNode_t::firstsurface
unsigned short firstsurface
Definition
r_model_brush.h:184
mBspNode_t::model
struct model_s * model
Definition
r_model_brush.h:178
mBspNode_t::contents
int contents
Definition
r_model_brush.h:173
mBspNode_t::parent
struct mBspNode_s * parent
Definition
r_model_brush.h:176
mBspNode_t::plane
cBspPlane_t * plane
Definition
r_model_brush.h:181
mBspNode_t::minmaxs
AABB minmaxs
Definition
r_model_brush.h:174
mBspNode_t::children
struct mBspNode_s * children[2]
Definition
r_model_brush.h:182
mBspNode_t::numsurfaces
unsigned short numsurfaces
Definition
r_model_brush.h:185
mBspSurface_t
Definition
r_model_brush.h:83
mBspSurface_t::center
vec3_t center
Definition
r_model_brush.h:102
mBspSurface_t::isOriginBrushModel
bool isOriginBrushModel
Definition
r_model_brush.h:128
mBspSurface_t::frame
int frame
Definition
r_model_brush.h:88
mBspSurface_t::stmaxs
short stmaxs[2]
Definition
r_model_brush.h:95
mBspSurface_t::deluxemap_texnum
int deluxemap_texnum
Definition
r_model_brush.h:120
mBspSurface_t::normal
vec3_t normal
Definition
r_model_brush.h:104
mBspSurface_t::lightmap
byte * lightmap
Definition
r_model_brush.h:123
mBspSurface_t::texinfo
mBspTexInfo_t * texinfo
Definition
r_model_brush.h:115
mBspSurface_t::firstedge
int firstedge
Definition
r_model_brush.h:91
mBspSurface_t::mbsBox
AABB mbsBox
Definition
r_model_brush.h:99
mBspSurface_t::lights
int lights
Definition
r_model_brush.h:126
mBspSurface_t::flags
int flags
Definition
r_model_brush.h:85
mBspSurface_t::index
unsigned int index
Definition
r_model_brush.h:109
mBspSurface_t::numedges
int numedges
Definition
r_model_brush.h:92
mBspSurface_t::stmins
short stmins[2]
Definition
r_model_brush.h:94
mBspSurface_t::light_t
int light_t
Definition
r_model_brush.h:106
mBspSurface_t::tile
int tile
Definition
r_model_brush.h:86
mBspSurface_t::samples
byte * samples
Definition
r_model_brush.h:122
mBspSurface_t::numTriangles
unsigned int numTriangles
Definition
r_model_brush.h:111
mBspSurface_t::light_s
int light_s
Definition
r_model_brush.h:106
mBspSurface_t::lightmap_texnum
int lightmap_texnum
Definition
r_model_brush.h:119
mBspSurface_t::tracenum
int tracenum
Definition
r_model_brush.h:113
mBspSurface_t::stcenter
vec2_t stcenter
Definition
r_model_brush.h:96
mBspSurface_t::stextents
vec2_t stextents
Definition
r_model_brush.h:97
mBspSurface_t::flare
mBspFlare_t * flare
Definition
r_model_brush.h:117
mBspSurface_t::firstTriangle
int firstTriangle
Definition
r_model_brush.h:110
mBspSurface_t::plane
cBspPlane_t * plane
Definition
r_model_brush.h:84
mBspSurface_t::lightmap_scale
int lightmap_scale
Definition
r_model_brush.h:107
mBspSurface_t::maxs
vec3_t maxs
Definition
r_model_brush.h:100
mBspSurface_t::lightColor
vec4_t lightColor
Definition
r_model_brush.h:103
mBspSurface_t::lightframe
int lightframe
Definition
r_model_brush.h:125
mBspSurfaces_t
surfaces are assigned to arrays based on their primary rendering type and then sorted by world textur...
Definition
r_model_brush.h:138
mBspSurfaces_t::count
int count
Definition
r_model_brush.h:140
mBspSurfaces_t::surfaces
mBspSurface_t ** surfaces
Definition
r_model_brush.h:139
mBspTexInfo_t
Definition
r_model_brush.h:65
mBspTexInfo_t::uv
vec3_t uv
Definition
r_model_brush.h:66
mBspTexInfo_t::image
image_t * image
Definition
r_model_brush.h:71
mBspTexInfo_t::vv
vec3_t vv
Definition
r_model_brush.h:68
mBspTexInfo_t::flags
uint32_t flags
Definition
r_model_brush.h:70
mBspTexInfo_t::u_offset
float u_offset
Definition
r_model_brush.h:67
mBspTexInfo_t::v_offset
float v_offset
Definition
r_model_brush.h:69
mBspVertex_t
Definition
r_model_brush.h:36
mBspVertex_t::normal
vec3_t normal
Definition
r_model_brush.h:38
mBspVertex_t::position
vec3_t position
Definition
r_model_brush.h:37
vec3_t
vec_t vec3_t[3]
Definition
ufotypes.h:39
vec4_t
vec_t vec4_t[4]
Definition
ufotypes.h:40
vec2_t
vec_t vec2_t[2]
Definition
ufotypes.h:38
src
client
renderer
r_model_brush.h
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0