1 | // Quake 3 data definitions |
---|
2 | // Copyright (C) 1999-2000 Id Software, Inc. |
---|
3 | // |
---|
4 | // This file must be identical in the quake and utils directories |
---|
5 | |
---|
6 | // contents flags are seperate bits |
---|
7 | // a given brush can contribute multiple content bits |
---|
8 | |
---|
9 | // these definitions also need to be in q_shared.h! |
---|
10 | #ifndef __Quake3Types_H__ |
---|
11 | #define __Quake3Types_H__ |
---|
12 | |
---|
13 | |
---|
14 | #define BSP_HEADER_ID (*(int*)"IBSP") |
---|
15 | #define BSP_HEADER_VER (46) |
---|
16 | |
---|
17 | #define BSP_ENTITIES_LUMP (0) |
---|
18 | #define BSP_SHADERS_LUMP (1) |
---|
19 | #define BSP_PLANES_LUMP (2) |
---|
20 | #define BSP_NODES_LUMP (3) |
---|
21 | #define BSP_LEAVES_LUMP (4) |
---|
22 | #define BSP_LFACES_LUMP (5) |
---|
23 | #define BSP_LBRUSHES_LUMP (6) |
---|
24 | #define BSP_MODELS_LUMP (7) |
---|
25 | #define BSP_BRUSH_LUMP (8) |
---|
26 | #define BSP_BRUSHSIDES_LUMP (9) |
---|
27 | #define BSP_VERTICES_LUMP (10) |
---|
28 | #define BSP_ELEMENTS_LUMP (11) |
---|
29 | #define BSP_FOG_LUMP (12) |
---|
30 | #define BSP_FACES_LUMP (13) |
---|
31 | #define BSP_LIGHTMAPS_LUMP (14) |
---|
32 | #define BSP_LIGHTVOLS_LUMP (15) |
---|
33 | #define BSP_VISIBILITY_LUMP (16) |
---|
34 | |
---|
35 | #define BSP_LIGHTMAP_BANKSIZE (128*128*3) |
---|
36 | |
---|
37 | |
---|
38 | #define CONTENTS_SOLID 1 // an eye is never valid in a solid |
---|
39 | #define CONTENTS_LAVA 8 |
---|
40 | #define CONTENTS_SLIME 16 |
---|
41 | #define CONTENTS_WATER 32 |
---|
42 | #define CONTENTS_FOG 64 |
---|
43 | |
---|
44 | #define CONTENTS_AREAPORTAL 0x8000 |
---|
45 | |
---|
46 | #define CONTENTS_PLAYERCLIP 0x10000 |
---|
47 | #define CONTENTS_MONSTERCLIP 0x20000 |
---|
48 | //bot specific contents types |
---|
49 | #define CONTENTS_TELEPORTER 0x40000 |
---|
50 | #define CONTENTS_JUMPPAD 0x80000 |
---|
51 | #define CONTENTS_CLUSTERPORTAL 0x100000 |
---|
52 | #define CONTENTS_DONOTENTER 0x200000 |
---|
53 | |
---|
54 | #define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity |
---|
55 | |
---|
56 | #define CONTENTS_BODY 0x2000000 // should never be on a brush, only in game |
---|
57 | #define CONTENTS_CORPSE 0x4000000 |
---|
58 | #define CONTENTS_DETAIL 0x8000000 // brushes not used for the bsp |
---|
59 | #define CONTENTS_STRUCTURAL 0x10000000 // brushes used for the bsp |
---|
60 | #define CONTENTS_TRANSLUCENT 0x20000000 // don't consume surface fragments inside |
---|
61 | #define CONTENTS_TRIGGER 0x40000000 |
---|
62 | #define CONTENTS_NODROP 0x80000000 // don't leave bodies or items (death fog, lava) |
---|
63 | |
---|
64 | #define SURF_NODAMAGE 0x1 // never give falling damage |
---|
65 | #define SURF_SLICK 0x2 // effects game physics |
---|
66 | #define SURF_SKY 0x4 // lighting from environment map |
---|
67 | #define SURF_LADDER 0x8 |
---|
68 | #define SURF_NOIMPACT 0x10 // don't make missile explosions |
---|
69 | #define SURF_NOMARKS 0x20 // don't leave missile marks |
---|
70 | #define SURF_FLESH 0x40 // make flesh sounds and effects |
---|
71 | #define SURF_NODRAW 0x80 // don't generate a drawsurface at all |
---|
72 | #define SURF_HINT 0x100 // make a primary bsp splitter |
---|
73 | #define SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes |
---|
74 | #define SURF_NOLIGHTMAP 0x400 // surface doesn't need a lightmap |
---|
75 | #define SURF_POINTLIGHT 0x800 // generate lighting info at vertexes |
---|
76 | #define SURF_METALSTEPS 0x1000 // clanking footsteps |
---|
77 | #define SURF_NOSTEPS 0x2000 // no footstep sounds |
---|
78 | #define SURF_NONSOLID 0x4000 // don't collide against curves with this set |
---|
79 | #define SURF_LIGHTFILTER 0x8000 // act as a light filter during q3map -light |
---|
80 | #define SURF_ALPHASHADOW 0x10000 // do per-pixel light shadow casting in q3map |
---|
81 | #define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies) |
---|
82 | |
---|
83 | /* Shader flags */ |
---|
84 | enum |
---|
85 | { |
---|
86 | SHADER_NOCULL = 1 << 0, |
---|
87 | SHADER_TRANSPARENT = 1 << 1, |
---|
88 | SHADER_DEPTHWRITE = 1 << 2, |
---|
89 | SHADER_SKY = 1 << 3, |
---|
90 | SHADER_NOMIPMAPS = 1 << 4, |
---|
91 | SHADER_NEEDCOLOURS = 1 << 5, |
---|
92 | SHADER_DEFORMVERTS = 1 << 6 |
---|
93 | }; |
---|
94 | |
---|
95 | /* Shaderpass flags */ |
---|
96 | enum |
---|
97 | { |
---|
98 | SHADER_LIGHTMAP = 1 << 0, |
---|
99 | SHADER_BLEND = 1 << 1, |
---|
100 | SHADER_ALPHAFUNC = 1 << 3, |
---|
101 | SHADER_TCMOD = 1 << 4, |
---|
102 | SHADER_ANIMMAP = 1 << 5, |
---|
103 | SHADER_TCGEN_ENV = 1 << 6 |
---|
104 | }; |
---|
105 | |
---|
106 | /* Transform functions */ |
---|
107 | enum WaveType |
---|
108 | { |
---|
109 | SHADER_FUNC_NONE = 0, |
---|
110 | SHADER_FUNC_SIN = 1, |
---|
111 | SHADER_FUNC_TRIANGLE = 2, |
---|
112 | SHADER_FUNC_SQUARE = 3, |
---|
113 | SHADER_FUNC_SAWTOOTH = 4, |
---|
114 | SHADER_FUNC_INVERSESAWTOOTH = 5 |
---|
115 | }; |
---|
116 | |
---|
117 | /* *Gen functions */ |
---|
118 | enum GenFunc |
---|
119 | { |
---|
120 | SHADER_GEN_IDENTITY = 0, |
---|
121 | SHADER_GEN_WAVE = 1, |
---|
122 | SHADER_GEN_VERTEX = 2 |
---|
123 | }; |
---|
124 | |
---|
125 | enum TexGen |
---|
126 | { |
---|
127 | TEXGEN_BASE = 0, // Coord set 0 |
---|
128 | TEXGEN_LIGHTMAP = 1, // Coord set 1 |
---|
129 | TEXGEN_ENVIRONMENT = 2 // Neither, generated |
---|
130 | }; |
---|
131 | |
---|
132 | enum DeformFunc |
---|
133 | { |
---|
134 | DEFORM_FUNC_NONE = 0, |
---|
135 | DEFORM_FUNC_BULGE = 1, |
---|
136 | DEFORM_FUNC_WAVE = 2, |
---|
137 | DEFORM_FUNC_NORMAL = 3, |
---|
138 | DEFORM_FUNC_MOVE = 4, |
---|
139 | DEFORM_FUNC_AUTOSPRITE = 5, |
---|
140 | DEFORM_FUNC_AUTOSPRITE2 = 6 |
---|
141 | |
---|
142 | }; |
---|
143 | ///////////////////////////////////////////////////////// |
---|
144 | // |
---|
145 | // bsp contents |
---|
146 | // |
---|
147 | |
---|
148 | struct bsp_plane_t { |
---|
149 | float normal[3]; |
---|
150 | float dist; |
---|
151 | }; |
---|
152 | |
---|
153 | struct bsp_model_t { |
---|
154 | float bbox[6]; |
---|
155 | int face_start; |
---|
156 | int face_count; |
---|
157 | int brush_start; |
---|
158 | int brush_count; |
---|
159 | }; |
---|
160 | |
---|
161 | struct bsp_node_t { |
---|
162 | int plane; // dividing plane |
---|
163 | //int children[2]; // left and right nodes, |
---|
164 | // negative are leaves |
---|
165 | int front; |
---|
166 | int back; |
---|
167 | int bbox[6]; |
---|
168 | }; |
---|
169 | |
---|
170 | struct bsp_leaf_t { |
---|
171 | int cluster; // visibility cluster number |
---|
172 | int area; |
---|
173 | int bbox[6]; |
---|
174 | int face_start; |
---|
175 | int face_count; |
---|
176 | int brush_start; |
---|
177 | int brush_count; |
---|
178 | }; |
---|
179 | |
---|
180 | #define BSP_FACETYPE_NORMAL (1) |
---|
181 | #define BSP_FACETYPE_PATCH (2) |
---|
182 | #define BSP_FACETYPE_MESH (3) |
---|
183 | #define BSP_FACETYPE_FLARE (4) |
---|
184 | |
---|
185 | struct bsp_face_t { |
---|
186 | int shader; // shader ref |
---|
187 | int unknown; |
---|
188 | int type; // face type |
---|
189 | int vert_start; |
---|
190 | int vert_count; |
---|
191 | int elem_start; |
---|
192 | int elem_count; |
---|
193 | int lm_texture; // lightmap |
---|
194 | int lm_offset[2]; |
---|
195 | int lm_size[2]; |
---|
196 | float org[3]; // facetype_normal only |
---|
197 | float bbox[6]; // facetype_patch only |
---|
198 | float normal[3]; // facetype_normal only |
---|
199 | int mesh_cp[2]; // patch control point dims |
---|
200 | }; |
---|
201 | |
---|
202 | struct bsp_shader_t { |
---|
203 | char name[64]; |
---|
204 | int surface_flags; |
---|
205 | int content_flags; |
---|
206 | }; |
---|
207 | |
---|
208 | struct bsp_vertex_t { |
---|
209 | float point[3]; |
---|
210 | float texture[2]; |
---|
211 | float lightmap[2]; |
---|
212 | float normal[3]; |
---|
213 | int color; |
---|
214 | }; |
---|
215 | |
---|
216 | struct bsp_vis_t { |
---|
217 | int cluster_count; |
---|
218 | int row_size; |
---|
219 | unsigned char data[1]; |
---|
220 | }; |
---|
221 | |
---|
222 | // OGRE additions |
---|
223 | struct bsp_lump_entry_t { |
---|
224 | int offset; |
---|
225 | int size; |
---|
226 | }; |
---|
227 | struct bsp_header_t { |
---|
228 | char magic[4]; |
---|
229 | int version; |
---|
230 | bsp_lump_entry_t lumps[17]; |
---|
231 | }; |
---|
232 | |
---|
233 | // |
---|
234 | // Brushes sides in BSP tree |
---|
235 | // |
---|
236 | struct bsp_brushside_t { |
---|
237 | int planenum; |
---|
238 | int content; // ??shader?? |
---|
239 | }; |
---|
240 | |
---|
241 | |
---|
242 | // |
---|
243 | // Brushes in BSP tree |
---|
244 | // |
---|
245 | struct bsp_brush_t { |
---|
246 | int firstside; |
---|
247 | int numsides; |
---|
248 | int shaderIndex; |
---|
249 | }; |
---|
250 | #endif |
---|