FragShader.fsh 577 B

1234567891011121314151617181920
  1. uniform sampler2D sTexture;
  2. uniform lowp vec3 FogColor;
  3. varying mediump vec2 TexCoord;
  4. varying lowp vec3 DiffuseLight;
  5. varying lowp vec3 FogIntensity;
  6. void main()
  7. {
  8. // Get color from the texture and modulate with diffuse lighting
  9. lowp vec3 texColor = texture2D(sTexture, TexCoord).rgb;
  10. lowp vec3 color = texColor * DiffuseLight;
  11. // interpolate the fog color with the texture-diffuse color using the
  12. // fog intensity calculated in the vertex shader
  13. color = mix(FogColor, color, FogIntensity);
  14. gl_FragColor = vec4(color, 1.0);
  15. }