FS2_Open
Open source remastering of the Freespace 2 engine
shadows.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Freespace Open 2013. All rights reserved.
3  *
4  * All source code herein is the property of Freespace Open. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 #include "asteroid/asteroid.h"
11 #include "cmdline/cmdline.h"
12 #include "debris/debris.h"
13 #include "graphics/gropengldraw.h"
14 #include "graphics/gropengltnl.h"
15 #include "graphics/shadows.h"
16 #include "lighting/lighting.h"
17 #include "math/vecmat.h"
18 #include "model/model.h"
19 #include "model/modelrender.h"
20 #include "render/3d.h"
21 
22 extern vec3d check_offsets[8];
23 
27 
29 
30 bool shadows_obj_in_frustum(object *objp, matrix *light_orient, vec3d *min, vec3d *max)
31 {
32  vec3d pos, pos_rot;
33 
34  vm_vec_sub(&pos, &objp->pos, &Eye_position);
35  vm_vec_rotate(&pos_rot, &pos, light_orient);
36 
37  if ( (pos_rot.xyz.x - objp->radius) > max->xyz.x
38  || (pos_rot.xyz.x + objp->radius) < min->xyz.x
39  || (pos_rot.xyz.y - objp->radius) > max->xyz.y
40  || (pos_rot.xyz.y + objp->radius) < min->xyz.y
41  || (pos_rot.xyz.z - objp->radius) > max->xyz.z ) {
42  return false;
43  }
44 
45  return true;
46 }
47 
49 {
50  memset(&shadow_data->proj_matrix, 0, sizeof(matrix4));
51 
52  shadow_data->proj_matrix.a1d[0] = 2.0f / ( shadow_data->max.xyz.x - shadow_data->min.xyz.x );
53  shadow_data->proj_matrix.a1d[5] = 2.0f / ( shadow_data->max.xyz.y - shadow_data->min.xyz.y );
54  shadow_data->proj_matrix.a1d[10] = -2.0f / ( shadow_data->max.xyz.z - shadow_data->min.xyz.z );
55  shadow_data->proj_matrix.a1d[12] = -(shadow_data->max.xyz.x + shadow_data->min.xyz.x) / ( shadow_data->max.xyz.x - shadow_data->min.xyz.x );
56  shadow_data->proj_matrix.a1d[13] = -(shadow_data->max.xyz.y + shadow_data->min.xyz.y) / ( shadow_data->max.xyz.y - shadow_data->min.xyz.y );
57  shadow_data->proj_matrix.a1d[14] = -(shadow_data->max.xyz.z + shadow_data->min.xyz.z) / ( shadow_data->max.xyz.z - shadow_data->min.xyz.z );
58  shadow_data->proj_matrix.a1d[15] = 1.0f;
59 }
60 
61 void shadows_debug_show_frustum(matrix* orient, vec3d *pos, float fov, float aspect, float z_near, float z_far)
62 {
63  // find the widths and heights of the near plane and far plane to determine the points of this frustum
64  float near_height = tanf(fov * 0.5f) * z_near;
65  float near_width = near_height * aspect;
66 
67  float far_height = tanf(fov * 0.5f) * z_far;
68  float far_width = far_height * aspect;
69 
70  vec3d up_scale = ZERO_VECTOR;
71  vec3d right_scale = ZERO_VECTOR;
72  vec3d forward_scale_near = orient->vec.fvec;
73  vec3d forward_scale_far = orient->vec.fvec;
74 
75  vm_vec_scale(&forward_scale_near, z_near);
76  vm_vec_scale(&forward_scale_far, z_far);
77 
78  // find the eight points using eye orientation and position
79  vec3d near_top_left = ZERO_VECTOR;
80  vec3d near_top_right = ZERO_VECTOR;
81  vec3d near_bottom_left = ZERO_VECTOR;
82  vec3d near_bottom_right = ZERO_VECTOR;
83 
84  // near top left
85  up_scale = orient->vec.uvec;
86  vm_vec_scale(&up_scale, -near_height);
87 
88  right_scale = orient->vec.rvec;
89  vm_vec_scale(&right_scale, -near_width);
90 
91  vm_vec_add(&near_top_left, &up_scale, &right_scale);
92  vm_vec_add2(&near_top_left, &forward_scale_near);
93 
94  // near top right
95  up_scale = orient->vec.uvec;
96  vm_vec_scale(&up_scale, -near_height);
97 
98  right_scale = orient->vec.rvec;
99  vm_vec_scale(&right_scale, near_width);
100 
101  vm_vec_add(&near_top_right, &up_scale, &right_scale);
102  vm_vec_add2(&near_top_right, &forward_scale_near);
103 
104  // near bottom left
105  up_scale = orient->vec.uvec;
106  vm_vec_scale(&up_scale, near_height);
107 
108  right_scale = orient->vec.rvec;
109  vm_vec_scale(&right_scale, -near_width);
110 
111  vm_vec_add(&near_bottom_left, &up_scale, &right_scale);
112  vm_vec_add2(&near_bottom_left, &forward_scale_near);
113 
114  // near bottom right
115  up_scale = orient->vec.uvec;
116  vm_vec_scale(&up_scale, near_height);
117 
118  right_scale = orient->vec.rvec;
119  vm_vec_scale(&right_scale, near_width);
120 
121  vm_vec_add(&near_bottom_right, &up_scale, &right_scale);
122  vm_vec_add2(&near_bottom_right, &forward_scale_near);
123 
124  vec3d far_top_left = ZERO_VECTOR;
125  vec3d far_top_right = ZERO_VECTOR;
126  vec3d far_bottom_left = ZERO_VECTOR;
127  vec3d far_bottom_right = ZERO_VECTOR;
128 
129  // far top left
130  up_scale = orient->vec.uvec;
131  vm_vec_scale(&up_scale, -far_height);
132 
133  right_scale = orient->vec.rvec;
134  vm_vec_scale(&right_scale, -far_width);
135 
136  vm_vec_add(&far_top_left, &up_scale, &right_scale);
137  vm_vec_add2(&far_top_left, &forward_scale_far);
138 
139  // far top right
140  up_scale = orient->vec.uvec;
141  vm_vec_scale(&up_scale, -far_height);
142 
143  right_scale = orient->vec.rvec;
144  vm_vec_scale(&right_scale, far_width);
145 
146  vm_vec_add(&far_top_right, &up_scale, &right_scale);
147  vm_vec_add2(&far_top_right, &forward_scale_far);
148 
149  // far bottom left
150  up_scale = orient->vec.uvec;
151  vm_vec_scale(&up_scale, far_height);
152 
153  right_scale = orient->vec.rvec;
154  vm_vec_scale(&right_scale, -far_width);
155 
156  vm_vec_add(&far_bottom_left, &up_scale, &right_scale);
157  vm_vec_add2(&far_bottom_left, &forward_scale_far);
158 
159  // far bottom right
160  up_scale = orient->vec.uvec;
161  vm_vec_scale(&up_scale, far_height);
162 
163  right_scale = orient->vec.rvec;
164  vm_vec_scale(&right_scale, far_width);
165 
166  vm_vec_add(&far_bottom_right, &up_scale, &right_scale);
167  vm_vec_add2(&far_bottom_right, &forward_scale_far);
168 
169  // translate frustum
170  vm_vec_add2(&near_bottom_left, pos);
171  vm_vec_add2(&near_bottom_right, pos);
172  vm_vec_add2(&near_top_right, pos);
173  vm_vec_add2(&near_top_left, pos);
174  vm_vec_add2(&far_top_left, pos);
175  vm_vec_add2(&far_top_right, pos);
176  vm_vec_add2(&far_bottom_right, pos);
177  vm_vec_add2(&far_bottom_left, pos);
178 
179  gr_set_color(0, 255, 255);
180  g3_draw_htl_line(&near_bottom_left, &near_bottom_right);
181  g3_draw_htl_line(&near_bottom_right, &near_top_right);
182  g3_draw_htl_line(&near_bottom_right, &near_top_left);
183  g3_draw_htl_line(&near_top_right, &near_top_left);
184  g3_draw_htl_line(&far_top_left, &far_top_right);
185  g3_draw_htl_line(&far_top_right, &far_bottom_right);
186  g3_draw_htl_line(&far_bottom_right, &far_bottom_left);
187  g3_draw_htl_line(&far_bottom_left, &far_top_left);
188 }
189 
190 void shadows_construct_light_frustum(light_frustum_info *shadow_data, matrix *light_matrix, matrix *orient, vec3d *pos, float fov, float aspect, float z_near, float z_far)
191 {
192  // find the widths and heights of the near plane and far plane to determine the points of this frustum
193  float near_height = tanf(fov * 0.5f) * z_near;
194  float near_width = near_height * aspect;
195 
196  float far_height = tanf(fov * 0.5f) * z_far;
197  float far_width = far_height * aspect;
198 
199  vec3d up_scale = ZERO_VECTOR;
200  vec3d right_scale = ZERO_VECTOR;
201  vec3d forward_scale_near = orient->vec.fvec;
202  vec3d forward_scale_far = orient->vec.fvec;
203 
204  vm_vec_scale(&forward_scale_near, z_near);
205  vm_vec_scale(&forward_scale_far, z_far);
206 
207  // find the eight points using eye orientation and position
208  vec3d near_top_left = ZERO_VECTOR;
209  vec3d near_top_right = ZERO_VECTOR;
210  vec3d near_bottom_left = ZERO_VECTOR;
211  vec3d near_bottom_right = ZERO_VECTOR;
212 
213  // near top left
214  up_scale = orient->vec.uvec;
215  vm_vec_scale(&up_scale, -near_height);
216 
217  right_scale = orient->vec.rvec;
218  vm_vec_scale(&right_scale, -near_width);
219 
220  vm_vec_add(&near_top_left, &up_scale, &right_scale);
221  vm_vec_add2(&near_top_left, &forward_scale_near);
222 
223  // near top right
224  up_scale = orient->vec.uvec;
225  vm_vec_scale(&up_scale, -near_height);
226 
227  right_scale = orient->vec.rvec;
228  vm_vec_scale(&right_scale, near_width);
229 
230  vm_vec_add(&near_top_right, &up_scale, &right_scale);
231  vm_vec_add2(&near_top_right, &forward_scale_near);
232 
233  // near bottom left
234  up_scale = orient->vec.uvec;
235  vm_vec_scale(&up_scale, near_height);
236 
237  right_scale = orient->vec.rvec;
238  vm_vec_scale(&right_scale, -near_width);
239 
240  vm_vec_add(&near_bottom_left, &up_scale, &right_scale);
241  vm_vec_add2(&near_bottom_left, &forward_scale_near);
242 
243  // near bottom right
244  up_scale = orient->vec.uvec;
245  vm_vec_scale(&up_scale, near_height);
246 
247  right_scale = orient->vec.rvec;
248  vm_vec_scale(&right_scale, near_width);
249 
250  vm_vec_add(&near_bottom_right, &up_scale, &right_scale);
251  vm_vec_add2(&near_bottom_right, &forward_scale_near);
252 
253  vec3d far_top_left = ZERO_VECTOR;
254  vec3d far_top_right = ZERO_VECTOR;
255  vec3d far_bottom_left = ZERO_VECTOR;
256  vec3d far_bottom_right = ZERO_VECTOR;
257 
258  // far top left
259  up_scale = orient->vec.uvec;
260  vm_vec_scale(&up_scale, -far_height);
261 
262  right_scale = orient->vec.rvec;
263  vm_vec_scale(&right_scale, -far_width);
264 
265  vm_vec_add(&far_top_left, &up_scale, &right_scale);
266  vm_vec_add2(&far_top_left, &forward_scale_far);
267 
268  // far top right
269  up_scale = orient->vec.uvec;
270  vm_vec_scale(&up_scale, -far_height);
271 
272  right_scale = orient->vec.rvec;
273  vm_vec_scale(&right_scale, far_width);
274 
275  vm_vec_add(&far_top_right, &up_scale, &right_scale);
276  vm_vec_add2(&far_top_right, &forward_scale_far);
277 
278  // far bottom left
279  up_scale = orient->vec.uvec;
280  vm_vec_scale(&up_scale, far_height);
281 
282  right_scale = orient->vec.rvec;
283  vm_vec_scale(&right_scale, -far_width);
284 
285  vm_vec_add(&far_bottom_left, &up_scale, &right_scale);
286  vm_vec_add2(&far_bottom_left, &forward_scale_far);
287 
288  // far bottom right
289  up_scale = orient->vec.uvec;
290  vm_vec_scale(&up_scale, far_height);
291 
292  right_scale = orient->vec.rvec;
293  vm_vec_scale(&right_scale, far_width);
294 
295  vm_vec_add(&far_bottom_right, &up_scale, &right_scale);
296  vm_vec_add2(&far_bottom_right, &forward_scale_far);
297 
298  vec3d frustum_pts[8];
299 
300  // bring frustum points into light space
301  vm_vec_rotate(&frustum_pts[0], &near_bottom_left, light_matrix);
302  vm_vec_rotate(&frustum_pts[1], &near_bottom_right, light_matrix);
303  vm_vec_rotate(&frustum_pts[2], &near_top_right, light_matrix);
304  vm_vec_rotate(&frustum_pts[3], &near_top_left, light_matrix);
305  vm_vec_rotate(&frustum_pts[4], &far_top_left, light_matrix);
306  vm_vec_rotate(&frustum_pts[5], &far_top_right, light_matrix);
307  vm_vec_rotate(&frustum_pts[6], &far_bottom_right, light_matrix);
308  vm_vec_rotate(&frustum_pts[7], &far_bottom_left, light_matrix);
309 
310  vec3d min = ZERO_VECTOR;
311  vec3d max = ZERO_VECTOR;
312 
313  min = frustum_pts[0];
314  max = frustum_pts[0];
315 
316  // find min and max of frustum points
317  for (int i = 0; i < 8; ++i) {
318  if ( frustum_pts[i].xyz.x < min.xyz.x ) {
319  min.xyz.x = frustum_pts[i].xyz.x;
320  }
321 
322  if ( frustum_pts[i].xyz.x > max.xyz.x ) {
323  max.xyz.x = frustum_pts[i].xyz.x;
324  }
325 
326  if ( frustum_pts[i].xyz.y < min.xyz.y ) {
327  min.xyz.y = frustum_pts[i].xyz.y;
328  }
329 
330  if ( frustum_pts[i].xyz.y > max.xyz.y ) {
331  max.xyz.y = frustum_pts[i].xyz.y;
332  }
333 
334  if ( frustum_pts[i].xyz.z < min.xyz.z ) {
335  min.xyz.z = frustum_pts[i].xyz.z;
336  }
337 
338  if ( frustum_pts[i].xyz.z > max.xyz.z ) {
339  max.xyz.z = frustum_pts[i].xyz.z;
340  }
341  }
342 
343  shadow_data->min = min;
344  shadow_data->max = max;
345 
346  shadows_construct_light_proj(shadow_data);
347 }
348 
349 matrix shadows_start_render(matrix *eye_orient, vec3d *eye_pos, float fov, float aspect, float veryneardist, float neardist, float middist, float fardist)
350 {
351  if(Static_light.empty())
352  return vmd_identity_matrix;
353 
354  light *lp = *(Static_light.begin());
355 
356  if ( lp == NULL ) {
357  return vmd_identity_matrix;
358  }
359 
360  vec3d light_dir;
361  matrix light_matrix;
362 
363  vm_vec_copy_normalize(&light_dir, &lp->vec);
364  vm_vector_2_matrix(&light_matrix, &light_dir, &eye_orient->vec.uvec, NULL);
365 
366  shadows_construct_light_frustum(&Shadow_frustums[0], &light_matrix, eye_orient, eye_pos, fov, aspect, 0.0f, veryneardist);
367  shadows_construct_light_frustum(&Shadow_frustums[1], &light_matrix, eye_orient, eye_pos, fov, aspect, veryneardist - (veryneardist - 0.0f)* 0.2f, neardist);
368  shadows_construct_light_frustum(&Shadow_frustums[2], &light_matrix, eye_orient, eye_pos, fov, aspect, neardist - (neardist - veryneardist) * 0.2f, middist);
369  shadows_construct_light_frustum(&Shadow_frustums[3], &light_matrix, eye_orient, eye_pos, fov, aspect, middist - (middist - neardist) * 0.2f, fardist);
370 
371  Shadow_cascade_distances[0] = veryneardist;
372  Shadow_cascade_distances[1] = neardist;
373  Shadow_cascade_distances[2] = middist;
374  Shadow_cascade_distances[3] = fardist;
375 
376  Shadow_proj_matrix[0] = Shadow_frustums[0].proj_matrix;
377  Shadow_proj_matrix[1] = Shadow_frustums[1].proj_matrix;
378  Shadow_proj_matrix[2] = Shadow_frustums[2].proj_matrix;
379  Shadow_proj_matrix[3] = Shadow_frustums[3].proj_matrix;
380 
381  gr_shadow_map_start(&Shadow_view_matrix, &light_matrix);
382 
383  return light_matrix;
384 }
385 
387 {
389 }
390 
392 {
393  if ( Static_light.empty() ) {
394  return;
395  }
396 
397  light *lp = *(Static_light.begin());
398 
399  if( Cmdline_nohtl || !Cmdline_shadow_quality || !lp ) {
400  return;
401  }
402 
403  //shadows_debug_show_frustum(&Player_obj->orient, &Player_obj->pos, fov, gr_screen.clip_aspect, Min_draw_distance, 3000.0f);
404 
407 
408  // these cascade distances are a result of some arbitrary tuning to give a good balance of quality and banding.
409  // maybe we could use a more programmatic algorithim?
410  matrix light_matrix = shadows_start_render(eye_orient, eye_pos, fov, gr_screen.clip_aspect, 200.0f, 600.0f, 2500.0f, 8000.0f);
411 
412  draw_list scene;
413  object *objp = Objects;
414 
415  for ( int i = 0; i <= Highest_object_index; i++, objp++ ) {
416  bool cull = true;
417 
418  for ( int j = 0; j < MAX_SHADOW_CASCADES; ++j ) {
419  if ( shadows_obj_in_frustum(objp, &light_matrix, &Shadow_frustums[j].min, &Shadow_frustums[j].max) ) {
420  cull = false;
421  break;
422  }
423  }
424 
425  if ( cull ) {
426  continue;
427  }
428 
429  switch(objp->type)
430  {
431  case OBJ_SHIP:
432  {
433  obj_queue_render(objp, &scene);
434  }
435  break;
436  case OBJ_ASTEROID:
437  {
438  model_render_params render_info;
439 
440  render_info.set_object_number(OBJ_INDEX(objp));
442 
444  model_render_queue(&render_info, &scene, Asteroid_info[Asteroids[objp->instance].asteroid_type].model_num[Asteroids[objp->instance].asteroid_subtype], &objp->orient, &objp->pos);
445  }
446  break;
447 
448  case OBJ_DEBRIS:
449  {
450  debris *db;
451  db = &Debris[objp->instance];
452 
453  if ( !(db->flags & DEBRIS_USED)){
454  continue;
455  }
456 
457  objp = &Objects[db->objnum];
458 
459  model_render_params render_info;
460 
462 
463  submodel_render_queue(&render_info, &scene, db->model_num, db->submodel_num, &objp->orient, &objp->pos);
464  }
465  break;
466  }
467  }
468 
469  scene.init_render();
470  scene.render_all(GR_ZBUFF_FULL);
471 
473 
474  gr_zbias(0);
476  gr_set_cull(0);
477 
478  gr_clear_states();
479  gr_set_buffer(-1);
480 
482 
485 }
#define gr_zbuffer_set
Definition: 2d.h:817
int i
Definition: multi_pxo.cpp:466
float Proj_fov
Definition: 3dsetup.cpp:31
#define MAX_SHADOW_CASCADES
Definition: shadows.h:16
matrix4 Shadow_view_matrix
Definition: shadows.cpp:24
#define gr_end_view_matrix
Definition: 2d.h:896
asteroid Asteroids[MAX_ASTEROIDS]
Definition: asteroid.cpp:63
float a1d[16]
Definition: pstypes.h:130
Definition: pstypes.h:88
bool shadows_obj_in_frustum(object *objp, matrix *light_orient, vec3d *min, vec3d *max)
Definition: shadows.cpp:30
#define OBJ_ASTEROID
Definition: object.h:44
matrix Eye_matrix
Definition: 3dsetup.cpp:26
void set_flags(uint flags)
#define MR_NO_LIGHTING
Definition: model.h:867
#define GR_ZBUFF_FULL
Definition: 2d.h:675
struct vec3d::@225::@227 xyz
light_frustum_info Shadow_frustums[MAX_SHADOW_CASCADES]
Definition: shadows.cpp:28
GLclampf f
Definition: Glext.h:7097
vec3d check_offsets[8]
Definition: objectsort.cpp:112
int model_num
Definition: debris.h:34
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
Definition: vecmat.cpp:933
void shadows_debug_show_frustum(matrix *orient, vec3d *pos, float fov, float aspect, float z_near, float z_far)
Definition: shadows.cpp:61
opengl_texture_state Texture
hull_check orient
Definition: lua.cpp:5049
object * objp
Definition: lua.cpp:3105
vec3d pos
Definition: object.h:152
int asteroid_subtype
Definition: asteroid.h:103
#define gr_end_proj_matrix
Definition: 2d.h:894
void shadows_end_render()
Definition: shadows.cpp:386
SCP_vector< light * > Static_light
Definition: lighting.cpp:36
void gr_set_color(int r, int g, int b)
Definition: 2d.cpp:1188
int asteroid_type
Definition: asteroid.h:102
int submodel_num
Definition: debris.h:35
#define gr_set_view_matrix
Definition: 2d.h:895
void model_render_queue(model_render_params *interp, draw_list *scene, int model_num, matrix *orient, vec3d *pos)
int instance
Definition: object.h:150
matrix shadows_start_render(matrix *eye_orient, vec3d *eye_pos, float fov, float aspect, float veryneardist, float neardist, float middist, float fardist)
Definition: shadows.cpp:349
matrix * vm_vector_2_matrix(matrix *m, const vec3d *fvec, const vec3d *uvec, const vec3d *rvec)
Definition: vecmat.cpp:850
Definition: debris.h:23
void vm_vec_add2(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:178
int Cmdline_nohtl
Definition: cmdline.cpp:438
#define gr_set_proj_matrix
Definition: 2d.h:893
struct matrix::@228::@230 vec
void vm_vec_scale(vec3d *dest, float s)
Definition: vecmat.cpp:248
float clip_aspect
Definition: 2d.h:372
#define MR_NO_TEXTURING
Definition: model.h:868
void model_clear_instance(int model_num)
Definition: modelread.cpp:4624
#define gr_set_buffer
Definition: 2d.h:891
float Max_draw_distance
Definition: 2d.cpp:85
#define OBJ_DEBRIS
Definition: object.h:37
void submodel_render_queue(model_render_params *render_info, draw_list *scene, int model_num, int submodel_num, matrix *orient, vec3d *pos)
int flags
Definition: debris.h:25
void shadows_render_all(float fov, matrix *eye_orient, vec3d *eye_pos)
Definition: shadows.cpp:391
matrix eye_orient
Definition: fredrender.cpp:112
float z
Definition: pstypes.h:91
void init_render(bool sort=true)
float Shadow_cascade_distances[MAX_SHADOW_CASCADES]
Definition: shadows.cpp:26
vec3d eye_pos
Definition: fredrender.cpp:103
debris Debris[MAX_DEBRIS_PIECES]
Definition: debris.cpp:41
int Cmdline_shadow_quality
Definition: cmdline.cpp:344
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
#define ZERO_VECTOR
Definition: vecmat.h:60
#define OBJ_INDEX(objp)
Definition: object.h:235
matrix4 Shadow_proj_matrix[MAX_SHADOW_CASCADES]
Definition: shadows.cpp:25
#define gr_shadow_map_start
Definition: 2d.h:953
#define gr_set_cull
Definition: 2d.h:838
matrix orient
Definition: object.h:153
#define OBJ_SHIP
Definition: object.h:32
int objnum
Definition: debris.h:31
Definition: lighting.h:32
float x
Definition: pstypes.h:91
void shadows_construct_light_frustum(light_frustum_info *shadow_data, matrix *light_matrix, matrix *orient, vec3d *pos, float fov, float aspect, float z_near, float z_far)
Definition: shadows.cpp:190
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:168
vec3d Eye_position
Definition: 3dsetup.cpp:27
#define gr_zbias
Definition: 2d.h:932
opengl_state GL_state
float y
Definition: pstypes.h:91
screen gr_screen
Definition: 2d.cpp:46
float Min_draw_distance
Definition: 2d.cpp:84
#define MR_IS_ASTEROID
Definition: model.h:871
void shadows_construct_light_proj(light_frustum_info *shadow_data)
Definition: shadows.cpp:48
#define gr_clear_states
Definition: 2d.h:946
float vm_vec_copy_normalize(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:427
void render_all(int depth_mode=-1)
int Highest_object_index
Definition: object.cpp:69
vec3d vec
Definition: lighting.h:34
hull_check pos
Definition: lua.cpp:5050
#define gr_shadow_map_end
Definition: 2d.h:954
float fov
Definition: lua.cpp:9155
#define DEBRIS_USED
Definition: debris.h:54
float radius
Definition: object.h:154
matrix4 proj_matrix
Definition: shadows.h:20
void set_object_number(int num)
char type
Definition: object.h:146
void obj_queue_render(object *obj, draw_list *scene)
Definition: object.cpp:1625
SCP_vector< asteroid_info > Asteroid_info
Definition: asteroid.cpp:62
void vm_vec_add(vec3d *dest, const vec3d *src0, const vec3d *src1)
Definition: vecmat.cpp:159
matrix vmd_identity_matrix
Definition: vecmat.cpp:28
void g3_draw_htl_line(const vec3d *start, const vec3d *end)
Definition: 3ddraw.cpp:1975