From 32530313f2cadeaef53adef34a10177fbc4f8890 Mon Sep 17 00:00:00 2001 From: IgorA Date: Mon, 24 Nov 2014 23:05:55 +0000 Subject: [PATCH] fix in 'ztriangle.inc' git-svn-id: svn://kolibrios.org@5189 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../TinyGL/asm_fork/examples/test3.asm | 45 ++++++----- .../libraries/TinyGL/asm_fork/ztriangle.inc | 80 ++----------------- 2 files changed, 28 insertions(+), 97 deletions(-) diff --git a/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm b/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm index 369207c752..cd840a91ba 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm @@ -25,9 +25,9 @@ start: mcall 40,0x27 stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 -;;;stdcall [glEnable], GL_DEPTH_TEST +;stdcall [glEnable], GL_DEPTH_TEST stdcall [glClearColor], 0.2,0.0,0.2,0.0 -stdcall [glShadeModel],GL_FLAT +;stdcall [glShadeModel],GL_FLAT call draw_3d @@ -109,28 +109,29 @@ 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 [glBegin],GL_TRIANGLES + + stdcall [glColor3f],0.0, 0.0, 1.0 + stdcall [glVertex3f], 0.0, 0.5, 0.1 + stdcall [glVertex3f], 0.475, 0.823, 0.1 + stdcall [glVertex3f], 0.433, 0.25, 0.1 + + stdcall [glColor3f],0.0, 1.0, 0.0 + stdcall [glVertex3f], 0.5, 0.0, 0.1 + stdcall [glVertex3f], 0.823,-0.475, 0.1 + stdcall [glVertex3f], 0.25, -0.433, 0.1 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 [glVertex3f], 0.0, -0.5, 0.1 + stdcall [glVertex3f], -0.475,-0.823,0.1 + stdcall [glVertex3f], -0.433,-0.25, 0.1 + + stdcall [glVertex3f], -0.5, 0.0, 0.1 + stdcall [glColor3f],1.0, 1.0, 0.0 + stdcall [glVertex3f], -0.823, 0.475, 0.1 + stdcall [glColor3f],1.0, 1.0, 1.0 + stdcall [glVertex3f], -0.25, 0.433, 0.1 + stdcall [glEnd] stdcall [glPopMatrix] diff --git a/programs/develop/libraries/TinyGL/asm_fork/ztriangle.inc b/programs/develop/libraries/TinyGL/asm_fork/ztriangle.inc index 75035c6859..d4f3201108 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/ztriangle.inc +++ b/programs/develop/libraries/TinyGL/asm_fork/ztriangle.inc @@ -170,9 +170,7 @@ end if fstsw ax sahf je .end_f -if DEBUG ;(2) -stdcall dbg_print,txt_sp,m_2 -end if + fld1 fdiv dword[fz] ;fz = 1.0 / fz fst dword[fz] ;st0 = fz @@ -452,9 +450,6 @@ end if mov dword[part],0 .cycle_0: -if DEBUG ;(3) -stdcall dbg_print,txt_sp,m_3 -end if mov ebx,[p0] mov ecx,[p1] mov edx,[p2] @@ -542,43 +537,14 @@ end if mov dword[derror],eax and dword[derror],0xffff ;derror = eax & 0x0000ffff shr eax,16 + bt eax,15 + jnc @f + or eax,0xffff0000 + @@: mov [dxdy_min],eax ;dxdy_min = eax >> 16 inc 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 mov eax,[l1] mov eax,[eax+offs_zbup_z] @@ -696,42 +662,6 @@ end if xor eax,eax .end_4: 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] - 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,[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: ; we draw all the scan line of the part