fixes in Light functions
git-svn-id: svn://kolibrios.org@5262 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5dd0204401
commit
49aa2adc78
|
@ -347,25 +347,30 @@ endp
|
||||||
align 4
|
align 4
|
||||||
fl_1e_3 dd 1.0e-3
|
fl_1e_3 dd 1.0e-3
|
||||||
|
|
||||||
|
if DEBUG
|
||||||
|
txt_mate db 'Material',0
|
||||||
|
txt_colo db 'Color',0
|
||||||
|
end if
|
||||||
|
|
||||||
; non optimized lightening model
|
; non optimized lightening model
|
||||||
align 4
|
align 4
|
||||||
proc gl_shade_vertex, context:dword, v:dword
|
proc gl_shade_vertex, context:dword, v:dword
|
||||||
locals
|
locals
|
||||||
R dd ? ;float
|
R dd ? ;float ebp-100
|
||||||
G dd ? ;float
|
G dd ? ;float ebp-96
|
||||||
B dd ? ;float
|
B dd ? ;float ebp-92
|
||||||
A dd ? ;float
|
A dd ? ;float ebp-88
|
||||||
s V3
|
s V3 ;ebp-84
|
||||||
d V3
|
d V3 ;ebp-72
|
||||||
dist dd ? ;float
|
dist dd ? ;float ebp-60
|
||||||
tmp dd ? ;float
|
tmp dd ? ;float ebp-56
|
||||||
att dd ? ;float
|
att dd ? ;float ebp-52
|
||||||
dot_spot dd ? ;float
|
dot_spot dd ? ;float ebp-48
|
||||||
lR dd ? ;float
|
lR dd ? ;float ebp-44
|
||||||
lB dd ? ;float
|
lB dd ? ;float ebp-40
|
||||||
lG dd ? ;float
|
lG dd ? ;float ebp-36
|
||||||
twoside dd ? ;int
|
twoside dd ? ;int ebp-32
|
||||||
idx dd ? ;int
|
idx dd ? ;int ebp-28
|
||||||
n V3 ;ebp-24
|
n V3 ;ebp-24
|
||||||
vcoord V3 ;ebp-12
|
vcoord V3 ;ebp-12
|
||||||
endl
|
endl
|
||||||
|
@ -387,6 +392,20 @@ pushad
|
||||||
movsd ;n.Z=v.normal.Z
|
movsd ;n.Z=v.normal.Z
|
||||||
mov esi,[v]
|
mov esi,[v]
|
||||||
|
|
||||||
|
if DEBUG ;offs_mate_emission, offs_mate_ambient, offs_mate_specular, offs_mate_diffuse
|
||||||
|
push ecx
|
||||||
|
stdcall dbg_print,txt_mate,txt_nl
|
||||||
|
add ecx,offs_mate_emission
|
||||||
|
stdcall gl_print_matrix,ecx,1
|
||||||
|
add ecx,offs_mate_ambient-offs_mate_emission
|
||||||
|
stdcall gl_print_matrix,ecx,1
|
||||||
|
add ecx,offs_mate_specular-offs_mate_ambient
|
||||||
|
stdcall gl_print_matrix,ecx,1
|
||||||
|
add ecx,offs_mate_diffuse-offs_mate_specular
|
||||||
|
stdcall gl_print_matrix,ecx,1
|
||||||
|
pop ecx
|
||||||
|
end if
|
||||||
|
|
||||||
fld dword[edx+offs_cont_ambient_light_model]
|
fld dword[edx+offs_cont_ambient_light_model]
|
||||||
fmul dword[ecx+offs_mate_ambient]
|
fmul dword[ecx+offs_mate_ambient]
|
||||||
fadd dword[ecx] ;offs_mate_emission=0
|
fadd dword[ecx] ;offs_mate_emission=0
|
||||||
|
@ -409,7 +428,7 @@ pushad
|
||||||
|
|
||||||
; ambient
|
; ambient
|
||||||
fld dword[ecx+offs_mate_ambient]
|
fld dword[ecx+offs_mate_ambient]
|
||||||
fmul dword[ebx+offs_ligh_ambient]
|
fmul dword[ebx] ;offs_ligh_ambient=0
|
||||||
fstp dword[lR] ;lR=l.ambient.v[0] * m.ambient.v[0]
|
fstp dword[lR] ;lR=l.ambient.v[0] * m.ambient.v[0]
|
||||||
fld dword[ecx+offs_mate_ambient+4]
|
fld dword[ecx+offs_mate_ambient+4]
|
||||||
fmul dword[ebx+offs_ligh_ambient+4]
|
fmul dword[ebx+offs_ligh_ambient+4]
|
||||||
|
@ -658,7 +677,7 @@ pushad
|
||||||
; testing specular buffer code
|
; testing specular buffer code
|
||||||
; dot_spec= pow(dot_spec,m.shininess)
|
; dot_spec= pow(dot_spec,m.shininess)
|
||||||
stdcall specbuf_get_buffer, edx, dword[ecx+offs_mate_shininess_i], dword[ecx+offs_mate_shininess]
|
stdcall specbuf_get_buffer, edx, dword[ecx+offs_mate_shininess_i], dword[ecx+offs_mate_shininess]
|
||||||
;eax = specbuf
|
mov edi,eax ;edi = specbuf
|
||||||
mov dword[idx],SPECULAR_BUFFER_SIZE
|
mov dword[idx],SPECULAR_BUFFER_SIZE
|
||||||
fild dword[idx]
|
fild dword[idx]
|
||||||
fld1
|
fld1
|
||||||
|
@ -673,21 +692,21 @@ pushad
|
||||||
ffree st0 ;dot_spec
|
ffree st0 ;dot_spec
|
||||||
fincstp
|
fincstp
|
||||||
shl dword[idx],2
|
shl dword[idx],2
|
||||||
add eax,dword[idx]
|
add edi,dword[idx]
|
||||||
fld dword[eax+offs_spec_buf] ;dot_spec = specbuf.buf[idx]
|
fld dword[edi+offs_spec_buf] ;dot_spec = specbuf.buf[idx]
|
||||||
fld dword[ebx+offs_ligh_specular]
|
fld dword[ebx+offs_ligh_specular]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
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]
|
||||||
fld dword[ebx+offs_ligh_specular+offs_Y]
|
fld dword[ebx+offs_ligh_specular+4]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fmul dword[ecx+offs_mate_specular+offs_Y]
|
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]
|
||||||
fld dword[ebx+offs_ligh_specular+offs_Z]
|
fld dword[ebx+offs_ligh_specular+8]
|
||||||
fmul st0,st1
|
fmul st0,st1
|
||||||
fmul dword[ecx+offs_mate_specular+offs_Z]
|
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 ;dot_spec
|
ffree st0 ;dot_spec
|
||||||
|
@ -725,6 +744,13 @@ pushad
|
||||||
mov [esi+offs_vert_color+8],eax ;v.color.v[2]=clampf(B,0,1)
|
mov [esi+offs_vert_color+8],eax ;v.color.v[2]=clampf(B,0,1)
|
||||||
mov eax,[A]
|
mov eax,[A]
|
||||||
mov [esi+offs_vert_color+12],eax ;v.color.v[3]=A
|
mov [esi+offs_vert_color+12],eax ;v.color.v[3]=A
|
||||||
|
if DEBUG ;offs_vert_color
|
||||||
|
push esi
|
||||||
|
stdcall dbg_print,txt_colo,txt_nl
|
||||||
|
add esi,offs_vert_color
|
||||||
|
stdcall gl_print_matrix,esi,1
|
||||||
|
pop esi
|
||||||
|
end if
|
||||||
popad
|
popad
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
|
@ -10,6 +10,8 @@ endl
|
||||||
fld1
|
fld1
|
||||||
fidiv dword[f_inc]
|
fidiv dword[f_inc]
|
||||||
fstp dword[f_inc] ;f_inc = 1.0f/SPECULAR_BUFFER_SIZE
|
fstp dword[f_inc] ;f_inc = 1.0f/SPECULAR_BUFFER_SIZE
|
||||||
|
mov ebx,[buf]
|
||||||
|
add ebx,offs_spec_buf
|
||||||
xor ecx,ecx
|
xor ecx,ecx
|
||||||
align 4
|
align 4
|
||||||
.cycle_0: ;for (i = 0; i <= SPECULAR_BUFFER_SIZE; i++)
|
.cycle_0: ;for (i = 0; i <= SPECULAR_BUFFER_SIZE; i++)
|
||||||
|
@ -30,11 +32,8 @@ align 4
|
||||||
fxch st1
|
fxch st1
|
||||||
fstp st ;Результат остается на вершине стека st0
|
fstp st ;Результат остается на вершине стека st0
|
||||||
|
|
||||||
mov ebx,ecx
|
|
||||||
shl ebx,2
|
|
||||||
add ebx,offs_spec_buf
|
|
||||||
add ebx,[buf]
|
|
||||||
fstp dword[ebx] ;buf.buf[i] = pow(val, shininess)
|
fstp dword[ebx] ;buf.buf[i] = pow(val, shininess)
|
||||||
|
add ebx,4
|
||||||
|
|
||||||
fld dword[val]
|
fld dword[val]
|
||||||
fadd dword[f_inc]
|
fadd dword[f_inc]
|
||||||
|
|
|
@ -59,7 +59,9 @@ endl
|
||||||
sub edi,16 ;edi = &q[3]
|
sub edi,16 ;edi = &q[3]
|
||||||
mov ecx,4
|
mov ecx,4
|
||||||
rep movsd
|
rep movsd
|
||||||
stdcall glopMaterial, eax,[q]
|
;mov edi,ebp
|
||||||
|
sub edi,28 ;edi = &q
|
||||||
|
stdcall glopMaterial, eax,edi
|
||||||
@@:
|
@@:
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
Loading…
Reference in New Issue