icculus quake2 doxygen  1.0 dev
gl_mesh.c File Reference
#include "gl_local.h"
#include "anorms.h"
#include "anormtab.h"

Go to the source code of this file.

Macros

#define NUMVERTEXNORMALS   162
 
#define SHADEDOT_QUANT   16
 

Typedefs

typedef float vec4_t[4]
 

Functions

void GL_LerpVerts (int nverts, dtrivertx_t *v, dtrivertx_t *ov, dtrivertx_t *verts, float *lerp, float move[3], float frontv[3], float backv[3])
 
void GL_DrawAliasFrameLerp (dmdl_t *paliashdr, float backlerp)
 
void GL_DrawAliasShadow (dmdl_t *paliashdr, int posenum)
 
static qboolean R_CullAliasModel (vec3_t bbox[8], entity_t *e)
 
void R_DrawAliasModel (entity_t *e)
 

Variables

float r_avertexnormals [NUMVERTEXNORMALS][3]
 
static vec4_t s_lerped [MAX_VERTS]
 
vec3_t shadevector
 
float shadelight [3]
 
float r_avertexnormal_dots [SHADEDOT_QUANT][256]
 
float * shadedots = r_avertexnormal_dots[0]
 
vec3_t lightspot
 
qboolean have_stencil
 

Macro Definition Documentation

◆ NUMVERTEXNORMALS

#define NUMVERTEXNORMALS   162

Definition at line 34 of file gl_mesh.c.

◆ SHADEDOT_QUANT

#define SHADEDOT_QUANT   16

Definition at line 49 of file gl_mesh.c.

Typedef Documentation

◆ vec4_t

typedef float vec4_t[4]

Definition at line 40 of file gl_mesh.c.

Function Documentation

◆ GL_DrawAliasFrameLerp()

void GL_DrawAliasFrameLerp ( dmdl_t paliashdr,
float  backlerp 
)

Definition at line 92 of file gl_mesh.c.

93 {
94  float l;
95  daliasframe_t *frame, *oldframe;
96  dtrivertx_t *v, *ov, *verts;
97  int *order;
98  int count;
99  float frontlerp;
100  float alpha;
101  vec3_t move, delta, vectors[3];
102  vec3_t frontv, backv;
103  int i;
104  int index_xyz;
105  float *lerp;
106 
107  frame = (daliasframe_t *)((byte *)paliashdr + paliashdr->ofs_frames
108  + currententity->frame * paliashdr->framesize);
109  verts = v = frame->verts;
110 
111  oldframe = (daliasframe_t *)((byte *)paliashdr + paliashdr->ofs_frames
112  + currententity->oldframe * paliashdr->framesize);
113  ov = oldframe->verts;
114 
115  order = (int *)((byte *)paliashdr + paliashdr->ofs_glcmds);
116 
117 // glTranslatef (frame->translate[0], frame->translate[1], frame->translate[2]);
118 // glScalef (frame->scale[0], frame->scale[1], frame->scale[2]);
119 
122  else
123  alpha = 1.0;
124 
125  // PMM - added double shell
127  qglDisable( GL_TEXTURE_2D );
128 
129  frontlerp = 1.0 - backlerp;
130 
131  // move should be the delta back to the previous frame * backlerp
133  AngleVectors (currententity->angles, vectors[0], vectors[1], vectors[2]);
134 
135  move[0] = DotProduct (delta, vectors[0]); // forward
136  move[1] = -DotProduct (delta, vectors[1]); // left
137  move[2] = DotProduct (delta, vectors[2]); // up
138 
139  VectorAdd (move, oldframe->translate, move);
140 
141  for (i=0 ; i<3 ; i++)
142  {
143  move[i] = backlerp*move[i] + frontlerp*frame->translate[i];
144  }
145 
146  for (i=0 ; i<3 ; i++)
147  {
148  frontv[i] = frontlerp*frame->scale[i];
149  backv[i] = backlerp*oldframe->scale[i];
150  }
151 
152  lerp = s_lerped[0];
153 
154  GL_LerpVerts( paliashdr->num_xyz, v, ov, verts, lerp, move, frontv, backv );
155 
156  if ( gl_vertex_arrays->value )
157  {
158  float colorArray[MAX_VERTS*4];
159 
160  qglEnableClientState( GL_VERTEX_ARRAY );
161  qglVertexPointer( 3, GL_FLOAT, 16, s_lerped ); // padded for SIMD
162 
163 // if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE ) )
164  // PMM - added double damage shell
166  {
167  qglColor4f( shadelight[0], shadelight[1], shadelight[2], alpha );
168  }
169  else
170  {
171  qglEnableClientState( GL_COLOR_ARRAY );
172  qglColorPointer( 3, GL_FLOAT, 0, colorArray );
173 
174  //
175  // pre light everything
176  //
177  for ( i = 0; i < paliashdr->num_xyz; i++ )
178  {
179  float l = shadedots[verts[i].lightnormalindex];
180 
181  colorArray[i*3+0] = l * shadelight[0];
182  colorArray[i*3+1] = l * shadelight[1];
183  colorArray[i*3+2] = l * shadelight[2];
184  }
185  }
186 
187  if ( qglLockArraysEXT != 0 )
188  qglLockArraysEXT( 0, paliashdr->num_xyz );
189 
190  while (1)
191  {
192  // get the vertex count and primitive type
193  count = *order++;
194  if (!count)
195  break; // done
196  if (count < 0)
197  {
198  count = -count;
199  qglBegin (GL_TRIANGLE_FAN);
200  }
201  else
202  {
203  qglBegin (GL_TRIANGLE_STRIP);
204  }
205 
206  // PMM - added double damage shell
208  {
209  do
210  {
211  index_xyz = order[2];
212  order += 3;
213 
214  qglVertex3fv( s_lerped[index_xyz] );
215 
216  } while (--count);
217  }
218  else
219  {
220  do
221  {
222  // texture coordinates come from the draw list
223  qglTexCoord2f (((float *)order)[0], ((float *)order)[1]);
224  index_xyz = order[2];
225 
226  order += 3;
227 
228  // normals and vertexes come from the frame list
229 // l = shadedots[verts[index_xyz].lightnormalindex];
230 
231 // qglColor4f (l* shadelight[0], l*shadelight[1], l*shadelight[2], alpha);
232  qglArrayElement( index_xyz );
233 
234  } while (--count);
235  }
236  qglEnd ();
237  }
238 
239  if ( qglUnlockArraysEXT != 0 )
240  qglUnlockArraysEXT();
241  }
242  else
243  {
244  while (1)
245  {
246  // get the vertex count and primitive type
247  count = *order++;
248  if (!count)
249  break; // done
250  if (count < 0)
251  {
252  count = -count;
253  qglBegin (GL_TRIANGLE_FAN);
254  }
255  else
256  {
257  qglBegin (GL_TRIANGLE_STRIP);
258  }
259 
261  {
262  do
263  {
264  index_xyz = order[2];
265  order += 3;
266 
267  qglColor4f( shadelight[0], shadelight[1], shadelight[2], alpha);
268  qglVertex3fv (s_lerped[index_xyz]);
269 
270  } while (--count);
271  }
272  else
273  {
274  do
275  {
276  // texture coordinates come from the draw list
277  qglTexCoord2f (((float *)order)[0], ((float *)order)[1]);
278  index_xyz = order[2];
279  order += 3;
280 
281  // normals and vertexes come from the frame list
282  l = shadedots[verts[index_xyz].lightnormalindex];
283 
284  qglColor4f (l* shadelight[0], l*shadelight[1], l*shadelight[2], alpha);
285  qglVertex3fv (s_lerped[index_xyz]);
286  } while (--count);
287  }
288 
289  qglEnd ();
290  }
291  }
292 
293 // if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE ) )
294  // PMM - added double damage shell
296  qglEnable( GL_TEXTURE_2D );
297 }

Referenced by R_DrawAliasModel().

◆ GL_DrawAliasShadow()

void GL_DrawAliasShadow ( dmdl_t paliashdr,
int  posenum 
)

Definition at line 310 of file gl_mesh.c.

311 {
312  dtrivertx_t *verts;
313  int *order;
314  vec3_t point;
315  float height, lheight;
316  int count;
317  daliasframe_t *frame;
318 
319  lheight = currententity->origin[2] - lightspot[2];
320 
321  frame = (daliasframe_t *)((byte *)paliashdr + paliashdr->ofs_frames
322  + currententity->frame * paliashdr->framesize);
323  verts = frame->verts;
324 
325  height = 0;
326 
327  order = (int *)((byte *)paliashdr + paliashdr->ofs_glcmds);
328 
329  height = -lheight + 0.1f;
330 
331  /* stencilbuffer shadows */
333  qglEnable(GL_STENCIL_TEST);
334  qglStencilFunc(GL_EQUAL, 1, 2);
335  qglStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
336  }
337 
338  while (1)
339  {
340  // get the vertex count and primitive type
341  count = *order++;
342  if (!count)
343  break; // done
344  if (count < 0)
345  {
346  count = -count;
347  qglBegin (GL_TRIANGLE_FAN);
348  }
349  else
350  qglBegin (GL_TRIANGLE_STRIP);
351 
352  do
353  {
354  // normals and vertexes come from the frame list
355 /*
356  point[0] = verts[order[2]].v[0] * frame->scale[0] + frame->translate[0];
357  point[1] = verts[order[2]].v[1] * frame->scale[1] + frame->translate[1];
358  point[2] = verts[order[2]].v[2] * frame->scale[2] + frame->translate[2];
359 */
360 
361  memcpy( point, s_lerped[order[2]], sizeof( point ) );
362 
363  point[0] -= shadevector[0]*(point[2]+lheight);
364  point[1] -= shadevector[1]*(point[2]+lheight);
365  point[2] = height;
366 // height -= 0.001;
367  qglVertex3fv (point);
368 
369  order += 3;
370 
371 // verts++;
372 
373  } while (--count);
374 
375  qglEnd ();
376  }
377 
378  /* stencilbuffer shadows */
380  qglDisable(GL_STENCIL_TEST);
381 }

Referenced by R_DrawAliasModel().

◆ GL_LerpVerts()

void GL_LerpVerts ( int  nverts,
dtrivertx_t v,
dtrivertx_t ov,
dtrivertx_t verts,
float *  lerp,
float  move[3],
float  frontv[3],
float  backv[3] 
)

Definition at line 56 of file gl_mesh.c.

57 {
58  int i;
59 
60  //PMM -- added RF_SHELL_DOUBLE, RF_SHELL_HALF_DAM
62  {
63  for (i=0 ; i < nverts; i++, v++, ov++, lerp+=4 )
64  {
65  float *normal = r_avertexnormals[verts[i].lightnormalindex];
66 
67  lerp[0] = move[0] + ov->v[0]*backv[0] + v->v[0]*frontv[0] + normal[0] * POWERSUIT_SCALE;
68  lerp[1] = move[1] + ov->v[1]*backv[1] + v->v[1]*frontv[1] + normal[1] * POWERSUIT_SCALE;
69  lerp[2] = move[2] + ov->v[2]*backv[2] + v->v[2]*frontv[2] + normal[2] * POWERSUIT_SCALE;
70  }
71  }
72  else
73  {
74  for (i=0 ; i < nverts; i++, v++, ov++, lerp+=4)
75  {
76  lerp[0] = move[0] + ov->v[0]*backv[0] + v->v[0]*frontv[0];
77  lerp[1] = move[1] + ov->v[1]*backv[1] + v->v[1]*frontv[1];
78  lerp[2] = move[2] + ov->v[2]*backv[2] + v->v[2]*frontv[2];
79  }
80  }
81 
82 }

Referenced by GL_DrawAliasFrameLerp().

◆ R_CullAliasModel()

static qboolean R_CullAliasModel ( vec3_t  bbox[8],
entity_t e 
)
static

Definition at line 388 of file gl_mesh.c.

