aa
This commit is contained in:
parent
2a804556db
commit
08ea9a0e7b
7 changed files with 40 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ vec4 PhongShading(void)
|
|||
vec4 ambient = gl_FrontLightProduct[0].ambient;
|
||||
|
||||
float dcoef = max(dot(L, N), 0.0);
|
||||
vec4 diffuse = gl_FrontLightProduct[0].diffuse*dcoef;
|
||||
vec4 diffuse = gl_FrontLightProduct[0].diffuse * dcoef;
|
||||
|
||||
vec4 specular = vec4(0.0);
|
||||
if(dcoef > 0.0){
|
||||
|
|
@ -24,7 +24,7 @@ vec4 PhongShading(void)
|
|||
vec3 R = reflect(-L, N);
|
||||
float specularLight = pow(max(dot(R, V), 0.0), gl_FrontMaterial.shininess);
|
||||
|
||||
specular = gl_FrontLightProduct[0].specular*specularLight;
|
||||
specular = gl_FrontLightProduct[0].specular * specularLight;
|
||||
}
|
||||
return ambient+diffuse+specular;
|
||||
}
|
||||
|
|
@ -43,10 +43,12 @@ float ShadowCoef(void){
|
|||
}
|
||||
|
||||
void main(void){
|
||||
vec4 c = gl_Color;
|
||||
vec4 c = PhongShading();
|
||||
vec4 ambient = gl_LightSource[0].ambient;
|
||||
float shadow_coef = ShadowCoef();
|
||||
|
||||
//c = c * texture2D(current_texture, gl_TexCoord[0].st);
|
||||
|
||||
gl_FragColor = ambient * shadow_coef * c + (1.0 - ambient) * c;
|
||||
gl_FragColor.a = 1.0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ void main(void){
|
|||
|
||||
gl_Position = gl_ProjectionMatrix * vPos;
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_TexCoord[0] * gl_MultiTexCoord0;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue