-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.reco1l.andengine | ||
|
||
import javax.microedition.khronos.opengles.GL10 | ||
|
||
data class BlendInfo( | ||
|
||
/** | ||
* The blending function to use. | ||
*/ | ||
var function: BlendingFunction, | ||
|
||
/** | ||
* Whether to mask the red channel. | ||
*/ | ||
var redMask: Boolean = true, | ||
|
||
/** | ||
* Whether to mask the green channel. | ||
*/ | ||
var greenMask: Boolean = true, | ||
|
||
/** | ||
* Whether to mask the blue channel. | ||
*/ | ||
var blueMask: Boolean = true, | ||
|
||
/** | ||
* Whether to mask the alpha channel. | ||
*/ | ||
var alphaMask: Boolean = true, | ||
|
||
/** | ||
* Whether to clear the color buffer. | ||
*/ | ||
var clear: Boolean = false | ||
|
||
) { | ||
|
||
fun apply(gl: GL10) { | ||
|
||
gl.glColorMask(redMask, greenMask, blueMask, alphaMask) | ||
|
||
if (function != BlendingFunction.Inherit) { | ||
gl.glBlendFunc(function.source, function.destination) | ||
} | ||
|
||
if (clear) { | ||
gl.glClear(GL10.GL_COLOR_BUFFER_BIT) | ||
} | ||
} | ||
|
||
|
||
companion object { | ||
|
||
val Inherit = BlendInfo(BlendingFunction.Inherit) | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters