🔧 Use new global methods for shader I/O

This commit is contained in:
Simon Schneegans
2022-06-10 07:20:21 +02:00
parent 25f2261ad6
commit 0bd0fb27b9
11 changed files with 43 additions and 77 deletions
+6 -11
View File
@@ -79,22 +79,15 @@ void main() {
vec2 texScale = 0.1 * uSize / uScale;
vec4 hex = getHexagons(iTexCoord.st * texScale);
if (tileProgress > hex.z) {
vec4 oColor = vec4(0.0);
// Crop outer parts of the shrinking tiles.
oColor.a = 0.0;
} else {
// Crop outer parts of the shrinking tiles.
if (tileProgress < hex.z) {
// Make the tiles shrink by offsetting the texture lookup towards the edge
// of the cell.
vec2 lookupOffset = tileProgress * hex.xy / texScale / (1.0 - tileProgress);
oColor = texture2D(uTexture, iTexCoord.st + lookupOffset);
// Shell.GLSLEffect uses straight alpha. So we have to convert from premultiplied.
if (oColor.a > 0) {
oColor.rgb /= oColor.a;
}
oColor = getInputColor(iTexCoord.st + lookupOffset);
vec4 glow = uGlowColor;
vec4 line = uLineColor;
@@ -122,4 +115,6 @@ void main() {
oColor.rgb = mix(oColor.rgb, line.rgb, line.a);
}
}
setOutputColor(oColor);
}