389 {
390  int i;
391  vec3_t mins, maxs;
392  dmdl_t *paliashdr;
393  vec3_t vectors[3];
394  vec3_t thismins, oldmins, thismaxs, oldmaxs;
395  daliasframe_t *pframe, *poldframe;
396  vec3_t angles;
397 
398  paliashdr = (dmdl_t *)currentmodel->extradata;
399 
400  if ( ( e->frame >= paliashdr->num_frames ) || ( e->frame < 0 ) )
401  {
402  ri.Con_Printf (PRINT_ALL, "R_CullAliasModel %s: no such frame %d\n",
403  currentmodel->name, e->frame);
404  e->frame = 0;
405  }
406  if ( ( e->oldframe >= paliashdr->num_frames ) || ( e->oldframe < 0 ) )
407  {
408  ri.Con_Printf (PRINT_ALL, "R_CullAliasModel %s: no such oldframe %d\n",
409  currentmodel->name, e->oldframe);
410  e->oldframe = 0;
411  }
412 
413  pframe = ( daliasframe_t * ) ( ( byte * ) paliashdr +
414  paliashdr->ofs_frames +
415  e->frame * paliashdr->framesize);
416 
417  poldframe = ( daliasframe_t * ) ( ( byte * ) paliashdr +
418  paliashdr->ofs_frames +
419  e->oldframe * paliashdr->framesize);
420 
421  /*
422  ** compute axially aligned mins and maxs
423  */
424  if ( pframe == poldframe )
425  {
426  for ( i = 0; i < 3; i++ )
427  {
428  mins[i] = pframe->translate[i];
429  maxs[i] = mins[i] + pframe->scale[i]*255;
430  }
431  }
432  else
433  {
434  for ( i = 0; i < 3; i++ )
435  {
436  thismins[i] = pframe->translate[i];
437  thismaxs[i] = thismins[i] + pframe->scale[i]*255;
438 
439  oldmins[i] = poldframe->translate[i];
440  oldmaxs[i] = oldmins[i] + poldframe->scale[i]*255;
441 
442  if ( thismins[i] < oldmins[i] )
443  mins[i] = thismins[i];
444  else
445  mins[i] = oldmins[i];
446 
447  if ( thismaxs[i] > oldmaxs[i] )
448  maxs[i] = thismaxs[i];
449  else
450  maxs[i] = oldmaxs[i];
451  }
452  }
453 
454  /*
455  ** compute a full bounding box
456  */
457  for ( i = 0; i < 8; i++ )
458  {
459  vec3_t tmp;
460 
461  if ( i & 1 )
462  tmp[0] = mins[0];
463  else
464  tmp[0] = maxs[0];
465 
466  if ( i & 2 )
467  tmp[1] = mins[1];
468  else
469  tmp[1] = maxs[1];
470 
471  if ( i & 4 )
472  tmp[2] = mins[2];
473  else
474  tmp[2] = maxs[2];
475 
476  VectorCopy( tmp, bbox[i] );
477  }
478 
479  /*
480  ** rotate the bounding box
481  */
482  VectorCopy( e->angles, angles );
483  angles[YAW] = -angles[YAW];
484  AngleVectors( angles, vectors[0], vectors[1], vectors[2] );
485 
486  for ( i = 0; i < 8; i++ )
487  {
488  vec3_t tmp;
489 
490  VectorCopy( bbox[i], tmp );
491 
492  bbox[i][0] = DotProduct( vectors[0], tmp );
493  bbox[i][1] = -DotProduct( vectors[1], tmp );
494  bbox[i][2] = DotProduct( vectors[2], tmp );
495 
496  VectorAdd( e->origin, bbox[i], bbox[i] );
497  }
498 
499  {
500  int p, f, aggregatemask = ~0;
501 
502  for ( p = 0; p < 8; p++ )
503  {
504  int mask = 0;
505 
506  for ( f = 0; f < 4; f++ )
507  {
508  float dp = DotProduct( frustum[f].normal, bbox[p] );
509 
510  if ( ( dp - frustum[f].dist ) < 0 )
511  {
512  mask |= ( 1 << f );
513  }
514  }
515 
516  aggregatemask &= mask;
517  }
518 
519  if ( aggregatemask )
520  {
521  return true;
522  }
523 
524  return false;
525  }
526 }

Referenced by R_DrawAliasModel().

◆ R_DrawAliasModel()

void R_DrawAliasModel ( entity_t e)

Definition at line 534 of file gl_mesh.c.

