Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8047 → Rev 8046

/programs/demos/3DS/3R_PHG.INC
File deleted
/programs/demos/3DS/3GLASS.INC
File deleted
/programs/demos/3DS/DATA.INC
1,7 → 1,6
; DATA AREA ************************************
 
i3 dw 3
i12 dd 12
i256 dw 256
i255d dd 255
dot_max dd 1.0 ; dot product max and min
65,7 → 64,6
dw 0
edit_end_y dw 0
mouse_state dd 0
 
menu:
db 2 ; button number = index
db 'rotary ' ; label
75,11 → 73,7
 
db 3
db 'shd. model'
if Ext >= SSE3
db 13
else
db 12
end if
dr_flag db 0 ; 6 - dots
dd shd_f
 
248,9 → 242,6
;; dd color_component_f
 
 
 
 
 
db -1 ; end mark
 
 
268,7 → 259,6
db 'btex'
db 'cenv'
db 'grdl'
db 'rphg'
spd_f:
db 'idle'
db 'full'
354,10 → 344,7
if Ext=SSE2
db ' (SSE2)'
end if
if Ext=SSE3
db ' (SSE3)'
end if
db ' 0.070',0
db ' 0.069b',0
labellen:
STRdata db '-1 '
 
433,19 → 420,9
;===============================================
 
lightsend:
 
 
 
 
align 16
emboss_bias:
dw 128, 128, 128, 128, 128, 128, 128, 128
zero_hgst_dd:
dd -1, -1, -1, 0
mask_255f:
times 4 dd 255.0
the_zero:
times 4 dd 0.0
 
I_END:
if USE_LFN = 0
582,11 → 559,6
tex_points rb points_count * 4 ; bump_map and texture coords
; each point word x, word y
align 16
lights_aligned:
lights_aligned_end = $ + 16 * 12
rb 16 * 12
 
 
if Ext >= SSE2
sse_repository rb 1024
end if
599,7 → 571,6
procinfo:
rb 1024 ; process info
I_Param rb 256
memStack:
rb 2000
memStack rb 4000 ;memory area for stack
align 16
screen:
/programs/demos/3DS/VIEW3DS.ASM
1,11 → 1,11
 
; application : View3ds ver. 0.070 - tiny .3ds and .asc files viewer
; application : View3ds ver. 0.069 - tiny .3ds and .asc files viewer
; with a few graphics effects demonstration.
; compiler : FASM
; system : KolibriOS
; author : Macgub aka Maciej Guba
; email : macgub3@wp.pl
; web : http://macgub.vxm.pl
; web : www.macgub.hekko.pl
; Fell free to use this intro in your own distribution of KolibriOS.
; Special greetings to KolibriOS team .
; I hope because my demos Christian Belive will be near to each of You.
36,7 → 36,6
MMX = 1
SSE = 2
SSE2 = 3
SSE3 = 4
Ext = SSE2 ;Ext={ NON | MMX | SSE | SSE2 }
 
; 0 for short names (Menuet-compatible), 1 for long names (Kolibri features)
55,6 → 54,9
 
START: ; start of execution
cld
; mov eax,14 ; window size according to cur res ...
; int 0x40
; sub eax,150 shl 16 + 150
mov eax, 500 shl 16 + 600 ; ... or set manually
mov [size_y_var],ax
shr ax,1
92,10 → 94,15
je .gen
jmp .malloc
.gen:
if USE_LFN
mov [triangles_count_var],1000
mov [points_count_var],1000
call alloc_mem_for_tp
end if
call generate_object
jmp .opt
.asc:
mov [triangles_count_var],10000 ; to do: read asc header
mov [triangles_count_var],10000
mov [points_count_var],10000
call alloc_mem_for_tp
call read_asc
108,14 → 115,12
.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>
call normalize_all_light_vectors
if Ext >= SSE3
call copy_lights ; to aligned float
end if
call init_triangles_normals2
call init_point_normals
call init_envmap2
285,9 → 290,6
jne .next_m5 ; 'grd ' 1
call make_random_lights ; 'env ' 2
call normalize_all_light_vectors ; 'bump' 3
if Ext >= SSE3
call copy_lights
end if
call do_color_buffer ; intit color_map ; 'tex ' 4
; cmp [emboss_flag],1 ; 'pos ' 5
; je @f ; 'dots' 6
330,13 → 332,13
.next_m:
cmp ah,18
jne .next_m2
 
