Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 3000 → Rev 3066

/programs/demos/3DS/DATA.INC
309,7 → 309,7
if Ext=SSE2
db ' (SSE2)'
end if
db ' 0.062',0
db ' 0.064',0
labellen:
STRdata db '-1 '
 
430,7 → 430,7
points_translated_ptr dd ?
screen_ptr dd ?
Zbuffer_ptr dd ?
edges_ptr dd ?
; edges_ptr dd ?
 
;===
 
/programs/demos/3DS/History.txt
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.
1. Two new buttons to increase and decrease brightness.
-----------------------------------------------------------------------------------
/programs/demos/3DS/VIEW3DS.ASM
1,5 → 1,5
 
; application : View3ds ver. 0.063 - tiny .3ds files viewer.
; application : View3ds ver. 0.064 - tiny .3ds files viewer.
; compiler : FASM
; system : KolibriOS
; author : Macgub aka Maciej Guba
682,7 → 682,7
int 40h
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 edx,STRdata ; pointer to text beginning
mov esi,10 ; text length
2445,11 → 2445,11
dec ecx
jnz .again_line_param
 
mov eax,[edges_ptr]
add eax,[edges_counter]
mov bl,[eax]
test bl,00000001b
jz @f
; mov eax,[edges_ptr] ; this not works correctly
; add eax,[edges_counter] ; I mean chosing overlapped edges.
; mov bl,[eax] ;
; test bl,00000001b ;
; jz @f ;
mov edi,screen
mov esi,[Zbuffer_ptr]
 
2479,11 → 2479,11
 
call smooth_line
@@:
mov eax,[edges_ptr]
add eax,[edges_counter]
mov bl,[eax]
test bl,00000010b
jz @f
; mov eax,[edges_ptr] ; this not works correctly
; add eax,[edges_counter]
; mov bl,[eax]
; test bl,00000010b
; jz @f
 
mov edi,screen
mov esi,[Zbuffer_ptr]
2515,11 → 2515,11
call smooth_line
@@:
 
mov eax,[edges_ptr]
add eax,[edges_counter]
mov bl,[eax]
test bl,00000100b
jz @f
; mov eax,[edges_ptr] ; this not works correctly
; add eax,[edges_counter] ;
; mov bl,[eax] ;
; test bl,00000100b ;
; jz @f ;
 
mov edi,screen
mov esi,[Zbuffer_ptr]
2568,31 → 2568,33
rep stosd
ret
 
read_from_file:
fninit
mov edi,[triangles_ptr]
read_tp_variables: ; read [triangles_count_var] and [points_count_var]
; and allocate memory
xor ebx,ebx
xor ebp,ebp
mov [points_count_var],0
mov [triangles_count_var],0
mov [points_count_var],bx
mov [triangles_count_var],bx
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
je @f ;Must be legal .3DS file
xor eax,eax
ret
@@:
mov eax,dword[esi+2]
; cmp eax,[fsize]
; jne .exit
 
cmp eax,[fsize] ;This must tell the length
je @f
xor eax,eax
ret
@@:
add eax,esi
mov [EndFile],eax ;
 
add esi,6
mov eax,[edges_ptr]
@@:
cmp [esi],word 3D3Dh
je @f
2635,32 → 2637,13
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
; dec ecx
loop @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
2670,49 → 2653,38
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
add esi,8
dec ecx
jnz @b
; xor ecx,ecx
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]
; and allocate memory
read_from_file:
fninit
mov edi,[triangles_ptr]
xor ebx,ebx
xor ebp,ebp
mov [points_count_var],bx
mov [triangles_count_var],bx
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
je @f ;Must be legal .3DS file
xor eax,eax
ret
@@:
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] ;This must tell the length
je @f
xor eax,eax
ret
@@:
; cmp eax,[fsize]
; jne .exit
 
add eax,esi
mov [EndFile],eax ;
 
2759,13 → 2731,32
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
loop @b
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
2775,16 → 2766,21
movzx ecx,word[esi+6]
add [triangles_count_var],cx
add esi,8
 
;mov edi,triangles
@@:
add esi,8
movsd
movsw
add word[edi-6],bp
add word[edi-4],bp
add word[edi-2],bp
add esi,2
dec ecx
jnz @b
; xor ecx,ecx
add ebp,edx
jmp .find4k
mov eax,-1 ;<---mark if OK
.exit:
mov dword[edi],-1
ret
 
if USE_LFN
2806,20 → 2802,20
int 0x40 ; -> allocate memory to triangles
mov [triangles_ptr], eax ; -> eax = pointer to allocated mem
 
mov eax, 68
movzx ecx, [triangles_count_var]
inc ecx
mov edx,[edges_ptr]
int 0x40 ; -> allocate memory to edges
mov [edges_ptr], eax ; -> eax = pointer to allocated mem
; mov eax, 68
; movzx ecx, [triangles_count_var]
; inc ecx
; mov edx,[edges_ptr]
; int 0x40 ; -> allocate memory to edges
; mov [edges_ptr], eax ; -> eax = pointer to allocated mem
 
mov eax,-1 ; fill edges list
movzx ecx,[triangles_count_var] ; importand if object generated
shr ecx,2
inc ecx
mov edi,[edges_ptr]
cld
rep stosd
; mov eax,-1 ; fill edges list
; movzx ecx,[triangles_count_var] ; importand if object generated
; shr ecx,2
; inc ecx
; mov edi,[edges_ptr]
; cld
; rep stosd
 
 
; mov eax, 68