/** * QUIK: User Interface Kit * Copyright (C) 2023 Halit Utku Maden, et al. */ #version 120 varying vec2 fv2TexPos; varying vec4 fv4Color; uniform int iEnableSdf; uniform int iEnableTexture; uniform int iAlphaDiscard; uniform float fSdfThreshold; uniform sampler2D txTexture; void main(void) { vec4 albedo = fv4Color; if (iEnableTexture != 0) { vec4 value = texture2D(txTexture, fv2TexPos); if (iEnableSdf != 0) { float a = max(value.r, value.a); value = (a >= fSdfThreshold) ? vec4(1,1,1,1) : vec4(0,0,0,0); } if (iAlphaDiscard != 0 && value.a == 0.0) { discard; } albedo = albedo * value; } gl_FragColor = albedo; }