39 lines
1004 B
GLSL
39 lines
1004 B
GLSL
#version 330 core
|
|
out vec4 FragColor;
|
|
|
|
in vec2 TexCoords;
|
|
|
|
uniform float rounding = 0.0f;
|
|
|
|
uniform vec2 screenSize;
|
|
uniform vec2 normalizedCenterPos;
|
|
uniform vec2 normalizedCenterScale;
|
|
uniform vec2 pixelScale;
|
|
uniform vec2 pixelPos;
|
|
|
|
uniform vec4 Color = {0.0f,0.0f,0.0f,1.0f};
|
|
|
|
uniform sampler2D tex;
|
|
|
|
void main()
|
|
{
|
|
FragColor = Color * texture(tex,TexCoords);
|
|
|
|
|
|
float rounding = clamp(rounding,0.0f,1.0f);
|
|
if (rounding != 0.0f) {
|
|
float roundingfactor = min(pixelScale.x,pixelScale.y)/2 * rounding;
|
|
vec2 r1 = pixelScale/2 - vec2(roundingfactor);
|
|
vec2 fragPosTopLeft = vec2(gl_FragCoord.x, screenSize.y - gl_FragCoord.y);
|
|
vec2 absrelcoord = abs(fragPosTopLeft - pixelScale/2 - pixelPos);
|
|
|
|
if (!(absrelcoord.x < r1.x || absrelcoord.y < r1.y)) {
|
|
vec2 cornerOffset = absrelcoord - r1;
|
|
if (dot(cornerOffset, cornerOffset) > roundingfactor * roundingfactor) {
|
|
discard;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|