535 {
536  int i;
537  dmdl_t *paliashdr;
538  float an;
539  vec3_t bbox[8];
540  image_t *skin;
541 
542  if ( !( e->flags & RF_WEAPONMODEL ) )
543  {
544  if ( R_CullAliasModel( bbox, e ) )
545  return;
546  }
547 
548  if ( e->flags & RF_WEAPONMODEL )
549  {
550  if ( r_lefthand->value == 2 )
551  return;
552  }
553 
554  paliashdr = (dmdl_t *)currentmodel->extradata;
555 
556  //
557  // get lighting information
558  //
559  // PMM - rewrote, reordered to handle new shells & mixing
560  // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy
561  //
563  {
566  {
567  shadelight[0] = 0.56;
568  shadelight[1] = 0.59;
569  shadelight[2] = 0.45;
570  }
572  {
573  shadelight[0] = 0.9;
574  shadelight[1] = 0.7;
575  }
577  shadelight[0] = 1.0;
579  shadelight[1] = 1.0;
581  shadelight[2] = 1.0;
582  }
583 /*
584  // PMM -special case for godmode
585  if ( (currententity->flags & RF_SHELL_RED) &&
586  (currententity->flags & RF_SHELL_BLUE) &&
587  (currententity->flags & RF_SHELL_GREEN) )
588  {
589  for (i=0 ; i<3 ; i++)
590  shadelight[i] = 1.0;
591  }
592  else if ( currententity->flags & ( RF_SHELL_RED | RF_SHELL_BLUE | RF_SHELL_DOUBLE ) )
593  {
594  VectorClear (shadelight);
595 
596  if ( currententity->flags & RF_SHELL_RED )
597  {
598  shadelight[0] = 1.0;
599  if (currententity->flags & (RF_SHELL_BLUE|RF_SHELL_DOUBLE) )
600  shadelight[2] = 1.0;
601  }
602  else if ( currententity->flags & RF_SHELL_BLUE )
603  {
604  if ( currententity->flags & RF_SHELL_DOUBLE )
605  {
606  shadelight[1] = 1.0;
607  shadelight[2] = 1.0;
608  }
609  else
610  {
611  shadelight[2] = 1.0;
612  }
613  }
614  else if ( currententity->flags & RF_SHELL_DOUBLE )
615  {
616  shadelight[0] = 0.9;
617  shadelight[1] = 0.7;
618  }
619  }
620  else if ( currententity->flags & ( RF_SHELL_HALF_DAM | RF_SHELL_GREEN ) )
621  {
622  VectorClear (shadelight);
623  // PMM - new colors
624  if ( currententity->flags & RF_SHELL_HALF_DAM )
625  {
626  shadelight[0] = 0.56;
627  shadelight[1] = 0.59;
628  shadelight[2] = 0.45;
629  }
630  if ( currententity->flags & RF_SHELL_GREEN )
631  {
632  shadelight[1] = 1.0;
633  }
634  }
635  }
636  //PMM - ok, now flatten these down to range from 0 to 1.0.
637  // max_shell_val = max(shadelight[0], max(shadelight[1], shadelight[2]));
638  // if (max_shell_val > 0)
639  // {
640  // for (i=0; i<3; i++)
641  // {
642  // shadelight[i] = shadelight[i] / max_shell_val;
643  // }
644  // }
645  // pmm
646 */
647  else if ( currententity->flags & RF_FULLBRIGHT )
648  {
649  for (i=0 ; i<3 ; i++)
650  shadelight[i] = 1.0;
651  }
652  else
653  {
655 
656  // player lighting hack for communication back to server
657  // big hack!
659  {
660  // pick the greatest component, which should be the same
661  // as the mono value returned by software
662  if (shadelight[0] > shadelight[1])
663  {
664  if (shadelight[0] > shadelight[2])
665  r_lightlevel->value = 150*shadelight[0];
666  else
667  r_lightlevel->value = 150*shadelight[2];
668  }
669  else
670  {
671  if (shadelight[1] > shadelight[2])
672  r_lightlevel->value = 150*shadelight[1];
673  else
674  r_lightlevel->value = 150*shadelight[2];
675  }
676 
677  }
678 
679  if ( gl_monolightmap->string[0] != '0' )
680  {
681  float s = shadelight[0];
682 
683  if ( s < shadelight[1] )
684  s = shadelight[1];
685  if ( s < shadelight[2] )
686  s = shadelight[2];
687 
688  shadelight[0] = s;
689  shadelight[1] = s;
690  shadelight[2] = s;
691  }
692  }
693 
695  {
696  for (i=0 ; i<3 ; i++)
697  if (shadelight[i] > 0.1)
698  break;
699  if (i == 3)
700  {
701  shadelight[0] = 0.1;
702  shadelight[1] = 0.1;
703  shadelight[2] = 0.1;
704  }
705  }
706 
707  if ( currententity->flags & RF_GLOW )
708  { // bonus items will pulse with time
709  float scale;
710  float min;
711 
712  scale = 0.1 * sin(r_newrefdef.time*7);
713  for (i=0 ; i<3 ; i++)
714  {
715  min = shadelight[i] * 0.8;
716  shadelight[i] += scale;
717  if (shadelight[i] < min)
718  shadelight[i] = min;
719  }
720  }
721 
722 // =================
723 // PGM ir goggles color override
725  {
726  shadelight[0] = 1.0;
727  shadelight[1] = 0.0;
728  shadelight[2] = 0.0;
729  }
730 // PGM
731 // =================
732 
734 
735  an = currententity->angles[1]/180*M_PI;
736  shadevector[0] = cos(-an);
737  shadevector[1] = sin(-an);
738  shadevector[2] = 1;
740 
741  //
742  // locate the proper data
743  //
744 
745  c_alias_polys += paliashdr->num_tris;
746 
747  //
748  // draw all the triangles
749  //
750  if (currententity->flags & RF_DEPTHHACK) // hack the depth range to prevent view model from poking into walls
751  qglDepthRange (gldepthmin, gldepthmin + 0.3*(gldepthmax-gldepthmin));
752 
753  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
754  {
755  extern void MYgluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar );
756 
757  qglMatrixMode( GL_PROJECTION );
758  qglPushMatrix();
759  qglLoadIdentity();
760  qglScalef( -1, 1, 1 );
762  qglMatrixMode( GL_MODELVIEW );
763 
764  qglCullFace( GL_BACK );
765  }
766 
767  qglPushMatrix ();
768  e->angles[PITCH] = -e->angles[PITCH]; // sigh.
769  R_RotateForEntity (e);
770  e->angles[PITCH] = -e->angles[PITCH]; // sigh.
771 
772  // select skin
773  if (currententity->skin)
774  skin = currententity->skin; // custom player skin
775  else
776  {
778  skin = currentmodel->skins[0];
779  else
780  {
782  if (!skin)
783  skin = currentmodel->skins[0];
784  }
785  }
786  if (!skin)
787  skin = r_notexture; // fallback...
788  GL_Bind(skin->texnum);
789 
790  // draw it
791 
792  qglShadeModel (GL_SMOOTH);
793 
794  GL_TexEnv( GL_MODULATE );
796  {
797  qglEnable (GL_BLEND);
798  }
799 
800 
801  if ( (currententity->frame >= paliashdr->num_frames)
802  || (currententity->frame < 0) )
803  {
804  ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such frame %d\n",
806  currententity->frame = 0;
807  currententity->oldframe = 0;
808  }
809 
810  if ( (currententity->oldframe >= paliashdr->num_frames)
811  || (currententity->oldframe < 0))
812  {
813  ri.Con_Printf (PRINT_ALL, "R_DrawAliasModel %s: no such oldframe %d\n",
815  currententity->frame = 0;
816  currententity->oldframe = 0;
817  }
818 
819  if ( !r_lerpmodels->value )
820  currententity->backlerp = 0;
822 
823  GL_TexEnv( GL_REPLACE );
824  qglShadeModel (GL_FLAT);
825 
826  qglPopMatrix ();
827 
828 #if 0
829  qglDisable( GL_CULL_FACE );
830  qglPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
831  qglDisable( GL_TEXTURE_2D );
832  qglBegin( GL_TRIANGLE_STRIP );
833  for ( i = 0; i < 8; i++ )
834  {
835  qglVertex3fv( bbox[i] );
836  }
837  qglEnd();
838  qglEnable( GL_TEXTURE_2D );
839  qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
840  qglEnable( GL_CULL_FACE );
841 #endif
842 
843  if ( ( currententity->flags & RF_WEAPONMODEL ) && ( r_lefthand->value == 1.0F ) )
844  {
845  qglMatrixMode( GL_PROJECTION );
846  qglPopMatrix();
847  qglMatrixMode( GL_MODELVIEW );
848  qglCullFace( GL_FRONT );
849  }
850 
852  {
853  qglDisable (GL_BLEND);
854  }
855 
857  qglDepthRange (gldepthmin, gldepthmax);
858 
859 //#if 1
860  if (gl_shadows->value &&
862  qglPushMatrix ();
863 
864  /* don't rotate shadows on ungodly axes */
865  qglTranslatef(e->origin[0], e->origin[1], e->origin[2]);
866  qglRotatef(e->angles[1], 0, 0, 1);
867 
868  qglDisable (GL_TEXTURE_2D);
869  qglEnable (GL_BLEND);
870  qglColor4f (0,0,0,0.5);
871  GL_DrawAliasShadow (paliashdr, currententity->frame );
872  qglEnable (GL_TEXTURE_2D);
873  qglDisable (GL_BLEND);
874  qglPopMatrix ();
875  }
876 //#endif
877  qglColor4f (1,1,1,1);
878 }

