This commit is contained in:
Nishi 2026-01-11 18:27:41 +09:00
commit 08ea9a0e7b
Signed by: nishi
GPG key ID: 27EF69B208EB9343
7 changed files with 40 additions and 14 deletions

View file

@ -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;
}

View file

@ -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;
}