1) fix rgb interpolation and z-buffer
2) add function glClear git-svn-id: svn://kolibrios.org@5159 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -51,6 +51,7 @@ if INTERP_Z eq 1
|
||||
mov edx,[ecx+offs_zbup_y]
|
||||
imul edx,[sx]
|
||||
add edx,[ecx+offs_zbup_x]
|
||||
shl edx,1
|
||||
add edx,[eax+offs_zbuf_zbuf]
|
||||
mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
|
||||
mov edx,[ecx+offs_zbup_z]
|
||||
@@ -99,19 +100,34 @@ local .end_0
|
||||
mov eax,[z]
|
||||
shr eax, ZB_POINT_Z_FRAC_BITS
|
||||
mov [zz],eax
|
||||
cmp eax,[pz]
|
||||
mov ebx,[pz]
|
||||
cmp ax,word[ebx]
|
||||
jl .end_0
|
||||
RGBPIXEL
|
||||
mov eax,dword[zz]
|
||||
mov [pz],eax
|
||||
mov ebx,[pz]
|
||||
mov word[ebx],ax
|
||||
.end_0:
|
||||
else ; INTERP_Z
|
||||
else
|
||||
RGBPIXEL
|
||||
end if ; INTERP_Z
|
||||
end if
|
||||
}
|
||||
|
||||
macro DRAWLINE d_x,d_y,inc_1,inc_2
|
||||
{
|
||||
local .mz_0
|
||||
local .mz_1
|
||||
local .mz_2
|
||||
local .mr_0
|
||||
local .mr_1
|
||||
local .mr_2
|
||||
local .mg_0
|
||||
local .mg_1
|
||||
local .mg_2
|
||||
local .mb_0
|
||||
local .mb_1
|
||||
local .mb_2
|
||||
|
||||
mov eax,d_x
|
||||
mov [n],eax
|
||||
|
||||
@@ -119,32 +135,103 @@ macro DRAWLINE d_x,d_y,inc_1,inc_2
|
||||
mov ecx,[p2]
|
||||
if INTERP_Z eq 1
|
||||
mov eax,[ecx+offs_zbup_z]
|
||||
cmp eax,[ebx+offs_zbup_z]
|
||||
jg .mz_0
|
||||
je .mz_1
|
||||
;if(p2.z<p1.z)
|
||||
sub eax,[ebx+offs_zbup_z]
|
||||
neg eax
|
||||
inc eax
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
neg eax
|
||||
inc eax
|
||||
jmp .mz_2
|
||||
.mz_0:
|
||||
sub eax,[ebx+offs_zbup_z]
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
jmp .mz_2
|
||||
.mz_1:
|
||||
xor eax,eax
|
||||
.mz_2:
|
||||
mov [zinc],eax ;zinc=(p2.z-p1.z)/n
|
||||
end if
|
||||
|
||||
;ebx=&p1, ecx=&p2
|
||||
mov eax,[ecx+offs_zbup_r]
|
||||
cmp eax,[ebx+offs_zbup_r]
|
||||
jg .mr_0
|
||||
je .mr_1
|
||||
;if(p2.r<p1.r)
|
||||
sub eax,[ebx+offs_zbup_r]
|
||||
neg eax
|
||||
inc eax
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
neg eax
|
||||
inc eax
|
||||
jmp .mr_2
|
||||
.mr_0:
|
||||
sub eax,[ebx+offs_zbup_r]
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
jmp .mr_2
|
||||
.mr_1:
|
||||
xor eax,eax
|
||||
.mr_2:
|
||||
mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
|
||||
|
||||
mov eax,[ecx+offs_zbup_g]
|
||||
cmp eax,[ebx+offs_zbup_g]
|
||||
jg .mg_0
|
||||
je .mg_1
|
||||
;if(p2.g<p1.g)
|
||||
sub eax,[ebx+offs_zbup_g]
|
||||
neg eax
|
||||
inc eax
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
neg eax
|
||||
inc eax
|
||||
jmp .mg_2
|
||||
.mg_0:
|
||||
sub eax,[ebx+offs_zbup_g]
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
jmp .mg_2
|
||||
.mg_1:
|
||||
xor eax,eax
|
||||
.mg_2:
|
||||
mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
|
||||
|
||||
mov eax,[ecx+offs_zbup_b]
|
||||
cmp eax,[ebx+offs_zbup_b]
|
||||
jg .mb_0
|
||||
je .mb_1
|
||||
;if(p2.b<p1.b)
|
||||
sub eax,[ebx+offs_zbup_b]
|
||||
neg eax
|
||||
inc eax
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
neg eax
|
||||
inc eax
|
||||
jmp .mb_2
|
||||
.mb_0:
|
||||
sub eax,[ebx+offs_zbup_b]
|
||||
shl eax,8
|
||||
xor edx,edx
|
||||
div dword[n]
|
||||
jmp .mb_2
|
||||
.mb_1:
|
||||
xor eax,eax
|
||||
.mb_2:
|
||||
mov [binc],eax ;binc=((p2.b-p1.b)<<8)/n
|
||||
|
||||
shl dword d_y,1
|
||||
@@ -185,6 +272,7 @@ end if
|
||||
add edi,[pp_inc_1]
|
||||
if INTERP_Z eq 1
|
||||
mov eax,inc_1
|
||||
shl eax,1
|
||||
add [pz],eax
|
||||
end if
|
||||
mov eax,d_x
|
||||
@@ -195,6 +283,7 @@ end if
|
||||
add edi,[pp_inc_2]
|
||||
if INTERP_Z eq 1
|
||||
mov eax,inc_2
|
||||
shl eax,1
|
||||
add [pz],eax
|
||||
end if
|
||||
mov eax,d_y
|
||||
|
Reference in New Issue
Block a user