if USE_LFN
mov [re_alloc_flag],1 ; reallocate memory
mov [triangles_count_var],1000
mov [points_count_var],1000
call alloc_mem_for_tp
mov [re_alloc_flag],0
 
end if
mov bl,[generator_flag]
; or bl,bl
; jz .next_m2
534,6 → 536,11
mov ecx,[points_count_var]
call rotary
 
; RDTSC
; pop ebx
; sub eax,ebx
; sub eax,41
; push eax
 
mov esi,[points_rotated_ptr]
mov edi,[points_translated_ptr]
540,6 → 547,10
mov ecx,[points_count_var]
call translate_points
 
; cmp [dr_flag],5
; jne @f
; call calc_attenuation_light
; @@:
cmp [fire_flag],0
jne @f
call clrscr ; clear the screen
557,6 → 568,8
@@:
call fill_Z_buffer ; make background
.non_f:
; RDTSC
; push eax
cmp [dr_flag],6
jne @f
call draw_dots
729,22 → 742,13
loop .dc
pop eax
 
 
mov eax,7 ; put image
mov ebx,[screen_ptr]
mov ecx,[size_y_var]
; mov ecx,SIZE_X shl 16 + SIZE_Y
mov edx,[offset_y] ;5 shl 16 + 25
cmp [dr_flag],12
je .ff
int 0x40
jmp .f
.ff:
mov eax,65
mov esi,32
xor ebp,ebp
int 0x40
.f:
 
mov eax,13
mov bx,[size_x_var]
add ebx,18
769,7 → 773,9
int 40h
 
 
; addsubps xmm0,xmm0
 
 
jmp still
 
;--------------------------------------------------------------------------------
791,9 → 797,6
include "GRD_TEX.INC"
include "TWO_TEX.INC"
include "ASC.INC"
if Ext >= SSE3
include "3r_phg.inc"
end if
clear_vertices_index:
mov edi,[vertices_index_ptr]
movzx eax,word[size_x_var]
822,15 → 825,9
movzx edx,word[size_x_var]
imul edx,ecx
add ebx,edx
push ebx
 
lea ecx,[ebx*2]
lea ebx,[ebx*3]
 
cmp [dr_flag],12
jne @f
add ebx,[esp]
@@:
add esp,4
add ebx,[screen_ptr]
mov ebx,[ebx]
and ebx,0x00ffffff
871,6 → 868,18
 
; left button pressed
 
; macro check_bar
; {
; movzx ebx,word[.x_coord]
; movzx ecx,word[.y_coord]
; imul ebx,ecx
; lea ecx,[ebx*2]
; lea ebx,[ebx*3]
; add ebx,[screen_ptr]
; mov ebx,[ebx]
; and ebx,0x00ffffff
; cmp ebx,0x00ff0000 ; is handle bar ?
; }
 
check_bar
jne .no_edit
976,7 → 985,7
mul ecx
 
mov [.temp],eax
lea ecx,[eax*4] ; more mem for r_phg cause
lea ecx,[eax*3]
add ecx,256
mov eax,68
mov ebx,20
1011,6 → 1020,28
 
 
 
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
shl eax,2
add ecx,eax
add ecx,MEM_END
mov ebx,1
mov eax,64 ; allocate mem - resize app mem
int 0x40
mov [screen_ptr],MEM_END
mov [Zbuffer_ptr],MEM_END
pop ecx
add [Zbuffer_ptr],ecx
end if
ret
 
update_flags:
; updates flags and writing flag description
1032,7 → 1063,6
add edi,17
cmp byte[edi],-1
jne .ch_another
jmp .no_write
.write:
; clreol {pascal never dies}
; * eax = 13 - function number
1417,6 → 1447,39
mov esp,ebp
pop ebp
ret
if 0
init_triangles_normals:
mov ebx,triangles_normals
mov ebp,triangles
@@:
push ebx
mov ebx,vectors
mov esi,dword[ebp] ; first point index
lea esi,[esi*3]
lea esi,[points+esi*2] ; esi - pointer to 1st 3d point
movzx edi,dword[ebp+4] ; second point index
lea edi,[edi*3]
lea edi,[points+edi*2] ; edi - pointer to 2nd 3d point
call make_vector
add ebx,12
mov esi,edi
movzx edi,dword[ebp+8] ; third point index
lea edi,[edi*3]
lea edi,[points+edi*2]
call make_vector
mov edi,ebx ; edi - pointer to 2nd vector
mov esi,ebx
sub esi,12 ; esi - pointer to 1st vector
pop ebx
call cross_product
mov edi,ebx
call normalize_vector
add ebp,12
add ebx,12
cmp dword[ebp],-1
jne @b
ret
end if
 
init_point_normals:
.x equ dword [ebp-4]
1536,46 → 1599,326
; cmp dword[ebp],-1
; jne @b
ret
if 0 ; ind 64 but
 
if Ext >= SSE3
copy_lights: ; after normalising !
mov esi,lights
mov edi,lights_aligned
mov ecx,3
.again:
push ecx
mov ecx,3
cld
rep movsd
xor eax,eax
stosd
mov ecx,3
.b:
push ecx
mov ecx,3
;=================================================================
sort_triangles:
mov esi,[triangles_ptr]
mov edi,triangles_with_z
mov ebp,[points_translated_ptr]
 
make_triangle_with_z: ;makes list with triangles and z position
movzx eax,word[esi]
lea eax,[eax*3]
movzx ecx,word[ebp+eax*2+4]
 
movzx eax,word[esi+2]
lea eax,[eax*3]
add cx,word[ebp+eax*2+4]
 
movzx eax,word[esi+4]
lea eax,[eax*3]
add cx,word[ebp+eax*2+4]
 
mov ax,cx
; cwd
; idiv word[i3]
movsd ; store vertex coordinates
movsw
stosw ; middle vertex coordinate 'z' in triangles_with_z list
cmp dword[esi],-1
jne make_triangle_with_z
movsd ; copy end mark
mov eax,4
lea edx,[edi-8-trizdd]
; lea edx, [edi-8]
; sub edx,[triangles_w_z_ptr]
mov [high],edx
call quicksort
mov eax,4
mov edx,[high]
call insertsort
jmp end_sort
 
quicksort:
mov ecx,edx
sub ecx,eax
cmp ecx,32
jc .exit
lea ecx,[eax+edx]
shr ecx,4
lea ecx,[ecx*8-4];
; mov edi,[triangles_w_z_ptr]
; mov ebx,[edi+eax]
; mov esi,[edi+ecx]
; mov edi,[edi+edx]
mov ebx,[trizdd+eax]; trizdd[l]
mov esi,[trizdd+ecx]; trizdd[i]
mov edi,[trizdd+edx]; trizdd[h]
cmp ebx,esi
jg @f ; direction NB! you need to negate these to invert the order
if Ext=NON
mov [trizdd+eax],esi
mov [trizdd+ecx],ebx
mov ebx,[trizdd+eax-4]
mov esi,[trizdd+ecx-4]
mov [trizdd+eax-4],esi
mov [trizdd+ecx-4],ebx
mov ebx,[trizdd+eax]
mov esi,[trizdd+ecx]
else
; push ebx
; mov ebx,[triangles_w_z_ptr]
; movq mm0,[ebx+eax-4]
; movq mm1,[ebx+ecx-4]
; movq [ebx+ecx-4],mm0
; movq [ebx+eax-4],mm1
; pop ebx
movq mm0,[trizdq+eax-4]
movq mm1,[trizdq+ecx-4]
movq [trizdq+ecx-4],mm0
movq [trizdq+eax-4],mm1
xchg ebx,esi
end if
@@:
movzx ebx,byte[esi]
cvtsi2ss xmm0,ebx
movss [edi],xmm0
inc esi
add edi,4
loop @b
stosd
pop ecx
loop .b
inc esi ; skip shiness
pop ecx
loop .again
cmp ebx,edi
jg @f ; direction
if Ext=NON
mov [trizdd+eax],edi
mov [trizdd+edx],ebx
mov ebx,[trizdd+eax-4]
mov edi,[trizdd+edx-4]
mov [trizdd+eax-4],edi
mov [trizdd+edx-4],ebx
mov ebx,[trizdd+eax]
mov edi,[trizdd+edx]
else
; push ebx
; mov ebx,[triangles_w_z_ptr]
; movq mm0,[ebx+eax-4]
; movq mm1,[ebx+edx-4]
; movq [ebx+edx-4],mm0
; movq [ebx+eax-4],mm1
movq mm0,[trizdq+eax-4]
movq mm1,[trizdq+edx-4]
movq [trizdq+edx-4],mm0
movq [trizdq+eax-4],mm1
; pop ebx
xchg ebx,edi
end if
@@:
cmp esi,edi
jg @f ; direction
if Ext=NON
mov [trizdd+ecx],edi
mov [trizdd+edx],esi
mov esi,[trizdd+ecx-4]
mov edi,[trizdd+edx-4]
mov [trizdd+ecx-4],edi
mov [trizdd+edx-4],esi
else
; push ebx
; mov ebx,[triangles_w_z_ptr]
; movq mm0,[ebx+ecx-4]
; movq mm1,[ebx+edx-4]
; movq [ebx+edx-4],mm0
; movq [ebx+ecx-4],mm1
; pop ebx
 
movq mm0,[trizdq+ecx-4]
movq mm1,[trizdq+edx-4]
movq [trizdq+edx-4],mm0
movq [trizdq+ecx-4],mm1
xchg ebx,esi
end if
@@:
mov ebp,eax ; direction
add ebp,8 ; j
if Ext=NON
mov esi,[trizdd+ebp]
mov edi,[trizdd+ecx]
mov [trizdd+ebp],edi
mov [trizdd+ecx],esi
mov esi,[trizdd+ebp-4]
mov edi,[trizdd+ecx-4]
mov [trizdd+ecx-4],esi
mov [trizdd+ebp-4],edi
else
; push ebx
; mov ebx,[triangles_w_z_ptr]
; movq mm0,[ebx+ebp-4]
; movq mm1,[ebx+ecx-4]
; movq [ebx+ecx-4],mm0
; movq [ebx+ebp-4],mm1
; pop ebx
 
movq mm0,[trizdq+ebp-4]
movq mm1,[trizdq+ecx-4]
movq [trizdq+ecx-4],mm0
movq [trizdq+ebp-4],mm1
end if
mov ecx,edx ; i; direction
mov ebx,[trizdd+ebp]; trizdd[j]
; mov ebx, [triangles_w_z_ptr]
; add ebx, ebp
 
; push eax
; mov eax, [triangles_w_z_ptr]
.loop:
sub ecx,8 ; direction
cmp [trizdd+ecx],ebx
; cmp [eax+ecx],ebx
jl .loop ; direction
@@:
add ebp,8 ; direction
cmp [trizdd+ebp],ebx
; cmp [eax+ebp],ebx
jg @b ; direction
cmp ebp,ecx
jge @f ; direction
if Ext=NON
mov esi,[trizdd+ecx]
mov edi,[trizdd+ebp]
mov [trizdd+ebp],esi
mov [trizdd+ecx],edi
mov edi,[trizdd+ecx-4]
mov esi,[trizdd+ebp-4]
mov [trizdd+ebp-4],edi
mov [trizdd+ecx-4],esi
else
; movq mm0,[eax+ecx-4]
; movq mm1,[eax+ebp-4]
; movq [eax+ebp-4],mm0
; movq [eax+ecx-4],mm1
movq mm0,[trizdq+ecx-4]
movq mm1,[trizdq+ebp-4]
movq [trizdq+ebp-4],mm0
movq [trizdq+ecx-4],mm1
end if
jmp .loop
; pop eax
@@:
if Ext=NON
mov esi,[trizdd+ecx]
mov edi,[trizdd+eax+8]
mov [trizdd+eax+8],esi
mov [trizdd+ecx],edi
mov edi,[trizdd+ecx-4]
mov esi,[trizdd+eax+4]
mov [trizdd+eax+4],edi
mov [trizdd+ecx-4],esi
else
; push edx
; mov edx,[triangles_w_z_ptr]
; movq mm0,[edx+ecx-4]
; movq mm1,[edx+eax+4]; dir
; movq [edx+eax+4],mm0; dir
; movq [edx+ecx-4],mm1
; pop edx
 
