Created
March 9, 2023 23:09
-
-
Save jonahwilliams/d1cedcb86ffdc091feb8a51b51d4a6bb 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
struct FragInfo | |
{ | |
vec2 start_point; | |
vec2 end_point; | |
float tile_mode; | |
float texture_sampler_y_coord_scale; | |
float alpha; | |
vec2 half_texel; | |
}; | |
uniform FragInfo frag_info; | |
uniform sampler2D texture_sampler; | |
varying vec2 v_position; | |
void main() | |
{ | |
vec2 _234 = frag_info.end_point - frag_info.start_point; | |
float _249 = dot(v_position - frag_info.start_point, _234) / dot(_234, _234); | |
vec4 _518 = vec4(0.0); | |
do | |
{ | |
bool _327 = frag_info.tile_mode == 3.0; | |
bool _340 = false; | |
if (_327) | |
{ | |
bool _331 = _249 < 0.0; | |
bool _338 = false; | |
if (!_331) | |
{ | |
_338 = _249 >= 1.0; | |
} | |
else | |
{ | |
_338 = _331; | |
} | |
_340 = _338; | |
} | |
else | |
{ | |
_340 = _327; | |
} | |
bool _359 = false; | |
if (!_340) | |
{ | |
_359 = _327 ? false : _327; | |
} | |
else | |
{ | |
_359 = _340; | |
} | |
if (_359) | |
{ | |
_518 = vec4(0.0); | |
break; | |
} | |
bool _391 = frag_info.tile_mode == 0.0; | |
float _511 = 0.0; | |
if (_391) | |
{ | |
_511 = clamp(_249, 0.0, 1.0); | |
} | |
else | |
{ | |
float _512 = 0.0; | |
if (frag_info.tile_mode == 1.0) | |
{ | |
_512 = fract(_249); | |
} | |
else | |
{ | |
float _513 = 0.0; | |
if (frag_info.tile_mode == 2.0) | |
{ | |
float _406 = _249 - 1.0; | |
_513 = abs(((-2.0) * floor(_406 * 0.5) + _406) - 1.0); | |
} | |
else | |
{ | |
_513 = _249; | |
} | |
_512 = _513; | |
} | |
_511 = _512; | |
} | |
float _514 = 0.0; | |
if (_391) | |
{ | |
_514 = 0.5; | |
} | |
else | |
{ | |
float _515 = 0.0; | |
if (frag_info.tile_mode == 1.0) | |
{ | |
_515 = fract(0.5); | |
} | |
else | |
{ | |
float _516 = 0.0; | |
if (frag_info.tile_mode == 2.0) | |
{ | |
_516 = abs(((-2.0) * floor(-0.25) + (-0.5)) - 1.0); | |
} | |
else | |
{ | |
_516 = 0.5; | |
} | |
_515 = _516; | |
} | |
_514 = _515; | |
} | |
float _474 = mix(frag_info.half_texel.y, 1.0 - frag_info.half_texel.y, _514); | |
vec2 _525 = vec2(mix(frag_info.half_texel.x, 1.0 - frag_info.half_texel.x, _511), _474); | |
vec2 _517 = vec2(0.0); | |
if (frag_info.texture_sampler_y_coord_scale < 0.0) | |
{ | |
vec2 _510 = _525; | |
_510.y = 1.0 - _474; | |
_517 = _510; | |
} | |
else | |
{ | |
_517 = _525; | |
} | |
_518 = texture2D(texture_sampler, _517); | |
break; | |
} while(false); | |
gl_FragData[0] = _518; | |
gl_FragData[0] = vec4(gl_FragData[0].xyz * gl_FragData[0].w, gl_FragData[0].w) * frag_info.alpha; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment