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
44 typedef struct mplane_s
48 int type; // for texture axis selection and fast side tests
49 // LordHavoc: faster than id's signbits system
50 int (*BoxOnPlaneSideFunc) (vec3_t emins, vec3_t emaxs, struct mplane_s *p);
53 typedef struct texture_s
56 unsigned width, height;
58 rtexture_t *glowtexture; // LordHavoc: fullbrights on walls
59 int anim_total; // total frames in sequence (0 = not animated)
60 struct texture_s *anim_frames[10]; // LordHavoc: direct pointers to each of the frames in the sequence
61 struct texture_s *alternate_anims; // bmodels in frame 1 use these
62 int transparent; // LordHavoc: transparent texture support
66 #define SURF_PLANEBACK 2
67 #define SURF_DRAWSKY 4
68 #define SURF_DRAWSPRITE 8
69 #define SURF_DRAWTURB 0x10
70 #define SURF_DRAWTILED 0x20
71 #define SURF_DRAWBACKGROUND 0x40
72 //#define SURF_UNDERWATER 0x80
73 #define SURF_DRAWNOALPHA 0x100
74 #define SURF_DRAWFULLBRIGHT 0x200
75 #define SURF_LIGHTBOTHSIDES 0x400
76 #define SURF_CLIPSOLID 0x800 // this polygon can obscure other polygons
90 // LordHavoc: was 7, I added one more for raw lightmap position
94 typedef struct glpoly_s
96 struct glpoly_s *next;
98 float verts[4][VERTEXSIZE]; // variable sized
101 typedef struct glpolysizeof_s
103 struct glpoly_s *next;
107 typedef struct msurface_s
109 int visframe; // should be drawn when node is crossed
114 int firstedge; // look up in model->surfedges[], negative numbers
115 int numedges; // are backwards edges
117 short texturemins[2];
120 short light_s, light_t; // gl lightmap coordinates
122 glpoly_t *polys; // multiple if warped
130 int lightframe; // avoid redundent addition of dlights
131 int worldnodeframe; // only render each surface once
133 int lightmaptexturenum;
134 byte styles[MAXLIGHTMAPS];
135 unsigned short cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
136 short cached_dlight; // LordHavoc: if lightmap was lit by dynamic lights, update on frame after end of effect to erase it
137 short cached_lightscalebit; // LordHavoc: to cause lightmap to be rerendered when lighthalf changes
138 float cached_ambient; // LordHavoc: rerender lightmaps when r_ambient changes
139 byte *samples; // [numstyles*surfsize]
142 // warning: if this is changed, references must be updated in cpu_* assembly files
143 typedef struct mnode_s
146 int contents; // 0, to differentiate from leafs
148 struct mnode_s *parent;
149 struct mportal_s *portals;
151 // for bounding box culling
157 struct mnode_s *children[2];
159 unsigned short firstsurface;
160 unsigned short numsurfaces;
165 typedef struct mleaf_s
168 int contents; // will be a negative contents number
170 struct mnode_s *parent;
171 struct mportal_s *portals;
173 // for bounding box culling
178 int visframe; // visible if current (r_framecount)
179 int worldnodeframe; // used by certain worldnode variants to avoid processing the same leaf twice in a frame
180 int portalmarkid; // used by polygon-through-portals visibility checker
182 // LordHavoc: leaf based dynamic lighting
186 byte *compressed_vis;
188 msurface_t **firstmarksurface;
190 byte ambient_sound_level[NUM_AMBIENTS];
195 dclipnode_t *clipnodes;
203 typedef struct mportal_s
205 struct mportal_s *next; // the next portal on this leaf
206 mleaf_t *here; // the leaf this portal is on
207 mleaf_t *past; // the leaf through this portal (infront)
211 int visframe; // is this portal visible this frame?
215 extern void CL_ParseEntityLump(char *entdata);
216 extern rtexture_t *r_notexture;
217 extern texture_t r_notexture_mip;
220 extern void Mod_LoadBrushModel (struct model_s *mod, void *buffer);
221 extern void Mod_BrushInit(void);