Last active
August 8, 2022 17:00
-
-
Save jonahwilliams/e2dbc01595eaa2ffecd03a787de9da5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 120 | |
#ifdef GL_ARB_shading_language_420pack | |
#extension GL_ARB_shading_language_420pack : require | |
#endif | |
struct FragInfo | |
{ | |
vec2 texture_size; | |
vec2 blur_direction; | |
float blur_sigma; | |
float blur_radius; | |
float src_factor; | |
float inner_blur_factor; | |
float outer_blur_factor; | |
}; | |
uniform FragInfo frag_info; | |
uniform sampler2D texture_sampler; | |
uniform sampler2D alpha_mask_sampler; | |
varying vec2 v_texture_coords; | |
varying vec2 v_src_texture_coords; | |
void main() | |
{ | |
vec2 _103 = frag_info.blur_direction / frag_info.texture_size; | |
float _108 = -frag_info.blur_radius; | |
vec4 _276 = vec4(0.0); | |
float _277 = 0.0; | |
_277 = 0.0; | |
_276 = vec4(0.0); | |
float _124 = 0.0; | |
vec4 _138 = vec4(0.0); | |
for (float _275 = _108; _275 <= frag_info.blur_radius; _277 = _124, _276 = _138, _275 += 1.0) | |
{ | |
float _204 = exp((((-0.5) * _275) * _275) / (frag_info.blur_sigma * frag_info.blur_sigma)) / (2.5066282749176025390625 * frag_info.blur_sigma); | |
_124 = _277 + _204; | |
vec2 _133 = v_texture_coords + (_103 * _275); | |
float _209 = _133.x; | |
bool _210 = _209 > 0.0; | |
bool _216 = false; | |
if (_210) | |
{ | |
_216 = _133.y > 0.0; | |
} | |
else | |
{ | |
_216 = _210; | |
} | |
bool _222 = false; | |
if (_216) | |
{ | |
_222 = _209 < 1.0; | |
} | |
else | |
{ | |
_222 = _216; | |
} | |
bool _228 = false; | |
if (_222) | |
{ | |
_228 = _133.y < 1.0; | |
} | |
else | |
{ | |
_228 = _222; | |
} | |
_138 = _276 + ((texture2D(texture_sampler, _133) * float(_228)) * _204); | |
} | |
bool _240 = v_src_texture_coords.x > 0.0; | |
bool _246 = false; | |
if (_240) | |
{ | |
_246 = v_src_texture_coords.y > 0.0; | |
} | |
else | |
{ | |
_246 = _240; | |
} | |
bool _252 = false; | |
if (_246) | |
{ | |
_252 = v_src_texture_coords.x < 1.0; | |
} | |
else | |
{ | |
_252 = _246; | |
} | |
bool _258 = false; | |
if (_252) | |
{ | |
_258 = v_src_texture_coords.y < 1.0; | |
} | |
else | |
{ | |
_258 = _252; | |
} | |
vec4 _264 = texture2D(alpha_mask_sampler, v_src_texture_coords) * float(_258); | |
float _158 = _264.w; | |
gl_FragData[0] = ((_276 / vec4(_277)) * (frag_info.inner_blur_factor * float(_158 > 0.0) + (frag_info.outer_blur_factor * float(_158 == 0.0)))) + (_264 * frag_info.src_factor); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 120 | |
#ifdef GL_ARB_shading_language_420pack | |
#extension GL_ARB_shading_language_420pack : require | |
#endif | |
uniform sampler2D texture_sampler; | |
uniform sampler2D alpha_mask_sampler; | |
varying float v_blur_sigma; | |
varying vec2 v_blur_direction; | |
varying vec2 v_texture_size; | |
varying float v_blur_radius; | |
varying vec2 v_texture_coords; | |
varying vec2 v_src_texture_coords; | |
varying float v_inner_blur_factor; | |
varying float v_outer_blur_factor; | |
varying float v_src_factor; | |
void main() | |
{ | |
vec2 _94 = v_blur_direction / v_texture_size; | |
float _98 = -v_blur_radius; | |
vec4 _258 = vec4(0.0); | |
float _259 = 0.0; | |
_259 = 0.0; | |
_258 = vec4(0.0); | |
float _113 = 0.0; | |
vec4 _126 = vec4(0.0); | |
for (float _257 = _98; _257 <= v_blur_radius; _259 = _113, _258 = _126, _257 += 1.0) | |
{ | |
float _186 = exp((((-0.5) * _257) * _257) / (v_blur_sigma * v_blur_sigma)) / (2.5066282749176025390625 * v_blur_sigma); | |
_113 = _259 + _186; | |
vec2 _121 = v_texture_coords + (_94 * _257); | |
float _191 = _121.x; | |
bool _192 = _191 > 0.0; | |
bool _198 = false; | |
if (_192) | |
{ | |
_198 = _121.y > 0.0; | |
} | |
else | |
{ | |
_198 = _192; | |
} | |
bool _204 = false; | |
if (_198) | |
{ | |
_204 = _191 < 1.0; | |
} | |
else | |
{ | |
_204 = _198; | |
} | |
bool _210 = false; | |
if (_204) | |
{ | |
_210 = _121.y < 1.0; | |
} | |
else | |
{ | |
_210 = _204; | |
} | |
_126 = _258 + ((texture2D(texture_sampler, _121) * float(_210)) * _186); | |
} | |
bool _222 = v_src_texture_coords.x > 0.0; | |
bool _228 = false; | |
if (_222) | |
{ | |
_228 = v_src_texture_coords.y > 0.0; | |
} | |
else | |
{ | |
_228 = _222; | |
} | |
bool _234 = false; | |
if (_228) | |
{ | |
_234 = v_src_texture_coords.x < 1.0; | |
} | |
else | |
{ | |
_234 = _228; | |
} | |
bool _240 = false; | |
if (_234) | |
{ | |
_240 = v_src_texture_coords.y < 1.0; | |
} | |
else | |
{ | |
_240 = _234; | |
} | |
vec4 _246 = texture2D(alpha_mask_sampler, v_src_texture_coords) * float(_240); | |
float _145 = _246.w; | |
gl_FragData[0] = ((_258 / vec4(_259)) * (v_inner_blur_factor * float(_145 > 0.0) + (v_outer_blur_factor * float(_145 == 0.0)))) + (_246 * v_src_factor); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment