fix calculate light position (in function Matrix_Inv)

git-svn-id: svn://kolibrios.org@6017 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2015-12-30 20:36:08 +00:00
parent dd4f527c54
commit ba6e638119
3 changed files with 18 additions and 44 deletions

View File

@ -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

View File

@ -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

View File

@ -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: