multi_sample_sprite.fp 656 B

12345678910111213141516171819
  1. varying mediump vec2 var_texcoord0;
  2. uniform lowp sampler2D texture1_sampler;
  3. uniform lowp sampler2D texture2_sampler;
  4. uniform lowp vec4 tint;
  5. uniform lowp vec4 mix_amount;
  6. void main()
  7. {
  8. // Pre-multiply alpha since all runtime textures already are
  9. lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
  10. // sample from both textures
  11. lowp vec4 color1 = texture2D(texture1_sampler, var_texcoord0.xy);
  12. lowp vec4 color2 = texture2D(texture2_sampler, var_texcoord0.xy);
  13. // mix (interpolate) the colors by the mix_amount
  14. lowp vec4 colormix = mix(color1, color2, mix_amount.x);
  15. // apply tint
  16. gl_FragColor = colormix * tint_pm;
  17. }