loaders/glsl_functions

    Dark Mode
Search:
Group by:
  Source   Edit

Consts

glsl_functions = (data: [(hcode: 1407382016, key: "mix_overlay", val: "vec4 mix_overlay(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n        outc = a;\n\n        if (outc.r < 0.5)\n            outc.r *= facm + 2.0 * fac * b.r;\n        else\n            outc.r = 1.0 - (facm + 2.0 * fac * (1.0 - b.r)) * (1.0 - outc.r);\n\n        if (outc.g < 0.5)\n            outc.g *= facm + 2.0 * fac * b.g;\n        else\n            outc.g = 1.0 - (facm + 2.0 * fac * (1.0 - b.g)) * (1.0 - outc.g);\n\n        if (outc.b < 0.5)\n            outc.b *= facm + 2.0 * fac * b.b;\n        else\n            outc.b = 1.0 - (facm + 2.0 * fac * (1.0 - b.b)) * (1.0 - outc.b);\n        return outc;\n    }"), (
    hcode: 656713985, key: "rgb_to_hsv", val: "vec4 rgb_to_hsv(vec4 rgb)\n    {\n        float cmax, cmin, h, s, v, cdelta;\n        vec3 c;\n\n        cmax = max(rgb[0], max(rgb[1], rgb[2]));\n        cmin = min(rgb[0], min(rgb[1], rgb[2]));\n        cdelta = cmax - cmin;\n\n        v = cmax;\n        if (cmax != 0.0)\n            s = cdelta / cmax;\n        else {\n            s = 0.0;\n            h = 0.0;\n        }\n\n        if (s == 0.0) {\n            h = 0.0;\n        }\n        else {\n            c = (vec3(cmax, cmax, cmax) - rgb.xyz) / cdelta;\n\n            if (rgb.x == cmax) h = c[2] - c[1];\n            else if (rgb.y == cmax) h = 2.0 + c[0] -  c[2];\n            else h = 4.0 + c[1] - c[0];\n\n            h /= 6.0;\n\n            if (h < 0.0)\n                h += 1.0;\n        }\n\n        return vec4(h, s, v, rgb.w);\n    }"), (
    hcode: 4060205056, key: "project", val: "vec3 project(vec3 a, vec3 b){\n        float len_sq = dot(b, b);\n        return (len_sq != 0.0) ? (dot(a, b) / len_sq) * b : vec3(0.0);\n    }"), (
    hcode: 3755313475, key: "map_range_stepped_clamp", val: "float map_range_stepped_clamp(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = (v-min0)/(max0-min0);\n        f = floor(f*(steps+1.0))/(steps);\n        return mix(min1, max1, clamp(f, 0.0, 1.0));\n    }\n    vec3 map_range_stepped_clamp(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = (v-min0)/(max0-min0);\n        f = floor(f*(steps+1.0))/(steps);\n        return mix(min1, max1, clamp(f, 0.0, 1.0));\n    }\n    "),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 3206876936,
    key: "map_range_stepped", val: "float map_range_stepped(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = (v-min0)/(max0-min0);\n        f = floor(f*(steps+1.0))/(steps);\n        return mix(min1, max1, f);\n    }\n    vec3 map_range_stepped(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = (v-min0)/(max0-min0);\n        f = floor(f*(steps+1.0))/(steps);\n        return mix(min1, max1, f);\n    }\n    "),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 2446967440,
    key: "mix_saturation", val: "vec4 mix_saturation(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n\n        outc = a;\n\n        vec4 hsv, hsv2;\n        hsv = rgb_to_hsv(outc);\n\n        if (hsv.y != 0.0) {\n            hsv2 = rgb_to_hsv(b);\n\n            hsv.y = facm * hsv.y + fac * hsv2.y;\n            outc = hsv_to_rgb(hsv);\n        }\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""), (hcode: 3947219474,
    key: "hsv_to_rgb", val: "vec4 hsv_to_rgb(vec4 hsv)\n    {\n        float i, f, p, q, t, h, s, v;\n        vec3 rgb;\n\n        h = hsv[0];\n        s = hsv[1];\n        v = hsv[2];\n\n        if (s == 0.0) {\n            rgb = vec3(v, v, v);\n        }\n        else {\n            if (h == 1.0)\n                h = 0.0;\n\n            h *= 6.0;\n            i = floor(h);\n            f = h - i;\n            rgb = vec3(f, f, f);\n            p = v * (1.0 - s);\n            q = v * (1.0 - (s * f));\n            t = v * (1.0 - (s * (1.0 - f)));\n\n            if (i == 0.0) rgb = vec3(v, t, p);\n            else if (i == 1.0) rgb = vec3(q, v, p);\n            else if (i == 2.0) rgb = vec3(p, v, t);\n            else if (i == 3.0) rgb = vec3(p, q, v);\n            else if (i == 4.0) rgb = vec3(t, p, v);\n            else rgb = vec3(v, p, q);\n        }\n\n        return vec4(rgb, hsv.w);\n    }"), (
    hcode: 3169636883, key: "modulo", val: "vec3 modulo(vec3 a, vec3 b){\n        return vec3(\n            sign(a.r) * ((b.r != 0.0) ? mod(abs(a.r),abs(b.r)) : 0.0),\n            sign(a.g) * ((b.g != 0.0) ? mod(abs(a.g),abs(b.g)) : 0.0),\n            sign(a.b) * ((b.b != 0.0) ? mod(abs(a.b),abs(b.b)) : 0.0) \n        );\n    }"), (
    hcode: 1626675412, key: "mix_hue", val: "vec4 mix_hue(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n\n        outc = a;\n\n        vec4 hsv, hsv2, tmp;\n        hsv2 = rgb_to_hsv(b);\n\n        if (hsv2.y != 0.0) {\n            hsv = rgb_to_hsv(outc);\n            hsv.x = hsv2.x;\n            tmp = hsv_to_rgb(hsv);\n\n            outc = mix(outc, tmp, fac);\n            outc.a = a.a;\n        }\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 2107803417,
    key: "mix_soft_light", val: "vec4 mix_soft_light(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n\n        vec4 one = vec4(1.0);\n        vec4 scr = one - (one - b) * (one - a);\n        outc = facm * a + fac * ((one - a) * b * a + a * scr);\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 1830080476,
    key: "mix_color", val: "vec4 mix_color(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n\n        outc = a;\n\n        vec4 hsv, hsv2, tmp;\n        hsv2 = rgb_to_hsv(b);\n\n        if (hsv2.y != 0.0) {\n            hsv = rgb_to_hsv(outc);\n            hsv.x = hsv2.x;\n            hsv.y = hsv2.y;\n            tmp = hsv_to_rgb(hsv);\n\n            outc = mix(outc, tmp, fac);\n            outc.a = a.a;\n        }\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 2620338975,
    key: "mix_value", val: "vec4 mix_value(vec4 a, vec4 b, float fac, out vec4 outc){\n        float facm = 1.0 - fac;\n\n        vec4 hsv, hsv2;\n        hsv = rgb_to_hsv(a);\n        hsv2 = rgb_to_hsv(b);\n\n        hsv.z = facm * hsv.z + fac * hsv2.z;\n        outc = hsv_to_rgb(hsv);\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""), (hcode: 1251330145,
    key: "map_range_linear_clamp", val: "float map_range_linear_clamp(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = (v-min0)/(max0-min0);\n        return mix(min1, max1, clamp(f, 0.0, 1.0));\n    }\n    vec3 map_range_linear_clamp(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = (v-min0)/(max0-min0);\n        return mix(min1, max1, clamp(f, 0.0, 1.0));\n    }\n    "), (
    hcode: 4272876449, key: "map_range_smoother", val: "float map_range_smoother(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = clamp((v-min0)/(max0-min0), 0.0, 1.0);\n        f = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n        return mix(min1, max1, f);\n    }\n    vec3 map_range_smoother(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = clamp((v-min0)/(max0-min0), 0.0, 1.0);\n        f = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n        return mix(min1, max1, f);\n    }\n    "), (
    hcode: 2885676579, key: "mix_burn", val: "vec4 mix_burn(vec4 a, vec4 b, float fac, out vec4 outc){\n        float tmp, facm = 1.0 - fac;\n        outc = a;\n\n        tmp = facm + fac * b.r;\n        if (tmp <= 0.0)\n            outc.r = 0.0;\n        else if ((tmp = (1.0 - (1.0 - outc.r) / tmp)) < 0.0)\n            outc.r = 0.0;\n        else if (tmp > 1.0)\n            outc.r = 1.0;\n        else\n            outc.r = tmp;\n\n        tmp = facm + fac * b.g;\n        if (tmp <= 0.0)\n            outc.g = 0.0;\n        else if ((tmp = (1.0 - (1.0 - outc.g) / tmp)) < 0.0)\n            outc.g = 0.0;\n        else if (tmp > 1.0)\n            outc.g = 1.0;\n        else\n            outc.g = tmp;\n\n        tmp = facm + fac * b.b;\n        if (tmp <= 0.0)\n            outc.b = 0.0;\n        else if ((tmp = (1.0 - (1.0 - outc.b) / tmp)) < 0.0)\n            outc.b = 0.0;\n        else if (tmp > 1.0)\n            outc.b = 1.0;\n        else\n            outc.b = tmp;\n        return outc;\n    }"), (
    hcode: 2136176866, key: "euler_xyz_to_mat3", val: "mat3 euler_xyz_to_mat3(vec3 euler){\n        float cx = cos(euler.x);\n        float cy = cos(euler.y);\n        float cz = cos(euler.z);\n        float sx = sin(euler.x);\n        float sy = sin(euler.y);\n        float sz = sin(euler.z);\n\n        mat3 mat;\n        mat[0][0] = cy * cz;\n        mat[0][1] = cy * sz;\n        mat[0][2] = -sy;\n\n        mat[1][0] = sy * sx * cz - cx * sz;\n        mat[1][1] = sy * sx * sz + cx * cz;\n        mat[1][2] = cy * sx;\n\n        mat[2][0] = sy * cx * cz + sx * sz;\n        mat[2][1] = sy * cx * sz - sx * cz;\n        mat[2][2] = cy * cx;\n        return mat;\n    }"), (
    hcode: 2676358373, key: "map_range_linear", val: "float map_range_linear(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = (v-min0)/(max0-min0);\n        return mix(min1, max1, f);\n    }\n    vec3 map_range_linear(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = (v-min0)/(max0-min0);\n        return mix(min1, max1, f);\n    }\n    "),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 3640453103,
    key: "math_smoothmin", val: "float math_smoothmin(float a, float b, float c){\n        if (c != 0.0) {\n            float h = max(c - abs(a - b), 0.0) / c;\n            return min(a, b) - h * h * h * c * (1.0 / 6.0);\n        }\n        else {\n            return min(a, b);\n        }\n    }"),
                         (hcode: 0, key: "", val: ""), (hcode: 913600369,
    key: "blackbody", val: "vec4 blackbody(float T)\n    {\n        float u = ( 0.860117757 + 1.54118254e-4 * T + 1.28641212e-7 * T*T ) / ( 1.0 + 8.42420235e-4 * T + 7.08145163e-7 * T*T );\n        float v = ( 0.317398726 + 4.22806245e-5 * T + 4.20481691e-8 * T*T ) / ( 1.0 - 2.89741816e-5 * T + 1.61456053e-7 * T*T );\n\n        float x = 3.0*u / ( 2.0*u - 8.0*v + 4.0 );\n        float y = 2.0*v / ( 2.0*u - 8.0*v + 4.0 );\n        float z = 1.0 - x - y;\n\n        float Y = 1.0;\n        float X = Y/y * x;\n        float Z = Y/y * z;\n\n        mat3 XYZtoRGB = mat3(\n            3.2404542, -0.9692660,  0.0556434,\n            -1.5371385, 1.8760108, -0.2040259,\n            -0.4985314,  0.0415560, 1.0572252\n        );\n\n        return vec4(( XYZtoRGB * vec3( X, Y, Z ) ), 1.0);\n    }"), (
    hcode: 1364658609, key: "map_range_smooth", val: "float map_range_smooth(float v, float min0, float max0, float min1, float max1, float steps){\n        float f = clamp((v-min0)/(max0-min0), 0.0, 1.0);\n        f = f * f * (3.0 - 2.0 * f);\n        return mix(min1, max1, f);\n    }\n    vec3 map_range_smooth(vec3 v, vec3 min0, vec3 max0, vec3 min1, vec3 max1, vec3 steps){\n        vec3 f = clamp((v-min0)/(max0-min0), 0.0, 1.0);\n        f = f * f * (3.0 - 2.0 * f);\n        return mix(min1, max1, f);\n    }\n    "),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 843453495,
    key: "mix_dodge", val: "vec4 mix_dodge(vec4 a, vec4 b, float fac, out vec4 outc){\n        outc = a;\n\n        if (outc.r != 0.0) {\n            float tmp = 1.0 - fac * b.r;\n            if (tmp <= 0.0)\n                outc.r = 1.0;\n            else if ((tmp = outc.r / tmp) > 1.0)\n                outc.r = 1.0;\n            else\n                outc.r = tmp;\n        }\n        if (outc.g != 0.0) {\n            float tmp = 1.0 - fac * b.g;\n            if (tmp <= 0.0)\n                outc.g = 1.0;\n            else if ((tmp = outc.g / tmp) > 1.0)\n                outc.g = 1.0;\n            else\n                outc.g = tmp;\n        }\n        if (outc.b != 0.0) {\n            float tmp = 1.0 - fac * b.b;\n            if (tmp <= 0.0)\n                outc.b = 1.0;\n            else if ((tmp = outc.b / tmp) > 1.0)\n                outc.b = 1.0;\n            else\n                outc.b = tmp;\n        }\n        return outc;\n    }"),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""),
                         (hcode: 0, key: "", val: ""), (hcode: 3519308734,
    key: "wrap", val: "float wrap(float a, float b, float c){\n        float range = b - c;\n        return (range != 0.0) ? a - (range * floor((a - c) / range)) : c;\n    }"),
                         (hcode: 0, key: "", val: "")], counter: 22)
  Source   Edit