View 3DS 0.64: bug fixes

git-svn-id: svn://kolibrios.org@3066 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-11-26 14:29:48 +00:00
parent a1006b9202
commit 77593a15ec
3 changed files with 165 additions and 154 deletions

View File

@ -309,7 +309,7 @@ base_vector:
if Ext=SSE2 if Ext=SSE2
db ' (SSE2)' db ' (SSE2)'
end if end if
db ' 0.062',0 db ' 0.064',0
labellen: labellen:
STRdata db '-1 ' STRdata db '-1 '
@ -430,7 +430,7 @@ align 8
points_translated_ptr dd ? points_translated_ptr dd ?
screen_ptr dd ? screen_ptr dd ?
Zbuffer_ptr dd ? Zbuffer_ptr dd ?
edges_ptr dd ? ; edges_ptr dd ?
;=== ;===

View File

@ -1,3 +1,18 @@
View3ds 0.064 - X 2012
1. Bug fixes.
-----------------------------------------------------------------------------------
View3ds 0.063 - X 2012
1. Postprocessing effect - wave. Ability to change amplitude and frequency.
-----------------------------------------------------------------------------------
View3ds 0.062 - VII 2012.
1. Counter fix by Mario.
2. New drawing model - smooth shaded lines (edges only view) by me.
-----------------------------------------------------------------------------------
View3ds 0.061 - Nov 2011. View3ds 0.061 - Nov 2011.
1. Two new buttons to increase and decrease brightness. 1. Two new buttons to increase and decrease brightness.
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
; application : View3ds ver. 0.063 - tiny .3ds files viewer. ; application : View3ds ver. 0.064 - tiny .3ds files viewer.
; compiler : FASM ; compiler : FASM
; system : KolibriOS ; system : KolibriOS
; author : Macgub aka Maciej Guba ; author : Macgub aka Maciej Guba
@ -682,7 +682,7 @@ end if
int 40h int 40h
mov eax,4 ; function 4 : write text to window mov eax,4 ; function 4 : write text to window
mov ebx,530*65536+510 ; [x start] *65536 + [y start] mov ebx,530*65536+510 ; [x start] *65536 + [y start]
mov ecx,0x00888888 mov ecx,0x00888888
mov edx,STRdata ; pointer to text beginning mov edx,STRdata ; pointer to text beginning
mov esi,10 ; text length mov esi,10 ; text length
@ -2445,11 +2445,11 @@ draw_triangles:
dec ecx dec ecx
jnz .again_line_param jnz .again_line_param
mov eax,[edges_ptr] ; mov eax,[edges_ptr] ; this not works correctly
add eax,[edges_counter] ; add eax,[edges_counter] ; I mean chosing overlapped edges.
mov bl,[eax] ; mov bl,[eax] ;
test bl,00000001b ; test bl,00000001b ;
jz @f ; jz @f ;
mov edi,screen mov edi,screen
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
@ -2479,11 +2479,11 @@ draw_triangles:
call smooth_line call smooth_line
@@: @@:
mov eax,[edges_ptr] ; mov eax,[edges_ptr] ; this not works correctly
add eax,[edges_counter] ; add eax,[edges_counter]
mov bl,[eax] ; mov bl,[eax]
test bl,00000010b ; test bl,00000010b
jz @f ; jz @f
mov edi,screen mov edi,screen
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
@ -2515,11 +2515,11 @@ draw_triangles:
call smooth_line call smooth_line
@@: @@:
mov eax,[edges_ptr] ; mov eax,[edges_ptr] ; this not works correctly
add eax,[edges_counter] ; add eax,[edges_counter] ;
mov bl,[eax] ; mov bl,[eax] ;
test bl,00000100b ; test bl,00000100b ;
jz @f ; jz @f ;
mov edi,screen mov edi,screen
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
@ -2568,128 +2568,6 @@ fill_Z_buffer:
rep stosd rep stosd
ret ret
read_from_file:
fninit
mov edi,[triangles_ptr]
xor ebx,ebx
xor ebp,ebp
mov [points_count_var],0
mov [triangles_count_var],0
if USE_LFN = 0
mov esi,SourceFile
else
mov esi,[fptr]
end if
cmp [esi],word 4D4Dh
jne .exit ;Must be legal .3DS file
; cmp dword[esi+2],EndFile-SourceFile
; jne .exit ;This must tell the length
mov eax,dword[esi+2]
; cmp eax,[fsize]
; jne .exit
add eax,esi
mov [EndFile],eax ;
add esi,6
mov eax,[edges_ptr]
@@:
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]
add [points_count_var],cx
mov edx,ecx
add esi,8
@@:
push edi
mov edi,[points_ptr]
push dword[esi+4]
pop dword[edi+ebx*2+0]
push dword[esi+8]
pop dword[edi+ebx*2+4]
push dword[esi+0]
pop dword[edi+ebx*2+8]
pop edi
; fld dword[esi+4]
; fstp dword[real_points+ebx*2+0] ; x
; fld dword[esi+8]
; fstp dword[real_points+ebx*2+4] ; y
; fld dword[esi+0]
; fstp dword[real_points+ebx*2+8] ; z
add ebx,6
add esi,12
dec ecx
jnz @b
@@:
; mov dword[points+ebx],-1
push edi
mov edi,[points_ptr]
mov dword[edi+ebx*2],-1 ; end mark (not always in use)
pop edi
@@:
cmp [esi],word 4120h
je @f
add esi,[esi+2]
jmp @b
@@:
movzx ecx,word[esi+6]
add [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
mov dl,byte[esi]
mov [eax],dl
inc eax
add esi,2
dec ecx
jnz @b
add ebp,edx
jmp .find4k
mov eax,-1 ;<---mark if OK
.exit:
mov dword[edi],-1
ret
read_tp_variables: ; read [triangles_count_var] and [points_count_var] read_tp_variables: ; read [triangles_count_var] and [points_count_var]
; and allocate memory ; and allocate memory
xor ebx,ebx xor ebx,ebx
@ -2787,6 +2665,124 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_var]
.exit: .exit:
ret ret
read_from_file:
fninit
mov edi,[triangles_ptr]
xor ebx,ebx
xor ebp,ebp
mov [points_count_var],0
mov [triangles_count_var],0
if USE_LFN = 0
mov esi,SourceFile
else
mov esi,[fptr]
end if
cmp [esi],word 4D4Dh
jne .exit ;Must be legal .3DS file
; cmp dword[esi+2],EndFile-SourceFile
; jne .exit ;This must tell the length
mov eax,dword[esi+2]
; cmp eax,[fsize]
; jne .exit
add eax,esi
mov [EndFile],eax ;
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]
add [points_count_var],cx
mov edx,ecx
add esi,8
@@:
push edi
mov edi,[points_ptr]
push dword[esi+4]
pop dword[edi+ebx*2+0]
push dword[esi+8]
pop dword[edi+ebx*2+4]
push dword[esi+0]
pop dword[edi+ebx*2+8]
pop edi
; fld dword[esi+4]
; fstp dword[real_points+ebx*2+0] ; x
; fld dword[esi+8]
; fstp dword[real_points+ebx*2+4] ; y
; fld dword[esi+0]
; fstp dword[real_points+ebx*2+8] ; z
add ebx,6
add esi,12
dec ecx
jnz @b
@@:
; mov dword[points+ebx],-1
push edi
mov edi,[points_ptr]
mov dword[edi+ebx*2],-1 ; end mark (not always in use)
pop edi
@@:
cmp [esi],word 4120h
je @f
add esi,[esi+2]
jmp @b
@@:
movzx ecx,word[esi+6]
add [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
mov eax,-1 ;<---mark if OK
.exit:
mov dword[edi],-1
ret
if USE_LFN if USE_LFN
alloc_mem_for_tp: alloc_mem_for_tp:
mov eax, 68 mov eax, 68
@ -2806,20 +2802,20 @@ alloc_mem_for_tp:
int 0x40 ; -> allocate memory to triangles int 0x40 ; -> allocate memory to triangles
mov [triangles_ptr], eax ; -> eax = pointer to allocated mem mov [triangles_ptr], eax ; -> eax = pointer to allocated mem
mov eax, 68 ; mov eax, 68
movzx ecx, [triangles_count_var] ; movzx ecx, [triangles_count_var]
inc ecx ; inc ecx
mov edx,[edges_ptr] ; mov edx,[edges_ptr]
int 0x40 ; -> allocate memory to edges ; int 0x40 ; -> allocate memory to edges
mov [edges_ptr], eax ; -> eax = pointer to allocated mem ; mov [edges_ptr], eax ; -> eax = pointer to allocated mem
mov eax,-1 ; fill edges list ; mov eax,-1 ; fill edges list
movzx ecx,[triangles_count_var] ; importand if object generated ; movzx ecx,[triangles_count_var] ; importand if object generated
shr ecx,2 ; shr ecx,2
inc ecx ; inc ecx
mov edi,[edges_ptr] ; mov edi,[edges_ptr]
cld ; cld
rep stosd ; rep stosd
; mov eax, 68 ; mov eax, 68