allow transparency & little cleanup

This commit is contained in:
jrkb 2023-04-13 12:53:36 +02:00
parent 8b7cb20503
commit 26ca2bdf43
2 changed files with 2 additions and 29 deletions

View file

@ -108,17 +108,6 @@ vec2 rotate(vec2 v) {
} }
void main() { void main() {
//vec4 debug = texture(curves, vec2(uv.x, 0.5));
//ivec4 debug = texelFetch(glyphs, ivec2(uv.x * float(textureSize(glyphs, 0).x), 0), 0);
//result = vec4(debug.rgb, 1.0);
//Glyph gly = loadGlyph(bufferIndex);
//result = vec4((float(gly.start) / 1883.0), (float(gly.count) / 42.0), 0.0, 1.0);
// verify bufferIndex [x]
//result = vec4((float(bufferIndex) / 100.0), 0.0, 0.0, 1.0);
//return;
float alpha = 0.0; float alpha = 0.0;
// Inverse of the diameter of a pixel in uv units for anti-aliasing. // Inverse of the diameter of a pixel in uv units for anti-aliasing.
@ -137,25 +126,13 @@ void main() {
alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2)); alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2));
} }
} }
// DEBUG
//if (uv.x > 0.5) {
//ivec2 ts = textureSize(curves,0);
//float w = float(ts.x);
//float h = float(ts.y);
////float green = (float(glyph.count) / 27.0);
//float green = float(w) / (3.0 * 27.0);
//result = vec4(0.0,h * 0.5,0.0,1.0);
//} else {
//result = vec4(0.0,0.5,0.0,1.0);
//}
//return;
if (enableSuperSamplingAntiAliasing) { if (enableSuperSamplingAntiAliasing) {
alpha *= 0.5; alpha *= 0.5;
} }
alpha = clamp(alpha, 0.0, 1.0); alpha = clamp(alpha, 0.0, 1.0);
result = color * alpha; result = vec4(color.rgb, color.a * alpha);
if (enableControlPointsVisualization) { if (enableControlPointsVisualization) {
// Visualize control points. // Visualize control points.

View file

@ -124,17 +124,13 @@ void main() {
alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2)); alpha += computeCoverage(inverseDiameter.y, rotate(p0), rotate(p1), rotate(p2));
} }
} }
//vec4 debug = texelFetch(glyphs, int(uv.x * textureSize(glyphs)));
//result = vec4(debug.rgb, 1.0);
//return;
if (enableSuperSamplingAntiAliasing) { if (enableSuperSamplingAntiAliasing) {
alpha *= 0.5; alpha *= 0.5;
} }
alpha = clamp(alpha, 0.0, 1.0); alpha = clamp(alpha, 0.0, 1.0);
result = color * alpha; result = vec4(color.rgb, color.a * alpha);
if (enableControlPointsVisualization) { if (enableControlPointsVisualization) {
// Visualize control points. // Visualize control points.