The replay must pass checks for qualifying length, level, and maximum amount of existing files. Only start recording a replay if the level is greater than the configured minimum level. Add function for getting a list of all replay JSON file paths from a directory. Remove the level advance event from replays, effectively restricting replays to a single level. Add modulus to time in glass shader so that large time values don't cause an unknown overflow value error in graphics. Add arcade cabinet home page to web documents.
117 lines
3.2 KiB
GLSL
117 lines
3.2 KiB
GLSL
/*@~@~@ |C|A|K|E|F|O|O|T| <presented by> 💫dank.game💫
|
|
|~)~)~)
|
|
|\~*~*| Licensed under the zlib and CC-BY licenses. Source is available at
|
|
|\\~*~|
|
|
,~|#\\~*|~, <https://open.shampoo.ooo/shampoo/cakefoot>
|
|
: \\@\\~| :
|
|
: \\#\\| : Created with open SPACE🪐BOX engine for cross-platform, PC, web and mobile games
|
|
: \\@\' :
|
|
: \\/ : <https://open.shampoo.ooo/shampoo/spacebox>
|
|
`~ ~ ~`~ ~'
|
|
|
|
The contents of this file must be appended to a file which forward declares a bg function and defines a main function.
|
|
See shaders/shader.frag.
|
|
|
|
This is a modification of "EarthBound Coffee Break" by @MakiXx on ShaderToy:
|
|
|
|
https://www.shadertoy.com/view/WlScWh
|
|
|
|
*/
|
|
|
|
/*!
|
|
* https://gist.github.com/patriciogonzalezvivo/670c22f3966e662d2f83
|
|
*/
|
|
float random(float n) { return fract(sin(n) * 43758.5453123); }
|
|
|
|
/*!
|
|
* https://gist.github.com/patriciogonzalezvivo/670c22f3966e662d2f83
|
|
*/
|
|
float noise(float p)
|
|
{
|
|
float fl = floor(p);
|
|
float fc = fract(p);
|
|
return mix(random(fl), random(fl + 1.0), fc);
|
|
}
|
|
|
|
float random2d(in vec2 st) {
|
|
return fract(sin(dot(st.xy, vec2(12.0, 78.0))));
|
|
}
|
|
|
|
float noise2d(in vec2 st) {
|
|
vec2 i = floor(st);
|
|
vec2 f = fract(st);
|
|
|
|
// Four corners in 2D of a tile
|
|
float a = random2d(i);
|
|
float b = random2d(i + vec2(1.0, 0.0));
|
|
float c = random2d(i + vec2(0.0, 1.0));
|
|
float d = random2d(i + vec2(1.0, 1.0));
|
|
|
|
// Smooth Interpolation
|
|
|
|
// Cubic Hermine Curve. Same as SmoothStep()
|
|
vec2 u = f*f*(3.0-2.0*f);
|
|
|
|
// Mix 4 corners percentages
|
|
return mix(a, b, u.x) +
|
|
(c - a)* u.y * (1.0 - u.x) +
|
|
(d - b) * u.x * u.y;
|
|
}
|
|
|
|
/*!
|
|
* Modified from the original, which is Copyright (c) 2020 Maki. All rights reserved.
|
|
* https://www.shadertoy.com/view/WlScWh
|
|
*/
|
|
vec2 wobbly(vec2 uv, float speed, float repetition, float amount, float offset)
|
|
{
|
|
return vec2(
|
|
uv.x,
|
|
uv.y + sin(uv.y * repetition + (mod(time, 600.0) + offset) * speed) / amount
|
|
);
|
|
}
|
|
|
|
/*!
|
|
* Modified from the original, which is Copyright (c) 2020 Maki. All rights reserved.
|
|
* https://www.shadertoy.com/view/WlScWh
|
|
*/
|
|
float bubbles(vec2 uv, float offset, float direction)
|
|
{
|
|
uv *= bg_control_2;
|
|
uv = wobbly(uv, 0.8, bg_control_1 * bg_control_2, 0.2 * bg_control_2, offset);
|
|
uv -= vec2(mod(time, 600.0) * 0.3 * direction, mod(time, 600.0) * 0.8);
|
|
|
|
vec2 F = vec2(noise2d(uv) * bg_control_4, 0.0);
|
|
|
|
return 1.0 - step(0.33, F.x)
|
|
- (1.0 - step(0.33 - bg_control_3, F.x))
|
|
+ (1.0 - step(0.33 - (bg_control_3 + 0.09), F.x))
|
|
- (1.0 - step(0.33 - (4.0 * bg_control_3 + 0.09), F.x));
|
|
}
|
|
|
|
#define colorBg vec4(0.1, 0.1, 0.1, 1.0)
|
|
|
|
/*!
|
|
* Modified from the original, which is Copyright (c) 2020 Maki. All rights reserved.
|
|
* https://www.shadertoy.com/view/WlScWh
|
|
*/
|
|
vec4 bg()
|
|
{
|
|
vec2 uv = gl_FragCoord.xy / resolution;
|
|
|
|
float blueBubbles = bubbles(uv, 11512.11, 1.0);
|
|
float blueCombined = clamp(blueBubbles, 0.0, 1.0);
|
|
|
|
float greenBubbles = bubbles(uv, 82351.93, -1.0);
|
|
float greenCombined = clamp(greenBubbles, 0.0, 1.0);
|
|
|
|
return mix(
|
|
mix(
|
|
colorBg, // a
|
|
bg_color_1, // b
|
|
blueCombined // alpha
|
|
), // a
|
|
bg_color_2, // b
|
|
greenCombined // alpha
|
|
);
|
|
}
|