forked from KolibriOS/kolibrios
fixes in material colors
git-svn-id: svn://kolibrios.org@5269 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5785bb90d5
commit
bade30c7b8
@ -24,8 +24,9 @@ start:
|
|||||||
|
|
||||||
mcall 40,0x27
|
mcall 40,0x27
|
||||||
|
|
||||||
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
|
stdcall [kosglMakeCurrent], 10,10,400,325,ctx1
|
||||||
stdcall [glEnable], GL_DEPTH_TEST
|
stdcall [glEnable], GL_DEPTH_TEST
|
||||||
|
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
|
||||||
stdcall [gluNewQuadric]
|
stdcall [gluNewQuadric]
|
||||||
mov [qObj],eax
|
mov [qObj],eax
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ draw_window:
|
|||||||
mcall 12,1
|
mcall 12,1
|
||||||
|
|
||||||
mov edx,0x33ffffff ;0x73ffffff
|
mov edx,0x33ffffff ;0x73ffffff
|
||||||
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption
|
mcall 0,(50 shl 16)+430,(30 shl 16)+375,,,caption
|
||||||
stdcall [kosglSwapBuffers]
|
stdcall [kosglSwapBuffers]
|
||||||
|
|
||||||
mcall 12,2
|
mcall 12,2
|
||||||
@ -150,15 +151,15 @@ stdcall [glPushMatrix]
|
|||||||
|
|
||||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||||
stdcall [gluSphere], [qObj], 1.0, 16,16
|
stdcall [gluSphere], [qObj], 1.0, 32,32
|
||||||
|
|
||||||
stdcall [glColor3f], 1.0, 0.0, 0.0
|
stdcall [glColor3f], 1.0, 0.0, 0.0
|
||||||
stdcall [glTranslatef], -1.6,0.0,0.0
|
stdcall [glTranslatef], -1.6,0.0,0.0
|
||||||
stdcall [gluSphere], [qObj], 0.55, 8,8
|
stdcall [gluSphere], [qObj], 0.55, 16,16
|
||||||
|
|
||||||
stdcall [glColor3f], 0.0, 0.0, 1.0
|
stdcall [glColor3f], 0.0, 0.0, 1.0
|
||||||
stdcall [glTranslatef], 3.2,0.0,0.0
|
stdcall [glTranslatef], 3.2,0.0,0.0
|
||||||
stdcall [gluSphere], [qObj], 0.55, 8,8
|
stdcall [gluSphere], [qObj], 0.55, 16,16
|
||||||
stdcall [glPopMatrix]
|
stdcall [glPopMatrix]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -39,12 +39,13 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
|||||||
mov dword[edx+offs_cont_vertex],eax
|
mov dword[edx+offs_cont_vertex],eax
|
||||||
|
|
||||||
; viewport
|
; viewport
|
||||||
mov dword[edx+offs_cont_viewport+offs_vpor_xmin],0
|
xor eax,eax
|
||||||
mov dword[edx+offs_cont_viewport+offs_vpor_ymin],0
|
mov dword[edx+offs_cont_viewport+offs_vpor_xmin],eax
|
||||||
|
mov dword[edx+offs_cont_viewport+offs_vpor_ymin],eax
|
||||||
mov eax,[ecx+offs_zbuf_xsize]
|
mov eax,[ecx+offs_zbuf_xsize]
|
||||||
mov dword[edx+offs_cont_viewport+offs_vpor_xsize], eax
|
mov dword[edx+offs_cont_viewport+offs_vpor_xsize],eax
|
||||||
mov eax,[ecx+offs_zbuf_ysize]
|
mov eax,[ecx+offs_zbuf_ysize]
|
||||||
mov dword[edx+offs_cont_viewport+offs_vpor_ysize], eax
|
mov dword[edx+offs_cont_viewport+offs_vpor_ysize],eax
|
||||||
mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
|
mov dword[edx+offs_cont_viewport+offs_vpor_updated],1
|
||||||
|
|
||||||
; shared state
|
; shared state
|
||||||
@ -71,9 +72,7 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
|||||||
gl_V3_New eax+offs_ligh_norm_spot_direction, 0.0,0.0,-1.0
|
gl_V3_New eax+offs_ligh_norm_spot_direction, 0.0,0.0,-1.0
|
||||||
mov dword[eax+offs_ligh_spot_exponent],0.0
|
mov dword[eax+offs_ligh_spot_exponent],0.0
|
||||||
mov dword[eax+offs_ligh_spot_cutoff],180.0
|
mov dword[eax+offs_ligh_spot_cutoff],180.0
|
||||||
mov dword[eax+offs_ligh_attenuation],1.0
|
gl_V3_New eax+offs_ligh_attenuation, 1.0,0.0,0.0
|
||||||
mov dword[eax+offs_ligh_attenuation+4],0.0
|
|
||||||
mov dword[eax+offs_ligh_attenuation+8],0.0
|
|
||||||
mov dword[eax+offs_ligh_enabled],0
|
mov dword[eax+offs_ligh_enabled],0
|
||||||
add eax,sizeof.GLLight
|
add eax,sizeof.GLLight
|
||||||
dec ecx
|
dec ecx
|
||||||
@ -107,25 +106,14 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
|||||||
stdcall glInitTextures,edx
|
stdcall glInitTextures,edx
|
||||||
|
|
||||||
; default state
|
; default state
|
||||||
mov dword[edx+offs_cont_current_color],1.0
|
gl_V4_New edx+offs_cont_current_color, 1.0,1.0,1.0,1.0
|
||||||
mov dword[edx+offs_cont_current_color+4],1.0
|
gl_V3_New edx+offs_cont_longcurrent_color, 65535,65535,65535
|
||||||
mov dword[edx+offs_cont_current_color+8],1.0
|
|
||||||
mov dword[edx+offs_cont_current_color+12],1.0
|
|
||||||
mov dword[edx+offs_cont_longcurrent_color],65535
|
|
||||||
mov dword[edx+offs_cont_longcurrent_color+4],65535
|
|
||||||
mov dword[edx+offs_cont_longcurrent_color+8],65535
|
|
||||||
|
|
||||||
mov dword[edx+offs_cont_current_normal],1.0
|
gl_V4_New edx+offs_cont_current_normal, 1.0,0.0,0.0,0.0
|
||||||
mov dword[edx+offs_cont_current_normal+4],0.0
|
|
||||||
mov dword[edx+offs_cont_current_normal+8],0.0
|
|
||||||
mov dword[edx+offs_cont_current_normal+12],0.0
|
|
||||||
|
|
||||||
mov dword[edx+offs_cont_current_edge_flag],1
|
mov dword[edx+offs_cont_current_edge_flag],1
|
||||||
|
|
||||||
mov dword[edx+offs_cont_current_tex_coord],0.0
|
gl_V4_New edx+offs_cont_current_tex_coord, 0.0,0.0,0.0,1.0
|
||||||
mov dword[edx+offs_cont_current_tex_coord+4],0.0
|
|
||||||
mov dword[edx+offs_cont_current_tex_coord+8],0.0
|
|
||||||
mov dword[edx+offs_cont_current_tex_coord+12],1.0
|
|
||||||
|
|
||||||
mov dword[edx+offs_cont_polygon_mode_front],GL_FILL
|
mov dword[edx+offs_cont_polygon_mode_front],GL_FILL
|
||||||
mov dword[edx+offs_cont_polygon_mode_back],GL_FILL
|
mov dword[edx+offs_cont_polygon_mode_back],GL_FILL
|
||||||
@ -136,10 +124,7 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
|||||||
mov dword[edx+offs_cont_cull_face_enabled],0
|
mov dword[edx+offs_cont_cull_face_enabled],0
|
||||||
|
|
||||||
; clear
|
; clear
|
||||||
mov dword[edx+offs_cont_clear_color],0.0
|
gl_V4_New edx+offs_cont_clear_color, 0.0,0.0,0.0,0.0
|
||||||
mov dword[edx+offs_cont_clear_color+4],0.0
|
|
||||||
mov dword[edx+offs_cont_clear_color+8],0.0
|
|
||||||
mov dword[edx+offs_cont_clear_color+12],0.0
|
|
||||||
mov dword[edx+offs_cont_clear_depth],0
|
mov dword[edx+offs_cont_clear_depth],0
|
||||||
|
|
||||||
; selection
|
; selection
|
||||||
@ -150,9 +135,8 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
|||||||
; matrix
|
; matrix
|
||||||
mov dword[edx+offs_cont_matrix_mode],0
|
mov dword[edx+offs_cont_matrix_mode],0
|
||||||
|
|
||||||
mov dword[edx+offs_cont_matrix_stack_depth_max],MAX_MODELVIEW_STACK_DEPTH
|
gl_V3_New edx+offs_cont_matrix_stack_depth_max,\
|
||||||
mov dword[edx+offs_cont_matrix_stack_depth_max+4],MAX_PROJECTION_STACK_DEPTH
|
MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH
|
||||||
mov dword[edx+offs_cont_matrix_stack_depth_max+8],MAX_TEXTURE_STACK_DEPTH
|
|
||||||
|
|
||||||
mov ecx,3 ;for(i=0;i<3;i++)
|
mov ecx,3 ;for(i=0;i<3;i++)
|
||||||
mov ebx,edx
|
mov ebx,edx
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
align 4
|
||||||
|
sp128f dd 128.0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
|
proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
|
||||||
@ -14,7 +16,8 @@ proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
|
|||||||
stdcall glopMaterial,eax,edi
|
stdcall glopMaterial,eax,edi
|
||||||
mov ecx,GL_BACK
|
mov ecx,GL_BACK
|
||||||
@@:
|
@@:
|
||||||
mov edi,[eax+offs_cont_materials]
|
mov edi,eax
|
||||||
|
add edi,offs_cont_materials
|
||||||
cmp ecx,GL_FRONT ;if (mode == GL_FRONT) m=&context.materials[0]
|
cmp ecx,GL_FRONT ;if (mode == GL_FRONT) m=&context.materials[0]
|
||||||
je @f
|
je @f
|
||||||
add edi,sizeof.GLMaterial ;else m=&context.materials[1]
|
add edi,sizeof.GLMaterial ;else m=&context.materials[1]
|
||||||
@ -54,7 +57,7 @@ proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
|
|||||||
add edi,offs_mate_shininess
|
add edi,offs_mate_shininess
|
||||||
movsd
|
movsd
|
||||||
mov dword[edi],SPECULAR_BUFFER_RESOLUTION
|
mov dword[edi],SPECULAR_BUFFER_RESOLUTION
|
||||||
fdiv dword[an180f]
|
fdiv dword[sp128f]
|
||||||
fimul dword[edi]
|
fimul dword[edi]
|
||||||
fistp dword[edi] ;m.shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION
|
fistp dword[edi] ;m.shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
@ -174,10 +177,12 @@ pushad
|
|||||||
add edi,offs_ligh_spot_direction
|
add edi,offs_ligh_spot_direction
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
rep movsd ;l.spot_direction=v[0,1,2]
|
rep movsd ;l.spot_direction=v[0,1,2]
|
||||||
mov esi,ebx
|
;mov esi,ebx
|
||||||
add esi,12
|
;add esi,12
|
||||||
mov edi,edx
|
sub esi,12
|
||||||
add edi,offs_ligh_norm_spot_direction
|
;mov edi,edx
|
||||||
|
;add edi,offs_ligh_norm_spot_direction
|
||||||
|
add edi,offs_ligh_norm_spot_direction-(offs_ligh_spot_direction+12)
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
rep movsd ;l.norm_spot_direction=v[0,1,2]
|
rep movsd ;l.norm_spot_direction=v[0,1,2]
|
||||||
add edx,offs_ligh_norm_spot_direction
|
add edx,offs_ligh_norm_spot_direction
|
||||||
@ -380,7 +385,8 @@ pushad
|
|||||||
; esi -> GLVertex *v
|
; esi -> GLVertex *v
|
||||||
mov esi,[v]
|
mov esi,[v]
|
||||||
mov edx,[context]
|
mov edx,[context]
|
||||||
mov ecx,[edx+offs_cont_materials] ;ecx(m) = &context.materials[0]
|
mov ecx,edx
|
||||||
|
add ecx,offs_cont_materials ;ecx(m) = &context.materials[0]
|
||||||
mov eax,[edx+offs_cont_light_model_two_side]
|
mov eax,[edx+offs_cont_light_model_two_side]
|
||||||
mov [twoside],eax
|
mov [twoside],eax
|
||||||
|
|
||||||
@ -437,19 +443,26 @@ end if
|
|||||||
fmul dword[ebx+offs_ligh_ambient+8]
|
fmul dword[ebx+offs_ligh_ambient+8]
|
||||||
fstp dword[lB] ;lB=l.ambient.v[2] * m.ambient.v[2]
|
fstp dword[lB] ;lB=l.ambient.v[2] * m.ambient.v[2]
|
||||||
|
|
||||||
cmp dword[ebx+offs_ligh_position+12],0 ;if (l.position.v[3] == 0)
|
fld dword[ebx+offs_ligh_position+offs_W]
|
||||||
|
ftst ;if (l.position.v[3] == 0)
|
||||||
|
fstsw ax
|
||||||
|
sahf
|
||||||
jne .els_0
|
jne .els_0
|
||||||
; light at infinity
|
; light at infinity
|
||||||
|
ffree st0 ;l.position.v[3]
|
||||||
|
fincstp
|
||||||
mov eax,[ebx+offs_ligh_position]
|
mov eax,[ebx+offs_ligh_position]
|
||||||
mov [d],eax ;d.X=l.position.v[0]
|
mov [d],eax ;d.X=l.position.v[0]
|
||||||
mov eax,[ebx+offs_ligh_position+4]
|
mov eax,[ebx+offs_ligh_position+offs_Y]
|
||||||
mov [d+4],eax ;d.Y=l.position.v[1]
|
mov [d+offs_Y],eax ;d.Y=l.position.v[1]
|
||||||
mov eax,[ebx+offs_ligh_position+8]
|
mov eax,[ebx+offs_ligh_position+offs_Z]
|
||||||
mov [d+8],eax ;d.Z=l.position.v[2]
|
mov [d+offs_Z],eax ;d.Z=l.position.v[2]
|
||||||
mov dword[att],1.0
|
mov dword[att],1.0
|
||||||
jmp .els_0_end
|
jmp .els_0_end
|
||||||
.els_0:
|
.els_0:
|
||||||
; distance attenuation
|
; distance attenuation
|
||||||
|
ffree st0 ;l.position.v[3]
|
||||||
|
fincstp
|
||||||
fld dword[ebx+offs_ligh_position]
|
fld dword[ebx+offs_ligh_position]
|
||||||
fsub dword[esi+offs_vert_ec]
|
fsub dword[esi+offs_vert_ec]
|
||||||
fstp dword[d] ;d.X=l.position.v[0]-v.ec.v[0]
|
fstp dword[d] ;d.X=l.position.v[0]-v.ec.v[0]
|
||||||
@ -468,7 +481,7 @@ end if
|
|||||||
fmul st0,st0
|
fmul st0,st0
|
||||||
faddp
|
faddp
|
||||||
fsqrt
|
fsqrt
|
||||||
fst dword[dist] ;dist=sqrt(d.X^2+d^2+d^2)
|
fst dword[dist] ;dist=sqrt(d.X^2+d.Y^2+d.Z^2)
|
||||||
fcom dword[fl_1e_3]
|
fcom dword[fl_1e_3]
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
@ -519,7 +532,7 @@ end if
|
|||||||
ftst ;if (dot>0)
|
ftst ;if (dot>0)
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jle .if0_end
|
jbe .if0_end
|
||||||
; diffuse light
|
; diffuse light
|
||||||
fld dword[ecx+offs_mate_diffuse]
|
fld dword[ecx+offs_mate_diffuse]
|
||||||
fmul dword[ebx+offs_ligh_diffuse]
|
fmul dword[ebx+offs_ligh_diffuse]
|
||||||
@ -654,7 +667,7 @@ end if
|
|||||||
ftst ;if (dot_spec > 0)
|
ftst ;if (dot_spec > 0)
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
jae .if0_end
|
jbe .if0_end
|
||||||
fld dword[s]
|
fld dword[s]
|
||||||
fmul st0,st0
|
fmul st0,st0
|
||||||
fld dword[s+offs_Y]
|
fld dword[s+offs_Y]
|
||||||
@ -678,17 +691,16 @@ end if
|
|||||||
; 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]
|
||||||
mov edi,eax ;edi = specbuf
|
mov edi,eax ;edi = specbuf
|
||||||
mov dword[idx],SPECULAR_BUFFER_SIZE
|
mov dword[idx],SPECULAR_BUFFER_SIZE ;idx = SPECULAR_BUFFER_SIZE
|
||||||
fild dword[idx]
|
|
||||||
fld1
|
fld1
|
||||||
fcomp
|
fcomp
|
||||||
fstsw ax
|
fstsw ax
|
||||||
|
fild dword[idx]
|
||||||
sahf
|
sahf
|
||||||
jae @f
|
jae @f ;if(dot_spec < 1.0)
|
||||||
fmul st0,st1
|
fmul st0,st1 ;idx *= dot_spec
|
||||||
@@:
|
@@:
|
||||||
fistp dword[idx] ;if (dot_spec < 1.0) idx = (int)(dot_spec*SPECULAR_BUFFER_SIZE)
|
fistp dword[idx]
|
||||||
;else idx = SPECULAR_BUFFER_SIZE;
|
|
||||||
ffree st0 ;dot_spec
|
ffree st0 ;dot_spec
|
||||||
fincstp
|
fincstp
|
||||||
shl dword[idx],2
|
shl dword[idx],2
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
|
|
||||||
if DEBUG
|
if DEBUG
|
||||||
|
align 4
|
||||||
|
txt_gl_scal db 'glopScale',0
|
||||||
|
txt_gl_tran db 'glopTranslate',0
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
proc gl_print_matrix uses eax ebx ecx edi, m:dword, rows:dword
|
proc gl_print_matrix uses eax ebx ecx edi, m:dword, rows:dword
|
||||||
mov ecx,[rows]
|
mov ecx,[rows]
|
||||||
@ -380,6 +384,7 @@ proc glopScale uses eax ebx ecx, context:dword, p:dword
|
|||||||
loop @b
|
loop @b
|
||||||
|
|
||||||
if DEBUG ;glopScale
|
if DEBUG ;glopScale
|
||||||
|
stdcall dbg_print,txt_gl_scal,txt_nl
|
||||||
mov ebx,[eax+offs_cont_matrix_mode]
|
mov ebx,[eax+offs_cont_matrix_mode]
|
||||||
shl ebx,2
|
shl ebx,2
|
||||||
add ebx,eax
|
add ebx,eax
|
||||||
@ -408,9 +413,9 @@ proc glopTranslate uses eax ebx ecx, context:dword, p:dword
|
|||||||
fmul st0,st3 ;m[0] * x
|
fmul st0,st3 ;m[0] * x
|
||||||
fld dword[ebx+4] ;m[1]
|
fld dword[ebx+4] ;m[1]
|
||||||
fmul st0,st3 ;m[1] * y
|
fmul st0,st3 ;m[1] * y
|
||||||
fld dword[ebx+8] ;m[2]
|
|
||||||
fmul st0,st3 ;m[2] * z
|
|
||||||
faddp
|
faddp
|
||||||
|
fld dword[ebx+8] ;m[2]
|
||||||
|
fmul st0,st2 ;m[2] * z
|
||||||
faddp
|
faddp
|
||||||
fadd dword[ebx+12] ;m[3]
|
fadd dword[ebx+12] ;m[3]
|
||||||
fstp dword[ebx+12] ;m[3] = m[0] * x + m[1] * y + m[2] * z + m[3]
|
fstp dword[ebx+12] ;m[3] = m[0] * x + m[1] * y + m[2] * z + m[3]
|
||||||
@ -424,6 +429,7 @@ proc glopTranslate uses eax ebx ecx, context:dword, p:dword
|
|||||||
fincstp
|
fincstp
|
||||||
|
|
||||||
if DEBUG ;glopTranslate
|
if DEBUG ;glopTranslate
|
||||||
|
stdcall dbg_print,txt_gl_tran,txt_nl
|
||||||
mov ebx,[eax+offs_cont_matrix_mode]
|
mov ebx,[eax+offs_cont_matrix_mode]
|
||||||
shl ebx,2
|
shl ebx,2
|
||||||
add ebx,eax
|
add ebx,eax
|
||||||
|
@ -108,13 +108,6 @@ endl
|
|||||||
mov dword[zsize],(1 shl ZB_POINT_Z_FRAC_BITS) / 2
|
mov dword[zsize],(1 shl ZB_POINT_Z_FRAC_BITS) / 2
|
||||||
fiadd dword[zsize]
|
fiadd dword[zsize]
|
||||||
fstp dword[eax+offs_vpor_trans+offs_Z]
|
fstp dword[eax+offs_vpor_trans+offs_Z]
|
||||||
if DEBUG ;gl_eval_viewport
|
|
||||||
stdcall dbg_print,f_ev,txt_nl
|
|
||||||
add eax,offs_vpor_scale
|
|
||||||
stdcall gl_print_matrix,eax,1
|
|
||||||
add eax,8
|
|
||||||
stdcall gl_print_matrix,eax,1
|
|
||||||
end if
|
|
||||||
ret
|
ret
|
||||||
endp
|
endp
|
||||||
|
|
||||||
@ -260,11 +253,11 @@ pushad
|
|||||||
fmul st0,st3 ;st0 *= v.coord.X
|
fmul st0,st3 ;st0 *= v.coord.X
|
||||||
fld dword[ebx+4] ;st0 = m[1]
|
fld dword[ebx+4] ;st0 = m[1]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Y
|
fmul st0,st3 ;st0 *= v.coord.Y
|
||||||
|
faddp ;st0 = v.coord.X * m[0] + v.coord.Y * m[1]
|
||||||
fld dword[ebx+8] ;st0 = m[2]
|
fld dword[ebx+8] ;st0 = m[2]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Z
|
fmul st0,st2 ;st0 *= v.coord.Z
|
||||||
fadd dword[ebx+12] ;st0 += m[3]
|
fadd dword[ebx+12] ;st0 += m[3]
|
||||||
faddp ;st0 += v.coord.Z * m[2]
|
faddp ;st0 += v.ec.X
|
||||||
faddp ;st0 += v.coord.Y * m[1]
|
|
||||||
fstp dword[edx+offs_vert_ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
|
fstp dword[edx+offs_vert_ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
|
||||||
add ebx,16 ;следущая строка матрицы
|
add ebx,16 ;следущая строка матрицы
|
||||||
add edx,4 ;следущая координата вектора
|
add edx,4 ;следущая координата вектора
|
||||||
@ -290,11 +283,11 @@ pushad
|
|||||||
fmul st0,st3 ;st0 *= v.ec.X
|
fmul st0,st3 ;st0 *= v.ec.X
|
||||||
fld dword[ebx+4] ;st0 = m[1]
|
fld dword[ebx+4] ;st0 = m[1]
|
||||||
fmul st0,st3 ;st0 *= v.ec.Y
|
fmul st0,st3 ;st0 *= v.ec.Y
|
||||||
|
faddp ;st0 = v.ec.X * m[0] + v.ec.Y * m[1]
|
||||||
fld dword[ebx+8] ;st0 = m[2]
|
fld dword[ebx+8] ;st0 = m[2]
|
||||||
fmul st0,st3 ;st0 *= v.ec.Z
|
fmul st0,st2 ;st0 *= v.ec.Z
|
||||||
fadd dword[ebx+12] ;st0 += m[3]
|
fadd dword[ebx+12] ;st0 += m[3]
|
||||||
faddp ;st0 += v.ec.Z * m[2]
|
faddp ;st0 = v.pc.X
|
||||||
faddp ;st0 += v.ec.Y * m[1]
|
|
||||||
fstp dword[edx+offs_vert_pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + m[3]
|
fstp dword[edx+offs_vert_pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + m[3]
|
||||||
add ebx,16 ;следущая строка матрицы
|
add ebx,16 ;следущая строка матрицы
|
||||||
add edx,4 ;следущая координата вектора
|
add edx,4 ;следущая координата вектора
|
||||||
@ -317,24 +310,24 @@ pushad
|
|||||||
fld dword[edi+offs_Z]
|
fld dword[edi+offs_Z]
|
||||||
|
|
||||||
mov ecx,3
|
mov ecx,3
|
||||||
|
add edx,offs_vert_normal
|
||||||
.cycle_2:
|
.cycle_2:
|
||||||
fld dword[ebx] ;st0 = m[0]
|
fld dword[ebx] ;st0 = m[0]
|
||||||
fmul st0,st3 ;st0 *= n.X
|
fmul st0,st3 ;st0 *= n.X
|
||||||
fld dword[ebx+4] ;st0 = m[1]
|
fld dword[ebx+4] ;st0 = m[1]
|
||||||
fmul st0,st3 ;st0 *= n.Y
|
fmul st0,st3 ;st0 *= n.Y
|
||||||
|
faddp ;st0 = n.X * m[0] + n.Y * m[1]
|
||||||
fld dword[ebx+8] ;st0 = m[2]
|
fld dword[ebx+8] ;st0 = m[2]
|
||||||
fmul st0,st3 ;st0 *= n.Z
|
fmul st0,st2 ;st0 *= n.Z
|
||||||
faddp ;st0 += n.Z * m[2]
|
faddp ;st0 = v.normal.X
|
||||||
faddp ;st0 += n.Y * m[1]
|
fstp dword[edx] ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
|
||||||
fstp dword[edx+offs_vert_normal] ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
|
|
||||||
add ebx,16 ;следущая строка матрицы
|
add ebx,16 ;следущая строка матрицы
|
||||||
add edx,4 ;следущая координата вектора
|
add edx,4 ;следущая координата вектора
|
||||||
loop .cycle_2
|
loop .cycle_2
|
||||||
|
|
||||||
cmp dword[eax+offs_cont_normalize_enabled],0
|
cmp dword[eax+offs_cont_normalize_enabled],0
|
||||||
je .end_els
|
je .end_els
|
||||||
mov edx,[v]
|
sub edx,12
|
||||||
add edx,offs_vert_normal
|
|
||||||
stdcall gl_V3_Norm,edx
|
stdcall gl_V3_Norm,edx
|
||||||
jmp .end_els
|
jmp .end_els
|
||||||
.els_0:
|
.els_0:
|
||||||
@ -355,34 +348,34 @@ pushad
|
|||||||
fmul st0,st3 ;st0 *= v.coord.X
|
fmul st0,st3 ;st0 *= v.coord.X
|
||||||
fld dword[ebx+4] ;st0 = m[1]
|
fld dword[ebx+4] ;st0 = m[1]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Y
|
fmul st0,st3 ;st0 *= v.coord.Y
|
||||||
|
faddp ;st0 = v.coord.X * m[0] + v.coord.Y * m[1]
|
||||||
fld dword[ebx+8] ;st0 = m[2]
|
fld dword[ebx+8] ;st0 = m[2]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Z
|
fmul st0,st2 ;st0 *= v.coord.Z
|
||||||
fadd dword[ebx+12] ;st0 += m[3]
|
fadd dword[ebx+12] ;st0 += m[3]
|
||||||
faddp ;st0 += v.coord.Z * m[2]
|
faddp ;st0 = v.pc.X
|
||||||
faddp ;st0 += v.coord.Y * m[1]
|
|
||||||
fstp dword[esi] ;v.pc.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
|
fstp dword[esi] ;v.pc.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3]
|
||||||
|
|
||||||
fld dword[ebx+16] ;st0 = m[4]
|
fld dword[ebx+16] ;st0 = m[4]
|
||||||
fmul st0,st3 ;st0 *= v.coord.X
|
fmul st0,st3 ;st0 *= v.coord.X
|
||||||
fld dword[ebx+20] ;st0 = m[5]
|
fld dword[ebx+20] ;st0 = m[5]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Y
|
fmul st0,st3 ;st0 *= v.coord.Y
|
||||||
|
faddp ;st0 = v.coord.X * m[4] + v.coord.Y * m[5]
|
||||||
fld dword[ebx+24] ;st0 = m[6]
|
fld dword[ebx+24] ;st0 = m[6]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Z
|
fmul st0,st2 ;st0 *= v.coord.Z
|
||||||
fadd dword[ebx+28] ;st0 += m[7]
|
fadd dword[ebx+28] ;st0 += m[7]
|
||||||
faddp ;st0 += v.coord.Z * m[6]
|
faddp ;st0 = v.pc.Y
|
||||||
faddp ;st0 += v.coord.Y * m[5]
|
fstp dword[esi+4] ;v.pc.Y = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
|
||||||
fstp dword[esi+4] ;v.pc.X = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
|
|
||||||
|
|
||||||
fld dword[ebx+32] ;st0 = m[8]
|
fld dword[ebx+32] ;st0 = m[8]
|
||||||
fmul st0,st3 ;st0 *= v.coord.X
|
fmul st0,st3 ;st0 *= v.coord.X
|
||||||
fld dword[ebx+36] ;st0 = m[9]
|
fld dword[ebx+36] ;st0 = m[9]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Y
|
fmul st0,st3 ;st0 *= v.coord.Y
|
||||||
|
faddp ;st0 = v.coord.X * m[8] + v.coord.Y * m[9]
|
||||||
fld dword[ebx+40] ;st0 = m[10]
|
fld dword[ebx+40] ;st0 = m[10]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Z
|
fmul st0,st2 ;st0 *= v.coord.Z
|
||||||
fadd dword[ebx+44] ;st0 += m[11]
|
fadd dword[ebx+44] ;st0 += m[11]
|
||||||
faddp ;st0 += v.coord.Z * m[10]
|
faddp ;st0 = v.pc.Z
|
||||||
faddp ;st0 += v.coord.Y * m[9]
|
fstp dword[esi+8] ;v.pc.Z = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11]
|
||||||
fstp dword[esi+8] ;v.pc.X = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11]
|
|
||||||
|
|
||||||
cmp dword[eax+offs_cont_matrix_model_projection_no_w_transform],0
|
cmp dword[eax+offs_cont_matrix_model_projection_no_w_transform],0
|
||||||
je .els_1
|
je .els_1
|
||||||
@ -395,11 +388,11 @@ pushad
|
|||||||
fmul st0,st3 ;st0 *= v.coord.X
|
fmul st0,st3 ;st0 *= v.coord.X
|
||||||
fld dword[ebx+52] ;st0 = m[13]
|
fld dword[ebx+52] ;st0 = m[13]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Y
|
fmul st0,st3 ;st0 *= v.coord.Y
|
||||||
|
faddp ;st0 = v.coord.X * m[12] + v.coord.Y * m[13]
|
||||||
fld dword[ebx+56] ;st0 = m[14]
|
fld dword[ebx+56] ;st0 = m[14]
|
||||||
fmul st0,st3 ;st0 *= v.coord.Z
|
fmul st0,st2 ;st0 *= v.coord.Z
|
||||||
fadd dword[ebx+60] ;st0 += m[15]
|
fadd dword[ebx+60] ;st0 += m[15]
|
||||||
faddp ;st0 += v.coord.Z * m[14]
|
faddp ;st0 = v.pc.W
|
||||||
faddp ;st0 += v.coord.Y * m[13]
|
|
||||||
fstp dword[esi+12] ;v.pc.W = v.coord.X * m[12] + v.coord.Y * m[13] + v.coord.Z * m[14] + m[15]
|
fstp dword[esi+12] ;v.pc.W = v.coord.X * m[12] + v.coord.Y * m[13] + v.coord.Z * m[14] + m[15]
|
||||||
.end_els:
|
.end_els:
|
||||||
ffree st0
|
ffree st0
|
||||||
@ -492,11 +485,20 @@ pushad
|
|||||||
je @f
|
je @f
|
||||||
cmp dword[edx+offs_cont_apply_texture_matrix],0
|
cmp dword[edx+offs_cont_apply_texture_matrix],0
|
||||||
je .els_1
|
je .els_1
|
||||||
; gl_M4_MulV4(&v->tex_coord, c->matrix_stack_ptr[2], &c->current_tex_coord);
|
mov eax,edx
|
||||||
|
add eax,offs_cont_current_tex_coord
|
||||||
|
push eax ;&context.current_tex_coord
|
||||||
|
mov eax,ebx
|
||||||
|
add eax,offs_vert_tex_coord
|
||||||
|
stdcall gl_M4_MulV4, eax, dword[edx+offs_cont_matrix_stack_ptr+8]
|
||||||
jmp @f
|
jmp @f
|
||||||
.els_1:
|
.els_1:
|
||||||
mov eax,[edx+offs_cont_current_tex_coord]
|
mov esi,edx
|
||||||
mov [ebx+offs_vert_tex_coord],eax
|
add esi,offs_cont_current_tex_coord
|
||||||
|
mov edi,ebx
|
||||||
|
add edi,offs_vert_tex_coord
|
||||||
|
mov ecx,4
|
||||||
|
rep movsd
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; precompute the mapping to the viewport
|
; precompute the mapping to the viewport
|
||||||
@ -572,20 +574,33 @@ pushad
|
|||||||
@@:
|
@@:
|
||||||
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP
|
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP
|
||||||
jne @f
|
jne @f
|
||||||
; if (c->vertex_cnt >= 3) {
|
cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3)
|
||||||
; if (n == 3)
|
jl .end_f
|
||||||
; n = 0;
|
cmp dword[n],3
|
||||||
; /* needed to respect triangle orientation */
|
jne .ts3
|
||||||
; switch(c->vertex_cnt & 1) {
|
xor eax,eax
|
||||||
; case 0:
|
mov dword[n],eax
|
||||||
; gl_draw_triangle(c,&c->vertex[2],&c->vertex[1],&c->vertex[0]);
|
.ts3:
|
||||||
; break;
|
; needed to respect triangle orientation
|
||||||
; default:
|
mov eax,[edx+offs_cont_vertex]
|
||||||
; case 1:
|
bt dword[edx+offs_cont_vertex_cnt],0
|
||||||
; gl_draw_triangle(c,&c->vertex[0],&c->vertex[1],&c->vertex[2]);
|
jc .case_1
|
||||||
; break;
|
mov [esp-12],eax
|
||||||
; }
|
add eax,sizeof.GLVertex
|
||||||
; }
|
mov [esp-8],eax
|
||||||
|
add eax,sizeof.GLVertex
|
||||||
|
mov [esp-4],eax
|
||||||
|
sub esp,12
|
||||||
|
stdcall gl_draw_triangle, edx ;&v[2],&v[1],&v[0]
|
||||||
|
jmp .end_f
|
||||||
|
.case_1:
|
||||||
|
mov [esp-4],eax
|
||||||
|
add eax,sizeof.GLVertex
|
||||||
|
mov [esp-8],eax
|
||||||
|
add eax,sizeof.GLVertex
|
||||||
|
mov [esp-12],eax
|
||||||
|
sub esp,12
|
||||||
|
stdcall gl_draw_triangle, edx ;&v[0],&v[1],&v[2]
|
||||||
jmp .end_f
|
jmp .end_f
|
||||||
@@:
|
@@:
|
||||||
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN
|
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_FAN
|
||||||
|
@ -605,8 +605,7 @@ proc gl_V3_Norm uses ebx, a:dword
|
|||||||
fmul st0,st0
|
fmul st0,st0
|
||||||
faddp
|
faddp
|
||||||
fsqrt ;st0 = sqrt(a.X^2 +a.Y^2 +a.Z^2)
|
fsqrt ;st0 = sqrt(a.X^2 +a.Y^2 +a.Z^2)
|
||||||
fldz
|
ftst
|
||||||
fcomp
|
|
||||||
fstsw ax
|
fstsw ax
|
||||||
sahf
|
sahf
|
||||||
je .r1 ;if (sqrt(...)==0) return 1
|
je .r1 ;if (sqrt(...)==0) return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user