UFO: Alien Invasion
Doxygen documentation generating
r_model_brush.h
Go to the documentation of this file.
1 
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 {
39 } mBspVertex_t;
40 
41 typedef struct mBspHeader_s {
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 {
67  float u_offset;
69  float v_offset;
70  uint32_t flags;
73 
74 typedef struct mBspFlare_s {
76  float radius;
77  const image_t* image;
79  float time;
80  float alpha;
81 } mBspFlare_t;
82 
83 typedef struct mBspSurface_s {
85  int flags;
86  int tile;
88  int frame;
91  int firstedge;
92  int numedges;
93 
94  short stmins[2];
95  short stmaxs[2];
98 
101 
105 
106  int light_s, light_t;
108 
109  unsigned int index;
111  unsigned int numTriangles;
112 
113  int tracenum;
114 
116 
118 
121 
126  int lights;
132 } mBspSurface_t;
133 
138 typedef struct mBspSurfaces_s {
140  int count;
142 
143 typedef enum {
151 
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;
176  struct mBspNode_s* parent;
177 
178  struct model_s* model;
179 
180  /* node specific */
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;
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;
206 
209 
210  int numleafs;
212 
215 
216  int numedges;
218 
219  int numnodes;
222 
225 
228 
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 */
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 
251 
252  /* sorted surfaces arrays */
254 } mBspModel_t;
struct model_s * model
struct model_s * model
vec2_t stextents
Definition: r_model_brush.h:97
unsigned int lmtexcoord_buffer
struct mBspNode_s * parent
unsigned int tangent_buffer
unsigned short numsurfaces
int nummodelsurfaces
uint32_t flags
Definition: r_model_brush.h:70
mBspTexInfo_t * texinfo
mBspSurface_t ** surfaces
mBspVertex_t * vertexes
mBspSurface_t * surfaces
unsigned int index
surfaceArrayType_t
unsigned int normal_buffer
bool isOriginBrushModel
unsigned short firstsurface
cBspPlane_t * planes
image_t * image
Definition: r_model_brush.h:71
brush model
Definition: aabb.h:42
float * tangents
float * texcoords
GLuint glElementIndex_t
Definition: r_gl.h:57
unsigned int index_buffer
byte * lightdata
unsigned int texcoord_buffer
float * normals
mBspFlare_t * flare
mBspLeaf_t * leafs
cBspPlane_t * plane
Definition: r_model_brush.h:84
vec3_t origin
Definition: r_model_brush.h:75
float * verts
unsigned int numTriangles
surfaces are assigned to arrays based on their primary rendering type and then sorted by world textur...
mBspNode_t * nodes
const image_t * image
Definition: r_model_brush.h:77
vec_t vec3_t[3]
Definition: ufotypes.h:39
vec_t vec2_t[2]
Definition: ufotypes.h:38
mBspEdge_t * edges
float * lmtexcoords
mBspHeader_t * submodels
vec3_t position
Definition: r_model_brush.h:37
mBspTexInfo_t * texinfo
mBspNode_t * parent
cBspPlane_t * plane
uint8_t byte
Definition: ufotypes.h:34
QGL_EXTERN int GLboolean GLfloat * v
Definition: r_gl.h:120
plane_t structure
Definition: typedefs.h:20
unsigned int vertex_buffer
vec3_t color
Definition: r_model_brush.h:78
glElementIndex_t * indexes
vec_t vec4_t[4]
Definition: ufotypes.h:40