1 #ifndef BBOX_TREE_H
2 #define BBOX_TREE_H
3
4 #include <stdlib.h>
5 #include "vmath.h"
6 #ifdef DEBUG
7 #include "errors.h"
8 #endif
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 #define TYPE_2D_NO_ALPHA_OBJECT 0x00
15 #define TYPE_2D_ALPHA_OBJECT 0x01
16 #define TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT 0x02
17 #define TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT 0x03
18 #define TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT 0x04
19 #define TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT 0x05
20 #define TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT 0x06
21 #define TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT 0x07
22 #define TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT 0x08
23 #define TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT 0x09
24 #define TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT 0x0A
25 #define TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT 0x0B
26 #define TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT 0x0C
27 #define TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT 0x0D
28 #define TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT 0x0E
29 #define TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT 0x0F
30 #define TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT 0x10
31 #define TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT 0x11
32 #define TYPE_PARTICLE_SYSTEM 0x12
33 #define TYPE_LIGHT 0x13
34 #define TYPE_TERRAIN 0x14
35 #define TYPE_NO_REFLECTIV_WATER 0x15
36 #define TYPE_REFLECTIV_WATER 0x16
37 #define TYPES_COUNT 0x17
38 #define TYPE_DELETED 0xFF
39
40 #define TYPE_MASK_2D_ALPHA_OBJECT 0x00
41 #define TYPE_MASK_2D_NO_ALPHA_OBJECT 0x01
42 #define TYPE_MASK_3D_BLEND_SELF_LIT_OBJECT 0x02
43 #define TYPE_MASK_3D_BLEND_NO_SELF_LIT_OBJECT 0x03
44 #define TYPE_MASK_3D_NO_BLEND_SELF_LIT_OBJECT 0x04
45 #define TYPE_MASK_3D_NO_BLEND_NO_SELF_LIT_OBJECT 0x05
46 #define TYPE_MASK_PARTICLE_SYSTEM 0x06
47 #define TYPE_MASK_LIGHT 0x07
48 #define TYPE_MASK_TERRAIN 0x08
49 #define TYPE_MASK_NO_REFLECTIV_WATER 0x09
50 #define TYPE_MASK_REFLECTIV_WATER 0x0A
51
52 #define INTERSECTION_TYPE_DEFAULT 0x00
53 #define INTERSECTION_TYPE_SHADOW 0x01
54 #define INTERSECTION_TYPE_REFLECTION 0x02
55 #define MAX_INTERSECTION_TYPES 0x03
56
57 #define OUTSIDE 0x0000
58 #define INSIDE 0x0001
59 #define INTERSECT 0x0002
60
61 #define BOUND_HUGE 10e30
62
63 #define EXTRA_FIRST_SUB_NODE 0x0001
64
65 typedef enum
66 {
67 ide_changed = 0
68 } intersection_data_enum;
69
70 typedef enum
71 {
72 bie_no_reflect = 0
73 } bbox_item_extra;
74
75 typedef struct
76 {
77 VECTOR3 bbmin;
78 VECTOR3 bbmax;
79 } AABBOX;
80
81 typedef struct
82 {
83 VECTOR3 center;
84 VECTOR3 direction;
85 float length;
86 } LINE;
87
88 typedef struct
89 {
90 VECTOR4 plane;
91 VECTOR3I mask;
92 } PLANE;
93
94 typedef PLANE FRUSTUM[16];
95
96 typedef struct
97 {
98 float scale;
99 Uint32 mask;
100 Uint32 zero;
101 } PLANE_DATA;
102
103 typedef PLANE_DATA FRUSTUM_DATA[16];
104
105 typedef struct
106 {
107 AABBOX bbox;
108 Uint32 texture_id;
109 Uint32 ID;
110 Uint16 options;
111 Uint8 type;
112 Uint8 extra;
113 #ifdef CLUSTER_INSIDES
114 Uint16 cluster;
115 #endif // CLUSTER_INSIDES
116 } BBOX_ITEM;
117
118 typedef struct
119 {
120 Uint32 size;
121 Uint32 index;
122 BBOX_ITEM* items;
123 } BBOX_ITEMS;
124
125 typedef struct
126 {
127 AABBOX bbox;
128 AABBOX orig_bbox;
129 Uint32 nodes[2];
130 BBOX_ITEMS dynamic_objects;
131 Uint32 items_index;
132 Uint32 items_count;
133 } BBOX_TREE_NODE;
134
135 typedef struct
136 {
137 Uint32 intersect_update_needed;
138 Uint32 size;
139 Uint32 count;
140 Uint32 start[TYPES_COUNT];
141 Uint32 stop[TYPES_COUNT];
142 Uint32 flags[TYPES_COUNT];
143 BBOX_ITEM* items;
144 Uint32 frustum_mask;
145 FRUSTUM frustum;
146 } BBOX_INTERSECTION_DATA;
147
148 typedef struct
149 {
150 Uint32 items_count;
151 BBOX_ITEM* items;
152 Uint32 nodes_count;
153 BBOX_TREE_NODE* nodes;
154 Uint32 cur_intersect_type;
155 BBOX_INTERSECTION_DATA intersect[MAX_INTERSECTION_TYPES];
156 } BBOX_TREE;
157
158 enum
159 {
160 A = 0,
161 B = 1,
162 C = 2,
163 D = 3
164 };
165
get_bbox_intersect_flag(BBOX_TREE * bbox_tree,Uint32 type,intersection_data_enum ide)166 static __inline__ int get_bbox_intersect_flag(BBOX_TREE* bbox_tree, Uint32 type, intersection_data_enum ide)
167 {
168 return (bbox_tree->intersect[bbox_tree->cur_intersect_type].flags[type] & (1 << ide)) != 0;
169 }
170
set_bbox_intersect_flag(BBOX_TREE * bbox_tree,Uint32 type,intersection_data_enum ide)171 static __inline__ void set_bbox_intersect_flag(BBOX_TREE* bbox_tree, Uint32 type, intersection_data_enum ide)
172 {
173 bbox_tree->intersect[bbox_tree->cur_intersect_type].flags[type] |= (1 << ide);
174 }
175
clear_bbox_intersect_flag(BBOX_TREE * bbox_tree,Uint32 type,intersection_data_enum ide)176 static __inline__ void clear_bbox_intersect_flag(BBOX_TREE* bbox_tree, Uint32 type, intersection_data_enum ide)
177 {
178 bbox_tree->intersect[bbox_tree->cur_intersect_type].flags[type] &= ~(1 << ide);
179 }
180
calc_light_aabb(AABBOX * bbox,float pos_x,float pos_y,float pos_z,float diff_r,float diff_g,float diff_b,float att,float exp,float clamp)181 static __inline__ void calc_light_aabb(AABBOX* bbox, float pos_x, float pos_y, float pos_z, float diff_r, float diff_g, float diff_b,
182 float att, float exp, float clamp)
183 {
184 float h, r;
185
186 h = max2f(fabsf(diff_r), max2f(fabsf(diff_g), fabsf(diff_b)));
187
188 r = (h/clamp-1)/att;
189
190 if (exp <= 0.0f) return;
191 else
192 {
193 if (exp == 2.0f) r = sqrt(r);
194 else
195 {
196 if (exp != 1.0f) r = pow(r, exp);
197 }
198 }
199
200 bbox->bbmin[X] = pos_x - r;
201 bbox->bbmin[Y] = pos_y - r;
202 bbox->bbmin[Z] = pos_z - r;
203 bbox->bbmax[X] = pos_x + r;
204 bbox->bbmax[Y] = pos_y + r;
205 bbox->bbmax[Z] = pos_z + r;
206 }
207
rotate_aabb(AABBOX * bbox,float r_x,float r_y,float r_z)208 static __inline__ void rotate_aabb(AABBOX* bbox, float r_x, float r_y, float r_z)
209 {
210 float matrix_1[16], matrix_2[16];
211 matrix_1[0] = bbox->bbmax[X];
212 matrix_1[1] = bbox->bbmax[Y];
213 matrix_1[2] = bbox->bbmax[Z];
214 matrix_1[3] = 1.0f;
215 matrix_1[4] = bbox->bbmax[X];
216 matrix_1[5] = bbox->bbmax[Y];
217 matrix_1[6] = bbox->bbmin[Z];
218 matrix_1[7] = 1.0f;
219 matrix_1[8] = bbox->bbmax[X];
220 matrix_1[9] = bbox->bbmin[Y];
221 matrix_1[10] = bbox->bbmax[Z];
222 matrix_1[11] = 1.0f;
223 matrix_1[12] = bbox->bbmax[X];
224 matrix_1[13] = bbox->bbmin[Y];
225 matrix_1[14] = bbox->bbmin[Z];
226 matrix_1[15] = 1.0f;
227 matrix_2[0] = bbox->bbmin[X];
228 matrix_2[1] = bbox->bbmax[Y];
229 matrix_2[2] = bbox->bbmax[Z];
230 matrix_2[3] = 1.0f;
231 matrix_2[4] = bbox->bbmin[X];
232 matrix_2[5] = bbox->bbmax[Y];
233 matrix_2[6] = bbox->bbmin[Z];
234 matrix_2[7] = 1.0f;
235 matrix_2[8] = bbox->bbmin[X];
236 matrix_2[9] = bbox->bbmin[Y];
237 matrix_2[10] = bbox->bbmax[Z];
238 matrix_2[11] = 1.0f;
239 matrix_2[12] = bbox->bbmin[X];
240 matrix_2[13] = bbox->bbmin[Y];
241 matrix_2[14] = bbox->bbmin[Z];
242 matrix_2[15] = 1.0f;
243 glPushMatrix();
244 glLoadIdentity();
245 glRotatef(r_z, 0.0f, 0.0f, 1.0f);
246 glRotatef(r_x, 1.0f, 0.0f, 0.0f);
247 glRotatef(r_y, 0.0f, 1.0f, 0.0f);
248 glPushMatrix();
249 glMultMatrixf(matrix_1);
250 glGetFloatv(GL_MODELVIEW_MATRIX, matrix_1);
251 glPopMatrix();
252 glMultMatrixf(matrix_2);
253 glGetFloatv(GL_MODELVIEW_MATRIX, matrix_2);
254 glPopMatrix();
255 bbox->bbmin[X] = min2f(min2f(matrix_1[0], matrix_1[4]), min2f(matrix_1[8], matrix_1[12]));
256 bbox->bbmin[X] = min2f(bbox->bbmin[X], min2f(min2f(matrix_2[0], matrix_2[4]), min2f(matrix_2[8], matrix_2[12])));
257 bbox->bbmin[Y] = min2f(min2f(matrix_1[1], matrix_1[5]), min2f(matrix_1[9], matrix_1[13]));
258 bbox->bbmin[Y] = min2f(bbox->bbmin[Y], min2f(min2f(matrix_2[1], matrix_2[5]), min2f(matrix_2[9], matrix_2[13])));
259 bbox->bbmin[Z] = min2f(min2f(matrix_1[2], matrix_1[6]), min2f(matrix_1[10], matrix_1[14]));
260 bbox->bbmin[Z] = min2f(bbox->bbmin[Z], min2f(min2f(matrix_2[2], matrix_2[6]), min2f(matrix_2[10], matrix_2[14])));
261
262 bbox->bbmax[X] = max2f(max2f(matrix_1[0], matrix_1[4]), max2f(matrix_1[8], matrix_1[12]));
263 bbox->bbmax[X] = max2f(bbox->bbmax[X], max2f(max2f(matrix_2[0], matrix_2[4]), max2f(matrix_2[8], matrix_2[12])));
264 bbox->bbmax[Y] = max2f(max2f(matrix_1[1], matrix_1[5]), max2f(matrix_1[9], matrix_1[13]));
265 bbox->bbmax[Y] = max2f(bbox->bbmax[Y], max2f(max2f(matrix_2[1], matrix_2[5]), max2f(matrix_2[9], matrix_2[13])));
266 bbox->bbmax[Z] = max2f(max2f(matrix_1[2], matrix_1[6]), max2f(matrix_1[10], matrix_1[14]));
267 bbox->bbmax[Z] = max2f(bbox->bbmax[Z], max2f(max2f(matrix_2[2], matrix_2[6]), max2f(matrix_2[10], matrix_2[14])));
268 }
269
matrix_mul_aabb(AABBOX * bbox,const MATRIX4x4 matrix)270 static __inline__ void matrix_mul_aabb(AABBOX* bbox, const MATRIX4x4 matrix)
271 {
272 MATRIX4x4 matrix_1, matrix_2;
273 matrix_1[0] = bbox->bbmax[X];
274 matrix_1[1] = bbox->bbmax[Y];
275 matrix_1[2] = bbox->bbmax[Z];
276 matrix_1[3] = 1.0f;
277 matrix_1[4] = bbox->bbmax[X];
278 matrix_1[5] = bbox->bbmax[Y];
279 matrix_1[6] = bbox->bbmin[Z];
280 matrix_1[7] = 1.0f;
281 matrix_1[8] = bbox->bbmax[X];
282 matrix_1[9] = bbox->bbmin[Y];
283 matrix_1[10] = bbox->bbmax[Z];
284 matrix_1[11] = 1.0f;
285 matrix_1[12] = bbox->bbmax[X];
286 matrix_1[13] = bbox->bbmin[Y];
287 matrix_1[14] = bbox->bbmin[Z];
288 matrix_1[15] = 1.0f;
289 matrix_2[0] = bbox->bbmin[X];
290 matrix_2[1] = bbox->bbmax[Y];
291 matrix_2[2] = bbox->bbmax[Z];
292 matrix_2[3] = 1.0f;
293 matrix_2[4] = bbox->bbmin[X];
294 matrix_2[5] = bbox->bbmax[Y];
295 matrix_2[6] = bbox->bbmin[Z];
296 matrix_2[7] = 1.0f;
297 matrix_2[8] = bbox->bbmin[X];
298 matrix_2[9] = bbox->bbmin[Y];
299 matrix_2[10] = bbox->bbmax[Z];
300 matrix_2[11] = 1.0f;
301 matrix_2[12] = bbox->bbmin[X];
302 matrix_2[13] = bbox->bbmin[Y];
303 matrix_2[14] = bbox->bbmin[Z];
304 matrix_2[15] = 1.0f;
305 glPushMatrix();
306 glLoadMatrixf(matrix);
307 glPushMatrix();
308 glMultMatrixf(matrix_1);
309 glGetFloatv(GL_MODELVIEW_MATRIX, matrix_1);
310 glPopMatrix();
311 glMultMatrixf(matrix_2);
312 glGetFloatv(GL_MODELVIEW_MATRIX, matrix_2);
313 glPopMatrix();
314 bbox->bbmin[X] = min2f(min2f(matrix_1[0], matrix_1[4]), min2f(matrix_1[8], matrix_1[12]));
315 bbox->bbmin[X] = min2f(bbox->bbmin[X], min2f(min2f(matrix_2[0], matrix_2[4]), min2f(matrix_2[8], matrix_2[12])));
316 bbox->bbmin[Y] = min2f(min2f(matrix_1[1], matrix_1[5]), min2f(matrix_1[9], matrix_1[13]));
317 bbox->bbmin[Y] = min2f(bbox->bbmin[Y], min2f(min2f(matrix_2[1], matrix_2[5]), min2f(matrix_2[9], matrix_2[13])));
318 bbox->bbmin[Z] = min2f(min2f(matrix_1[2], matrix_1[6]), min2f(matrix_1[10], matrix_1[14]));
319 bbox->bbmin[Z] = min2f(bbox->bbmin[Z], min2f(min2f(matrix_2[2], matrix_2[6]), min2f(matrix_2[10], matrix_2[14])));
320
321 bbox->bbmax[X] = max2f(max2f(matrix_1[0], matrix_1[4]), max2f(matrix_1[8], matrix_1[12]));
322 bbox->bbmax[X] = max2f(bbox->bbmax[X], max2f(max2f(matrix_2[0], matrix_2[4]), max2f(matrix_2[8], matrix_2[12])));
323 bbox->bbmax[Y] = max2f(max2f(matrix_1[1], matrix_1[5]), max2f(matrix_1[9], matrix_1[13]));
324 bbox->bbmax[Y] = max2f(bbox->bbmax[Y], max2f(max2f(matrix_2[1], matrix_2[5]), max2f(matrix_2[9], matrix_2[13])));
325 bbox->bbmax[Z] = max2f(max2f(matrix_1[2], matrix_1[6]), max2f(matrix_1[10], matrix_1[14]));
326 bbox->bbmax[Z] = max2f(bbox->bbmax[Z], max2f(max2f(matrix_2[2], matrix_2[6]), max2f(matrix_2[10], matrix_2[14])));
327 }
328
get_intersect_start_stop(BBOX_TREE * bbox_tree,Uint32 type,Uint32 * start,Uint32 * stop)329 static __inline__ void get_intersect_start_stop(BBOX_TREE* bbox_tree, Uint32 type, Uint32* start, Uint32* stop)
330 {
331 Uint32 idx;
332
333 idx = bbox_tree->cur_intersect_type;
334 *start = bbox_tree->intersect[idx].start[type];
335 *stop = bbox_tree->intersect[idx].stop[type];
336 }
337
get_intersect_item_ID(BBOX_TREE * bbox_tree,Uint32 index)338 static __inline__ Uint32 get_intersect_item_ID(BBOX_TREE* bbox_tree, Uint32 index)
339 {
340 Uint32 idx;
341
342 idx = bbox_tree->cur_intersect_type;
343 return bbox_tree->intersect[idx].items[index].ID;
344 }
345
get_intersect_item_bbox(BBOX_TREE * bbox_tree,Uint32 index)346 static __inline__ AABBOX get_intersect_item_bbox(BBOX_TREE* bbox_tree, Uint32 index)
347 {
348 Uint32 idx;
349
350 idx = bbox_tree->cur_intersect_type;
351 return bbox_tree->intersect[idx].items[index].bbox;
352 }
353
get_intersect_item_options(BBOX_TREE * bbox_tree,Uint32 index)354 static __inline__ Uint32 get_intersect_item_options(BBOX_TREE* bbox_tree, Uint32 index)
355 {
356 Uint32 idx;
357
358 idx = bbox_tree->cur_intersect_type;
359 return bbox_tree->intersect[idx].items[index].options;
360 }
361
get_cur_intersect_type(BBOX_TREE * bbox_tree)362 static __inline__ Uint32 get_cur_intersect_type(BBOX_TREE* bbox_tree)
363 {
364 return bbox_tree->cur_intersect_type;
365 }
366
set_cur_intersect_type(BBOX_TREE * bbox_tree,Uint32 intersec_type)367 static __inline__ void set_cur_intersect_type(BBOX_TREE* bbox_tree, Uint32 intersec_type)
368 {
369 bbox_tree->cur_intersect_type = intersec_type;
370 }
371
get_3dobject_id(Uint32 index,Uint32 material)372 static __inline__ Uint32 get_3dobject_id(Uint32 index, Uint32 material)
373 {
374 return (index << 12) + material;
375 }
376
get_3dobject_material(Uint32 ID)377 static __inline__ Uint32 get_3dobject_material(Uint32 ID)
378 {
379 return ID & 0x0FFF;
380 }
381
get_3dobject_index(Uint32 ID)382 static __inline__ Uint32 get_3dobject_index(Uint32 ID)
383 {
384 return ID >> 12;
385 }
386
get_terrain_id(Uint32 x,Uint32 y)387 static __inline__ Uint32 get_terrain_id(Uint32 x, Uint32 y)
388 {
389 return (y << 12) + x;
390 }
391
get_terrain_x(Uint32 ID)392 static __inline__ Uint32 get_terrain_x(Uint32 ID)
393 {
394 return ID & 0xFFF;
395 }
396
get_terrain_y(Uint32 ID)397 static __inline__ Uint32 get_terrain_y(Uint32 ID)
398 {
399 return ID >> 12;
400 }
401
is_blend_3d_object(Uint32 type)402 static __inline__ Uint32 is_blend_3d_object(Uint32 type)
403 {
404 switch (type)
405 {
406 case TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
407 case TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
408 case TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
409 case TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 1;
410 case TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
411 case TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
412 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
413 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 1;
414 case TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 0;
415 case TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
416 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
417 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
418 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 0;
419 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
420 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
421 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
422 default:
423 #ifdef DEBUG
424 LOG_ERROR("Wrong type (%d) for is_blend_3d_object!", type);
425 #endif
426 return 0;
427 }
428 }
429
is_ground_3d_object(Uint32 type)430 static __inline__ Uint32 is_ground_3d_object(Uint32 type)
431 {
432 switch (type)
433 {
434 case TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
435 case TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
436 case TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
437 case TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 1;
438 case TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 0;
439 case TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
440 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
441 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
442 case TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
443 case TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
444 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
445 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 1;
446 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 0;
447 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
448 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
449 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
450 default:
451 #ifdef DEBUG
452 LOG_ERROR("Wrong type (%d) for is_ground_3d_object!", type);
453 #endif
454 return 0;
455 }
456 }
457
is_alpha_3d_object(Uint32 type)458 static __inline__ Uint32 is_alpha_3d_object(Uint32 type)
459 {
460 switch (type)
461 {
462 case TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
463 case TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
464 case TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
465 case TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
466 case TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
467 case TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
468 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
469 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
470 case TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
471 case TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
472 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
473 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
474 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
475 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 1;
476 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 0;
477 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
478 default:
479 #ifdef DEBUG
480 LOG_ERROR("Wrong type (%d) for is_alpha_3d_object!", type);
481 #endif
482 return 0;
483 }
484 }
485
is_self_lit_3d_object(Uint32 type)486 static __inline__ Uint32 is_self_lit_3d_object(Uint32 type)
487 {
488 switch (type)
489 {
490 case TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
491 case TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
492 case TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
493 case TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
494 case TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
495 case TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
496 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
497 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
498 case TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
499 case TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
500 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
501 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
502 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT: return 1;
503 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT: return 0;
504 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT: return 1;
505 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT: return 0;
506 default:
507 #ifdef DEBUG
508 LOG_ERROR("Wrong type (%d) for is_self_lit_3d_object!", type);
509 #endif
510 return 0;
511 }
512 }
513
get_type_mask_from_type(Uint32 type)514 static __inline__ Uint32 get_type_mask_from_type(Uint32 type)
515 {
516 switch (type)
517 {
518 case TYPE_2D_NO_ALPHA_OBJECT:
519 return TYPE_MASK_2D_NO_ALPHA_OBJECT;
520 case TYPE_2D_ALPHA_OBJECT:
521 return TYPE_MASK_2D_ALPHA_OBJECT;
522 case TYPE_3D_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT:
523 return TYPE_MASK_3D_BLEND_SELF_LIT_OBJECT;
524 case TYPE_3D_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT:
525 return TYPE_MASK_3D_BLEND_NO_SELF_LIT_OBJECT;
526 case TYPE_3D_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT:
527 return TYPE_MASK_3D_BLEND_SELF_LIT_OBJECT;
528 case TYPE_3D_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT:
529 return TYPE_MASK_3D_BLEND_NO_SELF_LIT_OBJECT;
530 case TYPE_3D_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT:
531 return TYPE_MASK_3D_BLEND_SELF_LIT_OBJECT;
532 case TYPE_3D_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT:
533 return TYPE_MASK_3D_BLEND_NO_SELF_LIT_OBJECT;
534 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT:
535 return TYPE_MASK_3D_BLEND_SELF_LIT_OBJECT;
536 case TYPE_3D_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT:
537 return TYPE_MASK_3D_BLEND_NO_SELF_LIT_OBJECT;
538 case TYPE_3D_NO_BLEND_GROUND_ALPHA_SELF_LIT_OBJECT:
539 return TYPE_MASK_3D_NO_BLEND_SELF_LIT_OBJECT;
540 case TYPE_3D_NO_BLEND_GROUND_ALPHA_NO_SELF_LIT_OBJECT:
541 return TYPE_MASK_3D_NO_BLEND_NO_SELF_LIT_OBJECT;
542 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_SELF_LIT_OBJECT:
543 return TYPE_MASK_3D_NO_BLEND_SELF_LIT_OBJECT;
544 case TYPE_3D_NO_BLEND_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT:
545 return TYPE_MASK_3D_NO_BLEND_NO_SELF_LIT_OBJECT;
546 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_SELF_LIT_OBJECT:
547 return TYPE_MASK_3D_NO_BLEND_SELF_LIT_OBJECT;
548 case TYPE_3D_NO_BLEND_NO_GROUND_ALPHA_NO_SELF_LIT_OBJECT:
549 return TYPE_MASK_3D_NO_BLEND_NO_SELF_LIT_OBJECT;
550 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_SELF_LIT_OBJECT:
551 return TYPE_MASK_3D_NO_BLEND_SELF_LIT_OBJECT;
552 case TYPE_3D_NO_BLEND_NO_GROUND_NO_ALPHA_NO_SELF_LIT_OBJECT:
553 return TYPE_MASK_3D_NO_BLEND_NO_SELF_LIT_OBJECT;
554 case TYPE_PARTICLE_SYSTEM:
555 return TYPE_MASK_PARTICLE_SYSTEM;
556 case TYPE_LIGHT:
557 return TYPE_MASK_LIGHT;
558 case TYPE_TERRAIN:
559 return TYPE_MASK_TERRAIN;
560 case TYPE_NO_REFLECTIV_WATER:
561 return TYPE_MASK_NO_REFLECTIV_WATER;
562 case TYPE_REFLECTIV_WATER:
563 return TYPE_MASK_REFLECTIV_WATER;
564 default:
565 #ifdef DEBUG
566 LOG_ERROR("Wrong type (%d) for get_type_mask_from_type!", type);
567 #endif
568 return 0;
569 }
570 }
571
572 /**
573 * @ingroup misc
574 * @brief Checks which objects of the bounding-box-tree are in the frustum.
575 *
576 * Checks which objects of the axis-aligned-bounding-box-tree are in the frustum.
577 *
578 * @param bbox_tree The bounding-box-tree holding the objects.
579 * @param frustum The frustum, mostly the view-frustum.
580 * @param mask The mask used with the frustum.
581 *
582 * @callgraph
583 */
584 void check_bbox_tree(BBOX_TREE* bbox_tree);
585
586 /**
587 * @ingroup misc
588 * @brief Frees the given bounding-box-tree.
589 *
590 * Frees the given bounding-box-tree.
591 *
592 * @param bbox_tree The bounding-box-tree.
593 *
594 * @callgraph
595 */
596 void free_bbox_tree(BBOX_TREE* bbox_tree);
597
598 /**
599 * @ingroup misc
600 * @brief Clears the given bounding-box-tree.
601 *
602 * Clears the data of the given bounding-box-tree without
603 * freeing the bounding boxtree.
604 *
605 * @param bbox_tree The bounding-box-tree.
606 *
607 * @callgraph
608 */
609 void clear_bbox_tree(BBOX_TREE* bbox_tree);
610
611 /**
612 * @ingroup misc
613 * @brief Creates a bounding-box-tree.
614 *
615 * Creates an empty bounding-box-tree.
616 *
617 * @retval BBOX_TREE The bounding-box-tree.
618 * @callgraph
619 */
620 BBOX_TREE* build_bbox_tree();
621
622 /**
623 * @ingroup misc
624 * @brief Inits a bounding-box-tree.
625 *
626 * Inits a bounding-box-tree from a list of static objects.
627 *
628 * @param bbox_items The list of the static objects.
629 * @param bbox_tree The bounding-box-tree.
630 * @callgraph
631 */
632 void init_bbox_tree(BBOX_TREE* bbox_tree, const BBOX_ITEMS *bbox_items);
633
634 /**
635 * @ingroup misc
636 * @brief Adds a static light to a list of static objects.
637 *
638 * Adds a static light to a list of static objects.
639 *
640 * @param bbox_items The list of the static objects.
641 * @param ID The ID of the static light.
642 * @param bbox The bounding box of the static light.
643 * @callgraph
644 */
645 void add_light_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox);
646
647 /**
648 * @ingroup misc
649 * @brief Adds a static 3d object to a list of static objects.
650 *
651 * Adds a static 3d object to a list of static objects.
652 *
653 * @param bbox_items The list of the static objects.
654 * @param ID The ID of the static 3d object.
655 * @param bbox The bounding box of the static 3d object.
656 * @param blend Is this a blend object?
657 * @param ground Is this a ground object?
658 * @callgraph
659 */
660 void add_3dobject_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox, Uint32 blend, Uint32 ground, Uint32 alpha, Uint32 self_lit, Uint32 texture_id);
661
662 /**
663 * @ingroup misc
664 * @brief Adds a static 2d object to a list of static objects.
665 *
666 * Adds a static 2d object to a list of static objects.
667 *
668 * @param bbox_items The list of the static objects.
669 * @param ID The ID of the static 2d object.
670 * @param bbox The bounding box of the static 2d object.
671 * @param alpha Is this an alpha object?
672 * @callgraph
673 */
674 void add_2dobject_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox, Uint32 alpha, Uint32 texture_id);
675
676 /**
677 * @ingroup misc
678 * @brief Adds a static particle system to a list of static objects.
679 *
680 * Adds a static particle system to a list of static objects.
681 *
682 * @param bbox_items The list of the static objects.
683 * @param ID The ID of the static particle system.
684 * @param bbox The bounding box of the static particle system.
685 * @param sblend The sblend value of the static particle system.
686 * @param dblend The dblend value of the static particle system.
687 * @callgraph
688 */
689 void add_particle_sys_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox, Uint32 sblend, Uint32 dblend);
690
691 /**
692 * @ingroup misc
693 * @brief Adds a static terrain tile to a list of static objects.
694 *
695 * Adds a static terrain tile to a list of static objects.
696 *
697 * @param bbox_items The list of the static objects.
698 * @param ID The ID of the static terrain tile.
699 * @param bbox The bounding box of the static terrain tile.
700 * @param texture_id The ID of the texture_id.
701 * @callgraph
702 */
703 void add_terrain_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox, Uint32 texture_id);
704
705 /**
706 * @ingroup misc
707 * @brief Adds a static water tile to a list of static objects.
708 *
709 * Adds a static water tile to a list of static objects.
710 *
711 * @param bbox_items The list of the static objects.
712 * @param ID The ID of the static water tile.
713 * @param bbox The bounding box of the static water tile.
714 * @param reflectiv Is the tile reflectiv.
715 * @param texture_id The ID of the texture_id.
716 * @callgraph
717 */
718 void add_water_to_list(BBOX_ITEMS *bbox_items, Uint32 ID, const AABBOX bbox, Uint32 reflectiv, Uint32 texture_id);
719
720 /**
721 * @ingroup misc
722 * @brief Adds a 3d object to the bounding-box-tree.
723 *
724 * Adds a 3d object to the bounding-box-tree.
725 *
726 * @param bbox_tree The bounding-box-tree.
727 * @param ID The ID of the 3d object.
728 * @param bbox The bounding box of the dynamic 3d object.
729 * @param blend Is this a blend object?
730 * @param ground Is this a ground object?
731 * @param dynamic Is this a dynamic object?
732 * @callgraph
733 */
734 void add_3dobject_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 blend, Uint32 ground, Uint32 alpha, Uint32 self_lit, Uint32 texture_id, Uint32 dynamic);
735
736 /**
737 * @ingroup misc
738 * @brief Adds a 2d object to the bounding-box-tree.
739 *
740 * Adds a 2d object to the bounding-box-tree.
741 *
742 * @param bbox_tree The bounding-box-tree.
743 * @param ID The ID of the 3d object.
744 * @param bbox The bounding box of the dynamic 2d object.
745 * @param alpha Is this an alpha object?
746 * @param dynamic Is this a dynamic object?
747 * @callgraph
748 */
749 void add_2dobject_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 alpha, Uint32 texture_id, Uint32 dynamic);
750
751 /**
752 * @ingroup misc
753 * @brief Adds a particle system to the bounding-box-tree.
754 *
755 * Adds a particle system to the bounding-box-tree.
756 *
757 * @param bbox_tree The bounding-box-tree.
758 * @param ID The ID of the particle system.
759 * @param bbox The bounding box of the dynamic particle system.
760 * @param sblend The sblend value of the dynamic particle system.
761 * @param dblend The dblend value of the dynamic particle system.
762 * @param dynamic Is this a dynamic object?
763 * @callgraph
764 */
765 void add_particle_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 sblend, Uint32 dblend, Uint32 dynamic);
766
767 /**
768 * @ingroup misc
769 * @brief Adds a light to the bounding-box-tree.
770 *
771 * Adds a light to the bounding-box-tree.
772 *
773 * @param bbox_tree The bounding-box-tree.
774 * @param ID The ID of the light.
775 * @param bbox The bounding box of the light.
776 * @param dynamic Is this a dynamic object?
777 * @callgraph
778 */
779 void add_light_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 dynamic);
780
781 /**
782 * @ingroup misc
783 * @brief Adds a terrain tile to the bounding-box-tree.
784 *
785 * Adds a terrain tile to the bounding-box-tree.
786 *
787 * @param bbox_tree The bounding-box-tree.
788 * @param ID The ID of the terrain tile.
789 * @param bbox The bounding box of the terrain tile.
790 * @param texture_id The ID of the texture_id.
791 * @callgraph
792 */
793 void add_terrain_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 texture_id, Uint32 dynamic);
794
795 /**
796 * @ingroup misc
797 * @brief Adds a water tile to the bounding-box-tree.
798 *
799 * Adds a water tile to the bounding-box-tree.
800 *
801 * @param bbox_tree The bounding-box-tree.
802 * @param ID The ID of the water tile.
803 * @param bbox The bounding box of the water tile.
804 * @param reflectiv Is the tile reflectiv.
805 * @param texture_id The ID of the texture_id.
806 * @callgraph
807 */
808 void add_water_to_abt(BBOX_TREE *bbox_tree, Uint32 ID, const AABBOX bbox, Uint32 reflectiv, Uint32 texture_id, Uint32 dynamic);
809
810 /**
811 * @ingroup misc
812 * @brief Deletes a 3d object from the bounding-box-tree.
813 *
814 * Deletes a 3d object from the bounding-box-tree.
815 *
816 * @param bbox_tree The bounding-box-tree.
817 * @param ID The ID of the 3d object.
818 * @param blend Is this a blend object?
819 * @param ground Is this a ground object?
820 * @param dynamic Is this a dynamic object?
821 * @callgraph
822 */
823 void delete_3dobject_from_abt(BBOX_TREE *bbox_tree, Uint32 ID, Uint32 blend, Uint32 self_lit);
824
825 /**
826 * @ingroup misc
827 * @brief Deletes a 2d object from the bounding-box-tree.
828 *
829 * Deletes a 2d object from the bounding-box-tree.
830 *
831 * @param bbox_tree The bounding-box-tree.
832 * @param ID The ID of the 2d object.
833 * @param alpha Is this an alpha object?
834 * @param dynamic Is this a dynamic object?
835 * @callgraph
836 */
837 void delete_2dobject_from_abt(BBOX_TREE *bbox_tree, Uint32 ID, Uint32 alpha);
838
839 /**
840 * @ingroup misc
841 * @brief Deletes a particle system from the bounding-box-tree.
842 *
843 * Deletes a particle system from the bounding-box-tree.
844 *
845 * @param bbox_tree The bounding-box-tree.
846 * @param ID The ID of the particle system.
847 * @param dynamic Is this a dynamic object?
848 * @callgraph
849 */
850 void delete_particle_from_abt(BBOX_TREE *bbox_tree, Uint32 ID);
851
852 /**
853 * @ingroup misc
854 * @brief Deletes a light from the bounding-box-tree.
855 *
856 * Deletes a light from the bounding-box-tree.
857 *
858 * @param bbox_tree The bounding-box-tree.
859 * @param ID The ID of the light.
860 * @param dynamic Is this a dynamic object?
861 * @callgraph
862 */
863 void delete_light_from_abt(BBOX_TREE *bbox_tree, Uint32 ID);
864
865 /**
866 * @ingroup misc
867 * @brief Deletes a terrain tile from the bounding-box-tree.
868 *
869 * Deletes a terrain tile from the bounding-box-tree.
870 *
871 * @param bbox_tree The bounding-box-tree.
872 * @param ID The ID of the terrain tile.
873 * @param dynamic Is this a dynamic object?
874 * @callgraph
875 */
876 void delete_terrain_from_abt(BBOX_TREE *bbox_tree, Uint32 ID);
877
878 /**
879 * @ingroup misc
880 * @brief Deletes a water tile from the bounding-box-tree.
881 *
882 * Deletes a water tile from the bounding-box-tree.
883 *
884 * @param bbox_tree The bounding-box-tree.
885 * @param ID The ID of the water tile.
886 * @param reflectiv Is the tile reflectiv.
887 * @param dynamic Is this a dynamic object?
888 * @callgraph
889 */
890 void delete_water_from_abt(BBOX_TREE *bbox_tree, Uint32 ID, Uint32 reflectiv);
891
892 /**
893 * @ingroup misc
894 * @brief Creates a list for static objects.
895 *
896 * Creates a list for static objects.
897 *
898 * @param size The minimum size of the list for the static objects.
899 * @retval BBOX_ITEMS The list for the static objects.
900 * @callgraph
901 */
902 BBOX_ITEMS* create_bbox_items(Uint32 size);
903
904 /**
905 * @ingroup misc
906 * @brief Frees the list for static objects.
907 *
908 * Frees the list for static objects.
909 *
910 * @param bbox_items The list of the static objects.
911 * @callgraph
912 */
913 void free_bbox_items(BBOX_ITEMS* bbox_items);
914
915 /**
916 * @ingroup misc
917 * @brief Sets all intersection lists to update needed.
918 *
919 * Sets all intersection lists to update needed.
920 *
921 * @param bbox_tree The bounding box tree of the intersection list.
922 * @callgraph
923 */
924 void set_all_intersect_update_needed(BBOX_TREE* bbox_tree);
925
926 /**
927 * @ingroup misc
928 * @brief Calculates the scene bounding box.
929 *
930 * Calculates the bounding box that enclose the hole scene.
931 *
932 * @param bbox_tree The bounding-box-tree holding the objects.
933 * @param frustum The frustum.
934 * @param frustum The frustum mask.
935 * @param bbox The bbox of the objects in the frustum.
936 *
937 * @callgraph
938 */
939 void calc_scene_bbox(BBOX_TREE* bbox_tree, AABBOX* bbox);
940
941 extern BBOX_TREE* main_bbox_tree;
942 extern BBOX_ITEMS* main_bbox_tree_items;
943
944 int aabb_in_frustum(const AABBOX bbox);
945 void calculate_light_frustum(double* modl, double* proj);
946
947 /**
948 * @ingroup misc
949 * @brief Checks if the box intersect with the click line.
950 *
951 * Checks if the bounding box intersect with the click line.
952 *
953 * @param bbox bounding box
954 * @retval int 1 (true), if intersect, else 0 (false).
955 * @callgraph
956 */
957 int click_line_bbox_intersection(const AABBOX bbox);
958
959 /**
960 * @ingroup misc
961 * @brief Set the click line.
962 *
963 * Set click line.
964 *
965 * @callgraph
966 */
967 void set_click_line();
968
969 void set_frustum(BBOX_TREE* bbox_tree, const FRUSTUM frustum, Uint32 mask);
970 void check_bbox_tree_shadow(BBOX_TREE* bbox_tree, const FRUSTUM frustum, Uint32 mask, const FRUSTUM view_frustum,
971 Uint32 view_mask, const VECTOR3 light_dir);
972
973 void reflection_portal_check(BBOX_TREE* bbox_tree, const PLANE* portals, Uint32 count);
974
975 extern PLANE* reflection_portals;
976 extern LINE click_line;
977
978 #ifdef __cplusplus
979 } // extern "C"
980 #endif
981
982 #endif
983