Skip to content

Instantly share code, notes, and snippets.

@doorbash
Created June 15, 2019 08:22
Show Gist options
  • Save doorbash/29c11812c0b24d23b77f1d1e246a176c to your computer and use it in GitHub Desktop.
Save doorbash/29c11812c0b24d23b77f1d1e246a176c to your computer and use it in GitHub Desktop.
varying mediump vec2 var_texcoord0;
uniform lowp sampler2D texture_sampler;
void main() {
float x = var_texcoord0.x - 0.5;
float y = var_texcoord0.y - 0.5;
int angle = 20;
float rad = radians(90 - angle);
if(angle == 0) {
} else if(angle > 0 && y > 0 && x > 0) {
if(angle >= 90 || tan(rad) < (y / x)) {
gl_FragColor = texture2D(texture_sampler, var_texcoord0.xy);
}
} else if(angle > 90 && x > 0 && y < 0) {
if(angle >= 180 || tan(rad) < (y / x)) {
gl_FragColor = texture2D(texture_sampler, var_texcoord0.xy);
}
} else if(angle > 180 && x < 0 && y < 0) {
if(angle >= 270 || tan(rad) < (y / x)) {
gl_FragColor = texture2D(texture_sampler, var_texcoord0.xy);
}
} else if(angle > 270 && x < 0 && y > 0) {
if(angle == 360 || tan(rad) < (y / x)) {
gl_FragColor = texture2D(texture_sampler, var_texcoord0.xy);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment