<commit_before>
def wrapShader(code):
    return code

VS_2D = """

uniform mat4 projection;

attribute vec4 inVertex;

varying vec2 varUv;

void main()
{
    varUv = inVertex.zw;
    gl_Position = projection * vec4(inVertex.xy, 0.0, 1.0);
}
"""

PS_WALK_2D = """

varying vec2 varUv;

uniform sampler2D tex0;
uniform sampler2D tex1;
uniform float shownTime;
uniform float animationTime;

void main()
{
    vec4 color1 = texture2D(tex0, varUv);
    vec4 weights = texture2D(tex1, varUv);
    float influence = weights.r;

    if (influence > 0.0) {
        float speed = sin(animationTime * 5.0);
        float xShift = sin(speed + varUv.x * varUv.y * 10) * influence * 0.01;
        float yShift = cos(speed + varUv.x * varUv.y * 5) * influence * 0.01;

        gl_FragColor = texture2D(tex0, varUv + vec2(xShift, yShift));
    }
    else {
        gl_FragColor = color1;
    }
}
"""

LIB_WIND = """

uniform sampler2D tex0;
uniform sampler2D tex1;

uniform float mouseEnabled;
uniform vec2 mousePos;

uniform vec2 eyeShift;
uniform vec2 mouthShift;

const float WIND_SPEED = 5.0;
const float DISTANCE = 0.0075;
const float FLUIDNESS = 0.75;
const float TURBULENCE = 15.0;

vec4 applyWind(vec2 uv, float time)
{
    float movement = 0.1;

    vec4 weights = texture2D(tex1, uv);

    if (weights.g > 0.0) {
        vec2 eyeCoords = uv + (eyeShift * weights.g);
        if (texture2D(tex1, eyeCoords).g > 0.0) {
            return texture2D(tex0, eyeCoords);
        }
    }

    if (weights.b > 0.0) {
        vec2 smileCoords = uv + (mouthShift * weights.b);
        if (texture2D(tex1, smileCoords).b > 0.0) {
            return texture2D(tex0, smileCoords);
        }
    }

    float influence = weights.r * (0.5 + (movement * 1.25));

    if (mouseEnabled > 0.0) {
        //Use mouse position to set influence
        influence = (1.0 - distance(mousePos, uv) * 5.0) * 2.0;
    }

    if (influence > 0.0) {
        float modifier = sin(uv.x + time) / 2.0 + 1.5;
        float xShift = sin((uv.y * 20.0) * FLUIDNESS + (time * WIND_SPEED)) * modifier * influence * DISTANCE;
        float yShift = cos((uv.x * 50.0) * FLUIDNESS + (time * WIND_SPEED)) * influence * DISTANCE;
        return texture2D(tex0, uv + vec2(xShift, yShift));
    }
    else {
        return texture2D(tex0, uv);
    }
}
"""

PS_WIND_2D = LIB_WIND + """

varying vec2 varUv;

uniform float shownTime;
uniform float animationTime;

void main()
{
    gl_FragColor = applyWind(varUv, shownTime);
}
"""<commit_msg>Add wind effect strength fade in<commit_after>
def wrapShader(code):
    return code

VS_2D = """

uniform mat4 projection;

attribute vec4 inVertex;

varying vec2 varUv;

void main()
{
    varUv = inVertex.zw;
    gl_Position = projection * vec4(inVertex.xy, 0.0, 1.0);
}
"""

PS_WALK_2D = """

varying vec2 varUv;

uniform sampler2D tex0;
uniform sampler2D tex1;
uniform float shownTime;
uniform float animationTime;

void main()
{
    vec4 color1 = texture2D(tex0, varUv);
    vec4 weights = texture2D(tex1, varUv);
    float influence = weights.r;

    if (influence > 0.0) {
        float speed = sin(animationTime * 5.0);
        float xShift = sin(speed + varUv.x * varUv.y * 10) * influence * 0.01;
        float yShift = cos(speed + varUv.x * varUv.y * 5) * influence * 0.01;

        gl_FragColor = texture2D(tex0, varUv + vec2(xShift, yShift));
    }
    else {
        gl_FragColor = color1;
    }
}
"""

LIB_WIND = """

uniform sampler2D tex0;
uniform sampler2D tex1;

uniform float mouseEnabled;
uniform vec2 mousePos;

uniform vec2 eyeShift;
uniform vec2 mouthShift;

const float WIND_SPEED = 5.0;
const float DISTANCE = 0.0075;
const float FLUIDNESS = 0.75;
const float TURBULENCE = 15.0;
const float FADE_IN = 1.0; //In seconds

vec4 applyWind(vec2 uv, float time)
{
    float movement = 0.1;

    vec4 weights = texture2D(tex1, uv);

    if (weights.g > 0.0) {
        vec2 eyeCoords = uv + (eyeShift * weights.g);
        if (texture2D(tex1, eyeCoords).g > 0.0) {
            return texture2D(tex0, eyeCoords);
        }
    }

    if (weights.b > 0.0) {
        vec2 smileCoords = uv + (mouthShift * weights.b);
        if (texture2D(tex1, smileCoords).b > 0.0) {
            return texture2D(tex0, smileCoords);
        }
    }

    float timeFade = min(time / FADE_IN, 1.0);
    float influence = weights.r * (0.5 + (movement * 1.25)) * timeFade;

    if (mouseEnabled > 0.0) {
        //Use mouse position to set influence
        influence = (1.0 - distance(mousePos, uv) * 5.0) * 2.0;
    }

    if (influence > 0.0) {
        float modifier = sin(uv.x + time) / 2.0 + 1.5;
        float xShift = sin((uv.y * 20.0) * FLUIDNESS + (time * WIND_SPEED)) * modifier * influence * DISTANCE;
        float yShift = cos((uv.x * 50.0) * FLUIDNESS + (time * WIND_SPEED)) * influence * DISTANCE;
        return texture2D(tex0, uv + vec2(xShift, yShift));
    }
    else {
        return texture2D(tex0, uv);
    }
}
"""

PS_WIND_2D = LIB_WIND + """

varying vec2 varUv;

uniform float shownTime;
uniform float animationTime;

void main()
{
    gl_FragColor = applyWind(varUv, shownTime);
}
"""
{'fraction_non_alphanumeric': 0.12850696488130273, 'fraction_numerical': 0.04630174612517167, 'mean_word_length': 2.6544802867383512, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2746787', 'n_tokens_mistral': 2036, 'n_tokens_neox': 1895, 'n_words': 487}