summaryrefslogtreecommitdiff
path: root/bullet_fragment.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'bullet_fragment.glsl')
-rw-r--r--bullet_fragment.glsl7
1 files changed, 5 insertions, 2 deletions
diff --git a/bullet_fragment.glsl b/bullet_fragment.glsl
index 66f53a4..5e8becd 100644
--- a/bullet_fragment.glsl
+++ b/bullet_fragment.glsl
@@ -7,6 +7,9 @@ void main() {
l_uv -= l_offset;
l_uv = vec2(v_tex_rot * vec4(l_uv, 0.0, 1.0));
l_uv += l_offset;
- gl_FragColor = vec4(texture2D(tex, l_uv));
- gl_FragColor.xyz += gl_Color.xyz - gl_Color.xyz * gl_FragColor.x;
+ gl_FragColor = texture2D(tex, l_uv);
+ float M = max(max(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z);
+ float C = M - min(min(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z);
+ float S = C > 0.0 ? C / M : 0.0;
+ gl_FragColor.xyz = M * mix(vec3(1.0, 1.0, 1.0), gl_Color.xyz, S);
}