movq mm0,[trizdq+ecx-4]
movq mm1,[trizdq+eax+4]; dir
movq [trizdq+eax+4],mm0; dir
movq [trizdq+ecx-4],mm1
end if
add ecx,8
push ecx edx
mov edx,ebp
call quicksort
pop edx eax
call quicksort
.exit:
ret
insertsort:
mov esi,eax
.start:
add esi,8
cmp esi,edx
ja .exit
mov ebx,[trizdd+esi]
; mov ebx,[triangles_w_z_ptr]
; add ebx,esi
if Ext=NON
mov ecx,[trizdd+esi-4]
else
; push ebx
; mov ebx,[triangles_w_z_ptr]
; movq mm1,[ebx+esi-4]
movq mm1,[trizdq+esi-4]
; pop ebx
end if
 
mov edi,esi
@@:
cmp edi,eax
jna @f
; push eax
; mov eax,[triangles_w_z_ptr]
; cmp [eax+edi-8],ebx
; pop eax
cmp [trizdd+edi-8],ebx
jg @f ; direction
if Ext=NON
mov ebp,[trizdd+edi-8]
mov [trizdd+edi],ebp
mov ebp,[trizdd+edi-12]
mov [trizdd+edi-4],ebp
else
; push eax
; mov eax,[triangles_w_z_ptr]
; movq mm0,[eax+edi-12]
; movq [eax+edi-4],mm0
movq mm0,[trizdq+edi-12]
movq [trizdq+edi-4],mm0
; pop eax
end if
sub edi,8
jmp @b
@@:
if Ext=NON
mov [trizdd+edi],ebx
mov [trizdd+edi-4],ecx
else
; push eax
; mov eax,[triangles_w_z_ptr]
; movq [eax+edi-4],mm1
movq [trizdq+edi-4],mm1
; pop eax
end if
jmp .start
.exit:
ret
end_sort:
; translate triangles_with_z to sorted_triangles
mov esi,triangles_with_z
; mov esi,[triangles_w_z_ptr]
; mov edi,sorted_triangles
mov edi,[triangles_ptr]
again_copy:
if Ext=NON
movsd
movsw
add esi,2
else
movq mm0,[esi]
movq [edi],mm0
add esi,8
add edi,6
end if
cmp dword[esi],-1
jne again_copy
; if Ext=MMX
; emms
; end if
movsd ; copy end mark too
ret
end if ; 64 ind
clrscr:
mov edi,[screen_ptr]
movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
imul ecx,eax
 
 
lea ecx,[ecx*3]
shr ecx,2
xor eax,eax
if Ext=NON
rep stosd
1787,10 → 2130,7
je .cubic_env_mapping
cmp [dr_flag],11
je .draw_smooth_line
if Ext >= SSE3
cmp [dr_flag],12
je .r_phg
end if ; ****************
; ****************
mov esi,point_index3 ; do Gouraud shading
mov ecx,3
.again_grd_draw:
2613,73 → 2953,8
push [xx2]
 
call smooth_line
jmp .end_draw
@@:
if Ext >= SSE3
.r_phg:
 
 
movd xmm5,[size_y_var]
punpcklwd xmm5,[the_zero]
pshufd xmm5,xmm5,01110011b
 
 
mov eax,[point_index1]
mov ebx,[point_index2]
mov ecx,[point_index3]
imul eax,[i12]
imul ebx,[i12]
imul ecx,[i12]
add eax,[points_normals_rot_ptr]
add ebx,[points_normals_rot_ptr]
add ecx,[points_normals_rot_ptr]
movups xmm0,[eax]
movups xmm1,[ebx]
movups xmm2,[ecx]
andps xmm0,[zero_hgst_dd]
andps xmm1,[zero_hgst_dd]
andps xmm2,[zero_hgst_dd]
xorps xmm3,xmm3
 
mov eax,[point_index1]
mov ebx,[point_index2]
mov ecx,[point_index3]
imul eax,[i12]
imul ebx,[i12]
imul ecx,[i12]
add eax,[points_rotated_ptr]
add ebx,[points_rotated_ptr]
add ecx,[points_rotated_ptr]
push dword[ecx+8]
push dword[ebx+8]
push dword[eax+8]
movups xmm4,[esp]
add esp,12
andps xmm4,[zero_hgst_dd]
 
 
 
mov eax,dword[xx1]
ror eax,16
mov ebx,dword[xx2]
ror ebx,16
mov ecx,dword[xx3]
ror ecx,16
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
 
call real_phong_tri_z
 
jmp .end_draw
end if
 
 
 
 
 
 
 
 
.end_draw:
pop esi
add esi,12
2715,8 → 2990,6
push dword 0
 
