2014-10-31 22:28:24 +01:00
|
|
|
|
|
|
|
align 4
|
|
|
|
proc ZB_plot uses eax ebx ecx edx edi, zb:dword, p:dword
|
|
|
|
mov eax,[zb]
|
|
|
|
mov ebx,[p]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov ecx,[ebx+ZBufferPoint.y]
|
|
|
|
imul ecx,[eax+ZBuffer.xsize]
|
|
|
|
add ecx,[ebx+ZBufferPoint.x]
|
2014-11-03 14:16:54 +01:00
|
|
|
shl ecx,1
|
2020-09-19 21:57:00 +02:00
|
|
|
add ecx,[eax+ZBuffer.zbuf]
|
|
|
|
mov edx,[eax+ZBuffer.linesize]
|
|
|
|
imul edx,[ebx+ZBufferPoint.y]
|
|
|
|
mov edi,[ebx+ZBufferPoint.x]
|
2014-10-31 22:28:24 +01:00
|
|
|
imul edi,PSZB
|
|
|
|
add edx,edi
|
2020-09-19 21:57:00 +02:00
|
|
|
add edx,[eax+ZBuffer.pbuf]
|
|
|
|
mov edi,[ebx+ZBufferPoint.z]
|
2014-10-31 22:28:24 +01:00
|
|
|
shr edi,ZB_POINT_Z_FRAC_BITS
|
2014-11-03 14:16:54 +01:00
|
|
|
cmp di,word[ecx]
|
2014-10-31 22:28:24 +01:00
|
|
|
jl .end_f
|
|
|
|
if TGL_FEATURE_RENDER_BITS eq 24
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[ebx+ZBufferPoint.r]
|
2014-10-31 22:28:24 +01:00
|
|
|
mov byte[edx],ah
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[ebx+ZBufferPoint.g]
|
2014-10-31 22:28:24 +01:00
|
|
|
mov byte[edx+1],ah
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[ebx+ZBufferPoint.b]
|
2014-10-31 22:28:24 +01:00
|
|
|
mov byte[edx+2],ah
|
|
|
|
else
|
|
|
|
; *pp = RGB_TO_PIXEL(p->r, p->g, p->b);
|
|
|
|
end if
|
2014-11-03 14:16:54 +01:00
|
|
|
mov word[ecx],di
|
2014-10-31 22:28:24 +01:00
|
|
|
.end_f:
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
|
|
|
INTERP_Z equ 1
|
|
|
|
align 4
|
|
|
|
proc ZB_line_flat_z, zb:dword, p1:dword, p2:dword, color:dword
|
|
|
|
include 'zline.inc'
|
|
|
|
|
|
|
|
; line with color interpolation
|
|
|
|
INTERP_Z equ 1
|
|
|
|
align 4
|
|
|
|
proc ZB_line_interp_z, zb:dword, p1:dword, p2:dword
|
|
|
|
include 'zline_r.inc'
|
|
|
|
|
|
|
|
; no Z interpolation
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc ZB_line_flat, zb:dword, p1:dword, p2:dword, color:dword
|
|
|
|
include 'zline.inc'
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc ZB_line_interp, zb:dword, p1:dword, p2:dword
|
|
|
|
include 'zline_r.inc'
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc ZB_line_z uses eax ebx ecx, zb:dword, p1:dword, p2:dword
|
|
|
|
if DEBUG ;ZB_line_z
|
|
|
|
push edi
|
|
|
|
mov ecx,80
|
|
|
|
mov eax,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.x]
|
2014-10-31 22:28:24 +01:00
|
|
|
lea edi,[buf_param]
|
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.y]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.x]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.y]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
|
|
|
|
stdcall str_n_cat,edi,txt_nl,2
|
|
|
|
stdcall dbg_print,f_zbz,buf_param
|
|
|
|
pop edi
|
|
|
|
end if
|
|
|
|
mov ebx,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
RGB_TO_PIXEL dword[ebx+ZBufferPoint.r],dword[ebx+ZBufferPoint.g],dword[ebx+ZBufferPoint.b]
|
2014-10-31 22:28:24 +01:00
|
|
|
mov ecx,eax
|
|
|
|
mov ebx,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
RGB_TO_PIXEL dword[ebx+ZBufferPoint.r],dword[ebx+ZBufferPoint.g],dword[ebx+ZBufferPoint.b]
|
2014-10-31 22:28:24 +01:00
|
|
|
|
|
|
|
; choose if the line should have its color interpolated or not
|
|
|
|
cmp ecx,eax
|
|
|
|
jne .els
|
|
|
|
stdcall ZB_line_flat_z, dword[zb], dword[p1], ebx, ecx
|
|
|
|
jmp @f
|
|
|
|
.els:
|
|
|
|
stdcall ZB_line_interp_z, dword[zb], dword[p1], ebx
|
|
|
|
@@:
|
|
|
|
ret
|
|
|
|
endp
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc ZB_line uses eax ebx ecx, zb:dword, p1:dword, p2:dword
|
|
|
|
if DEBUG ;ZB_line
|
|
|
|
push edi
|
|
|
|
mov ecx,80
|
|
|
|
mov eax,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.x]
|
2014-10-31 22:28:24 +01:00
|
|
|
lea edi,[buf_param]
|
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.y]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.x]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
|
|
|
stdcall str_len,edi
|
|
|
|
add edi,eax
|
|
|
|
sub ecx,eax
|
|
|
|
|
|
|
|
mov eax,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
mov eax,[eax+ZBufferPoint.y]
|
2014-10-31 22:28:24 +01:00
|
|
|
stdcall convert_int_to_str,ecx
|
|
|
|
|
|
|
|
stdcall str_n_cat,edi,txt_nl,2
|
|
|
|
stdcall dbg_print,f_zb,buf_param
|
|
|
|
pop edi
|
|
|
|
end if
|
|
|
|
mov ebx,[p1]
|
2020-09-19 21:57:00 +02:00
|
|
|
RGB_TO_PIXEL dword[ebx+ZBufferPoint.r],dword[ebx+ZBufferPoint.g],dword[ebx+ZBufferPoint.b]
|
2014-10-31 22:28:24 +01:00
|
|
|
mov ecx,eax
|
|
|
|
mov ebx,[p2]
|
2020-09-19 21:57:00 +02:00
|
|
|
RGB_TO_PIXEL dword[ebx+ZBufferPoint.r],dword[ebx+ZBufferPoint.g],dword[ebx+ZBufferPoint.b]
|
2014-10-31 22:28:24 +01:00
|
|
|
|
|
|
|
; choose if the line should have its color interpolated or not
|
|
|
|
cmp ecx,eax
|
|
|
|
jne .els
|
|
|
|
stdcall ZB_line_flat, dword[zb], dword[p1], ebx, ecx
|
|
|
|
jmp @f
|
|
|
|
.els:
|
|
|
|
stdcall ZB_line_interp, dword[zb], dword[p1], ebx
|
|
|
|
@@:
|
|
|
|
ret
|
|
|
|
endp
|