mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-12 16:58:57 +00:00
@@ -6,10 +6,11 @@ varying vec4 v_color;
|
|||||||
varying vec2 v_texCoords;
|
varying vec2 v_texCoords;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform float u_grayness;
|
uniform float u_grayness;
|
||||||
|
uniform float u_bias;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
||||||
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
||||||
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
||||||
gl_FragColor = vec4(blendedColor.rgb, c.a);
|
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(blendedColor.rgb, c.a), u_bias);
|
||||||
}
|
}
|
||||||
@@ -6,10 +6,11 @@ varying vec4 v_color;
|
|||||||
varying vec2 v_texCoords;
|
varying vec2 v_texCoords;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform float u_grayness;
|
uniform float u_grayness;
|
||||||
|
uniform float u_bias;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
||||||
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
||||||
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
||||||
gl_FragColor = vec4(blendedColor.rgb, c.a);
|
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(blendedColor.rgb, c.a), u_bias);
|
||||||
}
|
}
|
||||||
@@ -6,10 +6,11 @@ varying vec4 v_color;
|
|||||||
varying vec2 v_texCoords;
|
varying vec2 v_texCoords;
|
||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform float u_grayness;
|
uniform float u_grayness;
|
||||||
|
uniform float u_bias;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
vec4 c = v_color * texture2D(u_texture, v_texCoords);
|
||||||
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
float grey = dot( c.rgb, vec3(0.22, 0.707, 0.071) );
|
||||||
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
vec3 blendedColor = mix(c.rgb, vec3(grey), u_grayness);
|
||||||
gl_FragColor = vec4(blendedColor.rgb, c.a);
|
gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(blendedColor.rgb, c.a), u_bias);
|
||||||
}
|
}
|
||||||
@@ -693,6 +693,7 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", 1f);
|
shaderGrayscale.setUniformf("u_grayness", 1f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 1f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -714,6 +715,7 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", 1f);
|
shaderGrayscale.setUniformf("u_grayness", 1f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 0.8f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -733,6 +735,7 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", 1f);
|
shaderGrayscale.setUniformf("u_grayness", 1f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 0.8f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -753,6 +756,7 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", 1f);
|
shaderGrayscale.setUniformf("u_grayness", 1f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 0.8f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -764,12 +768,13 @@ public class Graphics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void drawGrayTransitionImage(FImage image, float x, float y, float w, float h, boolean withDarkOverlay, float percentage) {
|
public void drawGrayTransitionImage(FImage image, float x, float y, float w, float h, float percentage) {
|
||||||
if (image == null)
|
if (image == null)
|
||||||
return;
|
return;
|
||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", percentage);
|
shaderGrayscale.setUniformf("u_grayness", percentage);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 0.5f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -778,17 +783,12 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
batch.setShader(null);
|
batch.setShader(null);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
if(withDarkOverlay){
|
|
||||||
float oldalpha = alphaComposite;
|
|
||||||
setAlphaComposite(0.4f);
|
|
||||||
fillRect(Color.BLACK, x, y, w, h);
|
|
||||||
setAlphaComposite(oldalpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void drawGrayTransitionImage(Texture image, float x, float y, float w, float h, boolean withDarkOverlay, float percentage) {
|
public void drawGrayTransitionImage(Texture image, float x, float y, float w, float h, boolean withDarkOverlay, float percentage) {
|
||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", percentage);
|
shaderGrayscale.setUniformf("u_grayness", percentage);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", withDarkOverlay ? 0.4f : 1f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -797,17 +797,12 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
batch.setShader(null);
|
batch.setShader(null);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
if(withDarkOverlay){
|
|
||||||
float oldalpha = alphaComposite;
|
|
||||||
setAlphaComposite(0.4f);
|
|
||||||
fillRect(Color.BLACK, x, y, w, h);
|
|
||||||
setAlphaComposite(oldalpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void drawGrayTransitionImage(TextureRegion image, float x, float y, float w, float h, boolean withDarkOverlay, float percentage) {
|
public void drawGrayTransitionImage(TextureRegion image, float x, float y, float w, float h, boolean withDarkOverlay, float percentage) {
|
||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", percentage);
|
shaderGrayscale.setUniformf("u_grayness", percentage);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", withDarkOverlay ? 0.4f : 1f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
@@ -816,12 +811,6 @@ public class Graphics {
|
|||||||
batch.end();
|
batch.end();
|
||||||
batch.setShader(null);
|
batch.setShader(null);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
if(withDarkOverlay){
|
|
||||||
float oldalpha = alphaComposite;
|
|
||||||
setAlphaComposite(0.4f);
|
|
||||||
fillRect(Color.BLACK, x, y, w, h);
|
|
||||||
setAlphaComposite(oldalpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void drawChromatic(TextureRegion image, float x, float y, float w, float h, Float time) {
|
public void drawChromatic(TextureRegion image, float x, float y, float w, float h, Float time) {
|
||||||
if (image == null)
|
if (image == null)
|
||||||
@@ -848,10 +837,9 @@ public class Graphics {
|
|||||||
if (amount != null) {
|
if (amount != null) {
|
||||||
batch.end();
|
batch.end();
|
||||||
shaderRipple.bind();
|
shaderRipple.bind();
|
||||||
shaderRipple.setUniformf("u_resolution", Forge.isLandscapeMode() ? w : h , Forge.isLandscapeMode() ? h : w);
|
|
||||||
shaderRipple.setUniformf("u_time", amount);
|
shaderRipple.setUniformf("u_time", amount);
|
||||||
shaderRipple.setUniformf("u_yflip", flipY ? 1f : 0f);
|
shaderRipple.setUniformf("u_yflip", flipY ? 1f : 0f);
|
||||||
shaderRipple.setUniformf("u_bias", 0.7f);
|
shaderRipple.setUniformf("u_bias", 0.5f);
|
||||||
batch.setShader(shaderRipple);
|
batch.setShader(shaderRipple);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw
|
//draw
|
||||||
|
|||||||
@@ -50,31 +50,31 @@ public class Shaders {
|
|||||||
"#define PRECISION\n" +
|
"#define PRECISION\n" +
|
||||||
"#endif\n" +
|
"#endif\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"varying vec2 v_texCoords;\n" +
|
|
||||||
"uniform sampler2D u_texture;\n" +
|
"uniform sampler2D u_texture;\n" +
|
||||||
|
"varying vec2 v_texCoords;\n" +
|
||||||
"uniform float u_time;\n" +
|
"uniform float u_time;\n" +
|
||||||
"uniform vec2 u_resolution;\n" +
|
|
||||||
"uniform float u_yflip;\n" +
|
"uniform float u_yflip;\n" +
|
||||||
"uniform float u_bias;\n" +
|
"uniform float u_bias;\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"void main() {\n" +
|
"void main() {\n" +
|
||||||
"\tvec2 uv = v_texCoords;\n" +
|
"\tvec2 uv = v_texCoords;\n" +
|
||||||
|
"\tvec2 center = vec2(0.0);\n" +
|
||||||
|
"\tvec2 coord = uv;\n" +
|
||||||
|
"\tvec2 centered_coord = (2.0 * uv) - 1.0;\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" vec2 dv = vec2(0.5,0.5) - uv;\n" +
|
"\tfloat shutter = 0.9;\n" +
|
||||||
" float dis = length(dv);\n" +
|
"\tfloat texelDistance = distance(center, centered_coord) * u_time;\n" +
|
||||||
" float sinFactor =0.02*(4.0*u_time) *sin(dis * 40.0 +u_time* -12.0);\n" +
|
"\tfloat dist = (1.41 * 1.41 * shutter) - texelDistance;\n" +
|
||||||
" float rippleOffset=0.35;\n" +
|
"\n" +
|
||||||
" float discardFactor = clamp(0.2 - abs(rippleOffset - dis), 0.0, 1.0) / 0.2;\n" +
|
"\tfloat ripples = 1.0 - sin((texelDistance * 32.0) - (2.0 * u_time));\n" +
|
||||||
|
"\tcoord -= normalize(centered_coord - center) * clamp(ripples, 0.0, 1.0)*(0.050 * u_time);\n" +
|
||||||
" \n" +
|
" \n" +
|
||||||
" vec2 offset = normalize(dv)* sinFactor * discardFactor;\n" +
|
"\tvec4 color;\n" +
|
||||||
" uv = offset + uv;\n" +
|
|
||||||
"\t\n" +
|
|
||||||
"\tvec4 texColor;\n" +
|
|
||||||
"\tif (u_yflip > 0)\n" +
|
"\tif (u_yflip > 0)\n" +
|
||||||
"\t\ttexColor = texture2D(u_texture, vec2(uv.x, 1.-uv.y));\n" +
|
"\t\tcolor = texture2D(u_texture, vec2(coord.x, 1.-coord.y));\n" +
|
||||||
"\telse\n" +
|
"\telse\n" +
|
||||||
"\t\ttexColor = texture2D(u_texture, uv);\n" +
|
"\t\tcolor = texture2D(u_texture, coord);\n" +
|
||||||
" gl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), texColor, u_bias);\n" +
|
"\tgl_FragColor = mix(vec4(0.0, 0.0, 0.0, 1.0), vec4(color.rgba * dist), u_bias);\n" +
|
||||||
"}";
|
"}";
|
||||||
public static final String fragChromaticAbberation="#ifdef GL_ES\n" +
|
public static final String fragChromaticAbberation="#ifdef GL_ES\n" +
|
||||||
"#define PRECISION mediump\n" +
|
"#define PRECISION mediump\n" +
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ public class RewardScene extends UIScene {
|
|||||||
done(true);
|
done(true);
|
||||||
else if (type == Type.Loot && !shown) {
|
else if (type == Type.Loot && !shown) {
|
||||||
shown = true;
|
shown = true;
|
||||||
|
float delay = 0.09f;
|
||||||
|
generated.shuffle();
|
||||||
for (Actor actor : new Array.ArrayIterator<>(generated)) {
|
for (Actor actor : new Array.ArrayIterator<>(generated)) {
|
||||||
if (!(actor instanceof RewardActor)) {
|
if (!(actor instanceof RewardActor)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -186,7 +188,8 @@ public class RewardScene extends UIScene {
|
|||||||
public void run() {
|
public void run() {
|
||||||
reward.flip();
|
reward.flip();
|
||||||
}
|
}
|
||||||
}, 0.09f);
|
}, delay);
|
||||||
|
delay += 0.15f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -617,6 +617,7 @@ public boolean toolTipIsVisible()
|
|||||||
batch.end();
|
batch.end();
|
||||||
shaderGrayscale.bind();
|
shaderGrayscale.bind();
|
||||||
shaderGrayscale.setUniformf("u_grayness", 1f);
|
shaderGrayscale.setUniformf("u_grayness", 1f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", 0.7f);
|
||||||
batch.setShader(shaderGrayscale);
|
batch.setShader(shaderGrayscale);
|
||||||
batch.begin();
|
batch.begin();
|
||||||
//draw gray
|
//draw gray
|
||||||
|
|||||||
@@ -845,6 +845,8 @@ public class MatchScreen extends FScreen {
|
|||||||
} else if (percentage > 1) {
|
} else if (percentage > 1) {
|
||||||
percentage = 1;
|
percentage = 1;
|
||||||
}
|
}
|
||||||
|
if (MatchController.instance.getGameView().isMatchOver())
|
||||||
|
percentage=1;
|
||||||
if (Forge.isMobileAdventureMode) {
|
if (Forge.isMobileAdventureMode) {
|
||||||
if (percentage < 1)
|
if (percentage < 1)
|
||||||
g.drawNightDay(currentBG, x, y, w, h, time);
|
g.drawNightDay(currentBG, x, y, w, h, time);
|
||||||
@@ -860,10 +862,10 @@ public class MatchScreen extends FScreen {
|
|||||||
} else {
|
} else {
|
||||||
g.setAlphaComposite(percentage);
|
g.setAlphaComposite(percentage);
|
||||||
if (!daynightTransition) {
|
if (!daynightTransition) {
|
||||||
if (image instanceof FSkinTexture)//for loading bg images
|
if (image instanceof FSkinTexture && !GuiBase.isAndroid()) //for loading bg images, currently android version cant load this ripple shader
|
||||||
g.drawRipple(image, x, y, w, h, 1 - (percentage * 1), false);
|
g.drawRipple(image, x, y, w, h, 1 - (percentage * 1), false);
|
||||||
else
|
else
|
||||||
g.drawGrayTransitionImage(image, x, y, w, h, darkoverlay, 1 - (percentage * 1));
|
g.drawGrayTransitionImage(image, x, y, w, h, 1 - (percentage * 1));
|
||||||
} else { //for non adventure transition.. todo generate new daynight + ripple shader for planechase images to use only single image
|
} else { //for non adventure transition.. todo generate new daynight + ripple shader for planechase images to use only single image
|
||||||
g.drawUnderWaterImage(image, x, y, w, h, 1 - (percentage * 1));
|
g.drawUnderWaterImage(image, x, y, w, h, 1 - (percentage * 1));
|
||||||
}
|
}
|
||||||
@@ -945,7 +947,7 @@ public class MatchScreen extends FScreen {
|
|||||||
bgFullWidth = w;
|
bgFullWidth = w;
|
||||||
bgHeight = scaledbgHeight;
|
bgHeight = scaledbgHeight;
|
||||||
}
|
}
|
||||||
if (bgAnimation != null && !isGameFast && !MatchController.instance.getGameView().isMatchOver()) {
|
if (bgAnimation != null && !isGameFast) {
|
||||||
bgAnimation.drawBackground(g, matchBG, x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, !Forge.isMobileAdventureMode, true);
|
bgAnimation.drawBackground(g, matchBG, x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, !Forge.isMobileAdventureMode, true);
|
||||||
} else {
|
} else {
|
||||||
g.drawImage(matchBG, x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, !Forge.isMobileAdventureMode);
|
g.drawImage(matchBG, x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, !Forge.isMobileAdventureMode);
|
||||||
@@ -969,7 +971,7 @@ public class MatchScreen extends FScreen {
|
|||||||
bgFullWidth = w;
|
bgFullWidth = w;
|
||||||
bgHeight = scaledbgHeight;
|
bgHeight = scaledbgHeight;
|
||||||
}
|
}
|
||||||
if (bgAnimation != null && !isGameFast && !MatchController.instance.getGameView().isMatchOver()) {
|
if (bgAnimation != null && !isGameFast) {
|
||||||
bgAnimation.drawBackground(g, FSkinTexture.valueOf(imageName), x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, true, false);
|
bgAnimation.drawBackground(g, FSkinTexture.valueOf(imageName), x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, true, false);
|
||||||
} else {
|
} else {
|
||||||
g.drawImage(FSkinTexture.valueOf(imageName), x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, true);
|
g.drawImage(FSkinTexture.valueOf(imageName), x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user