movzx eax,word[size_x_var]
cmp [dr_flag],12
je @f
lea ebx,[eax*3]
sub ebx,18
add eax,eax
2723,18 → 2996,7
sub eax,12
mov [.xres3m18],ebx
mov [.xres2m12],eax
jmp .f
@@:
lea ebx,[eax*4]
sub ebx,4*6
add eax,eax
sub eax,3*4
mov [.xres3m18],ebx
mov [.xres2m12],eax
.f:
 
 
 
mov esi,[points_translated_ptr]
.loop:
push esi
2771,13 → 3033,7
; sub eax,3
imul eax,edx
add eax,ebx
push eax
lea edi,[eax*3]
cmp [dr_flag],12
jne @f
add edi,[esp]
@@:
add esp,4
lea eax,[eax*2]
; draw bar 6x6
add edi,[screen_ptr]
2793,20 → 3049,13
push ecx
mov ecx,6
 
.do:
@@:
mov word[edi],0x0000 ;ax
mov byte[edi+2],0xff ;al
mov word[eax],dx
add eax,2
cmp [dr_flag],12
jne @f
add edi,4
loop .do
jmp .ad
@@:
add edi,3
loop .do
.ad:
loop @b
add edi,[.xres3m18]
add eax,[.xres2m12]
pop ecx
2828,10 → 3077,6
 
fill_Z_buffer:
mov eax,0x70000000
cmp [dr_flag],12
jne @f
mov eax,60000.1
@@:
mov edi,[Zbuffer_ptr]
movzx ecx,word[size_x_var]
movzx ebx,word[size_y_var]
/programs/demos/3DS/A_PROCS.INC
76,20 → 76,11
mul edx
; shl eax,9
add eax,dword .x
 
lea ebx,[eax*3]
cmp [dr_flag],12 ; 32 bit col cause
jne @f
add ebx,eax
@@:
mov eax,[esi]
mov [edi+ebx],eax
.skip:
add esi,3
cmp [dr_flag],12
jne @f
inc esi
@@:
inc dword .x
movzx edx,word[size_x_var]
cmp dword .x,edx ;SIZE_X
106,12 → 97,9
movzx ecx,word[size_x_var]
movzx eax,word[size_y_var]
imul ecx,eax
cmp [dr_flag],12
je @f
lea ecx,[ecx*3]
shr ecx,2
; mov ecx,SIZE_X*SIZE_Y*3/4
@@:
cld
rep movsd
 
168,42 → 156,23
sub ecx,ebx
mov esi,[screen_ptr]
mov edi,[Zbuffer_ptr]
cmp [dr_flag],12
je @f
lea ebx,[ebx*3]
jmp .f
@@:
shl ebx,2
.f:
mov edx,esi
add esi,ebx
lea ebx,[ebx+esi]
pxor xmm0,xmm0
push eax
.emb:
cmp [dr_flag],12
je @f
@@:
movlps xmm1,[esi+3]
movhps xmm1,[esi+6]
punpcklbw xmm1,xmm0
movlps xmm2,[esi-3]
movhps xmm2,[esi]
punpcklbw xmm2,xmm0
movlps xmm3,[ebx]
movhps xmm3,[ebx+3]
movlps xmm4,[edx]
movhps xmm4,[edx+3]
jmp .ff
@@:
movlps xmm1,[esi+4]
movhps xmm1,[esi+8]
movlps xmm2,[esi-4]
movhps xmm2,[esi]
movlps xmm3,[ebx]
movhps xmm3,[ebx+4]
movlps xmm4,[edx]
movhps xmm4,[edx+4]
.ff:
punpcklbw xmm1,xmm0
punpcklbw xmm2,xmm0
punpcklbw xmm3,xmm0
punpcklbw xmm4,xmm0
psubsw xmm1,xmm2
230,12 → 199,7
 
movd eax,xmm1
movzx eax,al
; cmp [dr_flag],12
; je @f
lea eax,[eax*3+envmap_cub]
; jmp .fff
;@@:
 
mov eax,[eax]
mov [edi],eax ;xmm1
psrldq xmm1,8
245,12 → 209,6
mov eax,[eax]
mov [edi+4],eax
 
cmp [dr_flag],12
jne @f
add esi,2
add ebx,2
add edx,2
@@:
 
