vkQuake2 doxygen  1.0 dev
r_alias.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 */
20 // r_alias.c: routines for setting up to draw alias models
21 
22 /*
23 ** use a real variable to control lerping
24 */
25 #include "r_local.h"
26 
27 
28 //PGM
29 extern byte iractive;
30 //PGM
31 
33 
35 
37 
38 //qb: colored lighting from leilei
42 
45 
49 
50 
53 
54 float aliastransform[3][4];
55 float aliasworldtransform[3][4];
57 
58 static float s_ziscale;
60 
61 
62 #define NUMVERTEXNORMALS 162
63 
65 #include "anorms.h"
66 };
67 
68 
69 void R_AliasSetUpLerpData(dmdl_t *pmdl, float backlerp);
70 void R_AliasSetUpTransform(void);
71 void R_AliasTransformVector(vec3_t in, vec3_t out, float m[3][4]);
73 
74 void R_AliasTransformFinalVerts(int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv);
75 
76 void R_AliasLerpFrames(dmdl_t *paliashdr, float backlerp);
77 
78 /*
79 ================
80 R_AliasCheckBBox
81 ================
82 */
83 
84 #define BBOX_TRIVIAL_ACCEPT 0
85 #define BBOX_MUST_CLIP_XY 1
86 #define BBOX_MUST_CLIP_Z 2
87 #define BBOX_TRIVIAL_REJECT 8
88 
89 /*
90 ** R_AliasCheckFrameBBox
91 **
92 ** Checks a specific alias frame bounding box
93 */
94 unsigned long R_AliasCheckFrameBBox(daliasframe_t *frame, float worldxf[3][4])
95 {
96  unsigned long aggregate_and_clipcode = ~0U,
97  aggregate_or_clipcode = 0;
98  int i;
99  vec3_t mins, maxs;
100  vec3_t transformed_min, transformed_max;
101  qboolean zclipped = false, zfullyclipped = true;
102 
103  /*
104  ** get the exact frame bounding box
105  */
106  for (i = 0; i < 3; i++)
107  {
108  mins[i] = frame->translate[i];
109  maxs[i] = mins[i] + frame->scale[i] * 255;
110  }
111 
112  /*
113  ** transform the min and max values into view space
114  */
115  R_AliasTransformVector(mins, transformed_min, aliastransform);
116  R_AliasTransformVector(maxs, transformed_max, aliastransform);
117 
118  if (transformed_min[2] >= ALIAS_Z_CLIP_PLANE)
119  zfullyclipped = false;
120  if (transformed_max[2] >= ALIAS_Z_CLIP_PLANE)
121  zfullyclipped = false;
122 
123  if (zfullyclipped)
124  {
125  return BBOX_TRIVIAL_REJECT;
126  }
127  if (zclipped)
128  {
130  }
131 
132  /*
133  ** build a transformed bounding box from the given min and max
134  */
135  for (i = 0; i < 8; i++)
136  {
137  int j;
138  vec3_t tmp, transformed;
139  unsigned long clipcode = 0;
140 
141  if (i & 1)
142  tmp[0] = mins[0];
143  else
144  tmp[0] = maxs[0];
145 
146  if (i & 2)
147  tmp[1] = mins[1];
148  else
149  tmp[1] = maxs[1];
150 
151  if (i & 4)
152  tmp[2] = mins[2];
153  else
154  tmp[2] = maxs[2];
155 
156  R_AliasTransformVector(tmp, transformed, worldxf);
157 
158  for (j = 0; j < 4; j++)
159  {
160  float dp = DotProduct(transformed, view_clipplanes[j].normal);
161 
162  if ((dp - view_clipplanes[j].dist) < 0.0F)
163  clipcode |= 1 << j;
164  }
165 
166  aggregate_and_clipcode &= clipcode;
167  aggregate_or_clipcode |= clipcode;
168  }
169 
170  if (aggregate_and_clipcode)
171  {
172  return BBOX_TRIVIAL_REJECT;
173  }
174  if (!aggregate_or_clipcode)
175  {
176  return BBOX_TRIVIAL_ACCEPT;
177  }
178 
179  return BBOX_MUST_CLIP_XY;
180 }
181 
183 {
184  unsigned long ccodes[2] = { 0, 0 };
185 
187 
188  /*
189  ** non-lerping model
190  */
191  if (currententity->backlerp == 0)
192  {
193  if (ccodes[0] == BBOX_TRIVIAL_ACCEPT)
194  return BBOX_TRIVIAL_ACCEPT;
195  else if (ccodes[0] & BBOX_TRIVIAL_REJECT)
196  return BBOX_TRIVIAL_REJECT;
197  else
198  return (ccodes[0] & ~BBOX_TRIVIAL_REJECT);
199  }
200 
202 
203  if ((ccodes[0] | ccodes[1]) == BBOX_TRIVIAL_ACCEPT)
204  return BBOX_TRIVIAL_ACCEPT;
205  else if ((ccodes[0] & ccodes[1]) & BBOX_TRIVIAL_REJECT)
206  return BBOX_TRIVIAL_REJECT;
207  else
208  return (ccodes[0] | ccodes[1]) & ~BBOX_TRIVIAL_REJECT;
209 }
210 
211 
212 /*
213 ================
214 R_AliasTransformVector
215 ================
216 */
217 void R_AliasTransformVector(vec3_t in, vec3_t out, float xf[3][4])
218 {
219  out[0] = DotProduct(in, xf[0]) + xf[0][3];
220  out[1] = DotProduct(in, xf[1]) + xf[1][3];
221  out[2] = DotProduct(in, xf[2]) + xf[2][3];
222 }
223 
224 
225 /*
226 ================
227 R_AliasPreparePoints
228 
229 General clipped case
230 ================
231 */
232 typedef struct
233 {
235  dtrivertx_t *last_verts; // verts from the last frame
236  dtrivertx_t *this_verts; // verts from this frame
237  finalvert_t *dest_verts; // destination for transformed verts
239 
241 
243 {
244  int i;
245  dstvert_t *pstverts;
246  dtriangle_t *ptri;
247  finalvert_t *pfv[3];
248  finalvert_t finalverts[MAXALIASVERTS +
249  ((CACHE_SIZE - 1) / sizeof(finalvert_t)) + 3];
250  finalvert_t *pfinalverts;
251 
252  //PGM
254  // iractive = 0;
255  // if(r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & RF_IR_VISIBLE)
256  // iractive = 1;
257  //PGM
258 
259  // put work vertexes on stack, cache aligned
260  pfinalverts = (finalvert_t *)
261  (((intptr_t)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
262 
267 
272 
273  // clip and draw all triangles
274  //
275  pstverts = (dstvert_t *)((byte *)s_pmdl + s_pmdl->ofs_st);
276  ptri = (dtriangle_t *)((byte *)s_pmdl + s_pmdl->ofs_tris);
277 
278  if ((currententity->flags & RF_WEAPONMODEL) && (r_lefthand->value == 1.0F))
279  {
280  for (i = 0; i < s_pmdl->num_tris; i++, ptri++)
281  {
282  pfv[0] = &pfinalverts[ptri->index_xyz[0]];
283  pfv[1] = &pfinalverts[ptri->index_xyz[1]];
284  pfv[2] = &pfinalverts[ptri->index_xyz[2]];
285 
286  if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
287  continue; // completely clipped
288 
289  // insert s/t coordinates
290  pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
291  pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;
292 
293  pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
294  pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;
295 
296  pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
297  pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;
298 
299  if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags))
300  { // totally unclipped
301  aliastriangleparms.a = pfv[2];
302  aliastriangleparms.b = pfv[1];
303  aliastriangleparms.c = pfv[0];
304 
305  R_DrawTriangle();
306  }
307  else
308  {
309  if (coloredlights)
310  R_AliasClipTriangleRGB(pfv[2], pfv[1], pfv[0]);
311  else
312  R_AliasClipTriangle(pfv[2], pfv[1], pfv[0]);
313  }
314  }
315  }
316  else
317  {
318  for (i = 0; i < s_pmdl->num_tris; i++, ptri++)
319  {
320  pfv[0] = &pfinalverts[ptri->index_xyz[0]];
321  pfv[1] = &pfinalverts[ptri->index_xyz[1]];
322  pfv[2] = &pfinalverts[ptri->index_xyz[2]];
323 
324  if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
325  continue; // completely clipped
326 
327  // insert s/t coordinates
328  pfv[0]->s = pstverts[ptri->index_st[0]].s << 16;
329  pfv[0]->t = pstverts[ptri->index_st[0]].t << 16;
330 
331  pfv[1]->s = pstverts[ptri->index_st[1]].s << 16;
332  pfv[1]->t = pstverts[ptri->index_st[1]].t << 16;
333 
334  pfv[2]->s = pstverts[ptri->index_st[2]].s << 16;
335  pfv[2]->t = pstverts[ptri->index_st[2]].t << 16;
336 
337  if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags))
338  { // totally unclipped
339  aliastriangleparms.a = pfv[0];
340  aliastriangleparms.b = pfv[1];
341  aliastriangleparms.c = pfv[2];
342 
343  R_DrawTriangle();
344  }
345  else
346  { // partially clipped
347  if (coloredlights)
348  R_AliasClipTriangleRGB(pfv[0], pfv[1], pfv[2]);
349  else
350  R_AliasClipTriangle(pfv[0], pfv[1], pfv[2]);
351  }
352  }
353  }
354 }
355 
356 
357 /*
358 ================
359 R_AliasSetUpTransform
360 ================
361 */
363 {
364  int i;
365  static float viewmatrix[3][4];
366  vec3_t angles;
367 
368  // TODO: should really be stored with the entity instead of being reconstructed
369  // TODO: should use a look-up table
370  // TODO: could cache lazily, stored in the entity
371  //
372  angles[ROLL] = currententity->angles[ROLL];
373  angles[PITCH] = currententity->angles[PITCH];
374  angles[YAW] = currententity->angles[YAW];
376 
377  // TODO: can do this with simple matrix rearrangement
378 
379  memset(aliasworldtransform, 0, sizeof(aliasworldtransform));
380  memset(aliasoldworldtransform, 0, sizeof(aliasworldtransform));
381 
382  for (i = 0; i < 3; i++)
383  {
387  }
388 
392 
396 
397  // FIXME: can do more efficiently than full concatenation
398  // memcpy( rotationmatrix, t2matrix, sizeof( rotationmatrix ) );
399 
400  // R_ConcatTransforms (t2matrix, tmatrix, rotationmatrix);
401 
402  // TODO: should be global, set when vright, etc., set
403  VectorCopy(vright, viewmatrix[0]);
404  VectorCopy(vup, viewmatrix[1]);
405  VectorInverse(viewmatrix[1]);
406  VectorCopy(vpn, viewmatrix[2]);
407 
408  viewmatrix[0][3] = 0;
409  viewmatrix[1][3] = 0;
410  viewmatrix[2][3] = 0;
411 
412  // memcpy( aliasworldtransform, rotationmatrix, sizeof( aliastransform ) );
413 
415 
419 
423 }
424 
425 
426 /*
427 ================
428 R_AliasTransformFinalVerts
429 ================
430 */
431 #if id386 && !defined __linux__ && !defined __FreeBSD__
432 void R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv )
433 {
434  float lightcos;
435  float lerped_vert[3];
436  int byte_to_dword_ptr_var;
437  int tmpint;
438 
439  float one = 1.0F;
440  float zi;
441 
442  static float FALIAS_Z_CLIP_PLANE = ALIAS_Z_CLIP_PLANE;
443  static float PS_SCALE = POWERSUIT_SCALE;
444 
445  __asm mov ecx, numpoints
446 
447  /*
448  lerped_vert[0] = r_lerp_move[0] + oldv->v[0]*r_lerp_backv[0] + newv->v[0]*r_lerp_frontv[0];
449  lerped_vert[1] = r_lerp_move[1] + oldv->v[1]*r_lerp_backv[1] + newv->v[1]*r_lerp_frontv[1];
450  lerped_vert[2] = r_lerp_move[2] + oldv->v[2]*r_lerp_backv[2] + newv->v[2]*r_lerp_frontv[2];
451  */
452 top_of_loop:
453 
454  __asm mov esi, oldv
455  __asm mov edi, newv
456 
457  __asm xor ebx, ebx
458 
459  __asm mov bl, byte ptr [esi+DTRIVERTX_V0]
460  __asm mov byte_to_dword_ptr_var, ebx
461  __asm fild dword ptr byte_to_dword_ptr_var
462  __asm fmul dword ptr [r_lerp_backv+0] ; oldv[0]*rlb[0]
463 
464  __asm mov bl, byte ptr [esi+DTRIVERTX_V1]
465  __asm mov byte_to_dword_ptr_var, ebx
466  __asm fild dword ptr byte_to_dword_ptr_var
467  __asm fmul dword ptr [r_lerp_backv+4] ; oldv[1]*rlb[1] | oldv[0]*rlb[0]
468 
469  __asm mov bl, byte ptr [esi+DTRIVERTX_V2]
470  __asm mov byte_to_dword_ptr_var, ebx
471  __asm fild dword ptr byte_to_dword_ptr_var
472  __asm fmul dword ptr [r_lerp_backv+8] ; oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
473 
474  __asm mov bl, byte ptr [edi+DTRIVERTX_V0]
475  __asm mov byte_to_dword_ptr_var, ebx
476  __asm fild dword ptr byte_to_dword_ptr_var
477  __asm fmul dword ptr [r_lerp_frontv+0] ; newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
478 
479  __asm mov bl, byte ptr [edi+DTRIVERTX_V1]
480  __asm mov byte_to_dword_ptr_var, ebx
481  __asm fild dword ptr byte_to_dword_ptr_var
482  __asm fmul dword ptr [r_lerp_frontv+4] ; newv[1]*rlf[1] | newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
483 
484  __asm mov bl, byte ptr [edi+DTRIVERTX_V2]
485  __asm mov byte_to_dword_ptr_var, ebx
486  __asm fild dword ptr byte_to_dword_ptr_var
487  __asm fmul dword ptr [r_lerp_frontv+8] ; newv[2]*rlf[2] | newv[1]*rlf[1] | newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
488 
489  __asm fxch st(5) ; oldv[0]*rlb[0] | newv[1]*rlf[1] | newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | newv[2]*rlf[2]
490  __asm faddp st(2), st ; newv[1]*rlf[1] | oldv[0]*rlb[0] + newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | newv[2]*rlf[2]
491  __asm faddp st(3), st ; oldv[0]*rlb[0] + newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] + newv[1]*rlf[1] | newv[2]*rlf[2]
492  __asm fxch st(1) ; oldv[2]*rlb[2] | oldv[0]*rlb[0] + newv[0]*rlf[0] | oldv[1]*rlb[1] + newv[1]*rlf[1] | newv[2]*rlf[2]
493  __asm faddp st(3), st ; oldv[0]*rlb[0] + newv[0]*rlf[0] | oldv[1]*rlb[1] + newv[1]*rlf[1] | oldv[2]*rlb[2] + newv[2]*rlf[2]
494  __asm fadd dword ptr [r_lerp_move+0] ; lv0 | oldv[1]*rlb[1] + newv[1]*rlf[1] | oldv[2]*rlb[2] + newv[2]*rlf[2]
495  __asm fxch st(1) ; oldv[1]*rlb[1] + newv[1]*rlf[1] | lv0 | oldv[2]*rlb[2] + newv[2]*rlf[2]
496  __asm fadd dword ptr [r_lerp_move+4] ; lv1 | lv0 | oldv[2]*rlb[2] + newv[2]*rlf[2]
497  __asm fxch st(2) ; oldv[2]*rlb[2] + newv[2]*rlf[2] | lv0 | lv1
498  __asm fadd dword ptr [r_lerp_move+8] ; lv2 | lv0 | lv1
499  __asm fxch st(1) ; lv0 | lv2 | lv1
500  __asm fstp dword ptr [lerped_vert+0] ; lv2 | lv1
501  __asm fstp dword ptr [lerped_vert+8] ; lv2
502  __asm fstp dword ptr [lerped_vert+4] ; (empty)
503 
504  __asm mov eax, currententity
505  __asm mov eax, dword ptr [eax+ENTITY_FLAGS]
507  __asm and eax, ebx
508  __asm jz not_powersuit
509 
510  /*
511  ** lerped_vert[0] += lightnormal[0] * POWERSUIT_SCALE
512  ** lerped_vert[1] += lightnormal[1] * POWERSUIT_SCALE
513  ** lerped_vert[2] += lightnormal[2] * POWERSUIT_SCALE
514  */
515 
516  __asm xor ebx, ebx
517  __asm mov bl, byte ptr [edi+DTRIVERTX_LNI]
518  __asm mov eax, 12
519  __asm mul ebx
520  __asm lea eax, [r_avertexnormals+eax]
521 
522  __asm fld dword ptr [eax+0] ; n[0]
523  __asm fmul PS_SCALE ; n[0] * PS
524  __asm fld dword ptr [eax+4] ; n[1] | n[0] * PS
525  __asm fmul PS_SCALE ; n[1] * PS | n[0] * PS
526  __asm fld dword ptr [eax+8] ; n[2] | n[1] * PS | n[0] * PS
527  __asm fmul PS_SCALE ; n[2] * PS | n[1] * PS | n[0] * PS
528  __asm fld dword ptr [lerped_vert+0] ; lv0 | n[2] * PS | n[1] * PS | n[0] * PS
529  __asm faddp st(3), st ; n[2] * PS | n[1] * PS | n[0] * PS + lv0
530  __asm fld dword ptr [lerped_vert+4] ; lv1 | n[2] * PS | n[1] * PS | n[0] * PS + lv0
531  __asm faddp st(2), st ; n[2] * PS | n[1] * PS + lv1 | n[0] * PS + lv0
532  __asm fadd dword ptr [lerped_vert+8] ; n[2] * PS + lv2 | n[1] * PS + lv1 | n[0] * PS + lv0
533  __asm fxch st(2) ; LV0 | LV1 | LV2
534  __asm fstp dword ptr [lerped_vert+0] ; LV1 | LV2
535  __asm fstp dword ptr [lerped_vert+4] ; LV2
536  __asm fstp dword ptr [lerped_vert+8] ; (empty)
537 
538 not_powersuit:
539 
540  /*
541  fv->flags = 0;
542 
543  fv->xyz[0] = DotProduct(lerped_vert, aliastransform[0]) + aliastransform[0][3];
544  fv->xyz[1] = DotProduct(lerped_vert, aliastransform[1]) + aliastransform[1][3];
545  fv->xyz[2] = DotProduct(lerped_vert, aliastransform[2]) + aliastransform[2][3];
546  */
547  __asm mov eax, fv
548  __asm mov dword ptr [eax+FINALVERT_FLAGS], 0
549 
550  __asm fld dword ptr [lerped_vert+0] ; lv0
551  __asm fmul dword ptr [aliastransform+0] ; lv0*at[0][0]
552  __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[0][0]
553  __asm fmul dword ptr [aliastransform+4] ; lv1*at[0][1] | lv0*at[0][0]
554  __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[0][1] | lv0*at[0][0]
555  __asm fmul dword ptr [aliastransform+8] ; lv2*at[0][2] | lv1*at[0][1] | lv0*at[0][0]
556  __asm fxch st(2) ; lv0*at[0][0] | lv1*at[0][1] | lv2*at[0][2]
557  __asm faddp st(1), st ; lv0*at[0][0] + lv1*at[0][1] | lv2*at[0][2]
558  __asm faddp st(1), st ; lv0*at[0][0] + lv1*at[0][1] + lv2*at[0][2]
559  __asm fadd dword ptr [aliastransform+12] ; FV.X
560 
561  __asm fld dword ptr [lerped_vert+0] ; lv0
562  __asm fmul dword ptr [aliastransform+16] ; lv0*at[1][0]
563  __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[1][0]
564  __asm fmul dword ptr [aliastransform+20] ; lv1*at[1][1] | lv0*at[1][0]
565  __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[1][1] | lv0*at[1][0]
566  __asm fmul dword ptr [aliastransform+24] ; lv2*at[1][2] | lv1*at[1][1] | lv0*at[1][0]
567  __asm fxch st(2) ; lv0*at[1][0] | lv1*at[1][1] | lv2*at[1][2]
568  __asm faddp st(1), st ; lv0*at[1][0] + lv1*at[1][1] | lv2*at[1][2]
569  __asm faddp st(1), st ; lv0*at[1][0] + lv1*at[1][1] + lv2*at[1][2]
570  __asm fadd dword ptr [aliastransform+28] ; FV.Y | FV.X
571  __asm fxch st(1) ; FV.X | FV.Y
572  __asm fstp dword ptr [eax+FINALVERT_X] ; FV.Y
573 
574  __asm fld dword ptr [lerped_vert+0] ; lv0
575  __asm fmul dword ptr [aliastransform+32] ; lv0*at[2][0]
576  __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[2][0]
577  __asm fmul dword ptr [aliastransform+36] ; lv1*at[2][1] | lv0*at[2][0]
578  __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[2][1] | lv0*at[2][0]
579  __asm fmul dword ptr [aliastransform+40] ; lv2*at[2][2] | lv1*at[2][1] | lv0*at[2][0]
580  __asm fxch st(2) ; lv0*at[2][0] | lv1*at[2][1] | lv2*at[2][2]
581  __asm faddp st(1), st ; lv0*at[2][0] + lv1*at[2][1] | lv2*at[2][2]
582  __asm faddp st(1), st ; lv0*at[2][0] + lv1*at[2][1] + lv2*at[2][2]
583  __asm fadd dword ptr [aliastransform+44] ; FV.Z | FV.Y
584  __asm fxch st(1) ; FV.Y | FV.Z
585  __asm fstp dword ptr [eax+FINALVERT_Y] ; FV.Z
586  __asm fstp dword ptr [eax+FINALVERT_Z] ; (empty)
587 
588  /*
589  ** lighting
590  **
591  ** plightnormal = r_avertexnormals[newv->lightnormalindex];
592  ** lightcos = DotProduct (plightnormal, r_plightvec);
593  ** temp = r_ambientlight;
594  */
595  __asm xor ebx, ebx
596  __asm mov bl, byte ptr [edi+DTRIVERTX_LNI]
597  __asm mov eax, 12
598  __asm mul ebx
599  __asm lea eax, [r_avertexnormals+eax]
600  __asm lea ebx, r_plightvec
601 
602  __asm fld dword ptr [eax+0]
603  __asm fmul dword ptr [ebx+0]
604  __asm fld dword ptr [eax+4]
605  __asm fmul dword ptr [ebx+4]
606  __asm fld dword ptr [eax+8]
607  __asm fmul dword ptr [ebx+8]
608  __asm fxch st(2)
609  __asm faddp st(1), st
610  __asm faddp st(1), st
611  __asm fstp dword ptr lightcos
612  __asm mov eax, lightcos
613  __asm mov ebx, r_ambientlight
614 
615  /*
616  if (lightcos < 0)
617  {
618  temp += (int)(r_shadelight * lightcos);
619 
620  // clamp; because we limited the minimum ambient and shading light, we
621  // don't have to clamp low light, just bright
622  if (temp < 0)
623  temp = 0;
624  }
625 
626  fv->v[4] = temp;
627  */
628  __asm or eax, eax
629  __asm jns store_fv4
630 
631  __asm fld dword ptr r_shadelight
632  __asm fmul dword ptr lightcos
633  __asm fistp dword ptr tmpint
634  __asm add ebx, tmpint
635 
636  __asm or ebx, ebx
637  __asm jns store_fv4
638  __asm mov ebx, 0
639 
640 store_fv4:
641  __asm mov edi, fv
642  __asm mov dword ptr [edi+FINALVERT_V4], ebx
643 
644  __asm mov edx, dword ptr [edi+FINALVERT_FLAGS]
645 
646  /*
647  ** do clip testing and projection here
648  */
649  /*
650  if ( dest_vert->xyz[2] < ALIAS_Z_CLIP_PLANE )
651  {
652  dest_vert->flags |= ALIAS_Z_CLIP;
653  }
654  else
655  {
656  R_AliasProjectAndClipTestFinalVert( dest_vert );
657  }
658  */
659  __asm mov eax, dword ptr [edi+FINALVERT_Z]
660  __asm and eax, eax
661  __asm js alias_z_clip
662  __asm cmp eax, FALIAS_Z_CLIP_PLANE
663  __asm jl alias_z_clip
664 
665  /*
666  This is the code to R_AliasProjectAndClipTestFinalVert
667 
668  float zi;
669  float x, y, z;
670 
671  x = fv->xyz[0];
672  y = fv->xyz[1];
673  z = fv->xyz[2];
674  zi = 1.0 / z;
675 
676  fv->v[5] = zi * s_ziscale;
677 
678  fv->v[0] = (x * aliasxscale * zi) + aliasxcenter;
679  fv->v[1] = (y * aliasyscale * zi) + aliasycenter;
680  */
681  __asm fld one ; 1
682  __asm fdiv dword ptr [edi+FINALVERT_Z] ; zi
683 
684  __asm mov eax, dword ptr [edi+32]
685  __asm mov eax, dword ptr [edi+64]
686 
687  __asm fst zi ; zi
688  __asm fmul s_ziscale ; fv5
689  __asm fld dword ptr [edi+FINALVERT_X] ; x | fv5
690  __asm fmul aliasxscale ; x * aliasxscale | fv5
691  __asm fld dword ptr [edi+FINALVERT_Y] ; y | x * aliasxscale | fv5
692  __asm fmul aliasyscale ; y * aliasyscale | x * aliasxscale | fv5
693  __asm fxch st(1) ; x * aliasxscale | y * aliasyscale | fv5
694  __asm fmul zi ; x * asx * zi | y * asy | fv5
695  __asm fadd aliasxcenter ; fv0 | y * asy | fv5
696  __asm fxch st(1) ; y * asy | fv0 | fv5
697  __asm fmul zi ; y * asy * zi | fv0 | fv5
698  __asm fadd aliasycenter ; fv1 | fv0 | fv5
699  __asm fxch st(2) ; fv5 | fv0 | fv1
700  __asm fistp dword ptr [edi+FINALVERT_V5] ; fv0 | fv1
701  __asm fistp dword ptr [edi+FINALVERT_V0] ; fv1
702  __asm fistp dword ptr [edi+FINALVERT_V1] ; (empty)
703 
704  /*
705  if (fv->v[0] < r_refdef.aliasvrect.x)
706  fv->flags |= ALIAS_LEFT_CLIP;
707  if (fv->v[1] < r_refdef.aliasvrect.y)
708  fv->flags |= ALIAS_TOP_CLIP;
709  if (fv->v[0] > r_refdef.aliasvrectright)
710  fv->flags |= ALIAS_RIGHT_CLIP;
711  if (fv->v[1] > r_refdef.aliasvrectbottom)
712  fv->flags |= ALIAS_BOTTOM_CLIP;
713  */
714  __asm mov eax, dword ptr [edi+FINALVERT_V0]
715  __asm mov ebx, dword ptr [edi+FINALVERT_V1]
716 
717  __asm cmp eax, r_refdef.aliasvrect.x
718  __asm jge ct_alias_top
719  __asm or edx, ALIAS_LEFT_CLIP
720 ct_alias_top:
721  __asm cmp ebx, r_refdef.aliasvrect.y
722  __asm jge ct_alias_right
723  __asm or edx, ALIAS_TOP_CLIP
724 ct_alias_right:
725  __asm cmp eax, r_refdef.aliasvrectright
726  __asm jle ct_alias_bottom
727  __asm or edx, ALIAS_RIGHT_CLIP
728 ct_alias_bottom:
729  __asm cmp ebx, r_refdef.aliasvrectbottom
730  __asm jle end_of_loop
731  __asm or edx, ALIAS_BOTTOM_CLIP
732 
733  __asm jmp end_of_loop
734 
735 alias_z_clip:
736  __asm or edx, ALIAS_Z_CLIP
737 
738 end_of_loop:
739 
740  __asm mov dword ptr [edi+FINALVERT_FLAGS], edx
741  __asm add oldv, DTRIVERTX_SIZE
742  __asm add newv, DTRIVERTX_SIZE
743  __asm add fv, FINALVERT_SIZE
744 
745  __asm dec ecx
746  __asm jnz top_of_loop
747 }
748 #else
750 {
751  int i;
752 
753  for (i = 0; i < numpoints; i++, fv++, oldv++, newv++)
754  {
755  int temp;
756  float lightcos, *plightnormal;
757  vec3_t lerped_vert;
758 
759  lerped_vert[0] = r_lerp_move[0] + oldv->v[0] * r_lerp_backv[0] + newv->v[0] * r_lerp_frontv[0];
760  lerped_vert[1] = r_lerp_move[1] + oldv->v[1] * r_lerp_backv[1] + newv->v[1] * r_lerp_frontv[1];
761  lerped_vert[2] = r_lerp_move[2] + oldv->v[2] * r_lerp_backv[2] + newv->v[2] * r_lerp_frontv[2];
762 
763  plightnormal = r_avertexnormals[newv->lightnormalindex];
764 
765  // PMM - added double damage shell
767  {
768  lerped_vert[0] += plightnormal[0] * POWERSUIT_SCALE;
769  lerped_vert[1] += plightnormal[1] * POWERSUIT_SCALE;
770  lerped_vert[2] += plightnormal[2] * POWERSUIT_SCALE;
771  }
772 
773  fv->xyz[0] = DotProduct(lerped_vert, aliastransform[0]) + aliastransform[0][3];
774  fv->xyz[1] = DotProduct(lerped_vert, aliastransform[1]) + aliastransform[1][3];
775  fv->xyz[2] = DotProduct(lerped_vert, aliastransform[2]) + aliastransform[2][3];
776 
777  fv->flags = 0;
778 
779  // lighting
780  lightcos = DotProduct(plightnormal, r_plightvec);
781  temp = r_ambientlight;
782 
783  if (lightcos < 0)
784  {
785  temp += (int)(r_shadelight * lightcos);
786 
787  // clamp; because we limited the minimum ambient and shading light, we
788  // don't have to clamp low light, just bright
789  if (temp < 0)
790  temp = 0;
791  }
792 
793  fv->l = temp;
794 
795  if (fv->xyz[2] < ALIAS_Z_CLIP_PLANE)
796  {
797  fv->flags |= ALIAS_Z_CLIP;
798  }
799  else
800  {
802  }
803  }
804 }
805 
806 #endif
807 
808 /*
809 ================
810 R_AliasProjectAndClipTestFinalVert
811 ================
812 */
814 {
815  float zi;
816  float x, y, z;
817 
818  // project points
819  x = fv->xyz[0];
820  y = fv->xyz[1];
821  z = fv->xyz[2];
822  zi = 1.0 / z;
823 
824  fv->zi = zi * s_ziscale;
825 
826  fv->u = (x * aliasxscale * zi) + aliasxcenter;
827  fv->v = (y * aliasyscale * zi) + aliasycenter;
828 
829  if (fv->u < r_refdef.aliasvrect.x)
830  fv->flags |= ALIAS_LEFT_CLIP;
831  if (fv->v < r_refdef.aliasvrect.y)
832  fv->flags |= ALIAS_TOP_CLIP;
833  if (fv->u > r_refdef.aliasvrectright)
834  fv->flags |= ALIAS_RIGHT_CLIP;
835  if (fv->v > r_refdef.aliasvrectbottom)
836  fv->flags |= ALIAS_BOTTOM_CLIP;
837 }
838 
839 /*
840 ===============
841 R_AliasSetupSkin
842 ===============
843 */
845 {
846  int skinnum;
847  image_t *pskindesc;
848 
849  if (currententity->skin)
850  pskindesc = currententity->skin;
851  else
852  {
853  skinnum = currententity->skinnum;
854  if ((skinnum >= s_pmdl->num_skins) || (skinnum < 0))
855  {
856  ri.Con_Printf(PRINT_ALL, "R_AliasSetupSkin %s: no such skin # %d\n",
857  currentmodel->name, skinnum);
858  skinnum = 0;
859  }
860 
861  pskindesc = currentmodel->skins[skinnum];
862  }
863 
864  if (!pskindesc)
865  return false;
866 
867  r_affinetridesc.pskin = pskindesc->pixels[0];
868  r_affinetridesc.skinwidth = pskindesc->width;
869  r_affinetridesc.skinheight = pskindesc->height;
870 
871  R_PolysetUpdateTables(); // FIXME: precalc edge lookups
872 
873  return true;
874 }
875 
876 
877 /*
878 ================
879 R_AliasSetupLighting
880 
881 FIXME: put lighting into tables
882 ================
883 */
885 {
886  alight_t lighting;
887 
888  /*
889  float lightvec[3] = {-1, 0, 0};
890  float rlightvec[3] = {-1, 0, 0};
891  float glightvec[3] = {-1, 0, 0};
892  float blightvec[3] = {-1, 0, 0};
893  */
894 
895  float lightvec[3] = { 0.2, -0.8, 0.6 };
896  float rlightvec[3] = { -1, 0, 0 };
897  float glightvec[3] = { 0, -1, 0 };
898  float blightvec[3] = { 0, 0, -1 };
899  //qb: use shadelight. vec3_t light;
900  int i, j;
901 
902  // all components of light should be identical in software
904  {
905  for (i = 0; i < 3; i++)
906  shadelight[i] = 1.0;
907  }
908  else
909  {
911  }
912 
913  // save off light value for server to look at (BIG HACK!)
915  r_lightlevel->value = 150.0 * shadelight[0];
916 
917 
919  {
920  for (i = 0; i < 3; i++)
921  if (shadelight[i] < 0.1)
922  shadelight[i] = 0.1;
923  }
924 
925  if (currententity->flags & RF_GLOW)
926  { // bonus items will pulse with time
927  float scale;
928  float min;
929 
930  scale = 0.1 * sin(r_newrefdef.time * 7);
931  for (i = 0; i < 3; i++)
932  {
933  min = shadelight[i] * 0.8;
934  shadelight[i] += scale;
935  if (shadelight[i] < min)
936  shadelight[i] = min;
937  }
938  }
939 
940  j = (shadelight[0] + shadelight[1] + shadelight[2])*0.3333 * 255;
941 
942  lighting.ambientlight = j;
943  lighting.shadelight = j;
944 
945 
946  lighting.plightvec = lightvec;
947 
948  lighting.prlightvec = rlightvec;
949  lighting.pglightvec = glightvec;
950  lighting.pblightvec = blightvec;
951 
952  // clamp lighting so it doesn't overbright as much
953  if (lighting.ambientlight > 128)
954  lighting.ambientlight = 128;
955  if (lighting.ambientlight + lighting.shadelight > 192)
956  lighting.shadelight = 192 - lighting.ambientlight;
957 
958  // guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't have
959  // to clamp off the bottom
960  r_ambientlight = lighting.ambientlight;
961 
964 
966 
969 
970  r_shadelight = lighting.shadelight;
971 
972  if (r_shadelight < 0)
973  r_shadelight = 0;
974 
976 
977  // rotate the lighting vector into the model's frame of reference
980  r_plightvec[2] = DotProduct(lighting.plightvec, s_alias_up);
981 
985 }
986 
987 
988 /*
989 =================
990 R_AliasSetupFrames
991 
992 =================
993 */
995 {
996  int thisframe = currententity->frame;
997  int lastframe = currententity->oldframe;
998 
999  if ((thisframe >= pmdl->num_frames) || (thisframe < 0))
1000  {
1001  ri.Con_Printf(PRINT_ALL, "R_AliasSetupFrames %s: no such thisframe %d\n",
1002  currentmodel->name, thisframe);
1003  thisframe = 0;
1004  }
1005  if ((lastframe >= pmdl->num_frames) || (lastframe < 0))
1006  {
1007  ri.Con_Printf(PRINT_ALL, "R_AliasSetupFrames %s: no such lastframe %d\n",
1008  currentmodel->name, lastframe);
1009  lastframe = 0;
1010  }
1011 
1012  r_thisframe = (daliasframe_t *)((byte *)pmdl + pmdl->ofs_frames
1013  + thisframe * pmdl->framesize);
1014 
1015  r_lastframe = (daliasframe_t *)((byte *)pmdl + pmdl->ofs_frames
1016  + lastframe * pmdl->framesize);
1017 }
1018 
1019 /*
1020 ** R_AliasSetUpLerpData
1021 **
1022 ** Precomputes lerp coefficients used for the whole frame.
1023 */
1024 void R_AliasSetUpLerpData(dmdl_t *pmdl, float backlerp)
1025 {
1026  float frontlerp;
1027  vec3_t translation, vectors[3];
1028  int i;
1029 
1030  frontlerp = 1.0F - backlerp;
1031 
1032  /*
1033  ** convert entity's angles into discrete vectors for R, U, and F
1034  */
1035  AngleVectors(currententity->angles, vectors[0], vectors[1], vectors[2]);
1036 
1037  /*
1038  ** translation is the vector from last position to this position
1039  */
1041 
1042  /*
1043  ** move should be the delta back to the previous frame * backlerp
1044  */
1045  r_lerp_move[0] = DotProduct(translation, vectors[0]); // forward
1046  r_lerp_move[1] = -DotProduct(translation, vectors[1]); // left
1047  r_lerp_move[2] = DotProduct(translation, vectors[2]); // up
1048 
1050 
1051  for (i = 0; i < 3; i++)
1052  {
1053  r_lerp_move[i] = backlerp*r_lerp_move[i] + frontlerp * r_thisframe->translate[i];
1054  }
1055 
1056  for (i = 0; i < 3; i++)
1057  {
1058  r_lerp_frontv[i] = frontlerp * r_thisframe->scale[i];
1059  r_lerp_backv[i] = backlerp * r_lastframe->scale[i];
1060  }
1061 }
1062 
1063 /*
1064 ================
1065 R_AliasDrawModel
1066 ================
1067 */
1069 {
1070  extern void(*d_pdrawspans)(void *);
1071  extern void R_PolysetDrawSpans8_Opaque_Coloured(void *);
1072  extern void R_PolysetDrawSpans8_33(void *);
1073  extern void R_PolysetDrawSpans8_66(void *);
1074  extern void R_PolysetDrawSpansConstant8_33(void *);
1075  extern void R_PolysetDrawSpansConstant8_66(void *);
1076 
1078 
1079  if (r_lerpmodels->value == 0)
1080  currententity->backlerp = 0;
1081 
1083  {
1084  if (r_lefthand->value == 1.0F)
1086  else if (r_lefthand->value == 2.0F)
1087  return;
1088  }
1089 
1090  /*
1091  ** we have to set our frame pointers and transformations before
1092  ** doing any real work
1093  */
1096 
1097  // see if the bounding box lets us trivially reject, also sets
1098  // trivial accept status
1100  {
1101  if ((currententity->flags & RF_WEAPONMODEL) && (r_lefthand->value == 1.0F))
1102  {
1104  }
1105  return;
1106  }
1107 
1108  // set up the skin and verify it exists
1109  if (!R_AliasSetupSkin())
1110  {
1111  ri.Con_Printf(PRINT_ALL, "R_AliasDrawModel %s: NULL skin found\n",
1112  currentmodel->name);
1113  return;
1114  }
1115 
1116  r_amodels_drawn++;
1118 
1119  /*
1120  ** select the proper span routine based on translucency
1121  */
1122  // PMM - added double damage shell
1123  // PMM - reordered to handle blending
1125  {
1126  int color;
1127 
1128  // PMM - added double
1130  // PMM - reordered, new shells after old shells (so they get overriden)
1131 
1132  if (color == RF_SHELL_RED)
1134  else if (color == RF_SHELL_GREEN)
1136  else if (color == RF_SHELL_BLUE)
1138  else if (color == (RF_SHELL_RED | RF_SHELL_GREEN))
1140  else if (color == (RF_SHELL_RED | RF_SHELL_BLUE))
1142  else if (color == (RF_SHELL_BLUE | RF_SHELL_GREEN))
1144  // PMM - added this .. it's yellowish
1145  else if (color == (RF_SHELL_DOUBLE))
1147  else if (color == (RF_SHELL_HALF_DAM))
1149  // pmm
1150  else
1152  /* if ( color & RF_SHELL_RED )
1153  {
1154  if ( ( color & RF_SHELL_BLUE) && ( color & RF_SHELL_GREEN) )
1155  r_aliasblendcolor = SHELL_WHITE_COLOR;
1156  else if ( color & (RF_SHELL_BLUE | RF_SHELL_DOUBLE))
1157  r_aliasblendcolor = SHELL_RB_COLOR;
1158  else
1159  r_aliasblendcolor = SHELL_RED_COLOR;
1160  }
1161  else if ( color & RF_SHELL_BLUE)
1162  {
1163  if ( color & RF_SHELL_DOUBLE )
1164  r_aliasblendcolor = SHELL_CYAN_COLOR;
1165  else
1166  r_aliasblendcolor = SHELL_BLUE_COLOR;
1167  }
1168  else if ( color & (RF_SHELL_DOUBLE) )
1169  r_aliasblendcolor = SHELL_DOUBLE_COLOR;
1170  else if ( color & (RF_SHELL_HALF_DAM) )
1171  r_aliasblendcolor = SHELL_HALF_DAM_COLOR;
1172  else if ( color & RF_SHELL_GREEN )
1173  r_aliasblendcolor = SHELL_GREEN_COLOR;
1174  else
1175  r_aliasblendcolor = SHELL_WHITE_COLOR;
1176  */
1177 
1178  if (currententity->alpha > 0.33)
1180  else
1182  }
1183  else if (currententity->flags & RF_TRANSLUCENT)
1184  {
1185  if (currententity->alpha > 0.66)
1187  else if (currententity->alpha > 0.33)
1189  else
1191  }
1192  else
1193  {
1195  }
1196 
1197  /*
1198  ** compute this_frame and old_frame addresses
1199  */
1201 
1203  s_ziscale = (float)0x8000 * (float)0x10000 * 3.0;
1204  else
1205  s_ziscale = (float)0x8000 * (float)0x10000;
1206 
1208 
1209  if ((currententity->flags & RF_WEAPONMODEL) && (r_lefthand->value == 1.0F))
1210  {
1212  }
1213 }
1214 
1215 
1216 
R_PolysetDrawSpans8_Opaque_Coloured
void R_PolysetDrawSpans8_Opaque_Coloured(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1198
RF_TRANSLUCENT
#define RF_TRANSLUCENT
Definition: q_shared.h:604
R_PolysetDrawSpans8_33
void R_PolysetDrawSpans8_33(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1005
ALIAS_Z_CLIP_PLANE
#define ALIAS_Z_CLIP_PLANE
Definition: r_local.h:235
r_thisframe
daliasframe_t * r_thisframe
Definition: r_alias.c:51
DTRIVERTX_LNI
#define DTRIVERTX_LNI
Definition: qfiles.h:116
dtrivertx_t::lightnormalindex
byte lightnormalindex
Definition: qfiles.h:110
r_prlightvec
vec3_t r_prlightvec
Definition: r_alias.c:39
RF_SHELL_RED
#define RF_SHELL_RED
Definition: q_shared.h:609
BBOX_MUST_CLIP_Z
#define BBOX_MUST_CLIP_Z
Definition: r_alias.c:86
currentmodel
model_t * currentmodel
Definition: r_main.c:39
entity_s::skin
struct image_s * skin
Definition: ref.h:75
YAW
#define YAW
Definition: q_shared.h:73
entity_s::origin
float origin[3]
Definition: ref.h:57
RF_IR_VISIBLE
#define RF_IR_VISIBLE
Definition: q_shared.h:614
daliasframe_t::scale
float scale[3]
Definition: qfiles.h:121
affinetridesc_t
Definition: r_local.h:326
int
CONST PIXELFORMATDESCRIPTOR int
Definition: qgl_win.c:35
transformed
static vec3_t transformed
Definition: r_part.c:468
NUMVERTEXNORMALS
#define NUMVERTEXNORMALS
Definition: r_alias.c:62
RF_MINLIGHT
#define RF_MINLIGHT
Definition: q_shared.h:599
FINALVERT_V5
#define FINALVERT_V5
Definition: r_local.h:309
VectorSubtract
#define VectorSubtract(a, b, c)
Definition: q_shared.h:163
aliasbatchedtransformdata
aliasbatchedtransformdata_t aliasbatchedtransformdata
Definition: r_alias.c:240
FINALVERT_V0
#define FINALVERT_V0
Definition: r_local.h:304
RF_SHELL_HALF_DAM
#define RF_SHELL_HALF_DAM
Definition: q_shared.h:616
DTRIVERTX_SIZE
#define DTRIVERTX_SIZE
Definition: qfiles.h:117
R_AliasSetupSkin
static qboolean R_AliasSetupSkin(void)
Definition: r_alias.c:844
R_PolysetUpdateTables
void R_PolysetUpdateTables(void)
Definition: r_polyse.c:196
aliasbatchedtransformdata_t
Definition: r_alias.c:232
ri
refimport_t ri
Definition: r_main.c:25
aliasxcenter
float aliasxcenter
Definition: r_local.h:762
RF_SHELL_GREEN
#define RF_SHELL_GREEN
Definition: q_shared.h:610
aliastriangleparms_t::b
finalvert_t * b
Definition: r_local.h:772
s_alias_forward
static vec3_t s_alias_forward
Definition: r_alias.c:59
U
#define U(a, b, c, d, k, s)
Definition: md4.c:27
s_alias_up
static vec3_t s_alias_up
Definition: r_alias.c:59
st
spawn_temp_t st
Definition: g_main.c:27
dmdl_t::num_tris
int num_tris
Definition: qfiles.h:149
CACHE_SIZE
#define CACHE_SIZE
Definition: d_ifacea.h:22
R_PolysetDrawSpans8_66
void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1100
vright
vec3_t vright
Definition: r_main.c:74
alight_t::prlightvec
float * prlightvec
Definition: r_local.h:363
DTRIVERTX_V0
#define DTRIVERTX_V0
Definition: qfiles.h:113
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
z
GLdouble GLdouble z
Definition: qgl_win.c:283
entity_s::skinnum
int skinnum
Definition: ref.h:70
i
int i
Definition: q_shared.c:305
BBOX_MUST_CLIP_XY
#define BBOX_MUST_CLIP_XY
Definition: r_alias.c:85
dstvert_t::s
short s
Definition: qfiles.h:97
fv
float fv
Definition: r_edge.c:75
DTRIVERTX_V2
#define DTRIVERTX_V2
Definition: qfiles.h:115
dtrivertx_t
Definition: qfiles.h:107
d_pdrawspans
void(* d_pdrawspans)(spanpackage_t *pspanpackage)
Definition: r_polyse.c:130
PITCH
#define PITCH
Definition: q_shared.h:72
r_origin
vec3_t r_origin
Definition: r_main.c:75
refdef_t::rdflags
int rdflags
Definition: ref.h:110
finalvert_s::t
int t
Definition: r_local.h:293
aliasbatchedtransformdata_t::num_points
int num_points
Definition: r_alias.c:234
entity_s::flags
int flags
Definition: ref.h:76
currententity
entity_t * currententity
Definition: r_bsp.c:28
FINALVERT_Y
#define FINALVERT_Y
Definition: r_local.h:312
aliasbatchedtransformdata_t::dest_verts
finalvert_t * dest_verts
Definition: r_alias.c:237
r_local.h
SHELL_DOUBLE_COLOR
#define SHELL_DOUBLE_COLOR
Definition: ref.h:42
finalvert_s
Definition: r_local.h:292
R_DrawTriangle
void R_DrawTriangle(void)
Definition: r_polyse.c:218
FINALVERT_SIZE
#define FINALVERT_SIZE
Definition: r_local.h:319
R_AliasClipTriangle
void R_AliasClipTriangle(finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
Definition: r_aclip.c:271
r_lefthand
cvar_t * r_lefthand
Definition: r_main.c:117
model_s::extradata
void * extradata
Definition: r_model.h:235
ALIAS_Z_CLIP
#define ALIAS_Z_CLIP
Definition: r_local.h:215
vup
vec3_t vup
Definition: r_main.c:72
j
GLint j
Definition: qgl_win.c:150
FINALVERT_V1
#define FINALVERT_V1
Definition: r_local.h:305
r_plightvec
vec3_t r_plightvec
Definition: r_alias.c:36
aliasxscale
float aliasxscale
Definition: r_main.c:85
aliasycenter
float aliasycenter
Definition: r_local.h:762
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:601
dtriangle_t::index_st
short index_st[3]
Definition: qfiles.h:104
refimport_t::Con_Printf
void(* Con_Printf)(int print_level, char *str,...)
Definition: ref.h:202
PRINT_ALL
#define PRINT_ALL
Definition: qcommon.h:751
r_shadelight
float r_shadelight
Definition: r_alias.c:48
SHELL_BLUE_COLOR
#define SHELL_BLUE_COLOR
Definition: ref.h:34
SHELL_RED_COLOR
#define SHELL_RED_COLOR
Definition: ref.h:32
r_lerped
vec3_t r_lerped[1024]
Definition: r_alias.c:43
R_PolysetDrawSpansConstant8_33
void R_PolysetDrawSpansConstant8_33(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1061
entity_s::alpha
float alpha
Definition: ref.h:73
dmdl_t::ofs_frames
int ofs_frames
Definition: qfiles.h:156
R_AliasProjectAndClipTestFinalVert
void R_AliasProjectAndClipTestFinalVert(finalvert_t *fv)
Definition: r_alias.c:813
image_s::height
int height
Definition: r_local.h:75
r_lerpmodels
cvar_t * r_lerpmodels
Definition: r_main.c:138
SHELL_BG_COLOR
#define SHELL_BG_COLOR
Definition: ref.h:39
ALIAS_BOTTOM_CLIP
#define ALIAS_BOTTOM_CLIP
Definition: r_local.h:214
dtriangle_t::index_xyz
short index_xyz[3]
Definition: qfiles.h:103
ROLL
#define ROLL
Definition: q_shared.h:74
R_AliasLerpFrames
void R_AliasLerpFrames(dmdl_t *paliashdr, float backlerp)
aliasoldworldtransform
float aliasoldworldtransform[3][4]
Definition: r_alias.c:56
alight_t::pglightvec
float * pglightvec
Definition: r_local.h:364
dstvert_t
Definition: qfiles.h:95
RF_DEPTHHACK
#define RF_DEPTHHACK
Definition: q_shared.h:603
ENTITY_FLAGS
#define ENTITY_FLAGS
Definition: ref.h:80
oldrefdef_t::aliasvrectbottom
int aliasvrectbottom
Definition: r_local.h:122
RDF_IRGOGGLES
#define RDF_IRGOGGLES
Definition: q_shared.h:625
min
#define min(a, b)
Definition: vk_local.h:72
r_affinetridesc
affinetridesc_t r_affinetridesc
Definition: r_alias.c:34
r_lastframe
daliasframe_t * r_lastframe
Definition: r_alias.c:51
alight_t::shadelight
int shadelight
Definition: r_local.h:358
dstvert_t::t
short t
Definition: qfiles.h:98
dmdl_t::num_skins
int num_skins
Definition: qfiles.h:146
entity_s::oldframe
int oldframe
Definition: ref.h:64
R_AliasCheckFrameBBox
unsigned long R_AliasCheckFrameBBox(daliasframe_t *frame, float worldxf[3][4])
Definition: r_alias.c:94
RF_SHELL_DOUBLE
#define RF_SHELL_DOUBLE
Definition: q_shared.h:615
r_newrefdef
refdef_t r_newrefdef
Definition: r_main.c:38
DotProduct
#define DotProduct(x, y)
Definition: q_shared.h:162
dmdl_t::num_xyz
int num_xyz
Definition: qfiles.h:147
R_AliasTransformFinalVerts
void R_AliasTransformFinalVerts(int numpoints, finalvert_t *fv, dtrivertx_t *oldv, dtrivertx_t *newv)
Definition: r_alias.c:749
cvar_s::value
float value
Definition: q_shared.h:331
entity_s::backlerp
float backlerp
Definition: ref.h:69
dmdl_t::framesize
int framesize
Definition: qfiles.h:144
F
#define F(X, Y, Z)
Definition: md4.c:13
refdef_t::time
float time
Definition: ref.h:109
vrect_s::x
int x
Definition: vid.h:24
SHELL_HALF_DAM_COLOR
#define SHELL_HALF_DAM_COLOR
Definition: ref.h:43
image_s::pixels
byte * pixels[4]
Definition: r_local.h:78
image_s::width
int width
Definition: r_local.h:75
alight_t::plightvec
float * plightvec
Definition: r_local.h:359
RF_GLOW
#define RF_GLOW
Definition: q_shared.h:608
VectorInverse
void VectorInverse(vec3_t v)
Definition: q_shared.c:775
alight_t::pblightvec
float * pblightvec
Definition: r_local.h:365
daliasframe_t::translate
float translate[3]
Definition: qfiles.h:122
coloredlights
int coloredlights
Definition: r_main.c:156
dtrivertx_t::v
byte v[3]
Definition: qfiles.h:109
r_lightlevel
cvar_t * r_lightlevel
Definition: r_main.c:142
SHELL_GREEN_COLOR
#define SHELL_GREEN_COLOR
Definition: ref.h:33
R_PolysetDrawSpansConstant8_66
void R_PolysetDrawSpansConstant8_66(spanpackage_t *pspanpackage)
Definition: r_polyse.c:1156
affinetridesc_t::skinwidth
int skinwidth
Definition: r_local.h:330
VectorAdd
#define VectorAdd(a, b, c)
Definition: q_shared.h:164
SHELL_RG_COLOR
#define SHELL_RG_COLOR
Definition: ref.h:36
r_amodels_drawn
int r_amodels_drawn
Definition: r_alias.c:32
y
GLint y
Definition: qgl_win.c:115
aliastriangleparms_t::a
finalvert_t * a
Definition: r_local.h:772
entity_s::frame
int frame
Definition: ref.h:58
R_AliasSetUpTransform
void R_AliasSetUpTransform(void)
Definition: r_alias.c:362
VectorCopy
#define VectorCopy(a, b)
Definition: q_shared.h:165
oldrefdef_t::aliasvrectright
int aliasvrectright
Definition: r_local.h:122
model_s::skins
image_t * skins[MAX_MD2SKINS]
Definition: r_model.h:234
R_AliasSetupFrames
void R_AliasSetupFrames(dmdl_t *pmdl)
Definition: r_alias.c:994
SHELL_RB_COLOR
#define SHELL_RB_COLOR
Definition: ref.h:38
iractive
byte iractive
Definition: r_polyse.c:148
FINALVERT_FLAGS
#define FINALVERT_FLAGS
Definition: r_local.h:310
aliasbatchedtransformdata_t::this_verts
dtrivertx_t * this_verts
Definition: r_alias.c:236
ALIAS_LEFT_CLIP
#define ALIAS_LEFT_CLIP
Definition: r_local.h:211
R_AliasCheckBBox
qboolean R_AliasCheckBBox(void)
Definition: r_alias.c:182
model_s::name
char name[MAX_QPATH]
Definition: r_model.h:173
POWERSUIT_SCALE
#define POWERSUIT_SCALE
Definition: ref.h:30
R_AliasSetUpLerpData
void R_AliasSetUpLerpData(dmdl_t *pmdl, float backlerp)
Definition: r_alias.c:1024
SHELL_WHITE_COLOR
#define SHELL_WHITE_COLOR
Definition: ref.h:47
finalvert_s::s
int s
Definition: r_local.h:293
ALIAS_TOP_CLIP
#define ALIAS_TOP_CLIP
Definition: r_local.h:212
aliasworldtransform
float aliasworldtransform[3][4]
Definition: r_alias.c:55
view_clipplanes
clipplane_t view_clipplanes[4]
Definition: r_rast.c:38
r_pblightvec
vec3_t r_pblightvec
Definition: r_alias.c:41
RF_FULLBRIGHT
#define RF_FULLBRIGHT
Definition: q_shared.h:602
alight_t
Definition: r_local.h:356
R_AliasPreparePoints
void R_AliasPreparePoints(void)
Definition: r_alias.c:242
daliasframe_t
Definition: qfiles.h:119
aliastransform
float aliastransform[3][4]
Definition: r_alias.c:54
daliasframe_t::verts
dtrivertx_t verts[1]
Definition: qfiles.h:124
aliastriangleparms_t::c
finalvert_t * c
Definition: r_local.h:772
aliasyscale
float aliasyscale
Definition: r_local.h:762
FINALVERT_X
#define FINALVERT_X
Definition: r_local.h:311
aliastriangleparms
aliastriangleparms_t aliastriangleparms
Definition: r_polyse.c:62
R_AliasDrawModel
void R_AliasDrawModel(void)
Definition: r_alias.c:1068
R_AliasSetupLighting
void R_AliasSetupLighting(void)
Definition: r_alias.c:884
RF_SHELL_BLUE
#define RF_SHELL_BLUE
Definition: q_shared.h:611
s_ziscale
static float s_ziscale
Definition: r_alias.c:58
LIGHT_MIN
#define LIGHT_MIN
Definition: r_local.h:243
R_AliasTransformVector
void R_AliasTransformVector(vec3_t in, vec3_t out, float m[3][4])
Definition: r_alias.c:217
dmdl_t::ofs_st
int ofs_st
Definition: qfiles.h:154
image_s
Definition: r_local.h:71
R_ConcatTransforms
void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4])
Definition: q_shared.c:219
r_aliasblendcolor
int r_aliasblendcolor
Definition: r_alias.c:47
dmdl_t::ofs_tris
int ofs_tris
Definition: qfiles.h:155
affinetridesc_t::skinheight
int skinheight
Definition: r_local.h:331
r_pglightvec
vec3_t r_pglightvec
Definition: r_alias.c:40
anorms.h
FINALVERT_Z
#define FINALVERT_Z
Definition: r_local.h:313
aliasbatchedtransformdata_t::last_verts
dtrivertx_t * last_verts
Definition: r_alias.c:235
r_lerp_frontv
vec3_t r_lerp_frontv
Definition: r_alias.c:44
R_LightPointColor
void R_LightPointColor(vec3_t p, vec3_t color)
Definition: r_light.c:387
DTRIVERTX_V1
#define DTRIVERTX_V1
Definition: qfiles.h:114
r_avertexnormals
float r_avertexnormals[NUMVERTEXNORMALS][3]
Definition: r_alias.c:64
VID_GRADES
#define VID_GRADES
Definition: r_local.h:159
R_AliasClipTriangleRGB
void R_AliasClipTriangleRGB(finalvert_t *index0, finalvert_t *index1, finalvert_t *index2)
Definition: r_aclip.c:372
dtriangle_t
Definition: qfiles.h:101
r_lerp_move
vec3_t r_lerp_move
Definition: r_alias.c:44
r_ambientlight
int r_ambientlight
Definition: r_alias.c:46
vpn
vec3_t vpn
Definition: r_main.c:73
entity_s::oldorigin
float oldorigin[3]
Definition: ref.h:63
FINALVERT_V4
#define FINALVERT_V4
Definition: r_local.h:308
oldrefdef_t::aliasvrect
vrect_t aliasvrect
Definition: r_local.h:120
BBOX_TRIVIAL_REJECT
#define BBOX_TRIVIAL_REJECT
Definition: r_alias.c:87
vec3_t
vec_t vec3_t[3]
Definition: q_shared.h:134
VID_CBITS
#define VID_CBITS
Definition: r_local.h:158
dmdl_t
Definition: qfiles.h:137
entity_s::angles
float angles[3]
Definition: ref.h:52
zi
static float zi
Definition: r_part.c:469
r_refdef
oldrefdef_t r_refdef
Definition: r_main.c:80
void
void(APIENTRY *qglAccum)(GLenum op
dmdl_t::num_frames
int num_frames
Definition: qfiles.h:151
s_alias_right
static vec3_t s_alias_right
Definition: r_alias.c:59
alight_t::ambientlight
int ambientlight
Definition: r_local.h:357
s_pmdl
dmdl_t * s_pmdl
Definition: r_alias.c:52
affinetridesc_t::pskin
void * pskin
Definition: r_local.h:328
vrect_s::y
int y
Definition: vid.h:24
MAXALIASVERTS
#define MAXALIASVERTS
Definition: r_local.h:234
BBOX_TRIVIAL_ACCEPT
#define BBOX_TRIVIAL_ACCEPT
Definition: r_alias.c:84
ALIAS_RIGHT_CLIP
#define ALIAS_RIGHT_CLIP
Definition: r_local.h:213
r_lerp_backv
vec3_t r_lerp_backv
Definition: r_alias.c:44
shadelight
float shadelight[3]
Definition: r_local.h:645