possible smooth buffer resizing,

fix and clean code,
fix and update examples

git-svn-id: svn://kolibrios.org@8069 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA
2020-09-19 19:57:00 +00:00
parent b60e6d45cf
commit d3fd66f14b
21 changed files with 465 additions and 491 deletions

View File

@@ -25,12 +25,12 @@ pushad
mov eax,[p1]
mov ebx,[p2]
mov ecx,[ebx+offs_zbup_y]
cmp [eax+offs_zbup_y], ecx ;if (p1.y > p2.y)
mov ecx,[ebx+ZBufferPoint.y]
cmp [eax+ZBufferPoint.y], ecx ;if (p1.y > p2.y)
jg @f
jl .end_0 ;if (p1.y != p2.y)
mov ecx,[ebx+offs_zbup_x]
cmp [eax+offs_zbup_x], ecx ;if (p1.x > p2.x)
mov ecx,[ebx+ZBufferPoint.x]
cmp [eax+ZBufferPoint.x], ecx ;if (p1.x > p2.x)
jle .end_0 ;if (p1.x <= p2.x)
@@: ;if (p1.y > p2.y || (p1.y == p2.y && p1.x > p2.x))
mov [p1],ebx
@@ -38,41 +38,41 @@ pushad
.end_0:
mov eax,[zb]
mov edx,[eax+offs_zbuf_xsize]
mov edx,[eax+ZBuffer.xsize]
mov [sx],edx
mov ecx,[p1]
mov edi,[eax+offs_zbuf_linesize]
imul edi,[ecx+offs_zbup_y]
mov edx,[ecx+offs_zbup_x]
mov edi,[eax+ZBuffer.linesize]
imul edi,[ecx+ZBufferPoint.y]
mov edx,[ecx+ZBufferPoint.x]
imul edx,PSZB
add edi,edx
add edi,[eax+offs_zbuf_pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
add edi,[eax+ZBuffer.pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
if INTERP_Z eq 1
mov edx,[ecx+offs_zbup_y]
mov edx,[ecx+ZBufferPoint.y]
imul edx,[sx]
add edx,[ecx+offs_zbup_x]
add edx,[ecx+ZBufferPoint.x]
shl edx,1
add edx,[eax+offs_zbuf_zbuf]
add edx,[eax+ZBuffer.zbuf]
mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
mov edx,[ecx+offs_zbup_z]
mov edx,[ecx+ZBufferPoint.z]
mov [z],edx ;z = p1.z
end if
mov ebx,[p2]
mov eax,[ebx+offs_zbup_x]
sub eax,[ecx+offs_zbup_x]
mov eax,[ebx+ZBufferPoint.x]
sub eax,[ecx+ZBufferPoint.x]
mov [d_x],eax ;d_x = p2.x - p1.x
mov eax,[ebx+offs_zbup_y]
sub eax,[ecx+offs_zbup_y]
mov eax,[ebx+ZBufferPoint.y]
sub eax,[ecx+ZBufferPoint.y]
mov [d_y],eax ;d_y = p2.y - p1.y
mov eax,[ecx+offs_zbup_r]
mov eax,[ecx+ZBufferPoint.r]
shl eax,8
mov [r],eax ;r = p1.r << 8
mov eax,[ecx+offs_zbup_g]
mov eax,[ecx+ZBufferPoint.g]
shl eax,8
mov [g],eax ;g = p1.g << 8
mov eax,[ecx+offs_zbup_b]
mov eax,[ecx+ZBufferPoint.b]
shl eax,8
mov [b],eax ;b = p1.b << 8
@@ -134,12 +134,12 @@ local .mb_2
mov ebx,[p1]
mov ecx,[p2]
if INTERP_Z eq 1
mov eax,[ecx+offs_zbup_z]
cmp eax,[ebx+offs_zbup_z]
mov eax,[ecx+ZBufferPoint.z]
cmp eax,[ebx+ZBufferPoint.z]
jg .mz_0
je .mz_1
;if(p2.z<p1.z)
sub eax,[ebx+offs_zbup_z]
sub eax,[ebx+ZBufferPoint.z]
neg eax
inc eax
xor edx,edx
@@ -148,7 +148,7 @@ if INTERP_Z eq 1
inc eax
jmp .mz_2
.mz_0:
sub eax,[ebx+offs_zbup_z]
sub eax,[ebx+ZBufferPoint.z]
xor edx,edx
div dword[n]
jmp .mz_2
@@ -159,12 +159,12 @@ if INTERP_Z eq 1
end if
;ebx=&p1, ecx=&p2
mov eax,[ecx+offs_zbup_r]
cmp eax,[ebx+offs_zbup_r]
mov eax,[ecx+ZBufferPoint.r]
cmp eax,[ebx+ZBufferPoint.r]
jg .mr_0
je .mr_1
;if(p2.r<p1.r)
sub eax,[ebx+offs_zbup_r]
sub eax,[ebx+ZBufferPoint.r]
neg eax
inc eax
shl eax,8
@@ -174,7 +174,7 @@ end if
inc eax
jmp .mr_2
.mr_0:
sub eax,[ebx+offs_zbup_r]
sub eax,[ebx+ZBufferPoint.r]
shl eax,8
xor edx,edx
div dword[n]
@@ -184,12 +184,12 @@ end if
.mr_2:
mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
mov eax,[ecx+offs_zbup_g]
cmp eax,[ebx+offs_zbup_g]
mov eax,[ecx+ZBufferPoint.g]
cmp eax,[ebx+ZBufferPoint.g]
jg .mg_0
je .mg_1
;if(p2.g<p1.g)
sub eax,[ebx+offs_zbup_g]
sub eax,[ebx+ZBufferPoint.g]
neg eax
inc eax
shl eax,8
@@ -199,7 +199,7 @@ end if
inc eax
jmp .mg_2
.mg_0:
sub eax,[ebx+offs_zbup_g]
sub eax,[ebx+ZBufferPoint.g]
shl eax,8
xor edx,edx
div dword[n]
@@ -209,12 +209,12 @@ end if
.mg_2:
mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
mov eax,[ecx+offs_zbup_b]
cmp eax,[ebx+offs_zbup_b]
mov eax,[ecx+ZBufferPoint.b]
cmp eax,[ebx+ZBufferPoint.b]
jg .mb_0
je .mb_1
;if(p2.b<p1.b)
sub eax,[ebx+offs_zbup_b]
sub eax,[ebx+ZBufferPoint.b]
neg eax
inc eax
shl eax,8
@@ -224,7 +224,7 @@ end if
inc eax
jmp .mb_2
.mb_0:
sub eax,[ebx+offs_zbup_b]
sub eax,[ebx+ZBufferPoint.b]
shl eax,8
xor edx,edx
div dword[n]