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 |
|
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,7 → 77,10 |
shr ax,1 |
mov [vect_x],ax |
|
mov eax, 20 shl 16 + 20 |
mov [x_start],eax |
|
|
call alloc_buffer_mem |
call read_param |
call read_from_disk ; read, if all is ok eax = 0 |
107,6 → 113,10 |
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 |
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 |
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 |
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,10 → 796,46 |
|
|
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 |
push ecx |
782,6 → 849,7 |
mov [Zbuffer_ptr],MEM_END |
pop ecx |
add [Zbuffer_ptr],ecx |
end if |
ret |
|
update_flags: |
1648,7 → 1716,7 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
; 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 |
; test bl,00000010b |
; jz @f |
|
mov edi,screen |
mov edi,[screen_ptr] |
mov esi,[Zbuffer_ptr] |
|
mov eax,[col1] |
2598,7 → 2666,7 |
; test bl,00000100b ; |
; jz @f ; |
|
mov edi,screen |
mov edi,[screen_ptr] |
mov esi,[Zbuffer_ptr] |
|
mov eax,[col3] |
3107,13 → 3175,18 |
|
; 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 |
|