Subversion Repositories Kolibri OS

Rev

Rev 5187 | Rev 5213 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5187 Rev 5208
Line 45... Line 45...
45
 
45
 
46
	ffree st0
46
	ffree st0
Line 47... Line 47...
47
	fincstp
47
	fincstp
48
 
48
 
49
	; color
49
	; color
50
	bt dword[eax+offs_cont_lighting_enabled],0
50
	cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled)
51
	jnc @f
51
	je @f
52
		mov ecx,ebx
52
		mov ecx,ebx
53
		add ecx,offs_vert_zp+offs_zbup_b
53
		add ecx,offs_vert_zp+offs_zbup_b
54
		push ecx
54
		push ecx
Line 58... Line 58...
58
		push ecx
58
		push ecx
59
		stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
59
		stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
60
		jmp .end_if
60
		jmp .end_if
61
	@@:
61
	@@:
62
		; no need to convert to integer if no lighting : take current color
62
		; no need to convert to integer if no lighting : take current color
63
		push ecx
-
 
64
		mov ecx,[eax+offs_cont_longcurrent_color]
63
		mov ecx,[eax+offs_cont_longcurrent_color]
65
		mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx
64
		mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx
66
		mov ecx,[eax+offs_cont_longcurrent_color+4]
65
		mov ecx,[eax+offs_cont_longcurrent_color+4]
67
		mov dword[ebx+offs_vert_zp+offs_zbup_g],ecx
66
		mov dword[ebx+offs_vert_zp+offs_zbup_g],ecx
68
		mov ecx,[eax+offs_cont_longcurrent_color+8]
67
		mov ecx,[eax+offs_cont_longcurrent_color+8]
69
		mov dword[ebx+offs_vert_zp+offs_zbup_b],ecx
68
		mov dword[ebx+offs_vert_zp+offs_zbup_b],ecx
70
		pop ecx
-
 
71
	.end_if:
69
	.end_if:
Line 72... Line 70...
72
  
70
  
73
	; texture
71
	; texture
74
	bt dword[eax+offs_cont_texture_2d_enabled],0
72
	bt dword[eax+offs_cont_texture_2d_enabled],0
Line 212... Line 210...
212
	fld dword[ecx+offs_vert_color+8]
210
	fld dword[ecx+offs_vert_color+8]
213
	fsub dword[ebx+offs_vert_color+8]
211
	fsub dword[ebx+offs_vert_color+8]
214
	fmul st0,st1
212
	fmul st0,st1
215
	fadd dword[ebx+offs_vert_color+8]
213
	fadd dword[ebx+offs_vert_color+8]
216
	fstp dword[eax+offs_vert_color+8]
214
	fstp dword[eax+offs_vert_color+8]
-
 
215
 
-
 
216
	ffree st0
-
 
217
	fincstp
217
	ret
218
	ret
218
endp
219
endp
Line 219... Line 220...
219
 
220
 
220
;
221
;
Line 320... Line 321...
320
 
321
 
321
	mov edx,[context]
322
	mov edx,[context]
322
	mov edi,[p1]
323
	mov edi,[p1]
Line 323... Line -...
323
	mov esi,[p2]
-
 
324
 
-
 
325
if DEBUG
-
 
326
	jmp @f
-
 
327
		f_1 db ' gl_draw_line',0
-
 
328
	@@:
-
 
329
	stdcall dbg_print,f_1,m_1
324
	mov esi,[p2]
330
end if
325
 
331
	cmp dword[edi+offs_vert_clip_code],0
326
	cmp dword[edi+offs_vert_clip_code],0
332
	jne .els_i
327
	jne .els_i
333
	cmp dword[esi+offs_vert_clip_code],0
328
	cmp dword[esi+offs_vert_clip_code],0
Line 357... Line 352...
357
		mov eax,[edi+offs_vert_clip_code]
352
		mov eax,[edi+offs_vert_clip_code]
358
		and eax,[esi+offs_vert_clip_code]
353
		and eax,[esi+offs_vert_clip_code]
