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 // LordHavoc: added these for lava and teleport textures
74 #define SURF_DRAWNOALPHA 0x100
75 #define SURF_DRAWFULLBRIGHT 0x200
76 // LordHavoc: light both sides
77 #define SURF_LIGHTBOTHSIDES 0x400
91 // LordHavoc: was 7, I added one more for raw lightmap position
94 typedef struct glpoly_s
96 struct glpoly_s *next;
97 struct glpoly_s *chain;
99 int flags; // for SURF_UNDERWATER
100 float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
103 typedef struct msurface_s
105 int visframe; // should be drawn when node is crossed
110 int firstedge; // look up in model->surfedges[], negative numbers
111 int numedges; // are backwards edges
113 short texturemins[2];
116 short light_s, light_t; // gl lightmap coordinates
118 glpoly_t *polys; // multiple if warped
126 int lightframe; // avoid redundent addition of dlights
127 int worldnodeframe; // only render each surface once
129 int lightmaptexturenum;
130 byte styles[MAXLIGHTMAPS];
131 unsigned short cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
132 short cached_dlight; // LordHavoc: if lightmap was lit by dynamic lights, update on frame after end of effect to erase it
133 short cached_lighthalf; // LordHavoc: to cause lightmap to be rerendered when lighthalf changes
134 float cached_ambient; // LordHavoc: rerender lightmaps when r_ambient changes
135 byte *samples; // [numstyles*surfsize]
138 // warning: if this is changed, references must be updated in cpu_* assembly files
139 typedef struct mnode_s
142 int contents; // 0, to differentiate from leafs
144 struct mnode_s *parent;
145 struct mportal_s *portals;
149 struct mnode_s *children[2];
151 unsigned short firstsurface;
152 unsigned short numsurfaces;
157 typedef struct mleaf_s
160 int contents; // will be a negative contents number
162 struct mnode_s *parent;
163 struct mportal_s *portals;
166 int visframe; // visible if current (r_framecount)
167 int worldnodeframe; // used by certain worldnode variants to avoid processing the same leaf twice in a frame
169 // for bounding box culling
173 // LordHavoc: leaf based dynamic lighting
177 byte *compressed_vis;
179 msurface_t **firstmarksurface;
181 byte ambient_sound_level[NUM_AMBIENTS];
186 dclipnode_t *clipnodes;
194 typedef struct mportal_s
196 struct mportal_s *next; // the next portal on this leaf
197 mleaf_t *here; // the leaf this portal is on
198 mleaf_t *past; // the leaf through this portal (infront)
205 extern void CL_ParseEntityLump(char *entdata);
206 extern rtexture_t *r_notexture;
207 extern texture_t r_notexture_mip;
210 extern void Mod_LoadBrushModel (struct model_s *mod, void *buffer);
211 extern void Mod_BrushInit(void);