forked from KolibriOS/kolibrios
fixes in draw triangle functions
git-svn-id: svn://kolibrios.org@5187 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
636971f000
commit
01ca66aad4
@ -43,6 +43,9 @@ endl
|
|||||||
fadd dword[eax+offs_cont_viewport+offs_vpor_trans+offs_Z]
|
fadd dword[eax+offs_cont_viewport+offs_vpor_trans+offs_Z]
|
||||||
fistp dword[ebx+offs_vert_zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1
|
fistp dword[ebx+offs_vert_zp+offs_zbup_z] ;v.zp.z = st0, st0 = st1
|
||||||
|
|
||||||
|
ffree st0
|
||||||
|
fincstp
|
||||||
|
|
||||||
; color
|
; color
|
||||||
bt dword[eax+offs_cont_lighting_enabled],0
|
bt dword[eax+offs_cont_lighting_enabled],0
|
||||||
jnc @f
|
jnc @f
|
||||||
@ -695,13 +698,13 @@ pushad
|
|||||||
mov edi,dword[ebx+offs_vert_zp+offs_zbup_y]
|
mov edi,dword[ebx+offs_vert_zp+offs_zbup_y]
|
||||||
mov dword[norm],edi
|
mov dword[norm],edi
|
||||||
fimul dword[norm]
|
fimul dword[norm]
|
||||||
fsub st0,st1
|
fsubp
|
||||||
|
|
||||||
;st0 = (p1.zp.x-p0.zp.x)*(p2.zp.y-p0.zp.y) - (p2.zp.x-p0.zp.x)*(p1.zp.y-p0.zp.y)
|
;st0 = (p1.zp.x-p0.zp.x)*(p2.zp.y-p0.zp.y) - (p2.zp.x-p0.zp.x)*(p1.zp.y-p0.zp.y)
|
||||||
|
|
||||||
mov dword[front],0
|
mov dword[front],0
|
||||||
fldz
|
fldz
|
||||||
fcom st1
|
fcompp
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
je .end_f
|
je .end_f
|
||||||
@ -741,11 +744,9 @@ pushad
|
|||||||
and eax,[cc]
|
and eax,[cc]
|
||||||
and eax,[cc+4]
|
and eax,[cc+4]
|
||||||
cmp eax,0
|
cmp eax,0
|
||||||
jne @f
|
jne .end_f
|
||||||
stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
|
stdcall gl_draw_triangle_clip, [context],ebx,ecx,edx,0
|
||||||
.end_f:
|
.end_f:
|
||||||
finit
|
|
||||||
@@:
|
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
@ -986,14 +987,14 @@ proc gl_draw_triangle_point uses eax ebx edx, context:dword, p0:dword,p1:dword,p
|
|||||||
add ebx,offs_vert_zp
|
add ebx,offs_vert_zp
|
||||||
stdcall ZB_plot,dword[edx+offs_cont_zb],ebx
|
stdcall ZB_plot,dword[edx+offs_cont_zb],ebx
|
||||||
@@:
|
@@:
|
||||||
add eax,[p1]
|
mov eax,[p1]
|
||||||
cmp dword[eax+offs_vert_edge_flag],0
|
cmp dword[eax+offs_vert_edge_flag],0
|
||||||
je @f
|
je @f
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
add ebx,offs_vert_zp
|
add ebx,offs_vert_zp
|
||||||
stdcall ZB_plot,dword[edx+offs_cont_zb],ebx
|
stdcall ZB_plot,dword[edx+offs_cont_zb],ebx
|
||||||
@@:
|
@@:
|
||||||
add eax,[p2]
|
mov eax,[p2]
|
||||||
cmp dword[eax+offs_vert_edge_flag],0
|
cmp dword[eax+offs_vert_edge_flag],0
|
||||||
je @f
|
je @f
|
||||||
mov ebx,eax
|
mov ebx,eax
|
||||||
|
174
programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm
Normal file
174
programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
use32
|
||||||
|
org 0x0
|
||||||
|
db 'MENUET01'
|
||||||
|
dd 0x1
|
||||||
|
dd start
|
||||||
|
dd i_end
|
||||||
|
dd mem,stacktop
|
||||||
|
dd 0,cur_dir_path
|
||||||
|
|
||||||
|
include '../../../../../../programs/proc32.inc'
|
||||||
|
include '../../../../../../programs/macros.inc'
|
||||||
|
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac'
|
||||||
|
include '../../../../../../programs/dll.inc'
|
||||||
|
include '../opengl_const.inc'
|
||||||
|
|
||||||
|
@use_library
|
||||||
|
|
||||||
|
align 4
|
||||||
|
start:
|
||||||
|
load_library name_tgl, cur_dir_path, library_path, system_path, \
|
||||||
|
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i
|
||||||
|
cmp eax,-1
|
||||||
|
jz button.exit
|
||||||
|
|
||||||
|
mcall 40,0x27
|
||||||
|
|
||||||
|
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
|
||||||
|
;;;stdcall [glEnable], GL_DEPTH_TEST
|
||||||
|
stdcall [glClearColor], 0.2,0.0,0.2,0.0
|
||||||
|
stdcall [glShadeModel],GL_FLAT
|
||||||
|
|
||||||
|
call draw_3d
|
||||||
|
|
||||||
|
align 4
|
||||||
|
red_win:
|
||||||
|
call draw_window
|
||||||
|
|
||||||
|
align 4
|
||||||
|
still:
|
||||||
|
mcall 10
|
||||||
|
cmp al,1
|
||||||
|
jz red_win
|
||||||
|
cmp al,2
|
||||||
|
jz key
|
||||||
|
cmp al,3
|
||||||
|
jz button
|
||||||
|
jmp still
|
||||||
|
|
||||||
|
align 4
|
||||||
|
draw_window:
|
||||||
|
pushad
|
||||||
|
mcall 12,1
|
||||||
|
|
||||||
|
mov edx,0x33ffffff ;0x73ffffff
|
||||||
|
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
|
||||||
|
mcall 12,2
|
||||||
|
popad
|
||||||
|
ret
|
||||||
|
|
||||||
|
align 4
|
||||||
|
key:
|
||||||
|
mcall 2
|
||||||
|
|
||||||
|
cmp ah,27 ;Esc
|
||||||
|
je button.exit
|
||||||
|
|
||||||
|
;178 ;Up
|
||||||
|
;177 ;Down
|
||||||
|
cmp ah,176 ;Left
|
||||||
|
jne @f
|
||||||
|
fld dword[angle_z]
|
||||||
|
fadd dword[delt_size]
|
||||||
|
fstp dword[angle_z]
|
||||||
|
call draw_3d
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
@@:
|
||||||
|
cmp ah,179 ;Right
|
||||||
|
jne @f
|
||||||
|
fld dword[angle_z]
|
||||||
|
fsub dword[delt_size]
|
||||||
|
fstp dword[angle_z]
|
||||||
|
call draw_3d
|
||||||
|
stdcall [kosglSwapBuffers]
|
||||||
|
@@:
|
||||||
|
|
||||||
|
jmp still
|
||||||
|
|
||||||
|
align 4
|
||||||
|
button:
|
||||||
|
mcall 17
|
||||||
|
cmp ah,1
|
||||||
|
jne still
|
||||||
|
.exit:
|
||||||
|
mcall -1
|
||||||
|
|
||||||
|
|
||||||
|
align 4
|
||||||
|
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0
|
||||||
|
align 4
|
||||||
|
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||||
|
;sizeof.TinyGLContext = 28
|
||||||
|
|
||||||
|
align 4
|
||||||
|
draw_3d:
|
||||||
|
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||||
|
|
||||||
|
stdcall [glPushMatrix]
|
||||||
|
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||||
|
|
||||||
|
stdcall [glColor3f],0.0, 0.0, 1.0
|
||||||
|
stdcall [glBegin],GL_LINE_LOOP
|
||||||
|
stdcall [glVertex3f], 0.0, 0.5, 0.3
|
||||||
|
stdcall [glVertex3f], 0.354, 0.354, 0.3
|
||||||
|
stdcall [glVertex3f], 0.5, 0.0, 0.3
|
||||||
|
stdcall [glEnd]
|
||||||
|
;stdcall [glColor3f],1.0, 1.0, 0.0
|
||||||
|
stdcall [glBegin],GL_LINE_LOOP
|
||||||
|
stdcall [glVertex3f], 0.354, -0.354, 0.3
|
||||||
|
stdcall [glVertex3f], 0.0, -0.5, 0.3
|
||||||
|
stdcall [glVertex3f], -0.354,-0.354, 0.3
|
||||||
|
stdcall [glEnd]
|
||||||
|
|
||||||
|
stdcall [glColor3f],1.0, 0.0, 0.0
|
||||||
|
stdcall [glBegin],GL_TRIANGLES
|
||||||
|
stdcall [glVertex3f], 0.0, 0.5, 0.1
|
||||||
|
stdcall [glVertex3f], 0.354, 0.354, 0.1
|
||||||
|
stdcall [glVertex3f], 0.5, 0.0, 0.1
|
||||||
|
stdcall [glColor3f],1.0, 1.0, 0.0
|
||||||
|
stdcall [glVertex3f], 0.354, -0.354, 0.1
|
||||||
|
stdcall [glVertex3f], 0.0, -0.5, 0.1
|
||||||
|
stdcall [glVertex3f], -0.354,-0.354, 0.1
|
||||||
|
stdcall [glEnd]
|
||||||
|
|
||||||
|
stdcall [glPopMatrix]
|
||||||
|
ret
|
||||||
|
|
||||||
|
angle_z dd 15.0
|
||||||
|
delt_size dd 3.0
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
align 4
|
||||||
|
import_lib_tinygl:
|
||||||
|
|
||||||
|
macro E_LIB n
|
||||||
|
{
|
||||||
|
n dd sz_#n
|
||||||
|
}
|
||||||
|
include '../export.inc'
|
||||||
|
dd 0,0
|
||||||
|
macro E_LIB n
|
||||||
|
{
|
||||||
|
sz_#n db `n,0
|
||||||
|
}
|
||||||
|
include '../export.inc'
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
|
system_path db '/sys/lib/'
|
||||||
|
name_tgl db 'tinygl.obj',0
|
||||||
|
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0
|
||||||
|
head_f_i:
|
||||||
|
head_f_l db 'System error',0
|
||||||
|
err_message_import db 'Error on load import library tinygl.obj',0
|
||||||
|
;--------------------------------------------------
|
||||||
|
|
||||||
|
i_end:
|
||||||
|
rb 1024
|
||||||
|
stacktop:
|
||||||
|
cur_dir_path:
|
||||||
|
rb 4096
|
||||||
|
library_path:
|
||||||
|
rb 4096
|
||||||
|
mem:
|
@ -83,6 +83,10 @@ m_2 db '(2)',13,10,0
|
|||||||
m_3 db '(3)',13,10,0
|
m_3 db '(3)',13,10,0
|
||||||
m_4 db '(4)',13,10,0
|
m_4 db '(4)',13,10,0
|
||||||
m_5 db '(5)',13,10,0
|
m_5 db '(5)',13,10,0
|
||||||
|
m_6 db '(6)',13,10,0
|
||||||
|
m_7 db '(7)',13,10,0
|
||||||
|
m_8 db '(8)',13,10,0
|
||||||
|
m_9 db '(9)',13,10,0
|
||||||
|
|
||||||
buf_param rb 80
|
buf_param rb 80
|
||||||
|
|
||||||
@ -161,6 +165,11 @@ f_alloc_l db 'alloc_list',0
|
|||||||
f_is_l db 'glIsList',0
|
f_is_l db 'glIsList',0
|
||||||
f_gen_l db 'glGenLists',0
|
f_gen_l db 'glGenLists',0
|
||||||
f_end_l db 'glEndList',0
|
f_end_l db 'glEndList',0
|
||||||
|
;f_fill_trf db 'ZB_fillTriangleFlat',0
|
||||||
|
;f_fill_trrgb db 'ZB_fillTriangleSmooth',0
|
||||||
|
f_fill_tr db 'ZB_fillTriangle...',0
|
||||||
|
f_fill_tr_nl db ' lines',0
|
||||||
|
f_fill_tr_nll db ' len',0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc dbg_print, fun:dword, mes:dword
|
proc dbg_print, fun:dword, mes:dword
|
||||||
|
@ -14,7 +14,7 @@ if TGL_FEATURE_RENDER_BITS eq 24
|
|||||||
mov eax,[ecx+offs_zbup_b]
|
mov eax,[ecx+offs_zbup_b]
|
||||||
shr eax,8
|
shr eax,8
|
||||||
mov [colorB],al ;colorB=p2.b>>8
|
mov [colorB],al ;colorB=p2.b>>8
|
||||||
else
|
;else
|
||||||
; color=RGB_TO_PIXEL(p2->r,p2->g,p2->b);
|
; color=RGB_TO_PIXEL(p2->r,p2->g,p2->b);
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
@ -29,16 +29,16 @@ local .end_0
|
|||||||
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
||||||
jl .end_0
|
jl .end_0
|
||||||
;edi = pp
|
;edi = pp
|
||||||
|
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение
|
||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
mov cl,[colorR]
|
mov cl,[colorR]
|
||||||
mov ch,[colorG]
|
mov ch,[colorG]
|
||||||
mov word[edi+3*_a],cx
|
mov word[edi+3*_a],cx
|
||||||
mov cl,[colorB]
|
mov cl,[colorB]
|
||||||
mov byte[edi+3*_a +2],cl
|
mov byte[edi+3*_a +2],cl
|
||||||
else
|
;else
|
||||||
; pp[_a]=color;
|
; pp[_a]=color;
|
||||||
end if
|
end if
|
||||||
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение
|
|
||||||
.end_0:
|
.end_0:
|
||||||
mov eax,[dzdx]
|
mov eax,[dzdx]
|
||||||
add [z],eax
|
add [z],eax
|
||||||
@ -75,55 +75,67 @@ end if
|
|||||||
|
|
||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
|
local .end_0
|
||||||
mov eax,[z]
|
mov eax,[z]
|
||||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
mov [zz],eax
|
mov [zz],eax
|
||||||
|
mov ebx,[pz]
|
||||||
|
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
||||||
|
jl .end_0
|
||||||
|
;edi = pp
|
||||||
|
mov word[ebx+2*_a],ax ;пишем в буфер глубины новое значение
|
||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
; if (zz >= pz[_a]) {
|
mov eax,[or1]
|
||||||
; pp[3 * _a]=or1 >> 8;
|
mov cl,ah
|
||||||
; pp[3 * _a + 1]=og1 >> 8;
|
mov eax,[og1]
|
||||||
; pp[3 * _a + 2]=ob1 >> 8;
|
mov ch,ah
|
||||||
; pz[_a]=zz;
|
mov word[edi+3*_a],cx
|
||||||
; }
|
mov eax,[ob1]
|
||||||
mov eax,[dzdx]
|
mov byte[edi+3*_a +2],ah
|
||||||
add [z],eax
|
end if
|
||||||
; og1+=dgdx;
|
if TGL_FEATURE_RENDER_BITS eq 16
|
||||||
; or1+=drdx;
|
|
||||||
; ob1+=dbdx;
|
|
||||||
elseif TGL_FEATURE_RENDER_BITS eq 16
|
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; tmp=rgb & 0xF81F07E0;
|
; tmp=rgb & 0xF81F07E0;
|
||||||
; pp[_a]=tmp | (tmp >> 16);
|
; pp[_a]=tmp | (tmp >> 16);
|
||||||
; pz[_a]=zz;
|
;else
|
||||||
; }
|
|
||||||
; z+=dzdx;
|
|
||||||
; rgb=(rgb+drgbdx) & ( ~ 0x00200800);
|
|
||||||
else
|
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);
|
; pp[_a] = RGB_TO_PIXEL(or1, og1, ob1);
|
||||||
; pz[_a]=zz;
|
end if
|
||||||
; }
|
.end_0:
|
||||||
mov eax,[dzdx]
|
mov eax,[dzdx]
|
||||||
add [z],eax
|
add [z],eax
|
||||||
; og1+=dgdx;
|
if TGL_FEATURE_RENDER_BITS eq 16
|
||||||
; or1+=drdx;
|
; rgb=(rgb+drgbdx) & ( ~ 0x00200800);
|
||||||
; ob1+=dbdx;
|
end if
|
||||||
|
if TGL_FEATURE_RENDER_BITS <> 16
|
||||||
|
mov eax,[dgdx]
|
||||||
|
add [og1],eax
|
||||||
|
mov eax,[drdx]
|
||||||
|
add [or1],eax
|
||||||
|
mov eax,[dbdx]
|
||||||
|
add [ob1],eax
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
|
|
||||||
DRAW_LINE_M equ 1
|
;;;DRAW_LINE_M equ 1
|
||||||
|
|
||||||
macro DRAW_LINE code
|
macro DRAW_LINE code
|
||||||
{
|
{
|
||||||
|
local .cycle_0
|
||||||
|
local .cycle_1
|
||||||
if TGL_FEATURE_RENDER_BITS eq 16
|
if TGL_FEATURE_RENDER_BITS eq 16
|
||||||
if code eq 0
|
if code eq 0
|
||||||
; register unsigned short *pz;
|
pz dd ? ;uint*
|
||||||
; register PIXEL *pp;
|
tmp dd ? ;uint
|
||||||
; register unsigned int tmp,z,zz,rgb,drgbdx;
|
z dd ? ;uint
|
||||||
; register int n;
|
zz dd ? ;uint
|
||||||
|
rgb dd ? ;uint
|
||||||
|
drgbdx dd ? ;uint
|
||||||
|
n dd ? ;int
|
||||||
end if
|
end if
|
||||||
if code eq 1
|
if code eq 1
|
||||||
; n=(x2 >> 16) - x1;
|
mov eax,[x2]
|
||||||
|
shr eax,16
|
||||||
|
sub eax,[x1]
|
||||||
|
mov [n],eax ;n = (x2 >> 16) - x1
|
||||||
; pp=pp1+x1;
|
; pp=pp1+x1;
|
||||||
; pz=pz1+x1;
|
; pz=pz1+x1;
|
||||||
; z=z1;
|
; z=z1;
|
||||||
@ -131,21 +143,27 @@ if code eq 1
|
|||||||
; rgb|=(g1 >> 5) & 0x000007FF;
|
; rgb|=(g1 >> 5) & 0x000007FF;
|
||||||
; rgb|=(b1 << 5) & 0x001FF000;
|
; rgb|=(b1 << 5) & 0x001FF000;
|
||||||
; drgbdx=_drgbdx;
|
; drgbdx=_drgbdx;
|
||||||
; while (n>=3) {
|
align 4
|
||||||
; PUT_PIXEL(0);
|
.cycle_0: ;while (n>=3)
|
||||||
; PUT_PIXEL(1);
|
cmp dword[n],3
|
||||||
; PUT_PIXEL(2);
|
jl .cycle_1
|
||||||
; PUT_PIXEL(3);
|
PUT_PIXEL 0
|
||||||
; pz+=4;
|
PUT_PIXEL 1
|
||||||
; pp+=4;
|
PUT_PIXEL 2
|
||||||
; n-=4;
|
PUT_PIXEL 3
|
||||||
; }
|
add dword[pz],8
|
||||||
; while (n>=0) {
|
add edi,4
|
||||||
; PUT_PIXEL(0);
|
sub [n],4
|
||||||
; pz+=1;
|
jmp .cycle_0
|
||||||
; pp+=1;
|
.cycle_1: ;while (n>=0)
|
||||||
; n-=1;
|
cmp dword[n],0
|
||||||
; }
|
jl .cycle_1_end
|
||||||
|
PUT_PIXEL 0
|
||||||
|
add dword[pz],2
|
||||||
|
inc edi
|
||||||
|
dec dword[n]
|
||||||
|
jmp .cycle_1
|
||||||
|
.cycle_1_end:
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
}
|
}
|
||||||
@ -171,27 +189,31 @@ INTERP_ST equ 1
|
|||||||
|
|
||||||
macro DRAW_INIT
|
macro DRAW_INIT
|
||||||
{
|
{
|
||||||
; texture=zb->current_texture;
|
mov eax,[zb]
|
||||||
|
mov eax,[eax+offs_zbuf_current_texture]
|
||||||
|
mov [texture],eax
|
||||||
}
|
}
|
||||||
|
|
||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
; zz=z >> ZB_POINT_Z_FRAC_BITS;
|
local .end_0
|
||||||
|
mov eax,[z]
|
||||||
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
|
mov [zz],eax
|
||||||
|
mov ebx,[pz]
|
||||||
|
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
||||||
|
jl .end_0
|
||||||
|
; pz[_a]=zz;
|
||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
; unsigned char *ptr;
|
; unsigned char *ptr;
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; ptr = texture + (((t & 0x3FC00000) | s) >> 14) * 3;
|
; ptr = texture + (((t & 0x3FC00000) | s) >> 14) * 3;
|
||||||
; pp[3 * _a]= ptr[0];
|
; pp[3 * _a]= ptr[0];
|
||||||
; pp[3 * _a + 1]= ptr[1];
|
; pp[3 * _a + 1]= ptr[1];
|
||||||
; pp[3 * _a + 2]= ptr[2];
|
; pp[3 * _a + 2]= ptr[2];
|
||||||
; pz[_a]=zz;
|
|
||||||
; }
|
|
||||||
else
|
else
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];
|
; pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];
|
||||||
; pz[_a]=zz;
|
|
||||||
; }
|
|
||||||
end if
|
end if
|
||||||
|
.end_0:
|
||||||
mov eax,[dzdx]
|
mov eax,[dzdx]
|
||||||
add [z],eax
|
add [z],eax
|
||||||
mov eax,[dsdx]
|
mov eax,[dsdx]
|
||||||
@ -220,8 +242,11 @@ NB_INTERP equ 8
|
|||||||
|
|
||||||
macro DRAW_INIT
|
macro DRAW_INIT
|
||||||
{
|
{
|
||||||
; texture=zb->current_texture;
|
mov eax,[zb]
|
||||||
; fdzdx=(float)dzdx;
|
mov eax,[eax+offs_zbuf_current_texture]
|
||||||
|
mov [texture],eax
|
||||||
|
fild dword[dzdx]
|
||||||
|
fstp dword[fdzdx]
|
||||||
; fndzdx=NB_INTERP * fdzdx;
|
; fndzdx=NB_INTERP * fdzdx;
|
||||||
; ndszdx=NB_INTERP * dszdx;
|
; ndszdx=NB_INTERP * dszdx;
|
||||||
; ndtzdx=NB_INTERP * dtzdx;
|
; ndtzdx=NB_INTERP * dtzdx;
|
||||||
@ -229,23 +254,25 @@ macro DRAW_INIT
|
|||||||
|
|
||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
; zz=z >> ZB_POINT_Z_FRAC_BITS;
|
local .end_0
|
||||||
|
mov eax,[z]
|
||||||
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
|
mov [zz],eax
|
||||||
|
mov ebx,[pz]
|
||||||
|
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
||||||
|
jl .end_0
|
||||||
|
; pz[_a]=zz;
|
||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
; unsigned char *ptr;
|
; unsigned char *ptr;
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; ptr = texture + (((t & 0x3FC00000) | (s & 0x003FC000)) >> 14) * 3;
|
; ptr = texture + (((t & 0x3FC00000) | (s & 0x003FC000)) >> 14) * 3;
|
||||||
; pp[3 * _a]= ptr[0];
|
; pp[3 * _a]= ptr[0];
|
||||||
; pp[3 * _a + 1]= ptr[1];
|
; pp[3 * _a + 1]= ptr[1];
|
||||||
; pp[3 * _a + 2]= ptr[2];
|
; pp[3 * _a + 2]= ptr[2];
|
||||||
; pz[_a]=zz;
|
|
||||||
; }
|
|
||||||
else
|
else
|
||||||
; if (zz >= pz[_a]) {
|
|
||||||
; pp[_a]=*(PIXEL *)((char *)texture+
|
; pp[_a]=*(PIXEL *)((char *)texture+
|
||||||
; (((t & 0x3FC00000) | (s & 0x003FC000)) >> (17 - PSZSH)));
|
; (((t & 0x3FC00000) | (s & 0x003FC000)) >> (17 - PSZSH)));
|
||||||
; pz[_a]=zz;
|
|
||||||
; }
|
|
||||||
end if
|
end if
|
||||||
|
.end_0:
|
||||||
mov eax,[dzdx]
|
mov eax,[dzdx]
|
||||||
add [z],eax
|
add [z],eax
|
||||||
mov eax,[dsdx]
|
mov eax,[dsdx]
|
||||||
@ -261,12 +288,11 @@ macro DRAW_LINE code
|
|||||||
if TGL_FEATURE_RENDER_BITS eq 24
|
if TGL_FEATURE_RENDER_BITS eq 24
|
||||||
if code eq 0
|
if code eq 0
|
||||||
pz dd ? ;uint *
|
pz dd ? ;uint *
|
||||||
;edi = pp dd ?
|
|
||||||
s dd ? ;uint
|
s dd ? ;uint
|
||||||
t dd ? ;uint
|
t dd ? ;uint
|
||||||
z dd ? ;uint
|
z dd ? ;uint
|
||||||
zz dd ? ;uint
|
zz dd ? ;uint
|
||||||
n dd ? ;int
|
n1 dd ? ;int - длинна горизонтальной линии в пикселях
|
||||||
dsdx dd ? ;int
|
dsdx dd ? ;int
|
||||||
dtdx dd ? ;int
|
dtdx dd ? ;int
|
||||||
s_z dd ? ;float
|
s_z dd ? ;float
|
||||||
@ -275,7 +301,7 @@ if code eq 0
|
|||||||
zinv dd ? ;float
|
zinv dd ? ;float
|
||||||
end if
|
end if
|
||||||
if code eq 1
|
if code eq 1
|
||||||
; n=(x2>>16)-x1;
|
; n1=(x2>>16)-x1;
|
||||||
; fz=(float)z1;
|
; fz=(float)z1;
|
||||||
; zinv=1.0 / fz;
|
; zinv=1.0 / fz;
|
||||||
; pp=(pp1 + x1 * PSZB);
|
; pp=(pp1 + x1 * PSZB);
|
||||||
@ -283,7 +309,7 @@ if code eq 1
|
|||||||
; z=z1;
|
; z=z1;
|
||||||
; sz=sz1;
|
; sz=sz1;
|
||||||
; tz=tz1;
|
; tz=tz1;
|
||||||
; while (n>=(NB_INTERP-1)) {
|
; while (n1>=(NB_INTERP-1)) {
|
||||||
; {
|
; {
|
||||||
; float ss,tt;
|
; float ss,tt;
|
||||||
; ss=(sz * zinv);
|
; ss=(sz * zinv);
|
||||||
@ -305,7 +331,7 @@ if code eq 1
|
|||||||
; PUT_PIXEL(7);
|
; PUT_PIXEL(7);
|
||||||
; pz+=NB_INTERP;
|
; pz+=NB_INTERP;
|
||||||
; pp=(pp + NB_INTERP * PSZB);
|
; pp=(pp + NB_INTERP * PSZB);
|
||||||
; n-=NB_INTERP;
|
; n1-=NB_INTERP;
|
||||||
; sz+=ndszdx;
|
; sz+=ndszdx;
|
||||||
; tz+=ndtzdx;
|
; tz+=ndtzdx;
|
||||||
; }
|
; }
|
||||||
@ -318,11 +344,11 @@ if code eq 1
|
|||||||
; dsdx= (int)( (dszdx - ss*fdzdx)*zinv );
|
; dsdx= (int)( (dszdx - ss*fdzdx)*zinv );
|
||||||
; dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );
|
; dtdx= (int)( (dtzdx - tt*fdzdx)*zinv );
|
||||||
; }
|
; }
|
||||||
; while (n>=0) {
|
; while (n1>=0) {
|
||||||
; PUT_PIXEL(0);
|
;;; PUT_PIXEL 0
|
||||||
; pz+=1;
|
; pz+=1;
|
||||||
; pp=(PIXEL *)((char *)pp + PSZB);
|
; pp=(PIXEL *)((char *)pp + PSZB);
|
||||||
; n-=1;
|
dec dword[n1]
|
||||||
; }
|
; }
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
@ -333,9 +359,9 @@ proc ZB_fillTriangleMappingPerspective, zb:dword, p0:dword, p1:dword, p2:dword
|
|||||||
locals
|
locals
|
||||||
texture dd ? ;PIXEL *
|
texture dd ? ;PIXEL *
|
||||||
fdzdx dd ? ;float
|
fdzdx dd ? ;float
|
||||||
fndzdx dd ?
|
fndzdx dd ? ;float
|
||||||
ndszdx dd ?
|
ndszdx dd ? ;float
|
||||||
ndtzdx dd ?
|
ndtzdx dd ? ;float
|
||||||
include 'ztriangle.inc'
|
include 'ztriangle.inc'
|
||||||
|
|
||||||
end if
|
end if
|
||||||
@ -350,27 +376,37 @@ INTERP_STZ equ 1
|
|||||||
|
|
||||||
macro DRAW_INIT
|
macro DRAW_INIT
|
||||||
{
|
{
|
||||||
; texture=zb->current_texture;
|
mov eax,[zb]
|
||||||
|
mov eax,[eax+offs_zbuf_current_texture]
|
||||||
|
mov [texture],eax
|
||||||
}
|
}
|
||||||
|
|
||||||
macro PUT_PIXEL _a
|
macro PUT_PIXEL _a
|
||||||
{
|
{
|
||||||
; float zinv;
|
local .end_0
|
||||||
; int s,t;
|
; int s,t;
|
||||||
; zz=z >> ZB_POINT_Z_FRAC_BITS;
|
mov eax,[z]
|
||||||
; if (zz >= pz[_a]) {
|
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||||
; zinv= 1.0 / (float) z;
|
mov [zz],eax
|
||||||
; s= (int) (sz * zinv);
|
mov ebx,[pz]
|
||||||
; t= (int) (tz * zinv);
|
cmp ax,word[ebx+2*_a] ;if (zz >= pz[_a])
|
||||||
; pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];
|
jl .end_0
|
||||||
; pz[_a]=zz;
|
; pz[_a]=zz;
|
||||||
; }
|
fild dword[z]
|
||||||
|
fld dword[s_z]
|
||||||
|
fdiv st0,st1
|
||||||
|
;fistp dword[...s...] ;s = (int) (s_z / (float) z)
|
||||||
|
; t= (int) (t_z / (float) z);
|
||||||
|
; pp[_a]=texture[((t & 0x3FC00000) | s) >> 14];
|
||||||
|
.end_0:
|
||||||
mov eax,[dzdx]
|
mov eax,[dzdx]
|
||||||
add [z],eax
|
add [z],eax
|
||||||
mov eax,[dszdx]
|
fld dword[dszdx]
|
||||||
add [sz],eax
|
fadd dword[s_z]
|
||||||
mov eax,[dtzdx]
|
fstp dword[s_z]
|
||||||
add [tz],eax
|
fld dword,[dtzdx]
|
||||||
|
fadd dword[t_z]
|
||||||
|
fstp dword[t_z]
|
||||||
}
|
}
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
|
@ -19,27 +19,27 @@
|
|||||||
update_left dd ?
|
update_left dd ?
|
||||||
update_right dd ?
|
update_right dd ?
|
||||||
|
|
||||||
nb_lines dd ?
|
nb_lines dd ? ;число горизонтальных линий в половине треугольника
|
||||||
dx1 dd ?
|
dx1 dd ?
|
||||||
dy1 dd ?
|
dy1 dd ?
|
||||||
dx2 dd ?
|
;dx2 dd ?
|
||||||
dy2 dd ?
|
dy2 dd ?
|
||||||
|
|
||||||
error dd ?
|
error dd ? ;int
|
||||||
derror dd ?
|
derror dd ? ;int
|
||||||
x1 dd ?
|
x1 dd ? ;int
|
||||||
dxdy_min dd ?
|
dxdy_min dd ? ;int
|
||||||
dxdy_max dd ?
|
dxdy_max dd ? ;int
|
||||||
; warning: x2 is multiplied by 2^16
|
; warning: x2 is multiplied by 2^16
|
||||||
x2 dd ?
|
x2 dd ? ;int
|
||||||
dx2dy2 dd ?
|
dx2dy2 dd ? ;int
|
||||||
|
|
||||||
if INTERP_Z eq 1
|
if INTERP_Z eq 1
|
||||||
z1 dd ?
|
z1 dd ? ;int
|
||||||
dzdx dd ?
|
dzdx dd ? ;int
|
||||||
dzdy dd ?
|
dzdy dd ? ;int
|
||||||
dzdl_min dd ?
|
dzdl_min dd ? ;int
|
||||||
dzdl_max dd ?
|
dzdl_max dd ? ;int
|
||||||
end if
|
end if
|
||||||
if INTERP_RGB eq 1
|
if INTERP_RGB eq 1
|
||||||
r1 dd ? ;int
|
r1 dd ? ;int
|
||||||
@ -59,16 +59,16 @@ if INTERP_RGB eq 1
|
|||||||
dbdl_max dd ?
|
dbdl_max dd ?
|
||||||
end if
|
end if
|
||||||
if INTERP_ST eq 1
|
if INTERP_ST eq 1
|
||||||
s1 dd ?
|
s1 dd ? ;int
|
||||||
dsdx dd ?
|
dsdx dd ? ;int
|
||||||
dsdy dd ?
|
dsdy dd ? ;int
|
||||||
dsdl_min dd ?
|
dsdl_min dd ? ;int
|
||||||
dsdl_max dd ?
|
dsdl_max dd ? ;int
|
||||||
t1 dd ?
|
t1 dd ? ;int
|
||||||
dtdx dd ?
|
dtdx dd ? ;int
|
||||||
dtdy dd ?
|
dtdy dd ? ;int
|
||||||
dtdl_min dd ?
|
dtdl_min dd ? ;int
|
||||||
dtdl_max dd ?
|
dtdl_max dd ? ;int
|
||||||
end if
|
end if
|
||||||
if INTERP_STZ eq 1
|
if INTERP_STZ eq 1
|
||||||
sz1 dd ? ;float
|
sz1 dd ? ;float
|
||||||
@ -83,11 +83,11 @@ if INTERP_STZ eq 1
|
|||||||
dtzdl_max dd ? ;float
|
dtzdl_max dd ? ;float
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
if DRAW_LINE_M eq 1
|
if DRAW_LINE_M eq 1
|
||||||
DRAW_LINE 0 ;переменные делаются в макросе
|
DRAW_LINE 0 ;переменные делаются в макросе
|
||||||
else
|
else
|
||||||
;edi = pp dd ?
|
n dd ? ;int - длинна горизонтальной линии в пикселях
|
||||||
n dd ? ;int
|
|
||||||
if INTERP_Z eq 1
|
if INTERP_Z eq 1
|
||||||
pz dd ? ;unsigned short *
|
pz dd ? ;unsigned short *
|
||||||
z dd ? ;uint
|
z dd ? ;uint
|
||||||
@ -109,41 +109,36 @@ end if
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
endl
|
endl
|
||||||
|
pushad
|
||||||
|
|
||||||
|
if DEBUG ;(1)
|
||||||
|
stdcall dbg_print,f_fill_tr,m_1
|
||||||
|
end if
|
||||||
|
|
||||||
; we sort the vertex with increasing y
|
; we sort the vertex with increasing y
|
||||||
mov ebx,[p0]
|
mov ebx,[p0]
|
||||||
mov ecx,[p1]
|
mov ecx,[p1]
|
||||||
mov eax,[ebx+offs_zbup_y]
|
|
||||||
cmp [ecx+offs_zbup_y],eax
|
|
||||||
jge @f
|
|
||||||
;if (p1.y < p0.y)
|
|
||||||
mov [p0],ecx
|
|
||||||
mov [p1],ebx
|
|
||||||
xchg ebx,ecx
|
|
||||||
mov eax,[ebx+offs_zbup_y] ;обновляем p0.y для следующего сравнения
|
|
||||||
@@:
|
|
||||||
mov edx,[p2]
|
mov edx,[p2]
|
||||||
cmp [edx+offs_zbup_y],eax
|
mov eax,[edx+offs_zbup_y]
|
||||||
jge @f
|
cmp [ecx+offs_zbup_y],eax ;(2-1)
|
||||||
;if (p2.y < p0.y)
|
jle @f
|
||||||
mov [p0],edx
|
xchg edx,ecx
|
||||||
mov [p1],ebx
|
|
||||||
mov [p2],ecx
|
|
||||||
mov ebx,[p0]
|
|
||||||
mov ecx,[p1]
|
|
||||||
mov edx,[p2]
|
|
||||||
jmp .end_e0
|
|
||||||
@@:
|
@@:
|
||||||
mov eax,[ecx+offs_zbup_y]
|
mov eax,[ecx+offs_zbup_y]
|
||||||
cmp [edx+offs_zbup_y],eax
|
cmp [ebx+offs_zbup_y],eax ;(1-0)
|
||||||
jge .end_e0
|
jle @f
|
||||||
;else if (p2.y < p1.y)
|
xchg ecx,ebx
|
||||||
mov [p1],edx
|
@@:
|
||||||
mov [p2],ecx
|
mov eax,[edx+offs_zbup_y]
|
||||||
.end_e0:
|
cmp [ecx+offs_zbup_y],eax ;(2-1)
|
||||||
|
jle @f
|
||||||
|
xchg edx,ecx
|
||||||
|
@@:
|
||||||
|
mov [p0],ebx
|
||||||
|
mov [p1],ecx
|
||||||
|
mov [p2],edx
|
||||||
|
|
||||||
; we compute dXdx and dXdy for all interpolated values
|
; we compute dXdx and dXdy for all interpolated values
|
||||||
|
|
||||||
mov eax,[ecx+offs_zbup_x]
|
mov eax,[ecx+offs_zbup_x]
|
||||||
sub eax,[ebx+offs_zbup_x]
|
sub eax,[ebx+offs_zbup_x]
|
||||||
mov [fdx1],eax ;p1.x - p0.x
|
mov [fdx1],eax ;p1.x - p0.x
|
||||||
@ -158,23 +153,26 @@ endl
|
|||||||
sub eax,[ebx+offs_zbup_y]
|
sub eax,[ebx+offs_zbup_y]
|
||||||
mov [fdy2],eax ;p2.y - p0.y
|
mov [fdy2],eax ;p2.y - p0.y
|
||||||
|
|
||||||
fild dword[fdx2]
|
|
||||||
fst dword[fdx2]
|
|
||||||
fild dword[fdy1]
|
|
||||||
fst dword[fdy1]
|
|
||||||
fmulp
|
|
||||||
fild dword[fdx1]
|
fild dword[fdx1]
|
||||||
fst dword[fdx1]
|
fst dword[fdx1]
|
||||||
fild dword[fdy2]
|
fild dword[fdy2]
|
||||||
fst dword[fdy2]
|
fst dword[fdy2]
|
||||||
fmulp
|
fmulp
|
||||||
fsubp ;st0 = st0-st1
|
fild dword[fdx2]
|
||||||
|
fst dword[fdx2]
|
||||||
|
fild dword[fdy1]
|
||||||
|
fst dword[fdy1]
|
||||||
|
fmulp
|
||||||
|
fsubp ;st0 = st1-st0
|
||||||
fst dword[fz] ;fz = fdx1 * fdy2 - fdx2 * fdy1
|
fst dword[fz] ;fz = fdx1 * fdy2 - fdx2 * fdy1
|
||||||
fldz
|
fldz
|
||||||
fcompp ;if (fz == 0)
|
fcompp ;if (fz == 0) return
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
je .end_f
|
je .end_f
|
||||||
|
if DEBUG ;(2)
|
||||||
|
stdcall dbg_print,txt_sp,m_2
|
||||||
|
end if
|
||||||
fld1
|
fld1
|
||||||
fdiv dword[fz] ;fz = 1.0 / fz
|
fdiv dword[fz] ;fz = 1.0 / fz
|
||||||
fst dword[fz] ;st0 = fz
|
fst dword[fz] ;st0 = fz
|
||||||
@ -201,26 +199,24 @@ if INTERP_Z eq 1
|
|||||||
mov eax,[edx+offs_zbup_z]
|
mov eax,[edx+offs_zbup_z]
|
||||||
sub eax,[ebx+offs_zbup_z]
|
sub eax,[ebx+offs_zbup_z]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.z - p0.z
|
||||||
fst dword[d1] ;d1 = p1.z - p0.z
|
fild dword[d2] ;d2 = p2.z - p0.z
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.z - p0.z
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
|
fmul st0,st2
|
||||||
|
fsubp
|
||||||
fistp dword[dzdx] ;dzdx = (int) (fdy2*d1 - fdy1*d2)
|
fistp dword[dzdx] ;dzdx = (int) (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
fld dword[fdx2]
|
|
||||||
fmul st0,st2
|
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st1
|
||||||
fsub st0,st1
|
fld dword[fdx2]
|
||||||
|
fmul st0,st3
|
||||||
|
fsubp
|
||||||
fistp dword[dzdy] ;dzdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[dzdy] ;dzdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
fincstp
|
fincstp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@ -231,26 +227,24 @@ if INTERP_RGB eq 1
|
|||||||
mov eax,[edx+offs_zbup_r]
|
mov eax,[edx+offs_zbup_r]
|
||||||
sub eax,[ebx+offs_zbup_r]
|
sub eax,[ebx+offs_zbup_r]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.r - p0.r
|
||||||
fst dword[d1] ;d1 = p1.r - p0.r
|
fild dword[d2] ;d2 = p2.r - p0.r
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.r - p0.r
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
|
fmul st0,st2
|
||||||
|
fsubp
|
||||||
fistp dword[drdx] ;drdx = (int) (fdy2*d1 - fdy1*d2)
|
fistp dword[drdx] ;drdx = (int) (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
fld dword[fdx2]
|
|
||||||
fmul st0,st2
|
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st1
|
||||||
fsub st0,st1
|
fld dword[fdx2]
|
||||||
|
fmul st0,st3
|
||||||
|
fsubp
|
||||||
fistp dword[drdy] ;drdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[drdy] ;drdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
fincstp
|
fincstp
|
||||||
|
|
||||||
mov eax,[ecx+offs_zbup_g]
|
mov eax,[ecx+offs_zbup_g]
|
||||||
@ -259,26 +253,24 @@ if INTERP_RGB eq 1
|
|||||||
mov eax,[edx+offs_zbup_g]
|
mov eax,[edx+offs_zbup_g]
|
||||||
sub eax,[ebx+offs_zbup_g]
|
sub eax,[ebx+offs_zbup_g]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.g - p0.g
|
||||||
fst dword[d1] ;d1 = p1.g - p0.g
|
fild dword[d2] ;d2 = p2.g - p0.g
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.g - p0.g
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
|
fmul st0,st2
|
||||||
|
fsubp
|
||||||
fistp dword[dgdx] ;dgdx = (int) (fdy2*d1 - fdy1*d2)
|
fistp dword[dgdx] ;dgdx = (int) (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
fld dword[fdx2]
|
|
||||||
fmul st0,st2
|
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st1
|
||||||
fsub st0,st1
|
fld dword[fdx2]
|
||||||
|
fmul st0,st3
|
||||||
|
fsubp
|
||||||
fistp dword[dgdy] ;dgdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[dgdy] ;dgdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
fincstp
|
fincstp
|
||||||
|
|
||||||
mov eax,[ecx+offs_zbup_b]
|
mov eax,[ecx+offs_zbup_b]
|
||||||
@ -287,26 +279,24 @@ if INTERP_RGB eq 1
|
|||||||
mov eax,[edx+offs_zbup_b]
|
mov eax,[edx+offs_zbup_b]
|
||||||
sub eax,[ebx+offs_zbup_b]
|
sub eax,[ebx+offs_zbup_b]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.b - p0.b
|
||||||
fst dword[d1] ;d1 = p1.b - p0.b
|
fild dword[d2] ;d2 = p2.b - p0.b
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.b - p0.b
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
|
fmul st0,st2
|
||||||
|
fsubp
|
||||||
fistp dword[dbdx] ;dbdx = (int) (fdy2*d1 - fdy1*d2)
|
fistp dword[dbdx] ;dbdx = (int) (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
fld dword[fdx2]
|
|
||||||
fmul st0,st2
|
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st1
|
||||||
fsub st0,st1
|
fld dword[fdx2]
|
||||||
|
fmul st0,st3
|
||||||
|
fsubp
|
||||||
fistp dword[dbdy] ;dbdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[dbdy] ;dbdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
fincstp
|
fincstp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@ -317,19 +307,15 @@ if INTERP_ST eq 1
|
|||||||
mov eax,[edx+offs_zbup_s]
|
mov eax,[edx+offs_zbup_s]
|
||||||
sub eax,[ebx+offs_zbup_s]
|
sub eax,[ebx+offs_zbup_s]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.s - p0.s
|
||||||
fst dword[d1] ;d1 = p1.s - p0.s
|
fild dword[d2] ;d2 = p2.s - p0.s
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.s - p0.s
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
|
fmul st0,st2
|
||||||
|
fsubp
|
||||||
fistp dword[dsdx] ;dsdx = (int) (fdy2*d1 - fdy1*d2)
|
fistp dword[dsdx] ;dsdx = (int) (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
fld dword[fdx2]
|
fld dword[fdx2]
|
||||||
fmul st0,st2
|
fmul st0,st2
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
@ -338,6 +324,10 @@ if INTERP_ST eq 1
|
|||||||
fistp dword[dsdy] ;dsdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[dsdy] ;dsdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
|
fincstp
|
||||||
|
|
||||||
mov eax,[ecx+offs_zbup_t]
|
mov eax,[ecx+offs_zbup_t]
|
||||||
sub eax,[ebx+offs_zbup_t]
|
sub eax,[ebx+offs_zbup_t]
|
||||||
@ -345,10 +335,8 @@ if INTERP_ST eq 1
|
|||||||
mov eax,[edx+offs_zbup_t]
|
mov eax,[edx+offs_zbup_t]
|
||||||
sub eax,[ebx+offs_zbup_t]
|
sub eax,[ebx+offs_zbup_t]
|
||||||
mov [d2],eax
|
mov [d2],eax
|
||||||
fild dword[d1]
|
fild dword[d1] ;d1 = p1.t - p0.t
|
||||||
fst dword[d1] ;d1 = p1.t - p0.t
|
fild dword[d2] ;d2 = p2.t - p0.t
|
||||||
fild dword[d2]
|
|
||||||
fst dword[d2] ;d2 = p2.t - p0.t
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
fld dword[fdy1]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
@ -366,6 +354,10 @@ if INTERP_ST eq 1
|
|||||||
fistp dword[dtdy] ;dtdy = (int) (fdx1*d2 - fdx2*d1)
|
fistp dword[dtdy] ;dtdy = (int) (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
|
fincstp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if INTERP_STZ eq 1
|
if INTERP_STZ eq 1
|
||||||
@ -374,68 +366,60 @@ if INTERP_STZ eq 1
|
|||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fstp dword[ebx+offs_zbup_sz] ;p0.sz = (float) p0.s * p0.z
|
fstp dword[ebx+offs_zbup_sz] ;p0.sz = (float) p0.s * p0.z
|
||||||
fild dword[ebx+offs_zbup_t]
|
fild dword[ebx+offs_zbup_t]
|
||||||
fmul st0,st1
|
fmulp
|
||||||
fstp dword[ebx+offs_zbup_tz] ;p0.tz = (float) p0.t * p0.z
|
fstp dword[ebx+offs_zbup_tz] ;p0.tz = (float) p0.t * p0.z
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
|
|
||||||
fild dword[ecx+offs_zbup_z]
|
fild dword[ecx+offs_zbup_z]
|
||||||
fild dword[ecx+offs_zbup_s]
|
fild dword[ecx+offs_zbup_s]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fstp dword[ecx+offs_zbup_sz] ;p1.sz = (float) p1.s * p1.z
|
fstp dword[ecx+offs_zbup_sz] ;p1.sz = (float) p1.s * p1.z
|
||||||
fild dword[ecx+offs_zbup_t]
|
fild dword[ecx+offs_zbup_t]
|
||||||
fmul st0,st1
|
fmulp
|
||||||
fstp dword[ecx+offs_zbup_tz] ;p1.tz = (float) p1.t * p1.z
|
fstp dword[ecx+offs_zbup_tz] ;p1.tz = (float) p1.t * p1.z
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
|
|
||||||
fild dword[edx+offs_zbup_z]
|
fild dword[edx+offs_zbup_z]
|
||||||
fild dword[edx+offs_zbup_s]
|
fild dword[edx+offs_zbup_s]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fstp dword[edx+offs_zbup_sz] ;p2.sz = (float) p2.s * p2.z
|
fstp dword[edx+offs_zbup_sz] ;p2.sz = (float) p2.s * p2.z
|
||||||
fild dword[edx+offs_zbup_t]
|
fild dword[edx+offs_zbup_t]
|
||||||
fmul st0,st1
|
fmulp
|
||||||
fstp dword[edx+offs_zbup_tz] ;p2.tz = (float) p2.t * p2.z
|
fstp dword[edx+offs_zbup_tz] ;p2.tz = (float) p2.t * p2.z
|
||||||
ffree st0
|
|
||||||
fincstp
|
|
||||||
|
|
||||||
fld dword[ecx+offs_zbup_sz]
|
fld dword[ecx+offs_zbup_sz]
|
||||||
fsub dword[ebx+offs_zbup_sz]
|
fsub dword[ebx+offs_zbup_sz] ;d1 = p1.sz - p0.sz
|
||||||
fst dword[d1] ;d1 = p1.sz - p0.sz
|
|
||||||
fld dword[edx+offs_zbup_sz]
|
fld dword[edx+offs_zbup_sz]
|
||||||
fsub dword[ebx+offs_zbup_sz]
|
fsub dword[ebx+offs_zbup_sz] ;d2 = p2.sz - p0.sz
|
||||||
fst dword[d2] ;d2 = p2.sz - p0.sz
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
|
||||||
fmul st0,st1
|
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fld dword[fdy1]
|
||||||
fistp dword[dszdx] ;dszdx = (int) (fdy2*d1 - fdy1*d2)
|
fmul st0,st2
|
||||||
ffree st0
|
fsubp
|
||||||
fincstp
|
fstp dword[dszdx] ;dszdx = (fdy2*d1 - fdy1*d2)
|
||||||
fld dword[fdx2]
|
fld dword[fdx2]
|
||||||
fmul st0,st2
|
fmul st0,st2
|
||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fsub st0,st1
|
||||||
fistp dword[dszdy] ;dszdy = (int) (fdx1*d2 - fdx2*d1)
|
fstp dword[dszdy] ;dszdy = (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
|
fincstp
|
||||||
|
|
||||||
fld dword[ecx+offs_zbup_tz]
|
fld dword[ecx+offs_zbup_tz]
|
||||||
fsub dword[ebx+offs_zbup_tz]
|
fsub dword[ebx+offs_zbup_tz] ;d1 = p1.tz - p0.tz
|
||||||
fst dword[d1] ;d1 = p1.tz - p0.tz
|
|
||||||
fld dword[edx+offs_zbup_tz]
|
fld dword[edx+offs_zbup_tz]
|
||||||
fsub dword[ebx+offs_zbup_tz]
|
fsub dword[ebx+offs_zbup_tz] ;d2 = p2.tz - p0.tz
|
||||||
fst dword[d2] ;d2 = p2.tz - p0.tz
|
|
||||||
|
|
||||||
fld dword[fdy1]
|
fld dword[fdy1]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fld dword[fdy2]
|
fld dword[fdy2]
|
||||||
fmul st0,st3
|
fmul st0,st3
|
||||||
fsub st0,st1
|
fsub st0,st1
|
||||||
fistp dword[dtzdx] ;dtzdx = (int) (fdy2*d1 - fdy1*d2)
|
fstp dword[dtzdx] ;dtzdx = (fdy2*d1 - fdy1*d2)
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
fld dword[fdx2]
|
fld dword[fdx2]
|
||||||
@ -443,13 +427,16 @@ if INTERP_STZ eq 1
|
|||||||
fld dword[fdx1]
|
fld dword[fdx1]
|
||||||
fmul st0,st2
|
fmul st0,st2
|
||||||
fsub st0,st1
|
fsub st0,st1
|
||||||
fistp dword[dtzdy] ;dtzdy = (int) (fdx1*d2 - fdx2*d1)
|
fstp dword[dtzdy] ;dtzdy = (fdx1*d2 - fdx2*d1)
|
||||||
ffree st0
|
ffree st0
|
||||||
fincstp
|
fincstp
|
||||||
|
ffree st0 ;free d2
|
||||||
|
fincstp
|
||||||
|
ffree st0 ;free d1
|
||||||
|
fincstp
|
||||||
end if
|
end if
|
||||||
|
|
||||||
; screen coordinates
|
; screen coordinates
|
||||||
|
|
||||||
mov eax,[zb]
|
mov eax,[zb]
|
||||||
mov edx,[eax+offs_zbuf_linesize]
|
mov edx,[eax+offs_zbuf_linesize]
|
||||||
imul edx,[ebx+offs_zbup_y]
|
imul edx,[ebx+offs_zbup_y]
|
||||||
@ -465,10 +452,13 @@ end if
|
|||||||
|
|
||||||
mov dword[part],0
|
mov dword[part],0
|
||||||
.cycle_0:
|
.cycle_0:
|
||||||
|
if DEBUG ;(3)
|
||||||
|
stdcall dbg_print,txt_sp,m_3
|
||||||
|
end if
|
||||||
mov ebx,[p0]
|
mov ebx,[p0]
|
||||||
mov ecx,[p1]
|
mov ecx,[p1]
|
||||||
mov edx,[p2]
|
mov edx,[p2]
|
||||||
cmp dword[part],0
|
cmp dword[part],0 ;if (part == 0)
|
||||||
jne .els_0
|
jne .els_0
|
||||||
mov dword[update_left],1
|
mov dword[update_left],1
|
||||||
mov dword[update_right],1
|
mov dword[update_right],1
|
||||||
@ -493,18 +483,20 @@ end if
|
|||||||
jmp .end_0
|
jmp .end_0
|
||||||
.els_0:
|
.els_0:
|
||||||
; second part
|
; second part
|
||||||
mov dword[update_left],0
|
|
||||||
mov dword[update_right],1
|
|
||||||
fldz
|
fldz
|
||||||
fld dword[fz]
|
fld dword[fz]
|
||||||
fcompp ;if (fz > 0)
|
fcompp ;if (fz > 0)
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jbe .els_2
|
jbe .els_2
|
||||||
|
mov dword[update_left],0
|
||||||
|
mov dword[update_right],1
|
||||||
mov [pr1],ecx
|
mov [pr1],ecx
|
||||||
mov [pr2],edx
|
mov [pr2],edx
|
||||||
jmp .end_2
|
jmp .end_2
|
||||||
.els_2:
|
.els_2:
|
||||||
|
mov dword[update_left],1
|
||||||
|
mov dword[update_right],0
|
||||||
mov [l1],ecx
|
mov [l1],ecx
|
||||||
mov [l2],edx
|
mov [l2],edx
|
||||||
.end_2:
|
.end_2:
|
||||||
@ -515,37 +507,78 @@ end if
|
|||||||
.end_0:
|
.end_0:
|
||||||
|
|
||||||
; compute the values for the left edge
|
; compute the values for the left edge
|
||||||
|
|
||||||
cmp dword[update_left],0 ;if (update_left)
|
cmp dword[update_left],0 ;if (update_left)
|
||||||
je .end_upd_l
|
je .end_upd_l
|
||||||
mov ebx,[l1]
|
mov ebx,[l1]
|
||||||
mov ecx,[l2]
|
mov ecx,[l2]
|
||||||
|
mov edx,[ecx+offs_zbup_y]
|
||||||
|
sub edx,[ebx+offs_zbup_y]
|
||||||
|
mov [dy1],edx ;dy1 = l2.y - l1.y
|
||||||
mov eax,[ecx+offs_zbup_x]
|
mov eax,[ecx+offs_zbup_x]
|
||||||
sub eax,[ebx+offs_zbup_x]
|
sub eax,[ebx+offs_zbup_x]
|
||||||
mov [dx1],eax ;dx1 = l2.x - l1.x
|
mov [dx1],eax ;dx1 = l2.x - l1.x
|
||||||
mov eax,[ecx+offs_zbup_y]
|
cmp edx,0 ;if (dy1 > 0)
|
||||||
sub eax,[ebx+offs_zbup_y]
|
|
||||||
mov [dy1],eax ;dy1 = l2.y - l1.y
|
|
||||||
cmp eax,0 ;if (dy1 > 0)
|
|
||||||
jle .els_3
|
jle .els_3
|
||||||
mov eax,[dx1]
|
|
||||||
shl eax,16
|
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
|
cmp eax,0
|
||||||
|
jl .otr_dx1
|
||||||
|
shl eax,16
|
||||||
div dword[dy1] ;eax = (dx1 << 16) / dy1
|
div dword[dy1] ;eax = (dx1 << 16) / dy1
|
||||||
jmp .end_3
|
jmp .end_3
|
||||||
|
.otr_dx1:
|
||||||
|
neg eax
|
||||||
|
inc eax
|
||||||
|
shl eax,16
|
||||||
|
div dword[dy1] ;eax = (-dx1 << 16) / dy1
|
||||||
|
neg eax
|
||||||
|
inc eax
|
||||||
|
jmp .end_3
|
||||||
.els_3:
|
.els_3:
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
.end_3:
|
.end_3:
|
||||||
mov edx,[ebx+offs_zbup_x]
|
mov edx,[ebx+offs_zbup_x]
|
||||||
mov [x1],edx
|
mov [x1],edx ;x1 = l1.x
|
||||||
mov dword[error],0
|
mov dword[error],0 ;error = 0
|
||||||
mov dword[derror],eax
|
mov dword[derror],eax
|
||||||
and dword[derror],0xffff
|
and dword[derror],0xffff ;derror = eax & 0x0000ffff
|
||||||
shr eax,16
|
shr eax,16
|
||||||
mov [dxdy_min],eax
|
mov [dxdy_min],eax ;dxdy_min = eax >> 16
|
||||||
inc eax
|
inc eax
|
||||||
mov [dxdy_max],eax
|
mov [dxdy_max],eax
|
||||||
|
|
||||||
|
if DEBUG ;(4) update_left [dx1], [dy1], [dxdy_min], [dxdy_max]
|
||||||
|
push ecx edi
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
mov eax,[dx1]
|
||||||
|
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,[dy1]
|
||||||
|
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,[dxdy_min]
|
||||||
|
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,[dxdy_max]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,m_4,buf_param
|
||||||
|
pop edi ecx
|
||||||
|
end if
|
||||||
|
|
||||||
if INTERP_Z eq 1
|
if INTERP_Z eq 1
|
||||||
mov eax,[l1]
|
mov eax,[l1]
|
||||||
mov eax,[eax+offs_zbup_z]
|
mov eax,[eax+offs_zbup_z]
|
||||||
@ -585,7 +618,6 @@ if INTERP_RGB eq 1
|
|||||||
mov [dbdl_min],eax ;dbdl_min = (dbdy +dbdx*dxdy_min)
|
mov [dbdl_min],eax ;dbdl_min = (dbdy +dbdx*dxdy_min)
|
||||||
add eax,[dbdx]
|
add eax,[dbdx]
|
||||||
mov [dbdl_max],eax ;dbdl_max = dbdl_min +dbdx
|
mov [dbdl_max],eax ;dbdl_max = dbdl_min +dbdx
|
||||||
|
|
||||||
end if
|
end if
|
||||||
if INTERP_ST eq 1
|
if INTERP_ST eq 1
|
||||||
mov ebx,[l1]
|
mov ebx,[l1]
|
||||||
@ -635,29 +667,85 @@ end if
|
|||||||
je .end_upd_r
|
je .end_upd_r
|
||||||
mov ebx,[pr1]
|
mov ebx,[pr1]
|
||||||
mov ecx,[pr2]
|
mov ecx,[pr2]
|
||||||
|
mov edx,[ebx+offs_zbup_x]
|
||||||
mov eax,[ecx+offs_zbup_x]
|
mov eax,[ecx+offs_zbup_x]
|
||||||
sub eax,[ebx+offs_zbup_x]
|
sub eax,edx
|
||||||
mov [dx2],eax ;dx2 = pr2.x - pr1.x
|
;mov [dx2],eax ;dx2 = pr2.x - pr1.x
|
||||||
mov eax,[ecx+offs_zbup_y]
|
shl edx,16
|
||||||
sub eax,[ebx+offs_zbup_y]
|
mov [x2],edx ; x2 = pr1.x << 16
|
||||||
mov [dy2],eax ;dy2 = pr2.y - pr1.y
|
mov edx,[ecx+offs_zbup_y]
|
||||||
cmp eax,0 ;if (dy2 > 0)
|
sub edx,[ebx+offs_zbup_y]
|
||||||
|
mov [dy2],edx ;dy2 = pr2.y - pr1.y
|
||||||
|
cmp edx,0 ;if (dy2 > 0)
|
||||||
jle .els_4
|
jle .els_4
|
||||||
mov eax,[dx2]
|
|
||||||
shl eax,16
|
|
||||||
xor edx,edx
|
xor edx,edx
|
||||||
|
cmp eax,0
|
||||||
|
jl .otr_dx2
|
||||||
|
shl eax,16
|
||||||
div dword[dy2] ;eax = (dx2 << 16) / dy2
|
div dword[dy2] ;eax = (dx2 << 16) / dy2
|
||||||
jmp .end_4
|
jmp .end_4
|
||||||
|
.otr_dx2:
|
||||||
|
neg eax
|
||||||
|
inc eax ;dx2 *= -1
|
||||||
|
shl eax,16
|
||||||
|
div dword[dy2] ;eax = (-dx2 << 16) / dy2
|
||||||
|
neg eax
|
||||||
|
inc eax
|
||||||
|
jmp .end_4
|
||||||
.els_4:
|
.els_4:
|
||||||
xor eax,eax
|
xor eax,eax
|
||||||
.end_4:
|
.end_4:
|
||||||
mov [dx2dy2],eax
|
mov [dx2dy2],eax
|
||||||
|
|
||||||
|
if DEBUG ;(5) update_right [dx2dy2], [dy2], [pr1.x], [pr2.x]
|
||||||
|
push ecx edi
|
||||||
|
mov eax,[dx2dy2]
|
||||||
|
shr eax,16
|
||||||
|
mov ecx,80
|
||||||
|
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,[dy2]
|
||||||
|
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 ebx,[pr1]
|
||||||
mov eax,[ebx+offs_zbup_x]
|
mov eax,[ebx+offs_zbup_x]
|
||||||
shl eax,16
|
stdcall convert_int_to_str,ecx
|
||||||
mov [x2],eax ; x2 = pr1.x << 16
|
stdcall str_n_cat,edi,txt_zp_sp,2
|
||||||
|
stdcall str_len,edi
|
||||||
|
add edi,eax
|
||||||
|
sub ecx,eax
|
||||||
|
|
||||||
|
mov ebx,[pr2]
|
||||||
|
mov eax,[ebx+offs_zbup_x]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,m_5,buf_param
|
||||||
|
pop edi ecx
|
||||||
|
end if
|
||||||
.end_upd_r:
|
.end_upd_r:
|
||||||
|
|
||||||
; we draw all the scan line of the part
|
; we draw all the scan line of the part
|
||||||
|
if DEBUG ;[nb_lines]
|
||||||
|
push ecx edi
|
||||||
|
mov eax,[nb_lines]
|
||||||
|
mov ecx,80
|
||||||
|
lea edi,[buf_param]
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,f_fill_tr_nl,buf_param
|
||||||
|
pop edi ecx
|
||||||
|
end if
|
||||||
|
|
||||||
.beg_w_lin:
|
.beg_w_lin:
|
||||||
cmp dword[nb_lines],0 ;while (nb_lines>0)
|
cmp dword[nb_lines],0 ;while (nb_lines>0)
|
||||||
@ -674,6 +762,34 @@ else
|
|||||||
mov [n],eax ;n = (x2 >> 16) - x1
|
mov [n],eax ;n = (x2 >> 16) - x1
|
||||||
imul edi,PSZB
|
imul edi,PSZB
|
||||||
add edi,[pp1] ;pp = pp1 + x1 * PSZB
|
add edi,[pp1] ;pp = pp1 + x1 * PSZB
|
||||||
|
|
||||||
|
if DEBUG ;[n], [x1], [x2]>>16
|
||||||
|
push ecx edi
|
||||||
|
mov eax,[n]
|
||||||
|
mov ecx,80
|
||||||
|
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,[x1]
|
||||||
|
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,[x2]
|
||||||
|
shr eax,16
|
||||||
|
stdcall convert_int_to_str,ecx
|
||||||
|
|
||||||
|
stdcall str_n_cat,edi,txt_nl,2
|
||||||
|
stdcall dbg_print,f_fill_tr_nll,buf_param
|
||||||
|
pop edi ecx
|
||||||
|
end if
|
||||||
|
|
||||||
if INTERP_Z eq 1
|
if INTERP_Z eq 1
|
||||||
mov eax,[x1]
|
mov eax,[x1]
|
||||||
shl eax,1
|
shl eax,1
|
||||||
@ -702,7 +818,11 @@ if INTERP_STZ eq 1
|
|||||||
mov eax,[tz1]
|
mov eax,[tz1]
|
||||||
mov [t_z],eax
|
mov [t_z],eax
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
align 4
|
||||||
.cycle_1: ;while (n>=3)
|
.cycle_1: ;while (n>=3)
|
||||||
|
cmp dword[n],3
|
||||||
|
jl .cycle_2
|
||||||
PUT_PIXEL 0
|
PUT_PIXEL 0
|
||||||
PUT_PIXEL 1
|
PUT_PIXEL 1
|
||||||
PUT_PIXEL 2
|
PUT_PIXEL 2
|
||||||
@ -712,23 +832,24 @@ if INTERP_Z eq 1
|
|||||||
end if
|
end if
|
||||||
add edi,4*PSZB
|
add edi,4*PSZB
|
||||||
sub dword[n],4
|
sub dword[n],4
|
||||||
cmp dword[n],3
|
jmp .cycle_1
|
||||||
jge .cycle_1
|
|
||||||
.cycle_2: ;while (n>=0)
|
.cycle_2: ;while (n>=0)
|
||||||
|
cmp dword[n],0
|
||||||
|
jl .cycle_2_end
|
||||||
PUT_PIXEL 0
|
PUT_PIXEL 0
|
||||||
if INTERP_Z eq 1
|
if INTERP_Z eq 1
|
||||||
add dword[pz],2 ;=sizeof(uint)
|
add dword[pz],2 ;=sizeof(uint)
|
||||||
end if
|
end if
|
||||||
add edi,PSZB
|
add edi,PSZB
|
||||||
dec dword[n]
|
dec dword[n]
|
||||||
cmp dword[n],0
|
jmp .cycle_2
|
||||||
jge .cycle_2
|
.cycle_2_end:
|
||||||
end if
|
end if ;проверка от макроса DRAW_LINE
|
||||||
|
|
||||||
; left edge
|
; left edge
|
||||||
mov eax,[derror]
|
mov eax,[derror]
|
||||||
add [error],eax
|
add [error],eax
|
||||||
cmp eax,0 ;if (error > 0)
|
cmp dword[error],0 ;if (error > 0)
|
||||||
jle .els_er
|
jle .els_er
|
||||||
sub dword[error],0x10000
|
sub dword[error],0x10000
|
||||||
mov eax,[dxdy_max]
|
mov eax,[dxdy_max]
|
||||||
@ -808,6 +929,7 @@ end if
|
|||||||
cmp dword[part],2
|
cmp dword[part],2
|
||||||
jl .cycle_0
|
jl .cycle_0
|
||||||
.end_f:
|
.end_f:
|
||||||
|
popad
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user