Added BRIGHTEN blend mode

Added BRIGHTEN blend mode which adds some contrast and lightens image
BRIGHTEN more closely matches the in-game effect than TINT_ID
Playing around with new blend modes -- will experiment with actual HSL method as well
This commit is contained in:
Collin Smith
2019-03-10 05:05:28 -07:00
parent 22251f560a
commit 78d59793e9
4 changed files with 19 additions and 6 deletions

View File

@ -69,6 +69,18 @@ void main() {
if (color.a > 0.0) {
color.rgb += tint.rgb;
}
// Same as 1, except adds contrast and brightness
} else if (blendMode == 8) {
if (color.a > 0.0) {
// Apply contrast
color.rgb -= 0.5;
color.rgb *= 1.8;
color.rgb += 0.5;
// Apply brightness
color.rgb += 0.4;
}
}
vec3 colorRGB = pow(color.rgb, vec3(1.0 / gamma));

View File

@ -21,7 +21,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
public class Animation extends BaseDrawable {
private static final String TAG = "Animation";
private static final int DEBUG_MODE = 0; // 0=off, 1=box, 2=layer box
private static final int DEBUG_MODE = 1; // 0=off, 1=box, 2=layer box
private static final int NUM_LAYERS = COF.Component.NUM_COMPONENTS;
private static final float FRAMES_PER_SECOND = 25f;
@ -214,7 +214,7 @@ public class Animation extends BaseDrawable {
Layer layer = layers[l];
if (layer == null) break;
if (layer.blendMode == BlendMode.ID) {
layer.setBlendMode(BlendMode.TINT_ID, Riiablo.colors.highlight);
layer.setBlendMode(BlendMode.BRIGHTEN, Riiablo.colors.highlight);
}
}
} else {
@ -222,7 +222,7 @@ public class Animation extends BaseDrawable {
COF.Layer cofLayer = cof.getLayer(l);
Layer layer = layers[cofLayer.component];
if (layer.blendMode == BlendMode.ID) {
layer.setBlendMode(BlendMode.TINT_ID, Riiablo.colors.highlight);
layer.setBlendMode(BlendMode.BRIGHTEN, Riiablo.colors.highlight);
}
}
}
@ -231,7 +231,7 @@ public class Animation extends BaseDrawable {
for (int l = 0; l < NUM_LAYERS; l++) {
Layer layer = layers[l];
if (layer == null) break;
if (layer.blendMode == BlendMode.TINT_ID) {
if (layer.blendMode == BlendMode.BRIGHTEN) {
layer.setBlendMode(BlendMode.ID);
}
}
@ -239,7 +239,7 @@ public class Animation extends BaseDrawable {
for (int l = 0; l < cof.getNumLayers(); l++) {
COF.Layer cofLayer = cof.getLayer(l);
Layer layer = layers[cofLayer.component];
if (layer.blendMode == BlendMode.TINT_ID) {
if (layer.blendMode == BlendMode.BRIGHTEN) {
layer.setBlendMode(BlendMode.ID);
}
}

View File

@ -14,4 +14,5 @@ public interface BlendMode {
int TINT_BLACKS = 5;
int TINT_WHITES = 6;
int TINT_ID = 7;
int BRIGHTEN = 8;
}

View File

@ -69,7 +69,7 @@ public class Button extends com.badlogic.gdx.scenes.scene2d.ui.Button implements
} else {
setColor(over ? Riiablo.colors.highlight : Color.WHITE);
}
if (over) batch.setBlendMode(BlendMode.TINT_ID);
if (over) batch.setBlendMode(BlendMode.BRIGHTEN);
super.draw(batch, parentAlpha);
if (over) batch.resetBlendMode();
}