forked from KolibriOS/kolibrios
3ds0066: upload new version by macgub
git-svn-id: svn://kolibrios.org@6619 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5add26b5b5
commit
88e99ce6e8
@ -12,7 +12,9 @@ do_sinus:
|
||||
mov edi,[Zbuffer_ptr]
|
||||
push edi
|
||||
; 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
|
||||
cld
|
||||
rep stosd
|
||||
@ -67,11 +69,12 @@ end if
|
||||
mov eax,.new_y
|
||||
or eax,eax
|
||||
jl .skip
|
||||
cmp eax,SIZE_Y
|
||||
movzx ebx,word[size_y_var]
|
||||
cmp eax,ebx ;SIZE_Y
|
||||
jg .skip
|
||||
; mov edx,SIZE_X
|
||||
; mul edx
|
||||
shl eax,9
|
||||
movzx edx,word[size_x_var]
|
||||
mul edx
|
||||
; shl eax,9
|
||||
add eax,dword .x
|
||||
lea ebx,[eax*3]
|
||||
mov eax,[esi]
|
||||
@ -79,17 +82,24 @@ end if
|
||||
.skip:
|
||||
add esi,3
|
||||
inc dword .x
|
||||
cmp dword .x,SIZE_X
|
||||
movzx edx,word[size_x_var]
|
||||
cmp dword .x,edx ;SIZE_X
|
||||
jl .again
|
||||
mov dword .x,0
|
||||
inc dword .y
|
||||
cmp dword .y,SIZE_Y
|
||||
movzx edx,word[size_y_var]
|
||||
cmp dword .y,edx ;SIZE_Y
|
||||
jl .again
|
||||
|
||||
; copy from temporary buffer -> Zbuffer to screen
|
||||
mov esi,[Zbuffer_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
|
||||
rep movsd
|
||||
|
||||
@ -112,11 +122,11 @@ draw_dots:
|
||||
jl @f
|
||||
or bx,bx
|
||||
jl @f
|
||||
cmp ax,SIZE_Y
|
||||
cmp ax,[size_y_var] ;SIZE_Y
|
||||
jge @f
|
||||
cmp bx,SIZE_X
|
||||
cmp bx,[size_x_var] ;SIZE_X
|
||||
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
|
||||
add eax,ebx
|
||||
mov edi,[screen_ptr]
|
||||
@ -130,7 +140,100 @@ draw_dots:
|
||||
|
||||
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,
|
||||
; transfer screen buffer into bump map
|
||||
; and draw two bump triangles
|
||||
@ -227,6 +330,7 @@ end if
|
||||
|
||||
pop ebp
|
||||
ret
|
||||
end if
|
||||
;********************************EMBOSS DONE*******************************
|
||||
|
||||
|
||||
|
@ -97,11 +97,12 @@ bump_triangle:
|
||||
test edx,80000000h ; Check only X
|
||||
jne .loop23_done
|
||||
|
||||
cmp .x1,SIZE_X ; {
|
||||
mov dx,[size_x_var]
|
||||
cmp .x1,dx ;SIZE_X ; {
|
||||
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
|
||||
cmp .x3,SIZE_X
|
||||
cmp .x3,dx ;SIZE_X
|
||||
jg .loop23_done ; {
|
||||
|
||||
|
||||
@ -462,7 +463,8 @@ bump_line:
|
||||
mov ecx,.y
|
||||
or ecx,ecx
|
||||
jl .bl_end
|
||||
cmp ecx,SIZE_Y
|
||||
movzx edx,word[size_y_var]
|
||||
cmp ecx,edx ;SIZE_Y
|
||||
jge .bl_end
|
||||
|
||||
cmp eax,ebx
|
||||
@ -497,8 +499,10 @@ end if
|
||||
.bl_ok:
|
||||
push eax
|
||||
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
|
||||
mul ebx
|
||||
mov ecx,.x1
|
||||
|
@ -780,7 +780,9 @@ bump_line_z:
|
||||
mov ecx,.y
|
||||
or ecx,ecx
|
||||
jl .bl_end
|
||||
cmp ecx,SIZE_Y
|
||||
; mov dx,[size_x_var]
|
||||
; dec dx
|
||||
cmp cx,[size_y_var] ;SIZE_Y
|
||||
jge .bl_end
|
||||
|
||||
cmp eax,ebx
|
||||
@ -828,8 +830,9 @@ end if
|
||||
|
||||
push eax
|
||||
push ebx ;store x1, x2
|
||||
|
||||
cmp .x1,SIZE_X
|
||||
movzx edx,word[size_x_var]
|
||||
dec edx
|
||||
cmp .x1,edx ;SIZE_X
|
||||
jge .bl_end
|
||||
cmp .x2,0
|
||||
jle .bl_end
|
||||
@ -919,11 +922,13 @@ end if
|
||||
imul ebx
|
||||
add .ey1,eax
|
||||
@@:
|
||||
cmp .x2,SIZE_X
|
||||
movzx edx,word[size_x_var]
|
||||
dec edx
|
||||
cmp .x2,edx ;SIZE_X
|
||||
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
|
||||
mul ebx
|
||||
mov ebx,.x1
|
||||
|
@ -1279,7 +1279,8 @@ bump_tex_line_z:
|
||||
mov ecx,.y
|
||||
or ecx,ecx
|
||||
jl .bl_end
|
||||
cmp ecx,SIZE_Y
|
||||
movzx edx,word[size_y_var]
|
||||
cmp ecx,edx ;SIZE_Y
|
||||
jge .bl_end
|
||||
|
||||
cmp eax,ebx
|
||||
@ -1380,7 +1381,9 @@ end if
|
||||
|
||||
push eax
|
||||
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
|
||||
cmp dword .x2,0
|
||||
jle .bl_end
|
||||
@ -1532,11 +1535,14 @@ end if
|
||||
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
|
||||
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
|
||||
add eax,.x1
|
||||
lea esi,[4*eax]
|
||||
|
@ -747,16 +747,29 @@ if Ext>=SSE2
|
||||
shufps xmm5,xmm5,0
|
||||
.again_blur:
|
||||
push ecx
|
||||
mov edi,screen
|
||||
mov ecx,SIZE_X*3/4
|
||||
mov edi,[screen_ptr]
|
||||
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
|
||||
rep stosd
|
||||
|
||||
mov ecx,(SIZE_X*(SIZE_Y-3))*3/16
|
||||
if 1
|
||||
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:
|
||||
@@:
|
||||
movaps xmm0,[edi+SIZE_X*3]
|
||||
movaps xmm1,[edi-SIZE_X*3]
|
||||
push ecx
|
||||
movups xmm0,[edi+ebx]
|
||||
mov ecx,edi
|
||||
sub ecx,ebx
|
||||
movups xmm1,[ecx]
|
||||
movups xmm2,[edi-3]
|
||||
movups xmm3,[edi+3]
|
||||
|
||||
@ -766,14 +779,17 @@ if Ext>=SSE2
|
||||
|
||||
psubusb xmm0,xmm5 ; importand if fire
|
||||
|
||||
movaps [edi],xmm0
|
||||
movups [edi],xmm0
|
||||
add edi,16
|
||||
add esi,16
|
||||
|
||||
pop ecx
|
||||
loop .blr
|
||||
|
||||
end if
|
||||
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
|
||||
pop ecx
|
||||
loop .again_blur
|
||||
@ -790,17 +806,25 @@ if Ext=SSE
|
||||
movq mm4,[esp]
|
||||
.again_blur:
|
||||
push ecx
|
||||
mov edi,screen
|
||||
mov ecx,SIZE_X*3/4
|
||||
mov edi,[screen_ptr]
|
||||
movzx ecx,word[size_x_var] ;SIZE_X*3/4
|
||||
lea ecx,[ecx*3]
|
||||
shr ecx,2
|
||||
; pxor mm5,mm5
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
|
||||
mov ecx,(SIZE_X*(SIZE_Y-3))*3/8
|
||||
movzx ebx,word[size_x_var]
|
||||
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:
|
||||
@@:
|
||||
movq mm0,[edi+SIZE_X*3]
|
||||
movq mm1,[edi-SIZE_X*3]
|
||||
movq mm0,[edi+ebx]
|
||||
movq mm1,[edi-ebx]
|
||||
movq mm2,[edi-3]
|
||||
movq mm3,[edi+3]
|
||||
|
||||
@ -817,7 +841,10 @@ if Ext=SSE
|
||||
loop .blr
|
||||
|
||||
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
|
||||
pop ecx
|
||||
loop .again_blur
|
||||
@ -833,7 +860,7 @@ if Ext=MMX
|
||||
push dword 0x01010101
|
||||
.again_blur:
|
||||
push ecx
|
||||
mov edi,screen
|
||||
mov edi,[screen_ptr]
|
||||
mov ecx,SIZE_X*3/4
|
||||
pxor mm5,mm5
|
||||
xor eax,eax
|
||||
|
@ -12,8 +12,8 @@
|
||||
xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera
|
||||
yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates
|
||||
zobs dw -500
|
||||
size_x dw SIZE_X
|
||||
size_y dw SIZE_Y
|
||||
; size_x dw SIZE_X
|
||||
; size_y dw SIZE_Y
|
||||
|
||||
re_alloc_flag db 0
|
||||
angle_counter dw 0
|
||||
@ -80,7 +80,7 @@ catmull_flag db 1
|
||||
db 8
|
||||
db 'culling '
|
||||
db 2
|
||||
culling_flag db 1
|
||||
culling_flag db 0
|
||||
dd onoff_f
|
||||
|
||||
db 9
|
||||
@ -314,7 +314,7 @@ base_vector:
|
||||
if Ext=SSE2
|
||||
db ' (SSE2)'
|
||||
end if
|
||||
db ' 0.065',0
|
||||
db ' 0.066',0
|
||||
labellen:
|
||||
STRdata db '-1 '
|
||||
|
||||
@ -436,6 +436,10 @@ align 8
|
||||
screen_ptr dd ?
|
||||
Zbuffer_ptr dd ?
|
||||
; edges_ptr dd ?
|
||||
size_y_var:
|
||||
dw ?
|
||||
size_x_var:
|
||||
dw ?
|
||||
|
||||
;===
|
||||
|
||||
|
@ -47,11 +47,12 @@ draw_triangle:
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .end_triangle
|
||||
|
||||
cmp word[.x1],SIZE_X ; {
|
||||
mov dx,[size_x_var]
|
||||
cmp word[.x1],dx ;SIZE_X ; {
|
||||
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
|
||||
cmp word[.x3],SIZE_X
|
||||
cmp word[.x3],dx ;SIZE_X
|
||||
jg .end_triangle ; }
|
||||
|
||||
shr eax,16
|
||||
@ -176,10 +177,13 @@ ret
|
||||
jcxz .end_hor_l
|
||||
; or edx,edx
|
||||
; jl .end_hor_l
|
||||
cmp edx,SIZE_Y
|
||||
movzx esi,word[size_y_var]
|
||||
cmp edx,esi ;SIZE_Y
|
||||
jg .end_hor_l
|
||||
push eax
|
||||
mov eax,SIZE_X*3
|
||||
movzx eax,word[size_x_var]
|
||||
lea eax,[eax*3]
|
||||
; mov eax,SIZE_X*3
|
||||
mul edx
|
||||
add edi,eax ; calculate line begin adress
|
||||
;add edi,ebx
|
||||
|
@ -291,10 +291,10 @@ flat_line_z:
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .fl_quit
|
||||
;; mov bx,[size_y]
|
||||
;; dec bx
|
||||
cmp ax,[size_y]
|
||||
cmp ax,SIZE_Y-1
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;[size_y_var]
|
||||
; cmp ax,SIZE_Y-1
|
||||
jg .fl_quit
|
||||
|
||||
; cmp .x1,0
|
||||
@ -318,9 +318,9 @@ flat_line_z:
|
||||
xchg edx,.z2
|
||||
mov .z1,edx
|
||||
.fl_ok:
|
||||
;; mov bx,[size_x]
|
||||
;; dec bx
|
||||
cmp .x1,SIZE_X-1
|
||||
mov bx,[size_x_var]
|
||||
dec bx
|
||||
cmp .x1,bx ;SIZE_X-1
|
||||
jg .fl_quit
|
||||
cmp .x2,0
|
||||
jle .fl_quit
|
||||
@ -343,11 +343,12 @@ flat_line_z:
|
||||
add .z1,eax
|
||||
mov .x1,0
|
||||
@@:
|
||||
cmp .x2,SIZE_X
|
||||
movzx edx,word[size_x_var]
|
||||
cmp .x2,dx ;[size_x_var] ;SIZE_X
|
||||
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
|
||||
mul edx ; edi = edi + (SIZE_X * y + x1)*3
|
||||
movsx edx,.x1
|
||||
|
@ -78,14 +78,17 @@ gouraud_triangle:
|
||||
or edx,ecx
|
||||
test edx,80000000h
|
||||
jne .gt_loop2_end
|
||||
|
||||
mov dx,[size_x_var]
|
||||
dec dx
|
||||
shr eax,16
|
||||
cmp ax,SIZE_X-1
|
||||
cmp ax,dx ;SIZE_X-1
|
||||
jg .gt_loop2_end
|
||||
shr ebx,16
|
||||
cmp bx,SIZE_X-1
|
||||
cmp bx,dx ;SIZE_X-1
|
||||
jg .gt_loop2_end
|
||||
shr ecx,16
|
||||
cmp cx,SIZE_X-1
|
||||
cmp cx,dx ;SIZE_X-1
|
||||
jg .gt_loop2_end
|
||||
|
||||
|
||||
@ -443,7 +446,9 @@ gouraud_line:
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .gl_quit
|
||||
cmp ax,SIZE_Y-1
|
||||
mov dx,[size_y_var]
|
||||
dec dx
|
||||
cmp ax,dx ;SIZE_Y-1
|
||||
jg .gl_quit
|
||||
|
||||
mov ax,.x1
|
||||
@ -479,7 +484,9 @@ end if
|
||||
; jl .gl_quit
|
||||
|
||||
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
|
||||
movsx ebx,word .x1
|
||||
lea ecx,[ebx*2+eax]
|
||||
|
@ -514,7 +514,9 @@ gouraud_line_z:
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .gl_quit
|
||||
cmp ax,SIZE_Y
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;SIZE_Y
|
||||
jge .gl_quit
|
||||
|
||||
mov eax,dword[.x1]
|
||||
@ -531,7 +533,9 @@ gouraud_line_z:
|
||||
xchg eax,.z2
|
||||
mov .z1,eax
|
||||
@@:
|
||||
cmp word[.x1],SIZE_X
|
||||
mov bx,[size_x_var]
|
||||
dec bx
|
||||
cmp word[.x1],bx ;SIZE_X
|
||||
jge .gl_quit
|
||||
cmp word[.x2],0
|
||||
jle .gl_quit
|
||||
@ -594,12 +598,14 @@ gouraud_line_z:
|
||||
add word[.c1b],ax
|
||||
|
||||
@@:
|
||||
cmp word[.x2],SIZE_X
|
||||
mov bx,[size_x_var]
|
||||
dec bx
|
||||
cmp word[.x2],bx ;SIZE_X
|
||||
jl @f
|
||||
mov word[.x2],SIZE_X
|
||||
mov word[.x2],bx ;SIZE_X
|
||||
@@:
|
||||
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
|
||||
mul edx
|
||||
movzx edx,word[.x1]
|
||||
|
@ -41,7 +41,15 @@ smooth_line:
|
||||
.ccoord equ ebp-60 ;current coordinate
|
||||
.czbuf equ ebp-64
|
||||
.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
|
||||
{
|
||||
if Ext=NON
|
||||
@ -126,15 +134,35 @@ end if
|
||||
or eax,ebx
|
||||
test eax,80008000h
|
||||
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
|
||||
cmp word[.x2],SIZE_X
|
||||
cmp word[.x2],dx ;SIZE_X
|
||||
jg .end_line
|
||||
cmp word[.y1],SIZE_Y
|
||||
cmp word[.y1],cx ;SIZE_Y
|
||||
jg .end_line
|
||||
cmp word[.y2],SIZE_Y
|
||||
cmp word[.y2],cx ;SIZE_Y
|
||||
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 cx,[.x1]
|
||||
@ -181,7 +209,7 @@ end if
|
||||
|
||||
call .calc_delta
|
||||
|
||||
mov eax,SIZE_X
|
||||
movzx eax,word [size_x_var] ;SIZE_X
|
||||
movsx ebx,word[.y1]
|
||||
mul ebx
|
||||
add esi,eax
|
||||
@ -247,7 +275,7 @@ end if
|
||||
|
||||
call .calc_delta
|
||||
|
||||
mov eax,SIZE_X
|
||||
movzx eax,word[size_x_var] ;SIZE_X
|
||||
movsx ebx,word[.y1]
|
||||
mul ebx
|
||||
add esi,eax
|
||||
@ -290,8 +318,8 @@ end if
|
||||
.draw_pixel
|
||||
|
||||
@@:
|
||||
add edi,SIZE_X*3
|
||||
add esi,SIZE_X*4
|
||||
add edi,[.xres3]
|
||||
add esi,[.xres4]
|
||||
|
||||
.update_cur_var
|
||||
|
||||
@ -318,7 +346,7 @@ end if
|
||||
|
||||
call .calc_delta
|
||||
|
||||
mov eax,SIZE_X
|
||||
mov eax,[.xres]
|
||||
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers
|
||||
mul ebx
|
||||
lea ebx,[3*eax]
|
||||
@ -359,12 +387,16 @@ end if
|
||||
@@:
|
||||
cmp dword[.delta_y],0
|
||||
jl @f
|
||||
add edi,SIZE_X*3+3
|
||||
add esi,SIZE_X*4+4
|
||||
add edi,[.xres3] ;SIZE_X*3+3
|
||||
add edi,3
|
||||
add esi,[.xres4] ;SIZE_X*4+4
|
||||
add esi,4
|
||||
jmp .d45_1
|
||||
@@:
|
||||
sub edi,(SIZE_X*3)-3
|
||||
sub esi,(SIZE_X*4)-4
|
||||
sub edi,[.xres3] ;(SIZE_X*3)-3
|
||||
sub edi,3
|
||||
sub esi,[.xres4] ;(SIZE_X*4)-4
|
||||
sub esi,4
|
||||
.d45_1:
|
||||
.update_cur_var
|
||||
|
||||
@ -395,7 +427,7 @@ end if
|
||||
|
||||
call .calc_delta
|
||||
|
||||
mov eax,SIZE_X
|
||||
mov eax,[.xres] ;SIZE_X
|
||||
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers
|
||||
mul ebx
|
||||
lea ebx,[3*eax]
|
||||
@ -446,9 +478,11 @@ end if
|
||||
|
||||
@@:
|
||||
mov eax,[.delta]
|
||||
mov ebx,[.xres3]
|
||||
add [.ccoord],eax
|
||||
add dword[.cscr],SIZE_X*3 ;
|
||||
add dword[.czbuf],SIZE_X*4
|
||||
mov eax,[.xres4]
|
||||
add dword[.cscr],ebx ;SIZE_X*3 ;
|
||||
add dword[.czbuf],eax ;SIZE_X*4
|
||||
.d_m_v1:
|
||||
|
||||
.update_cur_var
|
||||
@ -518,7 +552,7 @@ end if
|
||||
mov esi,[.czbuf]
|
||||
mov eax,[.ccoord] ; ccoord - cur y coordinate
|
||||
sar eax,ROUND
|
||||
mov ebx,SIZE_X
|
||||
mov ebx,[.xres] ;SIZE_X
|
||||
mul ebx
|
||||
add esi,eax
|
||||
lea eax,[eax*3]
|
||||
|
@ -742,7 +742,7 @@ horizontal_tex_grd_line:
|
||||
or cx,cx
|
||||
jl .quit_l
|
||||
|
||||
cmp cx,SIZE_Y
|
||||
cmp cx,word[size_y_var] ;SIZE_Y
|
||||
jge .quit_l
|
||||
|
||||
cmp ax,bx
|
||||
@ -805,7 +805,7 @@ end if
|
||||
@@:
|
||||
or bx,bx
|
||||
jle .quit_l
|
||||
cmp ax,SIZE_X
|
||||
cmp ax,word[size_x_var] ;SIZE_X
|
||||
jge .quit_l
|
||||
|
||||
push ax
|
||||
@ -880,7 +880,7 @@ end if
|
||||
imul ebx
|
||||
add .tex_y1,eax
|
||||
@@:
|
||||
mov edx,SIZE_X
|
||||
movsx edx,word[size_x_var] ;SIZE_X
|
||||
cmp .x2,dx
|
||||
jl @f
|
||||
mov .x2,dx
|
||||
|
@ -1,4 +1,8 @@
|
||||
|
||||
View3ds 0.065 - Feb 2015
|
||||
1. Asc files support.
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
View3ds 0.064 - Nov 2012
|
||||
1. Bug fixes.
|
||||
-----------------------------------------------------------------------------------
|
||||
@ -89,7 +93,7 @@ View3ds 0.03 - March 2007.
|
||||
1. Two shading models: smooth + texture, spherical environment mapping + texture.
|
||||
Version only with z coordinate interpolation.
|
||||
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 ).
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
|
@ -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?
|
||||
1. Asc files support.
|
||||
1. App window size according to current screen resolution;
|
||||
2, New emboss procedure.
|
||||
|
||||
Buttons description:
|
||||
1. rotary: choosing rotary axle: x, y, x+y.
|
||||
@ -13,14 +16,13 @@ Buttons description:
|
||||
mapping), grdl (Gouraud lines - edges only).
|
||||
3. speed: idle, full.
|
||||
4,5. zoom in, out: no comment.
|
||||
6. catmull: on( use z buffer ( z coordinate interpolation), off( depth sorting, painters
|
||||
alghoritm).Txgrd, 2tex and bumptex models only with catmull = on.
|
||||
6. catmull: on -> use z buffer ( z coordinate interpolation), off -> depth sorting, painters
|
||||
alghoritm).Txgrd, 2tex and bumptex models only with catmull = on.
|
||||
7. culling: backface culling on/ off.
|
||||
8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination).
|
||||
9. Blur: blur N times; N=0,1,2,3,4,5
|
||||
10.11,12,13. loseless operations (rotary 90, 180 degrees).
|
||||
12. emboss: Do emboss effect( flat bumps ), use blur to do edges more deep.
|
||||
carefull with emboss + fire - it looks annoying.
|
||||
12. emboss: Do emboss effect( flat bumps ), use 'bumps deep' button to do edges more deep.
|
||||
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,
|
||||
decrease wave effect frequency and amplitude.
|
||||
@ -33,4 +35,4 @@ Buttons description:
|
||||
20. bright - -> decrease picture brightness.
|
||||
21. wav effect -> do effect based sine function.
|
||||
|
||||
Maciej Guba Feb 2015
|
||||
Maciej Guba X 2016
|
||||
|
@ -82,37 +82,37 @@ tex_triangle:
|
||||
or edx,ecx
|
||||
test edx,80008000h
|
||||
jne .tt_end
|
||||
|
||||
mov dx,[size_x_var]
|
||||
; or ax,ax
|
||||
; jl .tt_end
|
||||
cmp ax,SIZE_Y
|
||||
jg .tt_end
|
||||
; cmp ax,SIZE_Y
|
||||
; jg .tt_end
|
||||
ror eax,16
|
||||
; or ax,ax
|
||||
; jl .tt_end
|
||||
cmp ax,SIZE_X
|
||||
cmp ax,dx ;SIZE_X
|
||||
jg .tt_end
|
||||
rol eax,16
|
||||
|
||||
; or bx,bx
|
||||
; jl .tt_end
|
||||
cmp bx,SIZE_Y
|
||||
jg .tt_end
|
||||
; cmp bx,SIZE_Y
|
||||
; jg .tt_end
|
||||
ror ebx,16
|
||||
; or bx,bx
|
||||
; jl .tt_end
|
||||
cmp bx,SIZE_X
|
||||
cmp bx,dx ;SIZE_X
|
||||
jg .tt_end
|
||||
rol ebx,16
|
||||
|
||||
; or cx,cx
|
||||
; jl .tt_end
|
||||
cmp cx,SIZE_Y
|
||||
jg .tt_end
|
||||
; cmp cx,SIZE_Y
|
||||
; jg .tt_end
|
||||
ror ecx,16
|
||||
; or cx,cx
|
||||
; jl .tt_end
|
||||
cmp cx,SIZE_X
|
||||
cmp cx,dx ;SIZE_X
|
||||
jg .tt_end
|
||||
rol ecx,16 ; uff.. parameters was checked
|
||||
|
||||
@ -432,7 +432,8 @@ textured_line:
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .tl_quit
|
||||
cmp ax,SIZE_Y
|
||||
mov dx,[size_y_var]
|
||||
cmp ax,dx ;SIZE_Y
|
||||
jg .tl_quit
|
||||
|
||||
mov ax,.x1
|
||||
@ -465,7 +466,9 @@ end if
|
||||
|
||||
mov ebx,edi
|
||||
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
|
||||
mov edi,eax
|
||||
movsx eax,.x1
|
||||
|
@ -95,22 +95,22 @@ tex_triangle_z:
|
||||
and edx,eax
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .tt_loop2_end
|
||||
cmp ax,SIZE_Y
|
||||
jl @f
|
||||
cmp bx,SIZE_Y
|
||||
jl @f
|
||||
cmp cx,SIZE_Y
|
||||
jl @f
|
||||
; cmp ax,SIZE_Y
|
||||
; jl @f
|
||||
; cmp bx,SIZE_Y
|
||||
; jl @f
|
||||
; cmp cx,SIZE_Y
|
||||
; jl @f
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
ror ecx,16
|
||||
cmp ax,SIZE_X
|
||||
jl @f
|
||||
cmp bx,SIZE_X
|
||||
jl @f
|
||||
cmp cx,SIZE_X
|
||||
jl @f
|
||||
jmp .tt_loop2_end
|
||||
; cmp ax,SIZE_X
|
||||
; jl @f
|
||||
; cmp bx,SIZE_X
|
||||
; jl @f
|
||||
; cmp cx,SIZE_X
|
||||
; jl @f
|
||||
; jmp .tt_loop2_end
|
||||
@@:
|
||||
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
|
||||
mov ebx,dword[.tex_x2]
|
||||
@ -440,7 +440,9 @@ textured_line_z:
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .tl_quit
|
||||
cmp ax,SIZE_Y
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;SIZE_Y
|
||||
jge .tl_quit
|
||||
|
||||
mov ax,.x1
|
||||
@ -472,7 +474,9 @@ end if
|
||||
mov .z1,eax
|
||||
|
||||
.tl_ok:
|
||||
cmp .x1,SIZE_X
|
||||
mov cx,[size_x_var]
|
||||
dec cx
|
||||
cmp .x1,cx ;SIZE_X
|
||||
jge .tl_quit
|
||||
cmp .x2,0
|
||||
jle .tl_quit
|
||||
@ -517,13 +521,13 @@ end if
|
||||
add dword[.tex_x1],eax
|
||||
|
||||
@@:
|
||||
cmp .x2,SIZE_X
|
||||
cmp .x2,cx ;SIZE_X
|
||||
jl @f
|
||||
mov .x2,SIZE_X
|
||||
mov .x2,cx ;SIZE_X
|
||||
@@:
|
||||
|
||||
movsx ebx,.y ; calc mem begin in buffers
|
||||
mov eax,SIZE_X
|
||||
movzx eax,word[size_x_var] ;SIZE_X
|
||||
mul ebx
|
||||
movsx ebx,.x1
|
||||
add eax,ebx
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user