view3ds 0073 by macgub

git-svn-id: svn://kolibrios.org@8719 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-05-12 00:26:00 +00:00
parent 1c24cac315
commit 73122f1cb1
9 changed files with 7546 additions and 7756 deletions

View File

@ -198,24 +198,7 @@ ret
;---------------------------- edi - pointer to vector ----- ;---------------------------- edi - pointer to vector -----
;----------------------- out : none ;----------------------- out : none
normalize_vector: normalize_vector:
if Ext = SSE2 | Ext = SSE | Ext = SSE3 if Ext >= SSE3
movups xmm0,[edi]
andps xmm0,[zero_hgst_dd]
movups xmm1,xmm0
mulps xmm0,xmm0
movhlps xmm2,xmm0
addps xmm0,xmm2
movaps xmm2,xmm0
shufps xmm2,xmm2,11100001b
addps xmm0,xmm2
shufps xmm0,xmm0,0
rsqrtps xmm0,xmm0
mulps xmm0,xmm1
movlps [edi],xmm0
movhlps xmm0,xmm0
movss [edi+8],xmm0
end if
if 0 ; Ext >= SSE3
movups xmm0,[edi] movups xmm0,[edi]
andps xmm0,[zero_hgst_dd] andps xmm0,[zero_hgst_dd]
movups xmm1,xmm0 movups xmm1,xmm0
@ -227,8 +210,7 @@ if 0 ; Ext >= SSE3
movlps [edi],xmm0 movlps [edi],xmm0
movhlps xmm0,xmm0 movhlps xmm0,xmm0
movss [edi+8],xmm0 movss [edi+8],xmm0
end if else
if Ext < SSE
fninit fninit
fld dword [edi+vec_x] fld dword [edi+vec_x]

View File

@ -312,9 +312,11 @@ stencil_line:
sub ecx,.x1 sub ecx,.x1
movss xmm2,.z1 ; cz movss xmm2,.z1 ; cz
.ccalc: .ccalc:
; movss xmm1,xmm2 movss xmm1,xmm2
comiss xmm2,dword[esi] cmpltss xmm1,dword[esi]
jg @f movd eax,xmm1
cmp eax,-1
jnz @f
movss dword[esi],xmm2 movss dword[esi],xmm2
@@: @@:
add esi,4 add esi,4

View File

@ -1,3 +1,227 @@
;===============================================================
do_edges_list:
push ebp
mov ebp,esp
sub esp,32
.ed_cnt equ [ebp-4]
.edd_ptr equ [ebp-8]
.counter equ [ebp-12]
mov ebx,[edges_ptr]
mov eax,[triangles_ptr]
mov ecx,[triangles_count_var]
@@:
movdqu xmm0,[eax]
movq [ebx],xmm0
pshufd xmm0,xmm0,11001001b
movq [ebx+8],xmm0
pshufd xmm0,xmm0,11001001b
movq [ebx+16],xmm0
add ebx,24
add eax,12
loop @b
mov ebx,[edges_ptr]
mov ecx,[triangles_count_var]
lea ecx,[ecx*3]
.mxd:
mov eax,[ebx]
cmp eax,[ebx+4]
jl @f
movq xmm0,[ebx]
pshufd xmm0,xmm0,11100001b
movq [ebx],xmm0
@@:
add ebx,8
loop .mxd
; insert sort
mov ebx,[edges_ptr]
mov ecx,[triangles_count_var]
lea ecx,[ecx*3]
mov esi,ecx
shl esi,3
add esi,ebx
.ccc:
mov eax,[ebx+8]
cmp eax,[ebx]
jge .g
movq xmm0,[ebx+8]
push ebx
.c:
cmp ebx,esi
jge .done
cmp ebx,[edges_ptr]
jl .done
cmp eax,[ebx]
jge .done
movq xmm7,[ebx]
movq [ebx+8],xmm7
sub ebx,8
jnz .c
add ebx,8
.done:
movq [ebx+8],xmm0
.p:
pop ebx
.g:
add ebx,8
dec ecx
cmp ecx,1
jnz .ccc
; insert sort again
mov ebx,[edges_ptr]
mov ecx,[triangles_count_var]
lea ecx,[ecx*3]
mov esi,ecx
shl esi,3
add esi,ebx
.count:
push ecx
push ebx
xor ecx,ecx
mov eax,[ebx] ; count
.aa:
inc ecx
add ebx,8
cmp ebx,esi
jge .br ; break
cmp eax,[ebx]
je .aa
mov .counter,ecx
pop ebx
mov edi,ebx
sub edi,8
mov edx,[ebx+8]
.ccc2:
cmp ebx,esi
jbe @f
add esp,4
jmp .ff
@@:
mov eax,[ebx+12]
mov edx,[ebx+8]
cmp eax,[ebx+4]
jge .gg2
movq xmm0,[ebx+8]
push ebx
.c2:
cmp eax,[ebx+4]
jge .done2
movq xmm7,[ebx]
movq [ebx+8],xmm7
sub ebx,8
cmp ebx,edi
jz @f
cmp [ebx+8],edx
jz .c2
@@:
.done2:
add ebx,8
movq [ebx],xmm0
.p2:
pop ebx
.gg2:
add ebx,8
dec ecx
cmp ecx,1
jnz .ccc2
pop ecx
sub ecx,.counter
add ebx,8
ja .count
jmp .ff
.br: ;break
add esp,8
.ff:
; count edges
mov ecx,0
mov edx,[triangles_count_var]
lea edx,[edx*3]
mov ebx,[edges_ptr]
; mov esi,edx
; shl esi,3
; add esi,[edges_ptr]
.nx:
movq xmm0,[ebx]
add ebx,8
; cmp ebx,esi
; jae @f
movq xmm1,[ebx]
; @@:
pcmpeqd xmm0,xmm1
pmovmskb eax,xmm0
and eax,0xff
cmp eax,0xff
jz @f
inc ecx
@@:
dec edx
jnz .nx
mov .ed_cnt,ecx
lea ecx,[ecx*3]
shl ecx,2
add ecx,65536
mov ebx,12
mov eax,68
mov edx,.edd_ptr
int 0x40 ; -> allocate memory to triangles
mov .edd_ptr, eax ; -> eax = pointer to allocated mem
mov ebx,[edges_ptr]
mov ecx,[triangles_count_var]
lea ecx,[ecx*3]
.seek:
movq xmm0,[ebx]
movq xmm1,[ebx+8]
pcmpeqd xmm1,xmm0
pmovmskb edx,xmm1
and edx,0xff
cmp edx,0xff
je @f
movq [eax],xmm0
add eax,8
@@:
add ebx,8
loop .seek
mov eax,68
mov ebx,13
mov ecx,[edges_ptr]
int 0x40 ; release old edges ptr
mov eax,.edd_ptr
mov ecx,.ed_cnt
mov [edges_ptr],eax
mov [edges_count],ecx
mov esp,ebp
pop ebp
ret
;=======================
do_sinus: do_sinus:
.x equ [ebp-8] .x equ [ebp-8]
.y equ [ebp-12] .y equ [ebp-12]
@ -19,21 +243,53 @@ do_sinus:
cld cld
rep stosd rep stosd
pop edi pop edi
; movzx eax,[sinus_flag]
; mov edx,10
; mul edx
; mov [sin_amplitude],eax
; mov [sin_frq],eax
fninit fninit
;if Ext = SSE2
; movups xmm1,[const0123] ; xmm1 - init values
; mov eax,0x000000ff
; movd xmm2,eax
; shufps xmm2,xmm2,0 ; xmm2 - mask value
; mov eax,4
; movd xmm3,eax
; shufps xmm3,xmm3,0
.again: .again:
if 0
fild dword .x
fidiv [sin_frq]
fsin
fimul [sin_amplitude]
fiadd dword .y
fistp dword .new_y
else
fild dword .x fild dword .x
fmul [sin_frq] fmul [sin_frq]
fistp dword .temp fistp dword .temp
mov eax, .temp mov eax, .temp
; mov bx, [angle_x]
; add bx, [angle_y]
; movzx ebx,bx
; shr ebx,1 ; change phase
; add eax,ebx
and eax, 0x000000ff and eax, 0x000000ff
; cdq
; mul [sin_frq]
; and eax,0x000000ff
; and ax,0x00ff
; cwde
fld dword [sin_tab+eax*4] fld dword [sin_tab+eax*4]
fimul dword [sin_amplitude] fimul dword [sin_amplitude]
fiadd dword .y fiadd dword .y
fistp dword .new_y fistp dword .new_y
end if
mov eax,.new_y mov eax,.new_y
or eax,eax or eax,eax
jl .skip jl .skip
@ -244,7 +500,109 @@ end if
ret ret
;align 16
; emboss_bias:
; dw 128, 128, 128, 128, 128, 128, 128, 128
if 0 ; old emb proc
; emboss - after drawing all,
; transfer screen buffer into bump map
; and draw two bump triangles
; *************************************
mov esi,screen
mov edi,bumpmap2
mov ecx,TEXTURE_SIZE/3
cld
if Ext=NON
xor eax,eax
xor bh,bh
xor dh,dh
@@:
lodsb
movzx bx,al
lodsb
movzx dx,al
lodsb
add ax,bx
add ax,dx
; cwd
; div [i3]
;; push ax
;; pop bx
;; shr bx,3
;; shr ax,2
;; add ax,bx
lea eax,[eax*5]
shr ax,4
stosb
loop @b
else
emms
pxor mm1,mm1
mov ebx,0x0000ffff
@@:
movd mm0,[esi]
punpcklbw mm0,mm1
movq mm2,mm0
psrlq mm2,16
movq mm3,mm0
psrlq mm3,32
paddw mm0,mm2
paddw mm0,mm3
movd eax,mm0
and eax,ebx
lea eax,[eax*5]
shr ax,4
stosb
add esi,3
loop @b
end if
push ebp
push dword 0 ; env coords
push word 0
push word SIZE_X
push word SIZE_Y
push dword 0
push dword 0 ; bump coords
push word SIZE_X
push word SIZE_Y
push word 0
mov eax,SIZE_Y
mov ebx,SIZE_X*65536+0
xor ecx,ecx
mov edx,bumpmap2
mov esi,envmap
mov edi,screen
call bump_triangle
push dword SIZE_X shl 16 + SIZE_Y ; env coords
push word 0
push word SIZE_X
push word SIZE_Y
push word 0
push dword SIZE_X shl 16 + SIZE_Y ; bump coords
push word 0
push word SIZE_X
push word SIZE_Y
push word 0
mov eax,SIZE_Y
mov ebx,SIZE_X * 65536+0
mov ecx,SIZE_X shl 16 + SIZE_Y
mov edx,bumpmap2
mov esi,envmap
mov edi,screen
call bump_triangle
pop ebp
ret
end if
;********************************EMBOSS DONE******************************* ;********************************EMBOSS DONE*******************************