Referenced by R_DrawEntitiesOnList().

Variable Documentation

◆ have_stencil

qboolean have_stencil

Referenced by GL_DrawAliasShadow().

◆ lightspot

vec3_t lightspot

Definition at line 118 of file r_light.c.

Referenced by GL_DrawAliasShadow(), and RecursiveLightPoint().

◆ r_avertexnormal_dots

float r_avertexnormal_dots[SHADEDOT_QUANT][256]
Initial value:
=
# 51 "C:/entry/dev/icculus-quake2/src/ref_gl/gl_mesh.c" 2

Definition at line 50 of file gl_mesh.c.

Referenced by R_DrawAliasModel().

◆ r_avertexnormals

float r_avertexnormals[NUMVERTEXNORMALS][3]
Initial value:
= {
}

Definition at line 36 of file gl_mesh.c.

Referenced by GL_LerpVerts().

◆ s_lerped

vec4_t s_lerped[MAX_VERTS]
static

Definition at line 42 of file gl_mesh.c.

Referenced by GL_DrawAliasFrameLerp(), and GL_DrawAliasShadow().

◆ shadedots

float* shadedots = r_avertexnormal_dots[0]

Definition at line 54 of file gl_mesh.c.

Referenced by GL_DrawAliasFrameLerp(), and R_DrawAliasModel().

