🔧 Use vec2 for size uniform

This commit is contained in:
Simon Schneegans
2022-05-11 05:33:25 +02:00
parent afaeebd0ab
commit 1347fc4d11
11 changed files with 21 additions and 24 deletions
+3 -3
View File
@@ -224,7 +224,7 @@ if (utils.isInShellProcess()) {
// This returns a flickering grid of random letters.
float getText(vec2 fragCoord) {
vec2 pixelCoords = fragCoord * vec2(uSizeX, uSizeY);
vec2 pixelCoords = fragCoord * uSize;
vec2 uv = mod(pixelCoords.xy, uLetterSize)/uLetterSize;
vec2 block = pixelCoords/uLetterSize - uv;
@@ -239,7 +239,7 @@ if (utils.isInShellProcess()) {
// to one below each drop and to zero above it. This second value is used for fading
// the window texture.
vec2 getRain(vec2 fragCoord) {
float column = cogl_tex_coord_in[0].x * uSizeX;
float column = cogl_tex_coord_in[0].x * uSize.x;
column -= mod(column, uLetterSize);
float delay = fract(sin(column)*78.233) * mix(0.0, 1.0, uRandomness);
@@ -248,7 +248,7 @@ if (utils.isInShellProcess()) {
float distToDrop = (uProgress*2-delay)*speed - cogl_tex_coord_in[0].y;
float rainAlpha = distToDrop >= 0 ? exp(-distToDrop/TRAIL_LENGTH) : 0;
float windowAlpha = 1 - clamp(uSizeY*distToDrop, 0, FADE_WIDTH) / FADE_WIDTH;
float windowAlpha = 1 - clamp(uSize.y*distToDrop, 0, FADE_WIDTH) / FADE_WIDTH;
// Fade at window borders.
rainAlpha *= getAbsoluteEdgeMask(EDGE_FADE);