add edi,8
add esi,6
257,23 → 215,17
add ebx,6
add edx,6
sub ecx,2
jnc .emb
jnc @b
 
 
pop ecx ;,eax
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
cmp [dr_flag],12
je .e
@@:
movsd
dec edi
loop @b
.e:
rep movsd
 
end if
 
ret
 
;align 16
/programs/demos/3DS/B_PROCS.INC
749,13 → 749,10
push ecx
mov edi,[screen_ptr]
movzx ecx,word[size_x_var] ;SIZE_X*3/4
 
cmp [dr_flag],12
je @f
lea ecx,[ecx*3+1]
shr ecx,2
@@:
 
; mov ecx,SIZE_X*3/4
xor eax,eax
rep stosd
if 1
763,16 → 760,9
movzx ecx,word[size_y_var]
sub ecx,3
imul ecx,ebx
cmp [dr_flag],12 ; 32 bit per pix cause
je @f
lea ecx,[ecx*3]
shr ecx,4
lea ebx,[ebx *3]
jmp .blr
@@:
 
shr ecx,2
shl ebx,2
; mov ecx,(SIZE_X*(SIZE_Y-3))*3/16
.blr:
@@:
781,19 → 771,15
mov ecx,edi
sub ecx,ebx
movups xmm1,[ecx]
cmp [dr_flag],12
je @f
movups xmm2,[edi-3]
movups xmm3,[edi+3]
jmp .f
@@:
movups xmm2,[edi-4]
movups xmm3,[edi+4]
.f:
 
pavgb xmm0,xmm1
pavgb xmm2,xmm3
pavgb xmm0,xmm2
 
psubusb xmm0,xmm5 ; importand if fire
 
movups [edi],xmm0
add edi,16
add esi,16
802,16 → 788,12
end if
xor eax,eax
movzx ecx,word[size_x_var]
cmp [dr_flag],12
je @f
lea ecx,[ecx*3]
shr ecx,2
@@:
; mov ecx,SIZE_X*3/4
rep stosd
pop ecx
dec ecx
jnz .again_blur
loop .again_blur
mov esp,ebp
pop ebp
end if
/programs/demos/3DS/History.txt
1,13 → 1,4
View3ds 0.069 - May 2020
1. KPacked files support by Leency.
2. 32bit vertices indexes and ability to load whole RAM limited objects.
(Above 65535 vertices and triangles), (by me).
3. I switch off painters algotithm mode (depth sorting). In app impelementetion it has
limited vertices count and produce less quality image than Z buffer Catmull algo.
In addition this switch off reduces app size, (by me).
 
-----------------------------------------------------------------------------------
 
View3ds 0.068 - XI 2016
1. Editing option - new 'editor' button.
2. For now I disable perspective correction, to make implemtation
/programs/demos/3DS/README.TXT
1,11 → 1,14
View3ds 0.070 - tiny viewer to .3ds and .asc files with several graphics
View3ds 0.069 - tiny viewer to .3ds and .asc files with several graphics
effects implementation.
 
 
What's new?
1. Some keys support by Leency.
2. New displaying model - real Phong - real not fake normal vector interpolation, normalising it and calculating
dot product (one for each light). It requires SSE3. (by me)
1. KPacked files support by Leency.
1. 32bit vertices indexes and ability to load whole RAM limited objects.
(Above 65535 vertices and triangles), (by me).
2. I switch off painters algotithm mode (depth sorting). In app impelementetion it has
limited vertices count and produce less quality image than Z buffer Catmull algo.
In addition this switch off reduces app size, (by me).
 
Buttons description:
1. rotary: choosing rotary axle: x, y, x+y.
14,7 → 17,7
pos (position shading depend), dots (app draws only points - nodes of object),
txgrd (texture mapping + smooth shading), 2tex (texture mapping + spherical
environment mapping), bmap (bump + texture mapping), cenv (cubic environment
mapping), grdl (Gouraud lines - edges only), rphg (real Phong).
mapping), grdl (Gouraud lines - edges only).
3. speed: idle, full.
4,5. zoom in, out: no comment.
6. catmull: disabled
39,4 → 42,4
is released apply current position. You may also decrease whole handlers count by enable culling (using
appropriate button) - some back handlers become hidden.
 
Maciej Guba VII 2020
Maciej Guba V 2020