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
mov edi,[screen_ptr]
movzx ecx,word[size_x_var] ;SIZE_X*3/4
lea ecx,[ecx*3]
lea ecx,[ecx*3+1]
shr ecx,2
; mov ecx,SIZE_X*3/4
xor eax,eax
rep stosd

View File

@ -38,7 +38,7 @@
XYZpartices:
db 'X','Y','Z'
i10 dw 10
draw_win_at_first db 1
menu:
db 2 ; button number = index
@ -314,7 +314,7 @@ base_vector:
if Ext=SSE2
db ' (SSE2)'
end if
db ' 0.066',0
db ' 0.067',0
labellen:
STRdata db '-1 '
@ -440,6 +440,10 @@ align 8
dw ?
size_x_var:
dw ?
x_start:
dw ?
y_start:
dw ?
;===
@ -526,6 +530,8 @@ end if
; screen rb SIZE_X * SIZE_Y * 3 ; screen buffer
;align 16
; Z_buffer rb SIZE_X * SIZE_Y * 4
procinfo:
rb 1024 ; process info
I_Param rb 256
memStack rb 4000 ;memory area for stack
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
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.
What's new?
1. App window size according to current screen resolution;
2, New emboss procedure.
1. Sizable app window.
Buttons description:
1. rotary: choosing rotary axle: x, y, x+y.
@ -35,4 +35,4 @@ Buttons description:
20. bright - -> decrease picture brightness.
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.
; compiler : FASM
; system : KolibriOS
@ -54,15 +54,18 @@ use32
START: ; start of execution
cld
mov eax,14
int 0x40
sub eax,150 shl 16 + 150
; mov eax,14 ; window size according to cur res ...
; int 0x40
; sub eax,150 shl 16 + 150
mov eax, 600 shl 16 + 600 ; ... or set manually
mov [size_y_var],ax
shr ax,1
mov [vect_y],ax
shr ax,1
shr ax,2
movzx ebx,ax
lea ebx,[ebx*3]
push ebx
fninit
fild dword[esp]
@ -74,6 +77,9 @@ START: ; start of execution
shr ax,1
mov [vect_x],ax
mov eax, 20 shl 16 + 20
mov [x_start],eax
call alloc_buffer_mem
call read_param
@ -107,6 +113,10 @@ START: ; start of execution
end if
call read_from_file
.opt:
; call alloc_buffer_mem ; alloc memfor screnn and z buffer
call optimize_object1 ; proc in file b_procs.asm
; set point(0,0,0) in center and calc all coords
; to be in <-1.0,1.0>
@ -117,12 +127,12 @@ START: ; start of execution
call init_envmap_cub
call generate_texture2
call init_sincos_tab
call do_color_buffer ; intit color_map
mov edi,bumpmap
call calc_bumpmap
call calc_bumpmap_coords ; bump and texture mapping
call draw_window
mov [draw_win_at_first],0
still:
@ -144,6 +154,27 @@ still:
jmp noclose
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
jmp noclose
@ -707,7 +738,7 @@ end if
pop eax
mov eax,7 ; put image
mov ebx,screen
mov ebx,[screen_ptr]
mov ecx,[size_y_var]
; mov ecx,SIZE_X shl 16 + SIZE_Y
mov edx,5 shl 16 + 25
@ -765,9 +796,45 @@ include "ASC.INC"
alloc_buffer_mem:
mov eax, 68
mov ebx, 11
int 0x40 ; -> create heap, to be sure
movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
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]
add ecx,16
and ecx,0xfffffff0
@ -782,6 +849,7 @@ alloc_buffer_mem:
mov [Zbuffer_ptr],MEM_END
pop ecx
add [Zbuffer_ptr],ecx
end if
ret
update_flags:
@ -1648,7 +1716,7 @@ sort_triangles:
ret
clrscr:
mov edi,screen
mov edi,[screen_ptr]
movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
imul ecx,eax
@ -1916,7 +1984,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
lea edi,[screen]
mov edi,[screen_ptr]
cmp [catmull_flag],0
je @f
; lea esi,[Z_buffer]
@ -1984,7 +2052,7 @@ draw_triangles:
mov ecx,dword[xx3]
ror ecx,16
; mov edi,screen
lea edi,[screen]
mov edi,[screen_ptr]
cmp [catmull_flag],0
je @f
; lea esi,[Z_buffer]
@ -2048,7 +2116,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov esi,envmap
cmp [catmull_flag],0
je @f
@ -2184,7 +2252,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov esi,envmap
mov edx,bumpmap ;BUMP_MAPPING
@ -2224,7 +2292,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov esi,texmap
cmp [catmull_flag],0
je @f
@ -2338,7 +2406,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov edx,texmap
mov esi,[Zbuffer_ptr]
@ -2399,7 +2467,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov esi,texmap
mov edx,envmap
@ -2481,7 +2549,7 @@ draw_triangles:
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,screen
mov edi,[screen_ptr]
mov esi,envmap
mov edx,bumpmap
@ -2527,7 +2595,7 @@ draw_triangles:
; mov bl,[eax] ;
; test bl,00000001b ;
; jz @f ;
mov edi,screen
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col1]
@ -2562,7 +2630,7 @@ draw_triangles:
; test bl,00000010b
; jz @f
mov edi,screen
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col1]
@ -2598,7 +2666,7 @@ draw_triangles:
; test bl,00000100b ;
; jz @f ;
mov edi,screen
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col3]
@ -3107,13 +3175,18 @@ ret
; 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 ecx,50*65536;+SIZE_Y;+30 ; [y start] *65536 + [y size]
mov bx,[x_start]
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]
add bx,115
mov cx,[size_y_var]
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
int 0x40