Almamu / linux-wallpaperengine

Wallpaper Engine backgrounds for Linux!
GNU General Public License v3.0
1.59k stars 61 forks source link

[BGFIX]2370927443 #124

Closed Crylia closed 1 year ago

Crylia commented 2 years ago

Wallpaper Engine Background(s)

2370927443

Console output

./wallengine 431960/2370927443
Detected scene.pkg file at /home/crylia/linux-wallpaperengine/build/431960/2370927443/scene.pkg. Adding to list of searchable paths
No gifscene.pkg file found at /home/crylia/linux-wallpaperengine/build/431960/2370927443/. Defaulting to normal folder storage
Found wallpaper engine's assets at /home/crylia/.steam/debian-installation/steamapps/common/wallpaper_engine/assets
min is not of type double, returning default value
max is not of type double, returning default value
step is not of type double, returning default value
min is not of type double, returning default value
max is not of type double, returning default value
min is not of type double, returning default value
[mp3float @ 0x560815550ec0] Could not update timestamps for skipped samples.
Invalid return value 0 for stream protocol
Invalid return value 0 for stream protocol
terminate called after throwing an instance of 'std::runtime_error'
  what():  0(519) : error C1021: operands to "%" must be integral
0(520) : error C7011: implicit cast from "int" to "uint"
0(520) : error C7011: implicit cast from "int" to "uint"
0(592) : error C7011: implicit cast from "float" to "int"

Compiled source code:
#version 150
#define highp
#define mediump
#define lowp
#define mul(x, y) ((y) * (x))
#define max(x, y) max (y, x)
#define lerp mix
#define frac fract
#define CAST2(x) (vec2(x))
#define CAST3(x) (vec3(x))
#define CAST4(x) (vec4(x))
#define CAST3X3(x) (mat3(x))
#define saturate(x) (clamp(x, 0.0, 1.0))
#define texSample2D texture2D
#define texSample2DLod textureLod
#define atan2 atan
#define ddx dFdx
#define ddy(x) dFdy(-(x))
#define GLSL 1
#define HLSL 1
#define float1 float
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define varying in
#define gl_FragColor glOutColor
out vec4 glOutColor;
#define ANTIALIAS 0
#define A_SMOOTH_CURVE 0
#define BLENDMODE 0
#define CLIP_HIGH 0
#define CLIP_LOW 0
#define RESOLUTION 16
#define SHAPE 0
#define TRANSPARENCY 1
// [COMBO] {"material":"Position","combo":"SHAPE","type":"options","default":0,"options":{"Bottom":0,"Top":1,"Left":2,"Right":3,"Circle - Inner":4,"Circle - Outer":5,"Center - L/R":6,"Center - U/D":7,"Stereo - L/R":8,"Stereo - U/D":9}}

// [COMBO] {"material":"Transparency","combo":"TRANSPARENCY","type":"options","default":1,"options":{"Preserve original":0,"Replace original":1,"Add to original":2,"Subtract from original":3,"Intersect original":4,"Fully opaque":5}}

// [COMBO] {"material":"Frequency Resolution","combo":"RESOLUTION","type":"options","default":32,"options":{"16":16,"32":32,"64":64}}

// [COMBO] {"material":"ui_editor_properties_blend_mode","combo":"BLENDMODE","type":"imageblending","default":0}

// [COMBO] {"material":"Smooth curve","combo":"A_SMOOTH_CURVE","type":"options","default":0}

// [COMBO] {"material":"Anti-aliasing","combo":"ANTIALIAS","type":"options","default":0}

// [COMBO] {"material":"Hide Below Lower Bounds","combo":"CLIP_LOW","type":"options","default":0}

// [COMBO] {"material":"Hide Above Upper Bounds","combo":"CLIP_HIGH","type":"options","default":0}

#define DEG2RAD 2 * M_PI / 360.0
#define DEG2PCT 1 / 360.0

// Same as GLSL's modulo function. Return value's sign is equivalent to the y value's sign.

