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 ------------------------
|
||||
|
||||
make_vector_r:
|
||||
if Ext < SSE2
|
||||
if Ext < SSE
|
||||
fninit
|
||||
fld dword[edi] ;edi+x3d
|
||||
fsub dword[esi] ;esi+x3d
|
||||
@ -297,6 +297,7 @@ cross_product:
|
||||
fstp dword [ebx+vec_z]
|
||||
ret
|
||||
cross_aligned:
|
||||
; params as above cross_p
|
||||
movaps xmm0,[esi]
|
||||
movaps xmm1,[esi]
|
||||
movaps xmm2,[edi]
|
||||
@ -607,6 +608,19 @@ ret
|
||||
;----------------------------------------------
|
||||
; esi - pointer to 3x3 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
|
||||
fld [rsscale]
|
||||
fld dword[esi] ;-----
|
||||
@ -639,14 +653,19 @@ add_scale_to_matrix:
|
||||
fld dword[esi+32]
|
||||
fmulp st1,st
|
||||
fstp dword[esi+32] ;------
|
||||
|
||||
end if
|
||||
ret
|
||||
|
||||
;in esi - offset to 3d points (point as 3 dwords float)
|
||||
; edi - offset to 2d points ( as 3 words integer)
|
||||
; ecx - number of points
|
||||
translate_points: ; just convert into integer; z coord still needed
|
||||
if Ext < SSE
|
||||
fninit
|
||||
else
|
||||
; movaps xmm1,[vect_x]
|
||||
end if
|
||||
|
||||
.again:
|
||||
if 0
|
||||
fld dword[esi+8]
|
||||
@ -676,7 +695,18 @@ translate_points: ; just convert into integer; z coord still needed
|
||||
fiadd [vect_y]
|
||||
fistp word[edi+2]
|
||||
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
|
||||
; packsdw xmm0,xmm0
|
||||
; movq [edi]
|
||||
@ -688,9 +718,12 @@ translate_points: ; just convert into integer; z coord still needed
|
||||
fistp word[edi+2]
|
||||
fld dword[esi+8]
|
||||
fistp word[edi+4]
|
||||
end if
|
||||
|
||||
add esi,12
|
||||
add edi,6
|
||||
dec ecx
|
||||
jnz .again
|
||||
; dec ecx
|
||||
; jnz .again
|
||||
loop .again
|
||||
|
||||
ret
|
||||
|
@ -341,7 +341,6 @@ end if
|
||||
pop ebp
|
||||
|
||||
ret
|
||||
align 16
|
||||
real_phong_line_z:
|
||||
; in:
|
||||
; xmm0 - normal vector 1
|
||||
@ -456,7 +455,7 @@ real_phong_line_z:
|
||||
sub ecx,.lx1
|
||||
movaps xmm0,.n1
|
||||
movss xmm2,.z1
|
||||
align 16
|
||||
|
||||
.ddraw:
|
||||
movss xmm7,xmm2
|
||||
cmpnltss xmm7,dword[esi]
|
||||
|
@ -353,7 +353,7 @@ end if
|
||||
|
||||
|
||||
ret
|
||||
align 16
|
||||
|
||||
ray_shd_l:
|
||||
; in:
|
||||
; xmm0 - normal vector 1
|
||||
@ -392,7 +392,7 @@ ray_shd_l:
|
||||
.dn equ [ebp-96]
|
||||
.dz equ [ebp-100]
|
||||
.y equ [ebp-104]
|
||||
; .cur_tri equ [ebp-108]
|
||||
.startx equ [ebp-108]
|
||||
.cnv equ [ebp-128]
|
||||
.Rlen equ [ebp-128-16]
|
||||
.r1 equ [ebp-128-32]
|
||||
@ -431,6 +431,7 @@ ray_shd_l:
|
||||
movaps .n1,xmm0
|
||||
movaps .n2,xmm1
|
||||
mov .lx1,eax
|
||||
; mov .startx,eax
|
||||
mov .lx2,ebx
|
||||
movlps .z1,xmm3
|
||||
|
||||
@ -546,9 +547,15 @@ end if
|
||||
mov edi,[triangles_ptr]
|
||||
xor ecx,ecx
|
||||
.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
|
||||
je .skipp
|
||||
@@:
|
||||
if 0
|
||||
mov edi,ecx
|
||||
imul edi,[i12]
|
||||
|
@ -16,22 +16,22 @@ stencil_tri:
|
||||
.y3 equ [ebp-12]
|
||||
|
||||
.dx12 equ dword[ebp-20]
|
||||
.dx13 equ dword[ebp-24]
|
||||
.dx23 equ dword[ebp-28]
|
||||
.dz12 equ dword[ebp-32]
|
||||
.dz13 equ dword[ebp-36]
|
||||
.dz12 equ dword[ebp-24]
|
||||
.dx13 equ dword[ebp-28]
|
||||
.dz13 equ dword[ebp-32]
|
||||
.dx23 equ dword[ebp-36]
|
||||
.dz23 equ dword[ebp-40]
|
||||
.zz2 equ [ebp-44]
|
||||
.zz1 equ [ebp-48]
|
||||
.z3 equ [ebp-56]
|
||||
.z2 equ [ebp-60]
|
||||
.z1 equ [ebp-64]
|
||||
.s_buff equ [ebp-68]
|
||||
;.s_buff equ [ebp-68]
|
||||
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
sub esp,128
|
||||
and ebp,0xfffffff0
|
||||
; sub esp,128
|
||||
; and ebp,0xfffffff0
|
||||
.sort2:
|
||||
cmp ax,bx
|
||||
jle .sort1
|
||||
@ -44,19 +44,24 @@ stencil_tri:
|
||||
shufps xmm0,xmm0,11011000b
|
||||
jmp .sort2
|
||||
.sort3:
|
||||
mov .y1,eax ; store triangle coordinates in user friendly variables
|
||||
mov .y2,ebx
|
||||
mov .y3,ecx
|
||||
; mov .y1,eax ; store triangle coordinates in user friendly variables
|
||||
; mov .y2,ebx
|
||||
; mov .y3,ecx
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
sub esp,60
|
||||
|
||||
|
||||
; mov edx,100.11
|
||||
; movd xmm0,edx
|
||||
; shufps xmm0,xmm0,11100000b
|
||||
|
||||
movaps .z1,xmm0
|
||||
movups .z1,xmm0
|
||||
; mov dword .z1,edx
|
||||
; mov .z2,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
|
||||
and edx,ebx ; if *all* of them are negative a sign flag is raised
|
||||
@ -157,7 +162,7 @@ stencil_tri:
|
||||
; mov edx,0.11
|
||||
; movd xmm0,edx
|
||||
; shufps xmm0,xmm0,11100000b
|
||||
mov esi,.s_buff
|
||||
; mov esi,.s_buff
|
||||
|
||||
call stencil_line
|
||||
|
||||
@ -192,7 +197,7 @@ stencil_tri:
|
||||
sar ebx,ROUND2
|
||||
sar eax,ROUND2
|
||||
movlps xmm0,.zz1
|
||||
mov esi,.s_buff
|
||||
; mov esi,.s_buff
|
||||
|
||||
|
||||
call stencil_line
|
||||
@ -215,7 +220,7 @@ stencil_tri:
|
||||
jl .loop2
|
||||
.loop2_end:
|
||||
|
||||
add esp,128
|
||||
mov esp,ebp
|
||||
pop ebp
|
||||
|
||||
ret
|
||||
@ -312,17 +317,19 @@ stencil_line:
|
||||
sub ecx,.x1
|
||||
movss xmm2,.z1 ; cz
|
||||
.ccalc:
|
||||
movss xmm1,xmm2
|
||||
cmpltss xmm1,dword[esi]
|
||||
movd eax,xmm1
|
||||
cmp eax,-1
|
||||
jnz @f
|
||||
; movss xmm1,xmm2
|
||||
; cmpltss xmm1,dword[esi]
|
||||
; movd eax,xmm1
|
||||
; cmp eax,-1
|
||||
comiss xmm2,[esi]
|
||||
ja @f
|
||||
movss dword[esi],xmm2
|
||||
@@:
|
||||
add esi,4
|
||||
addss xmm2,.dz
|
||||
sub ecx,1
|
||||
jnz .ccalc
|
||||
; sub ecx,1
|
||||
; jnz .ccalc
|
||||
loop .ccalc
|
||||
.l_quit:
|
||||
mov esp,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
|
||||
;--------------------------------------------------------------------
|
||||
|
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 ************************************
|
||||
if Ext > SSE2
|
||||
; if Ext > SSE2
|
||||
isSSE3 db 1
|
||||
end if
|
||||
; end if
|
||||
i3 dw 3
|
||||
i6 dd 6
|
||||
i12 dd 12
|
||||
@ -28,14 +28,15 @@
|
||||
y_offset dw SIZE_Y / 2
|
||||
z_offset dw 0
|
||||
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:
|
||||
xres_var dw SIZE_X
|
||||
; 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
|
||||
|
||||
angle_x dw 0
|
||||
angle_y dw 0
|
||||
@ -64,7 +65,7 @@
|
||||
screen_ptr dd 0
|
||||
Zbuffer_ptr dd 0
|
||||
vertices_index_ptr dd 0
|
||||
vertex_edit_no dw 0
|
||||
vertex_edit_no dd -1
|
||||
edit_start_x:
|
||||
dw 0
|
||||
edit_start_y dw 0
|
||||
@ -86,10 +87,11 @@
|
||||
|
||||
db 3
|
||||
db 'shd. model'
|
||||
max_dr_flg:
|
||||
if Ext >= SSE3
|
||||
max_dr_flg db 15
|
||||
db 15
|
||||
else
|
||||
db 12
|
||||
db 12
|
||||
end if
|
||||
dr_flag db 0 ; 6 - dots
|
||||
dd shd_f
|
||||
@ -290,6 +292,7 @@ flags: ; flags description
|
||||
db 'x+y '
|
||||
db ' x '
|
||||
db 'keys'
|
||||
|
||||
onoff_f:
|
||||
db 'off '
|
||||
db 'on '
|
||||
@ -354,7 +357,7 @@ base_vector:
|
||||
if Ext=SSE3
|
||||
db ' (SSE3)'
|
||||
end if
|
||||
db ' 0.075',0
|
||||
db ' 0.076',0
|
||||
labellen:
|
||||
STRdata db '-1 '
|
||||
lab_vert:
|
||||
@ -367,6 +370,9 @@ base_vector:
|
||||
db 'Edges count: '
|
||||
lab_ed_end:
|
||||
|
||||
db 'Chunks detected:'
|
||||
|
||||
|
||||
|
||||
all_lights_size dw lightsend-lights
|
||||
|
||||
@ -483,6 +489,17 @@ end if
|
||||
times 4 dd 1.0
|
||||
|
||||
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
|
||||
aprox dd 0.0001
|
||||
epsminus dd -0.0001
|
||||
@ -495,8 +512,8 @@ end if
|
||||
fsize dd 0 ;180000 ; sizeof(workarea)
|
||||
fptr dd 0 ;workarea
|
||||
file_name:
|
||||
db '/rd/1/3d/house.3ds',0
|
||||
; db '/tmp0/1/ant.3ds',0
|
||||
db '/rd/1/3d/house.3ds',0
|
||||
; db '/tmp0/1/sc.3ds',0
|
||||
|
||||
rb 256
|
||||
|
||||
@ -521,7 +538,9 @@ align 8
|
||||
points_count_var dd ? ;
|
||||
triangles_count_var dd ? ; dont change order
|
||||
edges_count dd ? ;
|
||||
chunks_number dd ?
|
||||
tex_points_ptr dd ?
|
||||
chunks_ptr dd ?
|
||||
|
||||
temp_col dw ?
|
||||
high dd ?
|
||||
|
@ -13,63 +13,55 @@ flat_triangle_z:
|
||||
; -------------------- stack : z coordinates
|
||||
; -------------------- Z-buffer : each z variable as dword
|
||||
; -------------------- (Z coor. as word) shl CATMULL_SHIFT
|
||||
.z1 equ word[ebp+4]
|
||||
.z2 equ word[ebp+6] ; each z coordinate as word integer
|
||||
.z3 equ word[ebp+8]
|
||||
.z1 equ word[ebp+4]
|
||||
.z2 equ word[ebp+6] ; each z coordinate as word integer
|
||||
.z3 equ word[ebp+8]
|
||||
|
||||
.col equ dword[ebp-4]
|
||||
.x1 equ word[ebp-6]
|
||||
.y1 equ word[ebp-8]
|
||||
.x2 equ word[ebp-10]
|
||||
.y2 equ word[ebp-12]
|
||||
.x3 equ word[ebp-14]
|
||||
.y3 equ word[ebp-16]
|
||||
.col equ dword[ebp-4]
|
||||
.x1 equ word[ebp-6]
|
||||
.y1 equ word[ebp-8]
|
||||
.x2 equ word[ebp-10]
|
||||
.y2 equ word[ebp-12]
|
||||
.x3 equ word[ebp-14]
|
||||
.y3 equ word[ebp-16]
|
||||
|
||||
.dx12 equ dword[ebp-20]
|
||||
;.dz12 equ dword[ebp-24]
|
||||
.dx13 equ dword[ebp-24]
|
||||
.dz13 equ dword[ebp-28]
|
||||
.dz12 equ dword[ebp-32]
|
||||
;.dz13 equ dword[ebp-32]
|
||||
.dx23 equ dword[ebp-36]
|
||||
.dz13M equ [ebp-40]
|
||||
.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
|
||||
.dx12 equ dword[ebp-20]
|
||||
.dz12 equ dword[ebp-24]
|
||||
.dx13 equ dword[ebp-28]
|
||||
.dz13 equ dword[ebp-32]
|
||||
.dx23 equ dword[ebp-36]
|
||||
.dz23 equ dword[ebp-40]
|
||||
.zz1 equ dword[ebp-44]
|
||||
.zz2 equ dword[ebp-48]
|
||||
|
||||
push edx ; store edx in variable .col
|
||||
mov ebp,esp
|
||||
|
||||
push edx ; store edx in variable .col
|
||||
.sort2:
|
||||
cmp ax,bx
|
||||
jle .sort1
|
||||
xchg eax,ebx
|
||||
mov dx,.z1
|
||||
xchg dx,.z2
|
||||
mov .z1,dx
|
||||
cmp ax,bx
|
||||
jle .sort1
|
||||
xchg eax,ebx
|
||||
mov dx,.z1
|
||||
xchg dx,.z2
|
||||
mov .z1,dx
|
||||
.sort1:
|
||||
cmp bx,cx
|
||||
jle .sort3
|
||||
xchg ebx,ecx
|
||||
mov dx,.z2
|
||||
xchg dx,.z3
|
||||
mov .z2,dx
|
||||
jmp .sort2
|
||||
cmp bx,cx
|
||||
jle .sort3
|
||||
xchg ebx,ecx
|
||||
mov dx,.z2
|
||||
xchg dx,.z3
|
||||
mov .z2,dx
|
||||
jmp .sort2
|
||||
.sort3:
|
||||
push eax ; store triangle coordinates in user friendly variables
|
||||
push ebx
|
||||
push ecx
|
||||
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,ecx
|
||||
and edx,eax
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .ft_loop2_end
|
||||
push eax ; store triangle coordinates in user friendly variables
|
||||
push ebx
|
||||
push ecx
|
||||
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,ecx
|
||||
and edx,eax
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .ft_loop2_end
|
||||
; cmp ax,SIZE_Y
|
||||
; jle @f
|
||||
; cmp bx,SIZE_Y
|
||||
@ -87,189 +79,167 @@ flat_triangle_z:
|
||||
; jle @f
|
||||
; jmp .ft_loop2_end
|
||||
;@@:
|
||||
sub esp,52-12
|
||||
; sub esp,52-12
|
||||
|
||||
mov bx,.y2 ; calc delta 12
|
||||
sub bx,.y1
|
||||
jnz .ft_dx12_make
|
||||
mov .dx12,0
|
||||
mov .dz12,0
|
||||
jmp .ft_dx12_done
|
||||
mov bx,.y2 ; calc delta 12
|
||||
sub bx,.y1
|
||||
jnz .ft_dx12_make
|
||||
push dword 0
|
||||
push dword 0
|
||||
jmp .ft_dx12_done
|
||||
.ft_dx12_make:
|
||||
mov ax,.x2
|
||||
sub ax,.x1
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov .dx12,eax
|
||||
mov ax,.x2
|
||||
sub ax,.x1
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
|
||||
mov ax,.z2
|
||||
sub ax,.z1
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
mov .dz12,eax
|
||||
mov ax,.z2
|
||||
sub ax,.z1
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
.ft_dx12_done:
|
||||
mov bx,.y3 ; calc delta 13
|
||||
sub bx,.y1
|
||||
jnz .ft_dx13_make
|
||||
mov .dx13,0
|
||||
mov .dz13,0
|
||||
mov dword .dz13M,0
|
||||
jmp .ft_dx13_done
|
||||
mov bx,.y3 ; calc delta 13
|
||||
sub bx,.y1
|
||||
jnz .ft_dx13_make
|
||||
push dword 0
|
||||
push dword 0
|
||||
jmp .ft_dx13_done
|
||||
.ft_dx13_make:
|
||||
mov ax,.x3
|
||||
sub ax,.x1
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov .dx13,eax
|
||||
mov ax,.x3
|
||||
sub ax,.x1
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
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:
|
||||
mov bx,.y3 ; calc delta 23
|
||||
sub bx,.y2
|
||||
jnz .gt_dx23_make
|
||||
mov .dx23,0
|
||||
mov .dz23,0
|
||||
jmp .gt_dx23_done
|
||||
; sub esp,48
|
||||
mov bx,.y3 ; calc delta 23
|
||||
sub bx,.y2
|
||||
jnz .gt_dx23_make
|
||||
push dword 0
|
||||
push dword 0
|
||||
; mov .dx23,0
|
||||
; mov .dz23,0
|
||||
jmp .gt_dx23_done
|
||||
.gt_dx23_make:
|
||||
mov ax,.x3
|
||||
sub ax,.x2
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov .dx23,eax
|
||||
mov ax,.x3
|
||||
sub ax,.x2
|
||||
cwde
|
||||
movsx ebx,bx
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
|
||||
mov ax,.z3
|
||||
sub ax,.z2
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
mov .dz23,eax
|
||||
mov ax,.z3
|
||||
sub ax,.z2
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
; mov .dz23,eax
|
||||
.gt_dx23_done:
|
||||
|
||||
movsx edx,.z1
|
||||
shl edx,CATMULL_SHIFT
|
||||
mov .zz1,edx
|
||||
mov .zz2,edx
|
||||
movsx eax,.x1
|
||||
shl eax,ROUND ; eax - x1
|
||||
mov ebx,eax ; ebx - x2
|
||||
;if Ext>=MMX
|
||||
; movq mm0,.zz2M
|
||||
;end if
|
||||
mov cx,.y1
|
||||
cmp cx,.y2
|
||||
jge .ft_loop1_end
|
||||
movsx edx,.z1
|
||||
shl edx,CATMULL_SHIFT
|
||||
push edx
|
||||
push edx
|
||||
|
||||
movsx eax,.x1
|
||||
shl eax,ROUND ; eax - x1
|
||||
mov ebx,eax ; ebx - x2
|
||||
mov cx,.y1
|
||||
cmp cx,.y2
|
||||
jge .ft_loop1_end
|
||||
.ft_loop1:
|
||||
|
||||
pushad
|
||||
pushad
|
||||
|
||||
push .col
|
||||
push cx ; y
|
||||
sar ebx,ROUND
|
||||
push bx ; x2
|
||||
sar eax,ROUND
|
||||
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
|
||||
push .col
|
||||
push cx ; y
|
||||
sar ebx,ROUND
|
||||
push bx ; x2
|
||||
sar eax,ROUND
|
||||
push ax ; x1
|
||||
push .zz2 ; z2 shl CATMULL_SHIFT
|
||||
push .zz1 ; z1 shl CATMULL_SHIFT
|
||||
|
||||
call flat_line_z
|
||||
|
||||
popad
|
||||
|
||||
add eax,.dx13
|
||||
add ebx,.dx12
|
||||
|
||||
mov edx,.dz13
|
||||
add .zz1,edx
|
||||
mov edx,.dz12
|
||||
add .zz2,edx
|
||||
;end if
|
||||
call flat_line_z
|
||||
|
||||
popad
|
||||
|
||||
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
|
||||
inc cx
|
||||
cmp cx,.y2
|
||||
jl .ft_loop1
|
||||
.ft_loop1_end:
|
||||
|
||||
movsx edx,.z2
|
||||
shl edx,CATMULL_SHIFT
|
||||
mov .zz2,edx
|
||||
movsx ebx,.x2
|
||||
shl ebx,ROUND
|
||||
;if Ext>=MMX
|
||||
; movq mm0,.zz2M
|
||||
;; push .dz13 ; exchange
|
||||
;; pop .dz12
|
||||
;; push .dz23 ; exchange
|
||||
;; pop .dz13
|
||||
;end if
|
||||
mov cx,.y2
|
||||
cmp cx,.y3
|
||||
jge .ft_loop2_end
|
||||
movsx edx,.z2
|
||||
shl edx,CATMULL_SHIFT
|
||||
mov .zz2,edx
|
||||
movsx ebx,.x2
|
||||
shl ebx,ROUND
|
||||
|
||||
mov cx,.y2
|
||||
cmp cx,.y3
|
||||
jge .ft_loop2_end
|
||||
.ft_loop2:
|
||||
pushad
|
||||
pushad
|
||||
|
||||
push .col
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
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
|
||||
push .col
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
push ax ; x1
|
||||
|
||||
popad
|
||||
push .zz2 ; z2 shl CATMULL_SHIFT
|
||||
push .zz1 ; z1 shl CATMULL_SHIFT
|
||||
|
||||
add eax,.dx13
|
||||
add ebx,.dx23
|
||||
;if Ext>=MMX
|
||||
; paddd mm0,.dz23M
|
||||
;else
|
||||
mov edx,.dz13
|
||||
add .zz1,edx
|
||||
mov edx,.dz23
|
||||
add .zz2,edx
|
||||
call flat_line_z
|
||||
|
||||
; mov edx,.dz13
|
||||
; add .zz1,edx
|
||||
; mov edx,.dz12
|
||||
; add .zz2,edx
|
||||
;end if
|
||||
inc cx
|
||||
cmp cx,.y3
|
||||
jl .ft_loop2
|
||||
popad
|
||||
|
||||
add eax,.dx13
|
||||
add ebx,.dx23
|
||||
|
||||
mov edx,.dz13
|
||||
add .zz1,edx
|
||||
mov edx,.dz23
|
||||
add .zz2,edx
|
||||
|
||||
inc cx
|
||||
cmp cx,.y3
|
||||
jl .ft_loop2
|
||||
.ft_loop2_end:
|
||||
|
||||
mov esp,ebp
|
||||
mov esp,ebp
|
||||
ret 6
|
||||
|
||||
flat_line_z:
|
||||
@ -286,16 +256,16 @@ flat_line_z:
|
||||
|
||||
.dz equ dword [ebp-4]
|
||||
|
||||
mov ebp,esp
|
||||
mov ebp,esp
|
||||
;; sub esp,4
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .fl_quit
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;[size_y_var]
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .fl_quit
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;[size_y_var]
|
||||
; cmp ax,SIZE_Y-1
|
||||
jg .fl_quit
|
||||
jg .fl_quit
|
||||
|
||||
; cmp .x1,0
|
||||
; jge .fl_ok1
|
||||
@ -307,91 +277,93 @@ flat_line_z:
|
||||
; cmp .x2,SIZE_X
|
||||
; jg .fl_quit
|
||||
; .fl_ok2:
|
||||
mov ax,.x1
|
||||
cmp ax,.x2
|
||||
je .fl_quit
|
||||
jl .fl_ok
|
||||
mov ax,.x1
|
||||
cmp ax,.x2
|
||||
je .fl_quit
|
||||
jl .fl_ok
|
||||
|
||||
xchg ax,.x2
|
||||
mov .x1,ax
|
||||
mov edx,.z1
|
||||
xchg edx,.z2
|
||||
mov .z1,edx
|
||||
xchg ax,.x2
|
||||
mov .x1,ax
|
||||
mov edx,.z1
|
||||
xchg edx,.z2
|
||||
mov .z1,edx
|
||||
.fl_ok:
|
||||
mov bx,[size_x_var]
|
||||
dec bx
|
||||
cmp .x1,bx ;SIZE_X-1
|
||||
jg .fl_quit
|
||||
cmp .x2,0
|
||||
jle .fl_quit
|
||||
mov bx,[size_x_var]
|
||||
dec bx
|
||||
cmp .x1,bx ;SIZE_X-1
|
||||
jg .fl_quit
|
||||
cmp .x2,0
|
||||
jle .fl_quit
|
||||
|
||||
mov eax,.z2
|
||||
sub eax,.z1
|
||||
mov eax,.z2
|
||||
sub eax,.z1
|
||||
cdq
|
||||
mov bx,.x2
|
||||
sub bx,.x1
|
||||
movsx ebx,bx
|
||||
idiv ebx
|
||||
mov bx,.x2
|
||||
sub bx,.x1
|
||||
movsx ebx,bx
|
||||
idiv ebx
|
||||
;; mov .dz,eax ; calculated delta - shifted .dz
|
||||
push eax
|
||||
push eax
|
||||
|
||||
cmp .x1,0
|
||||
jge @f
|
||||
movsx ebx,.x1
|
||||
neg ebx
|
||||
imul ebx
|
||||
add .z1,eax
|
||||
mov .x1,0
|
||||
cmp .x1,0
|
||||
jge @f
|
||||
movsx ebx,.x1
|
||||
neg ebx
|
||||
imul ebx
|
||||
add .z1,eax
|
||||
mov .x1,0
|
||||
@@:
|
||||
movzx edx,word[size_x_var]
|
||||
cmp .x2,dx ;[size_x_var] ;SIZE_X
|
||||
jl @f
|
||||
mov .x2,dx ;[size_x_var] ;SIZE_X
|
||||
movzx edx,word[size_x_var]
|
||||
cmp .x2,dx ;[size_x_var] ;SIZE_X
|
||||
jl @f
|
||||
mov .x2,dx ;[size_x_var] ;SIZE_X
|
||||
@@:
|
||||
; movzx edx,[size_x_var] ;SIZE_X
|
||||
movsx eax,.y
|
||||
mul edx ; edi = edi + (SIZE_X * y + x1)*3
|
||||
movsx edx,.x1
|
||||
add eax,edx
|
||||
push eax
|
||||
lea eax,[eax*3]
|
||||
add edi,eax ; esi = esi + (SIZE_X * y + x1)*4
|
||||
pop eax
|
||||
shl eax,2
|
||||
add esi,eax
|
||||
movsx eax,.y
|
||||
mul edx ; edi = edi + (SIZE_X * y + x1)*3
|
||||
movsx edx,.x1
|
||||
add eax,edx
|
||||
push eax
|
||||
lea eax,[eax*3]
|
||||
add edi,eax ; esi = esi + (SIZE_X * y + x1)*4
|
||||
pop eax
|
||||
shl eax,2
|
||||
add esi,eax
|
||||
|
||||
mov cx,.x2
|
||||
sub cx,.x1
|
||||
movzx ecx,cx
|
||||
mov cx,.x2
|
||||
sub cx,.x1
|
||||
movzx ecx,cx
|
||||
|
||||
mov eax,.col
|
||||
mov ebx,.z1 ; ebx : curr. z
|
||||
mov edx,.dz
|
||||
dec ecx
|
||||
jecxz .draw_last
|
||||
mov eax,.col
|
||||
mov ebx,.z1 ; ebx : curr. z
|
||||
mov edx,.dz
|
||||
dec ecx
|
||||
jecxz .draw_last
|
||||
.ddraw:
|
||||
cmp ebx,dword[esi]
|
||||
; cmovl [edi],eax
|
||||
; cmovl [esi],ebx
|
||||
jge @f
|
||||
stosd
|
||||
dec edi
|
||||
mov dword[esi],ebx
|
||||
jmp .no_skip
|
||||
cmp ebx,dword[esi]
|
||||
; cmovl [edi],eax
|
||||
; cmovl [esi],ebx
|
||||
jge @f
|
||||
mov [edi],eax
|
||||
mov [esi],ebx
|
||||
; stosd ; less branches
|
||||
; dec edi
|
||||
; mov dword[esi],ebx
|
||||
; jmp .no_skip
|
||||
@@:
|
||||
add edi,3
|
||||
.no_skip:
|
||||
add esi,4
|
||||
add ebx,edx
|
||||
loop .ddraw
|
||||
add edi,3
|
||||
; .no_skip:
|
||||
add esi,4
|
||||
add ebx,edx
|
||||
loop .ddraw
|
||||
|
||||
.draw_last:
|
||||
cmp ebx,dword[esi]
|
||||
jge .fl_quit
|
||||
cmp ebx,dword[esi]
|
||||
jge .fl_quit
|
||||
stosw
|
||||
shr eax,16
|
||||
shr eax,16
|
||||
stosb
|
||||
mov dword[esi],ebx
|
||||
mov dword[esi],ebx
|
||||
|
||||
.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
|
||||
1. I introduced procedure for searching nonredundand 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.
|
||||
|
||||
What's new?
|
||||
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).
|
||||
1. Detecting manifold chunks procedure based on kind of sorted pivot
|
||||
table. Chunks are counted and this number displayed.
|
||||
2. New calculating normal vectors proc that use some data produced
|
||||
by new chunks routine. Now big object loading is fast. I load object that
|
||||
contains ~500000 vertices, ~700000 faces and ~2000 0000 unique edges
|
||||
in few seconds on i5 2cond gen. Earlier such objects calculating was
|
||||
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:
|
||||
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
|
||||
environment mapping, bump (bump mapping), tex (texture mapping),
|
||||
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
|
||||
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_x3 equ ebp+12
|
||||
.tex_y3 equ ebp+14
|
||||
.z1 equ word[ebp+16]
|
||||
.z2 equ word[ebp+18]
|
||||
.z3 equ word[ebp+20]
|
||||
.z1 equ word[ebp+16]
|
||||
.z2 equ word[ebp+18]
|
||||
.z3 equ word[ebp+20]
|
||||
|
||||
.tex_ptr equ dword[ebp-4] ; pointer to texture
|
||||
.z_ptr equ dword[ebp-8] ; pointer to z-buffer
|
||||
.x1 equ word[ebp-10]
|
||||
.y1 equ word[ebp-12]
|
||||
.x2 equ word[ebp-14]
|
||||
.y2 equ word[ebp-16]
|
||||
.x3 equ word[ebp-18]
|
||||
.y3 equ word[ebp-20]
|
||||
.tex_ptr equ dword[ebp-4] ; pointer to texture
|
||||
.z_ptr equ dword[ebp-8] ; pointer to z-buffer
|
||||
.x1 equ word[ebp-10]
|
||||
.y1 equ word[ebp-12]
|
||||
.x2 equ word[ebp-14]
|
||||
.y2 equ word[ebp-16]
|
||||
.x3 equ word[ebp-18]
|
||||
.y3 equ word[ebp-20]
|
||||
|
||||
.dx12 equ dword[ebp-24]
|
||||
.dx12 equ dword[ebp-24]
|
||||
.tex_dx12 equ dword[ebp-28]
|
||||
.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_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_dy23 equ dword[ebp-64]
|
||||
.dz23 equ dword[ebp-68]
|
||||
.dz23 equ dword[ebp-68]
|
||||
|
||||
.scan_x1 equ dword[ebp-72]
|
||||
.scan_x2 equ dword[ebp-76]
|
||||
.scan_y1 equ dword[ebp-80]
|
||||
.scan_y2 equ dword[ebp-84]
|
||||
.cz1 equ dword[ebp-88]
|
||||
.cz2 equ dword[ebp-92]
|
||||
.cz1 equ dword[ebp-88]
|
||||
.cz2 equ dword[ebp-92]
|
||||
|
||||
mov ebp,esp
|
||||
push esi ; store memory pointers
|
||||
push edx
|
||||
mov ebp,esp
|
||||
push esi ; store memory pointers
|
||||
push edx
|
||||
.tt_sort3:
|
||||
cmp ax,bx ;sort all parameters
|
||||
jle .tt_sort1
|
||||
xchg eax,ebx
|
||||
mov edx,dword [.tex_x1]
|
||||
xchg edx,dword [.tex_x2]
|
||||
mov dword[.tex_x1],edx
|
||||
mov dx,.z1
|
||||
xchg dx,.z2
|
||||
mov .z1,dx
|
||||
cmp ax,bx ;sort all parameters
|
||||
jle .tt_sort1
|
||||
xchg eax,ebx
|
||||
mov edx,dword [.tex_x1]
|
||||
xchg edx,dword [.tex_x2]
|
||||
mov dword[.tex_x1],edx
|
||||
mov dx,.z1
|
||||
xchg dx,.z2
|
||||
mov .z1,dx
|
||||
.tt_sort1:
|
||||
cmp bx,cx
|
||||
jle .tt_sort2
|
||||
xchg ebx,ecx
|
||||
mov edx,dword [.tex_x2]
|
||||
xchg edx,dword [.tex_x3]
|
||||
mov dword [.tex_x2],edx
|
||||
mov dx,.z2
|
||||
xchg dx,.z3
|
||||
mov .z2,dx
|
||||
jmp .tt_sort3
|
||||
cmp bx,cx
|
||||
jle .tt_sort2
|
||||
xchg ebx,ecx
|
||||
mov edx,dword [.tex_x2]
|
||||
xchg edx,dword [.tex_x3]
|
||||
mov dword [.tex_x2],edx
|
||||
mov dx,.z2
|
||||
xchg dx,.z3
|
||||
mov .z2,dx
|
||||
jmp .tt_sort3
|
||||
.tt_sort2:
|
||||
|
||||
push eax ; and store to user friendly variables
|
||||
push ebx
|
||||
push ecx
|
||||
push eax ; and store to user friendly variables
|
||||
push ebx
|
||||
push ecx
|
||||
|
||||
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,ecx
|
||||
and edx,eax
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .tt_loop2_end
|
||||
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,ecx
|
||||
and edx,eax
|
||||
test edx,80008000h ; Check both X&Y at once
|
||||
jne .tt_loop2_end
|
||||
; cmp ax,SIZE_Y
|
||||
; jl @f
|
||||
; cmp bx,SIZE_Y
|
||||
; jl @f
|
||||
; cmp cx,SIZE_Y
|
||||
; jl @f
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
ror ecx,16
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
ror ecx,16
|
||||
; cmp ax,SIZE_X
|
||||
; jl @f
|
||||
; cmp bx,SIZE_X
|
||||
@ -112,301 +112,301 @@ tex_triangle_z:
|
||||
; jl @f
|
||||
; jmp .tt_loop2_end
|
||||
@@:
|
||||
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
|
||||
mov ebx,dword[.tex_x2]
|
||||
mov ecx,dword[.tex_x3]
|
||||
mov edx,eax
|
||||
or edx,ebx
|
||||
or edx,ecx
|
||||
test edx,80008000h
|
||||
jne .tt_loop2_end
|
||||
cmp ax,TEX_X
|
||||
jge .tt_loop2_end
|
||||
cmp bx,TEX_X
|
||||
jge .tt_loop2_end
|
||||
cmp cx,TEX_X
|
||||
jge .tt_loop2_end
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
ror ecx,16
|
||||
cmp ax,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
cmp bx,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
cmp cx,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
mov eax,dword[.tex_x1] ; texture coords must be in [0..TEX_X(Y)]
|
||||
mov ebx,dword[.tex_x2]
|
||||
mov ecx,dword[.tex_x3]
|
||||
mov edx,eax
|
||||
or edx,ebx
|
||||
or edx,ecx
|
||||
test edx,80008000h
|
||||
jne .tt_loop2_end
|
||||
cmp ax,TEX_X
|
||||
jge .tt_loop2_end
|
||||
cmp bx,TEX_X
|
||||
jge .tt_loop2_end
|
||||
cmp cx,TEX_X
|
||||
jge .tt_loop2_end
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
ror ecx,16
|
||||
cmp ax,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
cmp bx,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
cmp cx,TEX_Y
|
||||
jge .tt_loop2_end
|
||||
|
||||
|
||||
movsx ebx,.y2 ; calc delta
|
||||
sub bx,.y1
|
||||
jnz .tt_dx12_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
movsx ebx,.y2 ; calc delta
|
||||
sub bx,.y1
|
||||
jnz .tt_dx12_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
@@:
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx12_done
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx12_done
|
||||
.tt_dx12_make:
|
||||
mov ax,.x2
|
||||
sub ax,.x1
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,.x2
|
||||
sub ax,.x1
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov .dx12,eax ; dx12 = (x2-x1)/(y2-y1)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_x2]
|
||||
sub ax,word[.tex_x1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_x2]
|
||||
sub ax,word[.tex_x1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dx12],eax ; tex_dx12 = (tex_x2-tex_x1)/(y2-y1)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_y2]
|
||||
sub ax,word[.tex_y1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_y2]
|
||||
sub ax,word[.tex_y1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dy12],eax ; tex_dy12 = (tex_y2-tex_y1)/(y2-y1)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,.z2
|
||||
sub ax,.z1
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
mov ax,.z2
|
||||
sub ax,.z1
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
.tt_dx12_done:
|
||||
|
||||
movsx ebx,.y3 ; calc delta
|
||||
sub bx,.y1
|
||||
jnz .tt_dx13_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
movsx ebx,.y3 ; calc delta
|
||||
sub bx,.y1
|
||||
jnz .tt_dx13_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
@@:
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx13_done
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx13_done
|
||||
.tt_dx13_make:
|
||||
mov ax,.x3
|
||||
sub ax,.x1
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,.x3
|
||||
sub ax,.x1
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov .dx12,eax ; dx13 = (x3-x1)/(y3-y1)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_x3]
|
||||
sub ax,word[.tex_x1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_x3]
|
||||
sub ax,word[.tex_x1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dx12],eax ; tex_dx13 = (tex_x3-tex_x1)/(y3-y1)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_y3]
|
||||
sub ax,word[.tex_y1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_y3]
|
||||
sub ax,word[.tex_y1]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dy12],eax ; tex_dy13 = (tex_y3-tex_y1)/(y3-y1)
|
||||
push 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
|
||||
push eax
|
||||
.tt_dx13_done:
|
||||
|
||||
mov bx,.y3 ; calc delta
|
||||
sub bx,.y2
|
||||
jnz .tt_dx23_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
mov bx,.y3 ; calc delta
|
||||
sub bx,.y2
|
||||
jnz .tt_dx23_make
|
||||
xor edx,edx
|
||||
mov ecx,4
|
||||
@@:
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx23_done
|
||||
push edx
|
||||
loop @b
|
||||
jmp .tt_dx23_done
|
||||
.tt_dx23_make:
|
||||
mov ax,.x3
|
||||
sub ax,.x2
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
movzx ebx,bx
|
||||
idiv ebx
|
||||
mov ax,.x3
|
||||
sub ax,.x2
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
movzx ebx,bx
|
||||
idiv ebx
|
||||
; mov .dx23,eax ; dx23 = (x3-x2)/(y3-y2)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_x3]
|
||||
sub ax,word[.tex_x2]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_x3]
|
||||
sub ax,word[.tex_x2]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dx23],eax ; tex_dx23 = (tex_x3-tex_x2)/(y3-y2)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,word[.tex_y3]
|
||||
sub ax,word[.tex_y2]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
mov ax,word[.tex_y3]
|
||||
sub ax,word[.tex_y2]
|
||||
cwde
|
||||
shl eax,ROUND
|
||||
cdq
|
||||
idiv ebx
|
||||
; mov [.tex_dy23],eax ; tex_dy23 = (tex_y3-tex_y2)/(y3-y2)
|
||||
push eax
|
||||
push eax
|
||||
|
||||
mov ax,.z3
|
||||
sub ax,.z2
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
mov ax,.z3
|
||||
sub ax,.z2
|
||||
cwde
|
||||
shl eax,CATMULL_SHIFT
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
.tt_dx23_done:
|
||||
|
||||
movsx eax,.x1 ;eax - cur x1
|
||||
shl eax,ROUND ;ebx - cur x2
|
||||
mov ebx,eax
|
||||
movsx eax,.x1 ;eax - cur x1
|
||||
shl eax,ROUND ;ebx - cur x2
|
||||
mov ebx,eax
|
||||
|
||||
movsx edx, word[.tex_x1]
|
||||
shl edx,ROUND
|
||||
movsx edx, word[.tex_x1]
|
||||
shl edx,ROUND
|
||||
; mov [.scan_x1],edx
|
||||
; mov [.scan_x2],edx
|
||||
push edx
|
||||
push edx
|
||||
movsx edx, word[.tex_y1]
|
||||
shl edx,ROUND
|
||||
push edx
|
||||
push edx
|
||||
movsx edx, word[.tex_y1]
|
||||
shl edx,ROUND
|
||||
; mov [.scan_y1],edx
|
||||
; mov [.scan_y2],edx
|
||||
push edx
|
||||
push edx
|
||||
movsx edx,.z1
|
||||
shl edx,CATMULL_SHIFT
|
||||
push edx
|
||||
push edx
|
||||
mov cx,.y1
|
||||
cmp cx,.y2
|
||||
jge .tt_loop1_end
|
||||
push edx
|
||||
push edx
|
||||
movsx edx,.z1
|
||||
shl edx,CATMULL_SHIFT
|
||||
push edx
|
||||
push edx
|
||||
mov cx,.y1
|
||||
cmp cx,.y2
|
||||
jge .tt_loop1_end
|
||||
|
||||
.tt_loop1:
|
||||
pushad
|
||||
pushad
|
||||
|
||||
push .z_ptr
|
||||
push .cz1 ; z coords shifted shl catmull_shift
|
||||
push .cz2
|
||||
push .scan_y2
|
||||
push .scan_x2
|
||||
push .scan_y1
|
||||
push .scan_x1
|
||||
push esi ;[.tex_ptr]
|
||||
push .z_ptr
|
||||
push .cz1 ; z coords shifted shl catmull_shift
|
||||
push .cz2
|
||||
push .scan_y2
|
||||
push .scan_x2
|
||||
push .scan_y1
|
||||
push .scan_x1
|
||||
push esi ;[.tex_ptr]
|
||||
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
push ax
|
||||
call textured_line_z
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
push ax
|
||||
call textured_line_z
|
||||
|
||||
popad
|
||||
mov edx,.dz13
|
||||
add .cz1,edx
|
||||
mov edx,.dz12
|
||||
add .cz2,edx
|
||||
popad
|
||||
mov edx,.dz13
|
||||
add .cz1,edx
|
||||
mov edx,.dz12
|
||||
add .cz2,edx
|
||||
|
||||
mov edx, .tex_dx13
|
||||
add .scan_x1, edx
|
||||
mov edx, .tex_dx12
|
||||
add .scan_x2, edx
|
||||
mov edx, .tex_dy13
|
||||
add .scan_y1, edx
|
||||
mov edx, .tex_dy12
|
||||
add .scan_y2, edx
|
||||
mov edx, .tex_dx13
|
||||
add .scan_x1, edx
|
||||
mov edx, .tex_dx12
|
||||
add .scan_x2, edx
|
||||
mov edx, .tex_dy13
|
||||
add .scan_y1, edx
|
||||
mov edx, .tex_dy12
|
||||
add .scan_y2, edx
|
||||
|
||||
add eax, .dx13
|
||||
add ebx, .dx12
|
||||
inc cx
|
||||
cmp cx,.y2
|
||||
jl .tt_loop1
|
||||
add eax, .dx13
|
||||
add ebx, .dx12
|
||||
inc cx
|
||||
cmp cx,.y2
|
||||
jl .tt_loop1
|
||||
|
||||
.tt_loop1_end:
|
||||
|
||||
|
||||
mov cx,.y2
|
||||
cmp cx,.y3
|
||||
jge .tt_loop2_end
|
||||
mov cx,.y2
|
||||
cmp cx,.y3
|
||||
jge .tt_loop2_end
|
||||
|
||||
movsx ebx,.x2
|
||||
shl ebx,ROUND
|
||||
movsx edx,.z2
|
||||
shl edx,CATMULL_SHIFT
|
||||
mov .cz2,edx
|
||||
movzx edx, word [.tex_x2]
|
||||
shl edx,ROUND
|
||||
mov .scan_x2,edx
|
||||
movzx edx, word[.tex_y2]
|
||||
shl edx,ROUND
|
||||
mov .scan_y2,edx
|
||||
movsx ebx,.x2
|
||||
shl ebx,ROUND
|
||||
movsx edx,.z2
|
||||
shl edx,CATMULL_SHIFT
|
||||
mov .cz2,edx
|
||||
movzx edx, word [.tex_x2]
|
||||
shl edx,ROUND
|
||||
mov .scan_x2,edx
|
||||
movzx edx, word[.tex_y2]
|
||||
shl edx,ROUND
|
||||
mov .scan_y2,edx
|
||||
|
||||
.tt_loop2:
|
||||
|
||||
pushad
|
||||
pushad
|
||||
|
||||
push .z_ptr
|
||||
push .cz1 ; z coords shifted shl catmull_shift
|
||||
push .cz2
|
||||
push .z_ptr
|
||||
push .cz1 ; z coords shifted shl catmull_shift
|
||||
push .cz2
|
||||
|
||||
push .scan_y2
|
||||
push .scan_x2
|
||||
push .scan_y1
|
||||
push .scan_x1
|
||||
push esi ;[.tex_ptr]
|
||||
push .scan_y2
|
||||
push .scan_x2
|
||||
push .scan_y1
|
||||
push .scan_x1
|
||||
push esi ;[.tex_ptr]
|
||||
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
push ax
|
||||
call textured_line_z
|
||||
push cx
|
||||
sar ebx,ROUND
|
||||
push bx
|
||||
sar eax,ROUND
|
||||
push ax
|
||||
call textured_line_z
|
||||
|
||||
popad
|
||||
popad
|
||||
|
||||
|
||||
mov edx,.dz13
|
||||
add .cz1,edx
|
||||
mov edx,.dz23
|
||||
add .cz2,edx
|
||||
mov edx,.dz13
|
||||
add .cz1,edx
|
||||
mov edx,.dz23
|
||||
add .cz2,edx
|
||||
|
||||
mov edx, .tex_dx13
|
||||
add .scan_x1, edx
|
||||
mov edx, .tex_dx23
|
||||
add .scan_x2, edx
|
||||
mov edx, .tex_dy13
|
||||
add .scan_y1, edx
|
||||
mov edx, .tex_dy23
|
||||
add .scan_y2, edx
|
||||
mov edx, .tex_dx13
|
||||
add .scan_x1, edx
|
||||
mov edx, .tex_dx23
|
||||
add .scan_x2, edx
|
||||
mov edx, .tex_dy13
|
||||
add .scan_y1, edx
|
||||
mov edx, .tex_dy23
|
||||
add .scan_y2, edx
|
||||
|
||||
add eax, .dx13
|
||||
add ebx, .dx23
|
||||
inc cx
|
||||
cmp cx,.y3
|
||||
jl .tt_loop2
|
||||
add eax, .dx13
|
||||
add ebx, .dx23
|
||||
inc cx
|
||||
cmp cx,.y3
|
||||
jl .tt_loop2
|
||||
|
||||
.tt_loop2_end:
|
||||
|
||||
.tt_end:
|
||||
mov esp,ebp
|
||||
mov esp,ebp
|
||||
ret 18
|
||||
|
||||
textured_line_z:
|
||||
@ -421,126 +421,130 @@ textured_line_z:
|
||||
.tex_y1 equ ebp+18
|
||||
.tex_x2 equ ebp+22
|
||||
.tex_y2 equ ebp+26
|
||||
.z2 equ dword [ebp+30] ;z1, z2 coords shifted shl CATMULL_SHIFT
|
||||
.z1 equ dword [ebp+34]
|
||||
.z2 equ dword [ebp+30] ;z1, z2 coords shifted shl CATMULL_SHIFT
|
||||
.z1 equ dword [ebp+34]
|
||||
.z_ptr equ dword [ebp+38]
|
||||
|
||||
.tex_dy equ dword [ebp-4]
|
||||
.tex_dx equ dword [ebp-8]
|
||||
.dz equ dword [ebp-12]
|
||||
.cz equ dword [ebp-16]
|
||||
.dz equ dword [ebp-12]
|
||||
.cz equ dword [ebp-16]
|
||||
.c_tex_x equ dword [ebp-20] ; current tex x
|
||||
.m_sft1 equ ebp-28
|
||||
.m_sft2 equ ebp-32
|
||||
; .c_tex_xM equ ebp+14
|
||||
.tex_dxM equ ebp-8
|
||||
|
||||
mov ebp,esp
|
||||
mov ebp,esp
|
||||
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .tl_quit
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;SIZE_Y
|
||||
jge .tl_quit
|
||||
mov ax,.y
|
||||
or ax,ax
|
||||
jl .tl_quit
|
||||
mov bx,[size_y_var]
|
||||
dec bx
|
||||
cmp ax,bx ;SIZE_Y
|
||||
jge .tl_quit
|
||||
|
||||
mov ax,.x1
|
||||
cmp ax,.x2
|
||||
je .tl_quit
|
||||
jl .tl_ok
|
||||
mov ax,.x1
|
||||
cmp ax,.x2
|
||||
je .tl_quit
|
||||
jl .tl_ok
|
||||
|
||||
xchg ax,.x2 ; sort params
|
||||
mov .x1,ax
|
||||
if Ext >= MMX
|
||||
movq mm0,[.tex_x1]
|
||||
movq mm1,[.tex_x2]
|
||||
movq [.tex_x2],mm0
|
||||
movq [.tex_x1],mm1
|
||||
xchg ax,.x2 ; sort params
|
||||
mov .x1,ax
|
||||
if Ext >= SSE2
|
||||
movdqu xmm0,[.tex_x1]
|
||||
pshufd xmm0,xmm0,01001110b
|
||||
movdqu [.tex_x1],xmm0
|
||||
else if Ext >= MMX
|
||||
movq mm0,[.tex_x1]
|
||||
movq mm1,[.tex_x2]
|
||||
movq [.tex_x2],mm0
|
||||
movq [.tex_x1],mm1
|
||||
|
||||
else
|
||||
mov eax,dword[.tex_x1]
|
||||
xchg eax,dword[.tex_x2]
|
||||
mov dword[.tex_x1],eax
|
||||
mov eax,dword[.tex_x1]
|
||||
xchg eax,dword[.tex_x2]
|
||||
mov dword[.tex_x1],eax
|
||||
|
||||
mov eax,dword[.tex_y1]
|
||||
xchg eax,dword[.tex_y2]
|
||||
mov dword[.tex_y1],eax
|
||||
mov eax,dword[.tex_y1]
|
||||
xchg eax,dword[.tex_y2]
|
||||
mov dword[.tex_y1],eax
|
||||
|
||||
end if
|
||||
|
||||
mov eax,.z1
|
||||
xchg eax,.z2
|
||||
mov .z1,eax
|
||||
mov eax,.z1
|
||||
xchg eax,.z2
|
||||
mov .z1,eax
|
||||
|
||||
.tl_ok:
|
||||
mov cx,[size_x_var]
|
||||
dec cx
|
||||
cmp .x1,cx ;SIZE_X
|
||||
jge .tl_quit
|
||||
cmp .x2,0
|
||||
jle .tl_quit
|
||||
mov cx,[size_x_var]
|
||||
dec cx
|
||||
cmp .x1,cx ;SIZE_X
|
||||
jge .tl_quit
|
||||
cmp .x2,0
|
||||
jle .tl_quit
|
||||
|
||||
mov bx,.x2
|
||||
sub bx,.x1
|
||||
movsx ebx,bx
|
||||
mov bx,.x2
|
||||
sub bx,.x1
|
||||
movsx ebx,bx
|
||||
|
||||
mov eax,dword[.tex_y2] ; calc .dty
|
||||
sub eax,dword[.tex_y1]
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
mov eax,dword[.tex_y2] ; calc .dty
|
||||
sub eax,dword[.tex_y1]
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
|
||||
mov eax,dword[.tex_x2] ; calc .dtx
|
||||
sub eax,dword[.tex_x1]
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
mov eax,dword[.tex_x2] ; calc .dtx
|
||||
sub eax,dword[.tex_x1]
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
|
||||
mov eax,.z2 ; calc .dz
|
||||
sub eax,.z1
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
mov eax,.z2 ; calc .dz
|
||||
sub eax,.z1
|
||||
cdq
|
||||
idiv ebx
|
||||
push eax
|
||||
|
||||
cmp .x1,0 ; clipping
|
||||
jg @f
|
||||
cmp .x1,0 ; clipping
|
||||
jg @f
|
||||
|
||||
movsx ebx,.x1
|
||||
neg ebx
|
||||
imul ebx ; eax = .dz * abs(.x1)
|
||||
add .z1,eax
|
||||
mov .x1,0
|
||||
movsx ebx,.x1
|
||||
neg ebx
|
||||
imul ebx ; eax = .dz * abs(.x1)
|
||||
add .z1,eax
|
||||
mov .x1,0
|
||||
|
||||
mov eax,.tex_dy
|
||||
imul ebx
|
||||
add dword[.tex_y1],eax
|
||||
mov eax,.tex_dy
|
||||
imul ebx
|
||||
add dword[.tex_y1],eax
|
||||
|
||||
mov eax,.tex_dx
|
||||
imul ebx
|
||||
add dword[.tex_x1],eax
|
||||
mov eax,.tex_dx
|
||||
imul ebx
|
||||
add dword[.tex_x1],eax
|
||||
|
||||
@@:
|
||||
cmp .x2,cx ;SIZE_X
|
||||
jl @f
|
||||
mov .x2,cx ;SIZE_X
|
||||
cmp .x2,cx ;SIZE_X
|
||||
jl @f
|
||||
mov .x2,cx ;SIZE_X
|
||||
@@:
|
||||
|
||||
movsx ebx,.y ; calc mem begin in buffers
|
||||
movzx eax,word[size_x_var] ;SIZE_X
|
||||
mul ebx
|
||||
movsx ebx,.x1
|
||||
add eax,ebx
|
||||
mov ebx,eax
|
||||
movsx ebx,.y ; calc mem begin in buffers
|
||||
movzx eax,word[size_x_var] ;SIZE_X
|
||||
mul ebx
|
||||
movsx ebx,.x1
|
||||
add eax,ebx
|
||||
mov ebx,eax
|
||||
|
||||
lea eax,[eax*3]
|
||||
add edi,eax ; edi - scr buff
|
||||
shl ebx,2
|
||||
add .z_ptr,ebx ; z buffer pointer
|
||||
lea eax,[eax*3]
|
||||
add edi,eax ; edi - scr buff
|
||||
shl ebx,2
|
||||
add .z_ptr,ebx ; z buffer pointer
|
||||
|
||||
mov cx,.x2
|
||||
sub cx,.x1
|
||||
movzx ecx,cx
|
||||
mov cx,.x2
|
||||
sub cx,.x1
|
||||
movzx ecx,cx
|
||||
|
||||
;if Ext >= MMX
|
||||
; movq mm0,[.tex_x1]
|
||||
@ -549,12 +553,12 @@ end if
|
||||
; mov ebx,.z1
|
||||
; mov eax,.dz
|
||||
;else
|
||||
mov eax,dword[.tex_x1]
|
||||
mov ebx,dword[.tex_y1]
|
||||
push .z1 ; .cz
|
||||
push eax ;.c_tex_x
|
||||
mov eax,dword[.tex_x1]
|
||||
mov ebx,dword[.tex_y1]
|
||||
push .z1 ; .cz
|
||||
push eax ;.c_tex_x
|
||||
;end if
|
||||
mov edx,.z_ptr
|
||||
mov edx,.z_ptr
|
||||
|
||||
.tl_loop:
|
||||
|
||||
@ -569,43 +573,43 @@ end if
|
||||
; movd esi,mm3
|
||||
; mov dword[edx],ebx ; renew z buffer
|
||||
;else
|
||||
; eax - temp
|
||||
mov eax,.cz ; ebx - cur tex y shl ROUND
|
||||
cmp eax,[edx] ; ecx - l.lenght
|
||||
jge @f ; ebx - cur tex_y ; edx - temp
|
||||
mov esi,ebx ; edi - scr buff
|
||||
sar esi,ROUND ; esi - tex_ptr temp
|
||||
shl esi,TEX_SHIFT ; .z_ptr - cur pointer to z buff
|
||||
mov eax,.c_tex_x ; .cz - cur z coord shl CATMULL_SHIFT
|
||||
sar eax,ROUND
|
||||
add esi,eax
|
||||
mov eax,.cz
|
||||
mov dword[edx],eax ; renew z buffer
|
||||
; eax - temp
|
||||
mov eax,.cz ; ebx - cur tex y shl ROUND
|
||||
cmp eax,[edx] ; ecx - l.lenght
|
||||
jge @f ; ebx - cur tex_y ; edx - temp
|
||||
mov esi,ebx ; edi - scr buff
|
||||
sar esi,ROUND ; esi - tex_ptr temp
|
||||
shl esi,TEX_SHIFT ; .z_ptr - cur pointer to z buff
|
||||
mov eax,.c_tex_x ; .cz - cur z coord shl CATMULL_SHIFT
|
||||
sar eax,ROUND
|
||||
add esi,eax
|
||||
mov eax,.cz
|
||||
mov dword[edx],eax ; renew z buffer
|
||||
;end if
|
||||
and esi,TEXTURE_SIZE
|
||||
lea esi,[esi*3]
|
||||
add esi,.tex_ptr
|
||||
movsd
|
||||
dec edi
|
||||
jmp .no_skip
|
||||
and esi,TEXTURE_SIZE
|
||||
lea esi,[esi*3]
|
||||
add esi,.tex_ptr
|
||||
movsd
|
||||
dec edi
|
||||
jmp .no_skip
|
||||
@@:
|
||||
add edi,3
|
||||
add edi,3
|
||||
.no_skip:
|
||||
add edx,4
|
||||
add edx,4
|
||||
;if Ext >= MMX
|
||||
; add ebx,eax
|
||||
; paddd mm0,mm1
|
||||
;else
|
||||
mov eax,.dz
|
||||
add .cz,eax
|
||||
mov eax,.tex_dx
|
||||
add .c_tex_x,eax
|
||||
add ebx,.tex_dy
|
||||
mov eax,.dz
|
||||
add .cz,eax
|
||||
mov eax,.tex_dx
|
||||
add .c_tex_x,eax
|
||||
add ebx,.tex_dy
|
||||
;end if
|
||||
loop .tl_loop
|
||||
loop .tl_loop
|
||||
.tl_quit:
|
||||
|
||||
mov esp,ebp
|
||||
mov esp,ebp
|
||||
|
||||
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.
|
||||
; compiler : FASM
|
||||
; system : KolibriOS
|
||||
; author : Macgub aka Maciej Guba
|
||||
; 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.
|
||||
; Special greetings to KolibriOS team .
|
||||
; 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)
|
||||
; 2) Written in manually (at the end of the code) ; now not exist
|
||||
|
||||
format binary as ""
|
||||
|
||||
SIZE_X equ 512
|
||||
SIZE_Y equ 512 ; ///// I want definitely
|
||||
@ -38,14 +37,12 @@ MMX = 1
|
||||
SSE = 2
|
||||
SSE2 = 3
|
||||
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
|
||||
; use older versions of app. Probably ver 005 will be OK but it need
|
||||
; 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
|
||||
org 0x0
|
||||
db 'MENUET01' ; 8 byte id
|
||||
@ -98,7 +95,19 @@ START: ; start of execution
|
||||
call normalize_all_light_vectors
|
||||
call copy_lights ; to aligned float
|
||||
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_envmap2
|
||||
call init_envmap_cub
|
||||
call generate_texture2
|
||||
@ -107,7 +116,7 @@ START: ; start of execution
|
||||
if Ext >= SSE3
|
||||
call init_point_lights
|
||||
mov [fire_flag],0 ; proteza
|
||||
end if
|
||||
end if
|
||||
mov edi,bumpmap
|
||||
call calc_bumpmap
|
||||
call calc_bumpmap_coords ; bump and texture mapping
|
||||
@ -118,12 +127,13 @@ START: ; start of execution
|
||||
cpuid
|
||||
bt ecx,0 ; is sse3 on board?
|
||||
jc @f
|
||||
mov [max_dr_flg],12
|
||||
mov byte[max_dr_flg],12
|
||||
mov [isSSE3],0
|
||||
@@:
|
||||
end if
|
||||
|
||||
still:
|
||||
|
||||
still:
|
||||
cmp [edit_flag],1
|
||||
jne @f
|
||||
mov eax,40 ; set events mask
|
||||
@ -244,26 +254,26 @@ still:
|
||||
|
||||
jmp noclose
|
||||
|
||||
.rot_inc_x:
|
||||
inc [angle_x]
|
||||
and [angle_x],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_dec_x:
|
||||
dec [angle_x]
|
||||
and [angle_x],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_inc_y:
|
||||
inc [angle_y]
|
||||
and [angle_y],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_dec_y:
|
||||
dec [angle_y]
|
||||
and [angle_y],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_z:
|
||||
inc [angle_z]
|
||||
and [angle_z],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_inc_x:
|
||||
inc [angle_x]
|
||||
and [angle_x],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_dec_x:
|
||||
dec [angle_x]
|
||||
and [angle_x],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_inc_y:
|
||||
inc [angle_y]
|
||||
and [angle_y],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_dec_y:
|
||||
dec [angle_y]
|
||||
and [angle_y],0xff
|
||||
jmp noclose.end_rot
|
||||
.rot_z:
|
||||
inc [angle_z]
|
||||
and [angle_z],0xff
|
||||
jmp noclose.end_rot
|
||||
|
||||
button: ; button
|
||||
mov eax,17 ; get id
|
||||
@ -336,7 +346,7 @@ still:
|
||||
.next_m4:
|
||||
cmp ah,14
|
||||
jne @f
|
||||
.xchg:
|
||||
.xchg:
|
||||
call exchange
|
||||
@@:
|
||||
cmp ah,15
|
||||
@ -828,6 +838,7 @@ end if
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
;--------------------------------------------------------------------------------
|
||||
;-------------------------PROCEDURES---------------------------------------------
|
||||
;--------------------------------------------------------------------------------
|
||||
@ -838,6 +849,7 @@ include "3dmath.inc"
|
||||
include "grd_line.inc"
|
||||
include "b_procs.inc"
|
||||
include "a_procs.inc"
|
||||
include "chunks.inc"
|
||||
include "grd_cat.inc"
|
||||
include "bump_tex.inc"
|
||||
include "grd_tex.inc"
|
||||
@ -879,7 +891,9 @@ edit: ; mmx required, edit mesh by vertex
|
||||
imul edx,ecx
|
||||
add ebx,edx
|
||||
push ebx
|
||||
lea ecx,[ebx*2]
|
||||
mov ecx,ebx
|
||||
shl ecx,2
|
||||
; lea ecx,[ebx*2]
|
||||
lea ebx,[ebx*3]
|
||||
|
||||
cmp [dr_flag],12
|
||||
@ -931,11 +945,12 @@ edit: ; mmx required, edit mesh by vertex
|
||||
check_bar
|
||||
jne .no_edit
|
||||
add ecx,[vertices_index_ptr]
|
||||
mov cx,word[ecx]
|
||||
inc cx
|
||||
mov ecx,[ecx]
|
||||
; 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 dword[edit_end_x],eax
|
||||
@ -949,7 +964,7 @@ edit: ; mmx required, edit mesh by vertex
|
||||
; add ecx,[vertices_index_ptr]
|
||||
; mov cx,[ecx]
|
||||
; inc cx
|
||||
cmp [vertex_edit_no],0 ; cx ; vertex number
|
||||
cmp [vertex_edit_no],-1 ; cx ; vertex number
|
||||
je .end
|
||||
push dword[.x_coord]
|
||||
pop dword[edit_end_x]
|
||||
@ -961,8 +976,8 @@ edit: ; mmx required, edit mesh by vertex
|
||||
check_bar
|
||||
jne .end
|
||||
|
||||
movzx esi,[vertex_edit_no]
|
||||
dec esi
|
||||
mov esi,[vertex_edit_no]
|
||||
; dec esi
|
||||
lea esi,[esi*3]
|
||||
add esi,esi
|
||||
add esi,[points_translated_ptr]
|
||||
@ -996,8 +1011,8 @@ edit: ; mmx required, edit mesh by vertex
|
||||
call rotary
|
||||
|
||||
; inject into vertex list
|
||||
movzx edi,[vertex_edit_no]
|
||||
dec edi
|
||||
mov edi,[vertex_edit_no]
|
||||
; dec edi
|
||||
lea edi,[edi*3]
|
||||
shl edi,2
|
||||
add edi,[points_ptr]
|
||||
@ -1012,7 +1027,7 @@ edit: ; mmx required, edit mesh by vertex
|
||||
|
||||
|
||||
mov dword[edit_end_x],0
|
||||
mov [vertex_edit_no],0
|
||||
mov [vertex_edit_no],-1
|
||||
|
||||
.no_edit:
|
||||
.end:
|
||||
@ -1055,7 +1070,7 @@ alloc_buffer_mem:
|
||||
|
||||
|
||||
mov ecx,[.temp]
|
||||
add ecx,ecx
|
||||
shl ecx,2
|
||||
add ecx,256
|
||||
mov eax,68
|
||||
mov ebx,20
|
||||
@ -1477,18 +1492,84 @@ ret
|
||||
|
||||
if Ext >= SSE2
|
||||
init_point_normals:
|
||||
;in:
|
||||
; esi - tri_ch
|
||||
; edi - t_ptr
|
||||
.z equ dword [ebp-8]
|
||||
.y equ dword [ebp-12]
|
||||
.x equ [ebp-16]
|
||||
.point_number equ dword [ebp-28]
|
||||
.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
|
||||
mov ebp,esp
|
||||
sub esp,64
|
||||
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 .point_number,0
|
||||
mov .point_number,edx
|
||||
.ipn_loop:
|
||||
movd xmm0,.point_number
|
||||
pshufd xmm0,xmm0,0
|
||||
@ -1547,6 +1628,20 @@ init_point_normals:
|
||||
mov edx,.point_number
|
||||
cmp edx,[points_count_var]
|
||||
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
|
||||
pop ebp
|
||||
@ -1776,10 +1871,10 @@ draw_triangles:
|
||||
|
||||
emms
|
||||
; update translated list MMX required
|
||||
cmp [vertex_edit_no],0
|
||||
cmp [vertex_edit_no],-1
|
||||
je @f
|
||||
movzx eax,[vertex_edit_no]
|
||||
dec eax
|
||||
mov eax,[vertex_edit_no]
|
||||
; dec eax
|
||||
movd mm0,[edit_end_x]
|
||||
psubw mm0,[edit_start_x]
|
||||
lea eax,[eax*3]
|
||||
@ -2383,42 +2478,36 @@ draw_triangles:
|
||||
push word .zz2
|
||||
push word .zz1
|
||||
|
||||
mov esi, .point_index3 ; tex 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]
|
||||
|
||||
lea esi, .point_index1 ; env coords
|
||||
sub esp,12
|
||||
fninit
|
||||
lea esi, .point_index3 ; env coords
|
||||
mov edi,esp
|
||||
sub esp,24
|
||||
mov ecx,3
|
||||
@@:
|
||||
mov eax,dword[esi]
|
||||
lea eax,[eax*3]
|
||||
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]
|
||||
; texture x=(rotated point normal -> x * 255)+255
|
||||
fld dword[eax]
|
||||
fimul [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
|
||||
fld dword[eax+4]
|
||||
fimul [correct_tex]
|
||||
fiadd [correct_tex]
|
||||
fistp word[edi+2]
|
||||
and word[edi+2],0x7fff ; some objects need it
|
||||
add edi,4
|
||||
add esi,4
|
||||
fistp word[edi-2]
|
||||
and word[edi-2],0x7fff ; some objects need it
|
||||
|
||||
sub edi,8
|
||||
sub esi,4
|
||||
loop @b
|
||||
|
||||
mov eax, .xx1
|
||||
@ -2434,18 +2523,7 @@ draw_triangles:
|
||||
|
||||
.bump_tex:
|
||||
push ebp
|
||||
mov esi, .point_index3 ; tex 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]
|
||||
fninit
|
||||
|
||||
push dword texmap
|
||||
|
||||
@ -2455,41 +2533,37 @@ draw_triangles:
|
||||
push word .zz2
|
||||
push word .zz1
|
||||
|
||||
lea esi, .index1x12 ; env coords
|
||||
sub esp,12
|
||||
|
||||
lea ebx, .point_index1
|
||||
sub esp,36
|
||||
mov edi,esp
|
||||
mov ecx,3
|
||||
@@:
|
||||
mov eax,dword[esi]
|
||||
add eax,[points_normals_rot_ptr]
|
||||
mov eax,[ebx]
|
||||
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
|
||||
fld dword[eax]
|
||||
fld dword[esi]
|
||||
fimul [correct_tex]
|
||||
fiadd [correct_tex]
|
||||
fistp word[edi]
|
||||
fistp word[edi+6] ; env coords
|
||||
; texture y=(rotated point normal -> y * 255)+255
|
||||
fld dword[eax+4]
|
||||
fld dword[esi+4]
|
||||
fimul [correct_tex]
|
||||
fiadd [correct_tex]
|
||||
fistp word[edi+2]
|
||||
|
||||
add edi,4
|
||||
add esi,4
|
||||
fistp word[edi+4]
|
||||
add ebx,4
|
||||
add edi,12
|
||||
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 ebx,dword .xx2
|
||||
mov ecx,dword .xx3
|
||||
@ -2861,138 +2935,110 @@ end if
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
draw_handlers:
|
||||
; in eax - render model
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
|
||||
.counter equ ebp-16
|
||||
.xres3m18 equ ebp-8
|
||||
.xres2m12 equ ebp-12
|
||||
; in eax - render model
|
||||
push ebp
|
||||
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]
|
||||
|
||||
sub esp,16
|
||||
mov .dr_model,eax
|
||||
|
||||
; init counter
|
||||
sub esp,12
|
||||
push dword 0
|
||||
mov .dr_model,eax
|
||||
movzx eax,word[size_x_var]
|
||||
movzx eax,word[size_x_var]
|
||||
cmp .dr_model,12
|
||||
jge @f
|
||||
lea ebx,[eax*3]
|
||||
sub ebx,18
|
||||
add eax,eax
|
||||
sub eax,12
|
||||
mov [.xres3m18],ebx
|
||||
mov [.xres2m12],eax
|
||||
jmp .f
|
||||
@@:
|
||||
lea ebx,[eax*4]
|
||||
sub ebx,4*6
|
||||
add eax,eax
|
||||
sub eax,3*4
|
||||
mov [.xres3m18],ebx
|
||||
mov [.xres2m12],eax
|
||||
.f:
|
||||
jge @f
|
||||
lea ebx,[eax*3]
|
||||
sub ebx,3*6
|
||||
mov [.xplus_scr],ebx ; for scr 1st cause
|
||||
mov .fac,3
|
||||
jmp .in_r
|
||||
@@:
|
||||
lea ebx,[eax*4] ; for scr 2cond cause
|
||||
sub ebx,4*6
|
||||
mov [.xplus_scr],ebx
|
||||
mov .fac,4
|
||||
.in_r:
|
||||
|
||||
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]
|
||||
.loop:
|
||||
push esi
|
||||
; DO culling AT FIRST
|
||||
cmp [culling_flag],1 ; (if culling_flag = 1)
|
||||
jne .no_culling
|
||||
mov edi,[.counter] ; *********************************
|
||||
lea edi,[edi*3]
|
||||
shl edi,2
|
||||
add edi,[points_normals_rot_ptr]
|
||||
mov eax,[edi+8] ; check sign of z coof
|
||||
shr eax,31
|
||||
cmp eax,1
|
||||
jnz .skip
|
||||
.no_culling:
|
||||
mov eax,[esi]
|
||||
movzx ebx,ax ; ebx - x
|
||||
shr eax,16 ; eax - y
|
||||
cmp eax,4 ; check if markers not exceedes screen
|
||||
jle .skip
|
||||
cmp ebx,4
|
||||
jle .skip
|
||||
movzx edx,word[size_x_var]
|
||||
sub edx,4
|
||||
movzx ecx,word[size_y_var]
|
||||
sub ecx,4
|
||||
cmp ebx,edx
|
||||
jge .skip
|
||||
cmp eax,ecx
|
||||
jge .skip
|
||||
.l:
|
||||
push ecx
|
||||
cmp [culling_flag],1 ; (if culling_flag = 1)
|
||||
jne .no_culling
|
||||
mov edi,ecx ; *********************************
|
||||
lea edi,[edi*3]
|
||||
shl edi,2
|
||||
add edi,[points_normals_rot_ptr]
|
||||
bt dword[edi+8],31
|
||||
jnc .skip
|
||||
.no_culling:
|
||||
mov esi,ecx
|
||||
lea esi,[esi*3]
|
||||
add esi,esi
|
||||
add esi,[points_translated_ptr]
|
||||
movd xmm2,[esi]
|
||||
movd xmm3,[esi]
|
||||
pcmpgtw xmm2,xmm0
|
||||
pcmpgtw xmm3,xmm1
|
||||
pxor xmm3,xmm2
|
||||
movd eax,xmm3
|
||||
cmp eax,-1
|
||||
jne .skip
|
||||
|
||||
movzx edx,word[size_x_var]
|
||||
; sub ebx,3
|
||||
; sub eax,3
|
||||
imul eax,edx
|
||||
add eax,ebx
|
||||
push eax
|
||||
lea edi,[eax*3]
|
||||
cmp .dr_model,12
|
||||
jl @f
|
||||
add edi,[esp]
|
||||
@@:
|
||||
add esp,4
|
||||
lea eax,[eax*2]
|
||||
; draw bar 6x6
|
||||
add edi,[screen_ptr]
|
||||
add eax,dword[vertices_index_ptr]
|
||||
|
||||
|
||||
|
||||
|
||||
mov edx,[.counter]
|
||||
mov ecx,6
|
||||
|
||||
.oop:
|
||||
push ecx
|
||||
mov ecx,6
|
||||
|
||||
.do:
|
||||
mov word[edi],0x0000 ;ax
|
||||
mov byte[edi+2],0xff ;al
|
||||
mov word[eax],dx
|
||||
add eax,2
|
||||
cmp .dr_model,12
|
||||
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
|
||||
movzx eax,word[esi]
|
||||
movzx ebx,word[esi+2]
|
||||
sub eax,2
|
||||
sub ebx,2
|
||||
movzx edx, word[size_x_var]
|
||||
imul ebx,edx
|
||||
add ebx,eax
|
||||
mov edi,ebx
|
||||
imul ebx,.fac
|
||||
shl edi,2
|
||||
add ebx,[screen_ptr]
|
||||
add edi,[vertices_index_ptr]
|
||||
mov eax,ecx
|
||||
cld
|
||||
mov ecx,6
|
||||
.l2:
|
||||
push ecx
|
||||
mov ecx,6 ; draw bar
|
||||
.l1:
|
||||
mov word[ebx],0
|
||||
mov byte[ebx+2],0xff
|
||||
stosd
|
||||
add ebx,.fac
|
||||
loop .l1
|
||||
add ebx,[.xplus_scr]
|
||||
add edi,[.xplus_index]
|
||||
pop ecx
|
||||
loop .l2
|
||||
.skip:
|
||||
pop ecx
|
||||
inc ecx
|
||||
cmp ecx,[points_count_var]
|
||||
jna .l
|
||||
|
||||
mov esp,ebp
|
||||
pop ebp
|
||||
ret
|
||||
|
||||
|
||||
|
||||
fill_Z_buffer:
|
||||
mov eax,0x70000000
|
||||
cmp [dr_flag],11
|
||||
@ -3033,11 +3079,7 @@ read_tp_variables: ; read [triangles_count_var] and [points_count_va
|
||||
xor ebp,ebp
|
||||
mov [points_count_var],ebx
|
||||
mov [triangles_count_var],ebx
|
||||
if USE_LFN = 0
|
||||
mov esi,SourceFile
|
||||
else
|
||||
mov esi,[fptr]
|
||||
end if
|
||||
|
||||
cmp [esi],word 4D4Dh
|
||||
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
|
||||
add esi,8
|
||||
@@:
|
||||
|
||||
add ebx,6
|
||||
add esi,12
|
||||
lea ecx,[ecx*3]
|
||||
add ecx,ecx
|
||||
add ebx,ecx
|
||||
add ecx,ecx
|
||||
add esi,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
|
||||
dec ecx
|
||||
jnz @b
|
||||
shl ecx,3
|
||||
add esi,ecx
|
||||
; dec ecx
|
||||
; jnz @b
|
||||
; loop @b
|
||||
; xor ecx,ecx
|
||||
add ebp,edx
|
||||
jmp .find4k
|
||||
@ -3198,8 +3244,9 @@ read_from_file:
|
||||
|
||||
add ebx,6
|
||||
add esi,12
|
||||
dec ecx
|
||||
jnz @b
|
||||
; dec ecx
|
||||
; jnz @b
|
||||
loop @b
|
||||
@@:
|
||||
; mov dword[points+ebx],-1
|
||||
push edi
|
||||
@ -3227,14 +3274,17 @@ read_from_file:
|
||||
add dword[edi-8],ebp
|
||||
add dword[edi-4],ebp
|
||||
add esi,8
|
||||
dec ecx
|
||||
jnz @b
|
||||
; dec ecx
|
||||
; jnz @b
|
||||
loop @b
|
||||
add ebp,edx
|
||||
jmp .find4k
|
||||
mov eax,-1 ;<---mark if OK
|
||||
.exit:
|
||||
mov dword[edi],-1
|
||||
ret
|
||||
|
||||
|
||||
alloc_mem_for_tp:
|
||||
mov eax, 68
|
||||
cmp [re_alloc_flag],1
|
||||
@ -3265,7 +3315,7 @@ alloc_mem_for_tp:
|
||||
|
||||
mov eax, 68
|
||||
mov ecx, [triangles_count_var]
|
||||
lea ecx, [3+ecx*3]
|
||||
lea ecx, [6+ecx*3]
|
||||
shl ecx, 2
|
||||
mov edx,[triangles_normals_ptr]
|
||||
int 0x40 ; -> allocate memory for triangles normals
|
||||
@ -3274,7 +3324,7 @@ alloc_mem_for_tp:
|
||||
|
||||
mov eax, 68
|
||||
mov ecx, [points_count_var]
|
||||
lea ecx,[3+ecx*3]
|
||||
lea ecx,[6+ecx*3]
|
||||
shl ecx, 2
|
||||
mov edx,[points_normals_ptr]
|
||||
int 0x40
|
||||
@ -3284,13 +3334,14 @@ alloc_mem_for_tp:
|
||||
mov eax, 68
|
||||
; mov ebx, 12
|
||||
mov ecx, [points_count_var]
|
||||
lea ecx,[3+ecx*3]
|
||||
lea ecx,[10+ecx*3]
|
||||
shl ecx, 2
|
||||
mov edx,[points_normals_rot_ptr]
|
||||
int 0x40
|
||||
mov [points_normals_rot_ptr], eax
|
||||
|
||||
mov eax, 68
|
||||
|
||||
mov edx,[points_ptr]
|
||||
int 0x40
|
||||
mov [points_ptr], eax
|
||||
@ -3304,13 +3355,14 @@ alloc_mem_for_tp:
|
||||
mov ebx, 12
|
||||
mov ecx, [points_count_var]
|
||||
shl ecx,2
|
||||
add ecx,32
|
||||
mov edx,[tex_points_ptr]
|
||||
int 0x40
|
||||
mov [tex_points_ptr], eax
|
||||
|
||||
mov eax, 68
|
||||
mov ecx, [points_count_var]
|
||||
inc ecx
|
||||
add ecx,10
|
||||
shl ecx, 3
|
||||
mov edx,[points_translated_ptr]
|
||||
int 0x40
|
||||
@ -3417,7 +3469,7 @@ write_info:
|
||||
mov bx,[size_x_var]
|
||||
shl ebx,16
|
||||
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
|
||||
int 0x40
|
||||
|
||||
@ -3467,7 +3519,7 @@ write_info:
|
||||
int 40h
|
||||
pop esi
|
||||
add esi,4
|
||||
cmp esi,12
|
||||
cmp esi,16
|
||||
jnz .nxxx
|
||||
ret
|
||||
; *********************************************
|
||||
|
Loading…
Reference in New Issue
Block a user