Added another Photoshop tyle blend mode: Exclusion
Performs a sort of color XOR with source and destination. Very useful for UI highlighting but is a bizarre (and potentially useful) effect in 3D.
This commit is contained in:
parent
a18c568579
commit
5a482e2b98
@ -559,6 +559,9 @@ public class OGLESShaderRenderer implements Renderer {
|
|||||||
case Screen:
|
case Screen:
|
||||||
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_COLOR);
|
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_COLOR);
|
||||||
break;
|
break;
|
||||||
|
case Exclusion:
|
||||||
|
GLES20.glBlendFunc(GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_COLOR);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
||||||
+ state.getBlendMode());
|
+ state.getBlendMode());
|
||||||
|
@ -183,7 +183,15 @@ public class RenderState implements Cloneable, Savable {
|
|||||||
* <p>
|
* <p>
|
||||||
* Result = 1 - (1 - Source Color) * (1 - Dest Color) -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)
|
* Result = 1 - (1 - Source Color) * (1 - Dest Color) -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)
|
||||||
*/
|
*/
|
||||||
Screen
|
Screen,
|
||||||
|
/**
|
||||||
|
* Mixes the destination and source colors similar to a color-based XOR
|
||||||
|
* operation. This is directly equivalent to Photoshop's "Exclusion" blend.
|
||||||
|
* <p>
|
||||||
|
* Result = (Source Color * (1 - Dest Color)) + (Dest Color * (1 - Source Color))
|
||||||
|
* -> (GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR)
|
||||||
|
*/
|
||||||
|
Exclusion
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -701,6 +701,9 @@ public class JoglRenderer implements Renderer {
|
|||||||
case Screen:
|
case Screen:
|
||||||
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_COLOR);
|
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_COLOR);
|
||||||
break;
|
break;
|
||||||
|
case Exclusion:
|
||||||
|
gl.glBlendFunc(GL.GL_ONE_MINUS_DST_COLOR, GL.GL_ONE_MINUS_SRC_COLOR);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
||||||
+ state.getBlendMode());
|
+ state.getBlendMode());
|
||||||
|
@ -650,6 +650,9 @@ public class LwjglRenderer implements Renderer {
|
|||||||
case Screen:
|
case Screen:
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
|
||||||
break;
|
break;
|
||||||
|
case Exclusion:
|
||||||
|
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
throw new UnsupportedOperationException("Unrecognized blend mode: "
|
||||||
+ state.getBlendMode());
|
+ state.getBlendMode());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user