Rev 6017 | Rev 6145 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6017 | Rev 6134 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | CLIP_YMIN equ (1<<2) |
6 | CLIP_YMIN equ (1<<2) |
7 | CLIP_YMAX equ (1<<3) |
7 | CLIP_YMAX equ (1<<3) |
8 | CLIP_ZMIN equ (1<<4) |
8 | CLIP_ZMIN equ (1<<4) |
9 | CLIP_ZMAX equ (1<<5) |
9 | CLIP_ZMAX equ (1<<5) |
Line 10... | Line 10... | ||
10 | 10 | ||
11 | align 4 |
11 | align 16 |
12 | proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword |
12 | proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword |
13 | locals |
13 | locals |
14 | point dd ? |
14 | point dd ? |
15 | endl |
15 | endl |
Line 51... | Line 51... | ||
51 | push ecx |
51 | push ecx |
52 | add ecx,offs_zbup_r-offs_zbup_g |
52 | add ecx,offs_zbup_r-offs_zbup_g |
53 | push ecx |
53 | push ecx |
54 | stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8] |
54 | stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8] |
55 | jmp .end_if |
55 | jmp .end_if |
- | 56 | align 4 |
|
56 | @@: |
57 | @@: |
57 | ; no need to convert to integer if no lighting : take current color |
58 | ; no need to convert to integer if no lighting : take current color |
58 | mov ecx,[eax+offs_cont_longcurrent_color] |
59 | mov ecx,[eax+offs_cont_longcurrent_color] |
59 | mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx |
60 | mov dword[ebx+offs_vert_zp+offs_zbup_r],ecx |
60 | mov ecx,[eax+offs_cont_longcurrent_color+4] |
61 | mov ecx,[eax+offs_cont_longcurrent_color+4] |
Line 72... | Line 73... | ||
72 | fistp dword[ebx+offs_vert_zp+offs_zbup_s] |
73 | fistp dword[ebx+offs_vert_zp+offs_zbup_s] |
73 | add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_S_MIN |
74 | add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_S_MIN |
Line 74... | Line 75... | ||
74 | 75 | ||
75 | mov dword[point],dword(ZB_POINT_T_MAX - ZB_POINT_T_MIN) |
76 | mov dword[point],dword(ZB_POINT_T_MAX - ZB_POINT_T_MIN) |
76 | fild dword[point] |
77 | fild dword[point] |
77 | fmul dword[ebx+offs_vert_tex_coord+4] ;st0 *= v.tex_coord.Y |
78 | fmul dword[ebx+offs_vert_tex_coord+offs_Y] ;st0 *= v.tex_coord.Y |
78 | fistp dword[ebx+offs_vert_zp+offs_zbup_t] |
79 | fistp dword[ebx+offs_vert_zp+offs_zbup_t] |
79 | add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN |
80 | add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN |
80 | @@: |
81 | @@: |
81 | ret |
82 | ret |
Line 82... | Line 83... | ||
82 | endp |
83 | endp |
83 | 84 | ||
84 | align 4 |
85 | align 16 |
85 | proc gl_add_select1 uses eax ebx ecx, context:dword, z1:dword,z2:dword,z3:dword |
86 | proc gl_add_select1 uses eax ebx ecx, context:dword, z1:dword,z2:dword,z3:dword |
86 | mov eax,[z1] |
87 | mov eax,[z1] |
87 | mov ebx,eax |
88 | mov ebx,eax |
Line 111... | Line 112... | ||
111 | ret |
112 | ret |
112 | endp |
113 | endp |
Line 113... | Line 114... | ||
113 | 114 | ||
Line 114... | Line 115... | ||
114 | ; point |
115 | ; point |
115 | 116 | ||
116 | align 4 |
117 | align 16 |
117 | proc gl_draw_point uses eax ebx, context:dword, p0:dword |
118 | proc gl_draw_point uses eax ebx, context:dword, p0:dword |
118 | mov ebx,[p0] |
119 | mov ebx,[p0] |
119 | cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0) |
120 | cmp dword[ebx+offs_vert_clip_code],0 ;if (p0.clip_code == 0) |
120 | jne @f |
121 | jne @f |
121 | mov eax,[context] |
122 | mov eax,[context] |
122 | cmp dword[eax+offs_cont_render_mode],GL_SELECT |
123 | cmp dword[eax+offs_cont_render_mode],GL_SELECT |
123 | jne .els |
124 | jne .els |
- | 125 | stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z |
|
124 | stdcall gl_add_select, eax,dword[ebx+offs_vert_zp+offs_zbup_z],dword[ebx+offs_vert_zp+offs_zbup_z] ;p0.zp.z,p0.zp.z |
126 | jmp @f |
125 | jmp @f |
127 | align 4 |
126 | .els: |
128 | .els: |
127 | add ebx,offs_vert_zp |
129 | add ebx,offs_vert_zp |
128 | stdcall ZB_plot, dword[eax+offs_cont_zb],ebx |
130 | stdcall ZB_plot, dword[eax+offs_cont_zb],ebx |
129 | @@: |
131 | @@: |
Line 130... | Line 132... | ||
130 | ret |
132 | ret |
Line 131... | Line 133... | ||
131 | endp |
133 | endp |
132 | 134 | ||
133 | ; line |
135 | ; line |
134 | 136 | ||
135 | align 4 |
137 | align 16 |
136 | proc interpolate uses eax ebx ecx, q:dword,p0:dword,p1:dword,t:dword |
138 | proc interpolate uses eax ebx ecx, q:dword,p0:dword,p1:dword,t:dword |
Line 193... | Line 195... | ||
193 | ; |
195 | ; |
Line 194... | Line 196... | ||
194 | 196 | ||
195 | ; Line Clipping algorithm from 'Computer Graphics', Principles and |
197 | ; Line Clipping algorithm from 'Computer Graphics', Principles and |
196 | ; Practice |
198 | ; Practice |
197 | ; tmin,tmax -> &float |
199 | ; tmin,tmax -> &float |
198 | align 4 |
200 | align 16 |
199 | proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword |
201 | proc ClipLine1 uses ebx, denom:dword,num:dword,tmin:dword,tmax:dword |
200 | fld dword[denom] |
202 | fld dword[denom] |
201 | ftst |
203 | ftst |
202 | fstsw ax |
204 | fstsw ax |
Line 215... | Line 217... | ||
215 | fstsw ax |
217 | fstsw ax |
216 | sahf |
218 | sahf |
217 | jbe .r1_f1 ;if (t>*tmin) *tmin=t |
219 | jbe .r1_f1 ;if (t>*tmin) *tmin=t |
218 | fstp dword[ebx] |
220 | fstp dword[ebx] |
219 | jmp .r1 |
221 | jmp .r1 |
- | 222 | align 4 |
|
220 | .els_0: ;else if (denom<0) |
223 | .els_0: ;else if (denom<0) |
221 | jae .els_1 |
224 | jae .els_1 |
222 | fld dword[num] |
225 | fld dword[num] |
223 | fxch st1 |
226 | fxch st1 |
224 | fdivp ;t=num/denom |
227 | fdivp ;t=num/denom |
Line 232... | Line 235... | ||
232 | fstsw ax |
235 | fstsw ax |
233 | sahf |
236 | sahf |
234 | jae .r1_f1 |
237 | jae .r1_f1 |
235 | fstp dword[ebx] ;if (t<*tmin) *tmax=t |
238 | fstp dword[ebx] ;if (t<*tmin) *tmax=t |
236 | jmp .r1 |
239 | jmp .r1 |
- | 240 | align 4 |
|
237 | .els_1: ;else if (num>0) |
241 | .els_1: ;else if (num>0) |
238 | ffree st0 ;denom |
242 | ffree st0 ;denom |
239 | fincstp |
243 | fincstp |
240 | fld dword[num] |
244 | fld dword[num] |
241 | ftst |
245 | ftst |
242 | fstsw ax |
246 | fstsw ax |
243 | sahf |
247 | sahf |
244 | ja .r0_f1 ;if (num>0) return 0 |
248 | ja .r0_f1 ;if (num>0) return 0 |
245 | jmp .r1_f1 |
249 | jmp .r1_f1 |
246 | 250 | align 4 |
|
247 | .r0_f1: ;return 0 & free st0 |
251 | .r0_f1: ;return 0 & free st0 |
248 | ffree st0 |
252 | ffree st0 |
249 | fincstp |
253 | fincstp |
250 | .r0: ;return 0 |
254 | .r0: ;return 0 |
251 | xor eax,eax |
255 | xor eax,eax |
252 | jmp .end_f |
256 | jmp .end_f |
- | 257 | align 4 |
|
253 | .r1_f1: ;return 1 & free st0 |
258 | .r1_f1: ;return 1 & free st0 |
254 | ffree st0 |
259 | ffree st0 |
255 | fincstp |
260 | fincstp |
256 | .r1: ;return 1 |
261 | .r1: ;return 1 |
257 | xor eax,eax |
262 | xor eax,eax |
258 | inc eax |
263 | inc eax |
259 | .end_f: |
264 | .end_f: |
260 | ret |
265 | ret |
261 | endp |
266 | endp |
Line 262... | Line 267... | ||
262 | 267 | ||
263 | align 4 |
268 | align 16 |
264 | proc gl_draw_line, context:dword, p1:dword, p2:dword |
269 | proc gl_draw_line, context:dword, p1:dword, p2:dword |
265 | locals |
270 | locals |
266 | d_x dd ? |
271 | d_x dd ? |
267 | d_y dd ? |
272 | d_y dd ? |
Line 289... | Line 294... | ||
289 | cmp dword[edx+offs_cont_render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT) |
294 | cmp dword[edx+offs_cont_render_mode],GL_SELECT ;if (context.render_mode == GL_SELECT) |
290 | jne .els_1 |
295 | jne .els_1 |
291 | stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\ |
296 | stdcall gl_add_select1, edx,dword[edi+offs_vert_zp+offs_zbup_z],\ |
292 | dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z] |
297 | dword[esi+offs_vert_zp+offs_zbup_z],dword[esi+offs_vert_zp+offs_zbup_z] |
293 | jmp .end_f |
298 | jmp .end_f |
- | 299 | align 4 |
|
294 | .els_1: |
300 | .els_1: |
295 | add edi,offs_vert_zp |
301 | add edi,offs_vert_zp |
296 | add esi,offs_vert_zp |
302 | add esi,offs_vert_zp |
297 | push esi |
303 | push esi |
298 | push edi |
304 | push edi |
Line 300... | Line 306... | ||
300 | cmp dword[edx+offs_cont_depth_test],0 |
306 | cmp dword[edx+offs_cont_depth_test],0 |
301 | je .els_2 |
307 | je .els_2 |
302 | ;if (context.depth_test) |
308 | ;if (context.depth_test) |
303 | call ZB_line_z ;, dword[edx+offs_cont_zb],edi,esi |
309 | call ZB_line_z ;, dword[edx+offs_cont_zb],edi,esi |
304 | jmp .end_f |
310 | jmp .end_f |
- | 311 | align 4 |
|
305 | .els_2: |
312 | .els_2: |
306 | call ZB_line ;, dword[edx+offs_cont_zb],edi,esi |
313 | call ZB_line ;, dword[edx+offs_cont_zb],edi,esi |
307 | jmp .end_f |
314 | jmp .end_f |
- | 315 | align 4 |
|
308 | .els_i: |
316 | .els_i: |
309 | ;else if ( (p1.clip_code & p2.clip_code) != 0 ) |
317 | ;else if ( (p1.clip_code & p2.clip_code) != 0 ) |
310 | mov eax,[edi+offs_vert_clip_code] |
318 | mov eax,[edi+offs_vert_clip_code] |
311 | and eax,[esi+offs_vert_clip_code] |
319 | and eax,[esi+offs_vert_clip_code] |
312 | cmp eax,0 |
320 | or eax,eax |
313 | jne .end_f |
321 | jnz .end_f |
314 | .els_0: |
322 | .els_0: |
Line 315... | Line 323... | ||
315 | 323 | ||
316 | fld dword[esi+offs_vert_pc+offs_X] |
324 | fld dword[esi+offs_vert_pc+offs_X] |
317 | fsub dword[edi+offs_vert_pc+offs_X] |
325 | fsub dword[edi+offs_vert_pc+offs_X] |
Line 452... | Line 460... | ||
452 | push dword[edx+offs_cont_zb] |
460 | push dword[edx+offs_cont_zb] |
453 | cmp dword[edx+offs_cont_depth_test],0 |
461 | cmp dword[edx+offs_cont_depth_test],0 |
454 | je .els_3 |
462 | je .els_3 |
455 | call ZB_line_z ;(context.zb,&q1.zp,&q2.zp) |
463 | call ZB_line_z ;(context.zb,&q1.zp,&q2.zp) |
456 | jmp .end_f |
464 | jmp .end_f |
- | 465 | align 4 |
|
457 | .els_3: |
466 | .els_3: |
458 | call ZB_line ;(context.zb,&q1.zp,&q2.zp) |
467 | call ZB_line ;(context.zb,&q1.zp,&q2.zp) |
459 | .end_f: |
468 | .end_f: |
460 | popad |
469 | popad |
461 | ret |
470 | ret |
Line 507... | Line 516... | ||
507 | sahf |
516 | sahf |
508 | jne @f |
517 | jne @f |
509 | fldz |
518 | fldz |
510 | fst dword[t] ;t=0 |
519 | fst dword[t] ;t=0 |
511 | jmp .e_zero |
520 | jmp .e_zero |
- | 521 | align 4 |
|
512 | @@: ;else |
522 | @@: ;else |
513 | fld dword[edx+offs#dir] |
523 | fld dword[edx+offs#dir] |
514 | if sign eq 0 |
524 | if sign eq 0 |
515 | fchs |
525 | fchs |
516 | end if |
526 | end if |
Line 541... | Line 551... | ||
541 | end if |
551 | end if |
542 | fstp dword[ecx+offs#dir] ;c.dir = sign c.W |
552 | fstp dword[ecx+offs#dir] ;c.dir = sign c.W |
543 | mov eax,[t] |
553 | mov eax,[t] |
544 | } |
554 | } |
Line 545... | Line 555... | ||
545 | 555 | ||
546 | align 4 |
556 | align 16 |
547 | proc clip_xmin uses ebx ecx edx, c:dword, a:dword, b:dword |
557 | proc clip_xmin uses ebx ecx edx, c:dword, a:dword, b:dword |
548 | clip_func 0,_X,_Y,_Z |
558 | clip_func 0,_X,_Y,_Z |
549 | ret |
559 | ret |
Line 550... | Line 560... | ||
550 | endp |
560 | endp |
551 | 561 | ||
552 | align 4 |
562 | align 16 |
553 | proc clip_xmax uses ebx ecx edx, c:dword, a:dword, b:dword |
563 | proc clip_xmax uses ebx ecx edx, c:dword, a:dword, b:dword |
554 | clip_func 1,_X,_Y,_Z |
564 | clip_func 1,_X,_Y,_Z |
Line 555... | Line 565... | ||
555 | ret |
565 | ret |
556 | endp |
566 | endp |
557 | 567 | ||
558 | align 4 |
568 | align 16 |
559 | proc clip_ymin uses ebx ecx edx, c:dword, a:dword, b:dword |
569 | proc clip_ymin uses ebx ecx edx, c:dword, a:dword, b:dword |
Line 560... | Line 570... | ||
560 | clip_func 0,_Y,_X,_Z |
570 | clip_func 0,_Y,_X,_Z |
561 | ret |
571 | ret |
562 | endp |
572 | endp |
563 | 573 | ||
564 | align 4 |
574 | align 16 |
Line 565... | Line 575... | ||
565 | proc clip_ymax uses ebx ecx edx, c:dword, a:dword, b:dword |
575 | proc clip_ymax uses ebx ecx edx, c:dword, a:dword, b:dword |
566 | clip_func 1,_Y,_X,_Z |
576 | clip_func 1,_Y,_X,_Z |
567 | ret |
577 | ret |
568 | endp |
578 | endp |
569 | 579 | ||
Line 570... | Line 580... | ||
570 | align 4 |
580 | align 16 |
571 | proc clip_zmin uses ebx ecx edx, c:dword, a:dword, b:dword |
581 | proc clip_zmin uses ebx ecx edx, c:dword, a:dword, b:dword |
572 | clip_func 0,_Z,_X,_Y |
582 | clip_func 0,_Z,_X,_Y |
573 | ret |
583 | ret |
574 | endp |
584 | endp |
Line 575... | Line 585... | ||
575 | 585 | ||
576 | align 4 |
586 | align 16 |
Line 577... | Line 587... | ||
577 | proc clip_zmax uses ebx ecx edx, c:dword, a:dword, b:dword |
587 | proc clip_zmax uses ebx ecx edx, c:dword, a:dword, b:dword |
578 | clip_func 1,_Z,_X,_Y |
588 | clip_func 1,_Z,_X,_Y |
579 | ret |
589 | ret |
580 | endp |
590 | endp |
581 | 591 | ||
582 | align 4 |
592 | align 4 |
Line 604... | Line 614... | ||
604 | fsub dword[eax+offs_vert_color+8] |
614 | fsub dword[eax+offs_vert_color+8] |
605 | fmul dword[t] |
615 | fmul dword[t] |
606 | fadd dword[eax+offs_vert_color+8] |
616 | fadd dword[eax+offs_vert_color+8] |
607 | fstp dword[ebx+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t |
617 | fstp dword[ebx+offs_vert_color+8] ;q.color.v[2]=p0.color.v[2] + (p1.color.v[2]-p0.color.v[2])*t |
608 | jmp @f |
618 | jmp @f |
- | 619 | align 4 |
|
609 | .els_0: |
620 | .els_0: |
610 | mov ecx,[eax+offs_vert_color] |
621 | mov ecx,[eax+offs_vert_color] |
611 | mov [ebx+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0] |
622 | mov [ebx+offs_vert_color],ecx ;q.color.v[0]=p0.color.v[0] |
612 | mov ecx,[eax+offs_vert_color+4] |
623 | mov ecx,[eax+offs_vert_color+4] |
613 | mov [ebx+offs_vert_color+4],ecx ;q.color.v[1]=p0.color.v[1] |
624 | mov [ebx+offs_vert_color+4],ecx ;q.color.v[1]=p0.color.v[1] |
Line 646... | Line 657... | ||
646 | stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8] |
657 | stdcall RGBFtoRGBI, dword[ebx+offs_vert_color],dword[ebx+offs_vert_color+4],dword[ebx+offs_vert_color+8] |
647 | @@: |
658 | @@: |
648 | ret |
659 | ret |
649 | endp |
660 | endp |
Line 650... | Line 661... | ||
650 | 661 | ||
651 | align 4 |
662 | align 16 |
652 | proc gl_draw_triangle, context:dword, p0:dword, p1:dword, p2:dword |
663 | proc gl_draw_triangle, context:dword, p0:dword, p1:dword, p2:dword |
653 | locals |
664 | locals |
654 | cc rd 3 |
665 | cc rd 3 |
655 | front dd ? |
666 | front dd ? |
Line 714... | Line 725... | ||
714 | jne @f |
725 | jne @f |
715 | cmp dword[front],0 |
726 | cmp dword[front],0 |
716 | je .end_f |
727 | je .end_f |
717 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
728 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
718 | jmp .end_f |
729 | jmp .end_f |
- | 730 | align 4 |
|
719 | @@: |
731 | @@: |
720 | cmp dword[edi+offs_cont_current_cull_face],GL_FRONT |
732 | cmp dword[edi+offs_cont_current_cull_face],GL_FRONT |
721 | jne .end_f |
733 | jne .end_f |
722 | cmp dword[front],0 |
734 | cmp dword[front],0 |
723 | jne .end_f |
735 | jne .end_f |
724 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
736 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
725 | jmp .end_f |
737 | jmp .end_f |
- | 738 | align 4 |
|
726 | .els_1: |
739 | .els_1: |
727 | ; no culling |
740 | ; no culling |
728 | cmp dword[front],0 |
741 | cmp dword[front],0 |
729 | je @f |
742 | je @f |
730 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
743 | stdcall dword[edi+offs_cont_draw_triangle_front], edi,ebx,ecx,edx |
731 | jmp .end_f |
744 | jmp .end_f |
- | 745 | align 4 |
|
732 | @@: |
746 | @@: |
733 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
747 | stdcall dword[edi+offs_cont_draw_triangle_back], edi,ebx,ecx,edx |
734 | jmp .end_f |
748 | jmp .end_f |
- | 749 | align 4 |
|
735 | .els_0: |
750 | .els_0: |
736 | ;eax = cc[2] |
751 | ;eax = cc[2] |
737 | and eax,[cc] |
752 | and eax,[cc] |
738 | and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2] |
753 | and eax,[cc+4] ;eax = c_and = cc[0] & cc[1] & cc[2] |
739 | or eax,eax ;if (c_and==0) |
754 | or eax,eax ;if (c_and==0) |
Line 742... | Line 757... | ||
742 | .end_f: |
757 | .end_f: |
743 | popad |
758 | popad |
744 | ret |
759 | ret |
745 | endp |
760 | endp |
Line 746... | Line 761... | ||
746 | 761 | ||
747 | align 4 |
762 | align 16 |
748 | proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword |
763 | proc gl_draw_triangle_clip, context:dword, p0:dword, p1:dword, p2:dword, clip_bit:dword |
749 | locals |
764 | locals |
750 | co dd ? |
765 | co dd ? |
751 | cc rd 3 |
766 | cc rd 3 |
Line 772... | Line 787... | ||
772 | 787 | ||
773 | or edi,edi ;if (co == 0) |
788 | or edi,edi ;if (co == 0) |
774 | jnz .els_0 |
789 | jnz .els_0 |
775 | stdcall gl_draw_triangle, [context],ebx,ecx,edx |
790 | stdcall gl_draw_triangle, [context],ebx,ecx,edx |
- | 791 | jmp .end_f |
|
776 | jmp .end_f |
792 | align 4 |
777 | .els_0: |
793 | .els_0: |
778 | ;eax = cc[2] |
794 | ;eax = cc[2] |
779 | and eax,[cc] |
795 | and eax,[cc] |
Line 794... | Line 810... | ||
794 | and eax,[co] |
810 | and eax,[co] |
795 | or eax,eax |
811 | or eax,eax |
796 | jnz .cycle_0_end |
812 | jnz .cycle_0_end |
797 | inc dword[clip_bit] |
813 | inc dword[clip_bit] |
798 | jmp .cycle_0 |
814 | jmp .cycle_0 |
- | 815 | align 4 |
|
799 | .cycle_0_end: |
816 | .cycle_0_end: |
Line 800... | Line 817... | ||
800 | 817 | ||
801 | ; this test can be true only in case of rounding errors |
818 | ; this test can be true only in case of rounding errors |
802 | cmp dword[clip_bit],6 |
819 | cmp dword[clip_bit],6 |
Line 835... | Line 852... | ||
835 | ;q[0]=p0 q[1]=p1 q[2]=p2 |
852 | ;q[0]=p0 q[1]=p1 q[2]=p2 |
836 | mov [q],ebx |
853 | mov [q],ebx |
837 | mov [q+4],ecx |
854 | mov [q+4],ecx |
838 | mov [q+8],edx |
855 | mov [q+8],edx |
839 | jmp .els_2_end |
856 | jmp .els_2_end |
- | 857 | align 4 |
|
840 | .els_2: |
858 | .els_2: |
841 | mov eax,[cc+4] |
859 | mov eax,[cc+4] |
842 | and eax,[clip_mask] |
860 | and eax,[clip_mask] |
843 | or eax,eax ;else if (cc[1] & clip_mask) |
861 | or eax,eax ;else if (cc[1] & clip_mask) |
844 | jz .els_3 |
862 | jz .els_3 |
845 | ;q[0]=p1 q[1]=p2 q[2]=p0 |
863 | ;q[0]=p1 q[1]=p2 q[2]=p0 |
846 | mov [q],ecx |
864 | mov [q],ecx |
847 | mov [q+4],edx |
865 | mov [q+4],edx |
848 | mov [q+8],ebx |
866 | mov [q+8],ebx |
849 | jmp .els_2_end |
867 | jmp .els_2_end |
- | 868 | align 4 |
|
850 | .els_3: |
869 | .els_3: |
851 | ;q[0]=p2 q[1]=p0 q[2]=p1 |
870 | ;q[0]=p2 q[1]=p0 q[2]=p1 |
852 | mov [q],edx |
871 | mov [q],edx |
853 | mov [q+4],ebx |
872 | mov [q+4],ebx |
854 | mov [q+8],ecx |
873 | mov [q+8],ecx |
Line 906... | Line 925... | ||
906 | push edx |
925 | push edx |
907 | push edi |
926 | push edi |
908 | add edi,sizeof.GLVertex ;edi = &tmp2 |
927 | add edi,sizeof.GLVertex ;edi = &tmp2 |
909 | stdcall gl_draw_triangle_clip,[context],edi ;gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1) |
928 | stdcall gl_draw_triangle_clip,[context],edi ;gl_draw_triangle_clip(c,&tmp2,&tmp1,q[2],clip_bit+1) |
910 | jmp .end_f |
929 | jmp .end_f |
- | 930 | align 4 |
|
911 | .els_1: |
931 | .els_1: |
912 | ; two points outside |
932 | ; two points outside |
913 | mov eax,[cc] |
933 | mov eax,[cc] |
914 | and eax,[clip_mask] |
934 | and eax,[clip_mask] |
915 | cmp eax,0 ;if (cc[0] & clip_mask)==0 |
935 | cmp eax,0 ;if (cc[0] & clip_mask)==0 |
Line 917... | Line 937... | ||
917 | ;q[0]=p0 q[1]=p1 q[2]=p2 |
937 | ;q[0]=p0 q[1]=p1 q[2]=p2 |
918 | mov [q],ebx |
938 | mov [q],ebx |
919 | mov [q+4],ecx |
939 | mov [q+4],ecx |
920 | mov [q+8],edx |
940 | mov [q+8],edx |
921 | jmp .els_4_end |
941 | jmp .els_4_end |
- | 942 | align 4 |
|
922 | .els_4: |
943 | .els_4: |
923 | mov eax,[cc+4] |
944 | mov eax,[cc+4] |
924 | and eax,[clip_mask] |
945 | and eax,[clip_mask] |
925 | cmp eax,0 ;else if (cc[1] & clip_mask)==0 |
946 | cmp eax,0 ;else if (cc[1] & clip_mask)==0 |
926 | jne .els_5 |
947 | jne .els_5 |
927 | ;q[0]=p1 q[1]=p2 q[2]=p0 |
948 | ;q[0]=p1 q[1]=p2 q[2]=p0 |
928 | mov [q],ecx |
949 | mov [q],ecx |
929 | mov [q+4],edx |
950 | mov [q+4],edx |
930 | mov [q+8],ebx |
951 | mov [q+8],ebx |
931 | jmp .els_4_end |
952 | jmp .els_4_end |
- | 953 | align 4 |
|
932 | .els_5: |
954 | .els_5: |
933 | ;q[0]=p2 q[1]=p0 q[2]=p1 |
955 | ;q[0]=p2 q[1]=p0 q[2]=p1 |
934 | mov [q],edx |
956 | mov [q],edx |
935 | mov [q+4],ebx |
957 | mov [q+4],ebx |
936 | mov [q+8],ecx |
958 | mov [q+8],ecx |
Line 975... | Line 997... | ||
975 | .end_f: |
997 | .end_f: |
976 | popad |
998 | popad |
977 | ret |
999 | ret |
978 | endp |
1000 | endp |
Line 979... | Line 1001... | ||
979 | 1001 | ||
980 | align 4 |
1002 | align 16 |
981 | proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword |
1003 | proc gl_draw_triangle_select uses eax, context:dword, p0:dword,p1:dword,p2:dword |
982 | mov eax,[p2] |
1004 | mov eax,[p2] |
983 | push dword[eax+offs_vert_zp+offs_Z] |
1005 | push dword[eax+offs_vert_zp+offs_Z] |
984 | mov eax,[p1] |
1006 | mov eax,[p1] |
Line 993... | Line 1015... | ||
993 | count_triangles dd ? |
1015 | count_triangles dd ? |
994 | count_triangles_textured dd ? |
1016 | count_triangles_textured dd ? |
995 | count_pixels dd ? |
1017 | count_pixels dd ? |
996 | end if |
1018 | end if |
Line 997... | Line 1019... | ||
997 | 1019 | ||
998 | align 4 |
1020 | align 16 |
999 | proc gl_draw_triangle_fill, context:dword, p0:dword,p1:dword,p2:dword |
1021 | proc gl_draw_triangle_fill, context:dword, p0:dword,p1:dword,p2:dword |
1000 | pushad |
1022 | pushad |
1001 | if PROFILE eq 1 |
1023 | if PROFILE eq 1 |
1002 | ; int norm; |
1024 | ; int norm; |
Line 1028... | Line 1050... | ||
1028 | mov eax,[eax] ;переход по указателю |
1050 | mov eax,[eax] ;переход по указателю |
1029 | ;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax] |
1051 | ;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax] |
1030 | stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax] |
1052 | stdcall ZB_setTexture, dword[edx+offs_cont_zb],dword[eax] |
1031 | mov eax,[p0] |
1053 | mov eax,[p0] |
1032 | add eax,offs_vert_zp |
1054 | add eax,offs_vert_zp |
- | 1055 | push ecx |
|
- | 1056 | push ebx |
|
- | 1057 | push eax |
|
- | 1058 | push dword[edx+offs_cont_zb] |
|
- | 1059 | cmp dword[edx+offs_cont_matrix_model_projection_no_w_transform],0 |
|
- | 1060 | je @f |
|
1033 | stdcall ZB_fillTriangleMappingPerspective, dword[edx+offs_cont_zb],eax,ebx,ecx |
1061 | call ZB_fillTriangleMappingPerspective |
- | 1062 | jmp .end_f |
|
- | 1063 | align 4 |
|
- | 1064 | @@: |
|
- | 1065 | call ZB_fillTriangleMapping |
|
1034 | jmp .end_f |
1066 | jmp .end_f |
- | 1067 | align 4 |
|
1035 | .els_i: |
1068 | .els_i: |
1036 | mov eax,[p0] |
1069 | mov eax,[p0] |
1037 | add eax,offs_vert_zp |
1070 | add eax,offs_vert_zp |
1038 | cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
1071 | cmp dword[edx+offs_cont_current_shade_model],GL_SMOOTH |
1039 | jne .els |
1072 | jne .els |
1040 | ;else if (context.current_shade_model == GL_SMOOTH) |
1073 | ;else if (context.current_shade_model == GL_SMOOTH) |
1041 | stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx |
1074 | stdcall ZB_fillTriangleSmooth, dword[edx+offs_cont_zb],eax,ebx,ecx |
1042 | jmp .end_f |
1075 | jmp .end_f |
- | 1076 | align 4 |
|
1043 | .els: |
1077 | .els: |
1044 | stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx |
1078 | stdcall ZB_fillTriangleFlat, dword[edx+offs_cont_zb],eax,ebx,ecx |
1045 | .end_f: |
1079 | .end_f: |
1046 | popad |
1080 | popad |
1047 | ret |
1081 | ret |
1048 | endp |
1082 | endp |
Line 1049... | Line 1083... | ||
1049 | 1083 | ||
Line 1050... | Line 1084... | ||
1050 | ; Render a clipped triangle in line mode |
1084 | ; Render a clipped triangle in line mode |
1051 | 1085 | ||
1052 | align 4 |
1086 | align 16 |
1053 | proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dword,p2:dword |
1087 | proc gl_draw_triangle_line uses eax ebx ecx edx, context:dword, p0:dword,p1:dword,p2:dword |
1054 | mov edx,[context] |
1088 | mov edx,[context] |
1055 | cmp dword[edx+offs_cont_depth_test],0 |
1089 | cmp dword[edx+offs_cont_depth_test],0 |
1056 | je .els |
1090 | je .els |
- | 1091 | lea ecx,[ZB_line_z] |
|
1057 | lea ecx,[ZB_line_z] |
1092 | jmp @f |
1058 | jmp @f |
1093 | align 4 |
1059 | .els: |
1094 | .els: |
Line 1060... | Line 1095... | ||
1060 | lea ecx,[ZB_line] |
1095 | lea ecx,[ZB_line] |
Line 1093... | Line 1128... | ||
1093 | 1128 | ||
1094 | ret |
1129 | ret |
Line 1095... | Line 1130... | ||
1095 | endp |
1130 | endp |
1096 | 1131 | ||
1097 | ; Render a clipped triangle in point mode |
1132 | ; Render a clipped triangle in point mode |
1098 | align 4 |
1133 | align 16 |
1099 | proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p2:dword |
1134 | proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p2:dword |
1100 | mov edx,[context] |
1135 | mov edx,[context] |
1101 | mov eax,[p0] |
1136 | mov eax,[p0] |