2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 ==============================================================================
26 ==============================================================================
31 // in memory representation
33 // !!! if this is changed, it must be changed in asm_draw.h too !!!
45 // !!! if this is changed, it must be changed in asm_i386.h too !!!
46 typedef struct mplane_s
50 byte type; // for texture axis selection and fast side tests
51 // byte signbits; // signx + signy<<1 + signz<<2
54 int (*BoxOnPlaneSideFunc) (vec3_t emins, vec3_t emaxs, struct mplane_s *p);
57 typedef struct texture_s
60 unsigned width, height;
62 int gl_glowtexturenum; // LordHavoc: fullbrights on walls
63 struct msurface_s *texturechain; // for gl_texsort drawing
64 int anim_total; // total tenths in sequence ( 0 = no)
65 int anim_min, anim_max; // time for this frame min <=time< max
66 struct texture_s *anim_next; // in the animation sequence
67 struct texture_s *alternate_anims; // bmodels in frame 1 use these
68 unsigned offsets[MIPLEVELS]; // four mip maps stored
69 int transparent; // LordHavoc: transparent texture support
73 #define SURF_PLANEBACK 2
74 #define SURF_DRAWSKY 4
75 #define SURF_DRAWSPRITE 8
76 #define SURF_DRAWTURB 0x10
77 #define SURF_DRAWTILED 0x20
78 #define SURF_DRAWBACKGROUND 0x40
79 //#define SURF_UNDERWATER 0x80
80 // LordHavoc: added these for lava and teleport textures
81 #define SURF_DRAWNOALPHA 0x100
82 #define SURF_DRAWFULLBRIGHT 0x200
84 // !!! if this is changed, it must be changed in asm_draw.h too !!!
88 unsigned int cachededgeoffset;
99 // LordHavoc: was 7, I added two more for raw lightmap coordinates
102 typedef struct glpoly_s
104 struct glpoly_s *next;
105 struct glpoly_s *chain;
107 int flags; // for SURF_UNDERWATER
108 float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
111 typedef struct msurface_s
113 int visframe; // should be drawn when node is crossed
118 int firstedge; // look up in model->surfedges[], negative numbers
119 int numedges; // are backwards edges
121 short texturemins[2];
124 int light_s, light_t; // gl lightmap coordinates
126 glpoly_t *polys; // multiple if warped
127 struct msurface_s *texturechain;
135 int lightmaptexturenum;
136 byte styles[MAXLIGHTMAPS];
137 int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
138 qboolean cached_dlight; // true if dynamic light in cache
139 qboolean cached_lighthalf; // LordHavoc: to cause lightmap to be rerendered when lighthalf changes
140 byte *samples; // [numstyles*surfsize]
143 typedef struct mnode_s
146 int contents; // 0, to differentiate from leafs
147 int visframe; // node needs to be traversed if current
149 float minmaxs[6]; // for bounding box culling
151 struct mnode_s *parent;
155 struct mnode_s *children[2];
157 unsigned short firstsurface;
158 unsigned short numsurfaces;
163 typedef struct mleaf_s
166 int contents; // wil be a negative contents number
167 int visframe; // node needs to be traversed if current
169 float minmaxs[6]; // for bounding box culling
171 struct mnode_s *parent;
174 byte *compressed_vis;
177 msurface_t **firstmarksurface;
179 int key; // BSP sequence number for leaf's contents
180 byte ambient_sound_level[NUM_AMBIENTS];
183 // !!! if this is changed, it must be changed in asm_i386.h too !!!
186 dclipnode_t *clipnodes;