✨ Apply clang-format

This commit is contained in:
Simon Schneegans
2023-04-02 20:46:33 +02:00
parent 5aad16c8bf
commit 5ffee2c817
2 changed files with 16 additions and 14 deletions
+10 -9
View File
@@ -38,10 +38,11 @@ float WINDOW_OPEN_TIME = 0.35;
// or disappears (which is controlled by WINDOW_OPEN_TIME) and takes
// PORTAL_WOBBLE_TIME.
vec2 getPortalWobble(vec2 coords) {
float progress = (uForOpening ? (1.0 - uProgress) : uProgress) / WINDOW_OPEN_TIME * uDuration;
progress = clamp(1.0 - abs((progress - 1.0) / PORTAL_WOBBLE_TIME), 0.0, 1.0);
progress = easeInBack(progress, 1.7);
float dist = length(coords);
float progress =
(uForOpening ? (1.0 - uProgress) : uProgress) / WINDOW_OPEN_TIME * uDuration;
progress = clamp(1.0 - abs((progress - 1.0) / PORTAL_WOBBLE_TIME), 0.0, 1.0);
progress = easeInBack(progress, 1.7);
float dist = length(coords);
return coords * (1.0 - dist) * exp(-dist) * progress * PORTAL_WOBBLE_STRENGTH;
}
@@ -50,14 +51,13 @@ vec2 getPortalWobble(vec2 coords) {
// increase during uDuration*PORTAL_OPEN_TIME, stay at one until uDuration*(1.0 -
// PORTAL_CLOSE_TIME) and then decrease again.
float getPortalScale() {
float scale = 1.0;
float scale = 1.0;
float closeTime = PORTAL_CLOSE_TIME / uDuration;
float openTime = PORTAL_OPEN_TIME / uDuration;
float openTime = PORTAL_OPEN_TIME / uDuration;
if (uProgress < openTime) {
scale = easeOutBack(uProgress / openTime, 1.5);
} else if (uProgress > 1.0 - closeTime) {
scale =
easeOutBack(1.0 - (uProgress - 1.0 + closeTime) / closeTime, 1.5);
scale = easeOutBack(1.0 - (uProgress - 1.0 + closeTime) / closeTime, 1.5);
}
return scale;
@@ -167,7 +167,8 @@ vec4 getPortalColor() {
// window). The fraction of the animation time take for the window animation is defined by
// WINDOW_OPEN_TIME.
vec4 getWindowColor() {
float progress = (uForOpening ? (1.0 - uProgress) : uProgress) / WINDOW_OPEN_TIME * uDuration;
float progress =
(uForOpening ? (1.0 - uProgress) : uProgress) / WINDOW_OPEN_TIME * uDuration;
// Add some elastic easing to make the effect more dynamic.
progress = easeInBack(clamp(progress, 0.0, 1.0), 1.2);
+6 -5
View File
@@ -92,12 +92,13 @@ void main() {
}
// Get the window texture. We shift the texture lookup by the local derivative of
// the claw texture in order to mimic some folding distortion. This is only possible if not using GLES.
// the claw texture in order to mimic some folding distortion. This is only possible if
// not using GLES.
vec2 offset = vec2(0.0);
#ifndef GL_ES
offset = vec2(dFdx(scratchMap), dFdy(scratchMap)) * progress * 0.5;
#endif
#ifndef GL_ES
offset = vec2(dFdx(scratchMap), dFdy(scratchMap)) * progress * 0.5;
#endif
vec4 oColor = getInputColor(coords + offset);