forked from KolibriOS/kolibrios
view3ds 076 by macgub
git-svn-id: svn://kolibrios.org@9512 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e94c9d2b32
commit
ec81f654c0
@ -245,7 +245,7 @@ ret
|
|||||||
;---------------------- out : none ------------------------
|
;---------------------- out : none ------------------------
|
||||||
|
|
||||||
make_vector_r:
|
make_vector_r:
|
||||||
if Ext < SSE2
|
if Ext < SSE
|
||||||
fninit
|
fninit
|
||||||
fld dword[edi] ;edi+x3d
|
fld dword[edi] ;edi+x3d
|
||||||
fsub dword[esi] ;esi+x3d
|
fsub dword[esi] ;esi+x3d
|
||||||
@ -297,6 +297,7 @@ cross_product:
|
|||||||
fstp dword [ebx+vec_z]
|
fstp dword [ebx+vec_z]
|
||||||
ret
|
ret
|
||||||
cross_aligned:
|
cross_aligned:
|
||||||
|
; params as above cross_p
|
||||||
movaps xmm0,[esi]
|
movaps xmm0,[esi]
|
||||||
movaps xmm1,[esi]
|
movaps xmm1,[esi]
|
||||||
movaps xmm2,[edi]
|
movaps xmm2,[edi]
|
||||||
@ -607,6 +608,19 @@ ret
|
|||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
; esi - pointer to 3x3 matrix
|
; esi - pointer to 3x3 matrix
|
||||||
add_scale_to_matrix:
|
add_scale_to_matrix:
|
||||||
|
if Ext>SSE
|
||||||
|
movss xmm0,[rsscale]
|
||||||
|
shufps xmm0,xmm0,0
|
||||||
|
movups xmm1,[esi]
|
||||||
|
movups xmm2,[esi+16]
|
||||||
|
movss xmm3,[esi+32]
|
||||||
|
mulps xmm1,xmm0
|
||||||
|
mulps xmm2,xmm0
|
||||||
|
mulss xmm3,xmm0
|
||||||
|
movups [esi],xmm1
|
||||||
|
movups [esi+16],xmm2
|
||||||
|
movss [esi+32],xmm3
|
||||||
|
else
|
||||||
fninit
|
fninit
|
||||||
fld [rsscale]
|
fld [rsscale]
|
||||||
fld dword[esi] ;-----
|
fld dword[esi] ;-----
|
||||||
@ -639,14 +653,19 @@ add_scale_to_matrix:
|
|||||||
fld dword[esi+32]
|
fld dword[esi+32]
|
||||||
fmulp st1,st
|
fmulp st1,st
|
||||||
fstp dword[esi+32] ;------
|
fstp dword[esi+32] ;------
|
||||||
|
end if
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;in esi - offset to 3d points (point as 3 dwords float)
|
;in esi - offset to 3d points (point as 3 dwords float)
|
||||||
; edi - offset to 2d points ( as 3 words integer)
|
; edi - offset to 2d points ( as 3 words integer)
|
||||||
; ecx - number of points
|
; ecx - number of points
|
||||||
translate_points: ; just convert into integer; z coord still needed
|
translate_points: ; just convert into integer; z coord still needed
|
||||||
|
if Ext < SSE
|
||||||
fninit
|
fninit
|
||||||
|
else
|
||||||
|
; movaps xmm1,[vect_x]
|
||||||
|
end if
|
||||||
|
|
||||||
.again:
|
.again:
|
||||||
if 0
|
if 0
|
||||||
fld dword[esi+8]
|
fld dword[esi+8]
|
||||||
@ -676,7 +695,18 @@ translate_points: ; just convert into integer; z coord still needed
|
|||||||
fiadd [vect_y]
|
fiadd [vect_y]
|
||||||
fistp word[edi+2]
|
fistp word[edi+2]
|
||||||
end if
|
end if
|
||||||
; movups xmm0,[esi]
|
if Ext>=SSE
|
||||||
|
movups xmm0,[esi]
|
||||||
|
cvtps2dq xmm0,xmm0
|
||||||
|
packssdw xmm0,xmm0
|
||||||
|
paddw xmm0,[vect_x]
|
||||||
|
movd [edi],xmm0
|
||||||
|
; psrldq xmm0,4
|
||||||
|
; movd eax,xmm0
|
||||||
|
pextrw eax,xmm0,6
|
||||||
|
mov [edi+4],ax
|
||||||
|
else
|
||||||
|
|
||||||
; cvtps2dq xmm0,xmm0
|
; cvtps2dq xmm0,xmm0
|
||||||
; packsdw xmm0,xmm0
|
; packsdw xmm0,xmm0
|
||||||
; movq [edi]
|
; movq [edi]
|
||||||
@ -688,9 +718,12 @@ translate_points: ; just convert into integer; z coord still needed
|
|||||||
fistp word[edi+2]
|
fistp word[edi+2]
|
||||||
fld dword[esi+8]
|
fld dword[esi+8]
|
||||||
fistp word[edi+4]
|
fistp word[edi+4]
|
||||||
|
end if
|
||||||
|
|
||||||
add esi,12
|
add esi,12
|
||||||
add edi,6
|
add edi,6
|
||||||
dec ecx
|
; dec ecx
|
||||||
jnz .again
|
; jnz .again
|
||||||
|
loop .again
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
@ -341,7 +341,6 @@ end if
|
|||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
ret
|
ret
|
||||||
align 16
|
|
||||||
real_phong_line_z:
|
real_phong_line_z:
|
||||||
; in:
|
; in:
|
||||||
; xmm0 - normal vector 1
|
; xmm0 - normal vector 1
|
||||||
@ -456,7 +455,7 @@ real_phong_line_z:
|
|||||||
sub ecx,.lx1
|
sub ecx,.lx1
|
||||||
movaps xmm0,.n1
|
movaps xmm0,.n1
|
||||||
movss xmm2,.z1
|
movss xmm2,.z1
|
||||||
align 16
|
|
||||||
.ddraw:
|
.ddraw:
|
||||||
movss xmm7,xmm2
|
movss xmm7,xmm2
|
||||||
cmpnltss xmm7,dword[esi]
|
cmpnltss xmm7,dword[esi]
|
||||||
|
@ -353,7 +353,7 @@ end if
|
|||||||
|
|
||||||
|
|
||||||
ret
|
ret
|
||||||
align 16
|
|
||||||
ray_shd_l:
|
ray_shd_l:
|
||||||
; in:
|
; in:
|
||||||
; xmm0 - normal vector 1
|
; xmm0 - normal vector 1
|
||||||
@ -392,7 +392,7 @@ ray_shd_l:
|
|||||||
.dn equ [ebp-96]
|
.dn equ [ebp-96]
|
||||||
.dz equ [ebp-100]
|
.dz equ [ebp-100]
|
||||||
.y equ [ebp-104]
|
.y equ [ebp-104]
|
||||||
; .cur_tri equ [ebp-108]
|
.startx equ [ebp-108]
|
||||||
.cnv equ [ebp-128]
|
.cnv equ [ebp-128]
|
||||||
.Rlen equ [ebp-128-16]
|
.Rlen equ [ebp-128-16]
|
||||||
.r1 equ [ebp-128-32]
|
.r1 equ [ebp-128-32]
|
||||||
@ -431,6 +431,7 @@ ray_shd_l:
|
|||||||
movaps .n1,xmm0
|
movaps .n1,xmm0
|
||||||
movaps .n2,xmm1
|
movaps .n2,xmm1
|
||||||
mov .lx1,eax
|
mov .lx1,eax
|
||||||
|
; mov .startx,eax
|
||||||
mov .lx2,ebx
|
mov .lx2,ebx
|
||||||
movlps .z1,xmm3
|
movlps .z1,xmm3
|
||||||
|
|
||||||
@ -546,9 +547,15 @@ end if
|
|||||||
mov edi,[triangles_ptr]
|
mov edi,[triangles_ptr]
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
.nx_tri: ; next triangle
|
.nx_tri: ; next triangle
|
||||||
|
; mov eax,.lx1
|
||||||
|
; cmp eax,.startx
|
||||||
|
; je @f ; prevent artifact borders on tri
|
||||||
|
; cmp eax,.lx2 ; NOT work as I want !!
|
||||||
|
; je @f
|
||||||
|
|
||||||
cmp ecx,.cur_tri ; prevent self shadowing
|
cmp ecx,.cur_tri ; prevent self shadowing
|
||||||
je .skipp
|
je .skipp
|
||||||
|
@@:
|
||||||
if 0
|
if 0
|
||||||
mov edi,ecx
|
mov edi,ecx
|
||||||
imul edi,[i12]
|
imul edi,[i12]
|
||||||
|
@ -16,22 +16,22 @@ stencil_tri:
|
|||||||
.y3 equ [ebp-12]
|
.y3 equ [ebp-12]
|
||||||
|
|
||||||
.dx12 equ dword[ebp-20]
|
.dx12 equ dword[ebp-20]
|
||||||
.dx13 equ dword[ebp-24]
|
.dz12 equ dword[ebp-24]
|
||||||
.dx23 equ dword[ebp-28]
|
.dx13 equ dword[ebp-28]
|
||||||
.dz12 equ dword[ebp-32]
|
.dz13 equ dword[ebp-32]
|
||||||
.dz13 equ dword[ebp-36]
|
.dx23 equ dword[ebp-36]
|
||||||
.dz23 equ dword[ebp-40]
|
.dz23 equ dword[ebp-40]
|
||||||
.zz2 equ [ebp-44]
|
.zz2 equ [ebp-44]
|
||||||
.zz1 equ [ebp-48]
|
.zz1 equ [ebp-48]
|
||||||
.z3 equ [ebp-56]
|
.z3 equ [ebp-56]
|
||||||
.z2 equ [ebp-60]
|
.z2 equ [ebp-60]
|
||||||
.z1 equ [ebp-64]
|
.z1 equ [ebp-64]
|
||||||
.s_buff equ [ebp-68]
|
;.s_buff equ [ebp-68]
|
||||||
|
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
sub esp,128
|
; sub esp,128
|
||||||
and ebp,0xfffffff0
|
; and ebp,0xfffffff0
|
||||||
.sort2:
|
.sort2:
|
||||||
cmp ax,bx
|
cmp ax,bx
|
||||||
jle .sort1
|
jle .sort1
|
||||||
@ -44,19 +44,24 @@ stencil_tri:
|
|||||||
shufps xmm0,xmm0,11011000b
|
shufps xmm0,xmm0,11011000b
|
||||||
jmp .sort2
|
jmp .sort2
|
||||||
.sort3:
|
.sort3:
|
||||||
mov .y1,eax ; store triangle coordinates in user friendly variables
|
; mov .y1,eax ; store triangle coordinates in user friendly variables
|
||||||
mov .y2,ebx
|
; mov .y2,ebx
|
||||||
mov .y3,ecx
|
; mov .y3,ecx
|
||||||
|
push eax
|
||||||
|
push ebx
|
||||||
|
push ecx
|
||||||
|
sub esp,60
|
||||||
|
|
||||||
|
|
||||||
; mov edx,100.11
|
; mov edx,100.11
|
||||||
; movd xmm0,edx
|
; movd xmm0,edx
|
||||||
; shufps xmm0,xmm0,11100000b
|
; shufps xmm0,xmm0,11100000b
|
||||||
|
|
||||||
movaps .z1,xmm0
|
movups .z1,xmm0
|
||||||
; mov dword .z1,edx
|
; mov dword .z1,edx
|
||||||
; mov .z2,edx
|
; mov .z2,edx
|
||||||
; mov .z3,edx
|
; mov .z3,edx
|
||||||
mov .s_buff,esi
|
; mov .s_buff,esi
|
||||||
|
|
||||||
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
||||||
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
||||||
@ -157,7 +162,7 @@ stencil_tri:
|
|||||||
; mov edx,0.11
|
; mov edx,0.11
|
||||||
; movd xmm0,edx
|
; movd xmm0,edx
|
||||||
; shufps xmm0,xmm0,11100000b
|
; shufps xmm0,xmm0,11100000b
|
||||||
mov esi,.s_buff
|
; mov esi,.s_buff
|
||||||
|
|
||||||
call stencil_line
|
call stencil_line
|
||||||
|
|
||||||
@ -192,7 +197,7 @@ stencil_tri:
|
|||||||
sar ebx,ROUND2
|
sar ebx,ROUND2
|
||||||
sar eax,ROUND2
|
sar eax,ROUND2
|
||||||
movlps xmm0,.zz1
|
movlps xmm0,.zz1
|
||||||
mov esi,.s_buff
|
; mov esi,.s_buff
|
||||||
|
|
||||||
|
|
||||||
call stencil_line
|
call stencil_line
|
||||||
@ -215,7 +220,7 @@ stencil_tri:
|
|||||||
jl .loop2
|
jl .loop2
|
||||||
.loop2_end:
|
.loop2_end:
|
||||||
|
|
||||||
add esp,128
|
mov esp,ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -312,17 +317,19 @@ stencil_line:
|
|||||||
sub ecx,.x1
|
sub ecx,.x1
|
||||||
movss xmm2,.z1 ; cz
|
movss xmm2,.z1 ; cz
|
||||||
.ccalc:
|
.ccalc:
|
||||||
movss xmm1,xmm2
|
; movss xmm1,xmm2
|
||||||
cmpltss xmm1,dword[esi]
|
; cmpltss xmm1,dword[esi]
|
||||||
movd eax,xmm1
|
; movd eax,xmm1
|
||||||
cmp eax,-1
|
; cmp eax,-1
|
||||||
jnz @f
|
comiss xmm2,[esi]
|
||||||
|
ja @f
|
||||||
movss dword[esi],xmm2
|
movss dword[esi],xmm2
|
||||||
@@:
|
@@:
|
||||||
add esi,4
|
add esi,4
|
||||||
addss xmm2,.dz
|
addss xmm2,.dz
|
||||||
sub ecx,1
|
; sub ecx,1
|
||||||
jnz .ccalc
|
; jnz .ccalc
|
||||||
|
loop .ccalc
|
||||||
.l_quit:
|
.l_quit:
|
||||||
mov esp,ebp
|
mov esp,ebp
|
||||||
pop ebp
|
pop ebp
|
||||||
|
@ -1,4 +1,63 @@
|
|||||||
|
;=============================================================
|
||||||
|
|
||||||
|
remove_dead_tri:
|
||||||
|
; push ebp
|
||||||
|
; mov ebp,esp
|
||||||
|
mov edi,-1
|
||||||
|
movd xmm7,edi
|
||||||
|
pshufd xmm7,xmm7,0
|
||||||
|
|
||||||
|
mov esi,[triangles_ptr]
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
.chck:
|
||||||
|
; jecxz .cop
|
||||||
|
mov eax,[esi]
|
||||||
|
; mov ebx,[esi+4]
|
||||||
|
; mov edx,[esi+8]
|
||||||
|
cmp eax,[esi+4]
|
||||||
|
je .tri_fail
|
||||||
|
cmp eax,[esi+8]
|
||||||
|
je .tri_fail
|
||||||
|
mov eax,[esi+4]
|
||||||
|
cmp eax,[esi+8]
|
||||||
|
je .tri_fail
|
||||||
|
|
||||||
|
; cmp ebx,[esi]
|
||||||
|
; je .tri_fail
|
||||||
|
; cmp ebx,[esi+8]
|
||||||
|
; je .tri_fail
|
||||||
|
; cmp edx,[esi]
|
||||||
|
; je .tri_fail
|
||||||
|
; cmp edx,[esi+4]
|
||||||
|
; je .tri_fail
|
||||||
|
add esi,12
|
||||||
|
loop .chck
|
||||||
|
jmp .cop
|
||||||
|
.tri_fail:
|
||||||
|
movq [esi],xmm7
|
||||||
|
movd [esi+8],xmm7
|
||||||
|
add esi,12
|
||||||
|
loop .chck
|
||||||
|
.cop:
|
||||||
|
mov esi,[triangles_ptr]
|
||||||
|
mov edi,[triangles_ptr]
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
xor edx,edx
|
||||||
|
.cp:
|
||||||
|
cmp [esi],dword -1
|
||||||
|
je @f
|
||||||
|
movdqu xmm0,[esi]
|
||||||
|
movq [edi],xmm0
|
||||||
|
movhlps xmm0,xmm0
|
||||||
|
movd [edi+8],xmm0
|
||||||
|
add edi,12
|
||||||
|
inc edx
|
||||||
|
@@:
|
||||||
|
add esi,12
|
||||||
|
loop .cp
|
||||||
|
mov [triangles_count_var],edx
|
||||||
|
ret
|
||||||
|
;========================================================
|
||||||
|
|
||||||
if Ext > SSE2
|
if Ext > SSE2
|
||||||
;--------------------------------------------------------------------
|
;--------------------------------------------------------------------
|
||||||
|
File diff suppressed because it is too large
Load Diff
417
programs/demos/view3ds/chunks.inc
Normal file
417
programs/demos/view3ds/chunks.inc
Normal file
@ -0,0 +1,417 @@
|
|||||||
|
;=========================================================================
|
||||||
|
detect_chunks:
|
||||||
|
; make pivot table, sort, remove unused vertices, find chunks...
|
||||||
|
; in - some global variables
|
||||||
|
; out:
|
||||||
|
; ebx - chunks list ptr, every chunk as word
|
||||||
|
; ecx - chunks number
|
||||||
|
; esi - tri_ch ; vertices with triangles list
|
||||||
|
; edi - t_ptr ; pointers to tri_ch list
|
||||||
|
|
||||||
|
push ebp
|
||||||
|
mov ebp,esp
|
||||||
|
sub esp,60
|
||||||
|
|
||||||
|
|
||||||
|
.tri_ch equ dword[ebp-4] ; tri chunks list ptr
|
||||||
|
.chunks equ dword[ebp-8] ; chunks ptreach tri chunk No. as word
|
||||||
|
.endt equ dword[ebp-12] ;
|
||||||
|
.t_ptr equ dword[ebp-16] ; pointers list
|
||||||
|
.tri_ch1 equ dword[ebp-20] ;
|
||||||
|
.up equ dword[ebp-24] ; upload ptr
|
||||||
|
.chmr equ dword[ebp-28] ; bit mark list if tri stored
|
||||||
|
.str equ dword[ebp-32] ; store ptr
|
||||||
|
.ltch1 equ dword[ebp-36] ; end of tri_ch1 ptr
|
||||||
|
.ch_cnt equ dword[ebp-40]
|
||||||
|
.cntt equ dword[ebp-44]
|
||||||
|
.cc equ dword[ebp-48]
|
||||||
|
.lsparam equ dword[ebp-52]
|
||||||
|
.fix_mark equ dword[ebp-56]
|
||||||
|
.endVptr equ dword[ebp-60]
|
||||||
|
|
||||||
|
; some triangles have repeated indices of vertices
|
||||||
|
; check and remove such triangles
|
||||||
|
call remove_dead_tri
|
||||||
|
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
shl ecx,3
|
||||||
|
lea ecx,[ecx*3]
|
||||||
|
add ecx,100
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,12
|
||||||
|
int 0x40
|
||||||
|
mov .tri_ch,eax
|
||||||
|
|
||||||
|
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
imul ecx,[i12]
|
||||||
|
add ecx,32
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,12
|
||||||
|
int 0x40
|
||||||
|
mov .tri_ch1,eax
|
||||||
|
|
||||||
|
mov ecx,[points_count_var]
|
||||||
|
shl ecx,2
|
||||||
|
add ecx,1120
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,12
|
||||||
|
int 0x40
|
||||||
|
mov .t_ptr,eax
|
||||||
|
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
shl ecx,1
|
||||||
|
add ecx,20
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,12
|
||||||
|
int 0x40
|
||||||
|
mov .chunks,eax
|
||||||
|
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
shr ecx,3
|
||||||
|
add ecx,20
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,12
|
||||||
|
int 0x40
|
||||||
|
mov .chmr,eax ; chunks mark if bit is set - tri was used
|
||||||
|
|
||||||
|
mov edi,eax
|
||||||
|
pxor xmm0,xmm0
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
shr ecx,7
|
||||||
|
inc ecx
|
||||||
|
@@:
|
||||||
|
movdqa [edi],xmm0
|
||||||
|
add edi,16
|
||||||
|
loop @b
|
||||||
|
|
||||||
|
|
||||||
|
mov eax,[points_count_var]
|
||||||
|
imul eax,[i12]
|
||||||
|
add eax,[points_ptr]
|
||||||
|
mov .endVptr,eax
|
||||||
|
|
||||||
|
; make pivot table
|
||||||
|
|
||||||
|
mov edi,.tri_ch
|
||||||
|
mov esi,[triangles_ptr]
|
||||||
|
xor ecx,ecx
|
||||||
|
@@:
|
||||||
|
movd xmm1,ecx
|
||||||
|
movq xmm0,[esi]
|
||||||
|
pshufd xmm1,xmm1,0
|
||||||
|
movd xmm2,[esi+8]
|
||||||
|
punpckldq xmm0,xmm1
|
||||||
|
punpckldq xmm2,xmm1
|
||||||
|
movdqu [edi],xmm0
|
||||||
|
movq [edi+16],xmm2
|
||||||
|
add esi,12
|
||||||
|
add edi,24
|
||||||
|
inc ecx
|
||||||
|
cmp ecx,[triangles_count_var]
|
||||||
|
jnz @b
|
||||||
|
|
||||||
|
;sort
|
||||||
|
|
||||||
|
mov ebx,.tri_ch
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
lea ecx,[ecx*3]
|
||||||
|
|
||||||
|
mov esi,ecx
|
||||||
|
shl esi,3
|
||||||
|
add esi,ebx
|
||||||
|
mov .endt,esi
|
||||||
|
|
||||||
|
.ccc: ; ebx - vert index
|
||||||
|
mov eax,[ebx+8] ; ebx+4 - tri index
|
||||||
|
cmp eax,[ebx]
|
||||||
|
jge .g
|
||||||
|
movq xmm0,[ebx+8]
|
||||||
|
push ebx
|
||||||
|
.c:
|
||||||
|
cmp ebx,esi
|
||||||
|
jae .done
|
||||||
|
cmp ebx,.tri_ch
|
||||||
|
jb .done
|
||||||
|
cmp eax,[ebx]
|
||||||
|
jae .done
|
||||||
|
movq xmm7,[ebx]
|
||||||
|
movq [ebx+8],xmm7
|
||||||
|
sub ebx,8
|
||||||
|
jnc .c
|
||||||
|
add ebx,8
|
||||||
|
.done:
|
||||||
|
movq [ebx+8],xmm0
|
||||||
|
.p:
|
||||||
|
pop ebx
|
||||||
|
.g:
|
||||||
|
add ebx,8
|
||||||
|
dec ecx
|
||||||
|
cmp ecx,1
|
||||||
|
jnz .ccc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mov ecx,[points_count_var]
|
||||||
|
mov esi,.tri_ch
|
||||||
|
dec ecx
|
||||||
|
.ptC:
|
||||||
|
mov eax,[esi]
|
||||||
|
add esi,8
|
||||||
|
.ptCff:
|
||||||
|
cmp esi,.endt
|
||||||
|
jae .dnC
|
||||||
|
cmp eax,[esi]
|
||||||
|
je @f
|
||||||
|
lea ebx,[eax+1]
|
||||||
|
cmp ebx,[esi]
|
||||||
|
jne .movt
|
||||||
|
dec ecx
|
||||||
|
jz .dnC ; check done
|
||||||
|
@@:
|
||||||
|
jmp .ptC
|
||||||
|
|
||||||
|
; jmp .dnC
|
||||||
|
|
||||||
|
.movt:
|
||||||
|
|
||||||
|
movd xmm5,esi
|
||||||
|
movd xmm7,ebx
|
||||||
|
mov edi,[esi]
|
||||||
|
sub edi,ebx
|
||||||
|
movd xmm6,edi
|
||||||
|
|
||||||
|
@@:
|
||||||
|
cmp esi,.endt
|
||||||
|
jnb @f
|
||||||
|
sub [esi],edi ; fix .tri_ch pivot table list
|
||||||
|
add esi,8
|
||||||
|
jmp @b
|
||||||
|
@@:
|
||||||
|
|
||||||
|
|
||||||
|
;shrink vert
|
||||||
|
lea ebx,[ebx*3]
|
||||||
|
shl ebx,2
|
||||||
|
add ebx,[points_ptr]
|
||||||
|
imul edi,[i12]
|
||||||
|
add edi,ebx
|
||||||
|
|
||||||
|
cmp edi,.endVptr ; fix points_r list
|
||||||
|
ja .dnV
|
||||||
|
@@:
|
||||||
|
movq xmm0,[edi]
|
||||||
|
movd xmm1,[edi+8]
|
||||||
|
movq [ebx],xmm0
|
||||||
|
movd [ebx+8],xmm1
|
||||||
|
add edi,12
|
||||||
|
add ebx,12
|
||||||
|
cmp edi,.endVptr ; fix point_r list
|
||||||
|
jna @b
|
||||||
|
|
||||||
|
.dnV:
|
||||||
|
|
||||||
|
; recalc tri all indices above ebx - sub edi
|
||||||
|
push ecx
|
||||||
|
|
||||||
|
mov esi,[triangles_ptr]
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
lea ecx,[ecx*3]
|
||||||
|
movd edi,xmm6
|
||||||
|
movd ebx,xmm7
|
||||||
|
.agT:
|
||||||
|
cmp [esi],ebx
|
||||||
|
jb @f
|
||||||
|
sub [esi],edi
|
||||||
|
@@:
|
||||||
|
add esi,4
|
||||||
|
loop .agT
|
||||||
|
|
||||||
|
pop ecx
|
||||||
|
|
||||||
|
movd esi,xmm5
|
||||||
|
|
||||||
|
sub [points_count_var],edi
|
||||||
|
|
||||||
|
dec ecx
|
||||||
|
|
||||||
|
jmp .ptCff ; again check sth found
|
||||||
|
|
||||||
|
|
||||||
|
.dnC: ; check done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.do_ch:
|
||||||
|
|
||||||
|
|
||||||
|
;make t_ptr - table with pointers/adresses
|
||||||
|
|
||||||
|
|
||||||
|
mov ecx,[points_count_var]
|
||||||
|
mov esi,.tri_ch
|
||||||
|
mov edi,.t_ptr
|
||||||
|
mov ebx,ecx
|
||||||
|
|
||||||
|
mov [edi],esi
|
||||||
|
add edi,4
|
||||||
|
dec ecx
|
||||||
|
jz .dn
|
||||||
|
.pt:
|
||||||
|
mov eax,[esi] ; [esi] - vert ind
|
||||||
|
add esi,8
|
||||||
|
cmp eax,[esi] ; [esi+4] - tri ind
|
||||||
|
je @f
|
||||||
|
mov [edi],esi
|
||||||
|
add edi,4
|
||||||
|
dec ecx
|
||||||
|
jz .dn
|
||||||
|
@@:
|
||||||
|
cmp esi,.endt
|
||||||
|
jb .pt
|
||||||
|
|
||||||
|
|
||||||
|
.dn:
|
||||||
|
|
||||||
|
|
||||||
|
; each dword position in .t_ptr list - adress of corresponding
|
||||||
|
; triangles indices, each triangles from such index contains this
|
||||||
|
; vertice
|
||||||
|
|
||||||
|
|
||||||
|
mov eax,[triangles_count_var]
|
||||||
|
mov .cntt,eax ; temp help cnt
|
||||||
|
xor ecx,ecx
|
||||||
|
mov .cc,ecx
|
||||||
|
mov esi,[triangles_ptr]
|
||||||
|
mov edi,.tri_ch1
|
||||||
|
imul eax,[i12]
|
||||||
|
add eax,edi
|
||||||
|
mov .ltch1,eax ; last
|
||||||
|
|
||||||
|
mov .up,esi
|
||||||
|
mov .str,edi
|
||||||
|
.lb1: ; nx chunk
|
||||||
|
cmp edi,.ltch1
|
||||||
|
jnb .endl
|
||||||
|
mov edi,.tri_ch1
|
||||||
|
mov .str,edi
|
||||||
|
mov eax,.cc
|
||||||
|
mov edx,.cc
|
||||||
|
inc .cc
|
||||||
|
cmp edx,[triangles_count_var]
|
||||||
|
jz .endl
|
||||||
|
shr eax,3
|
||||||
|
and edx,111b
|
||||||
|
add eax,.chmr
|
||||||
|
|
||||||
|
xor ebx,ebx
|
||||||
|
bt [eax],edx ; mark
|
||||||
|
jc @f ; tri was stored
|
||||||
|
inc ecx
|
||||||
|
or ebx,1b
|
||||||
|
mov esi,.up
|
||||||
|
movdqu xmm0,[esi]
|
||||||
|
movdqu [edi],xmm0
|
||||||
|
add .str,12
|
||||||
|
@@:
|
||||||
|
add .up,12
|
||||||
|
or ebx,ebx
|
||||||
|
jz .lb1
|
||||||
|
|
||||||
|
.lb2:
|
||||||
|
mov eax,[edi]
|
||||||
|
mov edx,[edi] ; edx - vert ind
|
||||||
|
shl eax,2
|
||||||
|
add eax,.t_ptr
|
||||||
|
mov eax,[eax] ; [eax] - t ptr
|
||||||
|
or eax,eax
|
||||||
|
jz .endl
|
||||||
|
.nxt:
|
||||||
|
|
||||||
|
mov esi,[eax+4]
|
||||||
|
mov ebx,[eax+4]
|
||||||
|
shr esi,3
|
||||||
|
and ebx,111b
|
||||||
|
add esi,.chmr
|
||||||
|
bts [esi],ebx ; mark
|
||||||
|
jc @f ; tri was stored
|
||||||
|
dec .cntt
|
||||||
|
je .endl
|
||||||
|
mov esi,[eax+4] ; [eax+4] - tri ind
|
||||||
|
add esi,esi
|
||||||
|
add esi,.chunks
|
||||||
|
mov [esi],cx
|
||||||
|
mov esi,[eax+4]
|
||||||
|
|
||||||
|
imul esi,[i12]
|
||||||
|
add esi,[triangles_ptr]
|
||||||
|
movups xmm0,[esi]
|
||||||
|
mov esi,.str
|
||||||
|
movups [esi],xmm0
|
||||||
|
add .str,12
|
||||||
|
@@:
|
||||||
|
add eax,8
|
||||||
|
cmp edx,[eax]
|
||||||
|
je .nxt
|
||||||
|
add edi,4
|
||||||
|
|
||||||
|
cmp edi,.str
|
||||||
|
jne .lb2
|
||||||
|
jmp .lb1
|
||||||
|
|
||||||
|
.endl:
|
||||||
|
|
||||||
|
mov .ch_cnt,ecx
|
||||||
|
|
||||||
|
|
||||||
|
.end:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; mov eax,68
|
||||||
|
; mov ebx,13
|
||||||
|
; mov ecx,.t_ptr
|
||||||
|
; int 0x40
|
||||||
|
|
||||||
|
; mov eax,68
|
||||||
|
; mov ebx,13
|
||||||
|
; mov ecx,.tri_ch
|
||||||
|
; int 0x40
|
||||||
|
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,13
|
||||||
|
mov ecx,.tri_ch1
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,13
|
||||||
|
mov ecx,.chmr
|
||||||
|
int 0x40
|
||||||
|
; for now free mem - cunks list - unused
|
||||||
|
|
||||||
|
; mov eax,68
|
||||||
|
; mov ebx,13
|
||||||
|
; mov ecx,.chunks
|
||||||
|
; int 0x40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; mov ebx,.chunks
|
||||||
|
mov ecx,.ch_cnt
|
||||||
|
|
||||||
|
mov esi,.tri_ch
|
||||||
|
mov edi,.t_ptr
|
||||||
|
|
||||||
|
|
||||||
|
mov esp,ebp
|
||||||
|
pop ebp
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
; DATA AREA ************************************
|
; DATA AREA ************************************
|
||||||
if Ext > SSE2
|
; if Ext > SSE2
|
||||||
isSSE3 db 1
|
isSSE3 db 1
|
||||||
end if
|
; end if
|
||||||
i3 dw 3
|
i3 dw 3
|
||||||
i6 dd 6
|
i6 dd 6
|
||||||
i12 dd 12
|
i12 dd 12
|
||||||
@ -28,14 +28,15 @@
|
|||||||
y_offset dw SIZE_Y / 2
|
y_offset dw SIZE_Y / 2
|
||||||
z_offset dw 0
|
z_offset dw 0
|
||||||
rsscale dd 175.0 ; next real scale
|
rsscale dd 175.0 ; next real scale
|
||||||
vect_x: dw SIZE_X / 2
|
|
||||||
vect_y dw SIZE_Y / 2
|
|
||||||
vect_z dw 0
|
|
||||||
size_y_var:
|
|
||||||
yres_var dw SIZE_Y
|
|
||||||
|
|
||||||
size_x_var:
|
; vect_x: dw SIZE_X / 2
|
||||||
xres_var dw SIZE_X
|
; vect_y dw SIZE_Y / 2
|
||||||
|
; vect_z dw 0
|
||||||
|
; size_y_var:
|
||||||
|
; yres_var dw SIZE_Y
|
||||||
|
;
|
||||||
|
; size_x_var:
|
||||||
|
; xres_var dw SIZE_X
|
||||||
|
|
||||||
angle_x dw 0
|
angle_x dw 0
|
||||||
angle_y dw 0
|
angle_y dw 0
|
||||||
@ -64,7 +65,7 @@
|
|||||||
screen_ptr dd 0
|
screen_ptr dd 0
|
||||||
Zbuffer_ptr dd 0
|
Zbuffer_ptr dd 0
|
||||||
vertices_index_ptr dd 0
|
vertices_index_ptr dd 0
|
||||||
vertex_edit_no dw 0
|
vertex_edit_no dd -1
|
||||||
edit_start_x:
|
edit_start_x:
|
||||||
dw 0
|
dw 0
|
||||||
edit_start_y dw 0
|
edit_start_y dw 0
|
||||||
@ -86,10 +87,11 @@
|
|||||||
|
|
||||||
db 3
|
db 3
|
||||||
db 'shd. model'
|
db 'shd. model'
|
||||||
|
max_dr_flg:
|
||||||
if Ext >= SSE3
|
if Ext >= SSE3
|
||||||
max_dr_flg db 15
|
db 15
|
||||||
else
|
else
|
||||||
db 12
|
db 12
|
||||||
end if
|
end if
|
||||||
dr_flag db 0 ; 6 - dots
|
dr_flag db 0 ; 6 - dots
|
||||||
dd shd_f
|
dd shd_f
|
||||||
@ -290,6 +292,7 @@ flags: ; flags description
|
|||||||
db 'x+y '
|
db 'x+y '
|
||||||
db ' x '
|
db ' x '
|
||||||
db 'keys'
|
db 'keys'
|
||||||
|
|
||||||
onoff_f:
|
onoff_f:
|
||||||
db 'off '
|
db 'off '
|
||||||
db 'on '
|
db 'on '
|
||||||
@ -354,7 +357,7 @@ base_vector:
|
|||||||
if Ext=SSE3
|
if Ext=SSE3
|
||||||
db ' (SSE3)'
|
db ' (SSE3)'
|
||||||
end if
|
end if
|
||||||
db ' 0.075',0
|
db ' 0.076',0
|
||||||
labellen:
|
labellen:
|
||||||
STRdata db '-1 '
|
STRdata db '-1 '
|
||||||
lab_vert:
|
lab_vert:
|
||||||
@ -367,6 +370,9 @@ base_vector:
|
|||||||
db 'Edges count: '
|
db 'Edges count: '
|
||||||
lab_ed_end:
|
lab_ed_end:
|
||||||
|
|
||||||
|
db 'Chunks detected:'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all_lights_size dw lightsend-lights
|
all_lights_size dw lightsend-lights
|
||||||
|
|
||||||
@ -483,6 +489,17 @@ end if
|
|||||||
times 4 dd 1.0
|
times 4 dd 1.0
|
||||||
|
|
||||||
eps: times 4 dd 0.00000
|
eps: times 4 dd 0.00000
|
||||||
|
|
||||||
|
vect_x: dw SIZE_X / 2
|
||||||
|
vect_y dw SIZE_Y / 2
|
||||||
|
vect_z dw 0
|
||||||
|
size_y_var:
|
||||||
|
yres_var dw SIZE_Y
|
||||||
|
|
||||||
|
size_x_var:
|
||||||
|
xres_var dw SIZE_X
|
||||||
|
|
||||||
|
|
||||||
epsone dd 1.0001
|
epsone dd 1.0001
|
||||||
aprox dd 0.0001
|
aprox dd 0.0001
|
||||||
epsminus dd -0.0001
|
epsminus dd -0.0001
|
||||||
@ -495,8 +512,8 @@ end if
|
|||||||
fsize dd 0 ;180000 ; sizeof(workarea)
|
fsize dd 0 ;180000 ; sizeof(workarea)
|
||||||
fptr dd 0 ;workarea
|
fptr dd 0 ;workarea
|
||||||
file_name:
|
file_name:
|
||||||
db '/rd/1/3d/house.3ds',0
|
db '/rd/1/3d/house.3ds',0
|
||||||
; db '/tmp0/1/ant.3ds',0
|
; db '/tmp0/1/sc.3ds',0
|
||||||
|
|
||||||
rb 256
|
rb 256
|
||||||
|
|
||||||
@ -521,7 +538,9 @@ align 8
|
|||||||
points_count_var dd ? ;
|
points_count_var dd ? ;
|
||||||
triangles_count_var dd ? ; dont change order
|
triangles_count_var dd ? ; dont change order
|
||||||
edges_count dd ? ;
|
edges_count dd ? ;
|
||||||
|
chunks_number dd ?
|
||||||
tex_points_ptr dd ?
|
tex_points_ptr dd ?
|
||||||
|
chunks_ptr dd ?
|
||||||
|
|
||||||
temp_col dw ?
|
temp_col dw ?
|
||||||
high dd ?
|
high dd ?
|
||||||
|
@ -13,63 +13,55 @@ flat_triangle_z:
|
|||||||
; -------------------- stack : z coordinates
|
; -------------------- stack : z coordinates
|
||||||
; -------------------- Z-buffer : each z variable as dword
|
; -------------------- Z-buffer : each z variable as dword
|
||||||
; -------------------- (Z coor. as word) shl CATMULL_SHIFT
|
; -------------------- (Z coor. as word) shl CATMULL_SHIFT
|
||||||
.z1 equ word[ebp+4]
|
.z1 equ word[ebp+4]
|
||||||
.z2 equ word[ebp+6] ; each z coordinate as word integer
|
.z2 equ word[ebp+6] ; each z coordinate as word integer
|
||||||
.z3 equ word[ebp+8]
|
.z3 equ word[ebp+8]
|
||||||
|
|
||||||
.col equ dword[ebp-4]
|
.col equ dword[ebp-4]
|
||||||
.x1 equ word[ebp-6]
|
.x1 equ word[ebp-6]
|
||||||
.y1 equ word[ebp-8]
|
.y1 equ word[ebp-8]
|
||||||
.x2 equ word[ebp-10]
|
.x2 equ word[ebp-10]
|
||||||
.y2 equ word[ebp-12]
|
.y2 equ word[ebp-12]
|
||||||
.x3 equ word[ebp-14]
|
.x3 equ word[ebp-14]
|
||||||
.y3 equ word[ebp-16]
|
.y3 equ word[ebp-16]
|
||||||
|
|
||||||
.dx12 equ dword[ebp-20]
|
.dx12 equ dword[ebp-20]
|
||||||
;.dz12 equ dword[ebp-24]
|
.dz12 equ dword[ebp-24]
|
||||||
.dx13 equ dword[ebp-24]
|
.dx13 equ dword[ebp-28]
|
||||||
.dz13 equ dword[ebp-28]
|
.dz13 equ dword[ebp-32]
|
||||||
.dz12 equ dword[ebp-32]
|
.dx23 equ dword[ebp-36]
|
||||||
;.dz13 equ dword[ebp-32]
|
.dz23 equ dword[ebp-40]
|
||||||
.dx23 equ dword[ebp-36]
|
.zz1 equ dword[ebp-44]
|
||||||
.dz13M equ [ebp-40]
|
.zz2 equ dword[ebp-48]
|
||||||
.dz23 equ dword[ebp-44]
|
|
||||||
.zz1 equ dword[ebp-48]
|
|
||||||
.zz2 equ dword[ebp-52]
|
|
||||||
.zz2M equ qword[ebp-52]
|
|
||||||
.dz12M equ qword[ebp-32]
|
|
||||||
.dz23M equ qword[ebp-44]
|
|
||||||
;if Ext>=MMX
|
|
||||||
; emms
|
|
||||||
;end if
|
|
||||||
mov ebp,esp
|
|
||||||
|
|
||||||
push edx ; store edx in variable .col
|
mov ebp,esp
|
||||||
|
|
||||||
|
push edx ; store edx in variable .col
|
||||||
.sort2:
|
.sort2:
|
||||||
cmp ax,bx
|
cmp ax,bx
|
||||||
jle .sort1
|
jle .sort1
|
||||||
xchg eax,ebx
|
xchg eax,ebx
|
||||||
mov dx,.z1
|
mov dx,.z1
|
||||||
xchg dx,.z2
|
xchg dx,.z2
|
||||||
mov .z1,dx
|
mov .z1,dx
|
||||||
.sort1:
|
.sort1:
|
||||||
cmp bx,cx
|
cmp bx,cx
|
||||||
jle .sort3
|
jle .sort3
|
||||||
xchg ebx,ecx
|
xchg ebx,ecx
|
||||||
mov dx,.z2
|
mov dx,.z2
|
||||||
xchg dx,.z3
|
xchg dx,.z3
|
||||||
mov .z2,dx
|
mov .z2,dx
|
||||||
jmp .sort2
|
jmp .sort2
|
||||||
.sort3:
|
.sort3:
|
||||||
push eax ; store triangle coordinates in user friendly variables
|
push eax ; store triangle coordinates in user friendly variables
|
||||||
push ebx
|
push ebx
|
||||||
push ecx
|
push ecx
|
||||||
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
||||||
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
||||||
and edx,ecx
|
and edx,ecx
|
||||||
and edx,eax
|
and edx,eax
|
||||||
test edx,80008000h ; Check both X&Y at once
|
test edx,80008000h ; Check both X&Y at once
|
||||||
jne .ft_loop2_end
|
jne .ft_loop2_end
|
||||||
; cmp ax,SIZE_Y
|
; cmp ax,SIZE_Y
|
||||||
; jle @f
|
; jle @f
|
||||||
; cmp bx,SIZE_Y
|
; cmp bx,SIZE_Y
|
||||||
@ -87,189 +79,167 @@ flat_triangle_z:
|
|||||||
; jle @f
|
; jle @f
|
||||||
; jmp .ft_loop2_end
|
; jmp .ft_loop2_end
|
||||||
;@@:
|
;@@:
|
||||||
sub esp,52-12
|
; sub esp,52-12
|
||||||
|
|
||||||
mov bx,.y2 ; calc delta 12
|
mov bx,.y2 ; calc delta 12
|
||||||
sub bx,.y1
|
sub bx,.y1
|
||||||
jnz .ft_dx12_make
|
jnz .ft_dx12_make
|
||||||
mov .dx12,0
|
push dword 0
|
||||||
mov .dz12,0
|
push dword 0
|
||||||
jmp .ft_dx12_done
|
jmp .ft_dx12_done
|
||||||
.ft_dx12_make:
|
.ft_dx12_make:
|
||||||
mov ax,.x2
|
mov ax,.x2
|
||||||
sub ax,.x1
|
sub ax,.x1
|
||||||
cwde
|
cwde
|
||||||
movsx ebx,bx
|
movsx ebx,bx
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
mov .dx12,eax
|
push eax
|
||||||
|
|
||||||
mov ax,.z2
|
mov ax,.z2
|
||||||
sub ax,.z1
|
sub ax,.z1
|
||||||
cwde
|
cwde
|
||||||
shl eax,CATMULL_SHIFT
|
shl eax,CATMULL_SHIFT
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
mov .dz12,eax
|
push eax
|
||||||
.ft_dx12_done:
|
.ft_dx12_done:
|
||||||
mov bx,.y3 ; calc delta 13
|
mov bx,.y3 ; calc delta 13
|
||||||
sub bx,.y1
|
sub bx,.y1
|
||||||
jnz .ft_dx13_make
|
jnz .ft_dx13_make
|
||||||
mov .dx13,0
|
push dword 0
|
||||||
mov .dz13,0
|
push dword 0
|
||||||
mov dword .dz13M,0
|
jmp .ft_dx13_done
|
||||||
jmp .ft_dx13_done
|
|
||||||
.ft_dx13_make:
|
.ft_dx13_make:
|
||||||
mov ax,.x3
|
mov ax,.x3
|
||||||
sub ax,.x1
|
sub ax,.x1
|
||||||
cwde
|
cwde
|
||||||
movsx ebx,bx
|
movsx ebx,bx
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
mov .dx13,eax
|
push eax
|
||||||
|
|
||||||
|
mov ax,.z3
|
||||||
|
sub ax,.z1
|
||||||
|
cwde
|
||||||
|
shl eax,CATMULL_SHIFT
|
||||||
|
cdq
|
||||||
|
idiv ebx
|
||||||
|
push eax
|
||||||
|
|
||||||
mov ax,.z3
|
|
||||||
sub ax,.z1
|
|
||||||
cwde
|
|
||||||
shl eax,CATMULL_SHIFT
|
|
||||||
cdq
|
|
||||||
idiv ebx
|
|
||||||
mov .dz13,eax
|
|
||||||
mov dword .dz13M,eax
|
|
||||||
.ft_dx13_done:
|
.ft_dx13_done:
|
||||||
mov bx,.y3 ; calc delta 23
|
; sub esp,48
|
||||||
sub bx,.y2
|
mov bx,.y3 ; calc delta 23
|
||||||
jnz .gt_dx23_make
|
sub bx,.y2
|
||||||
mov .dx23,0
|
jnz .gt_dx23_make
|
||||||
mov .dz23,0
|
push dword 0
|
||||||
jmp .gt_dx23_done
|
push dword 0
|
||||||
|
; mov .dx23,0
|
||||||
|
; mov .dz23,0
|
||||||
|
jmp .gt_dx23_done
|
||||||
.gt_dx23_make:
|
.gt_dx23_make:
|
||||||
mov ax,.x3
|
mov ax,.x3
|
||||||
sub ax,.x2
|
sub ax,.x2
|
||||||
cwde
|
cwde
|
||||||
movsx ebx,bx
|
movsx ebx,bx
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
mov .dx23,eax
|
push eax
|
||||||
|
|
||||||
mov ax,.z3
|
mov ax,.z3
|
||||||
sub ax,.z2
|
sub ax,.z2
|
||||||
cwde
|
cwde
|
||||||
shl eax,CATMULL_SHIFT
|
shl eax,CATMULL_SHIFT
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
mov .dz23,eax
|
push eax
|
||||||
|
; mov .dz23,eax
|
||||||
.gt_dx23_done:
|
.gt_dx23_done:
|
||||||
|
|
||||||
movsx edx,.z1
|
movsx edx,.z1
|
||||||
shl edx,CATMULL_SHIFT
|
shl edx,CATMULL_SHIFT
|
||||||
mov .zz1,edx
|
push edx
|
||||||
mov .zz2,edx
|
push edx
|
||||||
movsx eax,.x1
|
|
||||||
shl eax,ROUND ; eax - x1
|
movsx eax,.x1
|
||||||
mov ebx,eax ; ebx - x2
|
shl eax,ROUND ; eax - x1
|
||||||
;if Ext>=MMX
|
mov ebx,eax ; ebx - x2
|
||||||
; movq mm0,.zz2M
|
mov cx,.y1
|
||||||
;end if
|
cmp cx,.y2
|
||||||
mov cx,.y1
|
jge .ft_loop1_end
|
||||||
cmp cx,.y2
|
|
||||||
jge .ft_loop1_end
|
|
||||||
.ft_loop1:
|
.ft_loop1:
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
push .col
|
push .col
|
||||||
push cx ; y
|
push cx ; y
|
||||||
sar ebx,ROUND
|
sar ebx,ROUND
|
||||||
push bx ; x2
|
push bx ; x2
|
||||||
sar eax,ROUND
|
sar eax,ROUND
|
||||||
push ax ; x1
|
push ax ; x1
|
||||||
;if Ext>=MMX
|
push .zz2 ; z2 shl CATMULL_SHIFT
|
||||||
; sub esp,8
|
push .zz1 ; z1 shl CATMULL_SHIFT
|
||||||
; movq [esp],mm0
|
|
||||||
;else
|
call flat_line_z
|
||||||
push .zz2 ; z2 shl CATMULL_SHIFT
|
|
||||||
push .zz1 ; z1 shl CATMULL_SHIFT
|
popad
|
||||||
|
|
||||||
|
add eax,.dx13
|
||||||
|
add ebx,.dx12
|
||||||
|
|
||||||
|
mov edx,.dz13
|
||||||
|
add .zz1,edx
|
||||||
|
mov edx,.dz12
|
||||||
|
add .zz2,edx
|
||||||
;end if
|
;end if
|
||||||
call flat_line_z
|
inc cx
|
||||||
|
cmp cx,.y2
|
||||||
popad
|
jl .ft_loop1
|
||||||
|
|
||||||
add eax,.dx13
|
|
||||||
add ebx,.dx12
|
|
||||||
;if Ext>=MMX
|
|
||||||
; paddd mm0,.dz12M
|
|
||||||
;else
|
|
||||||
|
|
||||||
mov edx,.dz13
|
|
||||||
add .zz1,edx
|
|
||||||
mov edx,.dz12
|
|
||||||
add .zz2,edx
|
|
||||||
;end if
|
|
||||||
inc cx
|
|
||||||
cmp cx,.y2
|
|
||||||
jl .ft_loop1
|
|
||||||
.ft_loop1_end:
|
.ft_loop1_end:
|
||||||
|
|
||||||
movsx edx,.z2
|
movsx edx,.z2
|
||||||
shl edx,CATMULL_SHIFT
|
shl edx,CATMULL_SHIFT
|
||||||
mov .zz2,edx
|
mov .zz2,edx
|
||||||
movsx ebx,.x2
|
movsx ebx,.x2
|
||||||
shl ebx,ROUND
|
shl ebx,ROUND
|
||||||
;if Ext>=MMX
|
|
||||||
; movq mm0,.zz2M
|
mov cx,.y2
|
||||||
;; push .dz13 ; exchange
|
cmp cx,.y3
|
||||||
;; pop .dz12
|
jge .ft_loop2_end
|
||||||
;; push .dz23 ; exchange
|
|
||||||
;; pop .dz13
|
|
||||||
;end if
|
|
||||||
mov cx,.y2
|
|
||||||
cmp cx,.y3
|
|
||||||
jge .ft_loop2_end
|
|
||||||
.ft_loop2:
|
.ft_loop2:
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
push .col
|
push .col
|
||||||
push cx
|
push cx
|
||||||
sar ebx,ROUND
|
sar ebx,ROUND
|
||||||
push bx
|
push bx
|
||||||
sar eax,ROUND
|
sar eax,ROUND
|
||||||
push ax ; x1
|
push ax ; x1
|
||||||
;if Ext>=MMX
|
|
||||||
; sub esp,8
|
|
||||||
; movq [esp],mm0
|
|
||||||
;else
|
|
||||||
push .zz2 ; z2 shl CATMULL_SHIFT
|
|
||||||
push .zz1 ; z1 shl CATMULL_SHIFT
|
|
||||||
;end if
|
|
||||||
call flat_line_z
|
|
||||||
|
|
||||||
popad
|
push .zz2 ; z2 shl CATMULL_SHIFT
|
||||||
|
push .zz1 ; z1 shl CATMULL_SHIFT
|
||||||
|
|
||||||
add eax,.dx13
|
call flat_line_z
|
||||||
add ebx,.dx23
|
|
||||||
;if Ext>=MMX
|
|
||||||
; paddd mm0,.dz23M
|
|
||||||
;else
|
|
||||||
mov edx,.dz13
|
|
||||||
add .zz1,edx
|
|
||||||
mov edx,.dz23
|
|
||||||
add .zz2,edx
|
|
||||||
|
|
||||||
; mov edx,.dz13
|
popad
|
||||||
; add .zz1,edx
|
|
||||||
; mov edx,.dz12
|
add eax,.dx13
|
||||||
; add .zz2,edx
|
add ebx,.dx23
|
||||||
;end if
|
|
||||||
inc cx
|
mov edx,.dz13
|
||||||
cmp cx,.y3
|
add .zz1,edx
|
||||||
jl .ft_loop2
|
mov edx,.dz23
|
||||||
|
add .zz2,edx
|
||||||
|
|
||||||
|
inc cx
|
||||||
|
cmp cx,.y3
|
||||||
|
jl .ft_loop2
|
||||||
.ft_loop2_end:
|
.ft_loop2_end:
|
||||||
|
|
||||||
mov esp,ebp
|
mov esp,ebp
|
||||||
ret 6
|
ret 6
|
||||||
|
|
||||||
flat_line_z:
|
flat_line_z:
|
||||||
@ -286,16 +256,16 @@ flat_line_z:
|
|||||||
|
|
||||||
.dz equ dword [ebp-4]
|
.dz equ dword [ebp-4]
|
||||||
|
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
;; sub esp,4
|
;; sub esp,4
|
||||||
mov ax,.y
|
mov ax,.y
|
||||||
or ax,ax
|
or ax,ax
|
||||||
jl .fl_quit
|
jl .fl_quit
|
||||||
mov bx,[size_y_var]
|
mov bx,[size_y_var]
|
||||||
dec bx
|
dec bx
|
||||||
cmp ax,bx ;[size_y_var]
|
cmp ax,bx ;[size_y_var]
|
||||||
; cmp ax,SIZE_Y-1
|
; cmp ax,SIZE_Y-1
|
||||||
jg .fl_quit
|
jg .fl_quit
|
||||||
|
|
||||||
; cmp .x1,0
|
; cmp .x1,0
|
||||||
; jge .fl_ok1
|
; jge .fl_ok1
|
||||||
@ -307,91 +277,93 @@ flat_line_z:
|
|||||||
; cmp .x2,SIZE_X
|
; cmp .x2,SIZE_X
|
||||||
; jg .fl_quit
|
; jg .fl_quit
|
||||||
; .fl_ok2:
|
; .fl_ok2:
|
||||||
mov ax,.x1
|
mov ax,.x1
|
||||||
cmp ax,.x2
|
cmp ax,.x2
|
||||||
je .fl_quit
|
je .fl_quit
|
||||||
jl .fl_ok
|
jl .fl_ok
|
||||||
|
|
||||||
xchg ax,.x2
|
xchg ax,.x2
|
||||||
mov .x1,ax
|
mov .x1,ax
|
||||||
mov edx,.z1
|
mov edx,.z1
|
||||||
xchg edx,.z2
|
xchg edx,.z2
|
||||||
mov .z1,edx
|
mov .z1,edx
|
||||||
.fl_ok:
|
.fl_ok:
|
||||||
mov bx,[size_x_var]
|
mov bx,[size_x_var]
|
||||||
dec bx
|
dec bx
|
||||||
cmp .x1,bx ;SIZE_X-1
|
cmp .x1,bx ;SIZE_X-1
|
||||||
jg .fl_quit
|
jg .fl_quit
|
||||||
cmp .x2,0
|
cmp .x2,0
|
||||||
jle .fl_quit
|
jle .fl_quit
|
||||||
|
|
||||||
mov eax,.z2
|
mov eax,.z2
|
||||||
sub eax,.z1
|
sub eax,.z1
|
||||||
cdq
|
cdq
|
||||||
mov bx,.x2
|
mov bx,.x2
|
||||||
sub bx,.x1
|
sub bx,.x1
|
||||||
movsx ebx,bx
|
movsx ebx,bx
|
||||||
idiv ebx
|
idiv ebx
|
||||||
;; mov .dz,eax ; calculated delta - shifted .dz
|
;; mov .dz,eax ; calculated delta - shifted .dz
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
cmp .x1,0
|
cmp .x1,0
|
||||||
jge @f
|
jge @f
|
||||||
movsx ebx,.x1
|
movsx ebx,.x1
|
||||||
neg ebx
|
neg ebx
|
||||||
imul ebx
|
imul ebx
|
||||||
add .z1,eax
|
add .z1,eax
|
||||||
mov .x1,0
|
mov .x1,0
|
||||||
@@:
|
@@:
|
||||||
movzx edx,word[size_x_var]
|
movzx edx,word[size_x_var]
|
||||||
cmp .x2,dx ;[size_x_var] ;SIZE_X
|
cmp .x2,dx ;[size_x_var] ;SIZE_X
|
||||||
jl @f
|
jl @f
|
||||||
mov .x2,dx ;[size_x_var] ;SIZE_X
|
mov .x2,dx ;[size_x_var] ;SIZE_X
|
||||||
@@:
|
@@:
|
||||||
; movzx edx,[size_x_var] ;SIZE_X
|
; movzx edx,[size_x_var] ;SIZE_X
|
||||||
movsx eax,.y
|
movsx eax,.y
|
||||||
mul edx ; edi = edi + (SIZE_X * y + x1)*3
|
mul edx ; edi = edi + (SIZE_X * y + x1)*3
|
||||||
movsx edx,.x1
|
movsx edx,.x1
|
||||||
add eax,edx
|
add eax,edx
|
||||||
push eax
|
push eax
|
||||||
lea eax,[eax*3]
|
lea eax,[eax*3]
|
||||||
add edi,eax ; esi = esi + (SIZE_X * y + x1)*4
|
add edi,eax ; esi = esi + (SIZE_X * y + x1)*4
|
||||||
pop eax
|
pop eax
|
||||||
shl eax,2
|
shl eax,2
|
||||||
add esi,eax
|
add esi,eax
|
||||||
|
|
||||||
mov cx,.x2
|
mov cx,.x2
|
||||||
sub cx,.x1
|
sub cx,.x1
|
||||||
movzx ecx,cx
|
movzx ecx,cx
|
||||||
|
|
||||||
mov eax,.col
|
mov eax,.col
|
||||||
mov ebx,.z1 ; ebx : curr. z
|
mov ebx,.z1 ; ebx : curr. z
|
||||||
mov edx,.dz
|
mov edx,.dz
|
||||||
dec ecx
|
dec ecx
|
||||||
jecxz .draw_last
|
jecxz .draw_last
|
||||||
.ddraw:
|
.ddraw:
|
||||||
cmp ebx,dword[esi]
|
cmp ebx,dword[esi]
|
||||||
; cmovl [edi],eax
|
; cmovl [edi],eax
|
||||||
; cmovl [esi],ebx
|
; cmovl [esi],ebx
|
||||||
jge @f
|
jge @f
|
||||||
stosd
|
mov [edi],eax
|
||||||
dec edi
|
mov [esi],ebx
|
||||||
mov dword[esi],ebx
|
; stosd ; less branches
|
||||||
jmp .no_skip
|
; dec edi
|
||||||
|
; mov dword[esi],ebx
|
||||||
|
; jmp .no_skip
|
||||||
@@:
|
@@:
|
||||||
add edi,3
|
add edi,3
|
||||||
.no_skip:
|
; .no_skip:
|
||||||
add esi,4
|
add esi,4
|
||||||
add ebx,edx
|
add ebx,edx
|
||||||
loop .ddraw
|
loop .ddraw
|
||||||
|
|
||||||
.draw_last:
|
.draw_last:
|
||||||
cmp ebx,dword[esi]
|
cmp ebx,dword[esi]
|
||||||
jge .fl_quit
|
jge .fl_quit
|
||||||
stosw
|
stosw
|
||||||
shr eax,16
|
shr eax,16
|
||||||
stosb
|
stosb
|
||||||
mov dword[esi],ebx
|
mov dword[esi],ebx
|
||||||
|
|
||||||
.fl_quit:
|
.fl_quit:
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,18 @@
|
|||||||
|
View3ds 0.075 - XII 2021
|
||||||
|
1. Cusom rotate using keys and mouse scroll support by Leency.
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
View3ds 0.074 - IX 2021
|
||||||
|
1. Fixed emboss bug in grd lines displaying model.
|
||||||
|
2. Grd line exceedes screen problem fix.
|
||||||
|
3. New rendering model - ray casted shadows and appropiate button to
|
||||||
|
set 'on' this option. Note that is non real time model, especially when
|
||||||
|
complex object is computed. I took effort to introduce accelerating
|
||||||
|
structure - AABB (Axis Aligned Bounding Boxes).. but it is disabled
|
||||||
|
|
||||||
|
for now - seems to work incorrect(slow).
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
|
||||||
View3ds 0.073 - may 2021
|
View3ds 0.073 - may 2021
|
||||||
1. I introduced procedure for searching nonredundand edges.
|
1. I introduced procedure for searching nonredundand edges.
|
||||||
2. Writing some info about object: vertices, triangles unique edges
|
2. Writing some info about object: vertices, triangles unique edges
|
||||||
|
@ -1,18 +1,33 @@
|
|||||||
View3ds 0.074 - tiny viewer to .3ds and .asc files with several graphics
|
View3ds 0.076 - tiny viewer to .3ds and .asc files with several graphics
|
||||||
effects implementation.
|
effects implementation.
|
||||||
|
|
||||||
What's new?
|
What's new?
|
||||||
1. Fixed emboss bug in grd lines displaying model.
|
1. Detecting manifold chunks procedure based on kind of sorted pivot
|
||||||
2. Grd line exceedes screen problem fix.
|
table. Chunks are counted and this number displayed.
|
||||||
3. New rendering model - ray casted shadows and appropiate button to
|
2. New calculating normal vectors proc that use some data produced
|
||||||
set 'on' this option. Note that is non real time model, especially when
|
by new chunks routine. Now big object loading is fast. I load object that
|
||||||
complex object is computed. I took effort to introduce accelerating
|
contains ~500000 vertices, ~700000 faces and ~2000 0000 unique edges
|
||||||
structure - AABB (Axis Aligned Bounding Boxes).. but it is disabled
|
in few seconds on i5 2cond gen. Earlier such objects calculating was
|
||||||
for now - seems to work incorrect(slow).
|
rather above time limits.
|
||||||
|
3. On http://board.flatassembler.net occasionaly there are some disccusions
|
||||||
|
about optimizing. Some clever people, wich skills and competence I trust,
|
||||||
|
claims - for CPU's manufactured last ~15 years size of code is crucial
|
||||||
|
for speed. (Better utilize CPU cache).
|
||||||
|
So I wrote some 'movsd' mnemonics instead 'mov [edi],sth'; 'loop' instead
|
||||||
|
'dec ecx,jnz sth'. Moreover I come back to init some local varibles
|
||||||
|
by 'push' (flat_cat.inc). I took effort to change divisions to
|
||||||
|
multiplications two_tex.inc (works ok in fpu only Ext = NON mode and
|
||||||
|
of course in Ext = SSE3 mode), grd_tex.inc (single line not parallel
|
||||||
|
muls, whole drawing routine 4 divs instead 27 divisions),
|
||||||
|
bump_tex.inc - 3 divs in SSE2 mode.s See sources for details.
|
||||||
|
4. Editor button allows now editing by vertex all above 65535 vert objects.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Buttons description:
|
Buttons description:
|
||||||
1. rotary: choosing rotary axle: x, y, x+y.
|
1. rotary: choosing rotary axle: x, y, x+y, keys - for object translate
|
||||||
|
using keyboard. .
|
||||||
2. shd. model: choosing shading model: flat, grd (smooth), env (spherical
|
2. shd. model: choosing shading model: flat, grd (smooth), env (spherical
|
||||||
environment mapping, bump (bump mapping), tex (texture mapping),
|
environment mapping, bump (bump mapping), tex (texture mapping),
|
||||||
pos (position shading depend), dots (app draws only points - nodes of object),
|
pos (position shading depend), dots (app draws only points - nodes of object),
|
||||||
@ -46,4 +61,4 @@ Buttons description:
|
|||||||
decrease whole handlers count by enable culling (using appropriate button) - some
|
decrease whole handlers count by enable culling (using appropriate button) - some
|
||||||
back handlers become hidden.
|
back handlers become hidden.
|
||||||
|
|
||||||
Maciej Guba IX 2021
|
Maciej Guba XII 2021
|
||||||
|
@ -24,86 +24,86 @@ tex_triangle_z:
|
|||||||
.tex_y2 equ ebp+10
|
.tex_y2 equ ebp+10
|
||||||
.tex_x3 equ ebp+12
|
.tex_x3 equ ebp+12
|
||||||
.tex_y3 equ ebp+14
|
.tex_y3 equ ebp+14
|
||||||
.z1 equ word[ebp+16]
|
.z1 equ word[ebp+16]
|
||||||
.z2 equ word[ebp+18]
|
.z2 equ word[ebp+18]
|
||||||
.z3 equ word[ebp+20]
|
.z3 equ word[ebp+20]
|
||||||
|
|
||||||
.tex_ptr equ dword[ebp-4] ; pointer to texture
|
.tex_ptr equ dword[ebp-4] ; pointer to texture
|
||||||
.z_ptr equ dword[ebp-8] ; pointer to z-buffer
|
.z_ptr equ dword[ebp-8] ; pointer to z-buffer
|
||||||
.x1 equ word[ebp-10]
|
.x1 equ word[ebp-10]
|
||||||
.y1 equ word[ebp-12]
|
.y1 equ word[ebp-12]
|
||||||
.x2 equ word[ebp-14]
|
.x2 equ word[ebp-14]
|
||||||
.y2 equ word[ebp-16]
|
.y2 equ word[ebp-16]
|
||||||
.x3 equ word[ebp-18]
|
.x3 equ word[ebp-18]
|
||||||
.y3 equ word[ebp-20]
|
.y3 equ word[ebp-20]
|
||||||
|
|
||||||
.dx12 equ dword[ebp-24]
|
.dx12 equ dword[ebp-24]
|
||||||
.tex_dx12 equ dword[ebp-28]
|
.tex_dx12 equ dword[ebp-28]
|
||||||
.tex_dy12 equ dword[ebp-32]
|
.tex_dy12 equ dword[ebp-32]
|
||||||
.dz12 equ dword[ebp-36]
|
.dz12 equ dword[ebp-36]
|
||||||
|
|
||||||
.dx13 equ dword[ebp-40]
|
.dx13 equ dword[ebp-40]
|
||||||
.tex_dx13 equ dword[ebp-44]
|
.tex_dx13 equ dword[ebp-44]
|
||||||
.tex_dy13 equ dword[ebp-48]
|
.tex_dy13 equ dword[ebp-48]
|
||||||
.dz13 equ dword[ebp-52]
|
.dz13 equ dword[ebp-52]
|
||||||
|
|
||||||
.dx23 equ dword[ebp-56]
|
.dx23 equ dword[ebp-56]
|
||||||
.tex_dx23 equ dword[ebp-60]
|
.tex_dx23 equ dword[ebp-60]
|
||||||
.tex_dy23 equ dword[ebp-64]
|
.tex_dy23 equ dword[ebp-64]
|
||||||
.dz23 equ dword[ebp-68]
|
.dz23 equ dword[ebp-68]
|
||||||
|
|
||||||
.scan_x1 equ dword[ebp-72]
|
.scan_x1 equ dword[ebp-72]
|
||||||
.scan_x2 equ dword[ebp-76]
|
.scan_x2 equ dword[ebp-76]
|
||||||
.scan_y1 equ dword[ebp-80]
|
.scan_y1 equ dword[ebp-80]
|
||||||
.scan_y2 equ dword[ebp-84]
|
.scan_y2 equ dword[ebp-84]
|
||||||
.cz1 equ dword[ebp-88]
|
.cz1 equ dword[ebp-88]
|
||||||
.cz2 equ dword[ebp-92]
|
.cz2 equ dword[ebp-92]
|
||||||
|
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
push esi ; store memory pointers
|
push esi ; store memory pointers
|
||||||
push edx
|
push edx
|
||||||
.tt_sort3:
|
.tt_sort3:
|
||||||
cmp ax,bx ;sort all parameters
|
cmp ax,bx ;sort all parameters
|
||||||
jle .tt_sort1
|
jle .tt_sort1
|
||||||
xchg eax,ebx
|
xchg eax,ebx
|
||||||
mov edx,dword [.tex_x1]
|
mov edx,dword [.tex_x1]
|
||||||
xchg edx,dword [.tex_x2]
|
xchg edx,dword [.tex_x2]
|
||||||
mov dword[.tex_x1],edx
|
mov dword[.tex_x1],edx
|
||||||
mov dx,.z1
|
mov dx,.z1
|
||||||
xchg dx,.z2
|
xchg dx,.z2
|
||||||
mov .z1,dx
|
mov .z1,dx
|
||||||
.tt_sort1:
|
.tt_sort1:
|
||||||
cmp bx,cx
|
cmp bx,cx
|
||||||
jle .tt_sort2
|
jle .tt_sort2
|
||||||
xchg ebx,ecx
|
xchg ebx,ecx
|
||||||
mov edx,dword [.tex_x2]
|
mov edx,dword [.tex_x2]
|
||||||
xchg edx,dword [.tex_x3]
|
xchg edx,dword [.tex_x3]
|
||||||
mov dword [.tex_x2],edx
|
mov dword [.tex_x2],edx
|
||||||
mov dx,.z2
|
mov dx,.z2
|
||||||
xchg dx,.z3
|
xchg dx,.z3
|
||||||
mov .z2,dx
|
mov .z2,dx
|
||||||
jmp .tt_sort3
|
jmp .tt_sort3
|
||||||
.tt_sort2:
|
.tt_sort2:
|
||||||
|
|
||||||
push eax ; and store to user friendly variables
|
push eax ; and store to user friendly variables
|
||||||
push ebx
|
push ebx
|
||||||
push ecx
|
push ecx
|
||||||
|
|
||||||
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
mov edx,80008000h ; eax,ebx,ecx are ANDd together into edx which means that
|
||||||
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
||||||
and edx,ecx
|
and edx,ecx
|
||||||
and edx,eax
|
and edx,eax
|
||||||
test edx,80008000h ; Check both X&Y at once
|
test edx,80008000h ; Check both X&Y at once
|
||||||
jne .tt_loop2_end
|
jne .tt_loop2_end
|
||||||
; cmp ax,SIZE_Y
|
; cmp ax,SIZE_Y
|
||||||
; jl @f
|
; jl @f
|
||||||
; cmp bx,SIZE_Y
|
; cmp bx,SIZE_Y
|
||||||
; jl @f
|
; jl @f
|
||||||
; cmp cx,SIZE_Y
|
; cmp cx,SIZE_Y
|
||||||
; jl @f
|
; jl @f
|
||||||
ror eax,16
|
ror eax,16
|
||||||
ror ebx,16
|
ror ebx,16
|
||||||
ror ecx,16
|
ror ecx,16
|
||||||
; cmp ax,SIZE_X
|
; cmp ax,SIZE_X
|
||||||
; jl @f
|
; jl @f
|
||||||
; cmp bx,SIZE_X
|
; cmp bx,SIZE_X
|
||||||
@ -112,301 +112,301 @@ tex_triangle_z:
|
|||||||
; jl @f
|
; jl @f
|
||||||
; jmp .tt_loop2_end
|
; jmp .tt_loop2_end
|
||||||
@@:
|
@@:
|
||||||
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
|
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
|
||||||
mov ebx,dword[.tex_x2]
|
mov ebx,dword[.tex_x2]
|
||||||
mov ecx,dword[.tex_x3]
|
mov ecx,dword[.tex_x3]
|
||||||
mov edx,eax
|
mov edx,eax
|
||||||
or edx,ebx
|
or edx,ebx
|
||||||
or edx,ecx
|
or edx,ecx
|
||||||
test edx,80008000h
|
test edx,80008000h
|
||||||
jne .tt_loop2_end
|
jne .tt_loop2_end
|
||||||
cmp ax,TEX_X
|
cmp ax,TEX_X
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
cmp bx,TEX_X
|
cmp bx,TEX_X
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
cmp cx,TEX_X
|
cmp cx,TEX_X
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
ror eax,16
|
ror eax,16
|
||||||
ror ebx,16
|
ror ebx,16
|
||||||
ror ecx,16
|
ror ecx,16
|
||||||
cmp ax,TEX_Y
|
cmp ax,TEX_Y
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
cmp bx,TEX_Y
|
cmp bx,TEX_Y
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
cmp cx,TEX_Y
|
cmp cx,TEX_Y
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
|
|
||||||
|
|
||||||
movsx ebx,.y2 ; calc delta
|
movsx ebx,.y2 ; calc delta
|
||||||
sub bx,.y1
|
sub bx,.y1
|
||||||
jnz .tt_dx12_make
|
jnz .tt_dx12_make
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
mov ecx,4
|
mov ecx,4
|
||||||
@@:
|
@@:
|
||||||
push edx
|
push edx
|
||||||
loop @b
|
loop @b
|
||||||
jmp .tt_dx12_done
|
jmp .tt_dx12_done
|
||||||
.tt_dx12_make:
|
.tt_dx12_make:
|
||||||
mov ax,.x2
|
mov ax,.x2
|
||||||
sub ax,.x1
|
sub ax,.x1
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov .dx12,eax ; dx12 = (x2-x1)/(y2-y1)
|
; mov .dx12,eax ; dx12 = (x2-x1)/(y2-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_x2]
|
mov ax,word[.tex_x2]
|
||||||
sub ax,word[.tex_x1]
|
sub ax,word[.tex_x1]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dx12],eax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1)
|
; mov [.tex_dx12],eax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_y2]
|
mov ax,word[.tex_y2]
|
||||||
sub ax,word[.tex_y1]
|
sub ax,word[.tex_y1]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dy12],eax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1)
|
; mov [.tex_dy12],eax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,.z2
|
mov ax,.z2
|
||||||
sub ax,.z1
|
sub ax,.z1
|
||||||
cwde
|
cwde
|
||||||
shl eax,CATMULL_SHIFT
|
shl eax,CATMULL_SHIFT
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
.tt_dx12_done:
|
.tt_dx12_done:
|
||||||
|
|
||||||
movsx ebx,.y3 ; calc delta
|
movsx ebx,.y3 ; calc delta
|
||||||
sub bx,.y1
|
sub bx,.y1
|
||||||
jnz .tt_dx13_make
|
jnz .tt_dx13_make
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
mov ecx,4
|
mov ecx,4
|
||||||
@@:
|
@@:
|
||||||
push edx
|
push edx
|
||||||
loop @b
|
loop @b
|
||||||
jmp .tt_dx13_done
|
jmp .tt_dx13_done
|
||||||
.tt_dx13_make:
|
.tt_dx13_make:
|
||||||
mov ax,.x3
|
mov ax,.x3
|
||||||
sub ax,.x1
|
sub ax,.x1
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov .dx12,eax ; dx13 = (x3-x1)/(y3-y1)
|
; mov .dx12,eax ; dx13 = (x3-x1)/(y3-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_x3]
|
mov ax,word[.tex_x3]
|
||||||
sub ax,word[.tex_x1]
|
sub ax,word[.tex_x1]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dx12],eax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1)
|
; mov [.tex_dx12],eax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_y3]
|
mov ax,word[.tex_y3]
|
||||||
sub ax,word[.tex_y1]
|
sub ax,word[.tex_y1]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dy12],eax ; tex_dy13 = (tex_y3-tex_y1)/(y3-y1)
|
; mov [.tex_dy12],eax ; tex_dy13 = (tex_y3-tex_y1)/(y3-y1)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,.z3
|
mov ax,.z3
|
||||||
sub ax,.z1
|
sub ax,.z1
|
||||||
cwde
|
cwde
|
||||||
shl eax,CATMULL_SHIFT
|
shl eax,CATMULL_SHIFT
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
.tt_dx13_done:
|
.tt_dx13_done:
|
||||||
|
|
||||||
mov bx,.y3 ; calc delta
|
mov bx,.y3 ; calc delta
|
||||||
sub bx,.y2
|
sub bx,.y2
|
||||||
jnz .tt_dx23_make
|
jnz .tt_dx23_make
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
mov ecx,4
|
mov ecx,4
|
||||||
@@:
|
@@:
|
||||||
push edx
|
push edx
|
||||||
loop @b
|
loop @b
|
||||||
jmp .tt_dx23_done
|
jmp .tt_dx23_done
|
||||||
.tt_dx23_make:
|
.tt_dx23_make:
|
||||||
mov ax,.x3
|
mov ax,.x3
|
||||||
sub ax,.x2
|
sub ax,.x2
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
movzx ebx,bx
|
movzx ebx,bx
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov .dx23,eax ; dx23 = (x3-x2)/(y3-y2)
|
; mov .dx23,eax ; dx23 = (x3-x2)/(y3-y2)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_x3]
|
mov ax,word[.tex_x3]
|
||||||
sub ax,word[.tex_x2]
|
sub ax,word[.tex_x2]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dx23],eax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2)
|
; mov [.tex_dx23],eax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,word[.tex_y3]
|
mov ax,word[.tex_y3]
|
||||||
sub ax,word[.tex_y2]
|
sub ax,word[.tex_y2]
|
||||||
cwde
|
cwde
|
||||||
shl eax,ROUND
|
shl eax,ROUND
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
; mov [.tex_dy23],eax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2)
|
; mov [.tex_dy23],eax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2)
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov ax,.z3
|
mov ax,.z3
|
||||||
sub ax,.z2
|
sub ax,.z2
|
||||||
cwde
|
cwde
|
||||||
shl eax,CATMULL_SHIFT
|
shl eax,CATMULL_SHIFT
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
.tt_dx23_done:
|
.tt_dx23_done:
|
||||||
|
|
||||||
movsx eax,.x1 ;eax - cur x1
|
movsx eax,.x1 ;eax - cur x1
|
||||||
shl eax,ROUND ;ebx - cur x2
|
shl eax,ROUND ;ebx - cur x2
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
|
|
||||||
movsx edx, word[.tex_x1]
|
movsx edx, word[.tex_x1]
|
||||||
shl edx,ROUND
|
shl edx,ROUND
|
||||||
; mov [.scan_x1],edx
|
; mov [.scan_x1],edx
|
||||||
; mov [.scan_x2],edx
|
; mov [.scan_x2],edx
|
||||||
push edx
|
push edx
|
||||||
push edx
|
push edx
|
||||||
movsx edx, word[.tex_y1]
|
movsx edx, word[.tex_y1]
|
||||||
shl edx,ROUND
|
shl edx,ROUND
|
||||||
; mov [.scan_y1],edx
|
; mov [.scan_y1],edx
|
||||||
; mov [.scan_y2],edx
|
; mov [.scan_y2],edx
|
||||||
push edx
|
push edx
|
||||||
push edx
|
push edx
|
||||||
movsx edx,.z1
|
movsx edx,.z1
|
||||||
shl edx,CATMULL_SHIFT
|
shl edx,CATMULL_SHIFT
|
||||||
push edx
|
push edx
|
||||||
push edx
|
push edx
|
||||||
mov cx,.y1
|
mov cx,.y1
|
||||||
cmp cx,.y2
|
cmp cx,.y2
|
||||||
jge .tt_loop1_end
|
jge .tt_loop1_end
|
||||||
|
|
||||||
.tt_loop1:
|
.tt_loop1:
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
push .z_ptr
|
push .z_ptr
|
||||||
push .cz1 ; z coords shifted shl catmull_shift
|
push .cz1 ; z coords shifted shl catmull_shift
|
||||||
push .cz2
|
push .cz2
|
||||||
push .scan_y2
|
push .scan_y2
|
||||||
push .scan_x2
|
push .scan_x2
|
||||||
push .scan_y1
|
push .scan_y1
|
||||||
push .scan_x1
|
push .scan_x1
|
||||||
push esi ;[.tex_ptr]
|
push esi ;[.tex_ptr]
|
||||||
|
|
||||||
push cx
|
push cx
|
||||||
sar ebx,ROUND
|
sar ebx,ROUND
|
||||||
push bx
|
push bx
|
||||||
sar eax,ROUND
|
sar eax,ROUND
|
||||||
push ax
|
push ax
|
||||||
call textured_line_z
|
call textured_line_z
|
||||||
|
|
||||||
popad
|
popad
|
||||||
mov edx,.dz13
|
mov edx,.dz13
|
||||||
add .cz1,edx
|
add .cz1,edx
|
||||||
mov edx,.dz12
|
mov edx,.dz12
|
||||||
add .cz2,edx
|
add .cz2,edx
|
||||||
|
|
||||||
mov edx, .tex_dx13
|
mov edx, .tex_dx13
|
||||||
add .scan_x1, edx
|
add .scan_x1, edx
|
||||||
mov edx, .tex_dx12
|
mov edx, .tex_dx12
|
||||||
add .scan_x2, edx
|
add .scan_x2, edx
|
||||||
mov edx, .tex_dy13
|
mov edx, .tex_dy13
|
||||||
add .scan_y1, edx
|
add .scan_y1, edx
|
||||||
mov edx, .tex_dy12
|
mov edx, .tex_dy12
|
||||||
add .scan_y2, edx
|
add .scan_y2, edx
|
||||||
|
|
||||||
add eax, .dx13
|
add eax, .dx13
|
||||||
add ebx, .dx12
|
add ebx, .dx12
|
||||||
inc cx
|
inc cx
|
||||||
cmp cx,.y2
|
cmp cx,.y2
|
||||||
jl .tt_loop1
|
jl .tt_loop1
|
||||||
|
|
||||||
.tt_loop1_end:
|
.tt_loop1_end:
|
||||||
|
|
||||||
|
|
||||||
mov cx,.y2
|
mov cx,.y2
|
||||||
cmp cx,.y3
|
cmp cx,.y3
|
||||||
jge .tt_loop2_end
|
jge .tt_loop2_end
|
||||||
|
|
||||||
movsx ebx,.x2
|
movsx ebx,.x2
|
||||||
shl ebx,ROUND
|
shl ebx,ROUND
|
||||||
movsx edx,.z2
|
movsx edx,.z2
|
||||||
shl edx,CATMULL_SHIFT
|
shl edx,CATMULL_SHIFT
|
||||||
mov .cz2,edx
|
mov .cz2,edx
|
||||||
movzx edx, word [.tex_x2]
|
movzx edx, word [.tex_x2]
|
||||||
shl edx,ROUND
|
shl edx,ROUND
|
||||||
mov .scan_x2,edx
|
mov .scan_x2,edx
|
||||||
movzx edx, word[.tex_y2]
|
movzx edx, word[.tex_y2]
|
||||||
shl edx,ROUND
|
shl edx,ROUND
|
||||||
mov .scan_y2,edx
|
mov .scan_y2,edx
|
||||||
|
|
||||||
.tt_loop2:
|
.tt_loop2:
|
||||||
|
|
||||||
pushad
|
pushad
|
||||||
|
|
||||||
push .z_ptr
|
push .z_ptr
|
||||||
push .cz1 ; z coords shifted shl catmull_shift
|
push .cz1 ; z coords shifted shl catmull_shift
|
||||||
push .cz2
|
push .cz2
|
||||||
|
|
||||||
push .scan_y2
|
push .scan_y2
|
||||||
push .scan_x2
|
push .scan_x2
|
||||||
push .scan_y1
|
push .scan_y1
|
||||||
push .scan_x1
|
push .scan_x1
|
||||||
push esi ;[.tex_ptr]
|
push esi ;[.tex_ptr]
|
||||||
|
|
||||||
push cx
|
push cx
|
||||||
sar ebx,ROUND
|
sar ebx,ROUND
|
||||||
push bx
|
push bx
|
||||||
sar eax,ROUND
|
sar eax,ROUND
|
||||||
push ax
|
push ax
|
||||||
call textured_line_z
|
call textured_line_z
|
||||||
|
|
||||||
popad
|
popad
|
||||||
|
|
||||||
|
|
||||||
mov edx,.dz13
|
mov edx,.dz13
|
||||||
add .cz1,edx
|
add .cz1,edx
|
||||||
mov edx,.dz23
|
mov edx,.dz23
|
||||||
add .cz2,edx
|
add .cz2,edx
|
||||||
|
|
||||||
mov edx, .tex_dx13
|
mov edx, .tex_dx13
|
||||||
add .scan_x1, edx
|
add .scan_x1, edx
|
||||||
mov edx, .tex_dx23
|
mov edx, .tex_dx23
|
||||||
add .scan_x2, edx
|
add .scan_x2, edx
|
||||||
mov edx, .tex_dy13
|
mov edx, .tex_dy13
|
||||||
add .scan_y1, edx
|
add .scan_y1, edx
|
||||||
mov edx, .tex_dy23
|
mov edx, .tex_dy23
|
||||||
add .scan_y2, edx
|
add .scan_y2, edx
|
||||||
|
|
||||||
add eax, .dx13
|
add eax, .dx13
|
||||||
add ebx, .dx23
|
add ebx, .dx23
|
||||||
inc cx
|
inc cx
|
||||||
cmp cx,.y3
|
cmp cx,.y3
|
||||||
jl .tt_loop2
|
jl .tt_loop2
|
||||||
|
|
||||||
.tt_loop2_end:
|
.tt_loop2_end:
|
||||||
|
|
||||||
.tt_end:
|
.tt_end:
|
||||||
mov esp,ebp
|
mov esp,ebp
|
||||||
ret 18
|
ret 18
|
||||||
|
|
||||||
textured_line_z:
|
textured_line_z:
|
||||||
@ -421,126 +421,130 @@ textured_line_z:
|
|||||||
.tex_y1 equ ebp+18
|
.tex_y1 equ ebp+18
|
||||||
.tex_x2 equ ebp+22
|
.tex_x2 equ ebp+22
|
||||||
.tex_y2 equ ebp+26
|
.tex_y2 equ ebp+26
|
||||||
.z2 equ dword [ebp+30] ;z1, z2 coords shifted shl CATMULL_SHIFT
|
.z2 equ dword [ebp+30] ;z1, z2 coords shifted shl CATMULL_SHIFT
|
||||||
.z1 equ dword [ebp+34]
|
.z1 equ dword [ebp+34]
|
||||||
.z_ptr equ dword [ebp+38]
|
.z_ptr equ dword [ebp+38]
|
||||||
|
|
||||||
.tex_dy equ dword [ebp-4]
|
.tex_dy equ dword [ebp-4]
|
||||||
.tex_dx equ dword [ebp-8]
|
.tex_dx equ dword [ebp-8]
|
||||||
.dz equ dword [ebp-12]
|
.dz equ dword [ebp-12]
|
||||||
.cz equ dword [ebp-16]
|
.cz equ dword [ebp-16]
|
||||||
.c_tex_x equ dword [ebp-20] ; current tex x
|
.c_tex_x equ dword [ebp-20] ; current tex x
|
||||||
.m_sft1 equ ebp-28
|
.m_sft1 equ ebp-28
|
||||||
.m_sft2 equ ebp-32
|
.m_sft2 equ ebp-32
|
||||||
; .c_tex_xM equ ebp+14
|
; .c_tex_xM equ ebp+14
|
||||||
.tex_dxM equ ebp-8
|
.tex_dxM equ ebp-8
|
||||||
|
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
|
|
||||||
mov ax,.y
|
mov ax,.y
|
||||||
or ax,ax
|
or ax,ax
|
||||||
jl .tl_quit
|
jl .tl_quit
|
||||||
mov bx,[size_y_var]
|
mov bx,[size_y_var]
|
||||||
dec bx
|
dec bx
|
||||||
cmp ax,bx ;SIZE_Y
|
cmp ax,bx ;SIZE_Y
|
||||||
jge .tl_quit
|
jge .tl_quit
|
||||||
|
|
||||||
mov ax,.x1
|
mov ax,.x1
|
||||||
cmp ax,.x2
|
cmp ax,.x2
|
||||||
je .tl_quit
|
je .tl_quit
|
||||||
jl .tl_ok
|
jl .tl_ok
|
||||||
|
|
||||||
xchg ax,.x2 ; sort params
|
xchg ax,.x2 ; sort params
|
||||||
mov .x1,ax
|
mov .x1,ax
|
||||||
if Ext >= MMX
|
if Ext >= SSE2
|
||||||
movq mm0,[.tex_x1]
|
movdqu xmm0,[.tex_x1]
|
||||||
movq mm1,[.tex_x2]
|
pshufd xmm0,xmm0,01001110b
|
||||||
movq [.tex_x2],mm0
|
movdqu [.tex_x1],xmm0
|
||||||
movq [.tex_x1],mm1
|
else if Ext >= MMX
|
||||||
|
movq mm0,[.tex_x1]
|
||||||
|
movq mm1,[.tex_x2]
|
||||||
|
movq [.tex_x2],mm0
|
||||||
|
movq [.tex_x1],mm1
|
||||||
|
|
||||||
else
|
else
|
||||||
mov eax,dword[.tex_x1]
|
mov eax,dword[.tex_x1]
|
||||||
xchg eax,dword[.tex_x2]
|
xchg eax,dword[.tex_x2]
|
||||||
mov dword[.tex_x1],eax
|
mov dword[.tex_x1],eax
|
||||||
|
|
||||||
mov eax,dword[.tex_y1]
|
mov eax,dword[.tex_y1]
|
||||||
xchg eax,dword[.tex_y2]
|
xchg eax,dword[.tex_y2]
|
||||||
mov dword[.tex_y1],eax
|
mov dword[.tex_y1],eax
|
||||||
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
mov eax,.z1
|
mov eax,.z1
|
||||||
xchg eax,.z2
|
xchg eax,.z2
|
||||||
mov .z1,eax
|
mov .z1,eax
|
||||||
|
|
||||||
.tl_ok:
|
.tl_ok:
|
||||||
mov cx,[size_x_var]
|
mov cx,[size_x_var]
|
||||||
dec cx
|
dec cx
|
||||||
cmp .x1,cx ;SIZE_X
|
cmp .x1,cx ;SIZE_X
|
||||||
jge .tl_quit
|
jge .tl_quit
|
||||||
cmp .x2,0
|
cmp .x2,0
|
||||||
jle .tl_quit
|
jle .tl_quit
|
||||||
|
|
||||||
mov bx,.x2
|
mov bx,.x2
|
||||||
sub bx,.x1
|
sub bx,.x1
|
||||||
movsx ebx,bx
|
movsx ebx,bx
|
||||||
|
|
||||||
mov eax,dword[.tex_y2] ; calc .dty
|
mov eax,dword[.tex_y2] ; calc .dty
|
||||||
sub eax,dword[.tex_y1]
|
sub eax,dword[.tex_y1]
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov eax,dword[.tex_x2] ; calc .dtx
|
mov eax,dword[.tex_x2] ; calc .dtx
|
||||||
sub eax,dword[.tex_x1]
|
sub eax,dword[.tex_x1]
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
mov eax,.z2 ; calc .dz
|
mov eax,.z2 ; calc .dz
|
||||||
sub eax,.z1
|
sub eax,.z1
|
||||||
cdq
|
cdq
|
||||||
idiv ebx
|
idiv ebx
|
||||||
push eax
|
push eax
|
||||||
|
|
||||||
cmp .x1,0 ; clipping
|
cmp .x1,0 ; clipping
|
||||||
jg @f
|
jg @f
|
||||||
|
|
||||||
movsx ebx,.x1
|
movsx ebx,.x1
|
||||||
neg ebx
|
neg ebx
|
||||||
imul ebx ; eax = .dz * abs(.x1)
|
imul ebx ; eax = .dz * abs(.x1)
|
||||||
add .z1,eax
|
add .z1,eax
|
||||||
mov .x1,0
|
mov .x1,0
|
||||||
|
|
||||||
mov eax,.tex_dy
|
mov eax,.tex_dy
|
||||||
imul ebx
|
imul ebx
|
||||||
add dword[.tex_y1],eax
|
add dword[.tex_y1],eax
|
||||||
|
|
||||||
mov eax,.tex_dx
|
mov eax,.tex_dx
|
||||||
imul ebx
|
imul ebx
|
||||||
add dword[.tex_x1],eax
|
add dword[.tex_x1],eax
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
cmp .x2,cx ;SIZE_X
|
cmp .x2,cx ;SIZE_X
|
||||||
jl @f
|
jl @f
|
||||||
mov .x2,cx ;SIZE_X
|
mov .x2,cx ;SIZE_X
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
movsx ebx,.y ; calc mem begin in buffers
|
movsx ebx,.y ; calc mem begin in buffers
|
||||||
movzx eax,word[size_x_var] ;SIZE_X
|
movzx eax,word[size_x_var] ;SIZE_X
|
||||||
mul ebx
|
mul ebx
|
||||||
movsx ebx,.x1
|
movsx ebx,.x1
|
||||||
add eax,ebx
|
add eax,ebx
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
|
|
||||||
lea eax,[eax*3]
|
lea eax,[eax*3]
|
||||||
add edi,eax ; edi - scr buff
|
add edi,eax ; edi - scr buff
|
||||||
shl ebx,2
|
shl ebx,2
|
||||||
add .z_ptr,ebx ; z buffer pointer
|
add .z_ptr,ebx ; z buffer pointer
|
||||||
|
|
||||||
mov cx,.x2
|
mov cx,.x2
|
||||||
sub cx,.x1
|
sub cx,.x1
|
||||||
movzx ecx,cx
|
movzx ecx,cx
|
||||||
|
|
||||||
;if Ext >= MMX
|
;if Ext >= MMX
|
||||||
; movq mm0,[.tex_x1]
|
; movq mm0,[.tex_x1]
|
||||||
@ -549,12 +553,12 @@ end if
|
|||||||
; mov ebx,.z1
|
; mov ebx,.z1
|
||||||
; mov eax,.dz
|
; mov eax,.dz
|
||||||
;else
|
;else
|
||||||
mov eax,dword[.tex_x1]
|
mov eax,dword[.tex_x1]
|
||||||
mov ebx,dword[.tex_y1]
|
mov ebx,dword[.tex_y1]
|
||||||
push .z1 ; .cz
|
push .z1 ; .cz
|
||||||
push eax ;.c_tex_x
|
push eax ;.c_tex_x
|
||||||
;end if
|
;end if
|
||||||
mov edx,.z_ptr
|
mov edx,.z_ptr
|
||||||
|
|
||||||
.tl_loop:
|
.tl_loop:
|
||||||
|
|
||||||
@ -569,43 +573,43 @@ end if
|
|||||||
; movd esi,mm3
|
; movd esi,mm3
|
||||||
; mov dword[edx],ebx ; renew z buffer
|
; mov dword[edx],ebx ; renew z buffer
|
||||||
;else
|
;else
|
||||||
; eax - temp
|
; eax - temp
|
||||||
mov eax,.cz ; ebx - cur tex y shl ROUND
|
mov eax,.cz ; ebx - cur tex y shl ROUND
|
||||||
cmp eax,[edx] ; ecx - l.lenght
|
cmp eax,[edx] ; ecx - l.lenght
|
||||||
jge @f ; ebx - cur tex_y ; edx - temp
|
jge @f ; ebx - cur tex_y ; edx - temp
|
||||||
mov esi,ebx ; edi - scr buff
|
mov esi,ebx ; edi - scr buff
|
||||||
sar esi,ROUND ; esi - tex_ptr temp
|
sar esi,ROUND ; esi - tex_ptr temp
|
||||||
shl esi,TEX_SHIFT ; .z_ptr - cur pointer to z buff
|
shl esi,TEX_SHIFT ; .z_ptr - cur pointer to z buff
|
||||||
mov eax,.c_tex_x ; .cz - cur z coord shl CATMULL_SHIFT
|
mov eax,.c_tex_x ; .cz - cur z coord shl CATMULL_SHIFT
|
||||||
sar eax,ROUND
|
sar eax,ROUND
|
||||||
add esi,eax
|
add esi,eax
|
||||||
mov eax,.cz
|
mov eax,.cz
|
||||||
mov dword[edx],eax ; renew z buffer
|
mov dword[edx],eax ; renew z buffer
|
||||||
;end if
|
;end if
|
||||||
and esi,TEXTURE_SIZE
|
and esi,TEXTURE_SIZE
|
||||||
lea esi,[esi*3]
|
lea esi,[esi*3]
|
||||||
add esi,.tex_ptr
|
add esi,.tex_ptr
|
||||||
movsd
|
movsd
|
||||||
dec edi
|
dec edi
|
||||||
jmp .no_skip
|
jmp .no_skip
|
||||||
@@:
|
@@:
|
||||||
add edi,3
|
add edi,3
|
||||||
.no_skip:
|
.no_skip:
|
||||||
add edx,4
|
add edx,4
|
||||||
;if Ext >= MMX
|
;if Ext >= MMX
|
||||||
; add ebx,eax
|
; add ebx,eax
|
||||||
; paddd mm0,mm1
|
; paddd mm0,mm1
|
||||||
;else
|
;else
|
||||||
mov eax,.dz
|
mov eax,.dz
|
||||||
add .cz,eax
|
add .cz,eax
|
||||||
mov eax,.tex_dx
|
mov eax,.tex_dx
|
||||||
add .c_tex_x,eax
|
add .c_tex_x,eax
|
||||||
add ebx,.tex_dy
|
add ebx,.tex_dy
|
||||||
;end if
|
;end if
|
||||||
loop .tl_loop
|
loop .tl_loop
|
||||||
.tl_quit:
|
.tl_quit:
|
||||||
|
|
||||||
mov esp,ebp
|
mov esp,ebp
|
||||||
|
|
||||||
ret 30+8
|
ret 30+8
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
; application : View3ds ver. 0.075 - tiny .3ds and .asc files viewer
|
; application : View3ds ver. 0.076 - 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
|
||||||
; author : Macgub aka Maciej Guba
|
; author : Macgub aka Maciej Guba
|
||||||
; email : macgub3@wp.pl
|
; email : macgub3@wp.pl
|
||||||
; web : http://macgub.co.pl, http://macgub.j.pl
|
; web : http://macgub.co.pl
|
||||||
; Fell free to use this intro in your own distribution of KolibriOS.
|
; Fell free to use this intro in your own distribution of KolibriOS.
|
||||||
; Special greetings to KolibriOS team .
|
; Special greetings to KolibriOS team .
|
||||||
; I hope because my demos Christian Belive will be near to each of You.
|
; I hope because my demos Christian Belive will be near to each of You.
|
||||||
@ -18,7 +18,6 @@
|
|||||||
; 1) Read from a file (*.3DS standard)
|
; 1) Read from a file (*.3DS standard)
|
||||||
; 2) Written in manually (at the end of the code) ; now not exist
|
; 2) Written in manually (at the end of the code) ; now not exist
|
||||||
|
|
||||||
format binary as ""
|
|
||||||
|
|
||||||
SIZE_X equ 512
|
SIZE_X equ 512
|
||||||
SIZE_Y equ 512 ; ///// I want definitely
|
SIZE_Y equ 512 ; ///// I want definitely
|
||||||
@ -38,14 +37,12 @@ MMX = 1
|
|||||||
SSE = 2
|
SSE = 2
|
||||||
SSE2 = 3
|
SSE2 = 3
|
||||||
SSE3 = 4
|
SSE3 = 4
|
||||||
Ext = SSE3 ;Ext={ NON | MMX | SSE | SSE2 | SSE3 }
|
Ext = SSE3 ;Ext={ NON | MMX | SSE | SSE2 | SSE3 }
|
||||||
|
|
||||||
; For now correct only SSE2 and SSE3 versions. if you have older CPU
|
; For now correct only SSE2 and SSE3 versions. if you have older CPU
|
||||||
; use older versions of app. Probably ver 005 will be OK but it need
|
; use older versions of app. Probably ver 005 will be OK but it need
|
||||||
; re-edit to support new Kolibri features.
|
; re-edit to support new Kolibri features.
|
||||||
|
|
||||||
; 0 for short names (Menuet-compatible), 1 for long names (Kolibri features)
|
|
||||||
USE_LFN = 1 ; App is Kolibri only now.
|
|
||||||
|
|
||||||
use32
|
use32
|
||||||
org 0x0
|
org 0x0
|
||||||
db 'MENUET01' ; 8 byte id
|
db 'MENUET01' ; 8 byte id
|
||||||
@ -98,7 +95,19 @@ START: ; start of execution
|
|||||||
call normalize_all_light_vectors
|
call normalize_all_light_vectors
|
||||||
call copy_lights ; to aligned float
|
call copy_lights ; to aligned float
|
||||||
call init_triangles_normals2
|
call init_triangles_normals2
|
||||||
|
|
||||||
|
if Ext >= SSE2
|
||||||
|
call detect_chunks
|
||||||
|
mov [chunks_number],ecx
|
||||||
|
mov [chunks_ptr],ebx
|
||||||
|
|
||||||
|
; esi - tri_ch
|
||||||
|
; edi - t_ptr - every vertice index - pointer to to all triangles
|
||||||
|
; that have this index
|
||||||
|
end if
|
||||||
|
|
||||||
call init_point_normals
|
call init_point_normals
|
||||||
|
|
||||||
call init_envmap2
|
call init_envmap2
|
||||||
call init_envmap_cub
|
call init_envmap_cub
|
||||||
call generate_texture2
|
call generate_texture2
|
||||||
@ -107,7 +116,7 @@ START: ; start of execution
|
|||||||
if Ext >= SSE3
|
if Ext >= SSE3
|
||||||
call init_point_lights
|
call init_point_lights
|
||||||
mov [fire_flag],0 ; proteza
|
mov [fire_flag],0 ; proteza
|
||||||
end if
|
end if
|
||||||
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
|
||||||
@ -118,12 +127,13 @@ START: ; start of execution
|
|||||||
cpuid
|
cpuid
|
||||||
bt ecx,0 ; is sse3 on board?
|
bt ecx,0 ; is sse3 on board?
|
||||||
jc @f
|
jc @f
|
||||||
mov [max_dr_flg],12
|
mov byte[max_dr_flg],12
|
||||||
mov [isSSE3],0
|
mov [isSSE3],0
|
||||||
@@:
|
@@:
|
||||||
end if
|
end if
|
||||||
|
|
||||||
still:
|
|
||||||
|
still:
|
||||||
cmp [edit_flag],1
|
cmp [edit_flag],1
|
||||||
jne @f
|
jne @f
|
||||||
mov eax,40 ; set events mask
|
mov eax,40 ; set events mask
|
||||||
@ -164,7 +174,7 @@ still:
|
|||||||
je key
|
je key
|
||||||
cmp eax,3 ; button event ?
|
cmp eax,3 ; button event ?
|
||||||
je button
|
je button
|
||||||
|
|
||||||
mov esi,eax
|
mov esi,eax
|
||||||
mov eax,37
|
mov eax,37
|
||||||
mov ebx,7 ; get mouse scroll
|
mov ebx,7 ; get mouse scroll
|
||||||
@ -175,7 +185,7 @@ still:
|
|||||||
cmp eax, 1
|
cmp eax, 1
|
||||||
je button.zoom_out
|
je button.zoom_out
|
||||||
mov eax,esi
|
mov eax,esi
|
||||||
|
|
||||||
cmp eax,6 ; mouse event ?
|
cmp eax,6 ; mouse event ?
|
||||||
jne @f
|
jne @f
|
||||||
cmp [edit_flag],1 ; handle mouse only when edit is active
|
cmp [edit_flag],1 ; handle mouse only when edit is active
|
||||||
@ -244,26 +254,26 @@ still:
|
|||||||
|
|
||||||
jmp noclose
|
jmp noclose
|
||||||
|
|
||||||
.rot_inc_x:
|
.rot_inc_x:
|
||||||
inc [angle_x]
|
inc [angle_x]
|
||||||
and [angle_x],0xff
|
and [angle_x],0xff
|
||||||
jmp noclose.end_rot
|
jmp noclose.end_rot
|
||||||
.rot_dec_x:
|
.rot_dec_x:
|
||||||
dec [angle_x]
|
dec [angle_x]
|
||||||
and [angle_x],0xff
|
and [angle_x],0xff
|
||||||
jmp noclose.end_rot
|
jmp noclose.end_rot
|
||||||
.rot_inc_y:
|
.rot_inc_y:
|
||||||
inc [angle_y]
|
inc [angle_y]
|
||||||
and [angle_y],0xff
|
and [angle_y],0xff
|
||||||
jmp noclose.end_rot
|
jmp noclose.end_rot
|
||||||
.rot_dec_y:
|
.rot_dec_y:
|
||||||
dec [angle_y]
|
dec [angle_y]
|
||||||
and [angle_y],0xff
|
and [angle_y],0xff
|
||||||
jmp noclose.end_rot
|
jmp noclose.end_rot
|
||||||
.rot_z:
|
.rot_z:
|
||||||
inc [angle_z]
|
inc [angle_z]
|
||||||
and [angle_z],0xff
|
and [angle_z],0xff
|
||||||
jmp noclose.end_rot
|
jmp noclose.end_rot
|
||||||
|
|
||||||
button: ; button
|
button: ; button
|
||||||
mov eax,17 ; get id
|
mov eax,17 ; get id
|
||||||
@ -336,7 +346,7 @@ still:
|
|||||||
.next_m4:
|
.next_m4:
|
||||||
cmp ah,14
|
cmp ah,14
|
||||||
jne @f
|
jne @f
|
||||||
.xchg:
|
.xchg:
|
||||||
call exchange
|
call exchange
|
||||||
@@:
|
@@:
|
||||||
cmp ah,15
|
cmp ah,15
|
||||||
@ -828,6 +838,7 @@ end if
|
|||||||
|
|
||||||
jmp still
|
jmp still
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
;-------------------------PROCEDURES---------------------------------------------
|
;-------------------------PROCEDURES---------------------------------------------
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
@ -838,6 +849,7 @@ include "3dmath.inc"
|
|||||||
include "grd_line.inc"
|
include "grd_line.inc"
|
||||||
include "b_procs.inc"
|
include "b_procs.inc"
|
||||||
include "a_procs.inc"
|
include "a_procs.inc"
|
||||||
|
include "chunks.inc"
|
||||||
include "grd_cat.inc"
|
include "grd_cat.inc"
|
||||||
include "bump_tex.inc"
|
include "bump_tex.inc"
|
||||||
include "grd_tex.inc"
|
include "grd_tex.inc"
|
||||||
@ -879,7 +891,9 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
imul edx,ecx
|
imul edx,ecx
|
||||||
add ebx,edx
|
add ebx,edx
|
||||||
push ebx
|
push ebx
|
||||||
lea ecx,[ebx*2]
|
mov ecx,ebx
|
||||||
|
shl ecx,2
|
||||||
|
; lea ecx,[ebx*2]
|
||||||
lea ebx,[ebx*3]
|
lea ebx,[ebx*3]
|
||||||
|
|
||||||
cmp [dr_flag],12
|
cmp [dr_flag],12
|
||||||
@ -931,11 +945,12 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
check_bar
|
check_bar
|
||||||
jne .no_edit
|
jne .no_edit
|
||||||
add ecx,[vertices_index_ptr]
|
add ecx,[vertices_index_ptr]
|
||||||
mov cx,word[ecx]
|
mov ecx,[ecx]
|
||||||
inc cx
|
; cmp ecx,-1
|
||||||
|
; je .no_edit
|
||||||
|
|
||||||
|
|
||||||
mov [vertex_edit_no],cx ;if vert_edit_no = 0, no vertex selected
|
mov [vertex_edit_no],ecx ;if vert_edit_no = -1, no vertex selected
|
||||||
|
|
||||||
mov eax,dword[.x_coord]
|
mov eax,dword[.x_coord]
|
||||||
mov dword[edit_end_x],eax
|
mov dword[edit_end_x],eax
|
||||||
@ -949,7 +964,7 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
; add ecx,[vertices_index_ptr]
|
; add ecx,[vertices_index_ptr]
|
||||||
; mov cx,[ecx]
|
; mov cx,[ecx]
|
||||||
; inc cx
|
; inc cx
|
||||||
cmp [vertex_edit_no],0 ; cx ; vertex number
|
cmp [vertex_edit_no],-1 ; cx ; vertex number
|
||||||
je .end
|
je .end
|
||||||
push dword[.x_coord]
|
push dword[.x_coord]
|
||||||
pop dword[edit_end_x]
|
pop dword[edit_end_x]
|
||||||
@ -961,8 +976,8 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
check_bar
|
check_bar
|
||||||
jne .end
|
jne .end
|
||||||
|
|
||||||
movzx esi,[vertex_edit_no]
|
mov esi,[vertex_edit_no]
|
||||||
dec esi
|
; dec esi
|
||||||
lea esi,[esi*3]
|
lea esi,[esi*3]
|
||||||
add esi,esi
|
add esi,esi
|
||||||
add esi,[points_translated_ptr]
|
add esi,[points_translated_ptr]
|
||||||
@ -996,8 +1011,8 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
call rotary
|
call rotary
|
||||||
|
|
||||||
; inject into vertex list
|
; inject into vertex list
|
||||||
movzx edi,[vertex_edit_no]
|
mov edi,[vertex_edit_no]
|
||||||
dec edi
|
; dec edi
|
||||||
lea edi,[edi*3]
|
lea edi,[edi*3]
|
||||||
shl edi,2
|
shl edi,2
|
||||||
add edi,[points_ptr]
|
add edi,[points_ptr]
|
||||||
@ -1012,7 +1027,7 @@ edit: ; mmx required, edit mesh by vertex
|
|||||||
|
|
||||||
|
|
||||||
mov dword[edit_end_x],0
|
mov dword[edit_end_x],0
|
||||||
mov [vertex_edit_no],0
|
mov [vertex_edit_no],-1
|
||||||
|
|
||||||
.no_edit:
|
.no_edit:
|
||||||
.end:
|
.end:
|
||||||
@ -1055,7 +1070,7 @@ alloc_buffer_mem:
|
|||||||
|
|
||||||
|
|
||||||
mov ecx,[.temp]
|
mov ecx,[.temp]
|
||||||
add ecx,ecx
|
shl ecx,2
|
||||||
add ecx,256
|
add ecx,256
|
||||||
mov eax,68
|
mov eax,68
|
||||||
mov ebx,20
|
mov ebx,20
|
||||||
@ -1477,18 +1492,84 @@ ret
|
|||||||
|
|
||||||
if Ext >= SSE2
|
if Ext >= SSE2
|
||||||
init_point_normals:
|
init_point_normals:
|
||||||
|
;in:
|
||||||
|
; esi - tri_ch
|
||||||
|
; edi - t_ptr
|
||||||
.z equ dword [ebp-8]
|
.z equ dword [ebp-8]
|
||||||
.y equ dword [ebp-12]
|
.y equ dword [ebp-12]
|
||||||
.x equ [ebp-16]
|
.x equ [ebp-16]
|
||||||
.point_number equ dword [ebp-28]
|
.point_number equ dword [ebp-28]
|
||||||
.hit_faces equ dword [ebp-32]
|
.hit_faces equ dword [ebp-32]
|
||||||
|
.t_ptr equ dword [ebp-36]
|
||||||
|
.tri_ch equ dword [ebp-40]
|
||||||
|
.max_val equ dword [ebp-44]
|
||||||
|
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp,esp
|
mov ebp,esp
|
||||||
sub esp,64
|
sub esp,64
|
||||||
and ebp,-16
|
and ebp,-16
|
||||||
|
mov .t_ptr,edi
|
||||||
|
mov .tri_ch,esi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mov ecx,[triangles_count_var]
|
||||||
|
shl ecx,3
|
||||||
|
lea ecx,[ecx*3]
|
||||||
|
add ecx,.tri_ch
|
||||||
|
mov .max_val,ecx
|
||||||
|
xor edx,edx
|
||||||
|
|
||||||
|
.lp1:
|
||||||
|
mov ebx,edx
|
||||||
|
shl ebx,2
|
||||||
|
add ebx,.t_ptr
|
||||||
|
mov esi,[ebx]
|
||||||
|
or esi,esi
|
||||||
|
jz .old
|
||||||
|
|
||||||
|
xorps xmm1,xmm1
|
||||||
|
xor ecx,ecx
|
||||||
|
@@:
|
||||||
|
mov eax,[esi+4] ; eax - tri index
|
||||||
|
mov ebx,[esi]
|
||||||
|
imul eax,[i12]
|
||||||
|
add eax,[triangles_normals_ptr]
|
||||||
|
movups xmm0,[eax]
|
||||||
|
inc ecx
|
||||||
|
addps xmm1,xmm0
|
||||||
|
add esi,8
|
||||||
|
cmp esi,.max_val ; some objects need this check
|
||||||
|
ja .old ;old method
|
||||||
|
cmp ebx,[esi]
|
||||||
|
je @b
|
||||||
|
|
||||||
|
cvtsi2ss xmm2,ecx
|
||||||
|
rcpss xmm2,xmm2
|
||||||
|
shufps xmm2,xmm2,0
|
||||||
|
mulps xmm1,xmm2
|
||||||
|
mov edi,edx
|
||||||
|
imul edi,[i12]
|
||||||
|
add edi,[points_normals_ptr]
|
||||||
|
movlps [edi],xmm1
|
||||||
|
movhlps xmm1,xmm1
|
||||||
|
movss [edi+8],xmm1
|
||||||
|
call normalize_vector
|
||||||
|
|
||||||
|
inc edx
|
||||||
|
cmp edx,[points_count_var]
|
||||||
|
jnz .lp1
|
||||||
|
|
||||||
|
jmp .end
|
||||||
|
|
||||||
|
|
||||||
|
.old:
|
||||||
|
|
||||||
mov edi,[points_normals_ptr]
|
mov edi,[points_normals_ptr]
|
||||||
mov .point_number,0
|
mov .point_number,edx
|
||||||
.ipn_loop:
|
.ipn_loop:
|
||||||
movd xmm0,.point_number
|
movd xmm0,.point_number
|
||||||
pshufd xmm0,xmm0,0
|
pshufd xmm0,xmm0,0
|
||||||
@ -1547,6 +1628,20 @@ init_point_normals:
|
|||||||
mov edx,.point_number
|
mov edx,.point_number
|
||||||
cmp edx,[points_count_var]
|
cmp edx,[points_count_var]
|
||||||
jne .ipn_loop
|
jne .ipn_loop
|
||||||
|
.end:
|
||||||
|
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,13
|
||||||
|
mov ecx,.t_ptr
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
mov eax,68
|
||||||
|
mov ebx,13
|
||||||
|
mov ecx,.tri_ch
|
||||||
|
int 0x40
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add esp,64
|
add esp,64
|
||||||
pop ebp
|
pop ebp
|
||||||
@ -1776,10 +1871,10 @@ draw_triangles:
|
|||||||
|
|
||||||
emms
|
emms
|
||||||
; update translated list MMX required
|
; update translated list MMX required
|
||||||
cmp [vertex_edit_no],0
|
cmp [vertex_edit_no],-1
|
||||||
je @f
|
je @f
|
||||||
movzx eax,[vertex_edit_no]
|
mov eax,[vertex_edit_no]
|
||||||
dec eax
|
; dec eax
|
||||||
movd mm0,[edit_end_x]
|
movd mm0,[edit_end_x]
|
||||||
psubw mm0,[edit_start_x]
|
psubw mm0,[edit_start_x]
|
||||||
lea eax,[eax*3]
|
lea eax,[eax*3]
|
||||||
@ -2383,42 +2478,36 @@ draw_triangles:
|
|||||||
push word .zz2
|
push word .zz2
|
||||||
push word .zz1
|
push word .zz1
|
||||||
|
|
||||||
mov esi, .point_index3 ; tex map coords
|
fninit
|
||||||
shl esi,2
|
lea esi, .point_index3 ; env coords
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index2
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index1
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
|
|
||||||
lea esi, .point_index1 ; env coords
|
|
||||||
sub esp,12
|
|
||||||
mov edi,esp
|
mov edi,esp
|
||||||
|
sub esp,24
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
@@:
|
@@:
|
||||||
mov eax,dword[esi]
|
mov eax,dword[esi]
|
||||||
lea eax,[eax*3]
|
|
||||||
shl eax,2
|
shl eax,2
|
||||||
|
mov ebx,eax
|
||||||
|
; mov ebx,eax
|
||||||
|
add ebx,[tex_points_ptr]
|
||||||
|
mov ebx,[ebx]
|
||||||
|
mov [edi-8],ebx
|
||||||
|
lea eax,[eax*3]
|
||||||
add eax,[points_normals_rot_ptr]
|
add eax,[points_normals_rot_ptr]
|
||||||
; texture x=(rotated point normal -> x * 255)+255
|
; texture x=(rotated point normal -> x * 255)+255
|
||||||
fld dword[eax]
|
fld dword[eax]
|
||||||
fimul [correct_tex]
|
fimul [correct_tex]
|
||||||
fiadd [correct_tex]
|
fiadd [correct_tex]
|
||||||
fistp word[edi]
|
fistp word[edi-4]
|
||||||
|
and word[edi-4],0x7fff ; some objects need it
|
||||||
; texture y=(rotated point normal -> y * 255)+255
|
; texture y=(rotated point normal -> y * 255)+255
|
||||||
fld dword[eax+4]
|
fld dword[eax+4]
|
||||||
fimul [correct_tex]
|
fimul [correct_tex]
|
||||||
fiadd [correct_tex]
|
fiadd [correct_tex]
|
||||||
fistp word[edi+2]
|
fistp word[edi-2]
|
||||||
and word[edi+2],0x7fff ; some objects need it
|
and word[edi-2],0x7fff ; some objects need it
|
||||||
add edi,4
|
|
||||||
add esi,4
|
sub edi,8
|
||||||
|
sub esi,4
|
||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
mov eax, .xx1
|
mov eax, .xx1
|
||||||
@ -2434,18 +2523,7 @@ draw_triangles:
|
|||||||
|
|
||||||
.bump_tex:
|
.bump_tex:
|
||||||
push ebp
|
push ebp
|
||||||
mov esi, .point_index3 ; tex map coords
|
fninit
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index2
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index1
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
|
|
||||||
push dword texmap
|
push dword texmap
|
||||||
|
|
||||||
@ -2455,41 +2533,37 @@ draw_triangles:
|
|||||||
push word .zz2
|
push word .zz2
|
||||||
push word .zz1
|
push word .zz1
|
||||||
|
|
||||||
lea esi, .index1x12 ; env coords
|
|
||||||
sub esp,12
|
lea ebx, .point_index1
|
||||||
|
sub esp,36
|
||||||
mov edi,esp
|
mov edi,esp
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
@@:
|
@@:
|
||||||
mov eax,dword[esi]
|
mov eax,[ebx]
|
||||||
add eax,[points_normals_rot_ptr]
|
shl eax,2
|
||||||
|
mov esi,eax
|
||||||
|
lea esi,[esi*3]
|
||||||
|
add eax,[tex_points_ptr]
|
||||||
|
mov eax,[eax]
|
||||||
|
ror eax,16
|
||||||
|
mov [edi],eax
|
||||||
|
mov [edi+8],eax
|
||||||
|
|
||||||
|
add esi,[points_normals_rot_ptr]
|
||||||
; texture x=(rotated point normal -> x * 255)+255
|
; texture x=(rotated point normal -> x * 255)+255
|
||||||
fld dword[eax]
|
fld dword[esi]
|
||||||
fimul [correct_tex]
|
fimul [correct_tex]
|
||||||
fiadd [correct_tex]
|
fiadd [correct_tex]
|
||||||
fistp word[edi]
|
fistp word[edi+6] ; env coords
|
||||||
; texture y=(rotated point normal -> y * 255)+255
|
; texture y=(rotated point normal -> y * 255)+255
|
||||||
fld dword[eax+4]
|
fld dword[esi+4]
|
||||||
fimul [correct_tex]
|
fimul [correct_tex]
|
||||||
fiadd [correct_tex]
|
fiadd [correct_tex]
|
||||||
fistp word[edi+2]
|
fistp word[edi+4]
|
||||||
|
add ebx,4
|
||||||
add edi,4
|
add edi,12
|
||||||
add esi,4
|
|
||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
mov esi, .point_index3 ; bump map coords
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index2
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
mov esi, .point_index1
|
|
||||||
shl esi,2
|
|
||||||
add esi,[tex_points_ptr]
|
|
||||||
push dword[esi]
|
|
||||||
|
|
||||||
mov eax,dword .xx1
|
mov eax,dword .xx1
|
||||||
mov ebx,dword .xx2
|
mov ebx,dword .xx2
|
||||||
mov ecx,dword .xx3
|
mov ecx,dword .xx3
|
||||||
@ -2861,138 +2935,110 @@ end if
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
draw_handlers:
|
draw_handlers:
|
||||||
; in eax - render model
|
|
||||||
push ebp
|
|
||||||
mov ebp,esp
|
|
||||||
|
|
||||||
.counter equ ebp-16
|
; in eax - render model
|
||||||
.xres3m18 equ ebp-8
|
push ebp
|
||||||
.xres2m12 equ ebp-12
|
mov ebp,esp
|
||||||
|
; emms
|
||||||
|
.fac equ dword[ebp-16]
|
||||||
|
.xplus_scr equ ebp-8
|
||||||
|
.xplus_index equ ebp-12
|
||||||
.dr_model equ dword[ebp-4]
|
.dr_model equ dword[ebp-4]
|
||||||
|
|
||||||
|
sub esp,16
|
||||||
|
mov .dr_model,eax
|
||||||
|
|
||||||
; init counter
|
movzx eax,word[size_x_var]
|
||||||
sub esp,12
|
|
||||||
push dword 0
|
|
||||||
mov .dr_model,eax
|
|
||||||
movzx eax,word[size_x_var]
|
|
||||||
cmp .dr_model,12
|
cmp .dr_model,12
|
||||||
jge @f
|
jge @f
|
||||||
lea ebx,[eax*3]
|
lea ebx,[eax*3]
|
||||||
sub ebx,18
|
sub ebx,3*6
|
||||||
add eax,eax
|
mov [.xplus_scr],ebx ; for scr 1st cause
|
||||||
sub eax,12
|
mov .fac,3
|
||||||
mov [.xres3m18],ebx
|
jmp .in_r
|
||||||
mov [.xres2m12],eax
|
@@:
|
||||||
jmp .f
|
lea ebx,[eax*4] ; for scr 2cond cause
|
||||||
@@:
|
sub ebx,4*6
|
||||||
lea ebx,[eax*4]
|
mov [.xplus_scr],ebx
|
||||||
sub ebx,4*6
|
mov .fac,4
|
||||||
add eax,eax
|
.in_r:
|
||||||
sub eax,3*4
|
|
||||||
mov [.xres3m18],ebx
|
|
||||||
mov [.xres2m12],eax
|
|
||||||
.f:
|
|
||||||
|
|
||||||
|
lea ebx,[eax*4]
|
||||||
|
sub ebx,4*6
|
||||||
|
mov [.xplus_index],ebx ; index
|
||||||
|
|
||||||
|
xor ecx,ecx
|
||||||
|
mov eax,4 shl 16 + 4
|
||||||
|
movd xmm0,[size_y_var]
|
||||||
|
movd xmm1,eax
|
||||||
|
psubw xmm0,xmm1
|
||||||
|
pshuflw xmm0,xmm0,00000001b
|
||||||
|
|
||||||
mov esi,[points_translated_ptr]
|
.l:
|
||||||
.loop:
|
push ecx
|
||||||
push esi
|
cmp [culling_flag],1 ; (if culling_flag = 1)
|
||||||
; DO culling AT FIRST
|
jne .no_culling
|
||||||
cmp [culling_flag],1 ; (if culling_flag = 1)
|
mov edi,ecx ; *********************************
|
||||||
jne .no_culling
|
lea edi,[edi*3]
|
||||||
mov edi,[.counter] ; *********************************
|
shl edi,2
|
||||||
lea edi,[edi*3]
|
add edi,[points_normals_rot_ptr]
|
||||||
shl edi,2
|
bt dword[edi+8],31
|
||||||
add edi,[points_normals_rot_ptr]
|
jnc .skip
|
||||||
mov eax,[edi+8] ; check sign of z coof
|
.no_culling:
|
||||||
shr eax,31
|
mov esi,ecx
|
||||||
cmp eax,1
|
lea esi,[esi*3]
|
||||||
jnz .skip
|
add esi,esi
|
||||||
.no_culling:
|
add esi,[points_translated_ptr]
|
||||||
mov eax,[esi]
|
movd xmm2,[esi]
|
||||||
movzx ebx,ax ; ebx - x
|
movd xmm3,[esi]
|
||||||
shr eax,16 ; eax - y
|
pcmpgtw xmm2,xmm0
|
||||||
cmp eax,4 ; check if markers not exceedes screen
|
pcmpgtw xmm3,xmm1
|
||||||
jle .skip
|
pxor xmm3,xmm2
|
||||||
cmp ebx,4
|
movd eax,xmm3
|
||||||
jle .skip
|
cmp eax,-1
|
||||||
movzx edx,word[size_x_var]
|
jne .skip
|
||||||
sub edx,4
|
|
||||||
movzx ecx,word[size_y_var]
|
|
||||||
sub ecx,4
|
|
||||||
cmp ebx,edx
|
|
||||||
jge .skip
|
|
||||||
cmp eax,ecx
|
|
||||||
jge .skip
|
|
||||||
|
|
||||||
movzx edx,word[size_x_var]
|
movzx eax,word[esi]
|
||||||
; sub ebx,3
|
movzx ebx,word[esi+2]
|
||||||
; sub eax,3
|
sub eax,2
|
||||||
imul eax,edx
|
sub ebx,2
|
||||||
add eax,ebx
|
movzx edx, word[size_x_var]
|
||||||
push eax
|
imul ebx,edx
|
||||||
lea edi,[eax*3]
|
add ebx,eax
|
||||||
cmp .dr_model,12
|
mov edi,ebx
|
||||||
jl @f
|
imul ebx,.fac
|
||||||
add edi,[esp]
|
shl edi,2
|
||||||
@@:
|
add ebx,[screen_ptr]
|
||||||
add esp,4
|
add edi,[vertices_index_ptr]
|
||||||
lea eax,[eax*2]
|
mov eax,ecx
|
||||||
; draw bar 6x6
|
cld
|
||||||
add edi,[screen_ptr]
|
mov ecx,6
|
||||||
add eax,dword[vertices_index_ptr]
|
.l2:
|
||||||
|
push ecx
|
||||||
|
mov ecx,6 ; draw bar
|
||||||
|
.l1:
|
||||||
|
mov word[ebx],0
|
||||||
mov edx,[.counter]
|
mov byte[ebx+2],0xff
|
||||||
mov ecx,6
|
stosd
|
||||||
|
add ebx,.fac
|
||||||
.oop:
|
loop .l1
|
||||||
push ecx
|
add ebx,[.xplus_scr]
|
||||||
mov ecx,6
|
add edi,[.xplus_index]
|
||||||
|
pop ecx
|
||||||
.do:
|
loop .l2
|
||||||
mov word[edi],0x0000 ;ax
|
.skip:
|
||||||
mov byte[edi+2],0xff ;al
|
pop ecx
|
||||||
mov word[eax],dx
|
inc ecx
|
||||||
add eax,2
|
cmp ecx,[points_count_var]
|
||||||
cmp .dr_model,12
|
jna .l
|
||||||
jl @f
|
|
||||||
add edi,4
|
|
||||||
loop .do
|
|
||||||
jmp .ad
|
|
||||||
@@:
|
|
||||||
add edi,3
|
|
||||||
loop .do
|
|
||||||
.ad:
|
|
||||||
add edi,[.xres3m18]
|
|
||||||
add eax,[.xres2m12]
|
|
||||||
pop ecx
|
|
||||||
loop .oop
|
|
||||||
|
|
||||||
.skip:
|
|
||||||
pop esi
|
|
||||||
add esi,6
|
|
||||||
inc dword[.counter]
|
|
||||||
mov ecx,[.counter]
|
|
||||||
cmp ecx,[points_count_var]
|
|
||||||
jng .loop
|
|
||||||
|
|
||||||
mov esp,ebp
|
|
||||||
pop ebp
|
|
||||||
|
|
||||||
|
mov esp,ebp
|
||||||
|
pop ebp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fill_Z_buffer:
|
fill_Z_buffer:
|
||||||
mov eax,0x70000000
|
mov eax,0x70000000
|
||||||
cmp [dr_flag],11
|
cmp [dr_flag],11
|
||||||
@ -3033,11 +3079,7 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_va
|
|||||||
xor ebp,ebp
|
xor ebp,ebp
|
||||||
mov [points_count_var],ebx
|
mov [points_count_var],ebx
|
||||||
mov [triangles_count_var],ebx
|
mov [triangles_count_var],ebx
|
||||||
if USE_LFN = 0
|
|
||||||
mov esi,SourceFile
|
|
||||||
else
|
|
||||||
mov esi,[fptr]
|
mov esi,[fptr]
|
||||||
end if
|
|
||||||
|
|
||||||
cmp [esi],word 4D4Dh
|
cmp [esi],word 4D4Dh
|
||||||
je @f ;Must be legal .3DS file
|
je @f ;Must be legal .3DS file
|
||||||
@ -3096,11 +3138,13 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_va
|
|||||||
mov edx,ecx
|
mov edx,ecx
|
||||||
add esi,8
|
add esi,8
|
||||||
@@:
|
@@:
|
||||||
|
lea ecx,[ecx*3]
|
||||||
add ebx,6
|
add ecx,ecx
|
||||||
add esi,12
|
add ebx,ecx
|
||||||
|
add ecx,ecx
|
||||||
|
add esi,ecx
|
||||||
; dec ecx
|
; dec ecx
|
||||||
loop @b
|
; loop @b
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
@ -3114,9 +3158,11 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_va
|
|||||||
add esi,8
|
add esi,8
|
||||||
|
|
||||||
@@:
|
@@:
|
||||||
add esi,8
|
shl ecx,3
|
||||||
dec ecx
|
add esi,ecx
|
||||||
jnz @b
|
; dec ecx
|
||||||
|
; jnz @b
|
||||||
|
; loop @b
|
||||||
; xor ecx,ecx
|
; xor ecx,ecx
|
||||||
add ebp,edx
|
add ebp,edx
|
||||||
jmp .find4k
|
jmp .find4k
|
||||||
@ -3198,8 +3244,9 @@ read_from_file:
|
|||||||
|
|
||||||
add ebx,6
|
add ebx,6
|
||||||
add esi,12
|
add esi,12
|
||||||
dec ecx
|
; dec ecx
|
||||||
jnz @b
|
; jnz @b
|
||||||
|
loop @b
|
||||||
@@:
|
@@:
|
||||||
; mov dword[points+ebx],-1
|
; mov dword[points+ebx],-1
|
||||||
push edi
|
push edi
|
||||||
@ -3227,14 +3274,17 @@ read_from_file:
|
|||||||
add dword[edi-8],ebp
|
add dword[edi-8],ebp
|
||||||
add dword[edi-4],ebp
|
add dword[edi-4],ebp
|
||||||
add esi,8
|
add esi,8
|
||||||
dec ecx
|
; dec ecx
|
||||||
jnz @b
|
; jnz @b
|
||||||
|
loop @b
|
||||||
add ebp,edx
|
add ebp,edx
|
||||||
jmp .find4k
|
jmp .find4k
|
||||||
mov eax,-1 ;<---mark if OK
|
mov eax,-1 ;<---mark if OK
|
||||||
.exit:
|
.exit:
|
||||||
mov dword[edi],-1
|
mov dword[edi],-1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
alloc_mem_for_tp:
|
alloc_mem_for_tp:
|
||||||
mov eax, 68
|
mov eax, 68
|
||||||
cmp [re_alloc_flag],1
|
cmp [re_alloc_flag],1
|
||||||
@ -3265,7 +3315,7 @@ alloc_mem_for_tp:
|
|||||||
|
|
||||||
mov eax, 68
|
mov eax, 68
|
||||||
mov ecx, [triangles_count_var]
|
mov ecx, [triangles_count_var]
|
||||||
lea ecx, [3+ecx*3]
|
lea ecx, [6+ecx*3]
|
||||||
shl ecx, 2
|
shl ecx, 2
|
||||||
mov edx,[triangles_normals_ptr]
|
mov edx,[triangles_normals_ptr]
|
||||||
int 0x40 ; -> allocate memory for triangles normals
|
int 0x40 ; -> allocate memory for triangles normals
|
||||||
@ -3274,7 +3324,7 @@ alloc_mem_for_tp:
|
|||||||
|
|
||||||
mov eax, 68
|
mov eax, 68
|
||||||
mov ecx, [points_count_var]
|
mov ecx, [points_count_var]
|
||||||
lea ecx,[3+ecx*3]
|
lea ecx,[6+ecx*3]
|
||||||
shl ecx, 2
|
shl ecx, 2
|
||||||
mov edx,[points_normals_ptr]
|
mov edx,[points_normals_ptr]
|
||||||
int 0x40
|
int 0x40
|
||||||
@ -3284,13 +3334,14 @@ alloc_mem_for_tp:
|
|||||||
mov eax, 68
|
mov eax, 68
|
||||||
; mov ebx, 12
|
; mov ebx, 12
|
||||||
mov ecx, [points_count_var]
|
mov ecx, [points_count_var]
|
||||||
lea ecx,[3+ecx*3]
|
lea ecx,[10+ecx*3]
|
||||||
shl ecx, 2
|
shl ecx, 2
|
||||||
mov edx,[points_normals_rot_ptr]
|
mov edx,[points_normals_rot_ptr]
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [points_normals_rot_ptr], eax
|
mov [points_normals_rot_ptr], eax
|
||||||
|
|
||||||
mov eax, 68
|
mov eax, 68
|
||||||
|
|
||||||
mov edx,[points_ptr]
|
mov edx,[points_ptr]
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [points_ptr], eax
|
mov [points_ptr], eax
|
||||||
@ -3304,13 +3355,14 @@ alloc_mem_for_tp:
|
|||||||
mov ebx, 12
|
mov ebx, 12
|
||||||
mov ecx, [points_count_var]
|
mov ecx, [points_count_var]
|
||||||
shl ecx,2
|
shl ecx,2
|
||||||
|
add ecx,32
|
||||||
mov edx,[tex_points_ptr]
|
mov edx,[tex_points_ptr]
|
||||||
int 0x40
|
int 0x40
|
||||||
mov [tex_points_ptr], eax
|
mov [tex_points_ptr], eax
|
||||||
|
|
||||||
mov eax, 68
|
mov eax, 68
|
||||||
mov ecx, [points_count_var]
|
mov ecx, [points_count_var]
|
||||||
inc ecx
|
add ecx,10
|
||||||
shl ecx, 3
|
shl ecx, 3
|
||||||
mov edx,[points_translated_ptr]
|
mov edx,[points_translated_ptr]
|
||||||
int 0x40
|
int 0x40
|
||||||
@ -3417,7 +3469,7 @@ write_info:
|
|||||||
mov bx,[size_x_var]
|
mov bx,[size_x_var]
|
||||||
shl ebx,16
|
shl ebx,16
|
||||||
add ebx,120*65536+70 ; [x start] *65536 + [y start]
|
add ebx,120*65536+70 ; [x start] *65536 + [y start]
|
||||||
mov ecx,30 shl 16 + 100
|
mov ecx,30 shl 16 + 150
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
int 0x40
|
int 0x40
|
||||||
|
|
||||||
@ -3467,7 +3519,7 @@ write_info:
|
|||||||
int 40h
|
int 40h
|
||||||
pop esi
|
pop esi
|
||||||
add esi,4
|
add esi,4
|
||||||
cmp esi,12
|
cmp esi,16
|
||||||
jnz .nxxx
|
jnz .nxxx
|
||||||
ret
|
ret
|
||||||
; *********************************************
|
; *********************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user