Merge pull request #126 from kwando/screen_blendmode

Add Screen blend mode.
experimental
shadowislord 11 years ago
commit dbd9ed9d78
  1. 3
      jme3-android/src/main/java/com/jme3/renderer/android/OGLESShaderRenderer.java
  2. 9
      jme3-core/src/main/java/com/jme3/material/RenderState.java
  3. 3
      jme3-jogl/src/main/java/com/jme3/renderer/jogl/JoglRenderer.java
  4. 3
      jme3-lwjgl/src/main/java/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -556,6 +556,9 @@ public class OGLESShaderRenderer implements Renderer {
case ModulateX2: case ModulateX2:
GLES20.glBlendFunc(GLES20.GL_DST_COLOR, GLES20.GL_SRC_COLOR); GLES20.glBlendFunc(GLES20.GL_DST_COLOR, GLES20.GL_SRC_COLOR);
break; break;
case Screen:
GLES20.glBlendFunc(GLES20.GL_ONE, 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());

@ -176,7 +176,14 @@ public class RenderState implements Cloneable, Savable {
* <p> * <p>
* Result = 2 * Source Color * Dest Color -> (GL_DST_COLOR, GL_SRC_COLOR) * 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
} }
/** /**

@ -698,6 +698,9 @@ public class JoglRenderer implements Renderer {
case ModulateX2: case ModulateX2:
gl.glBlendFunc(GL.GL_DST_COLOR, GL.GL_SRC_COLOR); gl.glBlendFunc(GL.GL_DST_COLOR, GL.GL_SRC_COLOR);
break; break;
case Screen:
gl.glBlendFunc(GL.GL_ONE, 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());

@ -647,6 +647,9 @@ public class LwjglRenderer implements Renderer {
case ModulateX2: case ModulateX2:
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR); glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
break; break;
case Screen:
glBlendFunc(GL_ONE, 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…
Cancel
Save