From 6dd203912d01f1f788fe6824ccd61f38eb47aa3d Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 6 Oct 2011 01:23:34 +0000 Subject: [PATCH] 3dsheart src uploaded git-svn-id: svn://kolibrios.org@2271 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/demos/3dsheart/trunk/3dmath.asm | 109 + programs/demos/3dsheart/trunk/3dsheart.asm | 2100 ++++++++++++++++++++ programs/demos/3dsheart/trunk/b_procs.asm | 134 ++ programs/demos/3dsheart/trunk/build.bat | 1 + programs/demos/3dsheart/trunk/bump3.asm | 609 ++++++ programs/demos/3dsheart/trunk/bump_cat.ASM | 769 +++++++ programs/demos/3dsheart/trunk/flat3.asm | 188 ++ programs/demos/3dsheart/trunk/flat_cat.ASM | 342 ++++ programs/demos/3dsheart/trunk/grd3.asm | 481 +++++ programs/demos/3dsheart/trunk/grd_cat.ASM | 598 ++++++ programs/demos/3dsheart/trunk/hrt.3ds | Bin 0 -> 36428 bytes programs/demos/3dsheart/trunk/tex3.ASM | 507 +++++ programs/demos/3dsheart/trunk/tex_cat.ASM | 585 ++++++ programs/demos/3dwav/trunk/3dwav.asm | 11 +- 14 files changed, 6430 insertions(+), 4 deletions(-) create mode 100644 programs/demos/3dsheart/trunk/3dmath.asm create mode 100644 programs/demos/3dsheart/trunk/3dsheart.asm create mode 100644 programs/demos/3dsheart/trunk/b_procs.asm create mode 100644 programs/demos/3dsheart/trunk/build.bat create mode 100644 programs/demos/3dsheart/trunk/bump3.asm create mode 100644 programs/demos/3dsheart/trunk/bump_cat.ASM create mode 100644 programs/demos/3dsheart/trunk/flat3.asm create mode 100644 programs/demos/3dsheart/trunk/flat_cat.ASM create mode 100644 programs/demos/3dsheart/trunk/grd3.asm create mode 100644 programs/demos/3dsheart/trunk/grd_cat.ASM create mode 100644 programs/demos/3dsheart/trunk/hrt.3ds create mode 100644 programs/demos/3dsheart/trunk/tex3.ASM create mode 100644 programs/demos/3dsheart/trunk/tex_cat.ASM diff --git a/programs/demos/3dsheart/trunk/3dmath.asm b/programs/demos/3dsheart/trunk/3dmath.asm new file mode 100644 index 0000000000..dd022f13d9 --- /dev/null +++ b/programs/demos/3dsheart/trunk/3dmath.asm @@ -0,0 +1,109 @@ +x3d equ 0 +y3d equ 2 +z3d equ 4 +vec_x equ 0 +vec_y equ 4 +vec_z equ 8 +; 3d point - triple integer word coordinate +; vector - triple float dword coordinate +;----------------------in: -------------------------------- +;------------------------ esi - pointer to 1st 3d point --- +;------------------------ edi - pointer to 2nd 3d point --- +;------------------------ ebx - pointer to result vector -- +;---------------------- out : none ------------------------ +make_vector: + fninit + fild word[edi+x3d] ;edi+x3d + fisub word[esi+x3d] ;esi+x3d + fstp dword[ebx+vec_x] + + fild word[edi+y3d] + fisub word[esi+y3d] + fstp dword[ebx+vec_y] + + fild word[edi+z3d] + fisub word[esi+z3d] + fstp dword[ebx+vec_z] + +ret +;---------------------- in: ------------------------------- +;--------------------------- esi - pointer to 1st vector -- +;--------------------------- edi - pointer to 2nd vector -- +;--------------------------- ebx - pointer to result vector +;---------------------- out : none +cross_product: + fninit + fld dword [esi+vec_y] + fmul dword [edi+vec_z] + fld dword [esi+vec_z] + fmul dword [edi+vec_y] + fsubp ;st1 ,st + fstp dword [ebx+vec_x] + + fld dword [esi+vec_z] + fmul dword [edi+vec_x] + fld dword [esi+vec_x] + fmul dword [edi+vec_z] + fsubp ;st1 ,st + fstp dword [ebx+vec_y] + + fld dword [esi+vec_x] + fmul dword [edi+vec_y] + fld dword [esi+vec_y] + fmul dword [edi+vec_x] + fsubp ;st1 ,st + fstp dword [ebx+vec_z] +ret +;----------------------- in: ------------------------------ +;---------------------------- edi - pointer to vector ----- +;----------------------- out : none +normalize_vector: + fninit + fld dword [edi+vec_x] + fmul st, st + fld dword [edi+vec_y] + fmul st, st + fld dword [edi+vec_z] + fmul st, st + faddp st1, st + faddp st1, st + fsqrt + + ftst + fstsw ax + sahf + jnz @f + + fst dword [edi+vec_x] + fst dword [edi+vec_y] + fstp dword [edi+vec_z] + ret + @@: + fld st + fld st + fdivr dword [edi+vec_x] + fstp dword [edi+vec_x] + fdivr dword [edi+vec_y] + fstp dword [edi+vec_y] + fdivr dword [edi+vec_z] + fstp dword [edi+vec_z] +ret +;------------------in: ------------------------- +;------------------ esi - pointer to 1st vector +;------------------ edi - pointer to 2nd vector +;------------------out: ------------------------ +;------------------ st0 - dot-product +dot_product: + fninit + fld dword [esi+vec_x] + fmul dword [edi+vec_x] + fld dword [esi+vec_y] + fmul dword [edi+vec_y] + fld dword [esi+vec_z] + fmul dword [edi+vec_z] + faddp + faddp +ret + + + diff --git a/programs/demos/3dsheart/trunk/3dsheart.asm b/programs/demos/3dsheart/trunk/3dsheart.asm new file mode 100644 index 0000000000..61b82e0c35 --- /dev/null +++ b/programs/demos/3dsheart/trunk/3dsheart.asm @@ -0,0 +1,2100 @@ +; +; application : Caritas - flat shading, Gouraud shading, +; enviornament mapping, bump mapping +; compiler : FASM +; system : KolibriOS +; author : macgub alias Maciej Guba +; email : macgub3@wp.pl +; web : www.menuet.xt.pl +; Fell free to use this intro in your own distribution of KolibriOS. +; Special greetings to all MenuetOS maniax in the world. +; I hope because my intros Christian Belive will be near to each of You. + + +; Some adjustments made by Madis Kalme +; madis.kalme@mail.ee +; I tried optimizing it a bit, but don't know if it was successful. The objects +; can be: +; 1) Read from a file (*.3DS standard) +; 2) Written in manually (at the end of the code) +SIZE_X equ 350 +SIZE_Y equ 350 +TIMEOUT equ 4 +ROUND equ 10 +TEX_X equ 512 ; texture width +TEX_Y equ 512 ; height +TEX_SHIFT equ 9 ; texture width shifting +TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 +TEX equ SHIFTING ; TEX={SHIFTING | FLUENTLY} +FLUENTLY = 0 +SHIFTING = 1 +CATMULL_SHIFT equ 8 +NON = 0 +MMX = 1 + +Ext = MMX ;Ext={ NON | MMX} + +use32 + org 0x0 + db 'MENUET01' ; 8 byte id + dd 0x01 ; header version + dd START ; start of code + dd I_END ; size of image + dd I_END ; memory for app + dd I_END ; esp + dd 0x0 , 0x0 ; I_Param , I_Icon + +START: ; start of execution + cld + ; call alloc_buffer_mem + call read_from_file + call init_triangles_normals + call init_point_normals + call init_envmap + mov edi,bumpmap + call calc_bumpmap + call calc_bumpmap_coords + call draw_window + + +still: + mov eax,23 ; wait here for event with timeout + mov ebx,TIMEOUT + cmp [speed_flag],1 + jne .skip + mov eax,11 + .skip: + int 0x40 + + cmp eax,1 ; redraw request ? + je red + cmp eax,2 ; key in buffer ? + je key + cmp eax,3 ; button in buffer ? + je button + + jmp noclose + + red: ; redraw + call draw_window + jmp noclose + + key: ; key + mov eax,2 ; just read it and ignore + int 0x40 + jmp noclose + + button: ; button + mov eax,17 ; get id + int 0x40 + + cmp ah,1 ; button id=1 ? + jne .ch_another + + mov eax,-1 ; close this program + int 0x40 + .ch_another: + cmp ah,2 + jne .ch_another1 + inc [r_flag] + cmp [r_flag],3 + jne noclose + mov [r_flag],0 + .ch_another1: + cmp ah,3 + jne .ch_another2 + inc [dr_flag] + cmp [dr_flag],4 + jne noclose + mov [dr_flag],0 + .ch_another2: + cmp ah,4 ; toggle speed + jne @f + inc [speed_flag] + cmp [speed_flag],2 + jne noclose + mov [speed_flag],0 + @@: + cmp ah,5 + jne @f ;scale- + mov [scale],0.7 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] ;-- last change + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector +; call do_scale + @@: + cmp ah,6 + jne @f ; scale+ + mov [scale],1.3 + fninit + fld [sscale] + fmul [scale] + fstp [sscale] + call read_from_file + mov ax,[vect_x] + mov bx,[vect_y] + mov cx,[vect_z] + call add_vector + call init_triangles_normals + call init_point_normals + @@: + cmp ah,7 + jne @f + xor ax,ax ;add vector to object and rotary point + mov bx,-10 + xor cx,cx + call add_vector + sub [vect_y],10 + sub [yo],10 + @@: + cmp ah,8 + jne @f + xor ax,ax + xor bx,bx + mov cx,10 + call add_vector + add [vect_z],10 + add [zo],10 + @@: + cmp ah,9 + jne @f + mov ax,-10 + xor bx,bx + xor cx,cx + call add_vector + sub [vect_x],10 + sub [xo],10 + @@: + cmp ah,10 + jne @f + mov ax,10 + xor bx,bx + xor cx,cx + call add_vector + add [vect_x],10 + add [xo],10 + @@: + cmp ah,11 + jne @f + xor ax,ax + xor bx,bx + mov cx,-10 + call add_vector + sub [vect_z],10 + sub [zo],10 + @@: + cmp ah,12 + jne @f + xor ax,ax + mov bx,10 + xor cx,cx + call add_vector + add [vect_y],10 + add [yo],10 + @@: + cmp ah,13 ; change main color - + jne @f ; - lead color setting + cmp [max_color_r],245 + jge @f + add [max_color_r],10 + call init_envmap + @@: + cmp ah,14 + jne @f + cmp [max_color_g],245 + jge @f + add [max_color_g],10 + call init_envmap + @@: + cmp ah,15 + jne @f + cmp [max_color_b],245 + jge @f + add [max_color_b],10 + call init_envmap + @@: + cmp ah,16 ; change main color + jne @f + cmp [max_color_r],10 + jle @f + sub [max_color_r],10 + call init_envmap + @@: + cmp ah,17 + jne @f + cmp [max_color_g],10 + jle @f + sub [max_color_g],10 + call init_envmap + @@: + cmp ah,18 + jne @f + cmp [max_color_b],10 + jle @f + sub [max_color_b],10 + call init_envmap + @@: + cmp ah,19 + jne @f + inc [catmull_flag] + cmp [catmull_flag],2 + jne @f + mov [catmull_flag],0 + @@: + noclose: + + call calculate_angle ; calculates sinus and cosinus + call copy_point_normals + ; copy normals and rotate the copy using sin/cosbeta - best way + call rotate_point_normals + cmp [dr_flag],2 + jge @f + call calculate_colors + @@: + call copy_points + call rotate_points + call translate_perspective_points; translate from 3d to 2d + call clrscr ; clear the screen + cmp [catmull_flag],1 ;non sort if Catmull + je .no_sort + call sort_triangles + .no_sort: + call fill_Z_buffer ; make background + + RDTSC + push eax + call draw_triangles ; draw all triangles from the list + + RDTSC + sub eax,[esp] + sub eax,41 + ; lea esi,[debug_points] + ; lea edi,[debug_points+6] + ; lea ebx,[debug_vector1] + ; call make_vector + ; fninit + ; fld [sinbeta_one] + ; fimul [debug_dwd] + ; fistp [debug_dd] + ; movzx eax,[debug_dd] + + + mov ecx,10 + .dc: + + pop eax +macro show +{ + mov eax,7 ; put image + mov ebx,screen + mov ecx,SIZE_X shl 16 + SIZE_Y + xor edx,edx + int 0x40 +} + show + + + jmp still + +;-------------------------------------------------------------------------------- +;-------------------------PROCEDURES--------------------------------------------- +;-------------------------------------------------------------------------------- +include "tex3.asm" +include "flat_cat.asm" +include "grd_cat.asm" +include "tex_cat.asm" +include "bump_cat.asm" +include "3dmath.asm" +include "grd3.asm" +include "flat3.asm" +include "bump3.asm" +include "b_procs.asm" + + +;alloc_buffer_mem: +; mov eax,68 +; mov ebx,5 +; mov ecx,SIZE_X*SIZE_Y*3 +; int 0x40 +; mov [screen],eax +;ret +calc_bumpmap_coords: +; fninit + mov esi,points + mov edi,tex_points +; @@: +; add esi,2 +; fild word[esi] +; fmul [bump_scale] +; fistp word[edi] +; fild word[esi+2] +; fmul [bump_scale] +; fistp word[edi+2] +; add esi,4 +; add edi,4 +; cmp [esi],dword -1 +; jnz @b + @@: + add esi,2 + movsd + ; add esi,2 + cmp dword[esi],dword -1 + jne @b +ret +;bump_scale dd 1.4 ;TEX_X/SIZE_X + +init_envmap: + +.temp equ word [ebp-2] + push ebp + mov ebp,esp + sub esp,2 + mov edi,envmap + fninit + + mov dx,-256 + .ie_ver: + mov cx,-256 + .ie_hor: + mov .temp,cx + fild .temp + fmul st,st0 + mov .temp,dx + fild .temp + fmul st,st0 + faddp + fsqrt + mov .temp,254 + fisubr .temp + fmul [env_const] + fistp .temp + mov ax,.temp + + or ax,ax + jge .ie_ok1 + xor ax,ax + jmp .ie_ok2 + .ie_ok1: + cmp ax,254 + jle .ie_ok2 + mov ax,254 + .ie_ok2: + push dx + mov bx,ax + mul [max_color_b] + shr ax,8 + stosb + mov ax,bx + mul [max_color_g] + shr ax,8 + stosb + mov ax,bx + mul [max_color_r] + shr ax,8 + stosb + pop dx + + inc cx + cmp cx,256 + jne .ie_hor + + inc dx + cmp dx,256 + jne .ie_ver + + mov esp,ebp + pop ebp +macro debug +{ + mov edi,envmap + mov ecx,512*512*3/4 + mov eax,0xffffffff + rep stosd +} +ret +calculate_colors: + fninit + xor ebx,ebx + movzx ecx,[points_count_var] + lea ecx,[ecx*3] + add ecx,ecx + .cc_again: + mov esi,light_vector + lea edi,[point_normals_rotated+ebx*2] + call dot_product + fcom [dot_min] + fstsw ax + sahf + ja .cc_ok1 + ffree st + mov dword[points_color+ebx],0 + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok1: + fcom [dot_max] + fstsw ax + sahf + jb .cc_ok2 + ffree st + mov dword[points_color+ebx],0 ; clear r,g,b + mov word[points_color+ebx+4],0 + add ebx,6 + cmp ebx,ecx + jne .cc_again + jmp .cc_done + .cc_ok2: + fld st + fld st + fimul [max_color_r] + fistp word[points_color+ebx] ;each color as word + fimul [max_color_g] + fistp word[points_color+ebx+2] + fimul [max_color_b] + fistp word[points_color+ebx+4] + add ebx,6 + cmp ebx,ecx + jne .cc_again + .cc_done: +ret +copy_point_normals: + movzx ecx,[points_count_var] + shl ecx,2 + inc ecx + mov esi,point_normals + mov edi,point_normals_rotated + rep movsd +ret +rotate_point_normals: + movzx ecx,[points_count_var] + mov ebx,point_normals_rotated + fninit ; for now only rotate around Z axle + .again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + + .y_rot: + fld dword[ebx] ; x + fld [sinbeta] + fmul dword[ebx+8] ; z * sinbeta + fchs + fld [cosbeta] + fmul dword[ebx] ; x * cosbeta + faddp + fstp dword[ebx] ; new x + fmul [sinbeta] ; old x * sinbeta + fld [cosbeta] + fmul dword[ebx+8] ; z * cosbeta + faddp + fstp dword[ebx+8] ; new z + add ebx,12 + loop .y_rot + jmp .end_rot + .z_rot: + fld dword[ebx] ;x + fld [sinbeta] + fmul dword[ebx+4] ;y + fld [cosbeta] + fmul dword[ebx] ;x + faddp + fstp dword[ebx] ;new x + fmul [sinbeta] ; sinbeta * old x + fchs + fld [cosbeta] + fmul dword[ebx+4] ; cosbeta * y + faddp + fstp dword[ebx+4] ; new y + add ebx,12 + loop .z_rot + jmp .end_rot + .x_rot: + fld dword[ebx+4] ;y + fld [sinbeta] + fmul dword[ebx+8] ;z + fld [cosbeta] + fmul dword[ebx+4] ;y + faddp + fstp dword[ebx+4] ; new y + fmul [sinbeta] ; sinbeta * old y + fchs + fld [cosbeta] + fmul dword[ebx+8] + faddp + fstp dword[ebx+8] + add ebx,12 + loop .x_rot + .end_rot: +ret +init_triangles_normals: + mov ebx,triangles_normals + mov ebp,triangles + @@: + push ebx + mov ebx,vectors + movzx esi,word[ebp] ; first point index + lea esi,[esi*3] + lea esi,[points+esi*2] ; esi - pointer to 1st 3d point + movzx edi,word[ebp+2] ; second point index + lea edi,[edi*3] + lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point + call make_vector + add ebx,12 + mov esi,edi + movzx edi,word[ebp+4] ; third point index + lea edi,[edi*3] + lea edi,[points+edi*2] + call make_vector + mov edi,ebx ; edi - pointer to 2nd vector + mov esi,ebx + sub esi,12 ; esi - pointer to 1st vector + pop ebx + call cross_product + mov edi,ebx + call normalize_vector + add ebp,6 + add ebx,12 + cmp dword[ebp],-1 + jne @b +ret + +init_point_normals: +.x equ dword [ebp-4] +.y equ dword [ebp-8] +.z equ dword [ebp-12] +.point_number equ word [ebp-26] +.hit_faces equ word [ebp-28] + + fninit + mov ebp,esp + sub esp,28 + mov edi,point_normals + mov .point_number,0 + .ipn_loop: + mov .hit_faces,0 + mov .x,0 + mov .y,0 + mov .z,0 + mov esi,triangles + xor ecx,ecx ; ecx - triangle number + .ipn_check_face: + xor ebx,ebx ; ebx - 'position' in one triangle + .ipn_check_vertex: + movzx eax,word[esi+ebx] ; eax - point_number + cmp ax,.point_number + jne .ipn_next_vertex + push esi + mov esi,ecx + lea esi,[esi*3] + lea esi,[triangles_normals+esi*4] + ; shl esi,2 + ; add esi,triangles_normals + + fld .x + fadd dword[esi+vec_x] + fstp .x + fld .y + fadd dword[esi+vec_y] + fstp .y + fld .z + fadd dword[esi+vec_z] + fstp .z + pop esi + inc .hit_faces + jmp .ipn_next_face + .ipn_next_vertex: + add ebx,2 + cmp ebx,6 + jne .ipn_check_vertex + .ipn_next_face: + add esi,6 + inc ecx + cmp cx,[triangles_count_var] + jne .ipn_check_face + + fld .x + fidiv .hit_faces + fstp dword[edi+vec_x] + fld .y + fidiv .hit_faces + fstp dword[edi+vec_y] + fld .z + fidiv .hit_faces + fstp dword[edi+vec_z] + call normalize_vector + add edi,12 ;type vector 3d + inc .point_number + mov dx,.point_number + cmp dx,[points_count_var] + jne .ipn_loop + + mov esp,ebp +ret + +add_vector: + mov ebp,points + @@: + add word[ebp],ax + add word[ebp+2],bx + add word[ebp+4],cx + add ebp,6 + cmp dword[ebp],-1 + jne @b +ret +;do_scale: +; fninit +; mov ebp,points +; .next_sc: +; fld1 +; fsub [scale] +; fld st +; fimul [xo] +; fld [scale] +; fimul word[ebp] ;x +; faddp +; fistp word[ebp] +; fld st +; fimul [yo] +; fld [scale] +; fimul word[ebp+2] +; faddp +; fistp word[ebp+2] +; fimul [zo] +; fld [scale] +; fimul word[ebp+4] +; faddp +; fistp word[ebp+4] +; add ebp,6 +; cmp dword[ebp],-1 +; jne .next_sc +;ret +sort_triangles: + mov esi,triangles + mov edi,triangles_with_z + mov ebp,points_rotated + + make_triangle_with_z: ;makes list with triangles and z position + movzx eax,word[esi] + lea eax,[eax*3] + movzx ecx,word[ebp+eax*2+4] + + movzx eax,word[esi+2] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + movzx eax,word[esi+4] + lea eax,[eax*3] + add cx,word[ebp+eax*2+4] + + mov ax,cx + ; cwd + ; idiv word[i3] + movsd ; store vertex coordinates + movsw + stosw ; middle vertex coordinate 'z' in triangles_with_z list + cmp dword[esi],-1 + jne make_triangle_with_z + movsd ; copy end mark + mov eax,4 + lea edx,[edi-8-trizdd] + mov [high],edx + call quicksort + mov eax,4 + mov edx,[high] + call insertsort + jmp end_sort + + quicksort: + mov ecx,edx + sub ecx,eax + cmp ecx,32 + jc .exit + lea ecx,[eax+edx] + shr ecx,4 + lea ecx,[ecx*8-4]; i + mov ebx,[trizdd+eax]; trizdd[l] + mov esi,[trizdd+ecx]; trizdd[i] + mov edi,[trizdd+edx]; trizdd[h] + cmp ebx,esi + jg @f ; direction NB! you need to negate these to invert the order + if Ext=NON + mov [trizdd+eax],esi + mov [trizdd+ecx],ebx + mov ebx,[trizdd+eax-4] + mov esi,[trizdd+ecx-4] + mov [trizdd+eax-4],esi + mov [trizdd+ecx-4],ebx + mov ebx,[trizdd+eax] + mov esi,[trizdd+ecx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,esi + end if + @@: + cmp ebx,edi + jg @f ; direction + if Ext=NON + mov [trizdd+eax],edi + mov [trizdd+edx],ebx + mov ebx,[trizdd+eax-4] + mov edi,[trizdd+edx-4] + mov [trizdd+eax-4],edi + mov [trizdd+edx-4],ebx + mov ebx,[trizdd+eax] + mov edi,[trizdd+edx] + else + movq mm0,[trizdq+eax-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+eax-4],mm1 + xchg ebx,edi + end if + @@: + cmp esi,edi + jg @f ; direction + if Ext=NON + mov [trizdd+ecx],edi + mov [trizdd+edx],esi + mov esi,[trizdd+ecx-4] + mov edi,[trizdd+edx-4] + mov [trizdd+ecx-4],edi + mov [trizdd+edx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+edx-4] + movq [trizdq+edx-4],mm0 + movq [trizdq+ecx-4],mm1 +; xchg ebx,esi + end if + @@: + mov ebp,eax ; direction + add ebp,8 ; j + if Ext=NON + mov esi,[trizdd+ebp] + mov edi,[trizdd+ecx] + mov [trizdd+ebp],edi + mov [trizdd+ecx],esi + mov esi,[trizdd+ebp-4] + mov edi,[trizdd+ecx-4] + mov [trizdd+ecx-4],esi + mov [trizdd+ebp-4],edi + else + movq mm0,[trizdq+ebp-4] + movq mm1,[trizdq+ecx-4] + movq [trizdq+ecx-4],mm0 + movq [trizdq+ebp-4],mm1 + end if + mov ecx,edx ; i; direction + mov ebx,[trizdd+ebp]; trizdd[j] + .loop: + sub ecx,8 ; direction + cmp [trizdd+ecx],ebx + jl .loop ; direction + @@: + add ebp,8 ; direction + cmp [trizdd+ebp],ebx + jg @b ; direction + cmp ebp,ecx + jge @f ; direction + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+ebp] + mov [trizdd+ebp],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+ebp-4] + mov [trizdd+ebp-4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+ebp-4] + movq [trizdq+ebp-4],mm0 + movq [trizdq+ecx-4],mm1 + end if + jmp .loop + @@: + if Ext=NON + mov esi,[trizdd+ecx] + mov edi,[trizdd+eax+8] + mov [trizdd+eax+8],esi + mov [trizdd+ecx],edi + mov edi,[trizdd+ecx-4] + mov esi,[trizdd+eax+4] + mov [trizdd+eax+4],edi + mov [trizdd+ecx-4],esi + else + movq mm0,[trizdq+ecx-4] + movq mm1,[trizdq+eax+4]; dir + movq [trizdq+eax+4],mm0; dir + movq [trizdq+ecx-4],mm1 + end if + add ecx,8 + push ecx edx + mov edx,ebp + call quicksort + pop edx eax + call quicksort + .exit: + ret + insertsort: + mov esi,eax + .start: + add esi,8 + cmp esi,edx + ja .exit + mov ebx,[trizdd+esi] + if Ext=NON + mov ecx,[trizdd+esi-4] + else + movq mm1,[trizdq+esi-4] + end if + mov edi,esi + @@: + cmp edi,eax + jna @f + cmp [trizdd+edi-8],ebx + jg @f ; direction + if Ext=NON + mov ebp,[trizdd+edi-8] + mov [trizdd+edi],ebp + mov ebp,[trizdd+edi-12] + mov [trizdd+edi-4],ebp + else + movq mm0,[trizdq+edi-12] + movq [trizdq+edi-4],mm0 + end if + sub edi,8 + jmp @b + @@: + if Ext=NON + mov [trizdd+edi],ebx + mov [trizdd+edi-4],ecx + else + movq [trizdq+edi-4],mm1 + end if + jmp .start + .exit: + ret + end_sort: + ; translate triangles_with_z to sorted_triangles + mov esi,triangles_with_z + ; mov edi,sorted_triangles + mov edi,triangles + again_copy: + if Ext=NON + movsd + movsw + add esi,2 + else + movq mm0,[esi] + movq [edi],mm0 + add esi,8 + add edi,6 + end if + cmp dword[esi],-1 + jne again_copy +; if Ext=MMX +; emms +; end if + movsd ; copy end mark too +ret + +clrscr: + mov edi,screen + mov ecx,SIZE_X*SIZE_Y*3/4 + xor eax,eax + if Ext=NON + rep stosd + else + pxor mm0,mm0 + @@: + movq [edi+00],mm0 + movq [edi+08],mm0 + movq [edi+16],mm0 + movq [edi+24],mm0 + add edi,32 + sub ecx,8 + jnc @b + end if +ret + +calculate_angle: + fninit +; fldpi +; fidiv [i180] + fld [piD180] + fimul [angle_counter] + fsincos + fstp [sinbeta] + fstp [cosbeta] + inc [angle_counter] + cmp [angle_counter],360 + jne end_calc_angle + mov [angle_counter],0 + end_calc_angle: +ret + +rotate_points: + fninit + mov ebx,points_rotated + again_r: + cmp [r_flag],1 + je .z_rot + cmp [r_flag],2 + je .x_rot + .y_rot: + mov eax,[ebx+2] ;z + mov ax,word[ebx] ;x + sub eax,dword[xo] + mov dword[xsub],eax + fld [sinbeta] + fimul [zsub] + fchs + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] ;x + fld [sinbeta] + fimul [xsub] + fld [cosbeta] + fimul [zsub] + faddp + fiadd [zo] + fistp word[ebx+4] ;z + jmp .end_rot + .z_rot: + mov ax,word[ebx] + sub ax,word[xo] ;need optimization + mov [xsub],ax + mov ax,word[ebx+2] + sub ax,word[yo] + mov [ysub],ax + fld [sinbeta] + fimul [ysub] + fld [cosbeta] + fimul [xsub] + faddp + fiadd [xo] + fistp word[ebx] + fld [cosbeta] + fimul [ysub] + fld [sinbeta] + fimul [xsub] + fchs + faddp + fiadd [yo] + fistp word[ebx+2] + jmp .end_rot + .x_rot: + mov ax,word[ebx+2] + sub ax,[yo] + mov [ysub],ax + mov ax,word[ebx+4] + sub ax,word[zo] + mov [zsub],ax + fld [sinbeta] + fimul [zsub] + fld [cosbeta] + fimul [ysub] + faddp + fiadd [yo] + fistp word[ebx+2];y + fld [cosbeta] + fimul [zsub] + fld [sinbeta] + fimul [ysub] + fchs + faddp + fiadd [zo] + fistp word[ebx+4] + .end_rot: + add ebx,6 + cmp dword[ebx],-1 + jne again_r +ret + +draw_triangles: + mov esi,triangles + .again_dts: + mov ebp,points_rotated + if Ext=NON + movzx eax,word[esi] + mov [point_index1],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx1],eax + mov eax,[ebp+4] + mov [zz1],ax + pop ebp + + + movzx eax,word[esi+2] + mov [point_index2],ax + lea eax,[eax*3] + add eax,eax + push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx2],eax + mov eax,[ebp+4] + mov [zz2],ax + pop ebp + + + movzx eax,word[esi+4] ; xyz3 = [ebp+[esi+4]*6] + mov [point_index3],ax + lea eax,[eax*3] + add eax,eax + ; push ebp + add ebp,eax + mov eax,[ebp] + mov dword[xx3],eax + mov eax,[ebp+4] + mov [zz3],ax + else + mov eax,dword[esi] ; don't know MMX + mov dword[point_index1],eax + ; shr eax,16 + ; mov [point_index2],ax + mov ax,word[esi+4] + mov [point_index3],ax + movq mm0,[esi] + pmullw mm0,qword[const6] + movd eax,mm0 + psrlq mm0,16 + movd ebx,mm0 + psrlq mm0,16 + movd ecx,mm0 + and eax,0FFFFh + and ebx,0FFFFh + and ecx,0FFFFh + movq mm0,[ebp+eax] + movq mm1,[ebp+ebx] + movq mm2,[ebp+ecx] + movq qword[xx1],mm0 + movq qword[xx2],mm1 + movq qword[xx3],mm2 +; emms + end if + push esi + ; culling + fninit + mov esi,point_index1 + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + lea eax,[eax+point_normals_rotated] + fld dword[eax+8] ; I check Z element of normal vector + ftst + fstsw ax + sahf + jb @f + ffree st + loop @b + jmp .end_draw + @@: + ffree st ;is visable + + cmp [dr_flag],0 ; draw type flag + je .flat_draw + cmp [dr_flag],2 + je .env_mapping + cmp [dr_flag],3 + je .bump_mapping + + cmp [catmull_flag],1 + je @f + + movzx edi,[point_index3] ; do gouraud shading catmull off + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push word[edi] + push word[edi+2] + push word[edi+4] + jmp .both_draw + @@: + movzx edi,[point_index3] ; do gouraud shading catmull on + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push [zz3] + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push [zz2] + push word[edi] + push word[edi+2] + push word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + push [zz1] + push word[edi] + push word[edi+2] + push word[edi+4] + + ; movzx edi,[point_index3] ;gouraud shading according to light vector + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [max_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] + + ; movzx edi,[point_index2] + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [max_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] + + ; movzx edi,[point_index1] + ; lea edi,[edi*3] + ; lea edi,[4*edi+point_normals_rotated] ; edi - normal + ; mov esi,light_vector + ; call dot_product + ; fabs + ; fimul [max_color_r] + ; fistp [temp_col] + ; and [temp_col],0x00ff + ; push [temp_col] + ; push [temp_col] + ; push [temp_col] + +; xor edx,edx ; draw acording to position +; mov ax,[zz3] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy3] +; and dx,0x00ff +; push dx +; mov ax,[zz2] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy2] +; and dx,0x00ff +; push dx +; mov ax,[zz1] +; add ax,128 +; neg al +; and ax,0x00ff +; push ax +; neg al +; push ax +; mov dx,[yy1] +; and dx,0x00ff +; push dx + .both_draw: + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + call gouraud_triangle_z + jmp .end_draw + @@: + call gouraud_triangle + jmp .end_draw + + .flat_draw: + movzx edi,[point_index3] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + movzx eax,word[edi] + movzx ebx,word[edi+2] + movzx ecx,word[edi+4] + movzx edi,[point_index2] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + movzx edi,[point_index1] + lea edi,[edi*3] + lea edi,[points_color+edi*2] + add ax,word[edi] + add bx,word[edi+2] + add cx,word[edi+4] + cwd + idiv [i3] + mov di,ax + shl edi,16 + mov ax,bx + cwd + idiv [i3] + mov di,ax + shl di,8 + mov ax,cx + cwd + idiv [i3] + mov edx,edi + mov dl,al + and edx,0x00ffffff + + + ; mov ax,[zz1] ; z position depend draw + ; add ax,[zz2] + ; add ax,[zz3] + ; cwd + ; idiv [i3] ; = -((a+b+c)/3+130) + ; add ax,130 + ; neg al + ; xor edx,edx + ; mov ah,al ;set color according to z position + ; shl eax,8 + ; mov edx,eax + + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + ; mov edi,screen + lea edi,[screen] + cmp [catmull_flag],0 + je @f + lea esi,[Z_buffer] + push word[zz3] + push word[zz2] + push word[zz1] + call flat_triangle_z + jmp .end_draw + @@: + call draw_triangle + jmp .end_draw + .env_mapping: + ; fninit + cmp [catmull_flag],0 + je @f + push [zz3] + push [zz2] + push [zz1] + @@: + mov esi,point_index1 + sub esp,12 + mov edi,esp + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + add eax,point_normals_rotated + ; texture x=(rotated point normal -> x * 255)+255 + fld dword[eax] + fimul [correct_tex] + fiadd [correct_tex] + fistp word[edi] + ; texture y=(rotated point normal -> y * 255)+255 + fld dword[eax+4] + fimul [correct_tex] + fiadd [correct_tex] + fistp word[edi+2] + + add edi,4 + add esi,2 + loop @b + + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + mov edi,screen + mov esi,envmap + cmp [catmull_flag],0 + je @f + mov edx,Z_buffer + call tex_triangle_z + jmp .end_draw + @@: + call tex_triangle + jmp .end_draw + .bump_mapping: + ; fninit + cmp [catmull_flag],0 + je @f + push Z_buffer + push [zz3] + push [zz2] + push [zz1] + @@: + mov esi,point_index1 + sub esp,12 + mov edi,esp + mov ecx,3 + @@: + movzx eax,word[esi] + lea eax,[eax*3] + shl eax,2 + add eax,point_normals_rotated + ; texture x=(rotated point normal -> x * 255)+255 + fld dword[eax] + fimul [correct_tex] + fiadd [correct_tex] + fistp word[edi] + ; texture y=(rotated point normal -> y * 255)+255 + fld dword[eax+4] + fimul [correct_tex] + fiadd [correct_tex] + fistp word[edi+2] + + add edi,4 + add esi,2 + loop @b + + movzx esi,[point_index3] + shl esi,2 + add esi,tex_points + push dword[esi] + movzx esi,[point_index2] + shl esi,2 + add esi,tex_points +; lea esi,[esi*3] +; lea esi,[points+2+esi*2] + push dword[esi] + ; push dword[xx2] + movzx esi,[point_index1] + shl esi,2 + add esi,tex_points +; lea esi,[esi*3] +; lea esi,[points+2+esi*2] + push dword[esi] + ; push dword[xx1] + + mov eax,dword[xx1] + ror eax,16 + mov ebx,dword[xx2] + ror ebx,16 + mov ecx,dword[xx3] + ror ecx,16 + mov edi,screen + mov esi,envmap + mov edx,bumpmap ;BUMP_MAPPING + + cmp [catmull_flag],0 + je @f + call bump_triangle_z + jmp .end_draw + @@: + call bump_triangle + + .end_draw: + pop esi + add esi,6 + cmp dword[esi],-1 + jne .again_dts +ret +translate_points: +; fninit +; mov ebx,points_rotated +; again_trans: +; fild word[ebx+4] ;z1 +; fmul [sq] +; fld st +; fiadd word[ebx] ;x1 +; fistp word[ebx] +; fchs +; fiadd word[ebx+2] ;y1 +; fistp word[ebx+2] ;y1 + +; add ebx,6 +; cmp dword[ebx],-1 +; jne again_trans +;ret +translate_perspective_points: ;translate points from 3d to 2d using + fninit ;perspective equations + mov ebx,points_rotated + .again_trans: + fild word[ebx] + fisub [xobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fiadd [xobs] + fistp word[ebx] + fild word[ebx+2] + fisub [yobs] + fimul [zobs] + fild word[ebx+4] + fisub [zobs] + fdivp + fchs + fiadd [yobs] + fistp word[ebx+2] + add ebx,6 + cmp dword[ebx],-1 + jne .again_trans +ret + + +copy_points: + mov esi,points + mov edi,points_rotated + mov ecx,points_count*3+2 + rep movsw +ret + + + +read_from_file: + mov edi,triangles + xor ebx,ebx + xor ebp,ebp + mov esi,SourceFile + cmp [esi],word 4D4Dh + jne .exit ;Must be legal .3DS file + cmp dword[esi+2],EndFile-SourceFile + jne .exit ;This must tell the length + add esi,6 + @@: + cmp [esi],word 3D3Dh + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + .find4k: + cmp [esi],word 4000h + je @f + add esi,[esi+2] + cmp esi,EndFile + jc .find4k + jmp .exit + @@: + add esi,6 + @@: + cmp [esi],byte 0 + je @f + inc esi + jmp @b + @@: + inc esi + @@: + cmp [esi],word 4100h + je @f + add esi,[esi+2] + jmp @b + @@: + add esi,6 + @@: + cmp [esi],word 4110h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [points_count_var],cx + mov edx,ecx + add esi,8 + @@: + fld dword[esi+4] + fmul [sscale] + fadd [xoffset] + fld dword[esi+8] + fchs + fmul [sscale] + fadd [yoffset] + fld dword[esi+0] + fchs + fmul [sscale] + fistp word[points+ebx+4] + fistp word[points+ebx+2] + fistp word[points+ebx+0] + add ebx,6 + add esi,12 + dec ecx + jnz @b + @@: + mov dword[points+ebx],-1 + @@: + cmp [esi],word 4120h + je @f + add esi,[esi+2] + jmp @b + @@: + movzx ecx,word[esi+6] + mov [triangles_count_var],cx + add esi,8 + ;mov edi,triangles + @@: + movsd + movsw + add word[edi-6],bp + add word[edi-4],bp + add word[edi-2],bp + add esi,2 + dec ecx + jnz @b + add ebp,edx + jmp .find4k + + .exit: + mov dword[edi],-1 +ret + + +; ********************************************* +; ******* WINDOW DEFINITIONS AND DRAW ******** +; ********************************************* +draw_window: + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,1 ; 1, start of draw + int 0x40 + + ; SKIN WIDTH + mov eax,48 + mov ebx,4 + int 0x40 + mov esi, eax + + ; DRAW WINDOW + mov eax,0 ; function 0 : define and draw window + mov ebx,100*65536+SIZE_X+9+80 ; [x start] *65536 + [x size] + mov ecx,100*65536+SIZE_Y+4 ; [y start] *65536 + [y size] + add ecx, esi + mov edx,0x74000000 ; color of work area RRGGBB,8->color gl + mov edi,labelt + int 0x40 + + ; BLACK BAR + mov eax,13 ; function 8 : define and draw button + mov ebx,SIZE_X*65536+80 ; [x start] *65536 + [x size] + mov ecx,0*65536+SIZE_Y ; [y start] *65536 + [y size] + mov edx,0 ; color RRGGBB + int 0x40 + + ; ROTARY BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,25*65536+12 ; [y start] *65536 + [y size] + mov edx,2 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; ROTARY LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelrot ; pointer to text beginning + mov esi,labelrotend-labelrot ; text length + int 0x40 + + ; DRAW MODE BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15)*65536+12 ; [y start] *65536 + [y size] + mov edx,3 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; DRAW MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+28+15 ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labeldrmod ; pointer to text beginning + mov esi,labeldrmodend-labeldrmod ; text length + int 0x40 + + ; SPEED BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*2)*65536+12 ; [y start] *65536 + [y size] + mov edx,4 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SPEED MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*2) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelspeedmod ; pointer to text beginning + mov esi,labelspeedmodend-labelspeedmod ; text length + int 0x40 + + ; SCALE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*3)*65536+12 ; [y start] *65536 + [y size] + mov edx,5 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SCALE- MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*3) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomout ; pointer to text beginning + mov esi,labelzoomoutend-labelzoomout ; text length + int 0x40 + + ; SCALE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*4)*65536+12 ; [y start] *65536 + [y size] + mov edx,6 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; SCALE+ MODE LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*4) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzoomin ; pointer to text beginning + mov esi,labelzoominend-labelzoomin ; text length + int 0x40 + ; ADD VECTOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*5) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelvector ; pointer to text beginning + mov esi,labelvectorend-labelvector ; text length + int 0x40 + ; VECTOR Y- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,7 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Y- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyminus ; pointer to text beginning + mov esi,labelyminusend-labelyminus ; text length + int 0x40 + ; VECTOR Z+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*6)*65536+12 ; [y start] *65536 + [y size] + mov edx,8 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Z+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*6) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzplus ; pointer to text beginning + mov esi,labelzplusend-labelzplus ; text length + int 0x40 + ; VECTOR x- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,9 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR x- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxminus ; pointer to text beginning + mov esi,labelxminusend-labelxminus ; text length + int 0x40 + ; VECTOR x+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*7)*65536+12 ; [y start] *65536 + [y size] + mov edx,10 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR x+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*7) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelxplus ; pointer to text beginning + mov esi,labelxplusend-labelxplus ; text length + int 0x40 + ; VECTOR z- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,11 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR z- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelzminus ; pointer to text beginning + mov esi,labelzminusend-labelzminus ; text length + int 0x40 + ;VECTOR Y+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*8)*65536+12 ; [y start] *65536 + [y size] + mov edx,12 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;VECTOR Y+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*8) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelyplus ; pointer to text beginning + mov esi,labelyplusend-labelyplus ; text length + int 0x40 + ; LEAD COLOR LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*9) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelmaincolor ; pointer to text beginning + mov esi,labelmaincolorend-labelmaincolor ; text length + int 0x40 + + ;RED+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,13 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredplus ; pointer to text beginning + mov esi,labelredplusend-labelredplus ; text length + int 0x40 + ;GREEN+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,14 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenplus ; pointer to text beginning + mov esi,labelgreenplusend-labelgreenplus ; text length + int 0x40 + ;BLUE+ BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*10)*65536+12 ; [y start] *65536 + [y size] + mov edx,15 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE+ LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*10) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueplus ; pointer to text beginning + mov esi,labelblueplusend-labelblueplus ; text length + int 0x40 + ;RED- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,16 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;RED- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelredminus ; pointer to text beginning + mov esi,labelredminusend-labelredminus ; text length + int 0x40 + ;GREEN- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+20)*65536+62-42 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,17 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;GREEN- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+20)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelgreenminus ; pointer to text beginning + mov esi,labelgreenminusend-labelgreenminus ; text length + int 0x40 + ;BLUE- BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10+41)*65536+62-41 ; [x start] *65536 + [x size] + mov ecx,(25+15*11)*65536+12 ; [y start] *65536 + [y size] + mov edx,18 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ;BLUE- LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12+41)*65536+(28+15*11) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelblueminus ; pointer to text beginning + mov esi,labelblueminusend-labelblueminus ; text length + int 0x40 + ; Catmull LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*12) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelcatmullmod ; pointer to text beginning + mov esi,labelcatmullmodend-labelcatmullmod ; text length + int 0x40 + ; on/off BUTTON + mov eax,8 ; function 8 : define and draw button + mov ebx,(SIZE_X+10)*65536+62 ; [x start] *65536 + [x size] + mov ecx,(25+15*13)*65536+12 ; [y start] *65536 + [y size] + mov edx,19 ; button id + mov esi,0x6688dd ; button color RRGGBB + int 0x40 + ; on/off LABEL + mov eax,4 ; function 4 : write text to window + mov ebx,(SIZE_X+12)*65536+(28+15*13) ; [x start] *65536 + [y start] + mov ecx,0x20ddeeff ; font 1 & color ( 0xF0RRGGBB ) + mov edx,labelonoff ; pointer to text beginning + mov esi,labelonoffend-labelonoff ; text length + int 0x40 + + + mov eax,12 ; function 12:tell os about windowdraw + mov ebx,2 ; 2, end of draw + int 0x40 + + ret + + + ; DATA AREA + i3 dw 3 + light_vector dd 0.0,0.0,-1.0 + ; debug_vector dd 0.0,2.0,2.0 ;--debug + ; debug_vector1 dd 0.0,0.0,0.0 + ; debug_points dw 1,1,1,3,4,20 + ; debug_dd dw ? + ; debug_dwd dd 65535 + ; debug_counter dw 0 + dot_max dd 1.0 ; dot product max and min + dot_min dd 0.0 + env_const dd 1.2 + correct_tex dw 255 + max_color_r dw 255 + max_color_g dw 25 + max_color_b dw 35 + xobs dw SIZE_X / 2 ;200 ;observer + yobs dw SIZE_Y / 2 ;200 ;coordinates + zobs dw -500 + + + angle_counter dw 0 + piD180 dd 0.017453292519943295769236907684886 + ; sq dd 0.70710678118654752440084436210485 + const6 dw 6,6,6,6 + xo dw 150;87 ; rotary point coodinates + zo dw 0 + yo dw 100 + xoffset dd 150.0 + yoffset dd 170.0 + sscale dd 8.0 ; real scale + vect_x dw 0 + vect_y dw 0 + vect_z dw 0 + + + r_flag db 0 ; rotary flag + dr_flag db 2 ; drawing mode flag + speed_flag db 0 + catmull_flag db 1 + SourceFile file 'hrt.3ds' + EndFile: + labelrot: + db 'rotary' + labelrotend: + labeldrmod: + db 'shd. mode' + labeldrmodend: + labelspeedmod: + db 'speed' + labelspeedmodend: + labelzoomout: + db 'zoom out' + labelzoomoutend: + labelzoomin: + db 'zoom in' + labelzoominend: + labelvector: + db 'add vector' + labelvectorend: + labelyminus: + db 'y -' + labelyminusend: + labelzplus: + db 'z +' + labelzplusend: + labelxminus: + db 'x -' + labelxminusend: + labelxplus: + db 'x +' + labelxplusend: + labelzminus: + db 'z -' + labelzminusend: + labelyplus: + db 'y +' + labelyplusend: + labelmaincolor: + db 'main color' + labelmaincolorend: + labelredplus: + db 'r +' + labelredplusend: + labelgreenplus: + db 'g +' + labelgreenplusend: + labelblueplus: + db 'b +' + labelblueplusend: + labelredminus: + db 'r -' + labelredminusend: + labelgreenminus: + db 'g -' + labelgreenminusend: + labelblueminus: + db 'b -' + labelblueminusend: + labelcatmullmod: + db 'catmull' + labelcatmullmodend: + labelonoff: + db 'on/off' + labelonoffend: + labelt: + db '3D Heart',0 +align 8 + @col dd ? + @y1 dw ? + @x1 dw ?;+8 + @y2 dw ? + @x2 dw ? + @y3 dw ? + @x3 dw ?;+16 + + @dx12 dd ? + @dx13 dd ?;+24 + @dx23 dd ? + + sinbeta dd ?;+32 + cosbeta dd ? + + xsub dw ? + zsub dw ?;+40 + ysub dw ? + + xx1 dw ? + yy1 dw ? + zz1 dw ?;+48 + xx2 dw ? + yy2 dw ? + zz2 dw ? + xx3 dw ?;+56 + yy3 dw ? + zz3 dw ? + scale dd ? ; help scale variable + ;screen dd ? ;pointer to screen buffer + triangles_count_var dw ? + points_count_var dw ? + + + point_index1 dw ? ;-\ + point_index2 dw ? ; } don't change order + point_index3 dw ? ;-/ + temp_col dw ? + high dd ? +align 8 + buffer dq ? + + ;err dd ? + drr dd ? + xx dd ? + yy dd ? + xst dd ? + yst dd ? +align 16 + points: + rw (EndFile-SourceFile)/12*3 + points_count = ($-points)/6 + triangles: + rw (EndFile-SourceFile)/12*3 + triangles_count = ($-triangles)/6 + +align 16 + points_rotated rw points_count*3 + 2 +align 16 + label trizdd dword + label trizdq qword + triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position +align 16 + triangles_normals rb triangles_count * 12 ; + point_normals rb points_count * 12 ;one 3dvector - triple float dword x,y,z +align 16 + point_normals_rotated rb points_count * 12 +align 16 + vectors rb 24 + points_color rb 6*points_count ; each color as word +; sorted_triangles rw triangles_count*3 + 2 +;align 16 + bumpmap rb TEXTURE_SIZE + 1 + envmap rb (TEXTURE_SIZE +1) * 3 + tex_points rb points_count * 4 ; bump_map points + ; each point word x, word y + screen rb SIZE_X * SIZE_Y * 3 ; screen buffer + Z_buffer rb SIZE_X * SIZE_Y * 4 + memStack rb 1000 ;memory area for stack + I_END: \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/b_procs.asm b/programs/demos/3dsheart/trunk/b_procs.asm new file mode 100644 index 0000000000..6d91ed8132 --- /dev/null +++ b/programs/demos/3dsheart/trunk/b_procs.asm @@ -0,0 +1,134 @@ +macro .comment +{ +init_envmap: ; create 512x512 env map +.temp equ word [ebp-2] + push ebp + mov ebp,esp + sub esp,2 + mov edi,envmap + fninit + + mov dx,-256 + .ie_ver: + mov cx,-256 + .ie_hor: + mov .temp,cx + fild .temp + fmul st,st0 + mov .temp,dx + fild .temp + fmul st,st0 + faddp + fsqrt + mov .temp,254 + fisubr .temp + fmul [env_const] + fistp .temp + mov ax,.temp + + or ax,ax + jge .ie_ok1 + xor ax,ax + jmp .ie_ok2 + .ie_ok1: + cmp ax,254 + jle .ie_ok2 + mov ax,254 + .ie_ok2: + push dx + mov bx,ax + mul [max_color_b] + shr ax,8 + stosb + mov ax,bx + mul [max_color_g] + shr ax,8 + stosb + mov ax,bx + mul [max_color_r] + shr ax,8 + stosb + pop dx + + inc cx + cmp cx,256 + jne .ie_hor + + inc dx + cmp dx,256 + jne .ie_ver + + mov esp,ebp + pop ebp +ret +} +calc_bumpmap: ; calculate random bumpmap +;--------------in edi _ pointer to TEX_X x TEX_Y bumpmap + push edi + mov ecx,TEXTURE_SIZE + @@: + push ecx + xor ecx,ecx + mov edx,255 + call random + stosb + pop ecx + loop @b + + pop edi + mov ecx,4 + .blur: + xor esi,esi + mov edx,TEXTURE_SIZE + xor eax,eax + xor ebx,ebx + @@: + mov ebp,esi + dec ebp + and ebp,TEXTURE_SIZE + mov al,byte[ebp+edi] + + mov ebp,esi + inc ebp + and ebp,TEXTURE_SIZE + mov bl,byte[ebp+edi] + add eax,ebx + + mov ebp,esi + sub ebp,TEX_X + and ebp,TEXTURE_SIZE + mov bl,byte[ebp+edi] + add eax,ebx + + mov ebp,esi + add ebp,TEX_X + and ebp,TEXTURE_SIZE + mov bl,byte[ebp+edi] + add eax,ebx + + shr eax,2 + mov byte[esi+edi],al + + inc esi + dec edx + jnz @b + + loop .blur +ret +random: +; in - ecx - min +; edx - max +; out - eax - random number + mov bx,[rand_seed] + add bx,0x9248 + ror bx,3 + mov [rand_seed],bx + + mov ax,dx + sub ax,cx + mul bx + mov ax,dx + add ax,cx + cwde +ret +rand_seed dw ? diff --git a/programs/demos/3dsheart/trunk/build.bat b/programs/demos/3dsheart/trunk/build.bat new file mode 100644 index 0000000000..c772ce5d00 --- /dev/null +++ b/programs/demos/3dsheart/trunk/build.bat @@ -0,0 +1 @@ +fasm 3dsheart.asm 3dsheart \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/bump3.asm b/programs/demos/3dsheart/trunk/bump3.asm new file mode 100644 index 0000000000..4db1fed748 --- /dev/null +++ b/programs/demos/3dsheart/trunk/bump3.asm @@ -0,0 +1,609 @@ +;------- Big thanks to majuma (www.majuma.xt.pl) for absolutelly great-- +;------- 13h mode demos ------------------------------------------------ + +bump_triangle: +;------------------in - eax - x1 shl 16 + y1 ----------- +;---------------------- ebx - x2 shl 16 + y2 ----------- +;---------------------- ecx - x3 shl 16 + y3 ----------- +;---------------------- edx - pointer to bump map ------ +;---------------------- esi - pointer to environment map +;---------------------- edi - pointer to screen buffer-- +;---------------------- stack : bump coordinates-------- +;---------------------- environment coordinates- +.b_x1 equ ebp+4 ; procedure don't save registers !!! +.b_y1 equ ebp+6 ; each coordinate as word +.b_x2 equ ebp+8 +.b_y2 equ ebp+10 +.b_x3 equ ebp+12 +.b_y3 equ ebp+14 +.e_x1 equ ebp+16 +.e_y1 equ ebp+18 +.e_x2 equ ebp+20 +.e_y2 equ ebp+22 +.e_x3 equ ebp+24 +.e_y3 equ ebp+26 + +.t_bmap equ dword[ebp-4] +.t_emap equ dword[ebp-8] +.x1 equ word[ebp-10] +.y1 equ word[ebp-12] +.x2 equ word[ebp-14] +.y2 equ word[ebp-16] +.x3 equ word[ebp-18] +.y3 equ word[ebp-20] + +.dx12 equ dword[ebp-24] +.dbx12 equ dword[ebp-28] +.dby12 equ dword[ebp-32] +.dex12 equ dword[ebp-36] +.dey12 equ dword[ebp-40] + +.dx13 equ dword[ebp-44] +.dbx13 equ dword[ebp-48] +.dby13 equ dword[ebp-52] +.dex13 equ dword[ebp-56] +.dey13 equ dword[ebp-60] + +.dx23 equ dword[ebp-64] +.dbx23 equ dword[ebp-68] +.dby23 equ dword[ebp-72] +.dex23 equ dword[ebp-76] +.dey23 equ dword[ebp-80] + +.cx1 equ dword[ebp-84] ; current variables +.cx2 equ dword[ebp-88] +.cbx1 equ dword[ebp-92] +.cbx2 equ dword[ebp-96] +.cby1 equ dword[ebp-100] +.cby2 equ dword[ebp-104] +.cex1 equ dword[ebp-108] +.cex2 equ dword[ebp-112] +.cey1 equ dword[ebp-116] +.cey2 equ dword[ebp-120] + + mov ebp,esp + push edx ; store bump map + push esi ; store e. map + ; sub esp,120 + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.b_x1] + xchg edx,dword[.b_x2] + mov dword[.b_x1],edx + mov edx,dword[.e_x1] + xchg edx,dword[.e_x2] + mov dword[.e_x1],edx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.b_x2] + xchg edx,dword[.b_x3] + mov dword[.b_x2],edx + mov edx,dword[.e_x2] + xchg edx,dword[.e_x3] + mov dword[.e_x2],edx + jmp .sort3 + .sort2: + push eax ; store triangle coords in variables + push ebx + push ecx + + mov edx,eax ; eax,ebx,ecx are ORd together into edx which means that + or edx,ebx ; if any *one* of them is negative a sign flag is raised + or edx,ecx + test edx,80000000h ; Check only X + jne .loop23_done + + cmp .x1,SIZE_X ; { + jg .loop23_done + cmp .x2,SIZE_X ; This can be optimized with effort + jg .loop23_done + cmp .x3,SIZE_X + jg .loop23_done ; { + + + mov bx,.y2 ; calc delta 12 + sub bx,.y1 + jnz .bt_dx12_make + mov ecx,5 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx12_done + .bt_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx12,eax + push eax + + mov ax,word[.b_x2] + sub ax,word[.b_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx12,eax + push eax + + mov ax,word[.b_y2] + sub ax,word[.b_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby12,eax + push eax + + mov ax,word[.e_x2] + sub ax,word[.e_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex12,eax + push eax + + mov ax,word[.e_y2] + sub ax,word[.e_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey12,eax + push eax + .bt_dx12_done: + + mov bx,.y3 ; calc delta13 + sub bx,.y1 + jnz .bt_dx13_make + mov ecx,5 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx13_done + .bt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx13,eax + push eax + + mov ax,word[.b_x3] + sub ax,word[.b_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx13,eax + push eax + + mov ax,word[.b_y3] + sub ax,word[.b_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby13,eax + push eax + + mov ax,word[.e_x3] + sub ax,word[.e_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex13,eax + push eax + + mov ax,word[.e_y3] + sub ax,word[.e_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey13,eax + push eax + .bt_dx13_done: + + mov bx,.y3 ; calc delta23 + sub bx,.y2 + jnz .bt_dx23_make + mov ecx,5 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx23_done + .bt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx23,eax + push eax + + mov ax,word[.b_x3] + sub ax,word[.b_x2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx23,eax + push eax + + mov ax,word[.b_y3] + sub ax,word[.b_y2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby23,eax + push eax + + mov ax,word[.e_x3] + sub ax,word[.e_x2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex23,eax + push eax + + mov ax,word[.e_y3] + sub ax,word[.e_y2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey23,eax + push eax + + ; sub esp,40 + .bt_dx23_done: + + movsx eax,.x1 + shl eax,ROUND + ; mov .cx1,eax + ; mov .cx2,eax + push eax + push eax + + movsx eax,word[.b_x1] + shl eax,ROUND + ; mov .cbx1,eax + ; mov .cbx2,eax + push eax + push eax + + movsx eax,word[.b_y1] + shl eax,ROUND + ; mov .cby1,eax + ; mov .cby2,eax + push eax + push eax + + movsx eax,word[.e_x1] + shl eax,ROUND + ;mov .cex1,eax + ;mov .cex2,eax + push eax + push eax + + movsx eax,word[.e_y1] + shl eax,ROUND + ;mov .cey1,eax + ;mov .cey2,eax + push eax + push eax + + movzx ecx,.y1 + cmp cx,.y2 + jge .loop12_done + .loop12: + call .call_bump_line + + mov eax,.dx13 + add .cx1,eax + mov eax,.dx12 + add .cx2,eax + + mov eax,.dbx13 + add .cbx1,eax + mov eax,.dbx12 + add .cbx2,eax + mov eax,.dby13 + add .cby1,eax + mov eax,.dby12 + add .cby2,eax + + mov eax,.dex13 + add .cex1,eax + mov eax,.dex12 + add .cex2,eax + mov eax,.dey13 + add .cey1,eax + mov eax,.dey12 + add .cey2,eax + + inc ecx + cmp cx,.y2 + jl .loop12 + .loop12_done: + movzx ecx,.y2 + cmp cx,.y3 + jge .loop23_done + + movzx eax,.x2 + shl eax,ROUND + mov .cx2,eax + + movzx eax,word[.b_x2] + shl eax,ROUND + mov .cbx2,eax + + movzx eax,word[.b_y2] + shl eax,ROUND + mov .cby2,eax + + movzx eax,word[.e_x2] + shl eax,ROUND + mov .cex2,eax + + movzx eax,word[.e_y2] + shl eax,ROUND + mov .cey2,eax + + .loop23: + call .call_bump_line + + mov eax,.dx13 + add .cx1,eax + mov eax,.dx23 + add .cx2,eax + + mov eax,.dbx13 + add .cbx1,eax + mov eax,.dbx23 + add .cbx2,eax + mov eax,.dby13 + add .cby1,eax + mov eax,.dby23 + add .cby2,eax + + mov eax,.dex13 + add .cex1,eax + mov eax,.dex23 + add .cex2,eax + mov eax,.dey13 + add .cey1,eax + mov eax,.dey23 + add .cey2,eax + + inc ecx + cmp cx,.y3 + jl .loop23 + .loop23_done: + mov esp,ebp +ret 24 + +.call_bump_line: + + ; push ebp + ; push ecx + pushad + + push .t_emap + push .t_bmap + push .cey2 + push .cex2 + push .cey1 + push .cex1 + push .cby2 + push .cbx2 + push .cby1 + push .cbx1 + push ecx + + mov eax,.cx1 + sar eax,ROUND + mov ebx,.cx2 + sar ebx,ROUND + + call bump_line + + popad +ret +bump_line: +;--------------in: eax - x1 +;-------------- ebx - x2 +;-------------- edi - pointer to screen buffer +;stack - another parameters : +.y equ dword [ebp+4] +.bx1 equ dword [ebp+8] ; --- +.by1 equ dword [ebp+12] ; | +.bx2 equ dword [ebp+16] ; | +.by2 equ dword [ebp+20] ; |> bump and env coords +.ex1 equ dword [ebp+24] ; |> shifted shl ROUND +.ey1 equ dword [ebp+28] ; | +.ex2 equ dword [ebp+32] ; | +.ey2 equ dword [ebp+36] ; --- +.bmap equ dword [ebp+40] +.emap equ dword [ebp+44] + +.x1 equ dword [ebp-4] +.x2 equ dword [ebp-8] +.dbx equ dword [ebp-12] +.dby equ dword [ebp-16] +.dex equ dword [ebp-20] +.dey equ dword [ebp-24] +.cbx equ dword [ebp-28] +.cby equ dword [ebp-32] +.cex equ dword [ebp-36] +.cey equ dword [ebp-40] + mov ebp,esp + + mov ecx,.y + or ecx,ecx + jl .bl_end + cmp ecx,SIZE_Y + jge .bl_end + + cmp eax,ebx + jl .bl_ok + je .bl_end + + xchg eax,ebx + + mov edx,.bx1 + xchg edx,.bx2 + mov .bx1,edx + mov edx,.by1 + xchg edx,.by2 + mov .by1,edx + + mov edx,.ex1 + xchg edx,.ex2 + mov .ex1,edx + mov edx,.ey1 + xchg edx,.ey2 + mov .ey1,edx + .bl_ok: + push eax + push ebx ;store x1, x2 + + mov eax,SIZE_X*3 + mov ebx,.y + mul ebx + mov ecx,.x1 + lea ecx,[ecx*3] + add eax,ecx + add edi,eax + + mov ecx,.x2 + sub ecx,.x1 + + mov eax,.bx2 ; calc .dbx + sub eax,.bx1 + cdq + idiv ecx + push eax + + mov eax,.by2 ; calc .dby + sub eax,.by1 + cdq + idiv ecx + push eax + + mov eax,.ex2 ; calc .dex + sub eax,.ex1 + cdq + idiv ecx + push eax + + mov eax,.ey2 ; calc .dey + sub eax,.ey1 + cdq + idiv ecx + push eax + + push .bx1 + push .by1 + push .ex1 + push .ey1 + .draw: + ; if TEX = SHIFTING ;bump drawing only in shifting mode + + mov eax,.cby + sar eax,ROUND + shl eax,TEX_SHIFT + mov esi,.cbx + sar esi,ROUND + add esi,eax + + mov ebx,esi + dec ebx + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx eax,byte [ebx] + + mov ebx,esi + inc ebx + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx ebx,byte [ebx] + sub eax,ebx + + mov ebx,esi + sub ebx,TEX_X + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx edx,byte [ebx] + + mov ebx,esi + add ebx,TEX_X + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx ebx,byte [ebx] + sub edx,ebx + + mov ebx,.cex ;.cex - current env map X + sar ebx,ROUND + add eax,ebx ; eax - modified x coord + + mov ebx,.cey ;.cey - current env map y + sar ebx,ROUND + add edx,ebx ; edx - modified y coord + + or eax,eax + jl .black + cmp eax,TEX_X + jg .black + or edx,edx + jl .black + cmp edx,TEX_Y + jg .black + + shl edx,TEX_SHIFT + add edx,eax + lea edx,[edx*3] + add edx,.emap + mov eax,dword[edx] + jmp .put_pixel + .black: + xor eax,eax + .put_pixel: + stosd + dec edi + + mov eax,.dbx + add .cbx,eax + mov eax,.dby + add .cby,eax + mov eax,.dex + add .cex,eax + mov eax,.dey + add .cey,eax + + dec ecx + jnz .draw + ; end if + .bl_end: + mov esp,ebp +ret 44 \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/bump_cat.ASM b/programs/demos/3dsheart/trunk/bump_cat.ASM new file mode 100644 index 0000000000..0673177a39 --- /dev/null +++ b/programs/demos/3dsheart/trunk/bump_cat.ASM @@ -0,0 +1,769 @@ +;SIZE_X equ 350 +;SIZE_Y equ 350 +ROUND equ 8 +;TEX_X equ 512 +;TEX_Y equ 512 +;TEXTURE_SIZE EQU (512*512)-1 +;TEX_SHIFT EQU 9 +CATMULL_SHIFT equ 8 +;TEXTURE_SIZE EQU (TEX_X * TEX_Y)-1 +;------- Big thanks to Majuma (www.majuma.xt.pl) for absolutely great--- +;------- DOS 13h mode demos -------------------------------------------- +;------- Procedure draws bump triangle using Catmull Z-buffer algorithm- +;------- (Z coordinate interpolation)----------------------------------- +bump_triangle_z: +;------------------in - eax - x1 shl 16 + y1 ----------- +;---------------------- ebx - x2 shl 16 + y2 ----------- +;---------------------- ecx - x3 shl 16 + y3 ----------- +;---------------------- edx - pointer to bump map ------ +;---------------------- esi - pointer to environment map +;---------------------- edi - pointer to screen buffer-- +;---------------------- stack : bump coordinates-------- +;---------------------- environment coordinates- +;---------------------- Z position coordinates-- +;---------------------- pointer io Z buffer----- +;-- Z-buffer - filled with coordinates as dword -------- +;-- (Z coor. as word) shl CATMULL_SHIFT ---------------- +.b_x1 equ ebp+4 ; procedure don't save registers !!! +.b_y1 equ ebp+6 ; each coordinate as word +.b_x2 equ ebp+8 +.b_y2 equ ebp+10 +.b_x3 equ ebp+12 +.b_y3 equ ebp+14 +.e_x1 equ ebp+16 +.e_y1 equ ebp+18 +.e_x2 equ ebp+20 +.e_y2 equ ebp+22 +.e_x3 equ ebp+24 +.e_y3 equ ebp+26 +.z1 equ word[ebp+28] +.z2 equ word[ebp+30] +.z3 equ word[ebp+32] +.z_buff equ dword[ebp+34] ; pointer to Z-buffer + + +.t_bmap equ dword[ebp-4] ; pointer to bump map +.t_emap equ dword[ebp-8] ; pointer to e. map +.x1 equ word[ebp-10] +.y1 equ word[ebp-12] +.x2 equ word[ebp-14] +.y2 equ word[ebp-16] +.x3 equ word[ebp-18] +.y3 equ word[ebp-20] + +.dx12 equ dword[ebp-24] +.dbx12 equ dword[ebp-28] +.dby12 equ dword[ebp-32] +.dex12 equ dword[ebp-36] +.dey12 equ dword[ebp-40] +.dz12 equ dword[ebp-44] + +.dx13 equ dword[ebp-48] +.dbx13 equ dword[ebp-52] +.dby13 equ dword[ebp-56] +.dex13 equ dword[ebp-60] +.dey13 equ dword[ebp-64] +.dz13 equ dword[ebp-68] + +.dx23 equ dword[ebp-72] +.dbx23 equ dword[ebp-76] +.dby23 equ dword[ebp-80] +.dex23 equ dword[ebp-84] +.dey23 equ dword[ebp-88] +.dz23 equ dword[ebp-92] + +.cx1 equ dword[ebp-96] ; current variables +.cx2 equ dword[ebp-100] +.cbx1 equ dword[ebp-104] +.cbx2 equ dword[ebp-108] +.cby1 equ dword[ebp-112] +.cby2 equ dword[ebp-116] +.cex1 equ dword[ebp-120] +.cex2 equ dword[ebp-124] +.cey1 equ dword[ebp-128] +.cey2 equ dword[ebp-132] +.cz1 equ dword[ebp-136] +.cz2 equ dword[ebp-140] + + mov ebp,esp + push edx ; store bump map + push esi ; store e. map + ; sub esp,120 + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.b_x1] + xchg edx,dword[.b_x2] + mov dword[.b_x1],edx + mov edx,dword[.e_x1] + xchg edx,dword[.e_x2] + mov dword[.e_x1],edx + mov dx,.z1 + xchg dx,.z2 + mov .z1,dx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.b_x2] + xchg edx,dword[.b_x3] + mov dword[.b_x2],edx + mov edx,dword[.e_x2] + xchg edx,dword[.e_x3] + mov dword[.e_x2],edx + mov dx,.z2 + xchg dx,.z3 + mov .z2,dx + jmp .sort3 + .sort2: + push eax ; store triangle coords in variables + push ebx + push ecx + + mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that + and edx,ebx ; if *all* of them are negative a sign flag is raised + and edx,ecx + and edx,eax + test edx,80008000h ; Check both X&Y at once + jne .loop23_done + ; mov edx,eax ; eax,ebx,ecx are ORd together into edx which means that + ; or edx,ebx ; if any *one* of them is negative a sign flag is raised + ; or edx,ecx + ; test edx,80000000h ; Check only X + ; jne .loop23_done + + ; cmp .x1,SIZE_X ; { + ; jg .loop23_done + ; cmp .x2,SIZE_X ; This can be optimized with effort + ; jg .loop23_done + ; cmp .x3,SIZE_X + ; jg .loop23_done ; { + + + mov bx,.y2 ; calc delta 12 + sub bx,.y1 + jnz .bt_dx12_make + mov ecx,6 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx12_done + .bt_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx12,eax + push eax + + mov ax,word[.b_x2] + sub ax,word[.b_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx12,eax + push eax + + mov ax,word[.b_y2] + sub ax,word[.b_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby12,eax + push eax + + mov ax,word[.e_x2] + sub ax,word[.e_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex12,eax + push eax + + mov ax,word[.e_y2] + sub ax,word[.e_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey12,eax + push eax + + mov ax,.z2 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + .bt_dx12_done: + + mov bx,.y3 ; calc delta13 + sub bx,.y1 + jnz .bt_dx13_make + mov ecx,6 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx13_done + .bt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx13,eax + push eax + + mov ax,word[.b_x3] + sub ax,word[.b_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx13,eax + push eax + + mov ax,word[.b_y3] + sub ax,word[.b_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby13,eax + push eax + + mov ax,word[.e_x3] + sub ax,word[.e_x1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex13,eax + push eax + + mov ax,word[.e_y3] + sub ax,word[.e_y1] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey13,eax + push eax + + ; nop here bug ????!!! + + mov ax,.z3 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + ; mov .dz13,eax + push eax + .bt_dx13_done: + + mov bx,.y3 ; calc delta23 + sub bx,.y2 + jnz .bt_dx23_make + mov ecx,6 + xor edx,edx + @@: + push edx ;dword 0 + loop @b + jmp .bt_dx23_done + .bt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx23,eax + push eax + + mov ax,word[.b_x3] + sub ax,word[.b_x2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dbx23,eax + push eax + + mov ax,word[.b_y3] + sub ax,word[.b_y2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dby23,eax + push eax + + mov ax,word[.e_x3] + sub ax,word[.e_x2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dex23,eax + push eax + + mov ax,word[.e_y3] + sub ax,word[.e_y2] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dey23,eax + push eax + + mov ax,.z3 + sub ax,.z2 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + ; mov .dz23,eax + push eax + ; sub esp,40 + .bt_dx23_done: + movsx eax,.x1 + shl eax,ROUND + ; mov .cx1,eax + ; mov .cx2,eax + push eax + push eax + + movsx eax,word[.b_x1] + shl eax,ROUND + ; mov .cbx1,eax + ; mov .cbx2,eax + push eax + push eax + + movsx eax,word[.b_y1] + shl eax,ROUND + ; mov .cby1,eax + ; mov .cby2,eax + push eax + push eax + + movsx eax,word[.e_x1] + shl eax,ROUND + ;mov .cex1,eax + ;mov .cex2,eax + push eax + push eax + + movsx eax,word[.e_y1] + shl eax,ROUND + ;mov .cey1,eax + ;mov .cey2,eax + push eax + push eax + + movsx eax,.z1 + shl eax,CATMULL_SHIFT + ;mov .cz1,eax + ;mov .cz2,eax + push eax + push eax + + movsx ecx,.y1 + cmp cx,.y2 + jge .loop12_done + .loop12: + call .call_bump_line + + mov eax,.dx13 + add .cx1,eax + mov eax,.dx12 + add .cx2,eax + + mov eax,.dbx13 + add .cbx1,eax + mov eax,.dbx12 + add .cbx2,eax + mov eax,.dby13 + add .cby1,eax + mov eax,.dby12 + add .cby2,eax + + mov eax,.dex13 + add .cex1,eax + mov eax,.dex12 + add .cex2,eax + mov eax,.dey13 + add .cey1,eax + mov eax,.dey12 + add .cey2,eax + + mov eax,.dz13 + add .cz1,eax + mov eax,.dz12 + add .cz2,eax + + inc ecx + cmp cx,.y2 + jl .loop12 + .loop12_done: + + movsx ecx,.y2 + cmp cx,.y3 + jge .loop23_done + + movsx eax,.z2 + shl eax,CATMULL_SHIFT + mov .cz2,eax + + movsx eax,.x2 + shl eax,ROUND + mov .cx2,eax + + movzx eax,word[.b_x2] + shl eax,ROUND + mov .cbx2,eax + + movzx eax,word[.b_y2] + shl eax,ROUND + mov .cby2,eax + + movzx eax,word[.e_x2] + shl eax,ROUND + mov .cex2,eax + + movzx eax,word[.e_y2] + shl eax,ROUND + mov .cey2,eax + + .loop23: + call .call_bump_line + + mov eax,.dx13 + add .cx1,eax + mov eax,.dx23 + add .cx2,eax + + mov eax,.dbx13 + add .cbx1,eax + mov eax,.dbx23 + add .cbx2,eax + mov eax,.dby13 + add .cby1,eax + mov eax,.dby23 + add .cby2,eax + + mov eax,.dex13 + add .cex1,eax + mov eax,.dex23 + add .cex2,eax + mov eax,.dey13 + add .cey1,eax + mov eax,.dey23 + add .cey2,eax + + mov eax,.dz13 + add .cz1,eax + mov eax,.dz23 + add .cz2,eax + + inc ecx + cmp cx,.y3 + jl .loop23 + .loop23_done: + + mov esp,ebp +ret 34 + +.call_bump_line: + + ; push ebp + ; push ecx + pushad + + push .cz1 + push .cz2 + push .z_buff + push .t_emap + push .t_bmap + push .cey2 + push .cex2 + push .cey1 + push .cex1 + push .cby2 + push .cbx2 + push .cby1 + push .cbx1 + push ecx + + mov eax,.cx1 + sar eax,ROUND + mov ebx,.cx2 + sar ebx,ROUND + + call bump_line_z + + popad +ret +bump_line_z: +;--------------in: eax - x1 +;-------------- ebx - x2 +;-------------- edi - pointer to screen buffer +;stack - another parameters : +.y equ dword [ebp+4] +.bx1 equ dword [ebp+8] ; --- +.by1 equ dword [ebp+12] ; | +.bx2 equ dword [ebp+16] ; | +.by2 equ dword [ebp+20] ; |> bump and env coords +.ex1 equ dword [ebp+24] ; |> shifted shl ROUND +.ey1 equ dword [ebp+28] ; | +.ex2 equ dword [ebp+32] ; | +.ey2 equ dword [ebp+36] ; --- +.bmap equ dword [ebp+40] +.emap equ dword [ebp+44] +.z_buff equ dword [ebp+48] +.z2 equ dword [ebp+52] ; -- |> z coords shifted +.z1 equ dword [ebp+56] ; -- shl CATMULL_SHIFT + +.x1 equ dword [ebp-4] +.x2 equ dword [ebp-8] +.dbx equ dword [ebp-12] +.dby equ dword [ebp-16] +.dex equ dword [ebp-20] +.dey equ dword [ebp-24] +.dz equ dword [ebp-28] +.cbx equ dword [ebp-32] +.cby equ dword [ebp-36] +.cex equ dword [ebp-40] +.cey equ dword [ebp-44] +.cz equ dword [ebp-48] +.czbuff equ dword [ebp-52] + mov ebp,esp + + mov ecx,.y + or ecx,ecx + jl .bl_end + cmp ecx,SIZE_Y + jge .bl_end + + cmp eax,ebx + jl .bl_ok + je .bl_end + + xchg eax,ebx + + mov edx,.bx1 + xchg edx,.bx2 + mov .bx1,edx + mov edx,.by1 + xchg edx,.by2 + mov .by1,edx + + mov edx,.ex1 + xchg edx,.ex2 + mov .ex1,edx + mov edx,.ey1 + xchg edx,.ey2 + mov .ey1,edx + + mov edx,.z1 + xchg edx,.z2 + mov .z1,edx + .bl_ok: + push eax + push ebx ;store x1, x2 + + cmp .x1,SIZE_X + jge .bl_end + cmp .x2,0 + jle .bl_end + + mov ebx,.x2 + sub ebx,.x1 + + mov eax,.bx2 ; calc .dbx + sub eax,.bx1 + cdq + idiv ebx + push eax + + mov eax,.by2 ; calc .dby + sub eax,.by1 + cdq + idiv ebx + push eax + + mov eax,.ex2 ; calc .dex + sub eax,.ex1 + cdq + idiv ebx + push eax + + mov eax,.ey2 ; calc .dey + sub eax,.ey1 + cdq + idiv ebx + push eax + + mov eax,.z2 ; calc .dz + sub eax,.z1 + cdq + idiv ebx + push eax + + cmp .x1,0 ; set correctly begin variable + jge @f ; CLIPPING ON FUNCTION + ; cutting triangle exceedes screen + mov ebx,.x1 + neg ebx + imul ebx ; eax = .dz * abs(.x1) + add .z1,eax + mov .x1,0 + + mov eax,.dbx + imul ebx + add .bx1,eax + + mov eax,.dby + imul ebx + add .by1,eax + + mov eax,.dex + imul ebx + add .ex1,eax + + mov eax,.dey + imul ebx + add .ey1,eax + @@: + cmp .x2,SIZE_X + jl @f + mov .x2,SIZE_X + @@: + mov eax,SIZE_X ;calc memory begin in buffers + mov ebx,.y + mul ebx + mov ebx,.x1 + add eax,ebx + mov ebx,eax + lea eax,[eax*3] + add edi,eax + mov esi,.z_buff ; z-buffer filled with dd variables + shl ebx,2 + add esi,ebx + + mov ecx,.x2 + sub ecx,.x1 + ; init current variables + push .bx1 + push .by1 + push .ex1 + push .ey1 + push .z1 ; current z shl CATMULL_SHIFT + push esi + .draw: + ; if TEX = SHIFTING ;bump drawing only in shifting mode + mov esi,.czbuff ; .czbuff current address in buffer + mov ebx,.cz ; .cz - cur z position + cmp ebx,dword[esi] + jge .skip + + mov eax,.cby + sar eax,ROUND + shl eax,TEX_SHIFT + mov esi,.cbx + sar esi,ROUND + add esi,eax + + mov ebx,esi + dec ebx + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx eax,byte [ebx] + + mov ebx,esi + inc ebx + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx ebx,byte [ebx] + sub eax,ebx + + mov ebx,esi + sub ebx,TEX_X + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx edx,byte [ebx] + + mov ebx,esi + add ebx,TEX_X + and ebx,TEXTURE_SIZE + add ebx,.bmap + movzx ebx,byte [ebx] + sub edx,ebx + + mov ebx,.cex ;.cex - current env map X + sar ebx,ROUND + add eax,ebx ; eax - modified x coord + + mov ebx,.cey ;.cey - current env map y + sar ebx,ROUND + add edx,ebx ; edx - modified y coord + + or eax,eax + jl .black + cmp eax,TEX_X + jg .black + or edx,edx + jl .black + cmp edx,TEX_Y + jg .black + + shl edx,TEX_SHIFT + add edx,eax + lea edx,[edx*3] + add edx,.emap + mov eax,dword[edx] + jmp .put_pixel + .black: + xor eax,eax + .put_pixel: + stosd + dec edi + mov ebx,.cz + mov esi,.czbuff + mov dword[esi],ebx + jmp .no_skip + .skip: + add edi,3 + .no_skip: + add .czbuff,4 + mov eax,.dbx + add .cbx,eax + mov eax,.dby + add .cby,eax + mov eax,.dex + add .cex,eax + mov eax,.dey + add .cey,eax + mov eax,.dz + add .cz,eax + + dec ecx + jnz .draw + ; end if + .bl_end: + mov esp,ebp +ret 56 \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/flat3.asm b/programs/demos/3dsheart/trunk/flat3.asm new file mode 100644 index 0000000000..a2253bcba9 --- /dev/null +++ b/programs/demos/3dsheart/trunk/flat3.asm @@ -0,0 +1,188 @@ +draw_triangle: + ;----------in - eax - x1 shl 16 + y1 + ;------------- -ebx - x2 shl 16 + y2 + ;---------------ecx - x3 shl 16 + y3 + ;---------------edx - color 0x00rrggbb + ;---------------edi - pointer to screen buffer + @ch3: + cmp ax,bx + jg @ch1 + @ch4: ; sort parameters + cmp bx,cx + jg @ch2 + jle @chEnd + @ch1: + xchg eax,ebx + jmp @ch4 + @ch2: + xchg ebx,ecx + jmp @ch3 + @chEnd: + mov dword[@y1],eax ; ....and store to user friendly variables + mov dword[@y2],ebx + mov dword[@y3],ecx + mov [@col],edx + mov edx,eax ; eax,ebx,ecx are ORd together into edx which means that + or edx,ebx ; if any *one* of them is negative a sign flag is raised + or edx,ecx + test edx,80008000h ; Check both X&Y at once + jne @end_triangle + + cmp [@x1],SIZE_X ; { + jg @end_triangle + cmp [@x2],SIZE_X ; This can be optimized with effort + jg @end_triangle + cmp [@x3],SIZE_X + jg @end_triangle ; } + + shr eax,16 + shr ebx,16 + shr ecx,16 + + neg ax ; calculate delta 12 + add ax,bx + cwde + shl eax,ROUND + cdq + mov bx,[@y2] + mov cx,[@y1] + sub bx,cx + ;cmp ebx,0 + jne @noZero1 + mov [@dx12],0 + jmp @yesZero1 + @noZero1: + idiv ebx + mov [@dx12],eax + @yesZero1: + + mov ax,[@x3] ; calculate delta 13 + sub ax,[@x1] + cwde + shl eax,ROUND + cdq + mov bx,[@y3] + mov cx,[@y1] + sub bx,cx + ;cmp ebx,0 + jne @noZero2 + mov [@dx13],0 + jmp @yesZero2 + @noZero2: + idiv ebx + mov [@dx13],eax + @yesZero2: + + mov ax,[@x3] ; calculate delta 23 [dx23] + sub ax,[@x2] + cwde + shl eax,ROUND + cdq + mov bx,[@y3] + mov cx,[@y2] + sub bx,cx + ;cmp ebx,0 + jne @noZero3 + mov [@dx23],0 + jmp @yesZero3 + @noZero3: + idiv ebx + mov [@dx23],eax + @yesZero3: + + movzx eax,word[@x1] ; eax - xk1 + shl eax,ROUND + mov ebx,eax ; ebx - xk2 + movzx esi,word[@y1] ; esi - y + @next_line1: + mov ecx,eax ; ecx - x11 + sar ecx,ROUND + mov edx,ebx ; edx - x12 + sar edx,ROUND + cmp ecx,edx + jle @nochg + xchg ecx,edx + @nochg: + pusha + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + mov eax,[@col] + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx12] + inc esi + cmp si,[@y2] + jl @next_line1 + + movzx esi,word[@y2] + movzx ebx,word[@x2] + shl ebx,ROUND + @next_line2: + mov ecx,eax + sar ecx,ROUND + mov edx,ebx + sar edx,ROUND + cmp ecx,edx + jle @nochg1 + xchg ecx,edx + @nochg1: + pusha + mov ebx,ecx + sub edx,ecx + mov ecx,edx + mov edx,esi + mov eax,[@col] + call @horizontal_line + popa + add eax,[@dx13] + add ebx,[@dx23] + inc esi + cmp si,[@y3] + jl @next_line2 + @end_triangle: +ret + +@horizontal_line: + ;---------in + ;---------eax - color of line, 0x00RRGGBB + ;---------ebx - x1 - x position of line begin + ;---------ecx - lenght of line + ;---------edx - y position of line + ;---------edi - pointer to buffer + jcxz @end_hor_l +; or edx,edx +; jl @end_hor_l + cmp edx,SIZE_Y + jg @end_hor_l + push eax + mov eax,SIZE_X*3 + mul edx + add edi,eax ; calculate line begin adress + ;add edi,ebx + ;shl ebx,1 + lea edi,[edi+ebx*2] + add edi,ebx + pop eax + cld + ;mov dword[edi-3],0000FF00h + @ddraw: ; Drawing horizontally: + ;push eax + stosd ; 4 bytes at a time + dec edi ; point to the 4th + ;shr eax,16 + ;stosb + ;pop eax + ;pusha ; If you want to draw pixel-by-pixel + ; mov eax,7 ; put image + ; mov ebx,screen + ; mov ecx,SIZE_X shl 16 + SIZE_Y + ; mov edx,5 shl 16 + 20 + ; int 0x40 + ;popa + loop @ddraw + mov byte[edi],0 ; The last 4th will be reset + @end_hor_l: +ret diff --git a/programs/demos/3dsheart/trunk/flat_cat.ASM b/programs/demos/3dsheart/trunk/flat_cat.ASM new file mode 100644 index 0000000000..c07458ecc9 --- /dev/null +++ b/programs/demos/3dsheart/trunk/flat_cat.ASM @@ -0,0 +1,342 @@ +CATMULL_SHIFT equ 16 +fill_Z_buffer: + mov eax,0x70000000 + mov edi,Z_buffer + mov ecx,SIZE_X*SIZE_Y + rep stosd +ret +flat_triangle_z: +; procedure drawing triangle with Z cordinate interpolation ------ +; (Catmull alghoritm)-------------------------------------------- +; ----------------in - eax - x1 shl 16 + y1 ---------------------- +; -------------------- ebx - x2 shl 16 + y2 ---------------------- +; -------------------- ecx - x3 shl 16 + y3 ---------------------- +; -------------------- edx - color 0x00RRGGBB -------------------- +; -------------------- esi - pointer to Z-buffer ----------------- +; -------------------- edi - pointer to screen buffer------------- +; -------------------- stack : z coordinates +; -------------------- Z-buffer : each z variable as dword +; -------------------- (Z coor. as word) shl CATMULL_SHIFT +.z1 equ word[ebp+4] +.z2 equ word[ebp+6] ; each z coordinate as word integer +.z3 equ word[ebp+8] + +.col equ dword[ebp-4] +.x1 equ word[ebp-6] +.y1 equ word[ebp-8] +.x2 equ word[ebp-10] +.y2 equ word[ebp-12] +.x3 equ word[ebp-14] +.y3 equ word[ebp-16] + +.dx12 equ dword[ebp-20] +.dz12 equ dword[ebp-24] +.dx13 equ dword[ebp-28] +.dz13 equ dword[ebp-32] +.dx23 equ dword[ebp-36] +.dz23 equ dword[ebp-40] +.zz1 equ dword[ebp-44] +.zz2 equ dword[ebp-48] + + mov ebp,esp + push edx ; store edx in variable .col + .sort2: + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov dx,.z1 + xchg dx,.z2 + mov .z1,dx + .sort1: + cmp bx,cx + jle .sort3 + xchg ebx,ecx + mov dx,.z2 + xchg dx,.z3 + mov .z2,dx + jmp .sort2 + .sort3: + push eax ; store triangle coordinates in user friendly variables + push ebx + push ecx + mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that + and edx,ebx ; if *all* of them are negative a sign flag is raised + and edx,ecx + and edx,eax + test edx,80008000h ; Check both X&Y at once + jne .ft_loop2_end + ; cmp ax,SIZE_Y + ; jle @f + ; cmp bx,SIZE_Y + ; jle @f + ; cmp cx,SIZE_Y + ; jge @f + ; ror eax,16 + ; ror ebx,16 + ; ror ecx,16 + ; cmp ax,SIZE_X + ; jle @f + ; cmp bx,SIZE_X + ; jle @f + ; cmp cx,SIZE_X + ; jle @f + ; jmp .ft_loop2_end + ;@@: + sub esp,32 + + mov bx,.y2 ; calc delta 12 + sub bx,.y1 + jnz .ft_dx12_make + mov .dx12,0 + mov .dz12,0 + jmp .ft_dx12_done + .ft_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx12,eax + + mov ax,.z2 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz12,eax + .ft_dx12_done: + mov bx,.y3 ; calc delta 13 + sub bx,.y1 + jnz .ft_dx13_make + mov .dx13,0 + mov .dz13,0 + jmp .ft_dx13_done + .ft_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx13,eax + + mov ax,.z3 + sub ax,.z1 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz13,eax + .ft_dx13_done: + mov bx,.y3 ; calc delta 23 + sub bx,.y2 + jnz .gt_dx23_make + mov .dx23,0 + mov .dz23,0 + jmp .gt_dx23_done + .gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx23,eax + + mov ax,.z3 + sub ax,.z2 + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + mov .dz23,eax + .gt_dx23_done: + + movsx edx,.z1 + shl edx,CATMULL_SHIFT + mov .zz1,edx + mov .zz2,edx + movsx eax,.x1 + shl eax,ROUND ; eax - x1 + mov ebx,eax ; ebx - x2 + mov cx,.y1 + cmp cx,.y2 + jge .ft_loop1_end + .ft_loop1: + + pushad + + push .col + push cx ; y + sar ebx,ROUND + push bx ; x2 + sar eax,ROUND + push ax ; x1 + push .zz2 ; z2 shl CATMULL_SHIFT + push .zz1 ; z1 shl CATMULL_SHIFT + call flat_line_z + + popad + + add eax,.dx13 + add ebx,.dx12 + mov edx,.dz13 + add .zz1,edx + mov edx,.dz12 + add .zz2,edx + inc cx + cmp cx,.y2 + jl .ft_loop1 + .ft_loop1_end: + + movsx edx,.z2 + shl edx,CATMULL_SHIFT + mov .zz2,edx + movsx ebx,.x2 + shl ebx,ROUND + mov cx,.y2 + cmp cx,.y3 + jge .ft_loop2_end + .ft_loop2: + pushad + + push .col + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax ; x1 + push .zz2 ; z2 shl CATMULL_SHIFT + push .zz1 ; z1 shl CATMULL_SHIFT + call flat_line_z + + popad + + add eax,.dx13 + add ebx,.dx23 + mov edx,.dz13 + add .zz1,edx + mov edx,.dz23 + add .zz2,edx + inc cx + cmp cx,.y3 + jl .ft_loop2 + .ft_loop2_end: + + mov esp,ebp +ret 6 + +flat_line_z: +;---------------- +;-------------in edi - pointer to screen buffer ---------------------------------- +;--------------- esi - pointer to z-buffer (each Z varible dword)----------------- +;----------stack - (each z coordinate shifted shl CATMULL_SHIFT)------------------ +.z1 equ dword [ebp+4] +.z2 equ dword [ebp+8] +.x1 equ word [ebp+12] +.x2 equ word [ebp+14] +.y equ word [ebp+16] +.col equ dword [ebp+18] + +.dz equ dword [ebp-4] + + mov ebp,esp +;; sub esp,4 + mov ax,.y + or ax,ax + jl .fl_quit + cmp ax,SIZE_Y-1 + jg .fl_quit + + ; cmp .x1,0 + ; jge .fl_ok1 + ; cmp .x2,0 + ; jl .fl_quit + ; .fl_ok1: + ; cmp .x1,SIZE_X + ; jle .fl_ok2 + ; cmp .x2,SIZE_X + ; jg .fl_quit + ; .fl_ok2: + mov ax,.x1 + cmp ax,.x2 + je .fl_quit + jl .fl_ok + + xchg ax,.x2 + mov .x1,ax + mov edx,.z1 + xchg edx,.z2 + mov .z1,edx + .fl_ok: + cmp .x1,SIZE_X-1 + jg .fl_quit + cmp .x2,0 + jle .fl_quit + + mov eax,.z2 + sub eax,.z1 + cdq + mov bx,.x2 + sub bx,.x1 + movsx ebx,bx + idiv ebx +;; mov .dz,eax ; calculated delta - shifted .dz + push eax + + cmp .x1,0 + jge @f + movsx ebx,.x1 + neg ebx + imul ebx + add .z1,eax + mov .x1,0 + @@: + cmp .x2,SIZE_X + jl @f + mov .x2,SIZE_X + @@: + mov edx,SIZE_X + movsx eax,.y + mul edx ; edi = edi + (SIZE_X * y + x1)*3 + movsx edx,.x1 + add eax,edx + push eax + lea eax,[eax*3] + add edi,eax ; esi = esi + (SIZE_X * y + x1)*4 + pop eax + shl eax,2 + add esi,eax + + mov cx,.x2 + sub cx,.x1 + movzx ecx,cx + + mov eax,.col + mov ebx,.z1 ; ebx : curr. z + mov edx,.dz + .ddraw: + ;pushad + ;show + ;popad + cmp ebx,dword[esi] + jge .skip + stosd + dec edi + mov dword[esi],ebx + jmp .no_skip + .skip: + add edi,3 + .no_skip: + add esi,4 + add ebx,edx + loop .ddraw + + .fl_quit: + mov esp,ebp +ret 18 diff --git a/programs/demos/3dsheart/trunk/grd3.asm b/programs/demos/3dsheart/trunk/grd3.asm new file mode 100644 index 0000000000..ade6e1be47 --- /dev/null +++ b/programs/demos/3dsheart/trunk/grd3.asm @@ -0,0 +1,481 @@ +gouraud_triangle: +;------------------in - eax - x1 shl 16 + y1 --------- +;---------------------- ebx - x2 shl 16 + y2 --------- +;---------------------- ecx - x3 shl 16 + y3 --------- +;---------------------- edi - pointer to screen buffer +;---------------------- stack : colors---------------- +;----------------- procedure don't save registers !!-- +.col1r equ ebp+4 ; each color as word +.col1g equ ebp+6 +.col1b equ ebp+8 +.col2r equ ebp+10 +.col2g equ ebp+12 +.col2b equ ebp+14 +.col3r equ ebp+16 +.col3g equ ebp+18 +.col3b equ ebp+20 + +.x1 equ word[ebp-2] +.y1 equ word[ebp-4] +.x2 equ word[ebp-6] +.y2 equ word[ebp-8] +.x3 equ word[ebp-10] +.y3 equ word[ebp-12] + +.dc12r equ dword[ebp-16] +.dc12g equ dword[ebp-20] +.dc12b equ dword[ebp-24] +.dc13r equ dword[ebp-28] +.dc13g equ dword[ebp-32] +.dc13b equ dword[ebp-36] +.dc23r equ dword[ebp-40] +.dc23g equ dword[ebp-44] +.dc23b equ dword[ebp-48] + +.c1r equ dword[ebp-52] +.c1g equ dword[ebp-56] +.c1b equ dword[ebp-60] +.c2r equ dword[ebp-64] +.c2g equ dword[ebp-68] +.c2b equ dword[ebp-72] + +.dx12 equ dword[ebp-76] +.dx13 equ dword[ebp-80] +.dx23 equ dword[ebp-84] + + + + mov ebp,esp +; sub esp,72 + + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.col1r] + xchg edx,dword[.col2r] + mov dword[.col1r],edx + mov dx,word[.col1b] + xchg dx,word[.col2b] + mov word[.col1b],dx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.col2r] + xchg edx,dword[.col3r] + mov dword[.col2r],edx + mov dx,word[.col2b] + xchg dx,word[.col3b] + mov word[.col2b],dx + jmp .sort3 + .sort2: + push eax ;store triangle coordinates in user friendly variables + push ebx + push ecx + sub esp,72 ; set correctly value of esp + + mov edx,eax ; check only X triangle coordinate + or edx,ebx + or edx,ecx + test edx,80000000h + jne .gt_loop2_end + shr eax,16 + cmp ax,SIZE_X-1 + jg .gt_loop2_end + shr ebx,16 + cmp bx,SIZE_X-1 + jg .gt_loop2_end + shr ecx,16 + cmp cx,SIZE_X-1 + jg .gt_loop2_end + + + mov bx,.y2 ; calc deltas + sub bx,.y1 + jnz .gt_dx12_make + mov .dx12,0 + mov .dc12r,0 + mov .dc12g,0 + mov .dc12b,0 + jmp .gt_dx12_done + .gt_dx12_make: + + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx12,eax + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12r,eax + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12g,eax + mov ax,word[.col2b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc12b,eax +.gt_dx12_done: + + mov bx,.y3 + sub bx,.y1 + jnz .gt_dx13_make + mov .dx13,0 + mov .dc13r,0 + mov .dc13g,0 + mov .dc13b,0 + jmp .gt_dx13_done +.gt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx13,eax + + mov ax,word[.col3r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13r,eax + mov ax,word[.col3g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13g,eax + mov ax,word[.col3b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc13b,eax +.gt_dx13_done: + + mov bx,.y3 + sub bx,.y2 + jnz .gt_dx23_make + mov .dx23,0 + mov .dc23r,0 + mov .dc23g,0 + mov .dc23b,0 + jmp .gt_dx23_done +.gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + mov .dx23,eax + + mov ax,word[.col3r] + sub ax,word[.col2r] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23r,eax + mov ax,word[.col3g] + sub ax,word[.col2g] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23g,eax + mov ax,word[.col3b] + sub ax,word[.col2b] + cwde + shl eax,ROUND + cdq + idiv ebx + mov .dc23b,eax +.gt_dx23_done: + + movsx eax,.x1 + shl eax,ROUND + mov ebx,eax + movsx edx,word[.col1r] + shl edx,ROUND + mov .c1r,edx + mov .c2r,edx + movsx edx,word[.col1g] + shl edx,ROUND + mov .c1g,edx + mov .c2g,edx + movsx edx,word[.col1b] + shl edx,ROUND + mov .c1b,edx + mov .c2b,edx + mov cx,.y1 + cmp cx,.y2 + jge .gt_loop1_end +.gt_loop1: + push eax ; eax - cur x1 + push ebx ; ebx - cur x2 + push cx ; cx - cur y + push edi + push ebp + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax + call gouraud_line + + pop ebp + pop edi + pop cx + pop ebx + pop eax + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc12r + add .c2r,edx + mov edx,.dc12g + add .c2g,edx + mov edx,.dc12b + add .c2b,edx + + add eax,.dx13 + add ebx,.dx12 + inc cx + cmp cx,.y2 + jl .gt_loop1 +.gt_loop1_end: + + mov cx,.y2 + cmp cx,.y3 + jge .gt_loop2_end + movsx ebx,.x2 + shl ebx,ROUND + + movsx edx,word[.col2r] + shl edx,ROUND + mov .c2r,edx + movsx edx,word[.col2g] + shl edx,ROUND + mov .c2g,edx + movsx edx,word[.col2b] + shl edx,ROUND + mov .c2b,edx +.gt_loop2: + push eax ; eax - cur x1 + push ebx ; ebx - cur x2 + push cx + push edi + push ebp + + mov edx,.c2r + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + push cx + sar ebx,ROUND + push bx + sar eax,ROUND + push ax + call gouraud_line + + pop ebp + pop edi + pop cx + pop ebx + pop eax + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc23r + add .c2r,edx + mov edx,.dc23g + add .c2g,edx + mov edx,.dc23b + add .c2b,edx + + add eax,.dx13 + add ebx,.dx23 + inc cx + cmp cx,.y3 + jl .gt_loop2 +.gt_loop2_end: + + ; add esp,84 + mov esp,ebp +ret 18 +gouraud_line: +;-------------in - edi - pointer to screen buffer +;----------------- stack - another parameters +.x1 equ word [ebp+4] +.x2 equ word [ebp+6] +.y equ word [ebp+8] +.col1b equ ebp+10 +.col1g equ ebp+12 +.col1r equ ebp+14 +.col2b equ ebp+16 +.col2g equ ebp+18 +.col2r equ ebp+20 +.dc_r equ dword[ebp-4] +.dc_g equ dword[ebp-8] +.dc_b equ dword[ebp-12] + mov ebp,esp + + mov ax,.y + or ax,ax + jl .gl_quit + cmp ax,SIZE_Y-1 + jg .gl_quit + + mov ax,.x1 + cmp ax,.x2 + je .gl_quit + jl .gl_ok + + xchg ax,.x2 + mov .x1,ax + mov eax,dword[.col1b] + xchg eax,dword[.col2b] + mov dword[.col1b],eax + mov ax,word[.col1r] + xchg ax,word[.col2r] + mov word[.col1r],ax +.gl_ok: + ; cmp .x1,SIZE_X-1 ;check + ; jg .gl_quit + ; cmp .x2,SIZE_X-1 + ; jl @f + ; mov .x2,SIZE_X-1 + ; @@: + ; cmp .x1,0 + ; jg @f + ; mov .x1,0 + ; @@: + ; cmp .x2,0 + ; jl .gl_quit + + movsx ecx,.y + mov eax,SIZE_X*3 + mul ecx + movsx ebx,.x1 + lea ecx,[ebx*2+eax] + add edi,ecx + add edi,ebx + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + mov cx,.x2 + sub cx,.x1 + movsx ecx,cx + idiv ecx + ;mov .dc_r,eax ;first delta + push eax + + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ecx + ;mov .dc_g,eax + push eax + + mov ax,word[.col2b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ecx + ; mov .dc_b,eax + push eax + + movsx ebx,word[.col1r] + shl ebx,ROUND + movsx edx,word[.col1g] + shl edx,ROUND + movsx esi,word[.col1b] + shl esi,ROUND +.gl_draw: + mov eax,ebx + sar eax,ROUND + stosb + mov eax,edx + sar eax,ROUND + stosb + mov eax,esi + sar eax,ROUND + stosb + add ebx,.dc_r + add edx,.dc_g + add esi,.dc_b + loop .gl_draw +.gl_quit: + ; add esp,12 + mov esp,ebp +ret 18 \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/grd_cat.ASM b/programs/demos/3dsheart/trunk/grd_cat.ASM new file mode 100644 index 0000000000..b60953821f --- /dev/null +++ b/programs/demos/3dsheart/trunk/grd_cat.ASM @@ -0,0 +1,598 @@ +ROUND equ 8 +CATMULL_SHIFT equ 8 +gouraud_triangle_z: +;----procedure drawing gouraud triangle with z coordinate +;----interpolation ( Catmull alghoritm )----------------- +;------------------in - eax - x1 shl 16 + y1 ------------ +;---------------------- ebx - x2 shl 16 + y2 ------------ +;---------------------- ecx - x3 shl 16 + y3 ------------ +;---------------------- esi - pointer to Z-buffer-------- +;---------------------- Z-buffer filled with dd variables +;---------------------- shifted CATMULL_SHIFT------------ +;---------------------- edi - pointer to screen buffer--- +;---------------------- stack : colors------------------- +;----------------- procedure don't save registers !!----- +.col1r equ ebp+4 ; each color as word +.col1g equ ebp+6 ; each z coordinate as word +.col1b equ ebp+8 +.z1 equ ebp+10 +.col2r equ ebp+12 +.col2g equ ebp+14 +.col2b equ ebp+16 +.z2 equ ebp+18 +.col3r equ ebp+20 +.col3g equ ebp+22 +.col3b equ ebp+24 +.z3 equ ebp+26 + +.x1 equ word[ebp-2] +.y1 equ word[ebp-4] +.x2 equ word[ebp-6] +.y2 equ word[ebp-8] +.x3 equ word[ebp-10] +.y3 equ word[ebp-12] + +.dx12 equ dword[ebp-16] +.dz12 equ dword[ebp-20] +.dc12r equ dword[ebp-24] +.dc12g equ dword[ebp-28] +.dc12b equ dword[ebp-32] + +.dx13 equ dword[ebp-36] +.dz13 equ dword[ebp-40] +.dc13r equ dword[ebp-44] +.dc13g equ dword[ebp-48] +.dc13b equ dword[ebp-52] + +.dx23 equ dword[ebp-56] +.dz23 equ dword[ebp-60] +.dc23r equ dword[ebp-64] +.dc23g equ dword[ebp-68] +.dc23b equ dword[ebp-72] + +.c1r equ dword[ebp-76] +.c1g equ dword[ebp-80] +.c1b equ dword[ebp-84] +.c2r equ dword[ebp-88] +.c2g equ dword[ebp-92] +.c2b equ dword[ebp-96] +.zz1 equ dword[ebp-100] +.zz2 equ dword[ebp-104] + + mov ebp,esp + ; sub esp,84 + .sort3: ; sort triangle coordinates... + cmp ax,bx + jle .sort1 + xchg eax,ebx + mov edx,dword[.col1r] + xchg edx,dword[.col2r] + mov dword[.col1r],edx + mov edx,dword[.col1b] + xchg edx,dword[.col2b] + mov dword[.col1b],edx + .sort1: + cmp bx,cx + jle .sort2 + xchg ebx,ecx + mov edx,dword[.col2r] + xchg edx,dword[.col3r] + mov dword[.col2r],edx + mov edx,dword[.col2b] + xchg edx,dword[.col3b] + mov dword[.col2b],edx + jmp .sort3 + .sort2: + push eax ; store in variables + push ebx + push ecx + mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that + and edx,ebx ; if *all* of them are negative a sign flag is raised + and edx,ecx + and edx,eax + test edx,80008000h ; Check both X&Y at once + jne .gt_loop2_end + + mov bx,.y2 ; calc deltas + sub bx,.y1 + jnz .gt_dx12_make + ; mov .dx12,0 + ; mov .dz12,0 + ; mov .dc12r,0 + ; mov .dc12g,0 + ; mov .dc12b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx12_done + .gt_dx12_make: + mov ax,.x2 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx12,eax + push eax + + mov ax,word[.z2] + sub ax,word[.z1] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col2r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12r,eax + push eax + mov ax,word[.col2g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12g,eax + push eax + mov ax,word[.col2b] ;;--- + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc12b,eax + push eax + .gt_dx12_done: + + mov bx,.y3 ; calc deltas + sub bx,.y1 + jnz .gt_dx13_make + ; mov .dx13,0 + ; mov .dz13,0 + ; mov .dc13r,0 + ; mov .dc13g,0 + ; mov .dc13b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx13_done + .gt_dx13_make: + mov ax,.x3 + sub ax,.x1 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx13,eax + push eax + + mov ax,word[.z3] + sub ax,word[.z1] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col3r] + sub ax,word[.col1r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13r,eax + push eax + mov ax,word[.col3g] + sub ax,word[.col1g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13g,eax + push eax + mov ax,word[.col3b] + sub ax,word[.col1b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc13b,eax + push eax + .gt_dx13_done: + + mov bx,.y3 ; calc deltas + sub bx,.y2 + jnz .gt_dx23_make + ; mov .dx23,0 + ; mov .dz23,0 + ; mov .dc23r,0 + ; mov .dc23g,0 + ; mov .dc23b,0 + mov ecx,5 + @@: + push dword 0 + loop @b + jmp .gt_dx23_done + .gt_dx23_make: + mov ax,.x3 + sub ax,.x2 + cwde + movsx ebx,bx + shl eax,ROUND + cdq + idiv ebx + ; mov .dx23,eax + push eax + + mov ax,word[.z3] + sub ax,word[.z2] + cwde + shl eax,CATMULL_SHIFT + cdq + idiv ebx + push eax + + mov ax,word[.col3r] + sub ax,word[.col2r] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23r,eax + push eax + mov ax,word[.col3g] + sub ax,word[.col2g] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23g,eax + push eax + mov ax,word[.col3b] + sub ax,word[.col2b] + cwde + shl eax,ROUND + cdq + idiv ebx + ; mov .dc23b,eax + push eax + .gt_dx23_done: + sub esp,32 + + movsx eax,.x1 ; eax - cur x1 + shl eax,ROUND ; ebx - cur x2 + mov ebx,eax + movsx edx,word[.z1] + shl edx,CATMULL_SHIFT + mov .zz1,edx + mov .zz2,edx + movzx edx,word[.col1r] + shl edx,ROUND + mov .c1r,edx + mov .c2r,edx + movzx edx,word[.col1g] + shl edx,ROUND + mov .c1g,edx + mov .c2g,edx + movzx edx,word[.col1b] + shl edx,ROUND + mov .c1b,edx + mov .c2b,edx + mov cx,.y1 + cmp cx,.y2 + jge .gt_loop1_end + + .gt_loop1: + pushad + ; macro .debug + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + sar ebx,ROUND ; x2 + push bx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + sar eax,ROUND + push ax ; x1 + push cx ; y + push .zz2 + push .zz1 + call gouraud_line_z + + popad + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc12r + add .c2r,edx + mov edx,.dc12g + add .c2g,edx + mov edx,.dc12b + add .c2b,edx + mov edx,.dz13 + add .zz1,edx + mov edx,.dz12 + add .zz2,edx + + add eax,.dx13 + add ebx,.dx12 + inc cx + cmp cx,.y2 + jl .gt_loop1 + + .gt_loop1_end: + mov cx,.y2 + cmp cx,.y3 + jge .gt_loop2_end + + movsx ebx,.x2 ; eax - cur x1 + shl ebx,ROUND ; ebx - cur x2 + movsx edx,word[.z2] + shl edx,CATMULL_SHIFT + mov .zz2,edx + movzx edx,word[.col2r] + shl edx,ROUND + mov .c2r,edx + movzx edx,word[.col2g] + shl edx,ROUND + mov .c2g,edx + movzx edx,word[.col2b] + shl edx,ROUND + mov .c2b,edx + + .gt_loop2: + pushad + ; macro .debug + + mov edx,.c2r ; c2r,c2g,c2b,c1r,c1g,c1b - current colors + sar edx,ROUND + push dx + mov edx,.c2g + sar edx,ROUND + push dx + mov edx,.c2b + sar edx,ROUND + push dx + sar ebx,ROUND ; x2 + push bx + mov edx,.c1r + sar edx,ROUND + push dx + mov edx,.c1g + sar edx,ROUND + push dx + mov edx,.c1b + sar edx,ROUND + push dx + sar eax,ROUND + push ax ; x1 + push cx ; y + push .zz2 + push .zz1 + call gouraud_line_z + + popad + + mov edx,.dc13r + add .c1r,edx + mov edx,.dc13g + add .c1g,edx + mov edx,.dc13b + add .c1b,edx + mov edx,.dc23r + add .c2r,edx + mov edx,.dc23g + add .c2g,edx + mov edx,.dc23b + add .c2b,edx + mov edx,.dz13 + add .zz1,edx + mov edx,.dz23 + add .zz2,edx + + add eax,.dx13 + add ebx,.dx23 + inc cx + cmp cx,.y3 + jl .gt_loop2 + .gt_loop2_end: + + mov esp,ebp +ret 24 +gouraud_line_z: +;----------------- procedure drawing gouraud line +;----------------- with z coordinate interpolation +;----------------- esi - pointer to Z_buffer +;----------------- edi - pointer to screen buffer +;----------------- stack: +.z1 equ dword[ebp+4] ; z coordiunate shifted left CATMULL_SHIFT +.z2 equ dword[ebp+8] +.y equ word[ebp+12] +.x1 equ ebp+14 +.c1b equ ebp+16 +.c1g equ ebp+18 +.c1r equ ebp+20 +.x2 equ ebp+22 +.c2b equ ebp+24 +.c2g equ ebp+26 +.c2r equ ebp+28 +.dz equ dword[ebp-4] +.dc_r equ dword[ebp-8] +.dc_g equ dword[ebp-12] +.dc_b equ dword[ebp-16] +.cr equ dword[ebp-20] +.cg equ dword[ebp-24] +.cb equ dword[ebp-28] + mov ebp,esp + + mov ax,.y + or ax,ax + jl .gl_quit + cmp ax,SIZE_Y + jge .gl_quit + + mov eax,dword[.x1] + cmp ax,word[.x2] + je .gl_quit + jl @f + + xchg eax,dword[.x2] + mov dword[.x1],eax + mov eax,dword[.c1g] + xchg eax,dword[.c2g] + mov dword[.c1g],eax + mov eax,.z1 + xchg eax,.z2 + mov .z1,eax + @@: + cmp word[.x1],SIZE_X + jge .gl_quit + cmp word[.x2],0 + jle .gl_quit + + mov eax,.z2 + sub eax,.z1 + cdq + mov bx,word[.x2] ; dz = z2-z1/x2-x1 + sub bx,word[.x1] + movsx ebx,bx + idiv ebx + push eax + + mov ax,word[.c2r] + sub ax,word[.c1r] + cwde + shl eax,ROUND ; dc_r = c2r-c1r/x2-x1 + cdq + idiv ebx + push eax + + mov ax,word[.c2g] + sub ax,word[.c1g] + cwde + shl eax,ROUND + cdq + idiv ebx + push eax + + mov ax,word[.c2b] + sub ax,word[.c1b] + cwde + shl eax,ROUND + cdq + idiv ebx + push eax + + cmp word[.x1],0 ; clipping on function + jg @f + mov eax,.dz + movsx ebx,word[.x1] + neg ebx + imul ebx + add .z1,eax + mov word[.x1],0 + + mov eax,.dc_r + imul ebx + sar eax,ROUND + add word[.c1r],ax + + mov eax,.dc_g + imul ebx + sar eax,ROUND + add word[.c1g],ax + + mov eax,.dc_b + imul ebx + sar eax,ROUND + add word[.c1b],ax + + @@: + cmp word[.x2],SIZE_X + jl @f + mov word[.x2],SIZE_X + @@: + sub esp,12 ; calculate memory begin + mov edx,SIZE_X ; in buffers + movzx eax,.y + mul edx + movzx edx,word[.x1] + add eax,edx + push eax + lea eax,[eax*3] + add edi,eax + pop eax + shl eax,2 + add esi,eax + + mov cx,word[.x2] + sub cx,word[.x1] + movzx ecx,cx + mov ebx,.z1 ; ebx - currrent z shl CATMULL_SIFT + mov edx,.dz ; edx - delta z + movzx eax,word[.c1r] + shl eax,ROUND + mov .cr,eax + movzx eax,word[.c1g] + shl eax,ROUND + mov .cg,eax + movzx eax,word[.c1b] + shl eax,ROUND + mov .cb,eax + .ddraw: + cmp ebx,dword[esi] ; esi - z_buffer + jge .skip ; edi - Screen buffer + mov eax,.cr + sar eax,ROUND + stosb + mov eax,.cg + sar eax,ROUND + stosb + mov eax,.cb + sar eax,ROUND + stosb + mov dword[esi],ebx + jmp .no_skip + .skip: + add edi,3 + .no_skip: + add esi,4 + add ebx,edx + mov eax,.dc_r + add .cr,eax + mov eax,.dc_g + add .cg,eax + mov eax,.dc_b + add .cb,eax + loop .ddraw + + .gl_quit: + mov esp,ebp +ret 26 \ No newline at end of file diff --git a/programs/demos/3dsheart/trunk/hrt.3ds b/programs/demos/3dsheart/trunk/hrt.3ds new file mode 100644 index 0000000000000000000000000000000000000000..a21f9d98be070cf1dde8e812f205bca709bf2319 GIT binary patch literal 36428 zcmeFaXH*r-)-~L{y8!`3P*F?>7*Ii!WOjEoDkcylnhEBdbHc30h&hX5&SDPit~N)^ zIe|InqaNcoSDpKQ<9YtP|KBn0z2mM~bM30?RdXWjuC5+8GBRSOBv~XUNs<)&uU@^n z;MRKohyU50iL8`S2qC6n1Fz@^JvOdMeaSVWATn-}BjWoeO}zdG{Ub@${wMwOhh?~+ zTQw;kVw9x+50)xL{||;s{4W;!zu1KT#U^J^iISA2N%H^SVq<1VQvE(X`}D6?Lz47< zV6J+{ijve$sras>`D<2rW9!;cdXHA6Oj}lied~XY(RMlYA;Vs5&l7{i^?^m#R%&5EJ7Z1-EI>8>O4nbnW4vOQm%rte!|Z@wSX$YwpB zrjK4}XHLF4DLdlMzip?SN%g2reI|}+WTiedcEQnARvNn!b50JvWqph}=~_2#E81vW zi)x5n;jX2lhT*7fT>)>6Y70jFm1dRK_M!fJYrV`KmwdFyqa*eFe&x+_*F3cBXCw5+ z%_^DKKRRetN{`Sx-taev@6WT=?=@Usx2~#rw%kUmkvmM!Srll-3~yn*FnXB2Xkn0< zaAQWj5fT5ki{GD-O>OFvHL8V;`YgrRr@k9)G`1z?tb8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