From ba6e638119453720ac3668396750b0081f3dd9ca Mon Sep 17 00:00:00 2001 From: IgorA Date: Wed, 30 Dec 2015 20:36:08 +0000 Subject: [PATCH] fix calculate light position (in function Matrix_Inv) git-svn-id: svn://kolibrios.org@6017 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../libraries/TinyGL/asm_fork/clip.asm | 34 ------------------- .../develop/libraries/TinyGL/asm_fork/zgl.inc | 4 +++ .../libraries/TinyGL/asm_fork/zmath.asm | 24 +++++++------ 3 files changed, 18 insertions(+), 44 deletions(-) diff --git a/programs/develop/libraries/TinyGL/asm_fork/clip.asm b/programs/develop/libraries/TinyGL/asm_fork/clip.asm index 0ca6683a83..4bb4634acb 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/clip.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/clip.asm @@ -8,15 +8,6 @@ CLIP_YMAX equ (1<<3) CLIP_ZMIN equ (1<<4) CLIP_ZMAX equ (1<<5) -offs_X equ 0 -offs_Y equ 4 -offs_Z equ 8 -offs_W equ 12 - -if DEBUG -f_ttv db ' gl_transform_to_viewport',0 -end if - align 4 proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword locals @@ -87,31 +78,6 @@ endl fistp dword[ebx+offs_vert_zp+offs_zbup_t] add dword[ebx+offs_vert_zp+offs_zbup_s],ZB_POINT_T_MIN @@: -if DEBUG ;gl_transform_to_viewport -pushad - mov ecx,80 - mov eax,[ebx+offs_vert_zp] - 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,[ebx+offs_vert_zp+offs_zbup_y] - 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,[ebx+offs_vert_zp+offs_zbup_z] - stdcall convert_int_to_str,ecx - - stdcall str_n_cat,edi,txt_nl,2 - stdcall dbg_print,f_ttv,buf_param -popad -end if ret endp diff --git a/programs/develop/libraries/TinyGL/asm_fork/zgl.inc b/programs/develop/libraries/TinyGL/asm_fork/zgl.inc index 6d5abda0b8..2ab3f0d673 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/zgl.inc +++ b/programs/develop/libraries/TinyGL/asm_fork/zgl.inc @@ -2,6 +2,10 @@ include 'opengl_const.inc' include 'zbuffer.inc' include 'zmath.inc' +offs_X equ 0 +offs_Y equ 4 +offs_Z equ 8 +offs_W equ 12 ;enum { OP_ ## a , ... } sum1 equ 0 diff --git a/programs/develop/libraries/TinyGL/asm_fork/zmath.asm b/programs/develop/libraries/TinyGL/asm_fork/zmath.asm index 84b1c70767..50c1f6b336 100644 --- a/programs/develop/libraries/TinyGL/asm_fork/zmath.asm +++ b/programs/develop/libraries/TinyGL/asm_fork/zmath.asm @@ -207,7 +207,7 @@ proc gl_M4_MulV4 uses ebx ecx edx, a:dword, b:dword, c:dword ;V4 *a, M4 *b, V4 * fmul st0,st3 ;st0 *= c.Z faddp fld dword[ebx+12] ;st0 += m[_][3] - fmul st0,st2 ;st0 *= c.Z + fmul st0,st2 ;st0 *= c.W faddp fstp dword[edx] ;a.X = b.m[_][0]*c.X +b.m[_][1]*c.Y +b.m[_][2]*c.Z +b.m[_][3]*c.W add ebx,16 ;следущая строка матрицы @@ -343,14 +343,18 @@ endl shl eax,2 add eax,[m] fld dword[eax] - fcom dword[max] ;if (fabs(m[i*n+j])>fabs(max)) + fld st0 + fabs + fld dword[max] + fabs + fcompp ;if (fabs(m[i*n+j])>fabs(max)) fstsw ax sahf - jbe @f + jae @f mov edx,edi ;k=i fst dword[max] @@: - ffree st0 + ffree st0 ;m[i*n+j] fincstp inc edi jmp .cycle_1 @@ -600,10 +604,10 @@ proc gl_V3_Norm uses ebx, a:dword mov ebx,[a] fld dword[ebx] fmul st0,st0 - fld dword[ebx+4] + fld dword[ebx+offs_Y] fmul st0,st0 faddp - fld dword[ebx+8] + fld dword[ebx+offs_Z] fmul st0,st0 faddp fsqrt ;st0 = sqrt(a.X^2 +a.Y^2 +a.Z^2) @@ -614,12 +618,12 @@ proc gl_V3_Norm uses ebx, a:dword fld dword[ebx] ;offs_X = 0 fdiv st0,st1 fstp dword[ebx] ;a.X/=sqrt(...) - fld dword[ebx+4] + fld dword[ebx+offs_Y] fdiv st0,st1 - fstp dword[ebx+4] ;a.Y/=sqrt(...) - fld dword[ebx+8] + fstp dword[ebx+offs_Y] ;a.Y/=sqrt(...) + fld dword[ebx+offs_Z] fdiv st0,st1 - fstp dword[ebx+8] ;a.Z/=sqrt(...) + fstp dword[ebx+offs_Z] ;a.Z/=sqrt(...) xor eax,eax jmp @f .r1: