27 #define LIGHT_MIN 5 // lowest light value we'll allow, to avoid the
58 #define NUMVERTEXNORMALS 162
80 #define BBOX_TRIVIAL_ACCEPT 0
81 #define BBOX_MUST_CLIP_XY 1
82 #define BBOX_MUST_CLIP_Z 2
83 #define BBOX_TRIVIAL_REJECT 8
92 unsigned long aggregate_and_clipcode = ~0
U,
93 aggregate_or_clipcode = 0;
96 vec3_t transformed_min, transformed_max;
97 qboolean zclipped =
false, zfullyclipped =
true;
102 for (
i=0 ;
i<3 ;
i++)
105 maxs[
i] = mins[
i] + frame->
scale[
i]*255;
115 zfullyclipped =
false;
117 zfullyclipped =
false;
131 for (
i = 0;
i < 8;
i++ )
135 unsigned long clipcode = 0;
154 for (
j = 0;
j < 4;
j++ )
162 aggregate_and_clipcode &= clipcode;
163 aggregate_or_clipcode |= clipcode;
166 if ( aggregate_and_clipcode )
170 if ( !aggregate_or_clipcode )
180 unsigned long ccodes[2] = { 0, 0 };
278 pfv[0] = &pfinalverts[ptri->
index_xyz[0]];
279 pfv[1] = &pfinalverts[ptri->
index_xyz[1]];
280 pfv[2] = &pfinalverts[ptri->
index_xyz[2]];
282 if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
286 pfv[0]->
s = pstverts[ptri->
index_st[0]].
s << 16;
287 pfv[0]->
t = pstverts[ptri->
index_st[0]].
t << 16;
289 pfv[1]->
s = pstverts[ptri->
index_st[1]].
s << 16;
290 pfv[1]->
t = pstverts[ptri->
index_st[1]].
t << 16;
292 pfv[2]->
s = pstverts[ptri->
index_st[2]].
s << 16;
293 pfv[2]->
t = pstverts[ptri->
index_st[2]].
t << 16;
295 if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
313 pfv[0] = &pfinalverts[ptri->
index_xyz[0]];
314 pfv[1] = &pfinalverts[ptri->
index_xyz[1]];
315 pfv[2] = &pfinalverts[ptri->
index_xyz[2]];
317 if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags )
321 pfv[0]->
s = pstverts[ptri->
index_st[0]].
s << 16;
322 pfv[0]->
t = pstverts[ptri->
index_st[0]].
t << 16;
324 pfv[1]->
s = pstverts[ptri->
index_st[1]].
s << 16;
325 pfv[1]->
t = pstverts[ptri->
index_st[1]].
t << 16;
327 pfv[2]->
s = pstverts[ptri->
index_st[2]].
s << 16;
328 pfv[2]->
t = pstverts[ptri->
index_st[2]].
t << 16;
330 if ( ! (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) )
355 static float viewmatrix[3][4];
372 for (
i=0 ;
i<3 ;
i++)
398 viewmatrix[0][3] = 0;
399 viewmatrix[1][3] = 0;
400 viewmatrix[2][3] = 0;
421 #if id386 && !defined __linux__ && !defined __FreeBSD__
425 float lerped_vert[3];
426 int byte_to_dword_ptr_var;
435 __asm mov ecx, numpoints
450 __asm mov byte_to_dword_ptr_var, ebx
451 __asm fild dword ptr byte_to_dword_ptr_var
455 __asm mov byte_to_dword_ptr_var, ebx
456 __asm fild dword ptr byte_to_dword_ptr_var
457 __asm fmul dword ptr [
r_lerp_backv+4] ; oldv[1]*rlb[1] | oldv[0]*rlb[0]
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+8] ; oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
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_frontv+0] ; newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
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_frontv+4] ; newv[1]*rlf[1] | newv[0]*rlf[0] | oldv[2]*rlb[2] | oldv[1]*rlb[1] | oldv[0]*rlb[0]
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+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]
479 __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]
480 __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]
481 __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]
482 __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]
483 __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]
484 __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]
485 __asm fxch
st(1) ; oldv[1]*rlb[1] + newv[1]*rlf[1] | lv0 | oldv[2]*rlb[2] + newv[2]*rlf[2]
486 __asm fadd dword ptr [
r_lerp_move+4] ; lv1 | lv0 | oldv[2]*rlb[2] + newv[2]*rlf[2]
487 __asm fxch
st(2) ; oldv[2]*rlb[2] + newv[2]*rlf[2] | lv0 | lv1
488 __asm fadd dword ptr [
r_lerp_move+8] ; lv2 | lv0 | lv1
489 __asm fxch
st(1) ; lv0 | lv2 | lv1
490 __asm fstp dword ptr [lerped_vert+0] ; lv2 | lv1
491 __asm fstp dword ptr [lerped_vert+8] ; lv2
492 __asm fstp dword ptr [lerped_vert+4] ; (empty)
498 __asm jz not_powersuit
512 __asm fld dword ptr [eax+0] ; n[0]
513 __asm fmul PS_SCALE ; n[0] * PS
514 __asm fld dword ptr [eax+4] ; n[1] | n[0] * PS
515 __asm fmul PS_SCALE ; n[1] * PS | n[0] * PS
516 __asm fld dword ptr [eax+8] ; n[2] | n[1] * PS | n[0] * PS
517 __asm fmul PS_SCALE ; n[2] * PS | n[1] * PS | n[0] * PS
518 __asm fld dword ptr [lerped_vert+0] ; lv0 | n[2] * PS | n[1] * PS | n[0] * PS
519 __asm faddp
st(3),
st ; n[2] * PS | n[1] * PS | n[0] * PS + lv0
520 __asm fld dword ptr [lerped_vert+4] ; lv1 | n[2] * PS | n[1] * PS | n[0] * PS + lv0
521 __asm faddp
st(2),
st ; n[2] * PS | n[1] * PS + lv1 | n[0] * PS + lv0
522 __asm fadd dword ptr [lerped_vert+8] ; n[2] * PS + lv2 | n[1] * PS + lv1 | n[0] * PS + lv0
523 __asm fxch
st(2) ; LV0 | LV1 | LV2
524 __asm fstp dword ptr [lerped_vert+0] ; LV1 | LV2
525 __asm fstp dword ptr [lerped_vert+4] ; LV2
526 __asm fstp dword ptr [lerped_vert+8] ; (empty)
540 __asm fld dword ptr [lerped_vert+0] ; lv0
542 __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[0][0]
543 __asm fmul dword ptr [
aliastransform+4] ; lv1*at[0][1] | lv0*at[0][0]
544 __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[0][1] | lv0*at[0][0]
545 __asm fmul dword ptr [
aliastransform+8] ; lv2*at[0][2] | lv1*at[0][1] | lv0*at[0][0]
546 __asm fxch
st(2) ; lv0*at[0][0] | lv1*at[0][1] | lv2*at[0][2]
547 __asm faddp
st(1),
st ; lv0*at[0][0] + lv1*at[0][1] | lv2*at[0][2]
548 __asm faddp
st(1),
st ; lv0*at[0][0] + lv1*at[0][1] + lv2*at[0][2]
551 __asm fld dword ptr [lerped_vert+0] ; lv0
553 __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[1][0]
554 __asm fmul dword ptr [
aliastransform+20] ; lv1*at[1][1] | lv0*at[1][0]
555 __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[1][1] | lv0*at[1][0]
556 __asm fmul dword ptr [
aliastransform+24] ; lv2*at[1][2] | lv1*at[1][1] | lv0*at[1][0]
557 __asm fxch
st(2) ; lv0*at[1][0] | lv1*at[1][1] | lv2*at[1][2]
558 __asm faddp
st(1),
st ; lv0*at[1][0] + lv1*at[1][1] | lv2*at[1][2]
559 __asm faddp
st(1),
st ; lv0*at[1][0] + lv1*at[1][1] + lv2*at[1][2]
561 __asm fxch
st(1) ; FV.X | FV.Y
564 __asm fld dword ptr [lerped_vert+0] ; lv0
566 __asm fld dword ptr [lerped_vert+4] ; lv1 | lv0*at[2][0]
567 __asm fmul dword ptr [
aliastransform+36] ; lv1*at[2][1] | lv0*at[2][0]
568 __asm fld dword ptr [lerped_vert+8] ; lv2 | lv1*at[2][1] | lv0*at[2][0]
569 __asm fmul dword ptr [
aliastransform+40] ; lv2*at[2][2] | lv1*at[2][1] | lv0*at[2][0]
570 __asm fxch
st(2) ; lv0*at[2][0] | lv1*at[2][1] | lv2*at[2][2]
571 __asm faddp
st(1),
st ; lv0*at[2][0] + lv1*at[2][1] | lv2*at[2][2]
572 __asm faddp
st(1),
st ; lv0*at[2][0] + lv1*at[2][1] + lv2*at[2][2]
574 __asm fxch
st(1) ; FV.Y | FV.Z
592 __asm fld dword ptr [eax+0]
593 __asm fmul dword ptr [ebx+0]
594 __asm fld dword ptr [eax+4]
595 __asm fmul dword ptr [ebx+4]
596 __asm fld dword ptr [eax+8]
597 __asm fmul dword ptr [ebx+8]
599 __asm faddp
st(1),
st
600 __asm faddp
st(1),
st
601 __asm fstp dword ptr lightcos
602 __asm mov eax, lightcos
622 __asm fmul dword ptr lightcos
623 __asm fistp dword ptr tmpint
624 __asm add ebx, tmpint
651 __asm js alias_z_clip
652 __asm cmp eax, FALIAS_Z_CLIP_PLANE
653 __asm jl alias_z_clip
674 __asm mov eax, dword ptr [edi+32]
675 __asm mov eax, dword ptr [edi+64]
684 __asm fmul zi ;
x * asx * zi |
y * asy | fv5
686 __asm fxch
st(1) ;
y * asy | fv0 | fv5
687 __asm fmul zi ;
y * asy * zi | fv0 | fv5
689 __asm fxch
st(2) ; fv5 | fv0 | fv1
708 __asm jge ct_alias_top
712 __asm jge ct_alias_right
716 __asm jle ct_alias_bottom
720 __asm jle end_of_loop
723 __asm jmp end_of_loop
736 __asm jnz top_of_loop
743 for (
i = 0;
i < numpoints;
i++,
fv++, oldv++, newv++ )
746 float lightcos, *plightnormal;
877 float lightvec[3] = {-1, 0, 0};
884 for (
i=0 ;
i<3 ;
i++)
899 for (
i=0 ;
i<3 ;
i++)
910 for (
i=0 ;
i<3 ;
i++)
912 min = light[
i] * 0.8;
919 j = (light[0] + light[1] + light[2])*0.3333*255;
969 if ( ( thisframe >= pmdl->
num_frames ) || ( thisframe < 0 ) )
975 if ( ( lastframe >= pmdl->
num_frames ) || ( lastframe < 0 ) )
997 vec3_t translation, vectors[3];
1000 frontlerp = 1.0F - backlerp;
1021 for (
i=0 ;
i<3 ;
i++)
1026 for (
i=0 ;
i<3 ;
i++)
1173 s_ziscale = (float)0x8000 * (
float)0x10000 * 3.0;
1175 s_ziscale = (float)0x8000 * (
float)0x10000;