Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- varying mediump vec4 position;
- varying mediump vec2 var_texcoord0;
- varying lowp vec4 colors[10];
- uniform lowp sampler2D DIFFUSE_TEXTURE;
- uniform lowp vec4 tint;
- uniform lowp vec4 saturation;
- void main()
- {
- lowp vec4 tint_pm = vec4(tint.xyz * tint.w, tint.w);
- lowp vec4 initial_color = texture2D(DIFFUSE_TEXTURE, var_texcoord0.xy);
- // Convert red channel to index [0..9]
- lowp int index = int(floor(min(initial_color.x * 10.0, 9.9)));
- // Use that index to get the new color from colors array
- lowp vec4 color = colors[index];
- // Save the original alpha channel value
- color.w = initial_color.w;
- {
- color.x = (color.x * (1.0 - saturation.w) + saturation.x * saturation.w) * color.w;
- color.y = (color.y * (1.0 - saturation.w) + saturation.y * saturation.w) * color.w;
- color.z = (color.z * (1.0 - saturation.w) + saturation.z * saturation.w) * color.w;
- }
- gl_FragColor = color * tint_pm;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement