FragShader.fsh 575 B

1234567891011121314151617181920
  1. uniform sampler2D sBasetex;
  2. uniform sampler2D sReflect;
  3. uniform sampler2D sShadow;
  4. varying mediump vec2 TexCoord;
  5. varying mediump vec3 ShadowCoord;
  6. varying mediump vec2 ReflectCoord;
  7. varying lowp float LightIntensity;
  8. const lowp float cReflect = 0.2;
  9. void main()
  10. {
  11. lowp vec3 baseColor = texture2D(sBasetex, TexCoord).rgb;
  12. baseColor *= 0.2 + 0.8 * texture2DProj(sShadow, ShadowCoord).r * LightIntensity;
  13. lowp vec3 reflectColor = texture2D(sReflect, ReflectCoord).rgb;
  14. gl_FragColor = vec4(baseColor + reflectColor * cReflect, 1.0);
  15. }