// begin of included from file common.h

#define M_PI 3.14159265359
#define M_PI_HALF 1.57079632679
#define M_PI_2 6.28318530718

#define SQRT_2 1.41421356237
#define SQRT_3 1.73205080756

///////////////////////////////////////////
// Color conversion
///////////////////////////////////////////

vec3 hsv2rgb(vec3 c)
{
    vec4 K= vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p= abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

vec3 rgb2hsv(vec3 RGB)
{
    vec4 P= (RGB.g < RGB.b) ? vec4(RGB.bg, -1.0, 2.0/3.0) : vec4(RGB.gb, 0.0, -1.0/3.0);
    vec4 Q= (RGB.r < P.x) ? vec4(P.xyw, RGB.r) : vec4(RGB.r, P.yzx);
    float C= Q.x - min(Q.w, Q.y);
    float H= abs((Q.w - Q.y) / (6.0 * C + 1e-10) + Q.z);

    vec3 HCV= vec3(H, C, Q.x);
    float S= HCV.y / (HCV.z + 1e-10);
    return vec3(HCV.x, S, HCV.z);
}

vec2 rotateVec2(vec2 v, float r)
{
    vec2 cs= vec2(cos(r), sin(r));
    return vec2(v.x * cs.x - v.y * cs.y,
                v.x * cs.y + v.y * cs.x);
}

float greyscale(vec3 color)
{
    return dot(color, vec3(0.11, 0.59, 0.3));
}

// end of included from file common.h
// begin of included from file common_blending.h

vec4 Desaturate(vec3 color, float Desaturation)
{
    vec3 grayXfer= vec3(0.3, 0.59, 0.11);
    vec3 gray= CAST3(dot(grayXfer, color));
    return vec4(mix(color, gray, Desaturation), 1.0);
}

vec3 RGBToHSL(vec3 color)
{
    vec3 hsl;
    float fmin= min(min(color.r, color.g), color.b);
    float fmax= max(max(color.r, color.g), color.b);
    float delta= fmax - fmin;
    hsl.z = (fmax + fmin) / 2.0;

    if (delta == 0.0)
    {
        hsl.x = 0.0;
        hsl.y = 0.0;
    }
    else
    {
        if (hsl.z < 0.5)
            hsl.y = delta / (fmax + fmin);
        else
            hsl.y = delta / (2.0 - fmax - fmin);
        float deltaR= (((fmax - color.r) / 6.0) + (delta / 2.0)) / delta;
        float deltaG= (((fmax - color.g) / 6.0) + (delta / 2.0)) / delta;
        float deltaB= (((fmax - color.b) / 6.0) + (delta / 2.0)) / delta;
        if (color.r == fmax )
            hsl.x = deltaB - deltaG;
        else if (color.g == fmax)
            hsl.x = (1.0 / 3.0) + deltaR - deltaB;
        else if (color.b == fmax)
            hsl.x = (2.0 / 3.0) + deltaG - deltaR;

        if (hsl.x < 0.0)
            hsl.x += 1.0;
        else if (hsl.x > 1.0)
            hsl.x -= 1.0;
    }

    return hsl;
}

float HueToRGB(float f1, float f2, float hue)
{
    if (hue < 0.0)
        hue += 1.0;
    else if (hue > 1.0)
        hue -= 1.0;
    float res;
    if ((6.0 * hue) < 1.0)
        res = f1 + (f2 - f1) * 6.0 * hue;
    else if ((2.0 * hue) < 1.0)
        res = f2;
    else if ((3.0 * hue) < 2.0)
        res = f1 + (f2 - f1) * ((2.0 / 3.0) - hue) * 6.0;
    else
        res = f1;
    return res;
}

vec3 HSLToRGB(vec3 hsl)
{
    vec3 rgb;
    if (hsl.y == 0.0)
        rgb = CAST3(hsl.z);
    else
    {
        float f2;
        if (hsl.z < 0.5)
            f2 = hsl.z * (1.0 + hsl.y);
        else
            f2 = (hsl.z + hsl.y) - (hsl.y * hsl.z);
        float f1= 2.0 * hsl.z - f2;
        rgb.r = HueToRGB(f1, f2, hsl.x + (1.0/3.0));
        rgb.g = HueToRGB(f1, f2, hsl.x);
        rgb.b= HueToRGB(f1, f2, hsl.x - (1.0/3.0));
    }

    return rgb;
}

vec3 ContrastSaturationBrightness(vec3 color, float brt, float sat, float con)
{
    const float AvgLumR= 0.5;
    const float AvgLumG= 0.5;
    const float AvgLumB= 0.5;

    const vec3 LumCoeff= vec3(0.2125, 0.7154, 0.0721);

    vec3 AvgLumin= vec3(AvgLumR, AvgLumG, AvgLumB);
    vec3 brtColor= color * brt;
    vec3 intensity= CAST3(dot(brtColor, LumCoeff));
    vec3 satColor= mix(intensity, brtColor, sat);
    vec3 conColor= mix(AvgLumin, satColor, con);
    return conColor;
}

#define BlendLinearDodgef(base, blend) (base + blend)
#define BlendLinearBurnf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLightenf(base, blend) max(blend, base)
#define BlendDarkenf(base, blend) min(blend, base)
#define BlendLinearLightf(base, blend) (blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
#define BlendScreenf(base, blend) (1.0 - ((1.0 - base) * (1.0 - blend)))
#define BlendOverlayf(base, blend) (base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
#define BlendSoftLightf(base, blend) ((blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend)))
#define BlendColorDodgef(base, blend) ((blend == 1.0) ? blend : min(base / (1.0 - blend), 1.0))
#define BlendColorBurnf(base, blend) ((blend == 0.0) ? blend : max((1.0 - ((1.0 - base) / blend)), 0.0))
#define BlendVividLightf(base, blend) ((blend < 0.5) ? BlendColorBurnf(base, (2.0 * blend)) : BlendColorDodgef(base, (2.0 * (blend - 0.5))))
#define BlendPinLightf(base, blend) ((blend < 0.5) ? BlendDarkenf(base, (2.0 * blend)) : BlendLightenf(base, (2.0 *(blend - 0.5))))
#define BlendHardMixf(base, blend) ((BlendVividLightf(base, blend) < 0.5) ? 0.0 : 1.0)
#define BlendReflectf(base, blend) ((blend == 1.0) ? blend : min(base * base / (1.0 - blend), 1.0))
#define BlendNormal(base, blend) (blend)
#define BlendLighten BlendLightenf
#define BlendDarken  BlendDarkenf
#define BlendMultiply(base, blend) (base * blend)
#define BlendAverage(base, blend) ((base + blend) / 2.0)
#define BlendAdd(base, blend) min(base + blend, CAST3(1.0))
#define BlendSubstract(base, blend) max(base + blend - CAST3(1.0), CAST3(0.0))
#define BlendDifference(base, blend) abs(base - blend)
#define BlendNegation(base, blend) (CAST3(1.0) - abs(CAST3(1.0) - base - blend))
#define BlendExclusion(base, blend) (base + blend - 2.0 * base * blend)
#define BlendScreen(base, blend) vec3(BlendScreenf(base.r, blend.r), BlendScreenf(base.g, blend.g), BlendScreenf(base.b, blend.b))
#define BlendOverlay(base, blend) vec3(BlendOverlayf(base.r, blend.r), BlendOverlayf(base.g, blend.g), BlendOverlayf(base.b, blend.b))
#define BlendSoftLight(base, blend) vec3(BlendSoftLightf(base.r, blend.r), BlendSoftLightf(base.g, blend.g), BlendSoftLightf(base.b, blend.b))
#define BlendHardLight(base, blend) BlendOverlay(blend, base)
#define BlendColorDodge(base, blend) vec3(BlendColorDodgef(base.r, blend.r), BlendColorDodgef(base.g, blend.g), BlendColorDodgef(base.b, blend.b))
#define BlendColorBurn(base, blend) vec3(BlendColorBurnf(base.r, blend.r), BlendColorBurnf(base.g, blend.g), BlendColorBurnf(base.b, blend.b))
#define BlendLinearLight(base, blend) vec3(BlendLinearLightf(base.r, blend.r), BlendLinearLightf(base.g, blend.g), BlendLinearLightf(base.b, blend.b))
#define BlendVividLight(base, blend) vec3(BlendVividLightf(base.r, blend.r), BlendVividLightf(base.g, blend.g), BlendVividLightf(base.b, blend.b))
#define BlendPinLight(base, blend) vec3(BlendPinLightf(base.r, blend.r), BlendPinLightf(base.g, blend.g), BlendPinLightf(base.b, blend.b))
#define BlendHardMix(base, blend) vec3(BlendHardMixf(base.r, blend.r), BlendHardMixf(base.g, blend.g), BlendHardMixf(base.b, blend.b))
#define BlendReflect(base, blend) vec3(BlendReflectf(base.r, blend.r), BlendReflectf(base.g, blend.g), BlendReflectf(base.b, blend.b))
#define BlendGlow(base, blend) BlendReflect(blend, base)
#define BlendPhoenix(base, blend) (min(base, blend) - max(base, blend) + CAST3(1.0))
#define BlendOpacity(base, blend, F, O) mix(base, F(base, blend), O)
#define BlendLinearDodge(base, blend) min(base + blend, CAST3(1.0))
#define BlendLinearBurn(base, blend) max(base + blend - CAST3(1.0), CAST3(0.0))
#define BlendTint(base, blend) (CAST3(max(base.x, max(base.y, base.z))) * blend)

vec3 BlendHue(vec3 base, vec3 blend)
{
    vec3 baseHSL= RGBToHSL(base);
    return HSLToRGB(vec3(RGBToHSL(blend).r, baseHSL.g, baseHSL.b));
}

vec3 BlendSaturation(vec3 base, vec3 blend)
{
    vec3 baseHSL= RGBToHSL(base);
    return HSLToRGB(vec3(baseHSL.r, RGBToHSL(blend).g, baseHSL.b));
}

vec3 BlendColor(vec3 base, vec3 blend)
{
    vec3 blendHSL= RGBToHSL(blend);
    return HSLToRGB(vec3(blendHSL.r, blendHSL.g, RGBToHSL(base).b));
}

vec3 BlendLuminosity(vec3 base, vec3 blend)
{
    vec3 baseHSL= RGBToHSL(base);
    return HSLToRGB(vec3(baseHSL.r, baseHSL.g, RGBToHSL(blend).b));
}

vec3 ApplyBlending(const int blendMode, in vec3 A, in vec3 B, in float opacity)
{
#if BLENDMODE == 1
        return mix(A,BlendDarken(A,B),opacity);
#endif
#if BLENDMODE == 2
        return mix(A,BlendMultiply(A,B),opacity);
#endif
#if BLENDMODE == 3
        return mix(A,BlendColorBurn(A,B),opacity);
#endif
#if BLENDMODE == 4
        return mix(A,BlendSubstract(A,B),opacity);
#endif
#if BLENDMODE == 5
        return min(A, B);
#endif
#if BLENDMODE == 6
        return mix(A,BlendLighten(A,B),opacity);
#endif
#if BLENDMODE == 7
        return mix(A,BlendScreen(A,B),opacity);
#endif
#if BLENDMODE == 8
        return mix(A,BlendColorDodge(A,B),opacity);
#endif
#if BLENDMODE == 9
        return mix(A,BlendAdd(A,B),opacity);
#endif
#if BLENDMODE == 10
        return max(A, B);
#endif
#if BLENDMODE == 11
        return mix(A,BlendOverlay(A,B),opacity);
#endif
#if BLENDMODE == 12
        return mix(A,BlendSoftLight(A,B),opacity);
#endif
#if BLENDMODE == 13
        return mix(A,BlendHardLight(A,B),opacity);
#endif
#if BLENDMODE == 14
        return mix(A,BlendVividLight(A,B),opacity);
#endif
#if BLENDMODE == 15
        return mix(A,BlendLinearLight(A,B),opacity);
#endif
#if BLENDMODE == 16
        return mix(A,BlendPinLight(A,B),opacity);
#endif
#if BLENDMODE == 17
        return mix(A,BlendHardMix(A,B),opacity);
#endif
#if BLENDMODE == 18
        return mix(A,BlendDifference(A,B),opacity);
#endif
#if BLENDMODE == 19
        return mix(A,BlendExclusion(A,B),opacity);
#endif
#if BLENDMODE == 20
        return mix(A,BlendSubstract(A,B),opacity);
#endif
#if BLENDMODE == 21
        return mix(A,BlendReflect(A,B),opacity);
#endif
#if BLENDMODE == 22
        return mix(A,BlendGlow(A,B),opacity);
#endif
#if BLENDMODE == 23
        return mix(A,BlendPhoenix(A,B),opacity);
#endif
#if BLENDMODE == 24
        return mix(A,BlendAverage(A,B),opacity);
#endif
#if BLENDMODE == 25
        return mix(A,BlendNegation(A,B),opacity);
#endif
#if BLENDMODE == 26
        return mix(A,BlendHue(A,B),opacity);
#endif
#if BLENDMODE == 27
        return mix(A,BlendSaturation(A,B),opacity);
#endif
#if BLENDMODE == 28
        return mix(A,BlendColor(A,B),opacity);
#endif
#if BLENDMODE == 29
        return mix(A,BlendLuminosity(A,B),opacity);
#endif
#if BLENDMODE == 30
        return mix(A,BlendTint(A,B),opacity);
#endif
#if BLENDMODE == 31
        return A + B * opacity;
#endif
        return mix(A,BlendNormal(A,B),opacity);
}

// end of included from file common_blending.h

float mod2(float x, float y) { return x - y * floor(x/y); }

varying vec2 v_TexCoord;

uniform float u_BarCount; // {"material":"Bar Count","default":32,"range":[1, 200]}
uniform vec2 u_BarBounds; // {"default":"0.0, 1.0","linked":true,"material":"Lower/Upper Bar Bounds","range":[0,1]}
uniform vec2 u_CircleAngles; // {"default":"0.0, 360.0","linked":true,"material":"Circle Start/End Angles","range":[0,360]}
uniform vec3 u_BarColor; // {"default":"1 1 1","material":"Bar Color","type":"color"}
uniform float u_BarOpacity; // {"default":"1","material":"ui_editor_properties_opacity"}
uniform float u_BarSpacing; // {"default":"0.1","material":"Bar Spacing"}
uniform vec2 u_AASmoothness; // {"default":"0.02, 0.02","linked":true,"material":"Anti-alias blurring","range":[0.01,0.10000000000000001]}

uniform sampler2D g_Texture0; // {"material":"previous","label":"Prev","hidden":true}

#if RESOLUTION == 16
uniform float g_AudioSpectrum16Left[16];
uniform float g_AudioSpectrum16Right[16];
#endif

#if RESOLUTION == 32
uniform float g_AudioSpectrum32Left[32];
uniform float g_AudioSpectrum32Right[32];
#endif

#if RESOLUTION == 64
uniform float g_AudioSpectrum64Left[64];
uniform float g_AudioSpectrum64Right[64];
#endif

// Position
#define BOTTOM 0
#define TOP 1
#define LEFT 2
#define RIGHT 3
#define CIRCLE_INNER 4
#define CIRCLE_OUTER 5
#define CENTER_H 6
#define CENTER_V 7
#define STEREO_H 8
#define STEREO_V 9

// Transparency
#define PRESERVE 0
#define REPLACE 1
#define ADD 2
#define SUBTRACT 3
#define INTERSECT 4
#define REMOVE 5

void main() {

    // Define the audio sample arrays
#if RESOLUTION == 16
#define u_AudioSpectrumLeft g_AudioSpectrum16Left
#define u_AudioSpectrumRight g_AudioSpectrum16Right
#endif
#if RESOLUTION == 32
#define u_AudioSpectrumLeft g_AudioSpectrum32Left
#define u_AudioSpectrumRight g_AudioSpectrum32Right
#endif
#if RESOLUTION == 64
#define u_AudioSpectrumLeft g_AudioSpectrum64Left
#define u_AudioSpectrumRight g_AudioSpectrum64Right
#endif

    // Map the coordinates to the selected shape
#if SHAPE == BOTTOM
    vec2 shapeCoord= v_TexCoord;
#endif
#if SHAPE == TOP
    vec2 shapeCoord= v_TexCoord;
    shapeCoord.y = 1 - shapeCoord.y;
#endif
#if SHAPE == LEFT
    vec2 shapeCoord= v_TexCoord.yx;
    shapeCoord.y = 1 - shapeCoord.y;
#endif
#if SHAPE == RIGHT
    vec2 shapeCoord= v_TexCoord.yx;
#endif
#if SHAPE == CENTER_H
    vec2 shapeCoord= v_TexCoord.yx;
    shapeCoord.y = frac(0.5 - shapeCoord.y);
#endif
#if SHAPE == CENTER_V
    vec2 shapeCoord= v_TexCoord.xy;
    shapeCoord.y = frac(0.5 - shapeCoord.y);
#endif
#if SHAPE == STEREO_H
    vec2 shapeCoord= v_TexCoord.yx;
#endif
#if SHAPE == STEREO_V
    vec2 shapeCoord= v_TexCoord.xy;
#endif
#if SHAPE == CIRCLE_INNER || SHAPE == CIRCLE_OUTER
    vec2 circleCoord= (v_TexCoord - 0.5) * 2;
    vec2 shapeCoord;
    float startAngle= u_CircleAngles.x * DEG2PCT;
    float endAngle= u_CircleAngles.y * DEG2PCT;
    shapeCoord.x = (atan2(circleCoord.y, circleCoord.x) + M_PI) / M_PI_2;
    // Shift to start angle
    shapeCoord.x = mod2(shapeCoord.x - min(startAngle, endAngle), 1.0);
    // Scale to area between start and end angles
    // y = 1 / (abs((x - 1) % 4 - 2) - 1)
    shapeCoord.x = shapeCoord.x / (abs(mod2(endAngle - startAngle - 1.0, 4.0) - 2.0) - 1.0);
    // Keep coordinates in
    shapeCoord.x += endAngle - startAngle < 0.0;
    shapeCoord.y = sqrt(circleCoord.x * circleCoord.x + circleCoord.y * circleCoord.y);
#if SHAPE == CIRCLE_INNER
    shapeCoord.y = 1.0 - shapeCoord.y;
#endif
#endif

    // Get the frequency for this pixel, ie where we will sample from in the audio spectrum array. 0 == lowest frequency, RESOLUTION == highest frequency.
#if A_SMOOTH_CURVE == 1
    float frequency= shapeCoord.x * RESOLUTION;
#else
    // BarDist == How far this pixel is from the center of the bar that it belongs to. 0 = right in the middle, 1 = right on the edge.
    float barDist= abs(frac(shapeCoord.x * u_BarCount) * 2 - 1);
    float frequency= floor(shapeCoord.x * u_BarCount) / u_BarCount * RESOLUTION;
#endif
    uint barFreq1 = frequency % RESOLUTION;
    uint barFreq2 = (barFreq1 + 1) % RESOLUTION;

    // Get the height of the bar
// STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ****** STEREO ******
#if SHAPE == STEREO_H || SHAPE == STEREO_V || SHAPE == CENTER_H || SHAPE == CENTER_V
    float barVolume1L= u_AudioSpectrumLeft[barFreq1];
    float barVolume2L= u_AudioSpectrumLeft[barFreq2];
    float barVolume1R= u_AudioSpectrumRight[barFreq1];
    float barVolume2R= u_AudioSpectrumRight[barFreq2];
    float barVolumeLeft= lerp(barVolume1L, barVolume2L, smoothstep(0, 1, frac(frequency)));
    float barVolumeRight= lerp(barVolume1R, barVolume2R, smoothstep(0, 1, frac(frequency)));

    bool isLeftChannel = shapeCoord.y < 0.49;
    bool isRightChannel = shapeCoord.y > 0.51;

    // bar = 1 if this pixel is inside a bar, 0 if outside
    float barHeightLeft= 0.5 * lerp(u_BarBounds.x, u_BarBounds.y, barVolumeLeft);
    float barHeightRight= 0.5 * lerp(u_BarBounds.x, u_BarBounds.y, barVolumeRight);
#if ANTIALIAS == 1
    float verticalSmoothingLeft= u_AASmoothness.y * 0.05, verticalSmoothingRight = verticalSmoothingLeft;
    verticalSmoothingLeft *= saturate(lerp(0, 1, barVolumeLeft * 100.0)); // Don't blur when near 0 volume
    verticalSmoothingRight *= saturate(lerp(0, 1, barVolumeRight * 100.0));
    float barLeft= smoothstep(shapeCoord.y - verticalSmoothingLeft, shapeCoord.y + verticalSmoothingLeft, barHeightLeft);
    float barRight= smoothstep(1 - shapeCoord.y - verticalSmoothingRight, 1 - shapeCoord.y + verticalSmoothingRight, barHeightRight);
#else
    int barLeft = step(shapeCoord.y, barHeightLeft);
    int barRight = step(1 - shapeCoord.y, barHeightRight);
#endif
#if SHAPE == CENTER_H || SHAPE == CENTER_V
    // Clip the L/R channels for center, so they don't wrap around.
    barLeft *= isLeftChannel; barRight *= isRightChannel;
#endif

    // Bounds Clipping (Stereo)
#if CLIP_LOW == 1
#if ANTIALIAS == 1
    barLeft *= 1.0 - smoothstep(shapeCoord.y - verticalSmoothingLeft, shapeCoord.y + verticalSmoothingLeft, 0.5 * u_BarBounds.x);
    barRight *= 1.0 - smoothstep(1.0 - shapeCoord.y - verticalSmoothingRight, 1 - shapeCoord.y + verticalSmoothingRight, 0.5 * u_BarBounds.x);
#else
    barLeft *= 1.0 - step(shapeCoord.y, 0.5 * u_BarBounds.x);
    barRight *= 1.0 - step(1.0 - shapeCoord.y, 0.5 * u_BarBounds.x);
#endif
#endif
#if CLIP_HIGH == 1
#if ANTIALIAS == 1
    barLeft *= smoothstep(shapeCoord.y - verticalSmoothingLeft, 1 - shapeCoord.y + verticalSmoothingLeft, u_BarBounds.y);
    barRight *= smoothstep(1.0 - shapeCoord.y - verticalSmoothingRight, 1 - shapeCoord.y + verticalSmoothingRight, u_BarBounds.y);
#else
    barLeft *= step(shapeCoord.y, u_BarBounds.y);
    barRight *= step(1.0 - shapeCoord.y, u_BarBounds.y);
#endif
#endif

    float bar= max(barLeft, barRight);

// NON-STEREO *********** NON-STEREO *********** NON-STEREO *********** NON-STEREO *********** NON-STEREO *********** NON-STEREO ***********
#else
    float barVolume1= (u_AudioSpectrumLeft[barFreq1] + u_AudioSpectrumRight[barFreq1]) * 0.5;
    float barVolume2= (u_AudioSpectrumLeft[barFreq2] + u_AudioSpectrumRight[barFreq2]) * 0.5;
    float barVolume= lerp(barVolume1, barVolume2, smoothstep(0, 1, frac(frequency)));

    // How tall the bar is in the current pixel's column
    float barHeight= lerp(u_BarBounds.x, u_BarBounds.y, barVolume);
    // bar = 1 if this pixel is inside a bar, 0 if outside
#if ANTIALIAS == 1
    float verticalSmoothing= u_AASmoothness.y * 0.05;
    verticalSmoothing *= saturate(lerp(0, 1, barVolume * 100.0)); // Don't blur when near 0 volume
    float bar= smoothstep(1 - shapeCoord.y - verticalSmoothing, 1 - shapeCoord.y + verticalSmoothing, barHeight);
#else
    int bar = step(1 - shapeCoord.y, barHeight);
#endif

    // Bounds Clipping (Non-stereo)
#if CLIP_LOW == 1
#if ANTIALIAS == 1
    bar *= 1.0 - smoothstep(1.0 - shapeCoord.y - verticalSmoothing, 1 - shapeCoord.y + verticalSmoothing, u_BarBounds.x);
#else
    bar *= 1.0 - step(1.0 - shapeCoord.y, u_BarBounds.x);
#endif
#endif
#if CLIP_HIGH == 1
#if ANTIALIAS == 1
    bar *= smoothstep(1.0 - shapeCoord.y - verticalSmoothing, 1 - shapeCoord.y + verticalSmoothing, u_BarBounds.y);
#else
    bar *= step(1.0 - shapeCoord.y, u_BarBounds.y);
#endif
#endif

#endif // End of stereo vs non-stereo

    // Semi-circle clipping
#if SHAPE == CIRCLE_INNER || SHAPE == CIRCLE_OUTER
// #if ANTIALIAS == 1
//  bar *= smoothstep(0.0, u_AASmoothness * 0.1, shapeCoord.x) * smoothstep(1.0, 1.0 - u_AASmoothness, shapeCoord.x * sign(endAngle - startAngle));
// #else
    bar *= shapeCoord.x > 0.0 && shapeCoord.x * sign(endAngle - startAngle) < 1.0;
// #endif
#endif

    // Bar spacing
#if A_SMOOTH_CURVE != 1
#if ANTIALIAS == 1
    bar *= max(1 - step (0.01, u_BarSpacing), smoothstep(barDist - u_AASmoothness.x, barDist + u_AASmoothness.x, (1 - u_BarSpacing)));
#else
    bar *= step(barDist, 1 - u_BarSpacing);
#endif
#endif

    vec3 finalColor= u_BarColor;

    // Get the existing pixel color
    vec4 scene= texSample2D(g_Texture0, v_TexCoord);

    // Apply blend mode
    finalColor = ApplyBlending(BLENDMODE, lerp(finalColor.rgb, scene.rgb, scene.a), finalColor.rgb, bar * u_BarOpacity);

#if TRANSPARENCY == PRESERVE
    float alpha= scene.a;
#endif
#if TRANSPARENCY == REPLACE
    float alpha= bar * u_BarOpacity;
#endif
#if TRANSPARENCY == ADD
    float alpha= max(scene.a, bar * u_BarOpacity);
#endif
#if TRANSPARENCY == SUBTRACT
    float alpha= max(0, scene.a - bar * u_BarOpacity);
#endif
#if TRANSPARENCY == INTERSECT
    float alpha= scene.a * bar * u_BarOpacity;
#endif
#if TRANSPARENCY == REMOVE
    float alpha= u_BarOpacity;
#endif

    gl_FragColor = vec4(finalColor, alpha);
    //gl_FragColor = vec4(CAST3(shapeCoord.x), alpha);
}

Desktop (please complete the following information):

Additional context

Nvidia 515.48.07 RTX 3070

Almamu commented 1 year ago

Should now display after the changes in 4e3254e843f061dcb27a16534f7b787c800a76d2 Sound doesn't work yet and crashes the background, you might want to run it with --silent for now...

Almamu commented 1 year ago

All the effects of Lofi cafe should be properly loaded and rendered, the only thing being left is particles. The progress on that is tracked in #52