diff options
Diffstat (limited to 'src/opengl/util/composition_mode_difference.glsl')
-rw-r--r-- | src/opengl/util/composition_mode_difference.glsl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/opengl/util/composition_mode_difference.glsl b/src/opengl/util/composition_mode_difference.glsl new file mode 100644 index 0000000..ca13ce7 --- /dev/null +++ b/src/opengl/util/composition_mode_difference.glsl @@ -0,0 +1,9 @@ +// Dca' = Sca + Dca - 2.min(Sca.Da, Dca.Sa) +// Da' = Sa + Da - Sa.Da +vec4 composite(vec4 src, vec4 dst) +{ + vec4 result; + result.rgb = src.rgb + dst.rgb - 2 * min(src.rgb * dst.a, dst.rgb * src.a); + result.a = src.a + dst.a - src.a * dst.a; + return result; +} |