359
		cmp eax,0
354
		cmp eax,0
360
		jne .end_f
355
		jne .end_f
361
	.els_0:
356
	.els_0:
362
if DEBUG
-
 
363
	stdcall dbg_print,f_1,m_2
-
 
364
end if
-
 
Line 365... Line 357...
365
 
357
 
366
	finit
358
	finit
367
	fld dword[esi+offs_vert_pc+offs_X]
359
	fld dword[esi+offs_vert_pc+offs_X]
368
	fsub dword[edi+offs_vert_pc+offs_X]
360
	fsub dword[edi+offs_vert_pc+offs_X]
Line 551... Line 543...
551
else
543
else
552
	fsub dword[d#dir]
544
	fsub dword[d#dir]
553
end if
545
end if
Line 554... Line 546...
554
 
546
 
555
	fldz
547
	fldz
556
	fcompp
548
	fcomp
557
	fstsw ax
549
	fstsw ax
558
	sahf
550
	sahf
-
 
551
	jne @f
559
	ja @f
552
		fldz
560
		fst dword[t] ;t=0
553
		fst dword[t] ;t=0
561
		jmp .e_zero
554
		jmp .e_zero
562
	@@: ;else
555
	@@: ;else
563
		fld dword[edx+offs#dir]
556
		fld dword[edx+offs#dir]
Line 571... Line 564...
571
 
564
 
572
	fmul dword[d#dir1] ;st0 = t * d.dir1
565
	fmul dword[d#dir1] ;st0 = t * d.dir1
573
	fadd dword[edx+offs#dir1]
566
	fadd dword[edx+offs#dir1]
Line -... Line 567...
-
 
567
	fstp dword[ecx+offs#dir1] ;c.dir1 = a.dir1 + t * d.dir1
-
 
568
 
-
 
569
	ffree st0
574
	fstp dword[ecx+offs#dir1] ;c.dir1 = a.dir1 + t * d.dir1
570
	fincstp
575
 
571
 
576
	fld dword[t]
572
	fld dword[t]
577
	fmul dword[d#dir2] ;st0 = t * d.dir2
573
	fmul dword[d#dir2] ;st0 = t * d.dir2
Line 628... Line 624...
628
 
624
 
629
align 4
625
align 4
Line 630... Line 626...
630
clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax
626
clip_proc dd clip_xmin,clip_xmax, clip_ymin,clip_ymax, clip_zmin,clip_zmax
631
 
627
 
-
 
628
align 4
632
align 4
629
proc updateTmp uses eax ebx ecx edx, context:dword, q:dword, p0:dword, p1:dword, t:dword
-
 
630
	mov ebx,[q]
633
proc updateTmp uses edx, context:dword, q:dword, p0:dword, p1:dword, t:dword
631
	mov edx,[context]
634
	mov eax,[context]
632
	mov eax,[p0]
-
 
633
	cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH)
-
 
634
	jne .els_0
-
 
635
		mov ecx,[p1]
-
 
636
		fld dword[ecx+offs_vert_color]
-
 
637
		fsub dword[eax+offs_vert_color]
635
	cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH ;if (context.current_shade_model == GL_SMOOTH)
638
		fmul dword[t]
-
 
639
		fadd dword[eax+offs_vert_color]
-
 
640
		fstp dword[ebx+offs_vert_color] ;q.color.v[0]=p0.color.v[0] + (p1.color.v[0]-p0.color.v[0])*t
-
 
641
		fld dword[ecx+offs_vert_color+4]
-
 
642
		fsub dword[eax+offs_vert_color+4]
636
	jne .els_0
643
		fmul dword[t]
-
 
644
		fadd dword[eax+offs_vert_color+4]
-
 
645
		fstp dword[ebx+offs_vert_color+4] ;q.color.v[1]=p0.color.v[1] + (p1.color.v[1]-p0.color.v[1])*t
-
 
646
		fld dword[ecx+offs_vert_color+8]
-
 
647
		fsub dword[eax+offs_vert_color+8]
637
;    q->color.v[0]=p0->color.v[0] + (p1->color.v[0]-p0->color.v[0])*t;
648
		fmul dword[t]
638
;    q->color.v[1]=p0->color.v[1] + (p1->color.v[1]-p0->color.v[1])*t;
649
		fadd dword[eax+offs_vert_color+8]
639
;    q->color.v[2]=p0->color.v[2] + (p1->color.v[2]-p0->color.v[2])*t;
650
		fstp dword[ebx+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t
-
 
651
		jmp @f
640
		jmp @f
652
	.els_0:
-
 
653
		mov ecx,[eax+offs_vert_color]
641
	.els_0:
654
		mov [ebx+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0]
-
 
655
		mov ecx,[eax+offs_vert_color+4]
642
;    q->color.v[0]=p0->color.v[0];
656
		mov [ebx+offs_vert_color+4],ecx ;q.color.v[1]=p0.color.v[1]
643
;    q->color.v[1]=p0->color.v[1];
657
		mov ecx,[eax+offs_vert_color+8]
Line 644... Line 658...
644
;    q->color.v[2]=p0->color.v[2];
658
		mov [ebx+offs_vert_color+8],ecx ;q.color.v[2]=p0.color.v[2]
645
	@@:
659
	@@:
-
 
660
 
-
 
661
	cmp dword[edx+offs_cont_texture_2d_enabled],0 ;if (context.texture_2d_enabled)
-
 
662
	je @f
-
 
663
		mov ecx,[p1]
-
 
664
		fld dword[ecx+offs_vert_tex_coord+offs_X]
646
 
665
		fsub dword[eax+offs_vert_tex_coord+offs_X]
-
 
666
		fmul dword[t]
-
 
667
		fadd dword[eax+offs_vert_tex_coord+offs_X]
-
 
668
		fstp dword[ebx+offs_vert_tex_coord+offs_X] ;q.tex_coord.X=p0.tex_coord.X + (p1.tex_coord.X-p0.tex_coord.X)*t
-
 
669
		fld dword[ecx+offs_vert_tex_coord+offs_Y]
647
	cmp dword[edx+offs_cont_texture_2d_enabled],0 ;if (context.texture_2d_enabled)
670
		fsub dword[eax+offs_vert_tex_coord+offs_Y]
-
 
671
		fmul dword[t]
-
 
672
		fadd dword[eax+offs_vert_tex_coord+offs_Y]
-
 
673
		fstp dword[ebx+offs_vert_tex_coord+offs_Y] ;q.tex_coord.Y=p0.tex_coord.Y + (p1.tex_coord.Y-p0.tex_coord.Y)*t
-
 
674
	@@:
-
 
675
 
-
 
676
	stdcall gl_clipcode, [ebx+offs_vert_pc+offs_X],[ebx+offs_vert_pc+offs_Y],\
-
 
677
		[ebx+offs_vert_pc+offs_Z],[ebx+offs_vert_pc+offs_W]
-
 
678
	mov dword[ebx+offs_vert_clip_code],eax
-
 
679
	cmp eax,0 ;if (q.clip_code==0)
-
 
680
	jne @f
-
 
681
		stdcall gl_transform_to_viewport,[context],ebx
-
 
682
		mov eax,ebx
-
 
683
		add eax,offs_vert_zp+offs_zbup_b
-
 
684
		push eax
-
 
685
		add eax,offs_zbup_g-offs_zbup_b
-
 
686
		push eax
648
	je @f
687
		add eax,offs_zbup_r-offs_zbup_g
649
;    q->tex_coord.X=p0->tex_coord.X + (p1->tex_coord.X-p0->tex_coord.X)*t;
-
 
650
;    q->tex_coord.Y=p0->tex_coord.Y + (p1->tex_coord.Y-p0->tex_coord.Y)*t;
-
 
651
	@@:
-
 
652
 
-
 
653
;  q->clip_code=gl_clipcode(q->pc.X,q->pc.Y,q->pc.Z,q->pc.W);
-
 
654
;  if (q->clip_code==0){
-
 
655
;    gl_transform_to_viewport(c,q);
688
		push eax
656
;    RGBFtoRGBI(q->color.v[0],q->color.v[1],q->color.v[2],q->zp.r,q->zp.g,q->zp.b);
689
		stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8]
Line 657... Line 690...
657
;  }
690
	@@:
658
	ret
691
	ret
Line 675... Line 708...
675
	mov eax,[ecx+offs_vert_clip_code]
708
	mov eax,[ecx+offs_vert_clip_code]
676
	mov dword[cc+4],eax
709
	mov dword[cc+4],eax
677
	or edi,eax
710
	or edi,eax
678
	mov eax,[edx+offs_vert_clip_code]
711
	mov eax,[edx+offs_vert_clip_code]
679
	mov dword[cc+8],eax
712
	mov dword[cc+8],eax
680
	or edi,eax
713
	or edi,eax ;co = cc[0] | cc[1] | cc[2]
Line 681... Line 714...
681
 
714
 
682
	; we handle the non clipped case here to go faster
715
	; we handle the non clipped case here to go faster
683
	cmp edi,0
716
	cmp edi,0 ;if (co==0)
684
	jne .els_0
717
	jne .els_0
685
		mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
718
		mov edi,dword[edx+offs_vert_zp+offs_zbup_x]
686
		mov edi,dword[ebx+offs_vert_zp+offs_zbup_x]
719
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
687
		mov dword[norm],edi
720
		mov dword[norm],edi
688
		fild dword[norm]
721
		fild dword[norm]
689
		mov esi,dword[ecx+offs_vert_zp+offs_zbup_y]
722
		mov esi,dword[ecx+offs_vert_zp+offs_zbup_y]
690
		mov esi,dword[ebx+offs_vert_zp+offs_zbup_y]
723
		sub esi,dword[ebx+offs_vert_zp+offs_zbup_y]
691
		mov dword[norm],edi
724
		mov dword[norm],edi
692
		fimul dword[norm]
725
		fimul dword[norm]
693
		mov edi,dword[ecx+offs_vert_zp+offs_zbup_x]
726
		mov edi,dword[ecx+offs_vert_zp+offs_zbup_x]
694
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
727
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_x]
695
		mov dword[norm],edi
728
		mov dword[norm],edi
696
		fild dword[norm]
729
		fild dword[norm]
697
		mov edi,dword[edx+offs_vert_zp+offs_zbup_y]
730
		mov edi,dword[edx+offs_vert_zp+offs_zbup_y]
698
		mov edi,dword[ebx+offs_vert_zp+offs_zbup_y]
731
		sub edi,dword[ebx+offs_vert_zp+offs_zbup_y]
699
		mov dword[norm],edi
732
		mov dword[norm],edi
700
		fimul dword[norm]
733
		fimul dword[norm]
Line 701... Line 734...
701
		fsubp
734
		fsubp
Line 739... Line 772...
739
				stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
772
				stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx
740
			@@:
773
			@@:
741
				stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
774
				stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx
742
		jmp .end_f
775
		jmp .end_f
743
	.els_0:
776
	.els_0:
-
 
777
		;eax = cc[2]
744
		and eax,[cc]
778
		and eax,[cc]
745
		and eax,[cc+4]
779
		and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2]
746
		cmp eax,0
780
		cmp eax,0 ;if (c_and==0)
747
		jne .end_f
781
		jne .end_f
748
			stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
782
			stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
749
	.end_f:
783
	.end_f:
750
popad
784
popad
751
	ret
785
	ret
Line 753... Line 787...
753
 
787
 
754
align 4
788
align 4
755
proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword
789
proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword
756
locals
790
locals
757
	co dd ?
-
 
758
	co1 dd ?
791
	co dd ?
759
	cc rd 3
792
	cc rd 3
760
	edge_flag_tmp dd ?
793
	edge_flag_tmp dd ?
-
 
794
	clip_mask dd ?
761
	clip_mask dd ?
795
	q rd 3 ;GLVertex*
762
	tmp1 GLVertex ?
796
	tmp1 GLVertex ?
763
	tmp2 GLVertex ?
-
 
764
	q rd 3 ;GLVertex*
-
 
765
	tt dd ? ;float
797
	tmp2 GLVertex ?
766
endl
798
endl
767
pushad
-
 
768
 
799
pushad
769
	mov ebx,[p0]
800
	mov ebx,[p0]
770
	mov ecx,[p1]
801
	mov ecx,[p1]
Line -... Line 802...
-
 
802
	mov edx,[p2]
-
 
803
 
-
 
804
if DEBUG ;(1) gl_draw_triangle_clip
-
 
805
pushad
-
 
806
	stdcall dbg_print,txt_sp,m_1
-
 
807
	add ebx,offs_vert_color
-
 
808
	add ecx,offs_vert_color
-
 
809
	add edx,offs_vert_color
-
 
810
	stdcall gl_print_matrix,ebx,1
-
 
811
	stdcall gl_print_matrix,ecx,1
-
 
812
	stdcall gl_print_matrix,edx,1
-
 
813
popad
-
 
814
end if
-
 
815
 
771
	mov edx,[p2]
816
;	finit ;???
772
	
817
 
773
	mov edi,[ebx+offs_vert_clip_code]
818
	mov edi,[ebx+offs_vert_clip_code]
774
	mov dword[cc],edi
819
	mov [cc],edi
775
	mov eax,[ecx+offs_vert_clip_code]
820
	mov eax,[ecx+offs_vert_clip_code]
776
	mov dword[cc+4],eax
821
	mov [cc+4],eax
777
	or edi,eax
822
	or edi,eax
778
	mov eax,[edx+offs_vert_clip_code]
823
	mov eax,[edx+offs_vert_clip_code]
779
	mov dword[cc+8],eax
824
	mov [cc+8],eax
Line 780... Line 825...
780
	or edi,eax
825
	or edi,eax
781
	mov dword[co],edi
826
	mov [co],edi ;co = cc[0] | cc[1] | cc[2]
782
 
827
 
783
	cmp edi,0
828
	cmp edi,0 ;if (co == 0)
784
	jne .els_0
829
	jne .els_0
-
 
830
		stdcall gl_draw_triangle, [context],ebx,ecx,edx
785
		stdcall gl_draw_triangle, [context],ebx,ecx,edx
831
		jmp .end_f
786
		jmp .end_f
832
	.els_0:
Line 787... Line 833...
787
	.els_0:
833
		;eax = cc[2]
788
		and eax,[cc]
834
		and eax,[cc]
789
		and eax,[cc+4]
835
		and eax,[cc+4] ;c_and = cc[0] & cc[1] & cc[2]
Line 790... Line 836...
790
 
836
 
791
		; the triangle is completely outside
837
		; the triangle is completely outside
792
		cmp eax,0
838
		cmp eax,0 ;if (c_and!=0) return
-
 
839
		jne .end_f
-
 
840
 
793
		jne .end_f
841
		; find the next direction to clip
-
 
842
		.cycle_0: ;while (clip_bit < 6 && (co & (1 << clip_bit)) == 0)
-
 
843
		cmp dword[clip_bit],6
-
 
844
		jge .cycle_0_end
-
 
845
		xor eax,eax
-
 
846
		inc eax
-
 
847
		mov ecx,[clip_bit]
-
 
848
		shl eax,cl
-
 
849
		and eax,[co]
Line 794... Line 850...
794
 
850
		cmp eax,0
795
	; find the next direction to clip
851
		jne .cycle_0_end
796
;    while (clip_bit < 6 && (co & (1 << clip_bit)) == 0)  {
852
			inc dword[clip_bit]
797
;      clip_bit++;
853
			jmp .cycle_0
Line 805... Line 861...
805
;      printf("%f %f %f %f\n",p0->pc.X,p0->pc.Y,p0->pc.Z,p0->pc.W);
861
;      printf("%f %f %f %f\n",p0->pc.X,p0->pc.Y,p0->pc.Z,p0->pc.W);
806
;      printf("%f %f %f %f\n",p1->pc.X,p1->pc.Y,p1->pc.Z,p1->pc.W);
862
;      printf("%f %f %f %f\n",p1->pc.X,p1->pc.Y,p1->pc.Z,p1->pc.W);
807
;      printf("%f %f %f %f\n",p2->pc.X,p2->pc.Y,p2->pc.Z,p2->pc.W);
863
;      printf("%f %f %f %f\n",p2->pc.X,p2->pc.Y,p2->pc.Z,p2->pc.W);
808
		jmp .end_f
864
		jmp .end_f
809
	@@:
865
	@@:
-
 
866
end if
810
else
867
if 1
811
	je .end_f
868
	je .end_f
812
end if
869
end if
Line -... Line 870...
-
 
870
 
-
 
871
	xor eax,eax
-
 
872
	inc eax
-
 
873
	mov ecx,[clip_bit]
813
 
874
	shl eax,cl
-
 
875
	mov [clip_mask],eax ;1 << clip_bit
-
 
876
	mov edi,[cc]
-
 
877
	xor edi,[cc+4]
814
;    clip_mask = 1 << clip_bit;
878
	xor edi,[cc+8]
Line 815... Line -...
815
;    co1=(cc[0] ^ cc[1] ^ cc[2]) & clip_mask;
-
 
816
 
879
	and eax,edi ;eax = co1 = (cc[0] ^ cc[1] ^ cc[2]) & clip_mask
Line -... Line 880...
-
 
880
 
-
 
881
	mov ecx,[p1] ;востанавливаем после shl ___,cl
-
 
882
 
-
 
883
	cmp eax,0 ;if (co1)
-
 
884
	je .els_1
-
 
885
		; one point outside
-
 
886
		mov eax,[cc]
817
;    if (co1)  { 
887
		and eax,[clip_mask]
-
 
888
		cmp eax,0 ;if (cc[0] & clip_mask)
-
 
889
		je .els_2
-
 
890
			;q[0]=p0 q[1]=p1 q[2]=p2
-
 
891
			mov [q],ebx
-
 
892
			mov [q+4],ecx
-
 
893
			mov [q+8],edx
-
 
894
			jmp .els_2_end
818
;      /* one point outside */
895
		.els_2:
-
 
896
		mov eax,[cc+4]
-
 
897
		and eax,[clip_mask]
-
 
898
		cmp eax,0 ;else if (cc[1] & clip_mask)
-
 
899
		je .els_3
-
 
900
			;q[0]=p1 q[1]=p2 q[2]=p0
-
 
901
			mov [q],ecx
-
 
902
			mov [q+4],edx
819
 
903
			mov [q+8],ebx
-
 
904
			jmp .els_2_end
-
 
905
		.els_3:
-
 
906
			;q[0]=p2 q[1]=p0 q[2]=p1
-
 
907
			mov [q],edx
-
 
908
			mov [q+4],ebx
-
 
909
			mov [q+8],ecx
-
 
910
		.els_2_end:
-
 
911
 
-
 
912
		mov ebx,[q]
-
 
913
		add ebx,offs_vert_pc
-
 
914
		mov ecx,[q+4]
820
;      if (cc[0] & clip_mask) { q[0]=p0; q[1]=p1; q[2]=p2; }
915
		add ecx,offs_vert_pc
-
 
916
		mov edx,[q+8]
-
 
917
		add edx,offs_vert_pc
-
 
918
 
-
 
919
		lea eax,[clip_proc]
-
 
920
		mov edi,[clip_bit]
-
 
921
		shl edi,2
821
;      else if (cc[1] & clip_mask) { q[0]=p1; q[1]=p2; q[2]=p0; }
922
		add eax,edi
-
 
923
		mov edi,ebp
-
 
924
		sub edi,(2*sizeof.GLVertex)-offs_vert_pc
-
 
925
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
-
 
926
		sub edi,offs_vert_pc
822
;      else { q[0]=p2; q[1]=p0; q[2]=p1; }
927
 
-
 
928
		sub ebx,offs_vert_pc
823
;      
929
		sub ecx,offs_vert_pc
-
 
930
		stdcall updateTmp,[context],edi,ebx,ecx,eax ;updateTmp(c,&tmp1,q[0],q[1],tt)
-
 
931
		add ebx,offs_vert_pc
-
 
932
 
-
 
933
		lea eax,[clip_proc]
-
 
934
		mov edi,[clip_bit]
-
 
935
		shl edi,2
824
;      tt=clip_proc[clip_bit](&tmp1.pc,&q[0]->pc,&q[1]->pc);
936
		add eax,edi
-
 
937
		mov edi,ebp
-
 
938
		sub edi,sizeof.GLVertex-offs_vert_pc
-
 
939
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
825
;      updateTmp(c,&tmp1,q[0],q[1],tt);
940
		sub edi,offs_vert_pc
826
;
941
		sub ebx,offs_vert_pc
-
 
942
		sub edx,offs_vert_pc
827
;      tt=clip_proc[clip_bit](&tmp2.pc,&q[0]->pc,&q[2]->pc);
943
		stdcall updateTmp,[context],edi,ebx,edx,eax ;updateTmp(c,&tmp2,q[0],q[2],tt)
-
 
944
 
828
;      updateTmp(c,&tmp2,q[0],q[2],tt);
945
		mov eax,[ebx+offs_vert_edge_flag]
-
 
946
		mov [tmp1+offs_vert_edge_flag],eax ;q[0].edge_flag
-
 
947
		mov eax,[edx+offs_vert_edge_flag]
-
 
948
		mov [edge_flag_tmp],eax	;q[2].edge_flag
-
 
949
		mov dword[edx+offs_vert_edge_flag],0 ;q[2].edge_flag=0
-
 
950
		mov eax,[clip_bit]
829
;
951
		inc eax
830
;      tmp1.edge_flag=q[0]->edge_flag;
952
		push eax ;для вызова нижней функции
831
;      edge_flag_tmp=q[2]->edge_flag;
953
		mov edi,ebp
832
;      q[2]->edge_flag=0;
954
		sub edi,2*sizeof.GLVertex
833
;      gl_draw_triangle_clip(c,&tmp1,q[1],q[2],clip_bit+1);
955
		stdcall gl_draw_triangle_clip,[context],edi,ecx,edx,eax ;gl_draw_triangle_clip(c,&tmp1,q[1],q[2],clip_bit+1)
834
;
956
 
-
 
957
		mov dword[tmp2.edge_flag],0
-
 
958
		mov dword[tmp1.edge_flag],0
-
 
959
		mov eax,[edge_flag_tmp]
-
 
960
		mov [edx+offs_vert_edge_flag],eax ;q[2].edge_flag=edge_flag_tmp
835
;      tmp2.edge_flag=0;
961
		push edx
-
 
962
		push edi
836
;      tmp1.edge_flag=0;
963
		add edi,sizeof.GLVertex ;edi = &tmp2
837
;      q[2]->edge_flag=edge_flag_tmp;
964
		stdcall gl_draw_triangle_clip,[context],edi ;gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1)
-
 
965
		jmp .end_f
-
 
966
	.els_1:
-
 
967
		; two points outside
838
;      gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1);
968
		mov eax,[cc]
839
;    } else {
969
		and eax,[clip_mask]
-
 
970
		cmp eax,0 ;if (cc[0] & clip_mask)==0
-
 
971
		jne .els_4
-
 
972
			;q[0]=p0 q[1]=p1 q[2]=p2
-
 
973
			mov [q],ebx
-
 
974
			mov [q+4],ecx
-
 
975
			mov [q+8],edx
-
 
976
			jmp .els_4_end
840
;      /* two points outside */
977
		.els_4:
-
 
978
		mov eax,[cc+4]
-
 
979
		and eax,[clip_mask]
-
 
980
		cmp eax,0 ;else if (cc[1] & clip_mask)==0
-
 
981
		jne .els_5
-
 
982
			;q[0]=p1 q[1]=p2 q[2]=p0
-
 
983
			mov [q],ecx
-
 
984
			mov [q+4],edx
841
 
985
			mov [q+8],ebx
-
 
986
			jmp .els_4_end
-
 
987
		.els_5:
-
 
988
			;q[0]=p2 q[1]=p0 q[2]=p1
-
 
989
			mov [q],edx
-
 
990
			mov [q+4],ebx
-
 
991
			mov [q+8],ecx
-
 
992
		.els_4_end:
-
 
993
 
-
 
994
		mov ebx,[q]
-
 
995
		add ebx,offs_vert_pc
-
 
996
		mov ecx,[q+4]
842
;      if ((cc[0] & clip_mask)==0) { q[0]=p0; q[1]=p1; q[2]=p2; }
997
		add ecx,offs_vert_pc
-
 
998
		mov edx,[q+8]
-
 
999
		add edx,offs_vert_pc
-
 
1000
 
-
 
1001
		lea eax,[clip_proc]
-
 
1002
		mov edi,[clip_bit]
-
 
1003
		shl edi,2
843
;      else if ((cc[1] & clip_mask)==0) { q[0]=p1; q[1]=p2; q[2]=p0; } 
1004
		add eax,edi
-
 
1005
		mov edi,ebp
844
;      else { q[0]=p2; q[1]=p0; q[2]=p1; }
1006
		sub edi,(2*sizeof.GLVertex)-offs_vert_pc
845
 
1007
		stdcall dword[eax],edi,ebx,ecx ;clip_proc[clip_bit](&tmp1.pc,&q[0].pc,&q[1].pc)
-
 
1008
		sub edi,offs_vert_pc
-
 
1009
		stdcall updateTmp,[context],edi,[q],[q+4],eax
-
 
1010
 
-
 
1011
		lea eax,[clip_proc]
-
 
1012
		mov edi,[clip_bit]
-
 
1013
		shl edi,2
846
;      tt=clip_proc[clip_bit](&tmp1.pc,&q[0]->pc,&q[1]->pc);
1014
		add eax,edi
-
 
1015
		mov edi,ebp
847
;      updateTmp(c,&tmp1,q[0],q[1],tt);
1016
		sub edi,sizeof.GLVertex-offs_vert_pc
-
 
1017
		stdcall dword[eax],edi,ebx,edx ;clip_proc[clip_bit](&tmp2.pc,&q[0].pc,&q[2].pc)
-
 
1018
		sub edi,offs_vert_pc
848
 
1019
		stdcall updateTmp,[context],edi,[q],[q+8],eax
849
;      tt=clip_proc[clip_bit](&tmp2.pc,&q[0]->pc,&q[2]->pc);
1020
 
850
;      updateTmp(c,&tmp2,q[0],q[2],tt);
1021
		mov edx,[q+8]
851
 
1022
 
-
 
1023
		mov dword[tmp1+offs_vert_edge_flag],1
852
;      tmp1.edge_flag=1;
1024
		mov eax,[edx+offs_vert_edge_flag]
-
 
1025
		mov dword[tmp1+offs_vert_edge_flag],eax ;tmp2.edge_flag = q[2].edge_flag
853
;      tmp2.edge_flag=q[2]->edge_flag;
1026
		mov eax,[clip_bit]
-
 
1027
		inc eax
-
 
1028
		push eax
854
;      gl_draw_triangle_clip(c,q[0],&tmp1,&tmp2,clip_bit+1);
1029
		push edi
855
;    }
1030
		sub edi,sizeof.GLVertex
856
;  }
1031
		stdcall gl_draw_triangle_clip,[context],[q],edi ;gl_draw_triangle_clip(c,q[0],&tmp1,&tmp2,clip_bit+1)
857
	.end_f:
1032
	.end_f: