Skip to content

Instantly share code, notes, and snippets.

@jonahwilliams
Last active November 23, 2022 23:26
Show Gist options
  • Save jonahwilliams/5cbd5ecbab479b23527209f6254104de to your computer and use it in GitHub Desktop.
Save jonahwilliams/5cbd5ecbab479b23527209f6254104de to your computer and use it in GitHub Desktop.
#version 120
#ifdef GL_ARB_shading_language_420pack
#extension GL_ARB_shading_language_420pack : require
#endif
struct FragInfo
{
vec2 texture_size;
vec2 direction;
float texture_sampler_y_coord_scale;
float radius;
};
uniform FragInfo frag_info;
uniform sampler2D texture_sampler;
varying vec2 v_texture_coords;
void main()
{
vec2 _99 = frag_info.direction / frag_info.texture_size;
float _105 = -frag_info.radius;
vec4 _213 = vec4(0.0);
_213 = vec4(1.0);
vec4 _134 = vec4(0.0);
for (float _212 = _105; _212 <= frag_info.radius; _213 = _134, _212 += 1.0)
{
vec2 _122 = v_texture_coords + (_99 * _212);
vec4 _215 = vec4(0.0);
do
{
float _162 = _122.x;
bool _163 = _162 < 0.0;
bool _170 = false;
if (!_163)
{
_170 = _162 >= 1.0;
}
else
{
_170 = _163;
}
bool _184 = false;
if (!_170)
{
float _174 = _122.y;
bool _175 = _174 < 0.0;
bool _182 = false;
if (!_175)
{
_182 = _174 >= 1.0;
}
else
{
_182 = _175;
}
_184 = _182;
}
else
{
_184 = _170;
}
if (_184)
{
_215 = vec4(0.0);
break;
}
vec2 _214 = vec2(0.0);
if (frag_info.texture_sampler_y_coord_scale < 0.0)
{
vec2 _211 = _122;
_211.y = 1.0 - _122.y;
_214 = _211;
}
else
{
_214 = _122;
}
_215 = texture2D(texture_sampler, _214);
break;
} while(false);
_134 = min(_215, _213);
}
gl_FragData[0] = _213;
}
#version 120
#ifdef GL_ARB_shading_language_420pack
#extension GL_ARB_shading_language_420pack : require
#endif
struct FragInfo
{
vec2 texture_size;
vec2 direction;
float texture_sampler_y_coord_scale;
float radius;
};
uniform FragInfo frag_info;
uniform sampler2D texture_sampler;
varying vec2 v_texture_coords;
void main()
{
vec2 _87 = frag_info.direction / frag_info.texture_size;
float _93 = -frag_info.radius;
vec4 _184 = vec4(0.0);
_184 = vec4(1.0);
vec4 _122 = vec4(0.0);
for (float _183 = _93; _183 <= frag_info.radius; _184 = _122, _183 += 1.0)
{
vec2 _110 = v_texture_coords + (_87 * _183);
vec4 _186 = vec4(0.0);
do
{
bool _152 = any(lessThan(_110, vec2(0.0)));
bool _159 = false;
if (!_152)
{
_159 = any(greaterThanEqual(_110, vec2(1.0)));
}
else
{
_159 = _152;
}
if (_159)
{
_186 = vec4(0.0);
break;
}
vec2 _185 = vec2(0.0);
if (frag_info.texture_sampler_y_coord_scale < 0.0)
{
vec2 _182 = _110;
_182.y = 1.0 - _110.y;
_185 = _182;
}
else
{
_185 = _110;
}
_186 = texture2D(texture_sampler, _185);
break;
} while(false);
_122 = min(_186, _184);
}
gl_FragData[0] = _184;
}
#version 120
#ifdef GL_ARB_shading_language_420pack
#extension GL_ARB_shading_language_420pack : require
#endif
struct FragInfo
{
vec2 texture_size;
vec2 direction;
float texture_sampler_y_coord_scale;
float radius;
};
uniform FragInfo frag_info;
uniform sampler2D texture_sampler;
varying vec2 v_texture_coords;
void main()
{
vec2 _199 = frag_info.direction / frag_info.texture_size;
float _205 = -frag_info.radius;
vec4 _424 = vec4(0.0);
_424 = vec4(1.0);
vec4 _235 = vec4(0.0);
for (float _423 = _205; _423 <= frag_info.radius; _424 = _235, _423 += 1.0)
{
vec2 _222 = v_texture_coords + (_199 * _423);
vec4 _432 = vec4(0.0);
do
{
float _278 = _222.x;
bool _279 = _278 < 0.0;
bool _286 = false;
if (!_279)
{
_286 = _278 >= 1.0;
}
else
{
_286 = _279;
}
bool _307 = false;
if (!_286)
{
float _295 = _222.y;
bool _296 = _295 < 0.0;
bool _303 = false;
if (!_296)
{
_303 = _295 >= 1.0;
}
else
{
_303 = _296;
}
_307 = _303;
}
else
{
_307 = _286;
}
if (_307)
{
_432 = vec4(0.0);
break;
}
vec2 _431 = vec2(0.0);
if (frag_info.texture_sampler_y_coord_scale < 0.0)
{
vec2 _422 = _222;
_422.y = 1.0 - _222.y;
_431 = _422;
}
else
{
_431 = _222;
}
_432 = texture2D(texture_sampler, _431);
break;
} while(false);
_235 = min(_432, _424);
}
gl_FragData[0] = _424;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment