View3ds 0.067: Sizable window [by macgub]

git-svn-id: svn://kolibrios.org@6648 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-01 14:45:32 +00:00
parent 39f57c29f2
commit 370074cb14
5 changed files with 496 additions and 411 deletions

View File

@ -749,8 +749,9 @@ if Ext>=SSE2
push ecx push ecx
mov edi,[screen_ptr] mov edi,[screen_ptr]
movzx ecx,word[size_x_var] ;SIZE_X*3/4 movzx ecx,word[size_x_var] ;SIZE_X*3/4
lea ecx,[ecx*3] lea ecx,[ecx*3+1]
shr ecx,2 shr ecx,2
; mov ecx,SIZE_X*3/4 ; mov ecx,SIZE_X*3/4
xor eax,eax xor eax,eax
rep stosd rep stosd

View File

@ -38,7 +38,7 @@
XYZpartices: XYZpartices:
db 'X','Y','Z' db 'X','Y','Z'
i10 dw 10 i10 dw 10
draw_win_at_first db 1
menu: menu:
db 2 ; button number = index db 2 ; button number = index
@ -314,7 +314,7 @@ base_vector:
if Ext=SSE2 if Ext=SSE2
db ' (SSE2)' db ' (SSE2)'
end if end if
db ' 0.066',0 db ' 0.067',0
labellen: labellen:
STRdata db '-1 ' STRdata db '-1 '
@ -440,6 +440,10 @@ align 8
dw ? dw ?
size_x_var: size_x_var:
dw ? dw ?
x_start:
dw ?
y_start:
dw ?
;=== ;===
@ -526,6 +530,8 @@ end if
; screen rb SIZE_X * SIZE_Y * 3 ; screen buffer ; screen rb SIZE_X * SIZE_Y * 3 ; screen buffer
;align 16 ;align 16
; Z_buffer rb SIZE_X * SIZE_Y * 4 ; Z_buffer rb SIZE_X * SIZE_Y * 4
procinfo:
rb 1024 ; process info
I_Param rb 256 I_Param rb 256
memStack rb 4000 ;memory area for stack memStack rb 4000 ;memory area for stack
align 16 align 16

View File

@ -1,4 +1,9 @@
View 3ds 0,066 - X 2016
1. App window size according to current screen resolution.
2. New emboss procedure.
-----------------------------------------------------------------------------------
View3ds 0.065 - Feb 2015 View3ds 0.065 - Feb 2015
1. Asc files support. 1. Asc files support.
----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------

View File

@ -1,10 +1,10 @@
View3ds 0.066 - tiny viewer to .3ds and .asc files with several graphics View3ds 0.067 - tiny viewer to .3ds and .asc files with several graphics
effects implementation. effects implementation.
What's new? What's new?
1. App window size according to current screen resolution; 1. Sizable app window.
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.
@ -35,4 +35,4 @@ Buttons description:
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 X 2016 Maciej Guba XI 2016

View File

@ -1,5 +1,5 @@
; application : View3ds ver. 0.066 - tiny .3ds and .asc files viewer ; application : View3ds ver. 0.067 - tiny .3ds and .asc files viewer
; with a few graphics effects demonstration. ; with a few graphics effects demonstration.
; compiler : FASM ; compiler : FASM
; system : KolibriOS ; system : KolibriOS
@ -54,15 +54,18 @@ use32
START: ; start of execution START: ; start of execution
cld cld
mov eax,14 ; mov eax,14 ; window size according to cur res ...
int 0x40 ; int 0x40
sub eax,150 shl 16 + 150 ; sub eax,150 shl 16 + 150
mov eax, 600 shl 16 + 600 ; ... or set manually
mov [size_y_var],ax mov [size_y_var],ax
shr ax,1 shr ax,1
mov [vect_y],ax mov [vect_y],ax
shr ax,1
shr ax,2
movzx ebx,ax movzx ebx,ax
lea ebx,[ebx*3]
push ebx push ebx
fninit fninit
fild dword[esp] fild dword[esp]
@ -74,6 +77,9 @@ START: ; start of execution
shr ax,1 shr ax,1
mov [vect_x],ax mov [vect_x],ax
mov eax, 20 shl 16 + 20
mov [x_start],eax
call alloc_buffer_mem call alloc_buffer_mem
call read_param call read_param
@ -107,6 +113,10 @@ START: ; start of execution
end if end if
call read_from_file call read_from_file
.opt: .opt:
; call alloc_buffer_mem ; alloc memfor screnn and z buffer
call optimize_object1 ; proc in file b_procs.asm call optimize_object1 ; proc in file b_procs.asm
; set point(0,0,0) in center and calc all coords ; set point(0,0,0) in center and calc all coords
; to be in <-1.0,1.0> ; to be in <-1.0,1.0>
@ -117,12 +127,12 @@ START: ; start of execution
call init_envmap_cub call init_envmap_cub
call generate_texture2 call generate_texture2
call init_sincos_tab call init_sincos_tab
call do_color_buffer ; intit color_map call do_color_buffer ; intit color_map
mov edi,bumpmap mov edi,bumpmap
call calc_bumpmap call calc_bumpmap
call calc_bumpmap_coords ; bump and texture mapping call calc_bumpmap_coords ; bump and texture mapping
call draw_window call draw_window
mov [draw_win_at_first],0
still: still:
@ -144,6 +154,27 @@ still:
jmp noclose jmp noclose
red: ; redraw red: ; redraw
mov eax,9 ; get process info
mov ebx,procinfo
mov ecx,-1
int 0x40
mov eax,[procinfo+42] ; read params of window
sub eax,115
mov [size_x_var],ax
shr ax,1
mov [vect_x],ax
;
mov eax,[procinfo+46]
sub eax,30
mov [size_y_var],ax
shr ax,1
mov [vect_y],ax
mov eax,[procinfo+34]
mov [x_start],ax
mov eax,[procinfo+38]
mov [y_start],ax
call alloc_buffer_mem ;realloc mem for scr & z buffs
call draw_window call draw_window
jmp noclose jmp noclose
@ -707,7 +738,7 @@ end if
pop eax pop eax
mov eax,7 ; put image mov eax,7 ; put image
mov ebx,screen mov ebx,[screen_ptr]
mov ecx,[size_y_var] mov ecx,[size_y_var]
; mov ecx,SIZE_X shl 16 + SIZE_Y ; mov ecx,SIZE_X shl 16 + SIZE_Y
mov edx,5 shl 16 + 25 mov edx,5 shl 16 + 25
@ -765,9 +796,45 @@ include "ASC.INC"
alloc_buffer_mem: alloc_buffer_mem:
mov eax, 68
mov ebx, 11
int 0x40 ; -> create heap, to be sure
movzx ecx,word[size_x_var] movzx ecx,word[size_x_var]
movzx eax,word[size_y_var] movzx eax,word[size_y_var]
mul ecx mul ecx
; add eax,100
push eax
lea ecx,[eax*3]
mov eax,68
mov ebx,20
mov edx,[screen_ptr]
cmp [draw_win_at_first],1
jne @f
xor edx,edx
@@:
int 0x40
mov [screen_ptr],eax
pop ecx
shl ecx,2
mov eax,68
mov ebx,20
mov edx,[Zbuffer_ptr]
cmp [draw_win_at_first],1
jne @f
xor edx,edx
@@:
int 0x40
mov [Zbuffer_ptr],eax
if 0
;old Menuet style alloc
movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
add eax,200
mul ecx
lea ecx,[eax*3] lea ecx,[eax*3]
add ecx,16 add ecx,16
and ecx,0xfffffff0 and ecx,0xfffffff0
@ -782,6 +849,7 @@ alloc_buffer_mem:
mov [Zbuffer_ptr],MEM_END mov [Zbuffer_ptr],MEM_END
pop ecx pop ecx
add [Zbuffer_ptr],ecx add [Zbuffer_ptr],ecx
end if
ret ret
update_flags: update_flags:
@ -1648,7 +1716,7 @@ sort_triangles:
ret ret
clrscr: clrscr:
mov edi,screen mov edi,[screen_ptr]
movzx ecx,word[size_x_var] movzx ecx,word[size_x_var]
movzx eax,word[size_y_var] movzx eax,word[size_y_var]
imul ecx,eax imul ecx,eax
@ -1916,7 +1984,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
lea edi,[screen] mov edi,[screen_ptr]
cmp [catmull_flag],0 cmp [catmull_flag],0
je @f je @f
; lea esi,[Z_buffer] ; lea esi,[Z_buffer]
@ -1984,7 +2052,7 @@ draw_triangles:
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
; mov edi,screen ; mov edi,screen
lea edi,[screen] mov edi,[screen_ptr]
cmp [catmull_flag],0 cmp [catmull_flag],0
je @f je @f
; lea esi,[Z_buffer] ; lea esi,[Z_buffer]
@ -2048,7 +2116,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov esi,envmap mov esi,envmap
cmp [catmull_flag],0 cmp [catmull_flag],0
je @f je @f
@ -2184,7 +2252,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov esi,envmap mov esi,envmap
mov edx,bumpmap ;BUMP_MAPPING mov edx,bumpmap ;BUMP_MAPPING
@ -2224,7 +2292,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov esi,texmap mov esi,texmap
cmp [catmull_flag],0 cmp [catmull_flag],0
je @f je @f
@ -2338,7 +2406,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov edx,texmap mov edx,texmap
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
@ -2399,7 +2467,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov esi,texmap mov esi,texmap
mov edx,envmap mov edx,envmap
@ -2481,7 +2549,7 @@ draw_triangles:
ror ebx,16 ror ebx,16
mov ecx,dword[xx3] mov ecx,dword[xx3]
ror ecx,16 ror ecx,16
mov edi,screen mov edi,[screen_ptr]
mov esi,envmap mov esi,envmap
mov edx,bumpmap mov edx,bumpmap
@ -2527,7 +2595,7 @@ draw_triangles:
; mov bl,[eax] ; ; mov bl,[eax] ;
; test bl,00000001b ; ; test bl,00000001b ;
; jz @f ; ; jz @f ;
mov edi,screen mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
mov eax,[col1] mov eax,[col1]
@ -2562,7 +2630,7 @@ draw_triangles:
; test bl,00000010b ; test bl,00000010b
; jz @f ; jz @f
mov edi,screen mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
mov eax,[col1] mov eax,[col1]
@ -2598,7 +2666,7 @@ draw_triangles:
; test bl,00000100b ; ; test bl,00000100b ;
; jz @f ; ; jz @f ;
mov edi,screen mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr] mov esi,[Zbuffer_ptr]
mov eax,[col3] mov eax,[col3]
@ -3107,13 +3175,18 @@ ret
; DRAW WINDOW ; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window mov eax,0 ; function 0 : define and draw window
mov ebx,50*65536;+SIZE_X;+80+30 ; [x start] *65536 + [x size] mov bx,[x_start]
mov ecx,50*65536;+SIZE_Y;+30 ; [y start] *65536 + [y size] shl ebx,16
mov cx,[y_start]
shl ecx,16
;ebx - [x start] *65536 + [x size]
;ecx - [y start] *65536 + [y size]
mov bx,[size_x_var] mov bx,[size_x_var]
add bx,115 add bx,115
mov cx,[size_y_var] mov cx,[size_y_var]
add cx,30 add cx,30
mov edx,0x14000000 ; color of work area RRGGBB,8->color gl ; @@:
mov edx,0x13000000 ; color of work area RRGGBB,8->color gl
mov edi,labelt ; WINDOW LABEL mov edi,labelt ; WINDOW LABEL
int 0x40 int 0x40