View File

@ -60,25 +60,24 @@ calc_one_col:
; stack - other parameters ; stack - other parameters
; out - eax - 0x00rrggbb ; out - eax - 0x00rrggbb
.dot_prd equ dword[ebp+4] ; dot product - cos x - not now .dot_prd equ dword[ebp+4] ; dot product - cos x - not now
.min_col_r equ [ebp+8] ; minimum color - ambient .min_col_r equ word[ebp+8] ; minimum color - ambient
.min_col_g equ word[ebp+10] .min_col_g equ word[ebp+10]
.min_col_b equ word[ebp+12] .min_col_b equ word[ebp+12]
.max_col_r equ [ebp+14] ; maximum color - specular .max_col_r equ word[ebp+14] ; maximum color - specular
.max_col_g equ word[ebp+16] .max_col_g equ word[ebp+16]
.max_col_b equ word[ebp+18] .max_col_b equ word[ebp+18]
.org_col_r equ [ebp+20] ; orginal color - diffuse .org_col_r equ word[ebp+20] ; orginal color - diffuse
.org_col_g equ word[ebp+22] .org_col_g equ word[ebp+22]
.org_col_b equ word[ebp+24] .org_col_b equ word[ebp+24]
.n equ word[ebp+26] ; shines - not implemented .n equ word[ebp+26] ; shines - not implemented
.temp equ word[ebp-2] .temp equ word[ebp-2]
.color_sum_r equ [ebp-6] .color_sum_r equ dword[ebp-6]
.color_sum_g equ [ebp-10] .color_sum_g equ dword[ebp-10]
.color_sum_b equ [ebp-14] .color_sum_b equ dword[ebp-14]
; color = ambient+cos(x)*diffuse+(cos(x)^n)*specular ; color = ambient+cos(x)*diffuse+(cos(x)^n)*specular
mov ebp,esp mov ebp,esp
sub esp,14 sub esp,14
mov ax,.min_col_r mov ax,.min_col_r
add ax,.max_col_r add ax,.max_col_r
add ax,.org_col_r add ax,.org_col_r
@ -96,38 +95,8 @@ calc_one_col:
add ax,.org_col_b add ax,.org_col_b
cwde cwde
mov .color_sum_b,eax mov .color_sum_b,eax
if 0
movq xmm0,.min_col_r
movq xmm1,.max_col_r
movq xmm2,.org_col_r
packuswb xmm0,[the_zero]
packuswb xmm1,[the_zero]
packuswb xmm2,[the_zero]
punpcklbw xmm0,xmm1
punpcklbw xmm2,[the_zero]
packusdw xmm2,[the_zero]
cvtdq2ps xmm0,xmm0
cvtdq2ps xmm1,xmm1
cvtdq2ps xmm2,xmm2
haddps xmm0,xmm0
haddps xmm1,xmm1
haddps xmm2,xmm2
haddps xmm0,xmm0
haddps xmm1,xmm1
haddps xmm2,xmm2
cvtss2si eax,xmm0
cvtss2si ebx,xmm1
cvtss2si ecx,xmm2
mov .color_sum_r,eax
mov .color_sum_g,ebx
mov .color_sum_b,ecx
end if
; fld .dot_prd ; fld .dot_prd
; fild .n ; fild .n
; fxch st1 ; fxch st1
@ -154,7 +123,7 @@ end if
faddp ; st0=first piece of col, st1=dot_pr^n.. faddp ; st0=first piece of col, st1=dot_pr^n..
fiadd .min_col_b fiadd .min_col_b
fimul .max_col_b fimul .max_col_b
fidiv dword .color_sum_b fidiv .color_sum_b
fistp .temp fistp .temp
movzx eax,.temp movzx eax,.temp
shl eax,16 shl eax,16
@ -166,19 +135,19 @@ end if
faddp faddp
fiadd .min_col_g fiadd .min_col_g
fimul .max_col_g fimul .max_col_g
fidiv dword .color_sum_g fidiv .color_sum_g
fistp .temp fistp .temp
mov ax,.temp mov ax,.temp
mov ah,al mov ah,al
shl eax,8 shl eax,8
fimul word .max_col_r fimul .max_col_r
fild word .org_col_r fild .org_col_r
fmulp st2,st fmulp st2,st
faddp faddp
fiadd word .min_col_r fiadd .min_col_r
fimul word .max_col_r fimul .max_col_r
fidiv dword .color_sum_r fidiv .color_sum_r
fistp .temp fistp .temp
mov ax,.temp ;eax - 0xbbgg00rr mov ax,.temp ;eax - 0xbbgg00rr
; mov ah,al ; mov ah,al

View File

@ -1,12 +1,15 @@
; DATA AREA ************************************ ; DATA AREA ************************************
i3 dw 3 i3 dw 3
i6 dd 6
i12 dd 12 i12 dd 12
i36 dd 36
i256 dw 256 i256 dw 256
i255d dd 255 i255d dd 255
dot_max dd 1.0 ; dot product max and min dot_max dd 1.0 ; dot product max and min
dot_min dd 0.0 dot_min dd 0.0
env_const dd 1.05 env_const dd 1.05
correct_tex dw 255
tex_x_div2 dw TEX_X / 2 tex_x_div2 dw TEX_X / 2
tex_y_div2 dw TEX_Y / 2 tex_y_div2 dw TEX_Y / 2
xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera
@ -54,6 +57,7 @@
points_ptr dd 0 points_ptr dd 0
points_rotated_ptr dd 0 points_rotated_ptr dd 0
points_translated_ptr dd 0 points_translated_ptr dd 0
edges_ptr dd 0
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
@ -64,6 +68,9 @@
edit_end_x: edit_end_x:
dw 0 dw 0
edit_end_y dw 0 edit_end_y dw 0
x_start: dw 20
y_start: dw 20
mouse_state dd 0 mouse_state dd 0
@ -343,9 +350,19 @@ base_vector:
if Ext=SSE3 if Ext=SSE3
db ' (SSE3)' db ' (SSE3)'
end if end if
db ' 0.072',0 db ' 0.073',0
labellen: labellen:
STRdata db '-1 ' STRdata db '-1 '
lab_vert:
db 'Vertices count: '
lab_vert_end:
lab_tr:
db 'Faces count: '
lab_tr_end:
lab_ed:
db 'Edges count: '
lab_ed_end:
all_lights_size dw lightsend-lights all_lights_size dw lightsend-lights
@ -410,6 +427,8 @@ lightsend:
align 16 align 16
abs_mask:
dd 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff
emboss_bias: emboss_bias:
dw 128, 128, 128, 128, 128, 128, 128, 128 dw 128, 128, 128, 128, 128, 128, 128, 128
zero_hgst_dd: zero_hgst_dd:
@ -465,21 +484,9 @@ align 8
col3 dd ? col3 dd ?
scale dd ? ; help scale variable scale dd ? ; help scale variable
;== points_count_var dd ? ;
triangles_count_var dd ? triangles_count_var dd ? ; dont change order
points_count_var dd ? edges_count dd ? ;
; size_y_var:
; yres_var dw ?
; size_x_var:
; xres_var dw ?
x_start:
dw ?
y_start:
dw ?
;===
point_index1 dd ? ;-\ point_index1 dd ? ;-\
point_index2 dd ? ; } don't change order point_index2 dd ? ; } don't change order

View File

@ -1,643 +1,115 @@
;-procedure draws smooth shaded lines (I mean interpolation 24 bit-- ; Line drawing procedure by Pablo Reda.
;-color), with z coord interpolation-------------------------------- ; Gouraud extension by Maciej Guba.
;-author: Maciej Guba (www.macgub.hekko.pl)------------------------- ;****************************************************
;-in : ------------------------------------------------------------- line_grd: ; eax=x1 ebx=y1 ecx=x2 edx=y2
;----- edi - pointer to screen buffer ------------------------------ ; xmm0 - color1 argb as 4 dword float
;----- esi - pointer to Z buffer ----------------------------------- ; xmm1 - color2 argb as 4 dword float
;------ constans : SIZE_X, SIZE_Y - screen width and height--------- ; xmm2 - z1 as dword float
;----------------- ROUND - fixed point shift------------------------ ; xmm3 - z2 as dword float
;------ other parameters via stack---------------------------------- ; mm0 - Z buffer
smooth_line: ; mm1 - screen buffer
.x1 equ ebp+4 ; mm2 - screen width
.y1 equ ebp+6
.z1 equ ebp+8
.r1 equ ebp+10
.g1 equ ebp+12
.b1 equ ebp+14
.x2 equ ebp+16
.y2 equ ebp+18
.z2 equ ebp+20
.r2 equ ebp+22
.g2 equ ebp+24
.b2 equ ebp+26
.line_lenght equ ebp-2 cmp ebx,edx
.delta equ ebp-6 ; je horizontal_grd
.delta_x equ ebp-10 jg .noswap
.delta_y equ ebp-14 xchg eax,ecx
.dr equ ebp-18 xchg ebx,edx
.dg equ ebp-22 movaps xmm7,xmm0
.db equ ebp-26 movaps xmm0,xmm1
.dz equ ebp-30 movaps xmm1,xmm7
.cr equ ebp-34 movaps xmm7,xmm2
.cg equ ebp-38 movaps xmm2,xmm3
.cb equ ebp-42 movaps xmm3,xmm7
.cz equ ebp-46 .noswap:
;.line_lenght equ ebp-48 cvtsi2ss xmm7,eax
.screen equ ebp-52 cvtsi2ss xmm6,ebx
.zbuffer equ ebp-56 cvtsi2ss xmm5,ecx
.ccoord equ ebp-60 ;current coordinate cvtsi2ss xmm4,edx
.czbuf equ ebp-64 subss xmm7,xmm5
.cscr equ ebp-68 subss xmm6,xmm4
.xres equ ebp-72 andps xmm7,[abs_mask] ; 0x7fff
.yres equ ebp-76 andps xmm6,[abs_mask] ; 0x7fff
.xresm1 equ ebp-80 maxss xmm7,xmm6 ; xmm7 - delta
.yresm1 equ ebp-84 shufps xmm7,xmm7,0
.xresp1 equ ebp-88 movaps xmm6,xmm3
.yresp1 equ ebp-92 rcpps xmm7,xmm7
.xres3 equ ebp-96 subss xmm6,xmm2
.xres4 equ ebp-100 mulss xmm6,xmm7 ; xmm6 - delta z
movaps xmm5,xmm1
macro .update_cur_var subps xmm5,xmm0
{ mulps xmm5,xmm7 ; xmm5 - delta col argb
if Ext=NON
mov ebx,[.dz]
add [.cz],ebx
mov ebx,[.dr]
add [.cr],ebx
mov ebx,[.dg]
add [.cg],ebx
mov ebx,[.db]
add [.cb],ebx
elseif Ext=MMX
movq mm0,[.cz]
movq mm1,[.cg]
paddd mm0,mm2 ;[.dz]
paddd mm1,mm3 ;[.dg]
movq [.cz],mm0
movq [.cg],mm1
elseif Ext >= SSE2
; movups xmm1,[.cz]
paddd xmm1,xmm0
; movups [.cz],xmm1
end if
}
macro .draw_pixel
{
mov [esi],ebx ; actualize Z buffer
if Ext>=SSE2
movaps xmm7,xmm1 ;[.cb] ;;xmm1
shufps xmm7,xmm7,00111001b
psrld xmm7,ROUND
packssdw xmm7,xmm7
packuswb xmm7,xmm7
pand xmm7,xmm6 ;[.mask]
movd [edi],xmm7
else
mov eax,[.cb]
sar eax,ROUND
mov [edi],al
; and eax,0x000000ff ; clean unused bits
mov ebx,[.cg]
sar ebx,ROUND
mov [edi+1],bl
; mov ah,bl
mov edx,[.cr]
sar edx,ROUND
mov [edi+2],dl
end if
; shl ebx,16
; or eax,ebx
; mov [edi],eax
}
macro .sort
{
if Ext >= MMX
movq mm0,[.x1]
movq mm1,[.x2]
movq [.x1],mm1
movq [.x2],mm0
else
mov edx,[.x1]
xchg edx,[.x2]
mov [.x1],edx
mov edx,[.z1]
xchg edx,[.z2]
mov [.z1],edx
end if
mov edx,[.g1]
xchg edx,[.g2]
mov [.g1],edx
}
shl eax,16
emms shl ecx,16
mov ebp,esp sub eax,ecx
sub esp,128 push ebx
mov eax,[.x1] ; check if parameters exceedes screen area push edx
mov ebx,[.x2] sub ebx,edx
or eax,ebx add ebx,1
test eax,80008000h
jne .end_line
movzx edx,word [size_x_var]
mov [.xres],edx
dec edx
movzx ecx,word [size_y_var]
mov [.yres],ecx
dec ecx
cmp word[.x1],dx ;SIZE_X
jg .end_line
cmp word[.x2],dx ;SIZE_X
jg .end_line
cmp word[.y1],cx ;SIZE_Y
jg .end_line
cmp word[.y2],cx ;SIZE_Y
jg .end_line
mov edx,[.xres]
shl edx,2
mov [.xres4],edx
shr edx,2
lea edx,[edx*3]
mov [.xres3],edx
mov edx,[.xres]
mov ecx,[.yres]
dec edx
dec ecx
mov [.xresm1],edx
mov [.yresm1],ecx
add edx,2
add ecx,2
mov [.xresp1],edx
mov [.yresp1],ecx
mov [.screen],edi
mov cx,[.x1]
cmp cx,[.x2]
je .vertical_l
mov cx,[.y1]
cmp cx,[.y2]
je .horizontal_l
mov ax,[.x1]
sub ax,[.x2]
cmp ax,0
jg @f
neg ax ; calc absolute value
@@:
mov [.delta_x],ax
mov bx,[.y1]
sub bx,[.y2]
cmp bx,0
jg @f
neg bx
@@:
mov [.delta_y],bx
cmp ax,bx
je .deg45_l
jl .more_vertical_l
jg .more_horizon_l
jmp .end_line
;
.horizontal_l:
mov ax,[.x1]
mov bx,[.x2]
cmp bx,ax
jge @f
.sort
@@:
mov bx,[.x2]
sub bx,[.x1]
movsx ebx,bx
cmp ebx,0 ;line lenght equql 0
je .end_line
mov [.delta_x],ebx
call .calc_delta
mov eax,[.xres] ;SIZE_X
movsx ebx,word[.y1]
mul ebx
add esi,eax
lea eax,[eax*3]
add esi,eax
add edi,eax
movsx eax,word[.x1]
add esi,eax
lea eax,[eax*3]
add edi,eax
add esi,eax
mov ecx,[.delta_x]
movsx ebx,word[.r1]
shl ebx,ROUND
mov [.cr],ebx
movsx ebx,word[.g1]
shl ebx,ROUND
mov [.cg],ebx
movsx ebx,word[.b1]
shl ebx,ROUND
mov [.cb],ebx
movsx ebx,word[.z1]
shl ebx,ROUND
mov [.cz],ebx
if Ext >= SSE2
movups xmm1,[.cz]
end if
.hdraw:
if Ext >= SSE2
movd ebx,xmm1
else
mov ebx,[.cz]
end if
cmp [esi],ebx
jle .skip
.draw_pixel
.skip:
add edi,3
add esi,4
.update_cur_var
loop .hdraw
jmp .end_line
.vertical_l:
mov ax,[.y1]
cmp [.y2],ax
jge @f
.sort
@@:
mov bx,[.y2]
sub bx,[.y1]
movsx ebx,bx
cmp ebx,0
je .end_line
mov [.delta_y],ebx
call .calc_delta
mov eax,[.xres] ;SIZE_X
movsx ebx,word[.y1]
mul ebx
add esi,eax
lea eax,[eax*3]
add edi,eax
add esi,eax
movsx eax,word[.x1]
add esi,eax
lea eax,[eax*3]
add esi,eax
add edi,eax
mov ecx,[.delta_y]
movsx ebx,word[.r1]
shl ebx,ROUND
mov [.cr],ebx
movsx ebx,word[.g1]
shl ebx,ROUND
mov [.cg],ebx
movsx ebx,word[.b1]
shl ebx,ROUND
mov [.cb],ebx
movsx ebx,word[.z1]
shl ebx,ROUND
mov [.cz],ebx
if Ext >= SSE2
movups xmm1,[.cz]
end if
.v_draw:
if Ext >= SSE2
movd ebx,xmm1
else
mov ebx,[.cz]
end if
cmp [esi],ebx
jle @f
.draw_pixel
@@:
add edi,[.xres3]
add esi,[.xres4]
.update_cur_var
loop .v_draw
jmp .end_line
.deg45_l:
mov word[.line_lenght],ax
mov ax,[.x1]
cmp [.x2],ax
jge @f
.sort
@@:
mov bx,[.y2]
sub bx,[.y1]
movsx ebx,bx
cmp ebx,0
je .end_line
mov [.delta_y],ebx
mov bx,[.x2]
sub bx,[.x1]
movsx ebx,bx
mov [.delta_x],ebx
call .calc_delta
mov eax,[.xres]
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers
mul ebx
lea ebx,[3*eax]
add edi,ebx
shl eax,2
add esi,eax
movsx eax,word[.x1]
lea ebx,[eax*3]
add edi,ebx
shl eax,2
add esi,eax
movzx ecx,word[.line_lenght]
movsx ebx,word[.r1]
shl ebx,ROUND
mov [.cr],ebx
movsx ebx,word[.g1]
shl ebx,ROUND
mov [.cg],ebx
movsx ebx,word[.b1]
shl ebx,ROUND
mov [.cb],ebx
movsx ebx,word[.z1]
shl ebx,ROUND
mov [.cz],ebx
.d45_draw:
if Ext >= SSE2
movd ebx,xmm1
else
mov ebx,[.cz]
end if
cmp [esi],ebx
jle @f
.draw_pixel
@@:
cmp dword[.delta_y],0
jl @f
add edi,[.xres3] ;SIZE_X*3+3
add edi,3
add esi,[.xres4] ;SIZE_X*4+4
add esi,4
jmp .d45_1
@@:
sub edi,[.xres3] ;(SIZE_X*3)-3
sub edi,3
sub esi,[.xres4] ;(SIZE_X*4)-4
sub esi,4
.d45_1:
.update_cur_var
loop .d45_draw
jmp .end_line
.more_vertical_l:
mov word[.line_lenght],bx
mov ax,[.y1]
cmp [.y2],ax
jge @f
.sort
@@:
mov bx,[.y2]
sub bx,[.y1]
movsx ebx,bx
cmp ebx,0
je .end_line ;=======================
mov [.delta_y],ebx
mov ax,[.x2]
sub ax,[.x1]
cwde
shl eax,ROUND
cdq cdq
idiv ebx idiv ebx
mov [.delta],eax mov esi,eax
add ecx,$7fff
call .calc_delta pop ebx
pop edx
mov eax,[.xres] ;SIZE_X .lineas:
movsx ebx,word[.y1] ;calc begin values in screen and Z buffers mov eax,ecx
mul ebx add eax,esi
lea ebx,[3*eax] push ebx
add esi,ebx push eax
add esi,eax push edx
add edi,ebx shr ecx,16
mov [.cscr],edi shr eax,16
mov [.czbuf],esi call horizontal_grd
pop edx
movzx ecx,word[.line_lenght] pop ecx
pop ebx
movsx ebx,word[.r1] add ebx,1
shl ebx,ROUND cmp ebx,edx
mov [.cr],ebx jle .lineas
movsx ebx,word[.g1]
shl ebx,ROUND
mov [.cg],ebx
movsx ebx,word[.b1]
shl ebx,ROUND
mov [.cb],ebx
movsx ebx,word[.z1]
shl ebx,ROUND
mov [.cz],ebx
if Ext >= SSE2
movups xmm1,[.cz]
end if
movsx ebx,word[.x1]
shl ebx,ROUND
mov [.ccoord],ebx ; .ccoord -> x coordinate
.draw_m_v:
mov edi,[.cscr]
mov esi,[.czbuf]
mov eax,[.ccoord]
sar eax,ROUND
lea ebx,[eax*3]
add edi,ebx
add esi,ebx
add esi,eax
if Ext >= SSE2
movd ebx,xmm1
else
mov ebx,[.cz]
end if
cmp [esi],ebx
jle @f
.draw_pixel
@@:
mov eax,[.delta]
mov ebx,[.xres3]
add [.ccoord],eax
mov eax,[.xres4]
add dword[.cscr],ebx ;SIZE_X*3 ;
add dword[.czbuf],eax ;SIZE_X*4
.d_m_v1:
.update_cur_var
dec ecx
jnz .draw_m_v
jmp .end_line
.more_horizon_l:
mov word[.line_lenght],ax
mov ax,[.x1]
cmp [.x2],ax
jge @f
.sort
@@:
mov bx,[.x2]
sub bx,[.x1]
movsx ebx,bx
cmp ebx,0;=======================
je .end_line
mov [.delta_x],ebx
mov ax,[.y2]
sub ax,[.y1]
cwde
shl eax,ROUND
cdq
idiv ebx
mov [.delta],eax
call .calc_delta
;calc begin values in screen and Z buffers
movsx ebx,word[.x1]
mov eax,ebx
add esi,ebx
lea ebx,[3*ebx]
add esi,ebx
add edi,ebx
mov [.cscr],edi
mov [.czbuf],esi
movzx ecx,word[.line_lenght]
movsx ebx,word[.r1]
shl ebx,ROUND
mov [.cr],ebx
movsx ebx,word[.g1]
shl ebx,ROUND
mov [.cg],ebx
movsx ebx,word[.b1]
shl ebx,ROUND
mov [.cb],ebx
movsx ebx,word[.z1]
shl ebx,ROUND
mov [.cz],ebx
if Ext >= SSE2
movups xmm1,[.cz]
end if
movsx ebx,word[.y1]
shl ebx,ROUND
mov [.ccoord],ebx ; .ccoord -> y coordinate
.draw_m_h:
mov edi,[.cscr]
mov esi,[.czbuf]
mov eax,[.ccoord] ; ccoord - cur y coordinate
sar eax,ROUND
mov ebx,[.xres] ;SIZE_X
mul ebx
add esi,eax
lea eax,[eax*3]
add esi,eax
add edi,eax
if Ext >= SSE2
movd ebx,xmm1
else
mov ebx,[.cz]
end if
cmp [esi],ebx
jle @f
.draw_pixel
@@:
mov eax,[.delta]
add [.ccoord],eax
add dword[.cscr],3 ;
add dword[.czbuf],4
.update_cur_var
dec ecx
jnz .draw_m_h
.end_line:
mov esp,ebp
ret 24
.calc_delta:
mov ax,[.z2]
sub ax,[.z1]
cwde
shl eax,ROUND
cdq
idiv ebx
mov [.dz],eax
mov ax,[.r2]
sub ax,[.r1]
cwde
shl eax,ROUND
cdq
idiv ebx
mov [.dr],eax
mov ax,[.g2]
sub ax,[.g1]
cwde
shl eax,ROUND
cdq
idiv ebx
mov [.dg],eax
mov ax,[.b2]
sub ax,[.b1]
cwde
shl eax,ROUND
cdq
idiv ebx
mov [.db],eax
if Ext=MMX | Ext = SSE
movq mm2,[.dz]
movq mm3,[.dg]
else if Ext >= SSE2
movups xmm0,[.dz]
movups xmm6,[.mask]
end if
ret ret
.mask:
dq 0xffffffff00ffffff
dq 0xffffffffffffffff
horizontal_grd: ; eax=x1 ebx=y1 ecx=x2
cmp ecx,eax
jg .m
xchg ecx,eax
.m:
sub ecx,eax
jnz .nn
add ecx,1
.nn:
movd edx,mm2
imul ebx,edx
add eax,ebx
movd edi,mm1
lea edi,[edi+eax*4]
push eax
push ebx
movd ebx,mm0
lea ebx,[ebx+eax*4]
.l:
; movss xmm4,xmm2 ; xmm2 - cur z
; cmpnltss xmm4,[ebx]
; movd eax,xmm4
; or eax,eax
; jnz @f
comiss xmm2,[ebx]
jng @f
movaps xmm4,xmm0 ; xmm0 - cur col
cvtps2dq xmm4,xmm4
packssdw xmm4,xmm4
packuswb xmm4,xmm4
movd [edi],xmm4
@@:
addss xmm2,xmm6
addps xmm0,xmm5
add edi,4
sub ecx,1
jnz .l
pop ebx
pop eax
ret

View File

@ -1,4 +1,14 @@
View3ds 0.072 - march 2021
1. New displaying model - texturing with bilinear filtering and transparency
simultanusly. Note that filtering is done only inside polygon. To better
quality of image there is a need to use floats coordinates of texture to pass
as arguments to single triangle rendering proc.
2. Optimizations.
3. SSE3 version runs correct on SSE2 cpus, but real phong, glass and
transparented texturing with filtering rendering models are disabled.
-----------------------------------------------------------------------------------
View3ds 0.071 - VIII 2020 View3ds 0.071 - VIII 2020
1. New displaying model - glass - it's two pass rendering. First pass calculates 1. New displaying model - glass - it's two pass rendering. First pass calculates
Z position of all front pixels, second render image with adding reflective Z position of all front pixels, second render image with adding reflective

View File

@ -1,7 +1,12 @@
View3ds 0.072 - tiny viewer to .3ds and .asc files with several graphics View3ds 0.073 - tiny viewer to .3ds and .asc files with several graphics
effects implementation. effects implementation.
What's new? What's new?
1. I introduced procedure for searching nonredundand edges.
2. Writing some info about object: vertices, triangles unique edges
count.
1. New displaying model - texturing with bilinear filtering and transparency 1. New displaying model - texturing with bilinear filtering and transparency
simultanusly. Note that filtering is done only inside polygon. To better simultanusly. Note that filtering is done only inside polygon. To better
quality of image there is a need to use floats coordinates of texture to pass quality of image there is a need to use floats coordinates of texture to pass
@ -26,21 +31,23 @@ Buttons description:
8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination). 8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination).
9. Blur: blur N times; N=0,1,2,3,4,5 9. Blur: blur N times; N=0,1,2,3,4,5
10.11,12,13. loseless operations (rotary 90, 180 degrees). 10.11,12,13. loseless operations (rotary 90, 180 degrees).
12. emboss: Do emboss effect( flat bumps ), use 'bumps deep' button to do edges more deep. 12. emboss: Do emboss effect( flat bumps ), use 'bumps deep' button to do edges
more deep.
13. fire: do motion blur ( looks like fire ). 13. fire: do motion blur ( looks like fire ).
14. move: changes meaning x,y,z +/- buttons -> obj: moving object, camr: moving camera, wave: x,y +/- increase, 14. move: changes meaning x,y,z +/- buttons -> obj: moving object, camr: moving
decrease wave effect frequency and amplitude. camera, wave: x,y +/- increase, decrease wave effect frequency and amplitude.
15. generate: Generates some objects: node, Thorn Crown, heart... 15. generate: Generates some objects: node, Thorn Crown, heart...
16. bumps: random, according to texture. 16. bumps: random, according to texture.
17. bumps deep -> create bumps deeper or lighter. 17. bumps deep -> create bumps deeper or lighter.
18. re-map tex -> re-map texture and bump map coordinates, to change spherical mapping 18. re-map tex -> re-map texture and bump map coordinates, to change spherical
around axle use 'xchg' and 'mirror' buttons, then press 're-map tex' button. mapping around axle use 'xchg' and 'mirror' buttons, then press 're-map tex' button.
19. bright + -> increase picture brightness. 19. bright + -> increase picture brightness.
20. bright - -> decrease picture brightness. 20. bright - -> decrease picture brightness.
21. wav effect -> do effect based sine function. 21. wav effect -> do effect based sine function.
22. editor -> setting editing option. If is "on" then red bars are draw according to each vertex, Pressing 22. editor -> setting editing option. If is "on" then red bars are draw according to each
and moving left mouse button (cursor must be on handler)- change vertex position. If left mouse button vertex, Pressing and moving left mouse button (cursor must be on handler)- change
is released apply current position. You may also decrease whole handlers count by enable culling (using vertex position. If left mouse button is released apply current position. You may also
appropriate button) - some back handlers become hidden. decrease whole handlers count by enable culling (using appropriate button) - some
back handlers become hidden.
Maciej Guba III 2021 Maciej Guba V 2021

View File

@ -1,11 +1,11 @@
; application : View3ds ver. 0.072 - tiny .3ds and .asc files viewer ; application : View3ds ver. 0.071 - 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.j.pl, http://macgub.co.pl ; web : http://macgub.co.pl, http://macgub.j.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.
@ -19,8 +19,8 @@
; 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
SIZE_X equ 500 SIZE_X equ 512
SIZE_Y equ 600 ; ///// I want definitely SIZE_Y equ 512 ; ///// I want definitely
TIMEOUT equ 10 ; ------ say: TIMEOUT equ 10 ; ------ say:
ROUND equ 10 ; \ @ @/ keep smiling every ROUND equ 10 ; \ @ @/ keep smiling every
TEX_X equ 512 ; texture width ; \ ./ / day. TEX_X equ 512 ; texture width ; \ ./ / day.
@ -61,9 +61,6 @@ START: ; start of execution
fstp [rsscale] fstp [rsscale]
pop ebx pop ebx
mov [x_start],dword 20 shl 16 + 20 ;eax
call alloc_buffer_mem call alloc_buffer_mem
call read_param call read_param
call read_from_disk ; read, if all is ok eax = 0 call read_from_disk ; read, if all is ok eax = 0
@ -86,14 +83,9 @@ START: ; start of execution
call read_asc call read_asc
jmp .opt jmp .opt
.malloc: .malloc:
if USE_LFN
call alloc_mem_for_tp call alloc_mem_for_tp
end if
call read_from_file call read_from_file
.opt: .opt:
call optimize_object1 ; proc in file b_procs.asm call optimize_object1 ; proc in file b_procs.asm
; set point(0,0,0) in center and calc all coords ; set point(0,0,0) in center and calc all coords
; to be in <-1.0,1.0> ; to be in <-1.0,1.0>
@ -111,19 +103,13 @@ START: ; start of execution
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
call do_edges_list
call draw_window call draw_window
;mov [draw_win_at_first],0 ;mov [draw_win_at_first],0
;mov eax,40 ; set events mask ;mov eax,40 ; set events mask
;mov ebx,1100000000000000000000000100111b ;mov ebx,1100000000000000000000000100111b
;int 0x40 ;int 0x40
if Ext >= SSE3
mov eax,1
cpuid
bt ecx,0 ; is sse3 on board?
jc @f
mov [max_dr_flg],12
@@:
end if
still: still:
cmp [edit_flag],1 cmp [edit_flag],1
@ -184,7 +170,7 @@ still:
mov ecx,-1 mov ecx,-1
int 0x40 int 0x40
mov eax,[procinfo+42] ; read params of window mov eax,[procinfo+42] ; read params of window
sub eax,115 sub eax,225
mov [size_x_var],ax mov [size_x_var],ax
shr ax,1 shr ax,1
mov [vect_x],ax mov [vect_x],ax
@ -259,29 +245,19 @@ still:
jne @f jne @f
.zoom_out: .zoom_out:
mov dword[scale],0.7 mov dword[scale],0.7
movss xmm0,[rsscale] fninit
mulss xmm0,[scale] fld [rsscale]
movss [rsscale],xmm0 fmul [scale]
; fninit fstp [rsscale]
; fld [rsscale]
; fmul [scale]
; fstp [rsscale]
@@: @@:
cmp ah,6 ; ah = 6 -> scale+ cmp ah,6 ; ah = 6 -> scale+
jne @f jne @f
.zoom_in: .zoom_in:
mov dword[scale],1.3 mov dword[scale],1.3
movss xmm0,[rsscale] fninit
mulss xmm0,[scale] fld [rsscale]
movss [rsscale],xmm0 fmul [scale]
fstp [rsscale]
; fninit
; fld [rsscale]
; fmul [scale]
; fstp [rsscale]
@@: @@:
cmp ah,9 ; lights random ; 'flat' 0 cmp ah,9 ; lights random ; 'flat' 0
jne .next_m5 ; 'grd ' 1 jne .next_m5 ; 'grd ' 1
@ -291,15 +267,7 @@ still:
call copy_lights call copy_lights
end if end if
call do_color_buffer ; intit color_map ; 'tex ' 4 call do_color_buffer ; intit color_map ; 'tex ' 4
; cmp [emboss_flag],1 ; 'pos ' 5
; je @f ; 'dots' 6
; cmp [dr_flag],8
; jge @f
; cmp [dr_flag],2 ; 'txgr' 7
; jl .next_m5 ; '2tex' 8
; cmp [dr_flag],3 ; 'btex' 9
; jg .next_m5
; @@:
call init_envmap2 ; update env map if shading model = environment or bump call init_envmap2 ; update env map if shading model = environment or bump
.next_m5: .next_m5:
cmp ah,11 cmp ah,11
@ -360,7 +328,8 @@ still:
call init_triangles_normals2 call init_triangles_normals2
call init_point_normals call init_point_normals
call calc_bumpmap_coords ; bump and texture mapping call calc_bumpmap_coords ; bump and texture mapping
call do_edges_list
call write_info
.next_m2: .next_m2:
cmp ah,19 cmp ah,19
je @f je @f
@ -547,6 +516,10 @@ still:
jne @f jne @f
call clrscr ; clear the screen call clrscr ; clear the screen
@@: @@:
; cmp [catmull_flag],1 ;non sort if Catmull = on
; je .no_sort
; 64 indexes call sort_triangles
.no_sort:
cmp [dr_flag],7 ; fill if 2tex and texgrd cmp [dr_flag],7 ; fill if 2tex and texgrd
jge @f jge @f
cmp [catmull_flag],0 ;non fill if Catmull = off cmp [catmull_flag],0 ;non fill if Catmull = off
@ -568,6 +541,11 @@ still:
call draw_handlers call draw_handlers
; call edit ; call edit
.no_edit: .no_edit:
.blurrr: .blurrr:
@ -595,6 +573,7 @@ still:
@@: @@:
cmp [inc_bright_flag],0 ; increase brightness cmp [inc_bright_flag],0 ; increase brightness
je .no_inc_bright je .no_inc_bright
movzx ebx,[inc_bright_flag] movzx ebx,[inc_bright_flag]
@ -727,9 +706,8 @@ end if
mov eax,7 ; put image mov eax,7 ; put image
mov ebx,[screen_ptr] mov ebx,[screen_ptr]
mov ecx,[size_y_var] mov ecx,[size_y_var]
; mov ecx,SIZE_X shl 16 + SIZE_Y mov edx,[offset_y]
mov edx,[offset_y] ;5 shl 16 + 25 cmp [dr_flag],11
cmp [dr_flag],12
jge .ff jge .ff
int 0x40 int 0x40
jmp .f jmp .f
@ -1235,13 +1213,6 @@ init_envmap2: ; do env_map using many light sources
push ax push ax
mov al,byte[esi+12] ; r mov al,byte[esi+12] ; r
push ax push ax
; pxor xmm1,xmm1
; movd xmm0,[esi+12]
; punpckhbw xmm0,xmm1
; sub esp,8
; movq [esp],xmm0
mov al,byte[esi+20] ; b max color mov al,byte[esi+20] ; b max color
push ax push ax
mov al,byte[esi+19] ; g mov al,byte[esi+19] ; g
@ -1418,7 +1389,7 @@ do_color_buffer: ; do color buffer for Gouraud, flat shading
mov esp,ebp mov esp,ebp
pop ebp pop ebp
ret ret
if Ext >= SSE2 if Ext >= SSE3
init_point_normals: init_point_normals:
.z equ dword [ebp-8] .z equ dword [ebp-8]
.y equ dword [ebp-12] .y equ dword [ebp-12]
@ -1426,6 +1397,7 @@ init_point_normals:
.point_number equ dword [ebp-28] .point_number equ dword [ebp-28]
.hit_faces equ dword [ebp-32] .hit_faces equ dword [ebp-32]
fninit
push ebp push ebp
mov ebp,esp mov ebp,esp
sub esp,64 sub esp,64
@ -1466,25 +1438,19 @@ init_point_normals:
jne .ipn_check_face jne .ipn_check_face
cvtsi2ss xmm6,.hit_faces cvtsi2ss xmm6,.hit_faces
movaps xmm7,.x movaps xmm7,.x
rcpss xmm6,xmm6 rcpss xmm6,xmm6
shufps xmm6,xmm6,11000000b shufps xmm6,xmm6,11000000b
mulps xmm7,xmm6 mulps xmm7,xmm6
movaps xmm6,xmm7
mulps xmm6,xmm6
andps xmm6,[zero_hgst_dd]
haddps xmm6,xmm6
haddps xmm6,xmm6
rsqrtps xmm6,xmm6
mulps xmm7,xmm6
movlps [edi],xmm7 movlps [edi],xmm7
movhlps xmm7,xmm7 movhlps xmm7,xmm7
movss [edi+8],xmm7 movss [edi+8],xmm7
call normalize_vector
; movaps xmm6,xmm7
; mulps xmm6,xmm6
; andps xmm6,[zero_hgst_dd]
; haddps xmm6,xmm6
; haddps xmm6,xmm6
; rsqrtps xmm6,xmm6
; mulps xmm7,xmm6
; movlps [edi],xmm7
; movhlps xmm7,xmm7
; movss [edi+8],xmm7
add edi,12 add edi,12
inc .point_number inc .point_number
mov edx,.point_number mov edx,.point_number
@ -1764,13 +1730,15 @@ draw_triangles:
end if end if
cmp [dr_flag],11
je .draw_smooth_line
mov esi,[triangles_ptr] mov esi,[triangles_ptr]
mov ecx,[triangles_count_var] mov ecx,[triangles_count_var]
.again_dts: .again_dts:
push ecx push ecx
mov ebp,[points_translated_ptr] mov ebp,[points_translated_ptr]
if Ext = NON if Ext >= SSE2
mov eax,dword[esi] mov eax,dword[esi]
mov [point_index1],eax mov [point_index1],eax
lea eax,[eax*3] lea eax,[eax*3]
@ -1814,7 +1782,7 @@ draw_triangles:
mov [zz3],ax mov [zz3],ax
else else
movq mm0,[esi] ; don't know MMX movq mm0,[esi] ; don't know MMX
movq qword[point_index1],mm0 mov qword[point_index1],mm0
; shr eax,16 ; shr eax,16
; mov [point_index2],ax ; mov [point_index2],ax
mov eax,dword[esi+8] mov eax,dword[esi+8]
@ -1890,19 +1858,17 @@ end if
lea eax,[eax*3] lea eax,[eax*3]
shl eax,2 shl eax,2
add eax,[points_normals_rot_ptr] add eax,[points_normals_rot_ptr]
bt dword[eax+8],+31
jc .no_culling
; lea eax,[eax+point_normals_rotated] ; lea eax,[eax+point_normals_rotated]
; fld dword[eax+8] ; ***************************** fld dword[eax+8] ; *****************************
; ftst ; CHECKING OF Z COOFICIENT OF ftst ; CHECKING OF Z COOFICIENT OF
; fstsw ax ; NORMAL VECTOR fstsw ax ; NORMAL VECTOR
; sahf sahf
; jb @f jb @f
; ffree st ffree st
loop @b loop @b
jmp .end_draw ; non visable jmp .end_draw ; non visable
; @@: @@:
; ffree st ;is visable ffree st ;is visable
.no_culling: .no_culling:
cmp [dr_flag],0 ; draw type flag cmp [dr_flag],0 ; draw type flag
je .flat_draw je .flat_draw
@ -1931,7 +1897,6 @@ end if
je .glass je .glass
cmp [dr_flag],14 cmp [dr_flag],14
je .glass_tex je .glass_tex
end if ; **************** end if ; ****************
mov esi,point_index3 ; do Gouraud shading mov esi,point_index3 ; do Gouraud shading
mov ecx,3 mov ecx,3
@ -1940,28 +1905,19 @@ end if
shl eax,2 shl eax,2
lea eax,[eax*3] lea eax,[eax*3]
add eax,[points_normals_rot_ptr] add eax,[points_normals_rot_ptr]
if Ext < SSE
; texture x=(rotated point normal -> x * 255)+255 ; texture x=(rotated point normal -> x * 255)+255
fld dword[eax] ; x cooficient of normal vector fld dword[eax] ; x cooficient of normal vector
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp1] fistp [temp1]
; texture y=(rotated point normal -> y * 255)+255 ; texture y=(rotated point normal -> y * 255)+255
fld dword[eax+4] ; y cooficient fld dword[eax+4] ; y cooficient
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp2] fistp [temp2]
mov eax,[temp2] mov eax,[temp2]
mov ebx,[temp1] mov ebx,[temp1]
else
movlps xmm0,[eax]
mulps xmm0,[correct_texf]
addps xmm0,[correct_texf]
cvtps2dq xmm0,xmm0
movd eax,xmm0
psrldq xmm0,4
movd ebx,xmm0
end if
and ebx,0xfffffff and ebx,0xfffffff
shl eax,TEX_SHIFT shl eax,TEX_SHIFT
add eax,ebx add eax,ebx
@ -2066,31 +2022,28 @@ end if
mov eax,[point_index1] mov eax,[point_index1]
mov ebx,[point_index2] mov ebx,[point_index2]
mov ecx,[point_index3] mov ecx,[point_index3]
; shl eax,2 shl eax,2
imul eax,[i12] shl ebx,2
imul ebx,[i12] shl ecx,2
imul ecx,[i12] lea eax,[eax*3] ;+point_normals_rotated]
; shl ebx,2
; shl ecx,2
; lea eax,[eax*3] ;+point_normals_rotated]
add eax,[points_normals_rot_ptr] add eax,[points_normals_rot_ptr]
; lea ebx,[ebx*3] ;+point_normals_rotated] lea ebx,[ebx*3] ;+point_normals_rotated]
add ebx,[points_normals_rot_ptr] add ebx,[points_normals_rot_ptr]
; lea ecx,[ecx*3] ;+point_normals_rotated] lea ecx,[ecx*3] ;+point_normals_rotated]
add ecx,[points_normals_rot_ptr] add ecx,[points_normals_rot_ptr]
fld dword[eax] ; x cooficient of normal vector fld dword[eax] ; x cooficient of normal vector
fadd dword[ebx] fadd dword[ebx]
fadd dword[ecx] fadd dword[ecx]
fidiv [i3] fidiv [i3]
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp1] ;dword[esp-4] ; x temp variables fistp [temp1] ;dword[esp-4] ; x temp variables
fld dword[eax+4] ; y cooficient of normal vector fld dword[eax+4] ; y cooficient of normal vector
fadd dword[ebx+4] fadd dword[ebx+4]
fadd dword[ecx+4] fadd dword[ecx+4]
fidiv [i3] fidiv [i3]
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp2] ;dword[esp-8] ; y fistp [temp2] ;dword[esp-8] ; y
mov edx,[temp2] ;dword[esp-8] mov edx,[temp2] ;dword[esp-8]
and edx,0xfffffff and edx,0xfffffff
@ -2147,12 +2100,17 @@ end if
lea eax,[eax*3] lea eax,[eax*3]
shl eax,2 shl eax,2
add eax,[points_normals_rot_ptr] ;point_normals_rotated add eax,[points_normals_rot_ptr] ;point_normals_rotated
movlps xmm0,[eax] ; texture x=(rotated point normal -> x * 255)+255
mulps xmm0,[correct_texf] fld dword[eax]
addps xmm0,[correct_texf] fimul [correct_tex]
cvtps2dq xmm0,xmm0 fiadd [correct_tex]
packssdw xmm0,xmm0 fistp word[edi]
movd [edi],xmm0 ; texture y=(rotated point normal -> y * 255)+255
fld dword[eax+4]
fimul [correct_tex]
fiadd [correct_tex]
fistp word[edi+2]
add edi,4 add edi,4
add esi,4 add esi,4
loop @b loop @b
@ -2192,8 +2150,8 @@ end if
fld1 fld1
faddp faddp
fmulp fmulp
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp word[edi] fistp word[edi]
mov word[edi+2],0 mov word[edi+2],0
; fistp word[edi+2] ; fistp word[edi+2]
@ -2244,16 +2202,18 @@ end if
mov eax,dword[esi] mov eax,dword[esi]
lea eax,[eax*3] lea eax,[eax*3]
shl eax,2 shl eax,2
; imul eax,[i12]
add eax,[points_normals_rot_ptr] ;point_normals_rotated add eax,[points_normals_rot_ptr] ;point_normals_rotated
; texture x=(rotated point normal -> x * 255)+255 ; texture x=(rotated point normal -> x * 255)+255
fld dword[eax]
fimul [correct_tex]
fiadd [correct_tex]
fistp word[edi]
; texture y=(rotated point normal -> y * 255)+255
fld dword[eax+4]
fimul [correct_tex]
fiadd [correct_tex]
fistp word[edi+2]
movlps xmm0,[eax]
mulps xmm0,[correct_texf]
addps xmm0,[correct_texf]
cvtps2dq xmm0,xmm0
packssdw xmm0,xmm0
movd [edi],xmm0
add edi,4 add edi,4
add esi,4 add esi,4
loop @b loop @b
@ -2265,11 +2225,17 @@ end if
mov esi,[point_index2] mov esi,[point_index2]
shl esi,2 shl esi,2
add esi,tex_points add esi,tex_points
; lea esi,[esi*3]
; lea esi,[points+2+esi*2]
push dword[esi] push dword[esi]
; push dword[xx2]
mov esi,[point_index1] mov esi,[point_index1]
shl esi,2 shl esi,2
add esi,tex_points add esi,tex_points
; lea esi,[esi*3]
; lea esi,[points+2+esi*2]
push dword[esi] push dword[esi]
; push dword[xx1]
mov eax,dword[xx1] mov eax,dword[xx1]
ror eax,16 ror eax,16
@ -2377,33 +2343,24 @@ end if
lea edx,[ecx*3] lea edx,[ecx*3]
push word[edx*2+xx1-2] ; zz1 ,2 ,3 push word[edx*2+xx1-2] ; zz1 ,2 ,3
; fninit fninit
mov eax,dword[esi] mov eax,dword[esi]
shl eax,2 shl eax,2
lea eax,[eax*3] ;+point_normals_rotated] lea eax,[eax*3] ;+point_normals_rotated]
add eax,[points_normals_rot_ptr] add eax,[points_normals_rot_ptr]
if Ext < SSE
; texture x=(rotated point normal -> x * 255)+255 ; texture x=(rotated point normal -> x * 255)+255
fld dword[eax] ; x cooficient of normal vector fld dword[eax] ; x cooficient of normal vector
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp1] ;word[ebp-2] fistp [temp1] ;word[ebp-2]
; texture y=(rotated point normal -> y * 255)+255 ; texture y=(rotated point normal -> y * 255)+255
fld dword[eax+4] ; y cooficient fld dword[eax+4] ; y cooficient
fmul dword[correct_texf] fimul [correct_tex]
fadd dword[correct_texf] fiadd [correct_tex]
fistp [temp2] ;word[ebp-4] fistp [temp2] ;word[ebp-4]
mov eax,[temp2]
mov ebx,[temp1] mov eax,[temp2] ;word[ebp-4]
else mov ebx,[temp1] ;word[ebp-2]
movlps xmm0,[eax]
mulps xmm0,[correct_texf]
addps xmm0,[correct_texf]
cvtps2dq xmm0,xmm0
movd eax,xmm0
psrldq xmm0,4
movd ebx,xmm0
end if
and ebx,0xfffffff ; some onjects need thid 'and' and ebx,0xfffffff ; some onjects need thid 'and'
shl eax,TEX_SHIFT shl eax,TEX_SHIFT
add eax,ebx add eax,ebx
@ -2471,22 +2428,16 @@ end if
shl eax,2 shl eax,2
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
movlps xmm0,[eax] fld dword[eax]
mulps xmm0,[correct_texf] fimul [correct_tex]
addps xmm0,[correct_texf] fiadd [correct_tex]
cvtps2dq xmm0,xmm0 fistp word[edi]
packssdw xmm0,xmm0
movd [edi],xmm0
; fld dword[eax]
; fmul dword[correct_texf]
; fadd dword[correct_texf]
; fistp word[edi]
; texture y=(rotated point normal -> y * 255)+255 ; texture y=(rotated point normal -> y * 255)+255
; fld dword[eax+4] fld dword[eax+4]
; fmul dword[correct_texf] fimul [correct_tex]
; fadd dword[correct_texf] 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 edi,4
add esi,4 add esi,4
@ -2537,15 +2488,7 @@ end if
lea eax,[eax*3] lea eax,[eax*3]
shl eax,2 shl eax,2
add eax,[points_normals_rot_ptr] add eax,[points_normals_rot_ptr]
if Ext >= SSE
; texture x=(rotated point normal -> x * 255)+255 ; texture x=(rotated point normal -> x * 255)+255
movlps xmm0,[eax]
mulps xmm0,[correct_texf]
addps xmm0,[correct_texf]
cvtps2dq xmm0,xmm0
packssdw xmm0,xmm0
movd [edi],xmm0
else
fld dword[eax] fld dword[eax]
fimul [correct_tex] fimul [correct_tex]
fiadd [correct_tex] fiadd [correct_tex]
@ -2555,7 +2498,7 @@ end if
fimul [correct_tex] fimul [correct_tex]
fiadd [correct_tex] fiadd [correct_tex]
fistp word[edi+2] fistp word[edi+2]
end if
add edi,4 add edi,4
add esi,4 add esi,4
loop @b loop @b
@ -2596,140 +2539,6 @@ end if
jmp .end_draw jmp .end_draw
.draw_smooth_line:
mov esi,point_index3
mov ecx,3
.again_line_param:
mov eax,dword[esi]
shl eax,2
lea eax,[eax*3]
add eax,[points_normals_rot_ptr]
if Ext>=SSE2
movlps xmm0,[eax]
mulps xmm0,[correct_texf]
addps xmm0,[correct_texf]
cvtps2dq xmm0,xmm0
movd eax,xmm0
psrldq xmm0,4
movd ebx,xmm0
else if
; texture ;x=(rotated point normal -> x * 255)+255
fld dword[eax] ; x cooficient of normal vector
fmul dword[correct_texf]
fadd dword[correct_texf]
fistp [temp1] ;word[esp-2]
; texture y=(rotated point normal -> y * 255)+255
fld dword[eax+4] ; y cooficient
fmul dword[correct_texf]
fadd dword[correct_texf]
fistp [temp2] ;word[esp-4]
mov eax,[temp2] ;word[esp-4]
mov ebx,[temp1] ;word[esp-2]
end if
and ebx,0xfffffff
shl eax,TEX_SHIFT
add eax,ebx
lea eax,[eax*3+color_map]
mov eax,dword[eax]
lea ebx,[ecx-1]
shl ebx,2
mov [ebx+col1],eax
sub esi,4
dec ecx
jnz .again_line_param
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col1]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz1]
push [yy1]
push [xx1]
mov eax,[col2]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz2]
push [yy2]
push [xx2]
call smooth_line
@@:
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col1]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz1]
push [yy1]
push [xx1]
mov eax,[col3]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz3]
push [yy3]
push [xx3]
call smooth_line
@@:
mov edi,[screen_ptr]
mov esi,[Zbuffer_ptr]
mov eax,[col3]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz3]
push [yy3]
push [xx3]
mov eax,[col2]
movzx bx,al
push bx ; b
movzx bx,ah
push bx
rol eax,16
xor ah,ah
push ax
push [zz2]
push [yy2]
push [xx2]
call smooth_line
jmp .end_draw
@@:
if Ext >= SSE3 if Ext >= SSE3
.r_phg: .r_phg:
@ -2789,7 +2598,6 @@ if Ext >= SSE3
jmp .end_draw jmp .end_draw
.glass: .glass:
movd xmm5,[size_y_var] movd xmm5,[size_y_var]
punpcklwd xmm5,[the_zero] punpcklwd xmm5,[the_zero]
pshufd xmm5,xmm5,01110011b pshufd xmm5,xmm5,01110011b
@ -2843,6 +2651,7 @@ if Ext >= SSE3
call glass_tri call glass_tri
jmp .end_draw jmp .end_draw
.glass_tex: .glass_tex:
movd xmm5,[size_y_var] movd xmm5,[size_y_var]
punpcklwd xmm5,[the_zero] punpcklwd xmm5,[the_zero]
@ -2917,27 +2726,133 @@ if Ext >= SSE3
call glass_tex_tri call glass_tex_tri
jmp .end_draw
end if end if
.end_draw: .end_draw:
pop esi pop esi
add esi,12 add esi,12
pop ecx pop ecx
sub ecx,1 dec ecx
jnz .again_dts jnz .again_dts
ret ret
.draw_smooth_line:
mov esi,[edges_ptr]
xor ecx,ecx
.again_s_line:
push ecx
push esi
mov ecx,2
.aga_n:
mov eax,[esi]
shl eax,2
lea eax,[eax*3]
add eax,[points_normals_rot_ptr]
movups xmm0,[eax]
xorps xmm1,xmm1
mov edx,lights_aligned
.again_cc:
movaps xmm3,xmm0 ;.cnv
mulps xmm3,[edx]
andps xmm3,[zero_hgst_dd]
; haddps xmm3,xmm3
; haddps xmm3,xmm3 ; xmm3 - dot pr
movhlps xmm2,xmm3
addps xmm3,xmm2
movdqa xmm2,xmm3
shufps xmm2,xmm2,01010101b
addps xmm3,xmm2
shufps xmm3,xmm3,0
movaps xmm6,xmm3 ;xmm7
mulps xmm6,xmm6
mulps xmm6,xmm6
mulps xmm6,xmm6
mulps xmm6,xmm6
mulps xmm6,xmm6
mulps xmm6,[edx+48]
movaps xmm7,xmm3
mulps xmm7,[edx+16]
addps xmm7,xmm6
addps xmm7,[edx+32]
minps xmm7,[mask_255f] ; global
maxps xmm1,xmm7
add edx,64 ; size of one light in aligned list
cmp edx,lights_aligned_end
jl .again_cc
sub esp,16
movups [esp],xmm1
add esi,4
loop .aga_n
movups xmm0,[esp]
movups xmm1,[esp+16]
add esp,32
sub esi,8
mov ecx,[esi]
mov edx,[esi+4]
imul ecx,[i6]
imul edx,[i6]
add ecx,[points_translated_ptr]
add edx,[points_translated_ptr]
movd xmm7,[ecx]
movhps xmm7,[edx]
pshufd xmm7,xmm7,11101000b
movdqa xmm6,xmm7
movd xmm5,[size_y_var]
pshuflw xmm5,xmm5,00010001b
pcmpgtw xmm7,xmm5
pcmpgtw xmm6,[the_zero]
pxor xmm7,xmm6
pmovmskb eax,xmm7
cmp al,-1
jnz .skp
mov eax,[esi]
mov ebx,[esi+4]
imul eax,[i12]
imul ebx,[i12]
add eax,[points_rotated_ptr]
add ebx,[points_rotated_ptr]
movss xmm2,[eax+8]
movss xmm3,[ebx+8]
movzx eax,word[ecx]
movzx ebx,word[ecx+2]
movzx ecx,word[edx]
movzx edx,word[edx+2]
emms
movd mm1,[screen_ptr]
movd mm0,[Zbuffer_ptr]
movzx esi,word[size_x_var]
movd mm2,esi
push ebp
call line_grd
pop ebp
.skp:
pop esi
pop ecx
add esi,8
inc ecx
cmp ecx,[edges_count]
jnz .again_s_line
ret
@ -3071,8 +2986,8 @@ ret
fill_Z_buffer: fill_Z_buffer:
mov eax,0x70000000 mov eax,0x70000000
cmp [dr_flag],12 cmp [dr_flag],11
jne @f jl @f
mov eax,60000.1 mov eax,60000.1
@@: @@:
mov edi,[Zbuffer_ptr] mov edi,[Zbuffer_ptr]
@ -3207,11 +3122,7 @@ read_from_file:
xor ebp,ebp xor ebp,ebp
mov [points_count_var],0 mov [points_count_var],0
mov [triangles_count_var],0 mov [triangles_count_var],0
if USE_LFN = 0
mov esi,SourceFile
else
mov esi,[fptr] mov esi,[fptr]
end if
cmp [esi],word 4D4Dh cmp [esi],word 4D4Dh
jne .exit ;Must be legal .3DS file jne .exit ;Must be legal .3DS file
; cmp dword[esi+2],EndFile-SourceFile ; cmp dword[esi+2],EndFile-SourceFile
@ -3298,17 +3209,14 @@ read_from_file:
;mov edi,triangles ;mov edi,triangles
@@: @@:
movzx eax,word[esi] movzx eax,word[esi]
add eax,ebp
stosd stosd
movzx eax,word[esi+2] movzx eax,word[esi+2]
add eax,ebp
stosd stosd
movzx eax,word[esi+4] movzx eax,word[esi+4]
add eax,ebp
stosd stosd
; add dword[edi-12],ebp add dword[edi-12],ebp
; 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
@ -3337,6 +3245,14 @@ alloc_mem_for_tp:
int 0x40 ; -> allocate memory to triangles int 0x40 ; -> allocate memory to triangles
mov [triangles_ptr], eax ; -> eax = pointer to allocated mem mov [triangles_ptr], eax ; -> eax = pointer to allocated mem
mov eax, 68
mov ecx,[triangles_count_var]
imul ecx,[i36]
mov edx,[edges_ptr]
int 0x40 ; -> allocate memory to triangles
mov [edges_ptr], eax ; -> eax = pointer to allocated mem
; ststic memory ; ststic memory
mov eax, 68 mov eax, 68
@ -3410,7 +3326,6 @@ read_from_disk:
@@: @@:
; eax = 0 -> ok file loaded ; eax = 0 -> ok file loaded
ret ret
read_param: read_param:
mov esi,I_Param mov esi,I_Param
cmp dword[esi],0 cmp dword[esi],0
@ -3482,6 +3397,64 @@ buttons: ; draw some buttons (all but navig
cmp byte[edi],-1 cmp byte[edi],-1
jnz .again jnz .again
ret ret
write_info:
mov eax,13
mov bx,[size_x_var]
shl ebx,16
add ebx,120*65536+70 ; [x start] *65536 + [y start]
mov ecx,30 shl 16 + 100
xor edx,edx
int 0x40
xor esi,esi
emms
movd mm7,esi
.nxxx:
push esi
movd mm7,esi
mov eax,4 ; function 4 : write text to window
movzx ebx,word[size_x_var]
shl ebx,16
add ebx,120*65536 ; [x start] *65536 + [y start]
mov bx,si
shl bx,3
add ebx,30
mov ecx,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB )
movd edx,mm7
shl edx,2
add edx,lab_vert ; pointer to text beginning
mov esi,lab_vert_end-lab_vert ; text length
int 0x40
movd esi,mm7
mov eax,[points_count_var+esi]
mov ecx,10
.dc:
xor edx,edx
mov edi,10
div edi
add dl,30h
mov [STRdata+ecx-1],dl
loop .dc
mov eax,4 ; function 4 : write text to window
mov bx,[size_x_var]
add ebx,120
shl ebx,16
mov bx,si ; [x start] *65536 + [y start]
shl bx,3
add bx,45
mov ecx,0x00ddeeff
mov edx,STRdata ; pointer to text beginning
mov esi,10 ; text length
int 40h
pop esi
add esi,4
cmp esi,12
jnz .nxxx
ret
; ********************************************* ; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ******** ; ******* WINDOW DEFINITIONS AND DRAW ********
; ********************************************* ; *********************************************
@ -3499,7 +3472,7 @@ ret
;ebx - [x start] *65536 + [x size] ;ebx - [x start] *65536 + [x size]
;ecx - [y start] *65536 + [y size] ;ecx - [y start] *65536 + [y size]
mov bx,[size_x_var] mov bx,[size_x_var]
add bx,115 add bx,225
mov cx,[size_y_var] mov cx,[size_y_var]
add cx,30 add cx,30
; @@: ; @@:
@ -3511,6 +3484,16 @@ ret
.Y_ADD equ 2 ;-> offset of 'add vector' buttons .Y_ADD equ 2 ;-> offset of 'add vector' buttons
; mov eax,47
; mov ebx,0000000000111000000000000000b
; mov ecx,[points_count_var]
; movzx edx,word[size_x_var]
; shl edx,16
; add edx,130*65536+60 ; [x start] *65536 + [y start]
; mov esi,0x00ddeeff ; font 1 & color ( 0xF0RRGGBB )
; int 0x40
call write_info
; ADD VECTOR LABEL ; add vector buttons - 30 ++ ; ADD VECTOR LABEL ; add vector buttons - 30 ++
mov eax,4 ; function 4 : write text to window mov eax,4 ; function 4 : write text to window
movzx ebx,word[size_x_var] movzx ebx,word[size_x_var]