🔧 Use uDuration instead of uTime

This commit is contained in:
Simon Schneegans
2022-06-10 07:30:44 +02:00
parent 0bd0fb27b9
commit 46a1729e54
9 changed files with 30 additions and 26 deletions
+4 -2
View File
@@ -22,7 +22,7 @@
// vec2 iTexCoord: Texture coordinates for retrieving the window input color.
// bool uForOpening: True if a window-open animation is ongoing, false otherwise.
// float uProgress: A value which transitions from 0 to 1 during the animation.
// float uTime: A steadily increasing value in seconds.
// float uDuration: The duration of the current animation in seconds.
// vec2 uSize: The size of uTexture in pixels.
// float uPadding: The empty area around the actual window (e.g. where the shadow
// is drawn). For now, this will only be set on GNOME.
@@ -37,6 +37,7 @@
uniform float forOpening;
uniform sampler2D sampler;
uniform float uDuration;
uniform float textureWidth;
uniform float textureHeight;
uniform float animationProgress;
@@ -69,6 +70,7 @@ void setOutputColor(vec4 outColor) {
uniform float forOpening;
uniform sampler2D sampler;
uniform float uDuration;
uniform float textureWidth;
uniform float textureHeight;
uniform float animationProgress;
@@ -102,7 +104,7 @@ void setOutputColor(vec4 outColor) {
uniform bool uForOpening;
uniform sampler2D uTexture;
uniform float uProgress;
uniform float uTime;
uniform float uDuration;
uniform vec2 uSize;
uniform float uPadding;
+3 -3
View File
@@ -70,14 +70,14 @@ void main() {
scaledUV /= uScale;
// Add molecule particles.
vec2 uv = scaledUV + vec2(0, 0.1 * uTime);
vec2 uv = scaledUV + vec2(0, 0.1 * uProgress * uDuration);
uv *= 0.010598 * vec2(0.5 * uSize.x, uSize.y);
float particles = 0.2 * pow((simplex3D(vec3(uv, 0.0 * uTime))), 3.0);
float particles = 0.2 * pow((simplex3D(vec3(uv, 0.0 * uProgress * uDuration))), 3.0);
// Add more molecule particles.
for (int i = 1; i <= 3; ++i) {
vec2 uv = scaledUV * 0.12154 / pow(1.5, i) * uSize;
float atoms = simplex3D(vec3(uv, 2.0 * uTime / i));
float atoms = simplex3D(vec3(uv, 2.0 * uProgress * uDuration / i));
particles += 0.5 * pow(0.2 * (1.0 / (1.0 - atoms) - 1.0), 2);
}
+1 -1
View File
@@ -100,7 +100,7 @@ void main() {
// Add glimmering atoms.
vec2 atomUV = iTexCoord.st + vec2(0, -0.025 * progress / SHOWER_TIME);
atomUV *= 0.2 * uSize / uScale;
float atoms = pow((simplex3D(vec3(atomUV, uTime))), 5.0);
float atoms = pow((simplex3D(vec3(atomUV, uProgress * uDuration))), 5.0);
oColor.rgb += uColor * atoms * masks.z;
oColor.a += atoms * masks.z;
+5 -3
View File
@@ -90,10 +90,12 @@ vec2 effectMask(float hideTime, float fadeWidth, float edgeFadeWidth) {
void main() {
// Get a noise value which moves vertically in time.
vec2 uv = iTexCoord.st * uSize / vec2(400, 600) / uScale;
uv.y += uTime * uMovementSpeed;
uv.y += uProgress * uDuration * uMovementSpeed;
float noise = u3DNoise ? simplex3DFractal(vec3(uv * 4.0, uTime * uMovementSpeed * 1.5))
: simplex2DFractal(uv * 4.0);
float noise =
u3DNoise
? simplex3DFractal(vec3(uv * 4.0, uProgress * uDuration * uMovementSpeed * 1.5))
: simplex2DFractal(uv * 4.0);
// Modulate noise by effect mask.
vec2 effectMask = effectMask(HIDE_TIME, FADE_WIDTH, EDGE_FADE);
+1 -1
View File
@@ -36,7 +36,7 @@ float getText(vec2 fragCoord) {
// Choose random letter.
uv += floor(hash22(floor(hash22(block) * vec2(12.9898, 78.233) +
LETTER_FLICKER_SPEED * uTime + 42.254)) *
LETTER_FLICKER_SPEED * uProgress * uDuration + 42.254)) *
LETTER_TILES);
return texture2D(uFontTexture, uv / LETTER_TILES).r;
+2 -1
View File
@@ -47,7 +47,8 @@ float getWisps(vec2 texCoords, float gridSize, vec2 seed) {
float radius = mix(0.5, 1.0, hash12(cellID * seed * 19.1249)) * WISPS_RADIUS;
float roundness = mix(-1.0, 1.0, hash12(cellID * seed * 7.51949));
vec2 offset = vec2(sin(speed * (uTime + 1)) * roundness, cos(speed * (uTime + 1)));
vec2 offset = vec2(sin(speed * (uProgress * uDuration + 1)) * roundness,
cos(speed * (uProgress * uDuration + 1)));
offset *= 0.5 - 0.5 * radius / gridSize;
offset = vec2(offset.x * cos(rotation) - offset.y * sin(rotation),
offset.x * sin(rotation) + offset.y * cos(rotation));