◆ shadelight

float shadelight[3]

◆ shadevector

vec3_t shadevector

Definition at line 45 of file gl_mesh.c.

Referenced by GL_DrawAliasShadow(), and R_DrawAliasModel().

RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:618
RF_NOSHADOW
#define RF_NOSHADOW
Definition: q_shared.h:626
dtrivertx_t::lightnormalindex
byte lightnormalindex
Definition: qfiles.h:110
RF_SHELL_RED
#define RF_SHELL_RED
Definition: q_shared.h:623
dmdl_t::ofs_glcmds
int ofs_glcmds
Definition: qfiles.h:157
height
GLsizei height
Definition: qgl_win.c:69
currentmodel
model_t * currentmodel
Definition: r_main.c:37
entity_s::skin
struct image_s * skin
Definition: ref.h:75
YAW
#define YAW
Definition: q_shared.h:66
entity_s::origin
float origin[3]
Definition: ref.h:57
RF_IR_VISIBLE
#define RF_IR_VISIBLE
Definition: q_shared.h:629
daliasframe_t::scale
float scale[3]
Definition: qfiles.h:121
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
gl_vertex_arrays
cvar_t * gl_vertex_arrays
Definition: gl_rmain.c:88
RF_MINLIGHT
#define RF_MINLIGHT
Definition: q_shared.h:613
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:156
RF_SHELL_HALF_DAM
#define RF_SHELL_HALF_DAM
Definition: q_shared.h:631
r_notexture
image_t * r_notexture
Definition: gl_rmain.c:38
gl_shadows
cvar_t * gl_shadows
Definition: gl_rmain.c:108
ri
refimport_t ri
Definition: r_main.c:25
RF_SHELL_GREEN
#define RF_SHELL_GREEN
Definition: q_shared.h:624
v
GLdouble v
Definition: qgl_win.c:143
zNear
GLdouble GLdouble GLdouble GLdouble zNear
Definition: qgl_win.c:159
dmdl_t::num_tris
int num_tris
Definition: qfiles.h:149
gldepthmax
float gldepthmax
Definition: gl_local.h:136
have_stencil
qboolean have_stencil
frustum
cplane_t frustum[4]
Definition: gl_rmain.c:44
R_LightPoint
void R_LightPoint(vec3_t p, vec3_t color)
Definition: r_light.c:224
shadevector
vec3_t shadevector
Definition: gl_mesh.c:45
cvar_s::string
char * string
Definition: q_shared.h:320
entity_s::skinnum
int skinnum
Definition: ref.h:70
VectorClear
#define VectorClear(a)
Definition: q_shared.h:159
i
int i
Definition: q_shared.c:305
GL_DrawAliasShadow
void GL_DrawAliasShadow(dmdl_t *paliashdr, int posenum)
Definition: gl_mesh.c:310
dtrivertx_t
Definition: qfiles.h:107
PITCH
#define PITCH
Definition: q_shared.h:65
refdef_t::rdflags
int rdflags
Definition: ref.h:128
order
GLdouble GLdouble GLint GLint order
Definition: qgl_win.c:225
entity_s::flags
int flags
Definition: ref.h:76
M_PI
#define M_PI
Definition: q_shared.h:135
currententity
entity_t * currententity
Definition: r_bsp.c:28
r_avertexnormal_dots
float r_avertexnormal_dots[SHADEDOT_QUANT][256]
Definition: gl_mesh.c:50
r_lefthand
cvar_t * r_lefthand
Definition: r_main.c:111
model_s::extradata
void * extradata
Definition: r_model.h:235
gl_stencilshadow
cvar_t * gl_stencilshadow
Definition: gl_rmain.c:109
AngleVectors
void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up)
Definition: q_shared.c:93
RF_WEAPONMODEL
#define RF_WEAPONMODEL
Definition: q_shared.h:615
refimport_t::Con_Printf
void(* Con_Printf)(int print_level, char *str,...)
Definition: ref.h:228
PRINT_ALL
#define PRINT_ALL
Definition: qcommon.h:743
SHADEDOT_QUANT
#define SHADEDOT_QUANT
Definition: gl_mesh.c:49
skin
cvar_t * skin
Definition: cl_main.c:95
shadedots
float * shadedots
Definition: gl_mesh.c:54
entity_s::alpha
float alpha
Definition: ref.h:73
dmdl_t::ofs_frames
int ofs_frames
Definition: qfiles.h:156
r_lerpmodels
cvar_t * r_lerpmodels
Definition: r_main.c:130
s_lerped
static vec4_t s_lerped[MAX_VERTS]
Definition: gl_mesh.c:42
RF_DEPTHHACK
#define RF_DEPTHHACK
Definition: q_shared.h:617
r_avertexnormals
float r_avertexnormals[NUMVERTEXNORMALS][3]
Definition: gl_mesh.c:36
RDF_IRGOGGLES
#define RDF_IRGOGGLES
Definition: q_shared.h:649
GL_Bind
void GL_Bind(int texnum)
Definition: gl_image.c:136
entity_s::oldframe
int oldframe
Definition: ref.h:64
R_CullAliasModel
static qboolean R_CullAliasModel(vec3_t bbox[8], entity_t *e)
Definition: gl_mesh.c:388
RF_SHELL_DOUBLE
#define RF_SHELL_DOUBLE
Definition: q_shared.h:630
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:36
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:155
dmdl_t::num_xyz
int num_xyz
Definition: qfiles.h:147
cvar_s::value
float value
Definition: q_shared.h:324
entity_s::backlerp
float backlerp
Definition: ref.h:69
VectorNormalize
vec_t VectorNormalize(vec3_t v)
Definition: q_shared.c:681
dmdl_t::framesize
int framesize
Definition: qfiles.h:144
refdef_t::time
float time
Definition: ref.h:127
RF_GLOW
#define RF_GLOW
Definition: q_shared.h:622
daliasframe_t::translate
float translate[3]
Definition: qfiles.h:122
alpha
GLfloat GLfloat GLfloat alpha
Definition: qgl_win.c:74
refdef_t::height
int height
Definition: ref.h:122
MAX_MD2SKINS
#define MAX_MD2SKINS
Definition: qfiles.h:92
MYgluPerspective
void MYgluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
Definition: gl_rmain.c:677
GL_DrawAliasFrameLerp
void GL_DrawAliasFrameLerp(dmdl_t *paliashdr, float backlerp)
Definition: gl_mesh.c:92
r_lightlevel
cvar_t * r_lightlevel
Definition: r_main.c:134
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:157
entity_s::frame
int frame
Definition: ref.h:58
zFar
GLclampd zFar
Definition: qgl_win.c:125
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:158
model_s::skins
image_t * skins[MAX_MD2SKINS]
Definition: r_model.h:234
MAX_VERTS
#define MAX_VERTS
Definition: qfiles.h:90
c_alias_polys
int c_alias_polys
Definition: gl_local.h:164
model_s::name
char name[MAX_QPATH]
Definition: r_model.h:173
POWERSUIT_SCALE
#define POWERSUIT_SCALE
Definition: ref.h:30
lightspot
vec3_t lightspot
Definition: r_light.c:118
RF_FULLBRIGHT
#define RF_FULLBRIGHT
Definition: q_shared.h:616
GL_TexEnv
void GL_TexEnv(GLenum mode)
Definition: gl_image.c:125
daliasframe_t
Definition: qfiles.h:119
shadelight
float shadelight[3]
Definition: gl_mesh.c:46
refdef_t::fov_y
float fov_y
Definition: ref.h:123
daliasframe_t::verts
dtrivertx_t verts[1]
Definition: qfiles.h:124
R_RotateForEntity
void R_RotateForEntity(entity_t *e)
Definition: gl_rmain.c:160
refdef_t::width
int width
Definition: ref.h:122
RF_SHELL_BLUE
#define RF_SHELL_BLUE
Definition: q_shared.h:625
image_s
Definition: r_local.h:65
mask
GLint GLuint mask
Definition: qgl_win.c:317
gldepthmin
float gldepthmin
Definition: gl_rmain.c:33
gl_monolightmap
cvar_t * gl_monolightmap
Definition: gl_rmain.c:112
entity_s::oldorigin
float oldorigin[3]
Definition: ref.h:63
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:127
dmdl_t
Definition: qfiles.h:137
GL_LerpVerts
void GL_LerpVerts(int nverts, dtrivertx_t *v, dtrivertx_t *ov, dtrivertx_t *verts, float *lerp, float move[3], float frontv[3], float backv[3])
Definition: gl_mesh.c:56
entity_s::angles
float angles[3]
Definition: ref.h:52
count
GLint GLsizei count
Definition: qgl_win.c:128
dmdl_t::num_frames
int num_frames
Definition: qfiles.h:151