Rev 8048 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8048 | Rev 8232 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; application : View3ds ver. 0.070 - tiny .3ds and .asc files viewer |
1 | ; application : View3ds ver. 0.071 - tiny .3ds and .asc files viewer |
2 | ; with a few graphics effects demonstration. |
2 | ; with a few graphics effects demonstration. |
3 | ; compiler : FASM |
3 | ; compiler : FASM |
4 | ; system : KolibriOS |
4 | ; system : KolibriOS |
5 | ; author : Macgub aka Maciej Guba |
5 | ; author : Macgub aka Maciej Guba |
6 | ; email : macgub3@wp.pl |
6 | ; email : macgub3@wp.pl |
Line 14... | Line 14... | ||
14 | ; madis.kalme@mail.ee |
14 | ; madis.kalme@mail.ee |
15 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
15 | ; I tried optimizing it a bit, but don't know if it was successful. The objects |
16 | ; can be: |
16 | ; can be: |
17 | ; 1) Read from a file (*.3DS standard) |
17 | ; 1) Read from a file (*.3DS standard) |
18 | ; 2) Written in manually (at the end of the code) |
18 | ; 2) Written in manually (at the end of the code) ; now not exist |
19 | 19 | ||
Line 20... | Line 20... | ||
20 | 20 | ||
21 | SIZE_X equ 512 |
21 | SIZE_X equ 512 |
22 | SIZE_Y equ 512 ; ///// I want definitely |
22 | SIZE_Y equ 512 ; ///// I want definitely |
Line 35... | Line 35... | ||
35 | MMX = 1 |
35 | MMX = 1 |
36 | SSE = 2 |
36 | SSE = 2 |
37 | SSE2 = 3 |
37 | SSE2 = 3 |
38 | SSE3 = 4 |
38 | SSE3 = 4 |
39 | Ext = SSE2 ;Ext={ NON | MMX | SSE | SSE2 } |
39 | Ext = SSE3 ;Ext={ NON | MMX | SSE | SSE2 | SSE3 } |
40 | 40 | ||
Line 41... | Line 41... | ||
41 | ; 0 for short names (Menuet-compatible), 1 for long names (Kolibri features) |
41 | ; 0 for short names (Menuet-compatible), 1 for long names (Kolibri features) |
42 | USE_LFN = 1 |
42 | USE_LFN = 1 ; App is Kolibri only now. |
Line 43... | Line 43... | ||
43 | 43 | ||
44 | use32 |
44 | use32 |
45 | org 0x0 |
45 | org 0x0 |
46 | db 'MENUET01' ; 8 byte id |
46 | db 'MENUET01' ; 8 byte id |
Line 61... | Line 61... | ||
61 | 61 | ||
Line 62... | Line 62... | ||
62 | 62 | ||
63 | shr ax,2 |
63 | shr ax,2 |
- | 64 | movzx ebx,ax |
|
64 | movzx ebx,ax |
65 | movzx ebx,ax |
65 | lea ebx,[ebx*3] |
66 | lea ebx,[ebx*3] |
66 | push ebx |
67 | push ebx |
67 | fninit |
68 | fninit |
68 | fild dword[esp] |
69 | fild dword[esp] |
Line 73... | Line 74... | ||
73 | mov [size_x_var],ax |
74 | mov [size_x_var],ax |
74 | shr ax,1 |
75 | shr ax,1 |
75 | mov [vect_x],ax |
76 | mov [vect_x],ax |
76 | 77 | ||
Line 77... | Line 78... | ||
77 | mov eax, 20 shl 16 + 20 |
78 | ; mov eax, 20 shl 16 + 20 |
78 | mov [x_start],eax |
79 | mov [x_start],dword 20 shl 16 + 20 ;eax |
Line 79... | Line 80... | ||
79 | 80 | ||
80 | 81 | ||
81 | call alloc_buffer_mem |
82 | call alloc_buffer_mem |
Line 129... | Line 130... | ||
129 | ;mov [draw_win_at_first],0 |
130 | ;mov [draw_win_at_first],0 |
130 | ;mov eax,40 ; set events mask |
131 | ;mov eax,40 ; set events mask |
131 | ;mov ebx,1100000000000000000000000100111b |
132 | ;mov ebx,1100000000000000000000000100111b |
132 | ;int 0x40 |
133 | ;int 0x40 |
133 | still: |
134 | |
- | 135 | ||
- | 136 | still: |
|
134 | cmp [edit_flag],1 |
137 | cmp [edit_flag],1 |
135 | jne @f |
138 | jne @f |
136 | mov eax,40 ; set events mask |
139 | mov eax,40 ; set events mask |
137 | mov ebx,1100000000000000000000000100111b |
140 | mov ebx,1100000000000000000000000100111b |
138 | jmp .int |
141 | jmp .int |
Line 314... | Line 317... | ||
314 | @@: |
317 | @@: |
315 | cmp ah,15 |
318 | cmp ah,15 |
316 | jne @f |
319 | jne @f |
317 | cmp [emboss_flag],1 |
320 | cmp [emboss_flag],1 |
318 | call init_envmap2 |
321 | ; call init_envmap2 |
319 | @@: |
322 | call do_emboss |
- | 323 | @@: |
|
320 | ; cmp ah,17 |
324 | ; cmp ah,17 |
321 | ; jne .next_m |
325 | ; jne .next_m |
322 | ; cmp [move_flag],2 |
326 | ; cmp [move_flag],2 |
323 | ; jne @f |
327 | ; jne @f |
324 | ; call draw_window ; redraw other labels to navigation buttons |
328 | ; call draw_window ; redraw other labels to navigation buttons |
Line 330... | Line 334... | ||
330 | cmp ah,18 |
334 | cmp ah,18 |
331 | jne .next_m2 |
335 | jne .next_m2 |
332 | 336 | ||
Line 333... | Line 337... | ||
333 | mov [re_alloc_flag],1 ; reallocate memory |
337 | mov [re_alloc_flag],1 ; reallocate memory |
334 | mov [triangles_count_var],1000 |
338 | mov [triangles_count_var],20000 |
335 | mov [points_count_var],1000 |
339 | mov [points_count_var],20000 |
336 | call alloc_mem_for_tp |
340 | call alloc_mem_for_tp |
337 | mov [re_alloc_flag],0 |
341 | mov [re_alloc_flag],0 |
Line 338... | Line 342... | ||
338 | 342 | ||
339 | mov bl,[generator_flag] |
343 | mov bl,[generator_flag] |
Line 345... | Line 349... | ||
345 | jmp .calc_norm |
349 | jmp .calc_norm |
346 | @@: |
350 | @@: |
347 | cmp bl,4 |
351 | cmp bl,4 |
348 | jg @f |
352 | jg @f |
349 | movzx ax,bl ; ax < - object number |
353 | movzx eax,bl ; eax < - object number |
350 | call generate_object2 |
354 | call generate_object2 |
351 | jmp .calc_norm |
355 | jmp .calc_norm |
352 | @@: |
356 | @@: |
353 | call generate_object3 |
357 | call generate_object3 |
354 | .calc_norm: |
358 | .calc_norm: |
355 | call optimize_object1 |
359 | call optimize_object1 |
Line 608... | Line 612... | ||
608 | mov esi,[screen_ptr] |
612 | mov esi,[screen_ptr] |
609 | movzx ecx,word[size_y_var] |
613 | movzx ecx,word[size_y_var] |
610 | movzx eax,word[size_x_var] |
614 | movzx eax,word[size_x_var] |
611 | mul ecx |
615 | mul ecx |
612 | lea ecx,[eax*3] |
616 | lea ecx,[eax*4] |
613 | if (Ext = MMX)|(Ext = SSE) |
617 | |
- | 618 | if (Ext = MMX)|(Ext = SSE) |
|
614 | mov bh,bl |
619 | mov bh,bl |
615 | push bx |
620 | push bx |
616 | shl ebx,16 |
621 | shl ebx,16 |
617 | pop bx |
622 | pop bx |
618 | push ebx |
623 | push ebx |
Line 666... | Line 671... | ||
666 | mov esi,[screen_ptr] |
671 | mov esi,[screen_ptr] |
667 | movzx eax,word[size_x_var] |
672 | movzx eax,word[size_x_var] |
668 | movzx ecx,word[size_y_var] |
673 | movzx ecx,word[size_y_var] |
669 | mul ecx |
674 | mul ecx |
670 | lea ecx,[eax*3] |
675 | lea ecx,[eax*4] |
671 | if (Ext = MMX)|(Ext = SSE) |
676 | if (Ext = MMX)|(Ext = SSE) |
672 | mov bh,bl |
677 | mov bh,bl |
673 | push bx |
678 | push bx |
674 | shl ebx,16 |
679 | shl ebx,16 |
675 | pop bx |
680 | pop bx |
676 | push ebx |
681 | push ebx |
Line 734... | Line 739... | ||
734 | mov ecx,[size_y_var] |
739 | mov ecx,[size_y_var] |
735 | ; mov ecx,SIZE_X shl 16 + SIZE_Y |
740 | ; mov ecx,SIZE_X shl 16 + SIZE_Y |
736 | mov edx,[offset_y] ;5 shl 16 + 25 |
741 | mov edx,[offset_y] ;5 shl 16 + 25 |
737 | cmp [dr_flag],12 |
742 | cmp [dr_flag],12 |
738 | je .ff |
743 | jge .ff |
739 | int 0x40 |
744 | int 0x40 |
740 | jmp .f |
745 | jmp .f |
741 | .ff: |
746 | .ff: |
742 | mov eax,65 |
747 | mov eax,65 |
743 | mov esi,32 |
748 | mov esi,32 |
744 | xor ebp,ebp |
749 | xor ebp,ebp |
Line 773... | Line 778... | ||
773 | 778 | ||
Line 774... | Line 779... | ||
774 | ;-------------------------------------------------------------------------------- |
779 | ;-------------------------------------------------------------------------------- |
775 | ;-------------------------PROCEDURES--------------------------------------------- |
780 | ;-------------------------PROCEDURES--------------------------------------------- |
776 | ;-------------------------------------------------------------------------------- |
781 | ;-------------------------------------------------------------------------------- |
777 | ;include "TEX3.INC" |
- | |
778 | include "FLAT_CAT.INC" |
782 | include "FLAT_CAT.INC" |
779 | include "TEX_CAT.INC" |
783 | include "TEX_CAT.INC" |
780 | include "BUMP_CAT.INC" |
784 | include "BUMP_CAT.INC" |
781 | include "3DMATH.INC" |
785 | include "3DMATH.INC" |
782 | include "GRD_LINE.INC" |
786 | include "GRD_LINE.INC" |
783 | ;include "GRD3.INC" |
- | |
784 | ;include "FLAT3.INC" |
- | |
785 | ;include "BUMP3.INC" |
- | |
786 | include "B_PROCS.INC" |
787 | include "B_PROCS.INC" |
787 | include "A_PROCS.INC" |
788 | include "A_PROCS.INC" |
788 | include "GRD_CAT.INC" |
789 | include "GRD_CAT.INC" |
789 | include "BUMP_TEX.INC" |
790 | include "BUMP_TEX.INC" |
790 | include "GRD_TEX.INC" |
791 | include "GRD_TEX.INC" |
791 | include "TWO_TEX.INC" |
792 | include "TWO_TEX.INC" |
792 | include "ASC.INC" |
793 | include "ASC.INC" |
793 | if Ext >= SSE3 |
794 | if Ext >= SSE3 |
794 | include "3R_PHG.INC" |
795 | include "3R_PHG.INC" |
- | 796 | include '3STENCIL.INC' |
|
- | 797 | include '3GLASS.INC' |
|
795 | end if |
798 | end if |
796 | clear_vertices_index: |
799 | clear_vertices_index: |
797 | mov edi,[vertices_index_ptr] |
800 | mov edi,[vertices_index_ptr] |
798 | movzx eax,word[size_x_var] |
801 | movzx eax,word[size_x_var] |
799 | movzx ecx,word[size_y_var] |
802 | movzx ecx,word[size_y_var] |
Line 825... | Line 828... | ||
825 | lea ecx,[ebx*2] |
828 | lea ecx,[ebx*2] |
826 | lea ebx,[ebx*3] |
829 | lea ebx,[ebx*3] |
827 | 830 | ||
Line 828... | Line 831... | ||
828 | cmp [dr_flag],12 |
831 | cmp [dr_flag],12 |
829 | jne @f |
832 | jl @f |
830 | add ebx,[esp] |
833 | add ebx,[esp] |
831 | @@: |
834 | @@: |
832 | add esp,4 |
835 | add esp,4 |
833 | add ebx,[screen_ptr] |
836 | add ebx,[screen_ptr] |
834 | mov ebx,[ebx] |
837 | mov ebx,[ebx] |
Line 944... | Line 947... | ||
944 | lea edi,[edi*3] |
947 | lea edi,[edi*3] |
945 | shl edi,2 |
948 | shl edi,2 |
946 | add edi,[points_ptr] |
949 | add edi,[points_ptr] |
947 | lea esi,[.points_rotated] |
950 | lea esi,[.points_rotated] |
948 | mov ecx,3 |
951 | cld |
949 | cld |
- | |
950 | rep movsd |
952 | movsd |
- | 953 | movsd |
|
- | 954 | movsd |
|
- | 955 | ; mov ecx,3 |
|
- | 956 | ; cld |
|
- | 957 | ; rep movsd |
|
951 | 958 | ||
Line 952... | Line 959... | ||
952 | 959 | ||
953 | mov dword[edit_end_x],0 |
960 | mov dword[edit_end_x],0 |
Line 980... | Line 987... | ||
980 | mov eax,68 |
987 | mov eax,68 |
981 | mov ebx,20 |
988 | mov ebx,20 |
982 | mov edx,[screen_ptr] |
989 | mov edx,[screen_ptr] |
983 | int 0x40 |
990 | int 0x40 |
984 | ; and eax,0xfffffff0 |
991 | mov [screen_ptr],eax |
985 | mov [screen_ptr],eax |
- | |
986 | 992 | ||
Line 987... | Line 993... | ||
987 | mov ecx,[.temp] |
993 | mov ecx,[.temp] |
988 | shl ecx,2 |
994 | shl ecx,2 |
989 | add ecx,256 |
995 | add ecx,256 |
990 | mov eax,68 |
996 | mov eax,68 |
991 | mov ebx,20 |
997 | mov ebx,20 |
992 | mov edx,[Zbuffer_ptr] |
998 | mov edx,[Zbuffer_ptr] |
993 | int 0x40 |
999 | int 0x40 |
994 | ; and eax,0xfffffff0 |
- | |
995 | mov [Zbuffer_ptr],eax |
1000 | mov [Zbuffer_ptr],eax |
Line 996... | Line 1001... | ||
996 | 1001 | ||
997 | 1002 | ||
998 | mov ecx,[.temp] |
1003 | mov ecx,[.temp] |
999 | add ecx,ecx |
1004 | add ecx,ecx |
1000 | add ecx,256 |
1005 | add ecx,256 |
1001 | mov eax,68 |
1006 | mov eax,68 |
1002 | mov ebx,20 |
1007 | mov ebx,20 |
1003 | mov edx,[vertices_index_ptr] |
- | |
1004 | int 0x40 |
1008 | mov edx,[vertices_index_ptr] |
Line 1005... | Line 1009... | ||
1005 | ; and eax,0xfffffff0 |
1009 | int 0x40 |
1006 | mov [vertices_index_ptr],eax |
1010 | mov [vertices_index_ptr],eax |
Line 1415... | Line 1419... | ||
1415 | .env_done: |
1419 | .env_done: |
1416 | mov esp,ebp |
1420 | mov esp,ebp |
1417 | pop ebp |
1421 | pop ebp |
1418 | ret |
1422 | ret |
- | 1423 | if Ext >= SSE3 |
|
- | 1424 | init_point_normals: |
|
- | 1425 | .z equ dword [ebp-8] |
|
- | 1426 | .y equ dword [ebp-12] |
|
- | 1427 | .x equ [ebp-16] |
|
- | 1428 | .point_number equ dword [ebp-28] |
|
- | 1429 | .hit_faces equ dword [ebp-32] |
|
Line -... | Line 1430... | ||
- | 1430 | ||
- | 1431 | fninit |
|
- | 1432 | push ebp |
|
- | 1433 | mov ebp,esp |
|
- | 1434 | sub esp,64 |
|
- | 1435 | and ebp,-16 |
|
- | 1436 | mov edi,[points_normals_ptr] |
|
- | 1437 | mov .point_number,0 |
|
- | 1438 | .ipn_loop: |
|
- | 1439 | movd xmm0,.point_number |
|
- | 1440 | pshufd xmm0,xmm0,0 |
|
- | 1441 | mov .hit_faces,0 |
|
- | 1442 | mov .x,dword 0 |
|
- | 1443 | mov .y,0 |
|
- | 1444 | mov .z,0 |
|
- | 1445 | mov esi,[triangles_ptr] |
|
- | 1446 | xor ecx,ecx ; ecx - triangle number |
|
- | 1447 | .ipn_check_face: |
|
- | 1448 | movdqu xmm1,[esi] |
|
- | 1449 | pcmpeqd xmm1,xmm0 |
|
- | 1450 | pmovmskb eax,xmm1 |
|
- | 1451 | and eax,0xfff |
|
- | 1452 | or eax,eax |
|
- | 1453 | jz .ipn_next_face |
|
- | 1454 | push esi |
|
- | 1455 | mov esi,ecx |
|
- | 1456 | lea esi,[esi*3] |
|
- | 1457 | shl esi,2 |
|
- | 1458 | add esi,[triangles_normals_ptr] |
|
- | 1459 | movups xmm7,[esi] |
|
- | 1460 | addps xmm7,.x |
|
- | 1461 | movaps .x,xmm7 |
|
- | 1462 | pop esi |
|
- | 1463 | inc .hit_faces |
|
- | 1464 | ||
- | 1465 | .ipn_next_face: |
|
- | 1466 | add esi,12 |
|
- | 1467 | inc ecx |
|
- | 1468 | cmp ecx,[triangles_count_var] |
|
- | 1469 | jne .ipn_check_face |
|
- | 1470 | cvtsi2ss xmm6,.hit_faces |
|
- | 1471 | movaps xmm7,.x |
|
- | 1472 | rcpss xmm6,xmm6 |
|
- | 1473 | shufps xmm6,xmm6,11000000b |
|
- | 1474 | mulps xmm7,xmm6 |
|
- | 1475 | movaps xmm6,xmm7 |
|
- | 1476 | mulps xmm6,xmm6 |
|
- | 1477 | andps xmm6,[zero_hgst_dd] |
|
- | 1478 | haddps xmm6,xmm6 |
|
- | 1479 | haddps xmm6,xmm6 |
|
- | 1480 | rsqrtps xmm6,xmm6 |
|
- | 1481 | mulps xmm7,xmm6 |
|
- | 1482 | movlps [edi],xmm7 |
|
- | 1483 | movhlps xmm7,xmm7 |
|
- | 1484 | movss [edi+8],xmm7 |
|
- | 1485 | add edi,12 |
|
- | 1486 | inc .point_number |
|
- | 1487 | mov edx,.point_number |
|
- | 1488 | cmp edx,[points_count_var] |
|
- | 1489 | jne .ipn_loop |
|
- | 1490 | ||
- | 1491 | add esp,64 |
|
- | 1492 | pop ebp |
|
- | 1493 | ret |
|
1419 | 1494 | else |
|
1420 | init_point_normals: |
1495 | init_point_normals: |
1421 | .x equ dword [ebp-4] |
1496 | .x equ dword [ebp-4] |
1422 | .y equ dword [ebp-8] |
1497 | .y equ dword [ebp-8] |
1423 | .z equ dword [ebp-12] |
1498 | .z equ dword [ebp-12] |
Line 1489... | Line 1564... | ||
1489 | 1564 | ||
Line 1490... | Line 1565... | ||
1490 | mov esp,ebp |
1565 | mov esp,ebp |
1491 | ret |
1566 | ret |
1492 | ;=============================================================== |
1567 | ;=============================================================== |
1493 | 1568 | end if |
|
1494 | init_triangles_normals2: |
1569 | init_triangles_normals2: |
1495 | mov ebx,[triangles_normals_ptr] |
1570 | mov ebx,[triangles_normals_ptr] |
1496 | mov ebp,[triangles_ptr] |
1571 | mov ebp,[triangles_ptr] |
1497 | mov ecx,[triangles_count_var] |
1572 | mov ecx,[triangles_count_var] |
1498 | @@: |
1573 | @@: |
Line 1625... | Line 1700... | ||
1625 | movd mm1,dword[eax] |
1700 | movd mm1,dword[eax] |
1626 | paddw mm1,mm0 |
1701 | paddw mm1,mm0 |
1627 | movd dword[eax],mm1 |
1702 | movd dword[eax],mm1 |
1628 | @@: |
1703 | @@: |
1629 | 1704 | if Ext >= SSE3 |
|
- | 1705 | cmp [dr_flag],13 |
|
- | 1706 | jne .no_stencil |
|
- | 1707 | mov esi,[triangles_ptr] |
|
- | 1708 | mov ecx,[triangles_count_var] |
|
- | 1709 | @@: |
|
- | 1710 | push esi |
|
- | 1711 | push ecx |
|
- | 1712 | ||
- | 1713 | mov eax,[esi] |
|
- | 1714 | mov ebx,[esi+4] |
|
- | 1715 | mov ecx,[esi+8] |
|
- | 1716 | imul eax,[i12] |
|
- | 1717 | imul ebx,[i12] |
|
- | 1718 | imul ecx,[i12] |
|
- | 1719 | add eax,[points_rotated_ptr] |
|
- | 1720 | add ebx,[points_rotated_ptr] |
|
- | 1721 | add ecx,[points_rotated_ptr] |
|
- | 1722 | push dword[ecx+8] |
|
- | 1723 | push dword[ebx+8] |
|
- | 1724 | push dword[eax+8] |
|
- | 1725 | movups xmm0,[esp] |
|
- | 1726 | add esp,12 |
|
- | 1727 | andps xmm0,[zero_hgst_dd] |
|
- | 1728 | ||
- | 1729 | ||
- | 1730 | mov eax,[esi] |
|
- | 1731 | mov ebx,[esi+4] |
|
- | 1732 | mov ecx,[esi+8] |
|
- | 1733 | shl eax,1 |
|
- | 1734 | shl ebx,1 |
|
- | 1735 | shl ecx,1 |
|
- | 1736 | lea eax,[eax*3] |
|
- | 1737 | lea ebx,[ebx*3] |
|
- | 1738 | lea ecx,[ecx*3] |
|
- | 1739 | add eax,[points_translated_ptr] |
|
- | 1740 | add ebx,[points_translated_ptr] |
|
- | 1741 | add ecx,[points_translated_ptr] |
|
- | 1742 | mov eax,[eax] |
|
- | 1743 | mov ebx,[ebx] |
|
- | 1744 | mov ecx,[ecx] |
|
- | 1745 | ror eax,16 |
|
- | 1746 | ror ebx,16 |
|
- | 1747 | ror ecx,16 |
|
- | 1748 | ||
- | 1749 | ||
- | 1750 | mov esi,[Zbuffer_ptr] |
|
- | 1751 | ||
- | 1752 | call stencil_tri |
|
- | 1753 | ||
- | 1754 | pop ecx |
|
- | 1755 | pop esi |
|
- | 1756 | add esi,12 |
|
- | 1757 | dec ecx |
|
- | 1758 | jnz @b |
|
- | 1759 | ||
- | 1760 | .no_stencil: |
|
- | 1761 | end if |
|
- | 1762 | ||
Line 1630... | Line 1763... | ||
1630 | 1763 | ||
1631 | - | ||
1632 | mov esi,[triangles_ptr] |
1764 | |
1633 | mov [edges_counter],0 |
1765 | mov esi,[triangles_ptr] |
1634 | mov ecx,[triangles_count_var] |
1766 | mov ecx,[triangles_count_var] |
1635 | .again_dts: |
1767 | .again_dts: |
1636 | push ecx |
1768 | push ecx |
Line 1742... | Line 1874... | ||
1742 | 1874 | ||
Line 1743... | Line 1875... | ||
1743 | 1875 | ||
1744 | .no_edit: |
1876 | .no_edit: |
- | 1877 | end if |
|
1745 | end if |
1878 | |
1746 | push esi ; |
1879 | push esi ; |
1747 | fninit ; DO culling AT FIRST |
1880 | fninit ; DO culling AT FIRST |
1748 | cmp [culling_flag],1 ; (if culling_flag = 1) |
1881 | cmp [culling_flag],1 ; (if culling_flag = 1) |
1749 | jne .no_culling |
1882 | jne .no_culling |
Line 1788... | Line 1921... | ||
1788 | je .draw_smooth_line |
1921 | je .draw_smooth_line |
1789 | if Ext >= SSE3 |
1922 | if Ext >= SSE3 |
1790 | cmp [dr_flag],12 |
1923 | cmp [dr_flag],12 |
1791 | je .r_phg |
1924 | je .r_phg |
1792 | end if ; **************** |
1925 | cmp [dr_flag],13 |
- | 1926 | je .glass |
|
- | 1927 | end if ; **************** |
|
1793 | mov esi,point_index3 ; do Gouraud shading |
1928 | mov esi,point_index3 ; do Gouraud shading |
1794 | mov ecx,3 |
1929 | mov ecx,3 |
1795 | .again_grd_draw: |
1930 | .again_grd_draw: |
1796 | mov eax,dword[esi] |
1931 | mov eax,dword[esi] |
1797 | shl eax,2 |
1932 | shl eax,2 |
Line 1800... | Line 1935... | ||
1800 | ; texture x=(rotated point normal -> x * 255)+255 |
1935 | ; texture x=(rotated point normal -> x * 255)+255 |
1801 | fld dword[eax] ; x cooficient of normal vector |
1936 | fld dword[eax] ; x cooficient of normal vector |
1802 | fimul [correct_tex] |
1937 | fimul [correct_tex] |
1803 | fiadd [correct_tex] |
1938 | fiadd [correct_tex] |
1804 | fistp word[esp-2] |
1939 | fistp [temp1] |
1805 | ; texture y=(rotated point normal -> y * 255)+255 |
1940 | ; texture y=(rotated point normal -> y * 255)+255 |
1806 | fld dword[eax+4] ; y cooficient |
1941 | fld dword[eax+4] ; y cooficient |
1807 | fimul [correct_tex] |
1942 | fimul [correct_tex] |
1808 | fiadd [correct_tex] |
1943 | fiadd [correct_tex] |
1809 | fistp word[esp-4] |
1944 | fistp [temp2] |
1810 | 1945 | ||
Line 1811... | Line 1946... | ||
1811 | movzx eax,word[esp-4] |
1946 | mov eax,[temp2] |
1812 | movzx ebx,word[esp-2] |
1947 | mov ebx,[temp1] |
- | 1948 | and ebx,0xfffffff |
|
1813 | shl eax,TEX_SHIFT |
1949 | shl eax,TEX_SHIFT |
1814 | add eax,ebx |
1950 | add eax,ebx |
1815 | lea eax,[eax*3+color_map] |
1951 | lea eax,[eax*3+color_map] |
1816 | mov eax,dword[eax] |
1952 | mov eax,dword[eax] |
1817 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
1953 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
Line 1871... | Line 2007... | ||
1871 | ; push [temp_col] |
2007 | ; push [temp_col] |
1872 | ; push [temp_col] |
2008 | ; push [temp_col] |
1873 | ; push [temp_col] |
2009 | ; push [temp_col] |
1874 | .rainbow: |
2010 | .rainbow: |
1875 | cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
2011 | ; cmp [catmull_flag],1 ; put on stack z coordinate if necessary |
1876 | jne @f |
2012 | ; jne @f |
1877 | push [zz3] |
2013 | push [zz3] |
1878 | @@: |
2014 | @@: |
1879 | mov eax,dword[yy3] |
2015 | mov eax,dword[yy3] |
1880 | mov ebx,0x00ff00ff |
2016 | mov ebx,0x00ff00ff |
1881 | and eax,ebx |
2017 | and eax,ebx |
1882 | push eax |
2018 | push eax |
1883 | neg al |
2019 | neg al |
1884 | push ax |
2020 | push ax |
1885 | ; cmp [catmull_flag],1 |
2021 | push [zz2] |
1886 | ; jne @f |
- | |
1887 | push [zz2] |
- | |
1888 | ; @@: |
2022 | |
1889 | mov eax,dword[yy2] |
2023 | mov eax,dword[yy2] |
1890 | and eax,ebx |
2024 | and eax,ebx |
1891 | push eax |
2025 | push eax |
1892 | neg al |
2026 | neg al |
1893 | push ax |
2027 | push ax |
1894 | ; cmp [catmull_flag],1 |
2028 | push [zz1] |
1895 | ; jne @f |
- | |
1896 | push [zz1] |
- | |
1897 | ; @@: |
2029 | |
1898 | mov eax,dword[yy1] |
2030 | mov eax,dword[yy1] |
1899 | and eax,ebx |
2031 | and eax,ebx |
1900 | push eax |
2032 | push eax |
1901 | neg al |
2033 | neg al |
1902 | push ax |
2034 | push ax |
1903 | .both_draw: |
2035 | .both_draw: |
Line 1907... | Line 2039... | ||
1907 | ror ebx,16 |
2039 | ror ebx,16 |
1908 | mov ecx,dword[xx3] |
2040 | mov ecx,dword[xx3] |
1909 | ror ecx,16 |
2041 | ror ecx,16 |
1910 | mov edi,[screen_ptr] |
2042 | mov edi,[screen_ptr] |
1911 | ; cmp [catmull_flag],0 |
2043 | mov esi,[Zbuffer_ptr] |
1912 | ; je @f |
- | |
1913 | mov esi,[Zbuffer_ptr] |
- | |
1914 | call gouraud_triangle_z |
2044 | call gouraud_triangle_z |
1915 | ; jmp .end_draw |
2045 | jmp .end_draw |
1916 | ; @@: |
- | |
1917 | ; call gouraud_triangle |
- | |
1918 | jmp .end_draw |
- | |
1919 | 2046 | ||
Line 1920... | Line 2047... | ||
1920 | .flat_draw: ;************************** |
2047 | .flat_draw: ;************************** |
1921 | ; FLAT DRAWING |
2048 | fninit ; FLAT DRAWING |
1922 | mov eax,[point_index1] |
2049 | mov eax,[point_index1] |
1923 | mov ebx,[point_index2] |
2050 | mov ebx,[point_index2] |
1924 | mov ecx,[point_index3] |
2051 | mov ecx,[point_index3] |
1925 | shl eax,2 |
2052 | shl eax,2 |
1926 | shl ebx,2 |
2053 | shl ebx,2 |
Line 1936... | Line 2063... | ||
1936 | fadd dword[ecx] |
2063 | fadd dword[ecx] |
1937 | fidiv [i3] |
2064 | fidiv [i3] |
1938 | fimul [correct_tex] |
2065 | fimul [correct_tex] |
1939 | fiadd [correct_tex] |
2066 | fiadd [correct_tex] |
1940 | fistp dword[esp-4] ; x temp variables |
2067 | fistp [temp1] ;dword[esp-4] ; x temp variables |
1941 | fld dword[eax+4] ; y cooficient of normal vector |
2068 | fld dword[eax+4] ; y cooficient of normal vector |
1942 | fadd dword[ebx+4] |
2069 | fadd dword[ebx+4] |
1943 | fadd dword[ecx+4] |
2070 | fadd dword[ecx+4] |
1944 | fidiv [i3] |
2071 | fidiv [i3] |
1945 | fimul [correct_tex] |
2072 | fimul [correct_tex] |
1946 | fiadd [correct_tex] |
2073 | fiadd [correct_tex] |
1947 | fistp dword[esp-8] ; y |
2074 | fistp [temp2] ;dword[esp-8] ; y |
1948 | mov edx,dword[esp-8] |
2075 | mov edx,[temp2] ;dword[esp-8] |
1949 | shl edx,TEX_SHIFT |
2076 | and edx,0xfffffff |
- | 2077 | and [temp1],0xfffffff |
|
- | 2078 | shl edx,TEX_SHIFT |
|
1950 | add edx,dword[esp-4] |
2079 | add edx,[temp1] ;dword[esp-4] |
1951 | lea eax,[3*edx] |
2080 | |
- | 2081 | lea eax,[3*edx] |
|
1952 | add eax,color_map |
2082 | add eax,color_map |
1953 | mov edx,dword[eax] |
2083 | mov edx,dword[eax] |
1954 | 2084 | ||
Line 1955... | Line 2085... | ||
1955 | and edx,0x00ffffff ; edx = 0x00rrggbb |
2085 | and edx,0x00ffffff ; edx = 0x00rrggbb |
Line 1974... | Line 2104... | ||
1974 | ror ebx,16 |
2104 | ror ebx,16 |
1975 | mov ecx,dword[xx3] |
2105 | mov ecx,dword[xx3] |
1976 | ror ecx,16 |
2106 | ror ecx,16 |
1977 | mov edi,[screen_ptr] |
2107 | mov edi,[screen_ptr] |
1978 | ; cmp [catmull_flag],0 |
2108 | |
1979 | ; je @f |
- | |
1980 | mov esi,[Zbuffer_ptr] |
- | |
- | 2109 | mov esi,[Zbuffer_ptr] |
|
1981 | push word[zz3] |
2110 | push word[zz3] |
1982 | push word[zz2] |
2111 | push word[zz2] |
1983 | push word[zz1] |
2112 | push word[zz1] |
1984 | call flat_triangle_z |
2113 | call flat_triangle_z |
1985 | jmp .end_draw |
2114 | jmp .end_draw |
1986 | ; @@: |
2115 | |
1987 | ; call draw_triangle |
2116 | .env_mapping: |
1988 | ; jmp .end_draw |
- | |
1989 | .env_mapping: |
- | |
1990 | ; fninit |
2117 | push [zz3] |
1991 | ; cmp [catmull_flag],0 |
- | |
1992 | ; je @f |
- | |
1993 | push [zz3] |
- | |
1994 | push [zz2] |
2118 | push [zz2] |
1995 | push [zz1] |
2119 | push [zz1] |
1996 | ; @@: |
2120 | |
1997 | mov esi,point_index1 |
2121 | mov esi,point_index1 |
1998 | sub esp,12 |
2122 | sub esp,12 |
1999 | mov edi,esp |
2123 | mov edi,esp |
2000 | mov ecx,3 |
2124 | mov ecx,3 |
2001 | @@: |
2125 | @@: |
2002 | mov eax,dword[esi] |
2126 | mov eax,dword[esi] |
2003 | lea eax,[eax*3] |
2127 | lea eax,[eax*3] |
2004 | shl eax,2 |
2128 | shl eax,2 |
2005 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2129 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2006 | ; # |
2130 | ; texture x=(rotated point normal -> x * 255)+255 |
2007 | ; fld dword[eax] |
- | |
2008 | ; fmul dword[eax+4] |
- | |
2009 | ; fld1 |
- | |
2010 | ; fld1 |
- | |
2011 | ; faddp |
- | |
2012 | ; fmulp |
- | |
2013 | ; fimul [correct_tex] |
- | |
2014 | ; fiadd [correct_tex] |
- | |
2015 | ; fistp word[edi] |
- | |
2016 | ; mov word[edi+2],0 |
- | |
2017 | ;; fistp word[edi+2] |
- | |
2018 | ; # last change |
- | |
2019 | ; texture x=(rotated point normal -> x * 255)+255 |
- | |
2020 | fld dword[eax] |
2131 | fld dword[eax] |
2021 | fimul [correct_tex] |
2132 | fimul [correct_tex] |
2022 | fiadd [correct_tex] |
2133 | fiadd [correct_tex] |
2023 | fistp word[edi] |
2134 | fistp word[edi] |
2024 | ; texture y=(rotated point normal -> y * 255)+255 |
2135 | ; texture y=(rotated point normal -> y * 255)+255 |
2025 | fld dword[eax+4] |
2136 | fld dword[eax+4] |
2026 | fimul [correct_tex] |
2137 | fimul [correct_tex] |
2027 | fiadd [correct_tex] |
2138 | fiadd [correct_tex] |
2028 | fistp word[edi+2] |
2139 | fistp word[edi+2] |
2029 | ; # end of last ch. |
2140 | |
2030 | add edi,4 |
- | |
- | 2141 | add edi,4 |
|
2031 | add esi,4 |
2142 | add esi,4 |
2032 | loop @b |
2143 | loop @b |
2033 | 2144 | ||
Line 2034... | Line 2145... | ||
2034 | mov eax,dword[xx1] |
2145 | mov eax,dword[xx1] |
Line 2038... | Line 2149... | ||
2038 | mov ecx,dword[xx3] |
2149 | mov ecx,dword[xx3] |
2039 | ror ecx,16 |
2150 | ror ecx,16 |
2040 | mov edi,[screen_ptr] |
2151 | mov edi,[screen_ptr] |
2041 | mov esi,envmap |
2152 | mov esi,envmap |
2042 | ; cmp [catmull_flag],0 |
2153 | |
2043 | ; je @f |
- | |
2044 | - | ||
Line 2045... | Line 2154... | ||
2045 | mov edx,[Zbuffer_ptr] |
2154 | mov edx,[Zbuffer_ptr] |
2046 | call tex_triangle_z |
2155 | call tex_triangle_z |
2047 | ; jmp .end_draw |
- | |
2048 | ; @@: |
2156 | |
2049 | ; call tex_triangle |
- | |
2050 | jmp .end_draw |
2157 | jmp .end_draw |
2051 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2158 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2052 | .cubic_env_mapping: |
2159 | .cubic_env_mapping: |
2053 | ; fninit |
- | |
2054 | ; cmp [catmull_flag],0 |
- | |
2055 | ; je @f |
- | |
2056 | push [zz3] |
2160 | push [zz3] |
2057 | push [zz2] |
2161 | push [zz2] |
2058 | push [zz1] |
2162 | push [zz1] |
2059 | ; @@: |
2163 | |
2060 | mov esi,point_index1 |
2164 | mov esi,point_index1 |
2061 | sub esp,12 |
2165 | sub esp,12 |
2062 | mov edi,esp |
2166 | mov edi,esp |
2063 | mov ecx,3 |
2167 | mov ecx,3 |
2064 | @@: |
2168 | @@: |
2065 | mov eax,dword[esi] |
2169 | mov eax,dword[esi] |
2066 | lea eax,[eax*3] |
2170 | lea eax,[eax*3] |
2067 | shl eax,2 |
2171 | shl eax,2 |
2068 | add eax,[points_normals_rot_ptr] ;point_normals_rotated |
2172 | add eax,[points_normals_rot_ptr] |
2069 | ; # |
2173 | |
2070 | fld dword[eax] |
2174 | fld dword[eax] |
2071 | fmul dword[eax+4] |
2175 | fmul dword[eax+4] |
2072 | fld1 |
2176 | fld1 |
2073 | fld1 |
2177 | fld1 |
2074 | faddp |
2178 | faddp |
Line 2101... | Line 2205... | ||
2101 | mov ecx,dword[xx3] |
2205 | mov ecx,dword[xx3] |
2102 | ror ecx,16 |
2206 | ror ecx,16 |
2103 | mov edi,[screen_ptr] |
2207 | mov edi,[screen_ptr] |
2104 | mov esi,envmap_cub |
2208 | mov esi,envmap_cub |
2105 | ; cmp [catmull_flag],0 |
2209 | mov edx,[Zbuffer_ptr] |
2106 | ; je @f |
- | |
2107 | mov edx,[Zbuffer_ptr] |
- | |
2108 | call tex_triangle_z |
2210 | |
- | 2211 | call tex_triangle_z |
|
2109 | ; jmp .end_draw |
2212 | |
2110 | ; @@: |
- | |
2111 | ; call tex_triangle |
2213 | jmp .end_draw |
2112 | jmp .end_draw |
- | |
2113 | 2214 | ||
Line 2114... | Line 2215... | ||
2114 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2215 | ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
Line 2115... | Line 2216... | ||
2115 | 2216 | ||
2116 | .bump_mapping: |
- | |
2117 | ; fninit |
- | |
2118 | ; cmp [catmull_flag],0 |
- | |
Line 2119... | Line 2217... | ||
2119 | ; je @f |
2217 | .bump_mapping: |
2120 | 2218 | ||
2121 | push [Zbuffer_ptr] |
2219 | push [Zbuffer_ptr] |
2122 | push [zz3] |
2220 | push [zz3] |
2123 | push [zz2] |
2221 | push [zz2] |
2124 | push [zz1] |
2222 | push [zz1] |
2125 | ; @@: |
2223 | |
2126 | mov esi,point_index1 |
2224 | mov esi,point_index1 |
2127 | sub esp,12 |
2225 | sub esp,12 |
2128 | mov edi,esp |
2226 | mov edi,esp |
Line 2175... | Line 2273... | ||
2175 | mov edi,[screen_ptr] |
2273 | mov edi,[screen_ptr] |
2176 | mov esi,envmap |
2274 | mov esi,envmap |
2177 | mov edx,bumpmap ;BUMP_MAPPING |
2275 | mov edx,bumpmap ;BUMP_MAPPING |
2178 | 2276 | ||
Line 2179... | Line -... | ||
2179 | ; cmp [catmull_flag],0 |
- | |
2180 | ; je @f |
- | |
2181 | call bump_triangle_z |
2277 | call bump_triangle_z |
2182 | ; jmp .end_draw |
- | |
2183 | ; @@: |
2278 | |
2184 | ; call bump_triangle |
- | |
2185 | jmp .end_draw |
2279 | jmp .end_draw |
Line 2186... | Line 2280... | ||
2186 | 2280 | ||
Line 2187... | Line -... | ||
2187 | .tex_mapping: |
- | |
2188 | - | ||
2189 | ; fninit |
- | |
2190 | ; cmp [catmull_flag],0 |
2281 | .tex_mapping: |
2191 | ; je @f |
2282 | |
2192 | push [zz3] |
2283 | push [zz3] |
2193 | push [zz2] |
2284 | push [zz2] |
2194 | push [zz1] |
2285 | push [zz1] |
Line 2213... | Line 2304... | ||
2213 | mov ecx,dword[xx3] |
2304 | mov ecx,dword[xx3] |
2214 | ror ecx,16 |
2305 | ror ecx,16 |
2215 | mov edi,[screen_ptr] |
2306 | mov edi,[screen_ptr] |
2216 | mov esi,texmap |
2307 | mov esi,texmap |
2217 | ; cmp [catmull_flag],0 |
2308 | mov edx,[Zbuffer_ptr] |
2218 | ; je @f |
- | |
2219 | mov edx,[Zbuffer_ptr] |
- | |
2220 | call tex_triangle_z |
2309 | |
- | 2310 | call tex_triangle_z |
|
2221 | ; jmp .end_draw |
2311 | |
2222 | ; @@: |
- | |
2223 | ; call tex_triangle |
2312 | jmp .end_draw |
2224 | jmp .end_draw |
- | |
2225 | ; .ray: |
2313 | ; .ray: |
2226 | ; grd_triangle according to points index |
2314 | ; grd_triangle according to points index |
2227 | ; cmp [catmull_flag],0 |
2315 | ; cmp [catmull_flag],0 |
2228 | ; je @f |
2316 | ; je @f |
2229 | ; push [zz3] ; spot light with attenuation |
2317 | ; push [zz3] ; spot light with attenuation |
Line 2281... | Line 2369... | ||
2281 | .aagain_grd_draw: |
2369 | .aagain_grd_draw: |
Line 2282... | Line 2370... | ||
2282 | 2370 | ||
2283 | lea edx,[ecx*3] |
2371 | lea edx,[ecx*3] |
2284 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
2372 | push word[edx*2+xx1-2] ; zz1 ,2 ,3 |
2285 | 2373 | fninit |
|
2286 | mov eax,dword[esi] |
2374 | mov eax,dword[esi] |
2287 | shl eax,2 |
2375 | shl eax,2 |
2288 | lea eax,[eax*3] ;+point_normals_rotated] |
2376 | lea eax,[eax*3] ;+point_normals_rotated] |
2289 | add eax,[points_normals_rot_ptr] |
2377 | add eax,[points_normals_rot_ptr] |
2290 | ; texture x=(rotated point normal -> x * 255)+255 |
2378 | ; texture x=(rotated point normal -> x * 255)+255 |
2291 | fld dword[eax] ; x cooficient of normal vector |
2379 | fld dword[eax] ; x cooficient of normal vector |
2292 | fimul [correct_tex] |
2380 | fimul [correct_tex] |
2293 | fiadd [correct_tex] |
2381 | fiadd [correct_tex] |
2294 | fistp word[ebp-2] |
2382 | fistp [temp1] ;word[ebp-2] |
2295 | ; texture y=(rotated point normal -> y * 255)+255 |
2383 | ; texture y=(rotated point normal -> y * 255)+255 |
2296 | fld dword[eax+4] ; y cooficient |
2384 | fld dword[eax+4] ; y cooficient |
2297 | fimul [correct_tex] |
2385 | fimul [correct_tex] |
2298 | fiadd [correct_tex] |
2386 | fiadd [correct_tex] |
Line 2299... | Line 2387... | ||
2299 | fistp word[ebp-4] |
2387 | fistp [temp2] ;word[ebp-4] |
2300 | 2388 | ||
- | 2389 | mov eax,[temp2] ;word[ebp-4] |
|
2301 | movzx eax,word[ebp-4] |
2390 | mov ebx,[temp1] ;word[ebp-2] |
2302 | movzx ebx,word[ebp-2] |
2391 | and ebx,0xfffffff ; some onjects need thid 'and' |
2303 | shl eax,TEX_SHIFT |
2392 | shl eax,TEX_SHIFT |
- | 2393 | add eax,ebx |
|
2304 | add eax,ebx |
2394 | lea eax,[eax*3] |
Line 2305... | Line 2395... | ||
2305 | lea eax,[eax*3+color_map] |
2395 | add eax,color_map |
2306 | mov eax,dword[eax] |
2396 | mov eax,dword[eax] |
2307 | 2397 | ||
Line 2368... | Line 2458... | ||
2368 | fld dword[eax] |
2458 | fld dword[eax] |
2369 | fimul [correct_tex] |
2459 | fimul [correct_tex] |
2370 | fiadd [correct_tex] |
2460 | fiadd [correct_tex] |
2371 | fistp word[edi] |
2461 | fistp word[edi] |
2372 | ; texture y=(rotated point normal -> y * 255)+255 |
2462 | |
- | 2463 | ; texture y=(rotated point normal -> y * 255)+255 |
|
2373 | fld dword[eax+4] |
2464 | fld dword[eax+4] |
2374 | fimul [correct_tex] |
2465 | fimul [correct_tex] |
2375 | fiadd [correct_tex] |
2466 | fiadd [correct_tex] |
2376 | fistp word[edi+2] |
2467 | fistp word[edi+2] |
2377 | 2468 | and word[edi+2],0x7fff ; some objects need it |
|
2378 | add edi,4 |
- | |
- | 2469 | add edi,4 |
|
2379 | add esi,4 |
2470 | add esi,4 |
2380 | loop @b |
2471 | loop @b |
2381 | 2472 | ||
Line 2382... | Line 2473... | ||
2382 | mov eax,dword[xx1] |
2473 | mov eax,dword[xx1] |
Line 2486... | Line 2577... | ||
2486 | ; texture ;x=(rotated point normal -> x * 255)+255 |
2577 | ; texture ;x=(rotated point normal -> x * 255)+255 |
2487 | fld dword[eax] ; x cooficient of normal vector |
2578 | fld dword[eax] ; x cooficient of normal vector |
2488 | fimul [correct_tex] |
2579 | fimul [correct_tex] |
2489 | fiadd [correct_tex] |
2580 | fiadd [correct_tex] |
2490 | fistp word[esp-2] |
2581 | fistp [temp1] ;word[esp-2] |
2491 | ; texture y=(rotated point normal -> y * 255)+255 |
2582 | ; texture y=(rotated point normal -> y * 255)+255 |
2492 | fld dword[eax+4] ; y cooficient |
2583 | fld dword[eax+4] ; y cooficient |
2493 | fimul [correct_tex] |
2584 | fimul [correct_tex] |
2494 | fiadd [correct_tex] |
2585 | fiadd [correct_tex] |
2495 | fistp word[esp-4] |
2586 | fistp [temp2] ;word[esp-4] |
2496 | 2587 | ||
Line 2497... | Line 2588... | ||
2497 | movzx eax,word[esp-4] |
2588 | mov eax,[temp2] ;word[esp-4] |
2498 | movzx ebx,word[esp-2] |
2589 | mov ebx,[temp1] ;word[esp-2] |
- | 2590 | and ebx,0xfffffff |
|
2499 | shl eax,TEX_SHIFT |
2591 | shl eax,TEX_SHIFT |
2500 | add eax,ebx |
2592 | add eax,ebx |
2501 | lea eax,[eax*3+color_map] |
2593 | lea eax,[eax*3+color_map] |
2502 | mov eax,dword[eax] |
2594 | mov eax,dword[eax] |
2503 | lea ebx,[ecx-1] |
2595 | lea ebx,[ecx-1] |
Line 2507... | Line 2599... | ||
2507 | sub esi,4 |
2599 | sub esi,4 |
2508 | dec ecx |
2600 | dec ecx |
2509 | jnz .again_line_param |
2601 | jnz .again_line_param |
Line 2510... | Line -... | ||
2510 | - | ||
2511 | ; mov eax,[edges_ptr] ; this not works correctly |
- | |
2512 | ; add eax,[edges_counter] ; I mean chosing overlapped edges. |
- | |
2513 | ; mov bl,[eax] ; |
- | |
2514 | ; test bl,00000001b ; |
- | |
2515 | ; jz @f ; |
2602 | |
2516 | mov edi,[screen_ptr] |
2603 | mov edi,[screen_ptr] |
Line 2517... | Line 2604... | ||
2517 | mov esi,[Zbuffer_ptr] |
2604 | mov esi,[Zbuffer_ptr] |
2518 | 2605 | ||
Line 2541... | Line 2628... | ||
2541 | push [xx2] |
2628 | push [xx2] |
2542 | 2629 | ||
Line 2543... | Line 2630... | ||
2543 | call smooth_line |
2630 | call smooth_line |
2544 | @@: |
2631 | @@: |
2545 | ; mov eax,[edges_ptr] ; this not works correctly |
- | |
2546 | ; add eax,[edges_counter] |
- | |
2547 | ; mov bl,[eax] |
- | |
2548 | ; test bl,00000010b |
- | |
2549 | ; jz @f |
- | |
Line 2550... | Line 2632... | ||
2550 | 2632 | ||
2551 | mov edi,[screen_ptr] |
2633 | mov edi,[screen_ptr] |
Line 2552... | Line 2634... | ||
2552 | mov esi,[Zbuffer_ptr] |
2634 | mov esi,[Zbuffer_ptr] |
Line 2577... | Line 2659... | ||
2577 | 2659 | ||
Line 2578... | Line 2660... | ||
2578 | call smooth_line |
2660 | call smooth_line |
2579 | @@: |
2661 | @@: |
Line 2580... | Line -... | ||
2580 | - | ||
2581 | ; mov eax,[edges_ptr] ; this not works correctly |
- | |
2582 | ; add eax,[edges_counter] ; |
- | |
2583 | ; mov bl,[eax] ; |
- | |
2584 | ; test bl,00000100b ; |
- | |
Line 2585... | Line 2662... | ||
2585 | ; jz @f ; |
2662 | |
2586 | 2663 | ||
Line 2587... | Line 2664... | ||
2587 | mov edi,[screen_ptr] |
2664 | mov edi,[screen_ptr] |
Line 2613... | Line 2690... | ||
2613 | 2690 | ||
Line 2614... | Line 2691... | ||
2614 | call smooth_line |
2691 | call smooth_line |
2615 | jmp .end_draw |
2692 | jmp .end_draw |
2616 | @@: |
2693 | @@: |
- | 2694 | ||
2617 | if Ext >= SSE3 |
2695 | if Ext >= SSE3 |
2618 | .r_phg: |
2696 | .r_phg: |
Line 2619... | Line 2697... | ||
2619 | 2697 | ||
Line 2669... | Line 2747... | ||
2669 | 2747 | ||
Line 2670... | Line 2748... | ||
2670 | call real_phong_tri_z |
2748 | call real_phong_tri_z |
Line 2671... | Line 2749... | ||
2671 | 2749 | ||
2672 | jmp .end_draw |
- | |
Line -... | Line 2750... | ||
- | 2750 | jmp .end_draw |
|
- | 2751 | ||
- | 2752 | .glass: |
|
- | 2753 | ||
- | 2754 | movd xmm5,[size_y_var] |
|
- | 2755 | punpcklwd xmm5,[the_zero] |
|
- | 2756 | pshufd xmm5,xmm5,01110011b |
|
- | 2757 | ||
- | 2758 | ||
- | 2759 | mov eax,[point_index1] |
|
- | 2760 | mov ebx,[point_index2] |
|
- | 2761 | mov ecx,[point_index3] |
|
- | 2762 | imul eax,[i12] |
|
- | 2763 | imul ebx,[i12] |
|
- | 2764 | imul ecx,[i12] |
|
- | 2765 | add eax,[points_normals_rot_ptr] |
|
- | 2766 | add ebx,[points_normals_rot_ptr] |
|
- | 2767 | add ecx,[points_normals_rot_ptr] |
|
- | 2768 | movups xmm0,[eax] |
|
- | 2769 | movups xmm1,[ebx] |
|
- | 2770 | movups xmm2,[ecx] |
|
- | 2771 | andps xmm0,[zero_hgst_dd] |
|
- | 2772 | andps xmm1,[zero_hgst_dd] |
|
- | 2773 | andps xmm2,[zero_hgst_dd] |
|
- | 2774 | xorps xmm3,xmm3 |
|
- | 2775 | ||
- | 2776 | mov eax,[point_index1] |
|
- | 2777 | mov ebx,[point_index2] |
|
- | 2778 | mov ecx,[point_index3] |
|
- | 2779 | imul eax,[i12] |
|
- | 2780 | imul ebx,[i12] |
|
- | 2781 | imul ecx,[i12] |
|
- | 2782 | add eax,[points_rotated_ptr] |
|
- | 2783 | add ebx,[points_rotated_ptr] |
|
- | 2784 | add ecx,[points_rotated_ptr] |
|
- | 2785 | push dword[ecx+8] |
|
- | 2786 | push dword[ebx+8] |
|
- | 2787 | push dword[eax+8] |
|
- | 2788 | movups xmm4,[esp] |
|
Line -... | Line 2789... | ||
- | 2789 | add esp,12 |
|
- | 2790 | andps xmm4,[zero_hgst_dd] |
|
- | 2791 | ||
- | 2792 | ||
- | 2793 | ||
- | 2794 | mov eax,dword[xx1] |
|
- | 2795 | ror eax,16 |
|
- | 2796 | mov ebx,dword[xx2] |
|
- | 2797 | ror ebx,16 |
|
- | 2798 | mov ecx,dword[xx3] |
|
- | 2799 | ror ecx,16 |
|
- | 2800 | mov edi,[screen_ptr] |
|
- | 2801 | mov esi,[Zbuffer_ptr] |
|
Line 2673... | Line 2802... | ||
2673 | end if |
2802 | |
2674 | 2803 | call glass_tri |
|
2675 | 2804 | ||
2676 | - | ||
- | 2805 | jmp .end_draw |
|
2677 | 2806 | end if |
|
2678 | 2807 | ||
2679 | - | ||
- | 2808 | ||
2680 | 2809 | ||
2681 | 2810 | ||
Line 2714... | Line 2843... | ||
2714 | push dword 0 |
2843 | push dword 0 |
2715 | 2844 | ||
Line 2716... | Line 2845... | ||
2716 | movzx eax,word[size_x_var] |
2845 | movzx eax,word[size_x_var] |
2717 | cmp [dr_flag],12 |
2846 | cmp [dr_flag],12 |
2718 | je @f |
2847 | jge @f |
2719 | lea ebx,[eax*3] |
2848 | lea ebx,[eax*3] |
2720 | sub ebx,18 |
2849 | sub ebx,18 |
2721 | add eax,eax |
2850 | add eax,eax |
2722 | sub eax,12 |
2851 | sub eax,12 |
2723 | mov [.xres3m18],ebx |
2852 | mov [.xres3m18],ebx |
Line 2772... | Line 2901... | ||
2772 | add eax,ebx |
2901 | add eax,ebx |
2773 | push eax |
2902 | push eax |
2774 | lea edi,[eax*3] |
2903 | lea edi,[eax*3] |
2775 | cmp [dr_flag],12 |
2904 | cmp [dr_flag],12 |
2776 | jne @f |
2905 | jl @f |
2777 | add edi,[esp] |
2906 | add edi,[esp] |
2778 | @@: |
2907 | @@: |
2779 | add esp,4 |
2908 | add esp,4 |
2780 | lea eax,[eax*2] |
2909 | lea eax,[eax*2] |
2781 | ; draw bar 6x6 |
2910 | ; draw bar 6x6 |
2782 | add edi,[screen_ptr] |
2911 | add edi,[screen_ptr] |
Line 2797... | Line 2926... | ||
2797 | mov byte[edi+2],0xff ;al |
2926 | mov byte[edi+2],0xff ;al |
2798 | mov word[eax],dx |
2927 | mov word[eax],dx |
2799 | add eax,2 |
2928 | add eax,2 |
2800 | cmp [dr_flag],12 |
2929 | cmp [dr_flag],12 |
2801 | jne @f |
2930 | jl @f |
2802 | add edi,4 |
2931 | add edi,4 |
2803 | loop .do |
2932 | loop .do |
2804 | jmp .ad |
2933 | jmp .ad |
2805 | @@: |
2934 | @@: |
2806 | add edi,3 |
2935 | add edi,3 |
2807 | loop .do |
2936 | loop .do |
Line 3071... | Line 3200... | ||
3071 | .exit: |
3200 | .exit: |
3072 | mov dword[edi],-1 |
3201 | mov dword[edi],-1 |
3073 | ret |
3202 | ret |
3074 | 3203 | ||
Line 3075... | Line -... | ||
3075 | if USE_LFN |
- | |
3076 | alloc_mem_for_tp: |
3204 | alloc_mem_for_tp: |
3077 | mov eax, 68 |
3205 | mov eax, 68 |
3078 | cmp [re_alloc_flag],1 |
3206 | cmp [re_alloc_flag],1 |
3079 | jz @f |
3207 | jz @f |
3080 | mov ebx, 12 |
3208 | mov ebx, 12 |
Line 3090... | Line 3218... | ||
3090 | mov edx,[triangles_ptr] |
3218 | mov edx,[triangles_ptr] |
3091 | int 0x40 ; -> allocate memory to triangles |
3219 | int 0x40 ; -> allocate memory to triangles |
3092 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
3220 | mov [triangles_ptr], eax ; -> eax = pointer to allocated mem |
3093 | 3221 | ||
Line 3094... | Line -... | ||
3094 | ; mov eax, 68 |
- | |
3095 | ; movzx ecx, [triangles_count_var] |
- | |
3096 | ; inc ecx |
- | |
3097 | ; mov edx,[edges_ptr] |
- | |
3098 | ; int 0x40 ; -> allocate memory to edges |
- | |
3099 | ; mov [edges_ptr], eax ; -> eax = pointer to allocated mem |
- | |
3100 | - | ||
3101 | ; mov eax,-1 ; fill edges list |
- | |
3102 | ; movzx ecx,[triangles_count_var] ; importand if object generated |
- | |
3103 | ; shr ecx,2 |
- | |
3104 | ; inc ecx |
- | |
3105 | ; mov edi,[edges_ptr] |
- | |
3106 | ; cld |
- | |
3107 | ; rep stosd |
- | |
3108 | - | ||
3109 | - | ||
3110 | ; mov eax, 68 |
- | |
3111 | ; mov ebx, 12 |
- | |
3112 | ; movzx ecx, [triangles_count_var] |
- | |
3113 | ; shl ecx, 4 |
- | |
3114 | ; int 0x40 |
- | |
3115 | ; mov [triangles_w_z_ptr], eax ; for trainagles_with_z list |
- | |
3116 | ; ststic memory |
3222 | ; ststic memory |
Line 3117... | Line 3223... | ||
3117 | 3223 | ||
3118 | mov eax, 68 |
3224 | mov eax, 68 |
3119 | mov ecx, [triangles_count_var] |
3225 | mov ecx, [triangles_count_var] |
3120 | lea ecx, [3+ecx*3] |
3226 | lea ecx, [3+ecx*3] |
3121 | shl ecx, 2 |
3227 | shl ecx, 2 |
3122 | mov edx,[triangles_normals_ptr] |
3228 | mov edx,[triangles_normals_ptr] |
3123 | int 0x40 ; -> allocate memory for triangles normals |
3229 | int 0x40 ; -> allocate memory for triangles normals |
Line 3124... | Line -... | ||
3124 | mov [triangles_normals_ptr], eax ; -> eax = pointer to allocated mem |
- | |
3125 | - | ||
3126 | ; mov eax, 68 |
- | |
3127 | ; movzx ecx,[points_count_var] |
- | |
3128 | ; lea ecx,[2+ecx*2] |
- | |
3129 | ; mov edx,dword [vertices_index_ptr] |
- | |
Line 3130... | Line 3230... | ||
3130 | ; int 0x40 |
3230 | mov [triangles_normals_ptr], eax ; -> eax = pointer to allocated mem |
3131 | ; mov dword[vertices_index_ptr], eax |
3231 | |
3132 | 3232 | ||
3133 | mov eax, 68 |
3233 | mov eax, 68 |
3134 | mov ecx, [points_count_var] |
3234 | mov ecx, [points_count_var] |
3135 | lea ecx,[3+ecx*3] |
3235 | lea ecx,[3+ecx*3] |
3136 | shl ecx, 2 |
3236 | shl ecx, 2 |
3137 | mov edx,[points_normals_ptr] |
- | |
3138 | int 0x40 |
- | |
3139 | mov [points_normals_ptr], eax |
- | |
3140 | ; int3 |
- | |
Line 3141... | Line 3237... | ||
3141 | 3237 | mov edx,[points_normals_ptr] |
|
3142 | 3238 | int 0x40 |
|
3143 | ; int3 |
3239 | mov [points_normals_ptr], eax |
Line 3169... | Line 3265... | ||
3169 | mov edx,[points_translated_ptr] |
3265 | mov edx,[points_translated_ptr] |
3170 | int 0x40 |
3266 | int 0x40 |
3171 | mov [points_translated_ptr], eax |
3267 | mov [points_translated_ptr], eax |
3172 | ret |
3268 | ret |
3173 | end if |
3269 | |
3174 | 3270 | ||
Line 3175... | Line 3271... | ||
3175 | 3271 | ||
3176 | read_from_disk: |
3272 | read_from_disk: |
3177 | if USE_LFN |
3273 | if USE_LFN |