45 #define BBOX_TRIVIAL_ACCEPT 0
46 #define BBOX_MUST_CLIP_XY 1
47 #define BBOX_MUST_CLIP_Z 2
48 #define BBOX_TRIVIAL_REJECT 8
57 out[0] = DotProduct(in, xf[0]) + xf[0][3];
58 out[1] = DotProduct(in, xf[1]) + xf[1][3];
59 out[2] = DotProduct(in, xf[2]) + xf[2][3];
70 unsigned long aggregate_and_clipcode = ~0U,
71 aggregate_or_clipcode = 0;
74 vec3_t transformed_min, transformed_max;
75 qboolean zclipped = qfalse, zfullyclipped = qtrue;
80 for (i = 0; i < 3; i++) {
82 maxs[i] = mins[i] + frame->
scale[i] * 255;
92 zfullyclipped = qfalse;
94 zfullyclipped = qfalse;
106 for (i = 0; i < 8; i++) {
108 vec3_t tmp, transformed;
109 unsigned long clipcode = 0;
128 for (j = 0; j < 4; j++) {
135 aggregate_and_clipcode &= clipcode;
136 aggregate_or_clipcode |= clipcode;
139 if (aggregate_and_clipcode) {
142 if (!aggregate_or_clipcode) {
156 unsigned long ccodes[2] = { 0, 0 };
223 for (i = 0; i < numpoints; i++,
fv++, oldv++, newv++) {
225 const vec_t *plightnormal;
232 plightnormal =
bytedirs[newv->lightnormalindex];
238 WEAPONSHELL_SCALE : POWERSUIT_SCALE;
240 lerped_vert[0] += plightnormal[0] * scale;
241 lerped_vert[1] += plightnormal[1] * scale;
242 lerped_vert[2] += plightnormal[2] * scale;
256 fv->l = 0x8000 + (
int)(0x7fff * lightcos);
296 if ((
currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND)) {
298 pfv[0] = &pfinalverts[ptri->
index_xyz[0]];
299 pfv[1] = &pfinalverts[ptri->
index_xyz[1]];
300 pfv[2] = &pfinalverts[ptri->
index_xyz[2]];
302 if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
306 pfv[0]->
s = pstverts[ptri->
index_st[0]].
s << 16;
307 pfv[0]->
t = pstverts[ptri->
index_st[0]].
t << 16;
309 pfv[1]->
s = pstverts[ptri->
index_st[1]].
s << 16;
310 pfv[1]->
t = pstverts[ptri->
index_st[1]].
t << 16;
312 pfv[2]->
s = pstverts[ptri->
index_st[2]].
s << 16;
313 pfv[2]->
t = pstverts[ptri->
index_st[2]].
t << 16;
315 if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
328 pfv[0] = &pfinalverts[ptri->
index_xyz[0]];
329 pfv[1] = &pfinalverts[ptri->
index_xyz[1]];
330 pfv[2] = &pfinalverts[ptri->
index_xyz[2]];
332 if (pfv[0]->flags & pfv[1]->flags & pfv[2]->flags)
336 pfv[0]->
s = pstverts[ptri->
index_st[0]].
s << 16;
337 pfv[0]->
t = pstverts[ptri->
index_st[0]].
t << 16;
339 pfv[1]->
s = pstverts[ptri->
index_st[1]].
s << 16;
340 pfv[1]->
t = pstverts[ptri->
index_st[1]].
t << 16;
342 pfv[2]->
s = pstverts[ptri->
index_st[2]].
s << 16;
343 pfv[2]->
t = pstverts[ptri->
index_st[2]].
t << 16;
345 if (!(pfv[0]->flags | pfv[1]->flags | pfv[2]->flags)) {
367 out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
368 out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];
369 out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2];
370 out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3];
371 out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0];
372 out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1];
373 out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2];
374 out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3];
375 out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0];
376 out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1];
377 out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2];
378 out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
390 float viewmatrix[3][4];
407 for (i = 0; i < 3; i++) {
427 VectorCopy(
vright, viewmatrix[0]);
428 VectorCopy(
vup, viewmatrix[1]);
429 VectorNegate(viewmatrix[1], viewmatrix[1]);
430 VectorCopy(
vpn, viewmatrix[2]);
432 viewmatrix[0][3] = 0;
433 viewmatrix[1][3] = 0;
434 viewmatrix[2][3] = 0;
463 if ((skinnum >=
currentmodel->numskins) || (skinnum < 0)) {
464 Com_DPrintf(
"R_AliasSetupSkin %s: no such skin # %d\n",
471 if (pskindesc == NULL ||
474 Com_DPrintf(
"R_AliasSetupSkin %s: bad skin %p\n",
493 float cp, cy, sp, sy;
500 VectorSet(light, 1, 1, 1);
506 for (i = 0; i < 3; i++)
517 for (i = 0; i < 3; i++) {
518 min = light[i] * 0.8;
525 for (i = 0; i < 3; i++)
526 clamp(light[i], 0, 1);
555 if (thisframe >=
currentmodel->numframes || thisframe < 0) {
556 Com_DPrintf(
"%s: %s: no such thisframe %d\n",
560 if (lastframe >=
currentmodel->numframes || lastframe < 0) {
561 Com_DPrintf(
"%s: %s: no such lastframe %d\n",
578 vec3_t translation, vectors[3];
596 r_lerp_move[0] = DotProduct(translation, vectors[0]);
597 r_lerp_move[1] = -DotProduct(translation, vectors[1]);
598 r_lerp_move[2] = DotProduct(translation, vectors[2]);
602 for (i = 0; i < 3; i++) {
606 for (i = 0; i < 3; i++) {
635 if (mask == RF_SHELL_RED)
637 else if (mask == RF_SHELL_GREEN)
639 else if (mask == RF_SHELL_BLUE)
641 else if (mask == (RF_SHELL_RED | RF_SHELL_GREEN))
643 else if (mask == (RF_SHELL_RED | RF_SHELL_BLUE))
645 else if (mask == (RF_SHELL_BLUE | RF_SHELL_GREEN))
647 else if (mask == RF_SHELL_DOUBLE)
649 else if (mask == RF_SHELL_HALF_DAM)
679 if ((
currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND))
709 s_ziscale = (float)0x8000 * (
float)0x10000 * 3.0;
711 s_ziscale = (float)0x8000 * (
float)0x10000;
716 if ((
currententity->flags & (RF_WEAPONMODEL | RF_LEFTHAND)) == (RF_WEAPONMODEL | RF_LEFTHAND))