]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - model_brush.h
removal of various id386 junk
[xonotic/darkplaces.git] / model_brush.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
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.
8
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.  
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20
21 /*
22 ==============================================================================
23
24 BRUSH MODELS
25
26 ==============================================================================
27 */
28
29
30 //
31 // in memory representation
32 //
33 // !!! if this is changed, it must be changed in asm_draw.h too !!!
34 typedef struct
35 {
36         vec3_t          position;
37 } mvertex_t;
38
39 #define SIDE_FRONT      0
40 #define SIDE_BACK       1
41 #define SIDE_ON         2
42
43
44 // plane_t structure
45 typedef struct mplane_s
46 {
47         vec3_t  normal;
48         float   dist;
49         byte    type;                   // for texture axis selection and fast side tests
50 //      byte    signbits;               // signx + signy<<1 + signz<<2
51 //      byte    pad[2];
52         byte    pad[3];
53         int (*BoxOnPlaneSideFunc) (vec3_t emins, vec3_t emaxs, struct mplane_s *p);
54 } mplane_t;
55
56 typedef struct texture_s
57 {
58         char            name[16];
59         unsigned        width, height;
60         int                     gl_texturenum;
61         int                     gl_glowtexturenum; // LordHavoc: fullbrights on walls
62         struct msurface_s       *texturechain;  // for gl_texsort drawing
63         int                     anim_total;                             // total tenths in sequence ( 0 = no)
64         int                     anim_min, anim_max;             // time for this frame min <=time< max
65         struct texture_s *anim_next;            // in the animation sequence
66         struct texture_s *alternate_anims;      // bmodels in frame 1 use these
67         unsigned        offsets[MIPLEVELS];             // four mip maps stored
68         int                     transparent;    // LordHavoc: transparent texture support
69 } texture_t;
70
71
72 #define SURF_PLANEBACK          2
73 #define SURF_DRAWSKY            4
74 #define SURF_DRAWSPRITE         8
75 #define SURF_DRAWTURB           0x10
76 #define SURF_DRAWTILED          0x20
77 #define SURF_DRAWBACKGROUND     0x40
78 //#define SURF_UNDERWATER               0x80
79 // LordHavoc: added these for lava and teleport textures
80 #define SURF_DRAWNOALPHA        0x100
81 #define SURF_DRAWFULLBRIGHT     0x200
82
83 // !!! if this is changed, it must be changed in asm_draw.h too !!!
84 typedef struct
85 {
86         unsigned short  v[2];
87         unsigned int    cachededgeoffset;
88 } medge_t;
89
90 typedef struct
91 {
92         float           vecs[2][4];
93         float           mipadjust;
94         texture_t       *texture;
95         int                     flags;
96 } mtexinfo_t;
97
98 // LordHavoc: was 7, I added two more for raw lightmap coordinates
99 #define VERTEXSIZE      9
100
101 typedef struct glpoly_s
102 {
103         struct  glpoly_s        *next;
104         struct  glpoly_s        *chain;
105         int             numverts;
106         int             flags;                  // for SURF_UNDERWATER
107         float   verts[4][VERTEXSIZE];   // variable sized (xyz s1t1 s2t2)
108 } glpoly_t;
109
110 typedef struct msurface_s
111 {
112         int                     visframe;               // should be drawn when node is crossed
113
114         mplane_t        *plane;
115         int                     flags;
116
117         int                     firstedge;      // look up in model->surfedges[], negative numbers
118         int                     numedges;       // are backwards edges
119         
120         short           texturemins[2];
121         short           extents[2];
122
123         int                     light_s, light_t;       // gl lightmap coordinates
124
125         glpoly_t        *polys;                         // multiple if warped
126         struct  msurface_s      *texturechain;
127
128         mtexinfo_t      *texinfo;
129         
130 // lighting info
131         int                     dlightframe;
132         int                     dlightbits[8];
133
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]
141 } msurface_t;
142
143 typedef struct mnode_s
144 {
145 // common with leaf
146         int                     contents;               // 0, to differentiate from leafs
147         int                     visframe;               // node needs to be traversed if current
148         
149         float           minmaxs[6];             // for bounding box culling
150
151         struct mnode_s  *parent;
152
153 // node specific
154         mplane_t        *plane;
155         struct mnode_s  *children[2];   
156
157         unsigned short          firstsurface;
158         unsigned short          numsurfaces;
159 } mnode_t;
160
161
162
163 typedef struct mleaf_s
164 {
165 // common with node
166         int                     contents;               // wil be a negative contents number
167         int                     visframe;               // node needs to be traversed if current
168
169         float           minmaxs[6];             // for bounding box culling
170
171         struct mnode_s  *parent;
172
173 // leaf specific
174         byte            *compressed_vis;
175         efrag_t         *efrags;
176
177         msurface_t      **firstmarksurface;
178         int                     nummarksurfaces;
179         int                     key;                    // BSP sequence number for leaf's contents
180         byte            ambient_sound_level[NUM_AMBIENTS];
181 } mleaf_t;
182
183 typedef struct
184 {
185         dclipnode_t     *clipnodes;
186         mplane_t        *planes;
187         int                     firstclipnode;
188         int                     lastclipnode;
189         vec3_t          clip_mins;
190         vec3_t          clip_maxs;
191 } hull_t;