add function 'glColor3ub' & some fixes

git-svn-id: svn://kolibrios.org@5387 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2015-01-28 16:54:02 +00:00
parent 2e7798d1dc
commit 23f3365f2a
3 changed files with 38 additions and 14 deletions

View File

@ -158,6 +158,37 @@ proc glColor3fv uses eax, v:dword
ret ret
endp endp
align 4
fl_255 dd 255.0
align 4
proc glColor3ub uses eax, r:dword, g:dword, b:dword
push dword 1.0
fld dword[fl_255]
movzx eax,byte[b]
mov dword[esp-4],eax
fild dword[esp-4]
fdiv st0,st1
fstp dword[esp-4] ;преобразовали int во float
movzx eax,byte[g]
mov dword[esp-8],eax
fild dword[esp-8]
fdiv st0,st1
fstp dword[esp-8]
movzx eax,byte[r]
mov dword[esp-12],eax
fild dword[esp-12]
fdiv st0,st1
fstp dword[esp-12]
ffree st0
fincstp
sub esp,12
call glColor4f
ret
endp
; TexCoord ; TexCoord
align 4 align 4

View File

@ -29,6 +29,7 @@ E_LIB glColor3f ;(float ,float ,float)
E_LIB glColor3d ;(double ,double ,double) E_LIB glColor3d ;(double ,double ,double)
E_LIB glColor3fv ;(float *) E_LIB glColor3fv ;(float *)
E_LIB glColor3dv ;(double *) E_LIB glColor3dv ;(double *)
E_LIB glColor3ub
E_LIB glColor4f ;(float ,float ,float, float ) E_LIB glColor4f ;(float ,float ,float, float )
E_LIB glColor4d ;(double ,double ,double, double ) E_LIB glColor4d ;(double ,double ,double, double )
E_LIB glColor4fv ;(float *) E_LIB glColor4fv ;(float *)

View File

@ -608,10 +608,11 @@ end if
fstp st ;Результат остается на вершине стека st0 fstp st ;Результат остается на вершине стека st0
fmul dword[att] fmul dword[att]
fstp dword[att] ;att=att*pow(dot_spot,l.spot_exponent) fstp dword[att] ;att=att*pow(dot_spot,l.spot_exponent)
jmp .if1_end jmp .if1_end_f1
@@: @@:
ffree st0 ;l.spot_exponent ffree st0 ;l.spot_exponent
fincstp fincstp
.if1_end_f1:
ffree st0 ;dot_spot ffree st0 ;dot_spot
fincstp fincstp
.if1_end: .if1_end:
@ -648,13 +649,13 @@ end if
fstp dword[s+offs_Z] ;s.Z=d.Z+1.0 fstp dword[s+offs_Z] ;s.Z=d.Z+1.0
.els_2_end: .els_2_end:
fld dword[n] fld dword[n]
fmul st0,st0 fmul dword[s]
fld dword[n+offs_Y] fld dword[n+offs_Y]
fmul st0,st0 fmul dword[s+offs_Y]
faddp faddp
fld dword[n+offs_Z] fld dword[n+offs_Z]
fmul st0,st0 fmul dword[s+offs_Z]
faddp ;dot_spec = n.X^2 +n.Y^2 +n.Z^2 faddp ;dot_spec = n.X*s.X +n.Y*s.Y +n.Z*s.Z
cmp dword[twoside],0 ;if (twoside && dot_spec < 0) cmp dword[twoside],0 ;if (twoside && dot_spec < 0)
je @f je @f
ftst ;if (dot_spec < 0) ftst ;if (dot_spec < 0)
@ -710,25 +711,16 @@ end if
fmul dword[ecx+offs_mate_specular] fmul dword[ecx+offs_mate_specular]
fadd dword[lR] fadd dword[lR]
fstp dword[lR] ;lR+=dot_spec * l.specular.v[0] * m.specular.v[0] fstp dword[lR] ;lR+=dot_spec * l.specular.v[0] * m.specular.v[0]
;ffree st0
;fincstp
fld dword[ebx+offs_ligh_specular+4] fld dword[ebx+offs_ligh_specular+4]
fmul st0,st1 fmul st0,st1
fmul dword[ecx+offs_mate_specular+4] fmul dword[ecx+offs_mate_specular+4]
fadd dword[lG] fadd dword[lG]
fstp dword[lG] ;lG+=dot_spec * l.specular.v[1] * m.specular.v[1] fstp dword[lG] ;lG+=dot_spec * l.specular.v[1] * m.specular.v[1]
;ffree st0
;fincstp
fld dword[ebx+offs_ligh_specular+8] fld dword[ebx+offs_ligh_specular+8]
fmul st0,st1 fmul st0,st1
fmul dword[ecx+offs_mate_specular+8] fmul dword[ecx+offs_mate_specular+8]
fadd dword[lB] fadd dword[lB]
fstp dword[lB] ;lB+=dot_spec * l.specular.v[2] * m.specular.v[2] fstp dword[lB] ;lB+=dot_spec * l.specular.v[2] * m.specular.v[2]
;ffree st0
;fincstp
ffree st0 ;dot_spec
fincstp
jmp .if2_end
.if0_end: .if0_end:
ffree st0 ;dot [or] dot_spec ffree st0 ;dot [or] dot_spec
fincstp fincstp