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 typedef struct mplane_s
49 byte type; // for texture axis selection and fast side tests
51 int (*BoxOnPlaneSideFunc) (vec3_t emins, vec3_t emaxs, struct mplane_s *p);
54 typedef struct texture_s
57 unsigned width, height;
59 int gl_glowtexturenum; // LordHavoc: fullbrights on walls
60 struct msurface_s *texturechain; // for gl_texsort drawing
61 int anim_total; // total tenths in sequence ( 0 = no)
62 int anim_min, anim_max; // time for this frame min <=time< max
63 struct texture_s *anim_next; // in the animation sequence
64 struct texture_s *alternate_anims; // bmodels in frame 1 use these
65 unsigned offsets[MIPLEVELS]; // four mip maps stored
66 int transparent; // LordHavoc: transparent texture support
70 #define SURF_PLANEBACK 2
71 #define SURF_DRAWSKY 4
72 #define SURF_DRAWSPRITE 8
73 #define SURF_DRAWTURB 0x10
74 #define SURF_DRAWTILED 0x20
75 #define SURF_DRAWBACKGROUND 0x40
76 //#define SURF_UNDERWATER 0x80
77 // LordHavoc: added these for lava and teleport textures
78 #define SURF_DRAWNOALPHA 0x100
79 #define SURF_DRAWFULLBRIGHT 0x200
81 // !!! if this is changed, it must be changed in asm_draw.h too !!!
85 unsigned int cachededgeoffset;
96 // LordHavoc: was 7, I added one more for raw lightmap position
99 typedef struct glpoly_s
101 struct glpoly_s *next;
102 struct glpoly_s *chain;
104 int flags; // for SURF_UNDERWATER
105 float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
108 typedef struct msurface_s
110 int visframe; // should be drawn when node is crossed
115 int firstedge; // look up in model->surfedges[], negative numbers
116 int numedges; // are backwards edges
118 short texturemins[2];
121 int light_s, light_t; // gl lightmap coordinates
123 glpoly_t *polys; // multiple if warped
124 struct msurface_s *texturechain;
132 int lightframe; // avoid redundent addition of dlights
134 int lightmaptexturenum;
135 byte styles[MAXLIGHTMAPS];
136 int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
137 // qboolean cached_dlight; // true if dynamic light in cache
138 qboolean cached_lighthalf; // LordHavoc: to cause lightmap to be rerendered when lighthalf changes
139 float cached_ambient; // LordHavoc: rerender lightmaps when r_ambient changes
140 byte *samples; // [numstyles*surfsize]
143 // warning: if this is changed, references must be updated in cpu_* assembly files
144 typedef struct mnode_s
147 int contents; // 0, to differentiate from leafs
148 int visframe; // node needs to be traversed if current
149 int lightframe; // LordHavoc: to avoid redundent parent chasing in R_VisMarkLights
151 float minmaxs[6]; // for bounding box culling
153 struct mnode_s *parent;
155 // LordHavoc: node based dynamic lighting
161 struct mnode_s *children[2];
163 unsigned short firstsurface;
164 unsigned short numsurfaces;
169 typedef struct mleaf_s
172 int contents; // wil be a negative contents number
173 int visframe; // node needs to be traversed if current
174 int lightframe; // LordHavoc: to avoid redundent parent chasing in R_VisMarkLights
176 float minmaxs[6]; // for bounding box culling
178 struct mnode_s *parent;
180 // LordHavoc: node based dynamic lighting
185 byte *compressed_vis;
188 msurface_t **firstmarksurface;
190 int key; // BSP sequence number for leaf's contents
191 byte ambient_sound_level[NUM_AMBIENTS];
196 dclipnode_t *clipnodes;