Rev 5418 | Rev 6523 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5418 | Rev 6145 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | if DEBUG |
1 | if DEBUG |
2 | f_vt db ' gl_vertex_transform',0 |
2 | f_vt db ' gl_vertex_transform',0 |
3 | end if |
3 | end if |
Line 4... | Line 4... | ||
4 | 4 | ||
5 | align 4 |
5 | align 16 |
6 | proc glopNormal uses ecx esi edi, context:dword, p:dword |
6 | proc glopNormal uses ecx esi edi, context:dword, p:dword |
7 | mov esi,[p] |
7 | mov esi,[p] |
8 | add esi,4 |
8 | add esi,4 |
9 | mov edi,[context] |
9 | mov edi,[context] |
Line 12... | Line 12... | ||
12 | rep movsd |
12 | rep movsd |
13 | mov dword[edi],0.0 ;context.current_normal.W = 0.0 |
13 | mov dword[edi],0.0 ;context.current_normal.W = 0.0 |
14 | ret |
14 | ret |
15 | endp |
15 | endp |
Line 16... | Line 16... | ||
16 | 16 | ||
17 | align 4 |
17 | align 16 |
18 | proc glopTexCoord uses ecx esi edi, context:dword, p:dword |
18 | proc glopTexCoord uses ecx esi edi, context:dword, p:dword |
19 | mov esi,[p] |
19 | mov esi,[p] |
20 | add esi,4 |
20 | add esi,4 |
21 | mov edi,[context] |
21 | mov edi,[context] |
22 | add edi,offs_cont_current_tex_coord |
22 | add edi,offs_cont_current_tex_coord |
23 | mov ecx,4 |
23 | mov ecx,4 |
24 | rep movsd |
24 | rep movsd |
25 | ret |
25 | ret |
Line 26... | Line 26... | ||
26 | endp |
26 | endp |
27 | 27 | ||
28 | align 4 |
28 | align 16 |
29 | proc glopEdgeFlag uses eax ebx, context:dword, p:dword |
29 | proc glopEdgeFlag uses eax ebx, context:dword, p:dword |
30 | mov eax,[context] |
30 | mov eax,[context] |
31 | mov ebx,[p] |
31 | mov ebx,[p] |
32 | mov ebx,[ebx+4] ;ebx = p[1] |
32 | mov ebx,[ebx+4] ;ebx = p[1] |
33 | mov dword[eax+offs_cont_current_edge_flag],ebx |
33 | mov dword[eax+offs_cont_current_edge_flag],ebx |
Line 34... | Line 34... | ||
34 | ret |
34 | ret |
35 | endp |
35 | endp |
36 | 36 | ||
37 | align 4 |
37 | align 16 |
38 | proc glopColor uses eax ecx esi edi, context:dword, p:dword |
38 | proc glopColor uses eax ecx esi edi, context:dword, p:dword |
39 | locals |
39 | locals |
Line 67... | Line 67... | ||
67 | stdcall glopMaterial, eax,edi |
67 | stdcall glopMaterial, eax,edi |
68 | @@: |
68 | @@: |
69 | ret |
69 | ret |
70 | endp |
70 | endp |
Line 71... | Line 71... | ||
71 | 71 | ||
72 | align 4 |
72 | align 16 |
73 | proc gl_eval_viewport uses eax, context:dword |
73 | proc gl_eval_viewport uses eax, context:dword |
74 | locals |
74 | locals |
75 | zsize dd ? ;float |
75 | zsize dd ? ;float |
76 | endl |
76 | endl |
Line 113... | Line 113... | ||
113 | fstp dword[eax+offs_vpor_trans+offs_Z] |
113 | fstp dword[eax+offs_vpor_trans+offs_Z] |
114 | ret |
114 | ret |
115 | endp |
115 | endp |
Line 116... | Line 116... | ||
116 | 116 | ||
117 | 117 | ||
118 | align 4 |
118 | align 16 |
119 | proc glopBegin uses eax ebx ecx edx, context:dword, p:dword |
119 | proc glopBegin uses eax ebx ecx edx, context:dword, p:dword |
120 | locals |
120 | locals |
121 | tmp M4 |
121 | tmp M4 |
Line 132... | Line 132... | ||
132 | 132 | ||
133 | bt dword[edx+offs_cont_matrix_model_projection_updated],0 |
133 | bt dword[edx+offs_cont_matrix_model_projection_updated],0 |
Line 134... | Line 134... | ||
134 | jnc .end_mmpu |
134 | jnc .end_mmpu |
- | 135 | ||
- | 136 | cmp dword[edx+offs_cont_lighting_enabled],0 ;if(context.lighting_enabled) |
|
- | 137 | jne .if_0 |
|
135 | 138 | cmp dword[eax+offs_cont_texture_2d_enabled],0 |
|
- | 139 | jne .if_0 |
|
- | 140 | jmp @f |
|
136 | cmp dword[edx+offs_cont_lighting_enabled],0 ;if(context.lighting_enabled) |
141 | align 4 |
137 | je @f |
142 | .if_0: |
138 | if DEBUG ;context.matrix_stack_ptr[0] |
143 | if DEBUG ;context.matrix_stack_ptr[0] |
139 | stdcall gl_print_matrix,dword[edx+offs_cont_matrix_stack_ptr],4 |
144 | stdcall gl_print_matrix,dword[edx+offs_cont_matrix_stack_ptr],4 |
140 | end if |
145 | end if |
Line 153... | Line 158... | ||
153 | if DEBUG ;context.matrix_model_view_inv |
158 | if DEBUG ;context.matrix_model_view_inv |
154 | stdcall dbg_print,txt_sp,txt_nl |
159 | stdcall dbg_print,txt_sp,txt_nl |
155 | stdcall gl_print_matrix,ebx,4 |
160 | stdcall gl_print_matrix,ebx,4 |
156 | end if |
161 | end if |
157 | jmp .end_if_0 |
162 | jmp .end_if_0 |
- | 163 | align 4 |
|
158 | @@: |
164 | @@: |
159 | mov ecx,edx |
165 | mov ecx,edx |
160 | add ecx,offs_cont_matrix_model_projection |
166 | add ecx,offs_cont_matrix_model_projection |
161 | ; precompute projection matrix |
167 | ; precompute projection matrix |
162 | stdcall gl_M4_Mul, ecx,dword[edx+offs_cont_matrix_stack_ptr+4],dword[edx+offs_cont_matrix_stack_ptr] |
168 | stdcall gl_M4_Mul, ecx,dword[edx+offs_cont_matrix_stack_ptr+4],dword[edx+offs_cont_matrix_stack_ptr] |
Line 205... | Line 211... | ||
205 | cmp dword[edx+offs_cont_render_mode],GL_SELECT |
211 | cmp dword[edx+offs_cont_render_mode],GL_SELECT |
206 | jne @f |
212 | jne @f |
207 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_select |
213 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_select |
208 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_select |
214 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_select |
209 | jmp .end_if_2 |
215 | jmp .end_if_2 |
- | 216 | align 4 |
|
210 | @@: |
217 | @@: |
Line 211... | Line 218... | ||
211 | 218 | ||
212 | cmp dword[edx+offs_cont_polygon_mode_front],GL_POINT |
219 | cmp dword[edx+offs_cont_polygon_mode_front],GL_POINT |
213 | jne @f |
220 | jne @f |
214 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_point |
221 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_point |
- | 222 | jmp .end_if_1 |
|
215 | jmp .end_if_1 |
223 | align 4 |
216 | @@: |
224 | @@: |
217 | cmp dword[edx+offs_cont_polygon_mode_front],GL_LINE |
225 | cmp dword[edx+offs_cont_polygon_mode_front],GL_LINE |
218 | jne @f |
226 | jne @f |
219 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_line |
227 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_line |
- | 228 | jmp .end_if_1 |
|
220 | jmp .end_if_1 |
229 | align 4 |
221 | @@: ;default: |
230 | @@: ;default: |
222 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_fill |
231 | mov dword[edx+offs_cont_draw_triangle_front],gl_draw_triangle_fill |
Line 223... | Line 232... | ||
223 | .end_if_1: |
232 | .end_if_1: |
224 | 233 | ||
225 | cmp dword[edx+offs_cont_polygon_mode_back],GL_POINT |
234 | cmp dword[edx+offs_cont_polygon_mode_back],GL_POINT |
226 | jne @f |
235 | jne @f |
- | 236 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_point |
|
227 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_point |
237 | jmp .end_if_2 |
228 | jmp .end_if_2 |
238 | align 4 |
229 | @@: |
239 | @@: |
230 | cmp dword[edx+offs_cont_polygon_mode_back],GL_LINE |
240 | cmp dword[edx+offs_cont_polygon_mode_back],GL_LINE |
231 | jne @f |
241 | jne @f |
- | 242 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_line |
|
232 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_line |
243 | jmp .end_if_2 |
233 | jmp .end_if_2 |
244 | align 4 |
234 | @@: ;default: |
245 | @@: ;default: |
235 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_fill |
246 | mov dword[edx+offs_cont_draw_triangle_back],gl_draw_triangle_fill |
236 | .end_if_2: |
247 | .end_if_2: |
Line 237... | Line 248... | ||
237 | ret |
248 | ret |
238 | endp |
249 | endp |
239 | 250 | ||
240 | ; coords, tranformation , clip code and projection |
251 | ; coords, tranformation , clip code and projection |
241 | ; TODO : handle all cases |
252 | ; TODO : handle all cases |
242 | align 4 |
253 | align 16 |
243 | proc gl_vertex_transform, context:dword, v:dword |
254 | proc gl_vertex_transform, context:dword, v:dword |
244 | pushad |
255 | pushad |
- | 256 | mov eax,[context] |
|
- | 257 | mov edx,[v] |
|
- | 258 | cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled) |
|
245 | mov eax,[context] |
259 | jne @f |
- | 260 | cmp dword[eax+offs_cont_texture_2d_enabled],0 |
|
- | 261 | jne @f |
|
246 | mov edx,[v] |
262 | jmp .els_0 |
247 | cmp dword[eax+offs_cont_lighting_enabled],0 ;if (context.lighting_enabled) |
263 | align 4 |
248 | je .els_0 |
264 | @@: |
249 | ; eye coordinates needed for lighting |
265 | ; eye coordinates needed for lighting |
250 | mov ebx,dword[eax+offs_cont_matrix_stack_ptr] |
266 | mov ebx,dword[eax+offs_cont_matrix_stack_ptr] |
Line 354... | Line 370... | ||
354 | 370 | ||
355 | cmp dword[eax+offs_cont_normalize_enabled],0 |
371 | cmp dword[eax+offs_cont_normalize_enabled],0 |
356 | je .end_els |
372 | je .end_els |
357 | stdcall gl_V3_Norm,edx |
373 | stdcall gl_V3_Norm,edx |
- | 374 | jmp .end_els |
|
358 | jmp .end_els |
375 | align 4 |
359 | .els_0: |
376 | .els_0: |
360 | ; no eye coordinates needed, no normal |
377 | ; no eye coordinates needed, no normal |
361 | ; NOTE: W = 1 is assumed |
378 | ; NOTE: W = 1 is assumed |
362 | mov ebx,eax |
379 | mov ebx,eax |
Line 407... | Line 424... | ||
407 | je .els_1 |
424 | je .els_1 |
408 | ;if (context.matrix_model_projection_no_w_transform) |
425 | ;if (context.matrix_model_projection_no_w_transform) |
409 | mov ebx,dword[ebx+60] ;ebx = m[15] |
426 | mov ebx,dword[ebx+60] ;ebx = m[15] |
410 | mov dword[esi+12],ebx ;v.pc.W = m[15] |
427 | mov dword[esi+12],ebx ;v.pc.W = m[15] |
411 | jmp .end_els |
428 | jmp .end_els |
- | 429 | align 4 |
|
412 | .els_1: |
430 | .els_1: |
413 | fld dword[ebx+48] ;st0 = m[12] |
431 | fld dword[ebx+48] ;st0 = m[12] |
414 | fmul st0,st3 ;st0 *= v.coord.X |
432 | fmul st0,st3 ;st0 *= v.coord.X |
415 | fld dword[ebx+52] ;st0 = m[13] |
433 | fld dword[ebx+52] ;st0 = m[13] |
416 | fmul st0,st3 ;st0 *= v.coord.Y |
434 | fmul st0,st3 ;st0 *= v.coord.Y |
Line 440... | Line 458... | ||
440 | mov dword[edx+offs_vert_clip_code],eax |
458 | mov dword[edx+offs_vert_clip_code],eax |
441 | popad |
459 | popad |
442 | ret |
460 | ret |
443 | endp |
461 | endp |
Line 444... | Line 462... | ||
444 | 462 | ||
445 | align 4 |
463 | align 16 |
446 | proc glopVertex, context:dword, p:dword |
464 | proc glopVertex, context:dword, p:dword |
447 | locals |
465 | locals |
448 | ;ebx = GLVertex * v |
466 | ;ebx = GLVertex * v |
449 | n dd ? ;ebp-4 |
467 | n dd ? ;ebp-4 |
Line 495... | Line 513... | ||
495 | ; color |
513 | ; color |
496 | cmp dword[edx+offs_cont_lighting_enabled],0 |
514 | cmp dword[edx+offs_cont_lighting_enabled],0 |
497 | je .els_0 |
515 | je .els_0 |
498 | stdcall gl_shade_vertex, edx,ebx |
516 | stdcall gl_shade_vertex, edx,ebx |
499 | jmp @f |
517 | jmp @f |
- | 518 | align 4 |
|
500 | .els_0: |
519 | .els_0: |
501 | mov esi,edx |
520 | mov esi,edx |
502 | add esi,offs_cont_current_color |
521 | add esi,offs_cont_current_color |
503 | mov edi,ebx |
522 | mov edi,ebx |
504 | add edi,offs_vert_color ;edi = &v.color |
523 | add edi,offs_vert_color ;edi = &v.color |
Line 516... | Line 535... | ||
516 | push eax ;&context.current_tex_coord |
535 | push eax ;&context.current_tex_coord |
517 | mov eax,ebx |
536 | mov eax,ebx |
518 | add eax,offs_vert_tex_coord |
537 | add eax,offs_vert_tex_coord |
519 | stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8] |
538 | stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8] |
520 | jmp @f |
539 | jmp @f |
- | 540 | align 4 |
|
521 | .els_1: |
541 | .els_1: |
522 | mov esi,edx |
542 | mov esi,edx |
523 | add esi,offs_cont_current_tex_coord |
543 | add esi,offs_cont_current_tex_coord |
524 | mov edi,ebx |
544 | mov edi,ebx |
525 | add edi,offs_vert_tex_coord |
545 | add edi,offs_vert_tex_coord |
Line 540... | Line 560... | ||
540 | cmp dword[edx+offs_cont_begin_type],GL_POINTS |
560 | cmp dword[edx+offs_cont_begin_type],GL_POINTS |
541 | jne @f |
561 | jne @f |
542 | stdcall gl_draw_point, edx, dword[edx+offs_cont_vertex] ;dword[edx+...] = &context.vertex[0] |
562 | stdcall gl_draw_point, edx, dword[edx+offs_cont_vertex] ;dword[edx+...] = &context.vertex[0] |
543 | mov dword[n],0 |
563 | mov dword[n],0 |
544 | jmp .end_f |
564 | jmp .end_f |
- | 565 | align 4 |
|
545 | @@: |
566 | @@: |
546 | cmp dword[edx+offs_cont_begin_type],GL_LINES |
567 | cmp dword[edx+offs_cont_begin_type],GL_LINES |
547 | jne @f |
568 | jne @f |
548 | cmp dword[n],2 |
569 | cmp dword[n],2 |
549 | jne .end_f |
570 | jne .end_f |
Line 552... | Line 573... | ||
552 | add eax,sizeof.GLVertex |
573 | add eax,sizeof.GLVertex |
553 | stdcall gl_draw_line, edx, eax |
574 | stdcall gl_draw_line, edx, eax |
554 | xor eax,eax |
575 | xor eax,eax |
555 | mov dword[n],eax |
576 | mov dword[n],eax |
556 | jmp .end_f |
577 | jmp .end_f |
- | 578 | align 4 |
|
557 | @@: |
579 | @@: |
558 | cmp dword[edx+offs_cont_begin_type],GL_LINE_STRIP |
580 | cmp dword[edx+offs_cont_begin_type],GL_LINE_STRIP |
559 | je .li_loop |
581 | je .li_loop |
560 | cmp dword[edx+offs_cont_begin_type],GL_LINE_LOOP |
582 | cmp dword[edx+offs_cont_begin_type],GL_LINE_LOOP |
561 | jne @f |
583 | jne @f |
Line 566... | Line 588... | ||
566 | mov edi,esi |
588 | mov edi,esi |
567 | add edi,2*sizeof.GLVertex |
589 | add edi,2*sizeof.GLVertex |
568 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
590 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
569 | rep movsd ;context.vertex[2] = context.vertex[0] |
591 | rep movsd ;context.vertex[2] = context.vertex[0] |
570 | jmp .end_f |
592 | jmp .end_f |
- | 593 | align 4 |
|
571 | .els_2: |
594 | .els_2: |
572 | cmp dword[n],2 |
595 | cmp dword[n],2 |
573 | jne .end_f ;else if (n == 2) |
596 | jne .end_f ;else if (n == 2) |
574 | mov eax,[edx+offs_cont_vertex] |
597 | mov eax,[edx+offs_cont_vertex] |
575 | push eax |
598 | push eax |
Line 579... | Line 602... | ||
579 | stdcall gl_draw_line, edx, eax |
602 | stdcall gl_draw_line, edx, eax |
580 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
603 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
581 | rep movsd ;context.vertex[0] = context.vertex[1] |
604 | rep movsd ;context.vertex[0] = context.vertex[1] |
582 | mov dword[n],1 |
605 | mov dword[n],1 |
583 | jmp .end_f |
606 | jmp .end_f |
- | 607 | align 4 |
|
584 | @@: |
608 | @@: |
585 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLES |
609 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLES |
586 | jne @f |
610 | jne @f |
587 | cmp dword[n],3 |
611 | cmp dword[n],3 |
588 | jne .end_f |
612 | jne .end_f |
Line 595... | Line 619... | ||
595 | sub esp,12 |
619 | sub esp,12 |
596 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
620 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
597 | xor eax,eax |
621 | xor eax,eax |
598 | mov dword[n],eax |
622 | mov dword[n],eax |
599 | jmp .end_f |
623 | jmp .end_f |
- | 624 | align 4 |
|
600 | @@: |
625 | @@: |
601 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP |
626 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP |
602 | jne @f |
627 | jne @f |
603 | cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3) |
628 | cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3) |
604 | jl .end_f |
629 | jl .end_f |
Line 617... | Line 642... | ||
617 | add eax,sizeof.GLVertex |
642 | add eax,sizeof.GLVertex |
618 | mov [esp-12],eax |
643 | mov [esp-12],eax |
619 | sub esp,12 |
644 | sub esp,12 |
620 | stdcall gl_draw_triangle, edx ;v2,v1,v0 |
645 | stdcall gl_draw_triangle, edx ;v2,v1,v0 |
621 | jmp .end_f |
646 | jmp .end_f |
- | 647 | align 4 |
|
622 | .case_1: |
648 | .case_1: |
623 | mov [esp-12],eax |
649 | mov [esp-12],eax |
624 | add eax,sizeof.GLVertex |
650 | add eax,sizeof.GLVertex |
625 | mov [esp-8],eax |
651 | mov [esp-8],eax |
626 | add eax,sizeof.GLVertex |
652 | add eax,sizeof.GLVertex |
627 | mov [esp-4],eax |
653 | mov [esp-4],eax |
628 | sub esp,12 |
654 | sub esp,12 |
629 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
655 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
630 | jmp .end_f |
656 | jmp .end_f |
- | 657 | align 4 |
|
631 | @@: |
658 | @@: |
632 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN |
659 | cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN |
633 | jne @f |
660 | jne @f |
634 | cmp dword[n],3 |
661 | cmp dword[n],3 |
635 | jne .end_f |
662 | jne .end_f |
Line 645... | Line 672... | ||
645 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
672 | stdcall gl_draw_triangle, edx ;v0,v1,v2 |
646 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
673 | mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
647 | rep movsd ;context.vertex[1] = context.vertex[2] |
674 | rep movsd ;context.vertex[1] = context.vertex[2] |
648 | mov dword[n],2 |
675 | mov dword[n],2 |
649 | jmp .end_f |
676 | jmp .end_f |
- | 677 | align 4 |
|
650 | @@: |
678 | @@: |
651 | cmp dword[edx+offs_cont_begin_type],GL_QUADS |
679 | cmp dword[edx+offs_cont_begin_type],GL_QUADS |
652 | jne @f |
680 | jne @f |
653 | cmp dword[n],4 |
681 | cmp dword[n],4 |
654 | jne .end_f |
682 | jne .end_f |
Line 670... | Line 698... | ||
670 | sub eax,2*sizeof.GLVertex |
698 | sub eax,2*sizeof.GLVertex |
671 | stdcall gl_draw_triangle, edx,eax ;v0,v2,v3 |
699 | stdcall gl_draw_triangle, edx,eax ;v0,v2,v3 |
672 | xor eax,eax |
700 | xor eax,eax |
673 | mov dword[n],eax |
701 | mov dword[n],eax |
674 | jmp .end_f |
702 | jmp .end_f |
- | 703 | align 4 |
|
675 | @@: |
704 | @@: |
676 | cmp dword[edx+offs_cont_begin_type],GL_QUAD_STRIP |
705 | cmp dword[edx+offs_cont_begin_type],GL_QUAD_STRIP |
677 | jne @f |
706 | jne @f |
678 | cmp dword[n],4 |
707 | cmp dword[n],4 |
679 | jne .end_f |
708 | jne .end_f |
Line 696... | Line 725... | ||
696 | stdcall gl_draw_triangle, edx ;v1,v3,v2 |
725 | stdcall gl_draw_triangle, edx ;v1,v3,v2 |
697 | mov ecx,(sizeof.GLVertex)/2 ;((...)/2) копируем 2 вершины |
726 | mov ecx,(sizeof.GLVertex)/2 ;((...)/2) копируем 2 вершины |
698 | rep movsd ;context.vertex[0] = context.vertex[2], context.vertex[1] = context.vertex[3] |
727 | rep movsd ;context.vertex[0] = context.vertex[2], context.vertex[1] = context.vertex[3] |
699 | mov dword[n],2 |
728 | mov dword[n],2 |
700 | jmp .end_f |
729 | jmp .end_f |
- | 730 | align 4 |
|
701 | @@: |
731 | @@: |
702 | cmp dword[edx+offs_cont_begin_type],GL_POLYGON |
732 | cmp dword[edx+offs_cont_begin_type],GL_POLYGON |
703 | je .end_f |
733 | je .end_f |
704 | ; default: |
734 | ; default: |
705 | ; gl_fatal_error("glBegin: type %x not handled\n", c->begin_type); |
735 | ; gl_fatal_error("glBegin: type %x not handled\n", c->begin_type); |
Line 710... | Line 740... | ||
710 | mov [edx+offs_cont_vertex_n],ecx |
740 | mov [edx+offs_cont_vertex_n],ecx |
711 | popad |
741 | popad |
712 | ret |
742 | ret |
713 | endp |
743 | endp |
Line 714... | Line 744... | ||
714 | 744 | ||
715 | align 4 |
745 | align 16 |
716 | proc glopEnd uses eax ebx ecx, context:dword, p:dword |
746 | proc glopEnd uses eax ebx ecx, context:dword, p:dword |
717 | mov eax,[context] |
747 | mov eax,[context] |
Line 718... | Line 748... | ||
718 | ; assert(c->in_begin == 1); |
748 | ; assert(c->in_begin == 1); |
Line 725... | Line 755... | ||
725 | push ebx |
755 | push ebx |
726 | add ebx,2*sizeof.GLVertex |
756 | add ebx,2*sizeof.GLVertex |
727 | push ebx |
757 | push ebx |
728 | stdcall gl_draw_line, eax |
758 | stdcall gl_draw_line, eax |
729 | jmp .end_i |
759 | jmp .end_i |
- | 760 | align 4 |
|
730 | .else_i: |
761 | .else_i: |
731 | cmp dword[eax+offs_cont_begin_type],GL_POLYGON |
762 | cmp dword[eax+offs_cont_begin_type],GL_POLYGON |
732 | jne .end_i |
763 | jne .end_i |
733 | mov ebx,dword[eax+offs_cont_vertex_cnt] |
764 | mov ebx,dword[eax+offs_cont_vertex_cnt] |
734 | @@: ;while (ebx >= 3) |
765 | @@: ;while (ebx >= 3) |
Line 741... | Line 772... | ||
741 | push ecx ;ecx = &context.vertex[i] |
772 | push ecx ;ecx = &context.vertex[i] |
742 | sub ecx,sizeof.GLVertex |
773 | sub ecx,sizeof.GLVertex |
743 | push ecx ;ecx = &context.vertex[i-1] |
774 | push ecx ;ecx = &context.vertex[i-1] |
744 | stdcall gl_draw_triangle, eax,[eax+offs_cont_vertex] |
775 | stdcall gl_draw_triangle, eax,[eax+offs_cont_vertex] |
745 | jmp @b |
776 | jmp @b |
- | 777 | align 4 |
|
746 | .end_i: |
778 | .end_i: |
747 | mov dword[eax+offs_cont_in_begin],0 |
779 | mov dword[eax+offs_cont_in_begin],0 |
748 | ret |
780 | ret |
749 | endp |
781 | endp |