Merge pull request #126 from kwando/screen_blendmode

Add Screen blend mode.
This commit is contained in:
shadowislord 2014-09-07 16:54:23 -04:00
commit dbd9ed9d78
4 changed files with 17 additions and 1 deletions

View File

@ -556,6 +556,9 @@ public class OGLESShaderRenderer implements Renderer {
case ModulateX2:
GLES20.glBlendFunc(GLES20.GL_DST_COLOR, GLES20.GL_SRC_COLOR);
break;
case Screen:
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());

View File

@ -176,7 +176,14 @@ public class RenderState implements Cloneable, Savable {
* <p>
* Result = 2 * Source Color * Dest Color -> (GL_DST_COLOR, GL_SRC_COLOR)
*/
ModulateX2
ModulateX2,
/**
* Opposite effect of Modulate/Multiply. Invert both colors, multiply and
* then invert the result.
* <p>
* Result = 1 - (1 - Source Color) * (1 - Dest Color) -> (GL_ONE, GL_ONE_MINUS_SRC_COLOR)
*/
Screen
}
/**

View File

@ -698,6 +698,9 @@ public class JoglRenderer implements Renderer {
case ModulateX2:
gl.glBlendFunc(GL.GL_DST_COLOR, GL.GL_SRC_COLOR);
break;
case Screen:
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());

View File

@ -647,6 +647,9 @@ public class LwjglRenderer implements Renderer {
case ModulateX2:
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
break;
case Screen:
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
break;
default:
throw new UnsupportedOperationException("Unrecognized blend mode: "
+ state.getBlendMode());