Rev 5153 | Rev 5187 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5153 | Rev 5175 | ||
---|---|---|---|
Line 167... | Line 167... | ||
167 | mov ebx,[p0] |
167 | mov ebx,[p0] |
168 | mov ecx,[p1] |
168 | mov ecx,[p1] |
169 | fld dword[t] |
169 | fld dword[t] |
Line 170... | Line 170... | ||
170 | 170 | ||
171 | ; интерполяция по координатам |
171 | ; интерполяция по координатам |
172 | fld dword[ecx+offs_vert_pc] |
172 | fld dword[ecx+offs_vert_pc+offs_X] |
173 | fsub dword[ebx+offs_vert_pc] |
173 | fsub dword[ebx+offs_vert_pc+offs_X] |
174 | fmul st0,st1 |
174 | fmul st0,st1 |
175 | fadd dword[ebx+offs_vert_pc] |
175 | fadd dword[ebx+offs_vert_pc+offs_X] |
Line 176... | Line 176... | ||
176 | fstp dword[eax+offs_vert_pc] |
176 | fstp dword[eax+offs_vert_pc+offs_X] |
177 | 177 | ||
178 | fld dword[ecx+offs_vert_pc+4] |
178 | fld dword[ecx+offs_vert_pc+offs_Y] |
179 | fsub dword[ebx+offs_vert_pc+4] |
179 | fsub dword[ebx+offs_vert_pc+offs_Y] |
180 | fmul st0,st1 |
180 | fmul st0,st1 |
Line 181... | Line 181... | ||
181 | fadd dword[ebx+offs_vert_pc+4] |
181 | fadd dword[ebx+offs_vert_pc+offs_Y] |
182 | fstp dword[eax+offs_vert_pc+4] |
182 | fstp dword[eax+offs_vert_pc+offs_Y] |
183 | 183 | ||
184 | fld dword[ecx+offs_vert_pc+8] |
184 | fld dword[ecx+offs_vert_pc+offs_Z] |
185 | fsub dword[ebx+offs_vert_pc+8] |
185 | fsub dword[ebx+offs_vert_pc+offs_Z] |
Line 186... | Line 186... | ||
186 | fmul st0,st1 |
186 | fmul st0,st1 |
187 | fadd dword[ebx+offs_vert_pc+8] |
187 | fadd dword[ebx+offs_vert_pc+offs_Z] |
188 | fstp dword[eax+offs_vert_pc+8] |
188 | fstp dword[eax+offs_vert_pc+offs_Z] |
189 | 189 | ||
190 | fld dword[ecx+offs_vert_pc+12] |
190 | fld dword[ecx+offs_vert_pc+offs_W] |
Line 191... | Line 191... | ||
191 | fsub dword[ebx+offs_vert_pc+12] |
191 | fsub dword[ebx+offs_vert_pc+offs_W] |
192 | fmul st0,st1 |
192 | fmul st0,st1 |
193 | fadd dword[ebx+offs_vert_pc+12] |
193 | fadd dword[ebx+offs_vert_pc+offs_W] |
194 | fstp dword[eax+offs_vert_pc+12] |
194 | fstp dword[eax+offs_vert_pc+offs_W] |
Line 529... | Line 529... | ||
529 | d_W dd ? |
529 | d_W dd ? |
530 | endl |
530 | endl |
531 | mov edx,[a] |
531 | mov edx,[a] |
532 | mov ebx,[b] |
532 | mov ebx,[b] |
533 | mov ecx,[c] |
533 | mov ecx,[c] |
534 | fld dword[ebx] |
534 | fld dword[ebx+offs_X] |
535 | fsub dword[edx] |
535 | fsub dword[edx+offs_X] |
536 | fstp dword[d_X] ;d_X = (b.X - a.X) |
536 | fstp dword[d_X] ;d_X = (b.X - a.X) |
537 | fld dword[ebx+4] |
537 | fld dword[ebx+offs_Y] |
538 | fsub dword[edx+4] |
538 | fsub dword[edx+offs_Y] |
539 | fstp dword[d_Y] ;d_Y = (b.Y - a.Y) |
539 | fstp dword[d_Y] ;d_Y = (b.Y - a.Y) |
540 | fld dword[ebx+8] |
540 | fld dword[ebx+offs_Z] |
541 | fsub dword[edx+8] |
541 | fsub dword[edx+offs_Z] |
542 | fstp dword[d_Z] ;d_Z = (b.Z - a.Z) |
542 | fstp dword[d_Z] ;d_Z = (b.Z - a.Z) |
543 | fld dword[ebx+12] |
543 | fld dword[ebx+offs_W] |
544 | fsub dword[edx+12] |
544 | fsub dword[edx+offs_W] |
545 | fst dword[d_W] ;d_W = (b.W - a.W) |
545 | fst dword[d_W] ;d_W = (b.W - a.W) |
546 | if sign eq 0 |
546 | if sign eq 0 |
547 | fadd dword[d#dir] |
547 | fadd dword[d#dir] |
548 | else |
548 | else |
549 | fsub dword[d#dir] |
549 | fsub dword[d#dir] |
550 | end if |
550 | end if |
Line 551... | Line 551... | ||
551 | 551 | ||
552 | fldz |
552 | fldz |
553 | fcomp st1 |
553 | fcompp |
554 | fstsw ax |
554 | fstsw ax |
555 | sahf |
555 | sahf |
556 | ja @f |
- | |
557 | fincstp |
556 | ja @f |
558 | fst dword[t] ;t=0 |
557 | fst dword[t] ;t=0 |
559 | jmp .e_zero |
558 | jmp .e_zero |
560 | @@: ;else |
- | |
561 | fincstp |
559 | @@: ;else |
562 | fld dword[edx+offs#dir] |
560 | fld dword[edx+offs#dir] |
563 | if sign eq 0 |
561 | if sign eq 0 |
564 | fchs |
562 | fchs |
565 | end if |
563 | end if |
Line 626... | Line 624... | ||
626 | endp |
624 | endp |
Line 627... | Line 625... | ||
627 | 625 | ||
628 | align 4 |
626 | align 4 |
Line -... | Line 627... | ||
- | 627 | clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax |
|
629 | clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax |
628 | |
630 | 629 | align 4 |
|
631 | ;static inline void updateTmp(GLContext *c, GLVertex *q,GLVertex *p0,GLVertex *p1,float t) |
630 | proc updateTmp uses edx, context:dword, q:dword, p0:dword, p1:dword, t:dword |
- | 631 | mov eax,[context] |
|
632 | ;{ |
632 | cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH) |
633 | ; if (c->current_shade_model == GL_SMOOTH) { |
633 | jne .els_0 |
634 | ; q->color.v[0]=p0->color.v[0] + (p1->color.v[0]-p0->color.v[0])*t; |
634 | ; q->color.v[0]=p0->color.v[0] + (p1->color.v[0]-p0->color.v[0])*t; |
- | 635 | ; q->color.v[1]=p0->color.v[1] + (p1->color.v[1]-p0->color.v[1])*t; |
|
635 | ; q->color.v[1]=p0->color.v[1] + (p1->color.v[1]-p0->color.v[1])*t; |
636 | ; q->color.v[2]=p0->color.v[2] + (p1->color.v[2]-p0->color.v[2])*t; |
636 | ; q->color.v[2]=p0->color.v[2] + (p1->color.v[2]-p0->color.v[2])*t; |
637 | jmp @f |
637 | ; } else { |
638 | .els_0: |
638 | ; q->color.v[0]=p0->color.v[0]; |
639 | ; q->color.v[0]=p0->color.v[0]; |
639 | ; q->color.v[1]=p0->color.v[1]; |
640 | ; q->color.v[1]=p0->color.v[1]; |
Line 640... | Line 641... | ||
640 | ; q->color.v[2]=p0->color.v[2]; |
641 | ; q->color.v[2]=p0->color.v[2]; |
- | 642 | @@: |
|
641 | ; } |
643 | |
642 | 644 | cmp dword[edx+offs_cont_texture_2d_enabled],0 ;if (context.texture_2d_enabled) |
|
643 | ; if (c->texture_2d_enabled) { |
645 | je @f |
Line 644... | Line 646... | ||
644 | ; q->tex_coord.X=p0->tex_coord.X + (p1->tex_coord.X-p0->tex_coord.X)*t; |
646 | ; q->tex_coord.X=p0->tex_coord.X + (p1->tex_coord.X-p0->tex_coord.X)*t; |
645 | ; q->tex_coord.Y=p0->tex_coord.Y + (p1->tex_coord.Y-p0->tex_coord.Y)*t; |
647 | ; q->tex_coord.Y=p0->tex_coord.Y + (p1->tex_coord.Y-p0->tex_coord.Y)*t; |
646 | ; } |
648 | @@: |
647 | 649 | ||
648 | ; q->clip_code=gl_clipcode(q->pc.X,q->pc.Y,q->pc.Z,q->pc.W); |
650 | ; q->clip_code=gl_clipcode(q->pc.X,q->pc.Y,q->pc.Z,q->pc.W); |
- | 651 | ; if (q->clip_code==0){ |
|
649 | ; if (q->clip_code==0){ |
652 | ; gl_transform_to_viewport(c,q); |
Line -... | Line 653... | ||
- | 653 | ; RGBFtoRGBI(q->color.v[0],q->color.v[1],q->color.v[2],q->zp.r,q->zp.g,q->zp.b); |
|
650 | ; gl_transform_to_viewport(c,q); |
654 | ; } |
- | 655 | ret |
|
- | 656 | endp |
|
- | 657 | ||
- | 658 | align 4 |
|
- | 659 | proc gl_draw_triangle, context:dword, p0:dword, p1:dword, p2:dword |
|
- | 660 | locals |
|
- | 661 | cc rd 3 |
|
- | 662 | front dd ? |
|
- | 663 | norm dd ? ;float |
|
Line 651... | Line -... | ||
651 | ; RGBFtoRGBI(q->color.v[0],q->color.v[1],q->color.v[2],q->zp.r,q->zp.g,q->zp.b); |
- | |
652 | ; } |
- | |
653 | ;} |
664 | endl |
654 | 665 | pushad |
|
655 | ;static void gl_draw_triangle_clip(GLContext *c, GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit); |
- | |
656 | 666 | mov ebx,[p0] |
|
657 | ;void gl_draw_triangle(GLContext *c, GLVertex *p0,GLVertex *p1,GLVertex *p2) |
667 | mov ecx,[p1] |
- | 668 | mov edx,[p2] |
|
658 | ;{ |
669 | |
659 | ; int co,c_and,cc[3],front; |
- | |
660 | ; float norm; |
670 | mov edi,[ebx+offs_vert_clip_code] |
- | 671 | mov dword[cc],edi |
|
661 | ; |
672 | mov eax,[ecx+offs_vert_clip_code] |
662 | ; cc[0]=p0->clip_code; |
673 | mov dword[cc+4],eax |
663 | ; cc[1]=p1->clip_code; |
674 | or edi,eax |
664 | ; cc[2]=p2->clip_code; |
675 | mov eax,[edx+offs_vert_clip_code] |
665 | ; |
676 | mov dword[cc+8],eax |
666 | ; co=cc[0] | cc[1] | cc[2]; |
677 | or edi,eax |
667 | ; |
- | |
668 | ; /* we handle the non clipped case here to go faster */ |
678 | |
669 | ; if (co==0) { |
- | |
670 | ; |
679 | ; we handle the non clipped case here to go faster |
671 | ; norm=(float)(p1->zp.x-p0->zp.x)*(float)(p2->zp.y-p0->zp.y)- |
680 | cmp edi,0 |
672 | ; (float)(p2->zp.x-p0->zp.x)*(float)(p1->zp.y-p0->zp.y); |
- | |
673 | ; |
- | |
674 | ; if (norm == 0) return; |
681 | jne .els_0 |
675 | ; |
682 | mov edi,dword[edx+offs_vert_zp+offs_zbup_x] |
676 | ; front = norm < 0.0; |
- | |
677 | ; front = front ^ c->current_front_face; |
683 | mov edi,dword[ebx+offs_vert_zp+offs_zbup_x] |
678 | ; |
684 | mov dword[norm],edi |
679 | ; /* back face culling */ |
- | |
680 | ; if (c->cull_face_enabled) { |
- | |
681 | ; /* most used case first */ |
685 | fild dword[norm] |
682 | ; if (c->current_cull_face == GL_BACK) { |
686 | mov esi,dword[ecx+offs_vert_zp+offs_zbup_y] |
683 | ; if (front == 0) return; |
687 | mov esi,dword[ebx+offs_vert_zp+offs_zbup_y] |
684 | ; c->draw_triangle_front(c,p0,p1,p2); |
- | |
685 | ; } else if (c->current_cull_face == GL_FRONT) { |
- | |
686 | ; if (front != 0) return; |
- | |
687 | ; c->draw_triangle_back(c,p0,p1,p2); |
- | |
688 | ; } else { |
688 | mov dword[norm],edi |
689 | ; return; |
- | |
690 | ; } |
689 | fimul dword[norm] |
691 | ; } else { |
- | |
692 | ; /* no culling */ |
- | |
693 | ; if (front) { |
- | |
694 | ; c->draw_triangle_front(c,p0,p1,p2); |
690 | mov edi,dword[ecx+offs_vert_zp+offs_zbup_x] |
695 | ; } else { |
691 | sub edi,dword[ebx+offs_vert_zp+offs_zbup_x] |
696 | ; c->draw_triangle_back(c,p0,p1,p2); |
- | |
697 | ; } |
692 | mov dword[norm],edi |
698 | ; } |
- | |
699 | ; } else { |
- | |
Line 700... | Line 693... | ||
700 | ; c_and=cc[0] & cc[1] & cc[2]; |
693 | fild dword[norm] |
701 | ; if (c_and==0) { |
- | |
702 | ; gl_draw_triangle_clip(c,p0,p1,p2,0); |
- | |
703 | ; } |
- | |
704 | ; } |
- | |
705 | ;} |
- | |
706 | - | ||
707 | ;static void gl_draw_triangle_clip(GLContext *c, GLVertex *p0,GLVertex *p1,GLVertex *p2,int clip_bit) |
- | |
708 | ;{ |
- | |
709 | ; int co,c_and,co1,cc[3],edge_flag_tmp,clip_mask; |
- | |
710 | ; GLVertex tmp1,tmp2,*q[3]; |
- | |
711 | ; float tt; |
- | |
712 | - | ||
713 | ; cc[0]=p0->clip_code; |
- | |
714 | ; cc[1]=p1->clip_code; |
- | |
715 | ; cc[2]=p2->clip_code; |
- | |
716 | - | ||
Line -... | Line 694... | ||
- | 694 | mov edi,dword[edx+offs_vert_zp+offs_zbup_y] |
|
- | 695 | mov edi,dword[ebx+offs_vert_zp+offs_zbup_y] |
|
- | 696 | mov dword[norm],edi |
|
- | 697 | fimul dword[norm] |
|
- | 698 | fsub st0,st1 |
|
- | 699 | ||
- | 700 | ;st0 = (p1.zp.x-p0.zp.x)*(p2.zp.y-p0.zp.y) - (p2.zp.x-p0.zp.x)*(p1.zp.y-p0.zp.y) |
|
- | 701 | ||
- | 702 | mov dword[front],0 |
|
- | 703 | fldz |
|
- | 704 | fcom st1 |
|
- | 705 | fstsw ax |
|
- | 706 | sahf |
|
- | 707 | je .end_f |
|
- | 708 | jb @f |
|
- | 709 | inc dword[front] ;front = 0.0 > norm |
|
- | 710 | @@: |
|
- | 711 | mov edi,[context] |
|
- | 712 | mov eax,dword[edi+offs_cont_current_front_face] |
|
- | 713 | xor dword[front],eax ;front ^= context.current_front_face |
|
- | 714 | ||
- | 715 | ; back face culling |
|
- | 716 | cmp dword[edi+offs_cont_cull_face_enabled],0 |
|
- | 717 | je .els_1 |
|
- | 718 | ; most used case first |
|
- | 719 | cmp dword[edi+offs_cont_current_cull_face],GL_BACK |
|
- | 720 | jne @f |
|
- | 721 | cmp dword[front],0 |
|
- | 722 | je .end_f |
|
- | 723 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
|
- | 724 | jmp .end_f |
|
- | 725 | @@: |
|
- | 726 | cmp dword[edi+offs_cont_current_cull_face],GL_FRONT |
|
- | 727 | jne .end_f |
|
- | 728 | cmp dword[front],0 |
|
- | 729 | jne .end_f |
|
- | 730 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
|
- | 731 | jmp .end_f |
|
- | 732 | .els_1: |
|
- | 733 | ; no culling |
|
- | 734 | cmp dword[front],0 |
|
- | 735 | je @f |
|
- | 736 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
|
- | 737 | @@: |
|
- | 738 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
|
- | 739 | jmp .end_f |
|
- | 740 | .els_0: |
|
- | 741 | and eax,[cc] |
|
- | 742 | and eax,[cc+4] |
|
- | 743 | cmp eax,0 |
|
- | 744 | jne @f |
|
- | 745 | stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0 |
|
- | 746 | .end_f: |
|
- | 747 | finit |
|
- | 748 | @@: |
|
- | 749 | popad |
|
- | 750 | ret |
|
- | 751 | endp |
|
- | 752 | ||
- | 753 | align 4 |
|
- | 754 | proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword |
|
- | 755 | locals |
|
- | 756 | co dd ? |
|
- | 757 | co1 dd ? |
|
- | 758 | cc rd 3 |
|
- | 759 | edge_flag_tmp dd ? |
|
- | 760 | clip_mask dd ? |
|
- | 761 | tmp1 GLVertex ? |
|
- | 762 | tmp2 GLVertex ? |
|
- | 763 | q rd 3 ;GLVertex* |
|
- | 764 | tt dd ? ;float |
|
- | 765 | endl |
|
- | 766 | pushad |
|
- | 767 | ||
- | 768 | mov ebx,[p0] |
|
- | 769 | mov ecx,[p1] |
|
- | 770 | mov edx,[p2] |
|
- | 771 | ||
- | 772 | mov edi,[ebx+offs_vert_clip_code] |
|
- | 773 | mov dword[cc],edi |
|
- | 774 | mov eax,[ecx+offs_vert_clip_code] |
|
- | 775 | mov dword[cc+4],eax |
|
- | 776 | or edi,eax |
|
- | 777 | mov eax,[edx+offs_vert_clip_code] |
|
- | 778 | mov dword[cc+8],eax |
|
- | 779 | or edi,eax |
|
- | 780 | mov dword[co],edi |
|
- | 781 | ||
- | 782 | cmp edi,0 |
|
- | 783 | jne .els_0 |
|
- | 784 | stdcall gl_draw_triangle, [context],ebx,ecx,edx |
|
- | 785 | jmp .end_f |
|
717 | ; co=cc[0] | cc[1] | cc[2]; |
786 | .els_0: |
718 | ; if (co == 0) { |
787 | and eax,[cc] |
719 | ; gl_draw_triangle(c,p0,p1,p2); |
788 | and eax,[cc+4] |
720 | ; } else { |
789 | |
Line 721... | Line 790... | ||
721 | ; c_and=cc[0] & cc[1] & cc[2]; |
790 | ; the triangle is completely outside |
722 | ; /* the triangle is completely outside */ |
791 | cmp eax,0 |
723 | ; if (c_and!=0) return; |
792 | jne .end_f |
- | 793 | ||
724 | 794 | ; find the next direction to clip |
|
725 | ; /* find the next direction to clip */ |
795 | ; while (clip_bit < 6 && (co & (1 << clip_bit)) == 0) { |
726 | ; while (clip_bit < 6 && (co & (1 << clip_bit)) == 0) { |
796 | ; clip_bit++; |
727 | ; clip_bit++; |
797 | ; } |
728 | ; } |
798 | |
- | 799 | ; this test can be true only in case of rounding errors |
|
- | 800 | cmp dword[clip_bit],6 |
|
729 | 801 | if 0 |
|
730 | ; /* this test can be true only in case of rounding errors */ |
802 | jne @f |
Line 731... | Line 803... | ||
731 | ; if (clip_bit == 6) { |
803 | ; printf("Error:\n"); |
732 | ;#if 0 |
804 | ; printf("%f %f %f %f\n",p0->pc.X,p0->pc.Y,p0->pc.Z,p0->pc.W); |
Line 733... | Line 805... | ||
733 | ; printf("Error:\n"); |
805 | ; printf("%f %f %f %f\n",p1->pc.X,p1->pc.Y,p1->pc.Z,p1->pc.W); |
Line 779... | Line 851... | ||
779 | ; tmp1.edge_flag=1; |
851 | ; tmp1.edge_flag=1; |
780 | ; tmp2.edge_flag=q[2]->edge_flag; |
852 | ; tmp2.edge_flag=q[2]->edge_flag; |
781 | ; gl_draw_triangle_clip(c,q[0],&tmp1,&tmp2,clip_bit+1); |
853 | ; gl_draw_triangle_clip(c,q[0],&tmp1,&tmp2,clip_bit+1); |
782 | ; } |
854 | ; } |
783 | ; } |
855 | ; } |
- | 856 | .end_f: |
|
- | 857 | popad |
|
- | 858 | ret |
|
784 | ;} |
859 | endp |
Line 785... | Line 860... | ||
785 | 860 | ||
786 | align 4 |
861 | align 4 |
787 | proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword |
862 | proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword |
788 | mov eax,[p2] |
863 | mov eax,[p2] |
Line 793... | Line 868... | ||
793 | push dword[eax+offs_vert_zp+offs_Z] |
868 | push dword[eax+offs_vert_zp+offs_Z] |
794 | stdcall gl_add_select1, [context] ;,p0.zp.z, p1.zp.z, p2.zp.z |
869 | stdcall gl_add_select1, [context] ;,p0.zp.z, p1.zp.z, p2.zp.z |
795 | ret |
870 | ret |
796 | endp |
871 | endp |
Line 797... | Line 872... | ||
797 | 872 | ||
- | 873 | if PROFILE eq 1 |
|
798 | ;#ifdef PROFILE |
874 | count_triangles dd ? |
- | 875 | count_triangles_textured dd ? |
|
799 | ;int count_triangles,count_triangles_textured,count_pixels; |
876 | count_pixels dd ? |
Line 800... | Line 877... | ||
800 | ;#endif |
877 | end if |
801 | 878 | ||
- | 879 | align 4 |
|
802 | align 4 |
880 | proc gl_draw_triangle_fill, context:dword, p0:dword,p1:dword,p2:dword |
803 | proc gl_draw_triangle_fill uses eax edx, context:dword, p0:dword,p1:dword,p2:dword |
- | |
804 | ;#ifdef PROFILE |
881 | pushad |
805 | ; { |
882 | if PROFILE eq 1 |
806 | ; int norm; |
883 | ; int norm; |
807 | ; assert(p0->zp.x >= 0 && p0->zp.x < c->zb->xsize); |
884 | ; assert(p0->zp.x >= 0 && p0->zp.x < c->zb->xsize); |
808 | ; assert(p0->zp.y >= 0 && p0->zp.y < c->zb->ysize); |
885 | ; assert(p0->zp.y >= 0 && p0->zp.y < c->zb->ysize); |
Line 812... | Line 889... | ||
812 | ; assert(p2->zp.y >= 0 && p2->zp.y < c->zb->ysize); |
889 | ; assert(p2->zp.y >= 0 && p2->zp.y < c->zb->ysize); |
Line 813... | Line 890... | ||
813 | 890 | ||
814 | ; norm=(p1->zp.x-p0->zp.x)*(p2->zp.y-p0->zp.y)- |
891 | ; norm=(p1->zp.x-p0->zp.x)*(p2->zp.y-p0->zp.y)- |
815 | ; (p2->zp.x-p0->zp.x)*(p1->zp.y-p0->zp.y); |
892 | ; (p2->zp.x-p0->zp.x)*(p1->zp.y-p0->zp.y); |
816 | ; count_pixels+=abs(norm)/2; |
893 | ; count_pixels+=abs(norm)/2; |
817 | ; count_triangles++; |
- | |
818 | ; } |
894 | inc dword[count_triangles] |
Line -... | Line 895... | ||
- | 895 | end if |
|
- | 896 | ||
- | 897 | mov ebx,[p1] |
|
- | 898 | add ebx,offs_vert_zp |
|
819 | ;#endif |
899 | mov ecx,[p2] |
820 | 900 | add ecx,offs_vert_zp |
|
821 | mov edx,[context] |
901 | mov edx,[context] |
822 | cmp dword[edx+offs_cont_texture_2d_enabled],0 |
902 | cmp dword[edx+offs_cont_texture_2d_enabled],0 |
823 | je .els_i |
903 | je .els_i |
824 | ;if (context.texture_2d_enabled) |
904 | ;if (context.texture_2d_enabled) |
825 | ;#ifdef PROFILE |
905 | if PROFILE eq 1 |
826 | ; count_triangles_textured++; |
906 | inc dword[count_triangles_textured] |
827 | ;#endif |
907 | end if |
828 | mov eax,dword[edx+offs_cont_current_texture] |
908 | mov eax,dword[edx+offs_cont_current_texture] |
829 | mov eax,[eax] ;переход по указателю |
909 | mov eax,[eax] ;переход по указателю |
- | 910 | ;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax] |
|
- | 911 | stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax] |
|
830 | ;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax] |
912 | mov eax,[p0] |
831 | stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax] |
913 | add eax,offs_vert_zp |
832 | ; ZB_fillTriangleMappingPerspective, dword[edx+offs_cont_zb],&p0->zp,&p1->zp,&p2->zp); |
914 | stdcall ZB_fillTriangleMappingPerspective, dword[edx+offs_cont_zb],eax,ebx,ecx |
- | 915 | jmp .end_f |
|
- | 916 | .els_i: |
|
833 | jmp .end_f |
917 | mov eax,[p0] |
834 | .els_i: |
918 | add eax,offs_vert_zp |
835 | cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
919 | cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
836 | jne .els |
920 | jne .els |
837 | ;else if (context.current_shade_model == GL_SMOOTH) |
921 | ;else if (context.current_shade_model == GL_SMOOTH) |
838 | ; ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],&p0->zp,&p1->zp,&p2->zp); |
922 | stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx |
839 | jmp .end_f |
923 | jmp .end_f |
840 | .els: |
924 | .els: |
- | 925 | stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx |
|
841 | ; ZB_fillTriangleFlat, dword[edx+offs_cont_zb],&p0->zp,&p1->zp,&p2->zp); |
926 | .end_f: |
842 | .end_f: |
927 | popad |
Line 843... | Line 928... | ||
843 | ret |
928 | ret |