3ds0066: upload new version by macgub

git-svn-id: svn://kolibrios.org@6619 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-10-27 09:39:38 +00:00
parent 5add26b5b5
commit 88e99ce6e8
18 changed files with 1518 additions and 1172 deletions

View File

@ -12,7 +12,9 @@ do_sinus:
mov edi,[Zbuffer_ptr] mov edi,[Zbuffer_ptr]
push edi push edi
; clear Zbuffer temporally used as image buffer ; clear Zbuffer temporally used as image buffer
mov ecx,SIZE_X*SIZE_Y movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
imul ecx,eax ;SIZE_X*SIZE_Y
xor eax,eax xor eax,eax
cld cld
rep stosd rep stosd
@ -67,11 +69,12 @@ end if
mov eax,.new_y mov eax,.new_y
or eax,eax or eax,eax
jl .skip jl .skip
cmp eax,SIZE_Y movzx ebx,word[size_y_var]
cmp eax,ebx ;SIZE_Y
jg .skip jg .skip
; mov edx,SIZE_X movzx edx,word[size_x_var]
; mul edx mul edx
shl eax,9 ; shl eax,9
add eax,dword .x add eax,dword .x
lea ebx,[eax*3] lea ebx,[eax*3]
mov eax,[esi] mov eax,[esi]
@ -79,17 +82,24 @@ end if
.skip: .skip:
add esi,3 add esi,3
inc dword .x inc dword .x
cmp dword .x,SIZE_X movzx edx,word[size_x_var]
cmp dword .x,edx ;SIZE_X
jl .again jl .again
mov dword .x,0 mov dword .x,0
inc dword .y inc dword .y
cmp dword .y,SIZE_Y movzx edx,word[size_y_var]
cmp dword .y,edx ;SIZE_Y
jl .again jl .again
; copy from temporary buffer -> Zbuffer to screen ; copy from temporary buffer -> Zbuffer to screen
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
mov edi,[screen_ptr] mov edi,[screen_ptr]
mov ecx,SIZE_X*SIZE_Y*3/4 movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
imul ecx,eax
lea ecx,[ecx*3]
shr ecx,2
; mov ecx,SIZE_X*SIZE_Y*3/4
cld cld
rep movsd rep movsd
@ -112,11 +122,11 @@ draw_dots:
jl @f jl @f
or bx,bx or bx,bx
jl @f jl @f
cmp ax,SIZE_Y cmp ax,[size_y_var] ;SIZE_Y
jge @f jge @f
cmp bx,SIZE_X cmp bx,[size_x_var] ;SIZE_X
jge @f jge @f
mov edx,SIZE_X ; SIZE_X not only power of 2 -> 256,512,... movzx edx,word[size_x_var] ;SIZE_X ; SIZE_X not only power of 2 -> 256,512,...
mul edx mul edx
add eax,ebx add eax,ebx
mov edi,[screen_ptr] mov edi,[screen_ptr]
@ -130,7 +140,100 @@ draw_dots:
ret ret
do_emboss: do_emboss: ; sse2 version only
if Ext >= SSE2
movzx ecx,[bumps_deep_flag]
inc ecx
call blur_screen ;blur n times
mov eax,[size_y_var] ;load both x, y
mov ebx,eax
shr ebx,16
cwde
mul ebx
mov ecx,eax
sub ecx,ebx
sub ecx,ebx
mov esi,[screen_ptr]
mov edi,[Zbuffer_ptr]
lea ebx,[ebx*3]
mov edx,esi
add esi,ebx
lea ebx,[ebx+esi]
pxor xmm0,xmm0
push eax
@@:
movlps xmm1,[esi+3]
movhps xmm1,[esi+6]
punpcklbw xmm1,xmm0
movlps xmm2,[esi-3]
movhps xmm2,[esi]
punpcklbw xmm2,xmm0
movlps xmm3,[ebx]
movhps xmm3,[ebx+3]
movlps xmm4,[edx]
movhps xmm4,[edx+3]
punpcklbw xmm3,xmm0
punpcklbw xmm4,xmm0
psubsw xmm1,xmm2
paddw xmm1,[.bias]
psubsw xmm3,xmm4
paddw xmm3,[.bias]
pmulhw xmm1,xmm3
movaps xmm7,xmm1
movaps xmm6,xmm1
psrlq xmm7,2*8
psrlq xmm6,4*8
pmaxsw xmm1,xmm7
pmaxsw xmm1,xmm6
if 0
movaps xmm7,xmm3
movaps xmm6,xmm3
psrlq xmm7,2*8
psrlq xmm6,4*8
pmaxsw xmm3,xmm7
pmaxsw xmm3,xmm6
end if
pmaxsw xmm1,xmm3
movd eax,xmm1
movzx eax,al
lea eax,[eax*3+envmap_cub]
mov eax,[eax]
mov [edi],eax ;xmm1
psrldq xmm1,8
movd eax,xmm1
movzx eax,al
lea eax,[eax*3+envmap_cub]
mov eax,[eax]
mov [edi+4],eax
add edi,8
add esi,6
add ebx,6
add edx,6
sub ecx,2
jnc @b
pop ecx ;,eax
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
@@:
movsd
dec edi
loop @b
end if
ret
align 16
.bias:
dw 128, 128, 128, 128, 128, 128, 128, 128
if 0 ; old emb proc
; emboss - after drawing all, ; emboss - after drawing all,
; transfer screen buffer into bump map ; transfer screen buffer into bump map
; and draw two bump triangles ; and draw two bump triangles
@ -227,6 +330,7 @@ end if
pop ebp pop ebp
ret ret
end if
;********************************EMBOSS DONE******************************* ;********************************EMBOSS DONE*******************************

View File

@ -97,11 +97,12 @@ bump_triangle:
test edx,80000000h ; Check only X test edx,80000000h ; Check only X
jne .loop23_done jne .loop23_done
cmp .x1,SIZE_X ; { mov dx,[size_x_var]
cmp .x1,dx ;SIZE_X ; {
jg .loop23_done jg .loop23_done
cmp .x2,SIZE_X ; This can be optimized with effort cmp .x2,dx ;SIZE_X ; This can be optimized with effort
jg .loop23_done jg .loop23_done
cmp .x3,SIZE_X cmp .x3,dx ;SIZE_X
jg .loop23_done ; { jg .loop23_done ; {
@ -462,7 +463,8 @@ bump_line:
mov ecx,.y mov ecx,.y
or ecx,ecx or ecx,ecx
jl .bl_end jl .bl_end
cmp ecx,SIZE_Y movzx edx,word[size_y_var]
cmp ecx,edx ;SIZE_Y
jge .bl_end jge .bl_end
cmp eax,ebx cmp eax,ebx
@ -497,8 +499,10 @@ end if
.bl_ok: .bl_ok:
push eax push eax
push ebx ;store x1, x2 push ebx ;store x1, x2
movzx eax,word[size_x_var]
lea eax,[eax*3]
mov eax,SIZE_X*3 ; mov eax,SIZE_X*3
mov ebx,.y mov ebx,.y
mul ebx mul ebx
mov ecx,.x1 mov ecx,.x1

View File

@ -780,7 +780,9 @@ bump_line_z:
mov ecx,.y mov ecx,.y
or ecx,ecx or ecx,ecx
jl .bl_end jl .bl_end
cmp ecx,SIZE_Y ; mov dx,[size_x_var]
; dec dx
cmp cx,[size_y_var] ;SIZE_Y
jge .bl_end jge .bl_end
cmp eax,ebx cmp eax,ebx
@ -828,8 +830,9 @@ end if
push eax push eax
push ebx ;store x1, x2 push ebx ;store x1, x2
movzx edx,word[size_x_var]
cmp .x1,SIZE_X dec edx
cmp .x1,edx ;SIZE_X
jge .bl_end jge .bl_end
cmp .x2,0 cmp .x2,0
jle .bl_end jle .bl_end
@ -919,11 +922,13 @@ end if
imul ebx imul ebx
add .ey1,eax add .ey1,eax
@@: @@:
cmp .x2,SIZE_X movzx edx,word[size_x_var]
dec edx
cmp .x2,edx ;SIZE_X
jl @f jl @f
mov .x2,SIZE_X mov .x2,edx ;SIZE_X
@@: @@:
mov eax,SIZE_X ;calc memory begin in buffers movzx eax,word[size_x_var] ;SIZE_X ;calc memory begin in buffers
mov ebx,.y mov ebx,.y
mul ebx mul ebx
mov ebx,.x1 mov ebx,.x1

View File

@ -1279,7 +1279,8 @@ bump_tex_line_z:
mov ecx,.y mov ecx,.y
or ecx,ecx or ecx,ecx
jl .bl_end jl .bl_end
cmp ecx,SIZE_Y movzx edx,word[size_y_var]
cmp ecx,edx ;SIZE_Y
jge .bl_end jge .bl_end
cmp eax,ebx cmp eax,ebx
@ -1380,7 +1381,9 @@ end if
push eax push eax
push ebx ;store x1, x2 push ebx ;store x1, x2
cmp dword .x1,SIZE_X movzx ebx,word[size_x_var]
; mov eax,.x1
cmp dword .x1,ebx ;dword .x1,SIZE_X
jge .bl_end jge .bl_end
cmp dword .x2,0 cmp dword .x2,0
jle .bl_end jle .bl_end
@ -1532,11 +1535,14 @@ end if
add .ty1,eax add .ty1,eax
@@: @@:
cmp dword .x2,SIZE_X ; mov ebx,.x2
movzx eax,word[size_x_var]
; cmp dword .x2,SIZE_X
cmp dword .x2,eax ; eax,ebx
jl @f jl @f
mov dword .x2,SIZE_X mov dword .x2,eax ;SIZE_X
@@: @@:
mov eax,SIZE_X ;calc memory begin in buffers movzx eax,word[size_x_var] ;SIZE_X ;calc memory begin in buffers
mul .y mul .y
add eax,.x1 add eax,.x1
lea esi,[4*eax] lea esi,[4*eax]

View File

@ -747,16 +747,29 @@ if Ext>=SSE2
shufps xmm5,xmm5,0 shufps xmm5,xmm5,0
.again_blur: .again_blur:
push ecx push ecx
mov edi,screen mov edi,[screen_ptr]
mov ecx,SIZE_X*3/4 movzx ecx,word[size_x_var] ;SIZE_X*3/4
lea ecx,[ecx*3]
shr ecx,2
; mov ecx,SIZE_X*3/4
xor eax,eax xor eax,eax
rep stosd rep stosd
if 1
mov ecx,(SIZE_X*(SIZE_Y-3))*3/16 movzx ebx,word[size_x_var]
movzx ecx,word[size_y_var]
sub ecx,3
imul ecx,ebx
lea ecx,[ecx*3]
shr ecx,4
lea ebx,[ebx*3]
; mov ecx,(SIZE_X*(SIZE_Y-3))*3/16
.blr: .blr:
@@: @@:
movaps xmm0,[edi+SIZE_X*3] push ecx
movaps xmm1,[edi-SIZE_X*3] movups xmm0,[edi+ebx]
mov ecx,edi
sub ecx,ebx
movups xmm1,[ecx]
movups xmm2,[edi-3] movups xmm2,[edi-3]
movups xmm3,[edi+3] movups xmm3,[edi+3]
@ -766,14 +779,17 @@ if Ext>=SSE2
psubusb xmm0,xmm5 ; importand if fire psubusb xmm0,xmm5 ; importand if fire
movaps [edi],xmm0 movups [edi],xmm0
add edi,16 add edi,16
add esi,16 add esi,16
pop ecx
loop .blr loop .blr
end if
xor eax,eax xor eax,eax
mov ecx,SIZE_X*3/4 movzx ecx,word[size_x_var]
lea ecx,[ecx*3]
shr ecx,2
; mov ecx,SIZE_X*3/4
rep stosd rep stosd
pop ecx pop ecx
loop .again_blur loop .again_blur
@ -790,17 +806,25 @@ if Ext=SSE
movq mm4,[esp] movq mm4,[esp]
.again_blur: .again_blur:
push ecx push ecx
mov edi,screen mov edi,[screen_ptr]
mov ecx,SIZE_X*3/4 movzx ecx,word[size_x_var] ;SIZE_X*3/4
lea ecx,[ecx*3]
shr ecx,2
; pxor mm5,mm5 ; pxor mm5,mm5
xor eax,eax xor eax,eax
rep stosd rep stosd
movzx ebx,word[size_x_var]
mov ecx,(SIZE_X*(SIZE_Y-3))*3/8 movzx ecx,word[size_y_var]
sub ecx,3
imul ecx,ebx
lea ecx,[ecx*3]
shr ecx,3
lea ebx,[ebx*3]
; mov ecx,(SIZE_X*(SIZE_Y-3))*3/8
.blr: .blr:
@@: @@:
movq mm0,[edi+SIZE_X*3] movq mm0,[edi+ebx]
movq mm1,[edi-SIZE_X*3] movq mm1,[edi-ebx]
movq mm2,[edi-3] movq mm2,[edi-3]
movq mm3,[edi+3] movq mm3,[edi+3]
@ -817,7 +841,10 @@ if Ext=SSE
loop .blr loop .blr
xor eax,eax xor eax,eax
mov ecx,SIZE_X*3/4 mov ecx,[size_x_var]
lea ecx,[ecx*3]
shr ecx,2
; SIZE_X*3/4
rep stosd rep stosd
pop ecx pop ecx
loop .again_blur loop .again_blur
@ -833,7 +860,7 @@ if Ext=MMX
push dword 0x01010101 push dword 0x01010101
.again_blur: .again_blur:
push ecx push ecx
mov edi,screen mov edi,[screen_ptr]
mov ecx,SIZE_X*3/4 mov ecx,SIZE_X*3/4
pxor mm5,mm5 pxor mm5,mm5
xor eax,eax xor eax,eax

View File

@ -12,8 +12,8 @@
xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera
yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates
zobs dw -500 zobs dw -500
size_x dw SIZE_X ; size_x dw SIZE_X
size_y dw SIZE_Y ; size_y dw SIZE_Y
re_alloc_flag db 0 re_alloc_flag db 0
angle_counter dw 0 angle_counter dw 0
@ -80,7 +80,7 @@ catmull_flag db 1
db 8 db 8
db 'culling ' db 'culling '
db 2 db 2
culling_flag db 1 culling_flag db 0
dd onoff_f dd onoff_f
db 9 db 9
@ -314,7 +314,7 @@ base_vector:
if Ext=SSE2 if Ext=SSE2
db ' (SSE2)' db ' (SSE2)'
end if end if
db ' 0.065',0 db ' 0.066',0
labellen: labellen:
STRdata db '-1 ' STRdata db '-1 '
@ -436,6 +436,10 @@ align 8
screen_ptr dd ? screen_ptr dd ?
Zbuffer_ptr dd ? Zbuffer_ptr dd ?
; edges_ptr dd ? ; edges_ptr dd ?
size_y_var:
dw ?
size_x_var:
dw ?
;=== ;===

View File

@ -47,11 +47,12 @@ draw_triangle:
test edx,80008000h ; Check both X&Y at once test edx,80008000h ; Check both X&Y at once
jne .end_triangle jne .end_triangle
cmp word[.x1],SIZE_X ; { mov dx,[size_x_var]
cmp word[.x1],dx ;SIZE_X ; {
jg .end_triangle jg .end_triangle
cmp word[.x2],SIZE_X ; This can be optimized with effort cmp word[.x2],dx ;SIZE_X ; This can be optimized with effort
jg .end_triangle jg .end_triangle
cmp word[.x3],SIZE_X cmp word[.x3],dx ;SIZE_X
jg .end_triangle ; } jg .end_triangle ; }
shr eax,16 shr eax,16
@ -176,10 +177,13 @@ ret
jcxz .end_hor_l jcxz .end_hor_l
; or edx,edx ; or edx,edx
; jl .end_hor_l ; jl .end_hor_l
cmp edx,SIZE_Y movzx esi,word[size_y_var]
cmp edx,esi ;SIZE_Y
jg .end_hor_l jg .end_hor_l
push eax push eax
mov eax,SIZE_X*3 movzx eax,word[size_x_var]
lea eax,[eax*3]
; mov eax,SIZE_X*3
mul edx mul edx
add edi,eax ; calculate line begin adress add edi,eax ; calculate line begin adress
;add edi,ebx ;add edi,ebx

View File

@ -291,10 +291,10 @@ flat_line_z:
mov ax,.y mov ax,.y
or ax,ax or ax,ax
jl .fl_quit jl .fl_quit
;; mov bx,[size_y] mov bx,[size_y_var]
;; dec bx dec bx
cmp ax,[size_y] cmp ax,bx ;[size_y_var]
cmp ax,SIZE_Y-1 ; cmp ax,SIZE_Y-1
jg .fl_quit jg .fl_quit
; cmp .x1,0 ; cmp .x1,0
@ -318,9 +318,9 @@ flat_line_z:
xchg edx,.z2 xchg edx,.z2
mov .z1,edx mov .z1,edx
.fl_ok: .fl_ok:
;; mov bx,[size_x] mov bx,[size_x_var]
;; dec bx dec bx
cmp .x1,SIZE_X-1 cmp .x1,bx ;SIZE_X-1
jg .fl_quit jg .fl_quit
cmp .x2,0 cmp .x2,0
jle .fl_quit jle .fl_quit
@ -343,11 +343,12 @@ flat_line_z:
add .z1,eax add .z1,eax
mov .x1,0 mov .x1,0
@@: @@:
cmp .x2,SIZE_X movzx edx,word[size_x_var]
cmp .x2,dx ;[size_x_var] ;SIZE_X
jl @f jl @f
mov .x2,SIZE_X mov .x2,dx ;[size_x_var] ;SIZE_X
@@: @@:
mov edx,SIZE_X ; movzx edx,[size_x_var] ;SIZE_X
movsx eax,.y movsx eax,.y
mul edx ; edi = edi + (SIZE_X * y + x1)*3 mul edx ; edi = edi + (SIZE_X * y + x1)*3
movsx edx,.x1 movsx edx,.x1

View File

@ -78,14 +78,17 @@ gouraud_triangle:
or edx,ecx or edx,ecx
test edx,80000000h test edx,80000000h
jne .gt_loop2_end jne .gt_loop2_end
mov dx,[size_x_var]
dec dx
shr eax,16 shr eax,16
cmp ax,SIZE_X-1 cmp ax,dx ;SIZE_X-1
jg .gt_loop2_end jg .gt_loop2_end
shr ebx,16 shr ebx,16
cmp bx,SIZE_X-1 cmp bx,dx ;SIZE_X-1
jg .gt_loop2_end jg .gt_loop2_end
shr ecx,16 shr ecx,16
cmp cx,SIZE_X-1 cmp cx,dx ;SIZE_X-1
jg .gt_loop2_end jg .gt_loop2_end
@ -443,7 +446,9 @@ gouraud_line:
mov ax,.y mov ax,.y
or ax,ax or ax,ax
jl .gl_quit jl .gl_quit
cmp ax,SIZE_Y-1 mov dx,[size_y_var]
dec dx
cmp ax,dx ;SIZE_Y-1
jg .gl_quit jg .gl_quit
mov ax,.x1 mov ax,.x1
@ -479,7 +484,9 @@ end if
; jl .gl_quit ; jl .gl_quit
movsx ecx,.y movsx ecx,.y
mov eax,SIZE_X*3 movzx eax,word[size_x_var]
lea eax,[eax*3]
; mov eax,SIZE_X*3
mul ecx mul ecx
movsx ebx,word .x1 movsx ebx,word .x1
lea ecx,[ebx*2+eax] lea ecx,[ebx*2+eax]

View File

@ -514,7 +514,9 @@ gouraud_line_z:
mov ax,.y mov ax,.y
or ax,ax or ax,ax
jl .gl_quit jl .gl_quit
cmp ax,SIZE_Y mov bx,[size_y_var]
dec bx
cmp ax,bx ;SIZE_Y
jge .gl_quit jge .gl_quit
mov eax,dword[.x1] mov eax,dword[.x1]
@ -531,7 +533,9 @@ gouraud_line_z:
xchg eax,.z2 xchg eax,.z2
mov .z1,eax mov .z1,eax
@@: @@:
cmp word[.x1],SIZE_X mov bx,[size_x_var]
dec bx
cmp word[.x1],bx ;SIZE_X
jge .gl_quit jge .gl_quit
cmp word[.x2],0 cmp word[.x2],0
jle .gl_quit jle .gl_quit
@ -594,12 +598,14 @@ gouraud_line_z:
add word[.c1b],ax add word[.c1b],ax
@@: @@:
cmp word[.x2],SIZE_X mov bx,[size_x_var]
dec bx
cmp word[.x2],bx ;SIZE_X
jl @f jl @f
mov word[.x2],SIZE_X mov word[.x2],bx ;SIZE_X
@@: @@:
sub esp,16 ; calculate memory begin sub esp,16 ; calculate memory begin
mov edx,SIZE_X ; in buffers movzx edx,word[size_x_var] ;SIZE_X ; in buffers
movzx eax,.y movzx eax,.y
mul edx mul edx
movzx edx,word[.x1] movzx edx,word[.x1]

View File

@ -41,7 +41,15 @@ smooth_line:
.ccoord equ ebp-60 ;current coordinate .ccoord equ ebp-60 ;current coordinate
.czbuf equ ebp-64 .czbuf equ ebp-64
.cscr equ ebp-68 .cscr equ ebp-68
;.lasty equ ebp-72 .xres equ ebp-72
.yres equ ebp-76
.xresm1 equ ebp-80
.yresm1 equ ebp-84
.xresp1 equ ebp-88
.yresp1 equ ebp-92
.xres3 equ ebp-96
.xres4 equ ebp-100
macro .update_cur_var macro .update_cur_var
{ {
if Ext=NON if Ext=NON
@ -126,15 +134,35 @@ end if
or eax,ebx or eax,ebx
test eax,80008000h test eax,80008000h
jne .end_line jne .end_line
cmp word[.x1],SIZE_X movzx edx,word [size_x_var]
mov [.xres],edx
movzx ecx,word [size_y_var]
mov [.yres],ecx
cmp word[.x1],dx ;SIZE_X
jg .end_line jg .end_line
cmp word[.x2],SIZE_X cmp word[.x2],dx ;SIZE_X
jg .end_line jg .end_line
cmp word[.y1],SIZE_Y cmp word[.y1],cx ;SIZE_Y
jg .end_line jg .end_line
cmp word[.y2],SIZE_Y cmp word[.y2],cx ;SIZE_Y
jg .end_line jg .end_line
mov edx,[.xres]
shl edx,2
mov [.xres4],edx
shr edx,2
lea edx,[edx*3]
mov [.xres3],edx
mov edx,[.xres]
mov ecx,[.yres]
dec edx
dec ecx
mov [.xresm1],edx
mov [.yresm1],ecx
add edx,2
add ecx,2
mov [.xresp1],edx
mov [.yresp1],ecx
mov [.screen],edi mov [.screen],edi
mov cx,[.x1] mov cx,[.x1]
@ -181,7 +209,7 @@ end if
call .calc_delta call .calc_delta
mov eax,SIZE_X movzx eax,word [size_x_var] ;SIZE_X
movsx ebx,word[.y1] movsx ebx,word[.y1]
mul ebx mul ebx
add esi,eax add esi,eax
@ -247,7 +275,7 @@ end if
call .calc_delta call .calc_delta
mov eax,SIZE_X movzx eax,word[size_x_var] ;SIZE_X
movsx ebx,word[.y1] movsx ebx,word[.y1]
mul ebx mul ebx
add esi,eax add esi,eax
@ -290,8 +318,8 @@ end if
.draw_pixel .draw_pixel
@@: @@:
add edi,SIZE_X*3 add edi,[.xres3]
add esi,SIZE_X*4 add esi,[.xres4]
.update_cur_var .update_cur_var
@ -318,7 +346,7 @@ end if
call .calc_delta call .calc_delta
mov eax,SIZE_X mov eax,[.xres]
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers movsx ebx,word[.y1] ;calc begin values in screen and Z buffers
mul ebx mul ebx
lea ebx,[3*eax] lea ebx,[3*eax]
@ -359,12 +387,16 @@ end if
@@: @@:
cmp dword[.delta_y],0 cmp dword[.delta_y],0
jl @f jl @f
add edi,SIZE_X*3+3 add edi,[.xres3] ;SIZE_X*3+3
add esi,SIZE_X*4+4 add edi,3
add esi,[.xres4] ;SIZE_X*4+4
add esi,4
jmp .d45_1 jmp .d45_1
@@: @@:
sub edi,(SIZE_X*3)-3 sub edi,[.xres3] ;(SIZE_X*3)-3
sub esi,(SIZE_X*4)-4 sub edi,3
sub esi,[.xres4] ;(SIZE_X*4)-4
sub esi,4
.d45_1: .d45_1:
.update_cur_var .update_cur_var
@ -395,7 +427,7 @@ end if
call .calc_delta call .calc_delta
mov eax,SIZE_X mov eax,[.xres] ;SIZE_X
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers movsx ebx,word[.y1] ;calc begin values in screen and Z buffers
mul ebx mul ebx
lea ebx,[3*eax] lea ebx,[3*eax]
@ -446,9 +478,11 @@ end if
@@: @@:
mov eax,[.delta] mov eax,[.delta]
mov ebx,[.xres3]
add [.ccoord],eax add [.ccoord],eax
add dword[.cscr],SIZE_X*3 ; mov eax,[.xres4]
add dword[.czbuf],SIZE_X*4 add dword[.cscr],ebx ;SIZE_X*3 ;
add dword[.czbuf],eax ;SIZE_X*4
.d_m_v1: .d_m_v1:
.update_cur_var .update_cur_var
@ -518,7 +552,7 @@ end if
mov esi,[.czbuf] mov esi,[.czbuf]
mov eax,[.ccoord] ; ccoord - cur y coordinate mov eax,[.ccoord] ; ccoord - cur y coordinate
sar eax,ROUND sar eax,ROUND
mov ebx,SIZE_X mov ebx,[.xres] ;SIZE_X
mul ebx mul ebx
add esi,eax add esi,eax
lea eax,[eax*3] lea eax,[eax*3]

View File

@ -742,7 +742,7 @@ horizontal_tex_grd_line:
or cx,cx or cx,cx
jl .quit_l jl .quit_l
cmp cx,SIZE_Y cmp cx,word[size_y_var] ;SIZE_Y
jge .quit_l jge .quit_l
cmp ax,bx cmp ax,bx
@ -805,7 +805,7 @@ end if
@@: @@:
or bx,bx or bx,bx
jle .quit_l jle .quit_l
cmp ax,SIZE_X cmp ax,word[size_x_var] ;SIZE_X
jge .quit_l jge .quit_l
push ax push ax
@ -880,7 +880,7 @@ end if
imul ebx imul ebx
add .tex_y1,eax add .tex_y1,eax
@@: @@:
mov edx,SIZE_X movsx edx,word[size_x_var] ;SIZE_X
cmp .x2,dx cmp .x2,dx
jl @f jl @f
mov .x2,dx mov .x2,dx

View File

@ -1,4 +1,8 @@
View3ds 0.065 - Feb 2015
1. Asc files support.
-----------------------------------------------------------------------------------
View3ds 0.064 - Nov 2012 View3ds 0.064 - Nov 2012
1. Bug fixes. 1. Bug fixes.
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
@ -29,9 +33,9 @@ View3ds 0.059 - June 2011.
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
View3ds 0.058 - June 2011. View3ds 0.058 - June 2011.
1. Blur function optimization on SSE and SSE2 (buttons 'blur' and 'fire'). 1. Blur function optimization on SSE and SSE2 (buttons 'blur' and 'fire').
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
View3ds 0.057 - April 2011. View3ds 0.057 - April 2011.
1. By opening file bigger then ~18 KB, and choosing env mode program terminate. 1. By opening file bigger then ~18 KB, and choosing env mode program terminate.
I remove this bug I remove this bug
@ -89,7 +93,7 @@ View3ds 0.03 - March 2007.
1. Two shading models: smooth + texture, spherical environment mapping + texture. 1. Two shading models: smooth + texture, spherical environment mapping + texture.
Version only with z coordinate interpolation. Version only with z coordinate interpolation.
2. Bit changed rotary. I took attempt in SSE instuctions. ( matrix multiplication ) 2. Bit changed rotary. I took attempt in SSE instuctions. ( matrix multiplication )
3. Color position depend drawing model instead spot light ( I hope,spot light come 3. Color position depend drawing model instead spot light ( I hope,spot light come
back in future ). back in future ).
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------

View File

@ -1,7 +1,10 @@
View3ds 0.065 - tiny viewer to .3ds and .asc files. View3ds 0.066 - tiny viewer to .3ds and .asc files with several graphics
effects implementation.
What's new? What's new?
1. Asc files support. 1. App window size according to current screen resolution;
2, New emboss procedure.
Buttons description: Buttons description:
1. rotary: choosing rotary axle: x, y, x+y. 1. rotary: choosing rotary axle: x, y, x+y.
@ -13,24 +16,23 @@ Buttons description:
mapping), grdl (Gouraud lines - edges only). mapping), grdl (Gouraud lines - edges only).
3. speed: idle, full. 3. speed: idle, full.
4,5. zoom in, out: no comment. 4,5. zoom in, out: no comment.
6. catmull: on( use z buffer ( z coordinate interpolation), off( depth sorting, painters 6. catmull: on -> use z buffer ( z coordinate interpolation), off -> depth sorting, painters
alghoritm).Txgrd, 2tex and bumptex models only with catmull = on. alghoritm).Txgrd, 2tex and bumptex models only with catmull = on.
7. culling: backface culling on/ off. 7. culling: backface culling on/ off.
8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination). 8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination).
9. Blur: blur N times; N=0,1,2,3,4,5 9. Blur: blur N times; N=0,1,2,3,4,5
10.11,12,13. loseless operations (rotary 90, 180 degrees). 10.11,12,13. loseless operations (rotary 90, 180 degrees).
12. emboss: Do emboss effect( flat bumps ), use blur to do edges more deep. 12. emboss: Do emboss effect( flat bumps ), use 'bumps deep' button to do edges more deep.
carefull with emboss + fire - it looks annoying.
13. fire: do motion blur ( looks like fire ). 13. fire: do motion blur ( looks like fire ).
14. move: changes meaning x,y,z +/- buttons -> obj: moving object, camr: moving camera, wave: x,y +/- increase, 14. move: changes meaning x,y,z +/- buttons -> obj: moving object, camr: moving camera, wave: x,y +/- increase,
decrease wave effect frequency and amplitude. decrease wave effect frequency and amplitude.
15. generate: Generates some objects: node, Thorn Crown, heart... 15. generate: Generates some objects: node, Thorn Crown, heart...
16. bumps: random, according to texture. 16. bumps: random, according to texture.
17. bumps deep -> create bumps deeper or lighter. 17. bumps deep -> create bumps deeper or lighter.
18. re-map tex -> re-map texture and bump map coordinates, to change spherical mapping 18. re-map tex -> re-map texture and bump map coordinates, to change spherical mapping
around axle use 'xchg' and 'mirror' buttons, then press 're-map tex' button. around axle use 'xchg' and 'mirror' buttons, then press 're-map tex' button.
19. bright + -> increase picture brightness. 19. bright + -> increase picture brightness.
20. bright - -> decrease picture brightness. 20. bright - -> decrease picture brightness.
21. wav effect -> do effect based sine function. 21. wav effect -> do effect based sine function.
Maciej Guba Feb 2015 Maciej Guba X 2016

View File

@ -82,37 +82,37 @@ tex_triangle:
or edx,ecx or edx,ecx
test edx,80008000h test edx,80008000h
jne .tt_end jne .tt_end
mov dx,[size_x_var]
; or ax,ax ; or ax,ax
; jl .tt_end ; jl .tt_end
cmp ax,SIZE_Y ; cmp ax,SIZE_Y
jg .tt_end ; jg .tt_end
ror eax,16 ror eax,16
; or ax,ax ; or ax,ax
; jl .tt_end ; jl .tt_end
cmp ax,SIZE_X cmp ax,dx ;SIZE_X
jg .tt_end jg .tt_end
rol eax,16 rol eax,16
; or bx,bx ; or bx,bx
; jl .tt_end ; jl .tt_end
cmp bx,SIZE_Y ; cmp bx,SIZE_Y
jg .tt_end ; jg .tt_end
ror ebx,16 ror ebx,16
; or bx,bx ; or bx,bx
; jl .tt_end ; jl .tt_end
cmp bx,SIZE_X cmp bx,dx ;SIZE_X
jg .tt_end jg .tt_end
rol ebx,16 rol ebx,16
; or cx,cx ; or cx,cx
; jl .tt_end ; jl .tt_end
cmp cx,SIZE_Y ; cmp cx,SIZE_Y
jg .tt_end ; jg .tt_end
ror ecx,16 ror ecx,16
; or cx,cx ; or cx,cx
; jl .tt_end ; jl .tt_end
cmp cx,SIZE_X cmp cx,dx ;SIZE_X
jg .tt_end jg .tt_end
rol ecx,16 ; uff.. parameters was checked rol ecx,16 ; uff.. parameters was checked
@ -432,7 +432,8 @@ textured_line:
mov ax,.y mov ax,.y
or ax,ax or ax,ax
jl .tl_quit jl .tl_quit
cmp ax,SIZE_Y mov dx,[size_y_var]
cmp ax,dx ;SIZE_Y
jg .tl_quit jg .tl_quit
mov ax,.x1 mov ax,.x1
@ -465,7 +466,9 @@ end if
mov ebx,edi mov ebx,edi
movsx edi,.y movsx edi,.y
mov eax,SIZE_X*3 movzx eax,word[size_x_var]
lea eax,[eax*3]
; mov eax,SIZE_X*3
mul edi mul edi
mov edi,eax mov edi,eax
movsx eax,.x1 movsx eax,.x1

View File

@ -95,22 +95,22 @@ tex_triangle_z:
and edx,eax and edx,eax
test edx,80008000h ; Check both X&Y at once test edx,80008000h ; Check both X&Y at once
jne .tt_loop2_end jne .tt_loop2_end
cmp ax,SIZE_Y ; cmp ax,SIZE_Y
jl @f ; jl @f
cmp bx,SIZE_Y ; cmp bx,SIZE_Y
jl @f ; jl @f
cmp cx,SIZE_Y ; cmp cx,SIZE_Y
jl @f ; jl @f
ror eax,16 ror eax,16
ror ebx,16 ror ebx,16
ror ecx,16 ror ecx,16
cmp ax,SIZE_X ; cmp ax,SIZE_X
jl @f ; jl @f
cmp bx,SIZE_X ; cmp bx,SIZE_X
jl @f ; jl @f
cmp cx,SIZE_X ; cmp cx,SIZE_X
jl @f ; jl @f
jmp .tt_loop2_end ; jmp .tt_loop2_end
@@: @@:
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)] mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
mov ebx,dword[.tex_x2] mov ebx,dword[.tex_x2]
@ -440,7 +440,9 @@ textured_line_z:
mov ax,.y mov ax,.y
or ax,ax or ax,ax
jl .tl_quit jl .tl_quit
cmp ax,SIZE_Y mov bx,[size_y_var]
dec bx
cmp ax,bx ;SIZE_Y
jge .tl_quit jge .tl_quit
mov ax,.x1 mov ax,.x1
@ -472,7 +474,9 @@ end if
mov .z1,eax mov .z1,eax
.tl_ok: .tl_ok:
cmp .x1,SIZE_X mov cx,[size_x_var]
dec cx
cmp .x1,cx ;SIZE_X
jge .tl_quit jge .tl_quit
cmp .x2,0 cmp .x2,0
jle .tl_quit jle .tl_quit
@ -517,13 +521,13 @@ end if
add dword[.tex_x1],eax add dword[.tex_x1],eax
@@: @@:
cmp .x2,SIZE_X cmp .x2,cx ;SIZE_X
jl @f jl @f
mov .x2,SIZE_X mov .x2,cx ;SIZE_X
@@: @@:
movsx ebx,.y ; calc mem begin in buffers movsx ebx,.y ; calc mem begin in buffers
mov eax,SIZE_X movzx eax,word[size_x_var] ;SIZE_X
mul ebx mul ebx
movsx ebx,.x1 movsx ebx,.x1
add eax,ebx add eax,ebx

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff