feat: add vaapi path for video wallpapers on generic gpus
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
uniform sampler2D source;
|
||||
uniform vec2 size;
|
||||
uniform vec4 crop;
|
||||
uniform float alpha;
|
||||
out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
vec2 p = vec2(gl_FragCoord.x, size.y - gl_FragCoord.y) / size;
|
||||
vec4 c = texture(source, crop.xy + p * crop.zw);
|
||||
outColor = vec4(c.rgb, c.a * alpha);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
void main() {
|
||||
vec2 corner = vec2(float((gl_VertexID << 1) & 2), float(gl_VertexID & 2));
|
||||
gl_Position = vec4(corner * 2.0 - 1.0, 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
// Bow-tie wipe transition adapted from gl-transitions.com
|
||||
// Author: huynx (MIT)
|
||||
// Original: two triangles grow from the top and bottom edges into a bow tie
|
||||
// that reveals the incoming image.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
float check(vec2 p1, vec2 p2, vec2 p3) {
|
||||
return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
|
||||
}
|
||||
|
||||
bool pointInTriangle(vec2 pt, vec2 p1, vec2 p2, vec2 p3) {
|
||||
bool b1 = check(pt, p1, p2) < 0.0;
|
||||
bool b2 = check(pt, p2, p3) < 0.0;
|
||||
bool b3 = check(pt, p3, p1) < 0.0;
|
||||
return (b1 == b2) && (b2 == b3);
|
||||
}
|
||||
|
||||
bool in_top_triangle(vec2 p) {
|
||||
vec2 vertex1 = vec2(0.5, progress);
|
||||
vec2 vertex2 = vec2(0.5 - progress, 0.0);
|
||||
vec2 vertex3 = vec2(0.5 + progress, 0.0);
|
||||
return pointInTriangle(p, vertex1, vertex2, vertex3);
|
||||
}
|
||||
|
||||
bool in_bottom_triangle(vec2 p) {
|
||||
vec2 vertex1 = vec2(0.5, 1.0 - progress);
|
||||
vec2 vertex2 = vec2(0.5 - progress, 1.0);
|
||||
vec2 vertex3 = vec2(0.5 + progress, 1.0);
|
||||
return pointInTriangle(p, vertex1, vertex2, vertex3);
|
||||
}
|
||||
|
||||
float blur_edge(vec2 bot1, vec2 bot2, vec2 top, vec2 testPt) {
|
||||
vec2 lineDir = bot1 - top;
|
||||
vec2 perpDir = vec2(lineDir.y, -lineDir.x);
|
||||
vec2 dirToPt1 = bot1 - testPt;
|
||||
float dist1 = abs(dot(normalize(perpDir), dirToPt1));
|
||||
|
||||
lineDir = bot2 - top;
|
||||
perpDir = vec2(lineDir.y, -lineDir.x);
|
||||
dirToPt1 = bot2 - testPt;
|
||||
float min_dist = min(abs(dot(normalize(perpDir), dirToPt1)), dist1);
|
||||
|
||||
if (min_dist < 0.005)
|
||||
return min_dist / 0.005;
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
if (in_top_triangle(uv)) {
|
||||
if (progress < 0.1)
|
||||
return getFromColor(uv);
|
||||
|
||||
if (uv.y < 0.5) {
|
||||
vec2 vertex1 = vec2(0.5, progress);
|
||||
vec2 vertex2 = vec2(0.5 - progress, 0.0);
|
||||
vec2 vertex3 = vec2(0.5 + progress, 0.0);
|
||||
return mix(
|
||||
getFromColor(uv),
|
||||
getToColor(uv),
|
||||
blur_edge(vertex2, vertex3, vertex1, uv));
|
||||
}
|
||||
if (progress > 0.0)
|
||||
return getToColor(uv);
|
||||
return getFromColor(uv);
|
||||
}
|
||||
|
||||
if (in_bottom_triangle(uv)) {
|
||||
if (uv.y >= 0.5) {
|
||||
vec2 vertex1 = vec2(0.5, 1.0 - progress);
|
||||
vec2 vertex2 = vec2(0.5 - progress, 1.0);
|
||||
vec2 vertex3 = vec2(0.5 + progress, 1.0);
|
||||
return mix(
|
||||
getFromColor(uv),
|
||||
getToColor(uv),
|
||||
blur_edge(vertex2, vertex3, vertex1, uv));
|
||||
}
|
||||
return getFromColor(uv);
|
||||
}
|
||||
|
||||
return getFromColor(uv);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Doom-style melt wipe, from gl-transitions.com
|
||||
// Author: Zeh Fernando (MIT)
|
||||
// Description: the outgoing image melts down in uneven columns, like the Doom
|
||||
// screen wipe. Fully procedural (no displacement texture).
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag). Optional
|
||||
// gl-transitions params are fixed here: bars = 30, amplitude = 2.0,
|
||||
// noise = 0.1, frequency = 0.5, dripScale = 0.5.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const int bars = 30;
|
||||
const float amplitude = 2.0;
|
||||
const float noise = 0.1;
|
||||
const float frequency = 0.5;
|
||||
const float dripScale = 0.5;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
float rand(int num) {
|
||||
return fract(mod(float(num) * 67123.313, 12.0) * sin(float(num) * 10.3) *
|
||||
cos(float(num)));
|
||||
}
|
||||
|
||||
float wave(int num) {
|
||||
float fn = float(num) * frequency * 0.1 * float(bars);
|
||||
return cos(fn * 0.5) * cos(fn * 0.13) * sin((fn + 10.0) * 0.3) / 2.0 + 0.5;
|
||||
}
|
||||
|
||||
float drip(int num) {
|
||||
return sin(float(num) / float(bars - 1) * 3.141592) * dripScale;
|
||||
}
|
||||
|
||||
float pos(int num) {
|
||||
return (noise == 0.0 ? wave(num)
|
||||
: mix(wave(num), rand(num), noise)) +
|
||||
(dripScale == 0.0 ? 0.0 : drip(num));
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
int bar = int(uv.x * float(bars));
|
||||
float scale = 1.0 + pos(bar) * amplitude;
|
||||
float phase = progress * scale;
|
||||
float posY = uv.y;
|
||||
|
||||
if (phase + posY < 1.0) {
|
||||
return getFromColor(vec2(uv.x, uv.y + phase));
|
||||
}
|
||||
return getToColor(uv);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Fade (crossfade) transition, from gl-transitions.com.
|
||||
//
|
||||
// Ported to ZShell's own GLSL ABI (same contract as wallpaper_trans_bowtie.frag):
|
||||
// version/precision header is prepended by WallpaperService::shaderSource, the
|
||||
// fullscreen triangle comes from shaders/wallpaper.vert, and getFromColor /
|
||||
// getToColor sample with the crop + per-layer flip convention.
|
||||
//
|
||||
// uniforms: samplers `from`/`to`, vec2 size, vec4 fromCrop, vec4 toCrop,
|
||||
// float fromFlip, float toFlip, float progress (0..1).
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
uniform float progress;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
return mix(getFromColor(uv), getToColor(uv), progress);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
// Hexagonalize crossfade, from gl-transitions.com
|
||||
// Author: Fernando Kuteken (MIT)
|
||||
// Description: both images turn into hexagons, crossfade, then sharpen again.
|
||||
// Hexagonal math from http://www.redblobgames.com/grids/hexagons/
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag). The
|
||||
// gl-transitions `ratio` contextual value is derived from `size`. Optional
|
||||
// params are fixed here: steps = 50, horizontalHexagons = 20.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const int steps = 50;
|
||||
const float horizontalHexagons = 20.0;
|
||||
float ratio;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
struct Hexagon {
|
||||
float q;
|
||||
float r;
|
||||
float s;
|
||||
};
|
||||
|
||||
Hexagon createHexagon(float q, float r) {
|
||||
Hexagon hex;
|
||||
hex.q = q;
|
||||
hex.r = r;
|
||||
hex.s = -q - r;
|
||||
return hex;
|
||||
}
|
||||
|
||||
Hexagon roundHexagon(Hexagon hex) {
|
||||
float q = floor(hex.q + 0.5);
|
||||
float r = floor(hex.r + 0.5);
|
||||
float s = floor(hex.s + 0.5);
|
||||
|
||||
float deltaQ = abs(q - hex.q);
|
||||
float deltaR = abs(r - hex.r);
|
||||
float deltaS = abs(s - hex.s);
|
||||
|
||||
if (deltaQ > deltaR && deltaQ > deltaS)
|
||||
q = -r - s;
|
||||
else if (deltaR > deltaS)
|
||||
r = -q - s;
|
||||
else
|
||||
s = -q - r;
|
||||
|
||||
return createHexagon(q, r);
|
||||
}
|
||||
|
||||
Hexagon hexagonFromPoint(vec2 point, float size) {
|
||||
point.y /= ratio;
|
||||
point = (point - 0.5) / size;
|
||||
|
||||
float q = (sqrt(3.0) / 3.0) * point.x + (-1.0 / 3.0) * point.y;
|
||||
float r = 0.0 * point.x + 2.0 / 3.0 * point.y;
|
||||
|
||||
Hexagon hex = createHexagon(q, r);
|
||||
return roundHexagon(hex);
|
||||
}
|
||||
|
||||
vec2 pointFromHexagon(Hexagon hex, float size) {
|
||||
float x = (sqrt(3.0) * hex.q + (sqrt(3.0) / 2.0) * hex.r) * size + 0.5;
|
||||
float y = (0.0 * hex.q + (3.0 / 2.0) * hex.r) * size + 0.5;
|
||||
return vec2(x, y * ratio);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
float dist = 2.0 * min(progress, 1.0 - progress);
|
||||
dist = steps > 0 ? ceil(dist * float(steps)) / float(steps) : dist;
|
||||
|
||||
float size = (sqrt(3.0) / 3.0) * dist / horizontalHexagons;
|
||||
|
||||
vec2 point = dist > 0.0 ? pointFromHexagon(hexagonFromPoint(uv, size), size)
|
||||
: uv;
|
||||
|
||||
return mix(getFromColor(point), getToColor(point), progress);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
ratio = size.x / size.y;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Linear blur crossfade, from gl-transitions.com
|
||||
// Author: gre (MIT)
|
||||
// Description: a crossfade that passes through a directional blur.
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag): the version
|
||||
// header is prepended by WallpaperService::shaderSource, the fullscreen
|
||||
// triangle comes from wallpaper.vert, and getFromColor/getToColor apply the
|
||||
// crop + flip convention. `uv` is bottom-left origin per gl-transitions.
|
||||
//
|
||||
// Optional gl-transitions params are fixed here: intensity = 0.1.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const float intensity = 0.1;
|
||||
const int passes = 6;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
vec4 c1 = vec4(0.0);
|
||||
vec4 c2 = vec4(0.0);
|
||||
|
||||
float disp = intensity * (0.5 - distance(0.5, progress));
|
||||
for (int xi = 0; xi < passes; xi++) {
|
||||
float x = float(xi) / float(passes) - 0.5;
|
||||
for (int yi = 0; yi < passes; yi++) {
|
||||
float y = float(yi) / float(passes) - 0.5;
|
||||
vec2 v = vec2(x, y);
|
||||
c1 += getFromColor(uv + disp * v);
|
||||
c2 += getToColor(uv + disp * v);
|
||||
}
|
||||
}
|
||||
c1 /= float(passes * passes);
|
||||
c2 /= float(passes * passes);
|
||||
return mix(c1, c2, progress);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// Split slide-in (horizontal), from gl-transitions.com
|
||||
// Author: OllyOllyOlly (MIT)
|
||||
// Description: the incoming image slides in as two halves moving horizontally
|
||||
// in opposite directions.
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag).
|
||||
// Optional gl-transitions params are fixed here: reverse = false.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const vec2 boundMin = vec2(0.0, 0.0);
|
||||
const vec2 boundMax = vec2(1.0, 1.0);
|
||||
|
||||
bool inBounds(vec2 p) {
|
||||
return all(lessThan(boundMin, p)) && all(lessThan(p, boundMax));
|
||||
}
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
float modifier = 1.0;
|
||||
vec2 toP = (uv.y > 0.5)
|
||||
? vec2((uv.x - (progress * modifier)) + modifier, uv.y)
|
||||
: vec2((uv.x + (progress * modifier)) - modifier, uv.y);
|
||||
|
||||
return inBounds(toP) ? getToColor(toP) : getFromColor(uv);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Tiles wave reveal, from gl-transitions.com
|
||||
// Author: numb3r23 (MIT)
|
||||
// Description: the incoming image is revealed tile by tile in a diagonal wave.
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag).
|
||||
// Optional gl-transitions params are fixed here: tileCount = (8, 8),
|
||||
// flipX = true, flipY = false.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const ivec2 tileCount = ivec2(8, 8);
|
||||
const bool flipX = true;
|
||||
const bool flipY = false;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
vec2 tileSize = 1.0 / vec2(tileCount);
|
||||
vec2 posInTile = fract(uv * vec2(tileCount));
|
||||
vec2 tileNum = floor(uv * vec2(tileCount));
|
||||
float countTiles = float(tileCount.x * tileCount.y);
|
||||
|
||||
// Diagonal wave from bottom-left to top-right.
|
||||
float offset = (tileNum.y + tileNum.x * float(tileCount.y)) / countTiles;
|
||||
float timeOffset = clamp((progress - offset) * countTiles, 0.0, 0.5);
|
||||
float sinTime = 1.0 - abs(cos(fract(timeOffset) * 3.1415926));
|
||||
|
||||
vec2 texC = posInTile;
|
||||
|
||||
if (sinTime <= 0.5) {
|
||||
if (flipX) {
|
||||
if (texC.x < sinTime || texC.x > 1.0 - sinTime)
|
||||
return getFromColor(uv);
|
||||
texC.x = texC.x < 0.5
|
||||
? (texC.x - sinTime) * 0.5 / (0.5 - sinTime)
|
||||
: (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;
|
||||
}
|
||||
if (flipY) {
|
||||
if (texC.y < sinTime || texC.y > 1.0 - sinTime)
|
||||
return getFromColor(uv);
|
||||
texC.y = texC.y < 0.5
|
||||
? (texC.y - sinTime) * 0.5 / (0.5 - sinTime)
|
||||
: (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;
|
||||
}
|
||||
vec2 globalUV = tileNum * tileSize + texC * tileSize;
|
||||
return getFromColor(globalUV);
|
||||
} else {
|
||||
if (flipX) {
|
||||
if (texC.x > sinTime || texC.x < 1.0 - sinTime)
|
||||
return getToColor(uv);
|
||||
texC.x = texC.x < 0.5
|
||||
? (texC.x - sinTime) * 0.5 / (0.5 - sinTime)
|
||||
: (texC.x - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;
|
||||
texC.x = 1.0 - texC.x;
|
||||
}
|
||||
if (flipY) {
|
||||
if (texC.y > sinTime || texC.y < 1.0 - sinTime)
|
||||
return getToColor(uv);
|
||||
texC.y = texC.y < 0.5
|
||||
? (texC.y - sinTime) * 0.5 / (0.5 - sinTime)
|
||||
: (texC.y - 0.5) * 0.5 / (0.5 - sinTime) + 0.5;
|
||||
texC.y = 1.0 - texC.y;
|
||||
}
|
||||
vec2 globalUV = tileNum * tileSize + texC * tileSize;
|
||||
return getToColor(globalUV);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Window slices wipe, from gl-transitions.com
|
||||
// Author: gre (MIT)
|
||||
// Description: the incoming image appears through vertical slices that widen.
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag).
|
||||
// Optional gl-transitions params are fixed here: count = 10.0,
|
||||
// smoothness = 0.5.
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
const float count = 10.0;
|
||||
const float smoothness = 0.5;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
float pr = smoothstep(-smoothness, 0.0, uv.x - progress * (1.0 + smoothness));
|
||||
float s = step(pr, fract(count * uv.x));
|
||||
return mix(getFromColor(uv), getToColor(uv), s);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Hard-edged wipe from top to bottom, from gl-transitions.com
|
||||
// Author: Jake Nelson (MIT)
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag).
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
return mix(getFromColor(uv), getToColor(uv), step(1.0 - uv.y, progress));
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Hard-edged wipe from left to right, from gl-transitions.com
|
||||
// Author: Jake Nelson (MIT)
|
||||
//
|
||||
// Ported to ZShell's GLSL ABI (see wallpaper_trans_bowtie.frag).
|
||||
|
||||
uniform sampler2D from;
|
||||
uniform sampler2D to;
|
||||
uniform vec2 size;
|
||||
uniform vec4 fromCrop;
|
||||
uniform vec4 toCrop;
|
||||
uniform float progress;
|
||||
uniform float fromFlip;
|
||||
uniform float toFlip;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
vec4 getFromColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, fromFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(from, fromCrop.xy + s * fromCrop.zw);
|
||||
}
|
||||
|
||||
vec4 getToColor(vec2 uv) {
|
||||
vec2 s = vec2(uv.x, toFlip > 0.5 ? 1.0 - uv.y : uv.y);
|
||||
return texture(to, toCrop.xy + s * toCrop.zw);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
return mix(getFromColor(uv), getToColor(uv), step(0.0 + uv.x, progress));
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 uv = gl_FragCoord.xy / size;
|
||||
outColor = transition(uv);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
uniform sampler2D luma;
|
||||
uniform sampler2D chroma;
|
||||
uniform vec2 size;
|
||||
uniform vec2 srcSize;
|
||||
uniform vec4 crop;
|
||||
uniform float alpha;
|
||||
uniform int matrix;
|
||||
uniform int range;
|
||||
uniform vec2 chromaOff;
|
||||
out vec4 outColor;
|
||||
|
||||
float noise(vec2 p) {
|
||||
return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
const float PI = 3.1415926535893;
|
||||
|
||||
float sinc(float x) {
|
||||
x *= PI;
|
||||
return abs(x) < 1e-6 ? 1.0 : sin(x) / x;
|
||||
}
|
||||
|
||||
float lanczos(float x) {
|
||||
if (abs(x) >= 3.0)
|
||||
return 0.0;
|
||||
return sinc(x) * sinc(x / 3.0);
|
||||
}
|
||||
|
||||
float hermite(float x) {
|
||||
float a = abs(x);
|
||||
if (a >= 1.0)
|
||||
return 0.0;
|
||||
return 1.0 - 3.0 * a * a + 2.0 * a * a * a;
|
||||
}
|
||||
|
||||
vec4 resample(sampler2D tex, vec2 plane, vec2 dest, vec2 uv) {
|
||||
vec2 pt = 1.0 / plane;
|
||||
float wx[6];
|
||||
float wy[6];
|
||||
vec2 base;
|
||||
|
||||
int upx = dest.x >= plane.x ? 1 : 0;
|
||||
int tx = upx == 1 ? 6 : 2;
|
||||
float fsx = max(1.0, plane.x / dest.x);
|
||||
float f = fract(uv.x * plane.x - 0.5);
|
||||
base.x = uv.x - f * pt.x - pt.x * (float(tx) * 0.5 - 1.0);
|
||||
float sx = 0.0;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
if (i >= tx) { wx[i] = 0.0; continue; }
|
||||
float x = f - (float(i) - float(tx) * 0.5 + 1.0);
|
||||
wx[i] = upx == 1 ? lanczos(x / fsx) : hermite(x / fsx);
|
||||
sx += wx[i];
|
||||
}
|
||||
if (sx != 0.0)
|
||||
for (int i = 0; i < 6; ++i) wx[i] /= sx;
|
||||
|
||||
int upy = dest.y >= plane.y ? 1 : 0;
|
||||
int ty = upy == 1 ? 6 : 2;
|
||||
float fsy = max(1.0, plane.y / dest.y);
|
||||
f = fract(uv.y * plane.y - 0.5);
|
||||
base.y = uv.y - f * pt.y - pt.y * (float(ty) * 0.5 - 1.0);
|
||||
float sy = 0.0;
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
if (i >= ty) { wy[i] = 0.0; continue; }
|
||||
float y = f - (float(i) - float(ty) * 0.5 + 1.0);
|
||||
wy[i] = upy == 1 ? lanczos(y / fsy) : hermite(y / fsy);
|
||||
sy += wy[i];
|
||||
}
|
||||
if (sy != 0.0)
|
||||
for (int i = 0; i < 6; ++i) wy[i] /= sy;
|
||||
|
||||
vec4 col = vec4(0.0);
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
if (wx[i] == 0.0)
|
||||
continue;
|
||||
for (int j = 0; j < 6; ++j) {
|
||||
if (wy[j] == 0.0)
|
||||
continue;
|
||||
vec2 c = base + vec2(float(i) * pt.x, float(j) * pt.y);
|
||||
col += (wx[i] * wy[j]) * texture(tex, c);
|
||||
}
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 p = vec2(gl_FragCoord.x, size.y - gl_FragCoord.y) / size;
|
||||
vec2 uv = crop.xy + p * crop.zw;
|
||||
float Yv = resample(luma, srcSize, size, uv).r;
|
||||
vec2 ch = resample(chroma, srcSize * 0.5, size, uv + chromaOff).rg;
|
||||
vec3 yuv;
|
||||
if (range == 0) {
|
||||
yuv = vec3((Yv - 16.0 / 255.0) / (219.0 / 255.0),
|
||||
(ch.r - 128.0 / 255.0) / (224.0 / 255.0),
|
||||
(ch.g - 128.0 / 255.0) / (224.0 / 255.0));
|
||||
} else {
|
||||
yuv = vec3(Yv, ch.r - 0.5, ch.g - 0.5);
|
||||
}
|
||||
mat3 m = matrix == 1
|
||||
? mat3(1.0, 1.0, 1.0, 0.0, -0.187324, 1.855600, 1.574800, -0.468124, 0.0)
|
||||
: mat3(1.0, 1.0, 1.0, 0.0, -0.344136, 1.772000, 1.402000, -0.714136, 0.0);
|
||||
vec3 rgb = m * yuv;
|
||||
rgb += (noise(gl_FragCoord.xy) - 0.5) / 255.0;
|
||||
outColor = vec4(clamp(rgb, 0.0, 1.0), alpha);
|
||||
}
|
||||
Reference in New Issue
Block a user