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
|
||||
|
||||
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1
|
||||
stdcall [kosglMakeCurrent], 10,10,400,325,ctx1
|
||||
stdcall [glEnable], GL_DEPTH_TEST
|
||||
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
|
||||
stdcall [gluNewQuadric]
|
||||
mov [qObj],eax
|
||||
|
||||
@ -55,7 +56,7 @@ draw_window:
|
||||
mcall 12,1
|
||||
|
||||
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]
|
||||
|
||||
mcall 12,2
|
||||
@ -150,15 +151,15 @@ stdcall [glPushMatrix]
|
||||
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.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 [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 [glTranslatef], 3.2,0.0,0.0
|
||||
stdcall [gluSphere], [qObj], 0.55, 8,8
|
||||
stdcall [gluSphere], [qObj], 0.55, 16,16
|
||||
stdcall [glPopMatrix]
|
||||
ret
|
||||
|
||||
|
@ -39,12 +39,13 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||
mov dword[edx+offs_cont_vertex],eax
|
||||
|
||||
; viewport
|
||||
mov dword[edx+offs_cont_viewport+offs_vpor_xmin],0
|
||||
mov dword[edx+offs_cont_viewport+offs_vpor_ymin],0
|
||||
xor eax,eax
|
||||
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 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 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
|
||||
|
||||
; 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
|
||||
mov dword[eax+offs_ligh_spot_exponent],0.0
|
||||
mov dword[eax+offs_ligh_spot_cutoff],180.0
|
||||
mov dword[eax+offs_ligh_attenuation],1.0
|
||||
mov dword[eax+offs_ligh_attenuation+4],0.0
|
||||
mov dword[eax+offs_ligh_attenuation+8],0.0
|
||||
gl_V3_New eax+offs_ligh_attenuation, 1.0,0.0,0.0
|
||||
mov dword[eax+offs_ligh_enabled],0
|
||||
add eax,sizeof.GLLight
|
||||
dec ecx
|
||||
@ -107,25 +106,14 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||
stdcall glInitTextures,edx
|
||||
|
||||
; default state
|
||||
mov dword[edx+offs_cont_current_color],1.0
|
||||
mov dword[edx+offs_cont_current_color+4],1.0
|
||||
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
|
||||
gl_V4_New edx+offs_cont_current_color, 1.0,1.0,1.0,1.0
|
||||
gl_V3_New edx+offs_cont_longcurrent_color, 65535,65535,65535
|
||||
|
||||
mov dword[edx+offs_cont_current_normal],1.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
|
||||
gl_V4_New edx+offs_cont_current_normal, 1.0,0.0,0.0,0.0
|
||||
|
||||
mov dword[edx+offs_cont_current_edge_flag],1
|
||||
|
||||
mov dword[edx+offs_cont_current_tex_coord],0.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
|
||||
gl_V4_New edx+offs_cont_current_tex_coord, 0.0,0.0,0.0,1.0
|
||||
|
||||
mov dword[edx+offs_cont_polygon_mode_front],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
|
||||
|
||||
; clear
|
||||
mov dword[edx+offs_cont_clear_color],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
|
||||
gl_V4_New edx+offs_cont_clear_color, 0.0,0.0,0.0,0.0
|
||||
mov dword[edx+offs_cont_clear_depth],0
|
||||
|
||||
; selection
|
||||
@ -150,9 +135,8 @@ proc glInit uses eax ebx ecx edx, zbuffer1:dword
|
||||
; matrix
|
||||
mov dword[edx+offs_cont_matrix_mode],0
|
||||
|
||||
mov dword[edx+offs_cont_matrix_stack_depth_max],MAX_MODELVIEW_STACK_DEPTH
|
||||
mov dword[edx+offs_cont_matrix_stack_depth_max+4],MAX_PROJECTION_STACK_DEPTH
|
||||
mov dword[edx+offs_cont_matrix_stack_depth_max+8],MAX_TEXTURE_STACK_DEPTH
|
||||
gl_V3_New edx+offs_cont_matrix_stack_depth_max,\
|
||||
MAX_MODELVIEW_STACK_DEPTH,MAX_PROJECTION_STACK_DEPTH,MAX_TEXTURE_STACK_DEPTH
|
||||
|
||||
mov ecx,3 ;for(i=0;i<3;i++)
|
||||
mov ebx,edx
|
||||
|
@ -1,3 +1,5 @@
|
||||
align 4
|
||||
sp128f dd 128.0
|
||||
|
||||
align 4
|
||||
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
|
||||
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]
|
||||
je @f
|
||||
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
|
||||
movsd
|
||||
mov dword[edi],SPECULAR_BUFFER_RESOLUTION
|
||||
fdiv dword[an180f]
|
||||
fdiv dword[sp128f]
|
||||
fimul dword[edi]
|
||||
fistp dword[edi] ;m.shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION
|
||||
jmp .end_f
|
||||
@ -174,10 +177,12 @@ pushad
|
||||
add edi,offs_ligh_spot_direction
|
||||
mov ecx,3
|
||||
rep movsd ;l.spot_direction=v[0,1,2]
|
||||
mov esi,ebx
|
||||
add esi,12
|
||||
mov edi,edx
|
||||
add edi,offs_ligh_norm_spot_direction
|
||||
;mov esi,ebx
|
||||
;add esi,12
|
||||
sub esi,12
|
||||
;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
|
||||
rep movsd ;l.norm_spot_direction=v[0,1,2]
|
||||
add edx,offs_ligh_norm_spot_direction
|
||||
@ -380,7 +385,8 @@ pushad
|
||||
; esi -> GLVertex *v
|
||||
mov esi,[v]
|
||||
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 [twoside],eax
|
||||
|
||||
@ -437,19 +443,26 @@ end if
|
||||
fmul dword[ebx+offs_ligh_ambient+8]
|
||||
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
|
||||
; light at infinity
|
||||
ffree st0 ;l.position.v[3]
|
||||
fincstp
|
||||
mov eax,[ebx+offs_ligh_position]
|
||||
mov [d],eax ;d.X=l.position.v[0]
|
||||
mov eax,[ebx+offs_ligh_position+4]
|
||||
mov [d+4],eax ;d.Y=l.position.v[1]
|
||||
mov eax,[ebx+offs_ligh_position+8]
|
||||
mov [d+8],eax ;d.Z=l.position.v[2]
|
||||
mov eax,[ebx+offs_ligh_position+offs_Y]
|
||||
mov [d+offs_Y],eax ;d.Y=l.position.v[1]
|
||||
mov eax,[ebx+offs_ligh_position+offs_Z]
|
||||
mov [d+offs_Z],eax ;d.Z=l.position.v[2]
|
||||
mov dword[att],1.0
|
||||
jmp .els_0_end
|
||||
.els_0:
|
||||
; distance attenuation
|
||||
ffree st0 ;l.position.v[3]
|
||||
fincstp
|
||||
fld dword[ebx+offs_ligh_position]
|
||||
fsub dword[esi+offs_vert_ec]
|
||||
fstp dword[d] ;d.X=l.position.v[0]-v.ec.v[0]
|
||||
@ -468,7 +481,7 @@ end if
|
||||
fmul st0,st0
|
||||
faddp
|
||||
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]
|
||||
fstsw ax
|
||||
sahf
|
||||
@ -519,7 +532,7 @@ end if
|
||||
ftst ;if (dot>0)
|
||||
fstsw ax
|
||||
sahf
|
||||
jle .if0_end
|
||||
jbe .if0_end
|
||||
; diffuse light
|
||||
fld dword[ecx+offs_mate_diffuse]
|
||||
fmul dword[ebx+offs_ligh_diffuse]
|
||||
@ -654,7 +667,7 @@ end if
|
||||
ftst ;if (dot_spec > 0)
|
||||
fstsw ax
|
||||
sahf
|
||||
jae .if0_end
|
||||
jbe .if0_end
|
||||
fld dword[s]
|
||||
fmul st0,st0
|
||||
fld dword[s+offs_Y]
|
||||
@ -678,17 +691,16 @@ end if
|
||||
; dot_spec= pow(dot_spec,m.shininess)
|
||||
stdcall specbuf_get_buffer, edx, dword[ecx+offs_mate_shininess_i], dword[ecx+offs_mate_shininess]
|
||||
mov edi,eax ;edi = specbuf
|
||||
mov dword[idx],SPECULAR_BUFFER_SIZE
|
||||
fild dword[idx]
|
||||
mov dword[idx],SPECULAR_BUFFER_SIZE ;idx = SPECULAR_BUFFER_SIZE
|
||||
fld1
|
||||
fcomp
|
||||
fstsw ax
|
||||
fild dword[idx]
|
||||
sahf
|
||||
jae @f
|
||||
fmul st0,st1
|
||||
jae @f ;if(dot_spec < 1.0)
|
||||
fmul st0,st1 ;idx *= dot_spec
|
||||
@@:
|
||||
fistp dword[idx] ;if (dot_spec < 1.0) idx = (int)(dot_spec*SPECULAR_BUFFER_SIZE)
|
||||
;else idx = SPECULAR_BUFFER_SIZE;
|
||||
fistp dword[idx]
|
||||
ffree st0 ;dot_spec
|
||||
fincstp
|
||||
shl dword[idx],2
|
||||
|
@ -1,5 +1,9 @@
|
||||
|
||||
if DEBUG
|
||||
align 4
|
||||
txt_gl_scal db 'glopScale',0
|
||||
txt_gl_tran db 'glopTranslate',0
|
||||
|
||||
align 4
|
||||
proc gl_print_matrix uses eax ebx ecx edi, m:dword, rows:dword
|
||||
mov ecx,[rows]
|
||||
@ -380,6 +384,7 @@ proc glopScale uses eax ebx ecx, context:dword, p:dword
|
||||
loop @b
|
||||
|
||||
if DEBUG ;glopScale
|
||||
stdcall dbg_print,txt_gl_scal,txt_nl
|
||||
mov ebx,[eax+offs_cont_matrix_mode]
|
||||
shl ebx,2
|
||||
add ebx,eax
|
||||
@ -408,9 +413,9 @@ proc glopTranslate uses eax ebx ecx, context:dword, p:dword
|
||||
fmul st0,st3 ;m[0] * x
|
||||
fld dword[ebx+4] ;m[1]
|
||||
fmul st0,st3 ;m[1] * y
|
||||
fld dword[ebx+8] ;m[2]
|
||||
fmul st0,st3 ;m[2] * z
|
||||
faddp
|
||||
fld dword[ebx+8] ;m[2]
|
||||
fmul st0,st2 ;m[2] * z
|
||||
faddp
|
||||
fadd dword[ebx+12] ;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
|
||||
|
||||
if DEBUG ;glopTranslate
|
||||
stdcall dbg_print,txt_gl_tran,txt_nl
|
||||
mov ebx,[eax+offs_cont_matrix_mode]
|
||||
shl ebx,2
|
||||
add ebx,eax
|
||||
|
@ -108,13 +108,6 @@ endl
|
||||
mov dword[zsize],(1 shl ZB_POINT_Z_FRAC_BITS) / 2
|
||||
fiadd dword[zsize]
|
||||
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
|
||||
endp
|
||||
|
||||
@ -260,11 +253,11 @@ pushad
|
||||
fmul st0,st3 ;st0 *= v.coord.X
|
||||
fld dword[ebx+4] ;st0 = m[1]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.Z
|
||||
fmul st0,st2 ;st0 *= v.coord.Z
|
||||
fadd dword[ebx+12] ;st0 += m[3]
|
||||
faddp ;st0 += v.coord.Z * m[2]
|
||||
faddp ;st0 += v.coord.Y * m[1]
|
||||
faddp ;st0 += v.ec.X
|
||||
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 edx,4 ;следущая координата вектора
|
||||
@ -290,11 +283,11 @@ pushad
|
||||
fmul st0,st3 ;st0 *= v.ec.X
|
||||
fld dword[ebx+4] ;st0 = m[1]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.ec.Z
|
||||
fmul st0,st2 ;st0 *= v.ec.Z
|
||||
fadd dword[ebx+12] ;st0 += m[3]
|
||||
faddp ;st0 += v.ec.Z * m[2]
|
||||
faddp ;st0 += v.ec.Y * m[1]
|
||||
faddp ;st0 = v.pc.X
|
||||
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 edx,4 ;следущая координата вектора
|
||||
@ -317,24 +310,24 @@ pushad
|
||||
fld dword[edi+offs_Z]
|
||||
|
||||
mov ecx,3
|
||||
add edx,offs_vert_normal
|
||||
.cycle_2:
|
||||
fld dword[ebx] ;st0 = m[0]
|
||||
fmul st0,st3 ;st0 *= n.X
|
||||
fld dword[ebx+4] ;st0 = m[1]
|
||||
fmul st0,st3 ;st0 *= n.Y
|
||||
faddp ;st0 = n.X * m[0] + n.Y * m[1]
|
||||
fld dword[ebx+8] ;st0 = m[2]
|
||||
fmul st0,st3 ;st0 *= n.Z
|
||||
faddp ;st0 += n.Z * m[2]
|
||||
faddp ;st0 += n.Y * m[1]
|
||||
fstp dword[edx+offs_vert_normal] ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
|
||||
fmul st0,st2 ;st0 *= n.Z
|
||||
faddp ;st0 = v.normal.X
|
||||
fstp dword[edx] ;v.normal.X = n.X * m[0] + n.Y * m[1] + n.Z * m[2]
|
||||
add ebx,16 ;следущая строка матрицы
|
||||
add edx,4 ;следущая координата вектора
|
||||
loop .cycle_2
|
||||
|
||||
cmp dword[eax+offs_cont_normalize_enabled],0
|
||||
je .end_els
|
||||
mov edx,[v]
|
||||
add edx,offs_vert_normal
|
||||
sub edx,12
|
||||
stdcall gl_V3_Norm,edx
|
||||
jmp .end_els
|
||||
.els_0:
|
||||
@ -355,34 +348,34 @@ pushad
|
||||
fmul st0,st3 ;st0 *= v.coord.X
|
||||
fld dword[ebx+4] ;st0 = m[1]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.Z
|
||||
fmul st0,st2 ;st0 *= v.coord.Z
|
||||
fadd dword[ebx+12] ;st0 += m[3]
|
||||
faddp ;st0 += v.coord.Z * m[2]
|
||||
faddp ;st0 += v.coord.Y * m[1]
|
||||
faddp ;st0 = v.pc.X
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.X
|
||||
fld dword[ebx+20] ;st0 = m[5]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.Z
|
||||
fmul st0,st2 ;st0 *= v.coord.Z
|
||||
fadd dword[ebx+28] ;st0 += m[7]
|
||||
faddp ;st0 += v.coord.Z * m[6]
|
||||
faddp ;st0 += v.coord.Y * m[5]
|
||||
fstp dword[esi+4] ;v.pc.X = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
|
||||
faddp ;st0 = v.pc.Y
|
||||
fstp dword[esi+4] ;v.pc.Y = v.coord.X * m[4] + v.coord.Y * m[5] + v.coord.Z * m[6] + m[7]
|
||||
|
||||
fld dword[ebx+32] ;st0 = m[8]
|
||||
fmul st0,st3 ;st0 *= v.coord.X
|
||||
fld dword[ebx+36] ;st0 = m[9]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.Z
|
||||
fmul st0,st2 ;st0 *= v.coord.Z
|
||||
fadd dword[ebx+44] ;st0 += m[11]
|
||||
faddp ;st0 += v.coord.Z * m[10]
|
||||
faddp ;st0 += v.coord.Y * m[9]
|
||||
fstp dword[esi+8] ;v.pc.X = v.coord.X * m[8] + v.coord.Y * m[9] + v.coord.Z * m[10] + m[11]
|
||||
faddp ;st0 = v.pc.Z
|
||||
fstp dword[esi+8] ;v.pc.Z = 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
|
||||
je .els_1
|
||||
@ -395,11 +388,11 @@ pushad
|
||||
fmul st0,st3 ;st0 *= v.coord.X
|
||||
fld dword[ebx+52] ;st0 = m[13]
|
||||
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]
|
||||
fmul st0,st3 ;st0 *= v.coord.Z
|
||||
fmul st0,st2 ;st0 *= v.coord.Z
|
||||
fadd dword[ebx+60] ;st0 += m[15]
|
||||
faddp ;st0 += v.coord.Z * m[14]
|
||||
faddp ;st0 += v.coord.Y * m[13]
|
||||
faddp ;st0 = v.pc.W
|
||||
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:
|
||||
ffree st0
|
||||
@ -492,11 +485,20 @@ pushad
|
||||
je @f
|
||||
cmp dword[edx+offs_cont_apply_texture_matrix],0
|
||||
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
|
||||
.els_1:
|
||||
mov eax,[edx+offs_cont_current_tex_coord]
|
||||
mov [ebx+offs_vert_tex_coord],eax
|
||||
mov esi,edx
|
||||
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
|
||||
@ -572,20 +574,33 @@ pushad
|
||||
@@:
|
||||
cmp dword[edx+offs_cont_begin_type],GL_TRIANGLE_STRIP
|
||||
jne @f
|
||||
; if (c->vertex_cnt >= 3) {
|
||||
; if (n == 3)
|
||||
; n = 0;
|
||||
; /* needed to respect triangle orientation */
|
||||
; switch(c->vertex_cnt & 1) {
|
||||
; case 0:
|
||||
; gl_draw_triangle(c,&c->vertex[2],&c->vertex[1],&c->vertex[0]);
|
||||
; break;
|
||||
; default:
|
||||
; case 1:
|
||||
; gl_draw_triangle(c,&c->vertex[0],&c->vertex[1],&c->vertex[2]);
|
||||
; break;
|
||||
; }
|
||||
; }
|
||||
cmp dword[edx+offs_cont_vertex_cnt],3 ;if (context.vertex_cnt >= 3)
|
||||
jl .end_f
|
||||
cmp dword[n],3
|
||||
jne .ts3
|
||||
xor eax,eax
|
||||
mov dword[n],eax
|
||||
.ts3:
|
||||
; needed to respect triangle orientation
|
||||
mov eax,[edx+offs_cont_vertex]
|
||||
bt dword[edx+offs_cont_vertex_cnt],0
|
||||
jc .case_1
|
||||
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
|
||||
@@:
|
||||
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
|
||||
faddp
|
||||
fsqrt ;st0 = sqrt(a.X^2 +a.Y^2 +a.Z^2)
|
||||
fldz
|
||||
fcomp
|
||||
ftst
|
||||
fstsw ax
|
||||
sahf
|
||||
je .r1 ;if (sqrt(...)==0) return 1
|
||||
|
Loading…
Reference in New Issue
Block a user