From 5ffee2c817e2953ce3a5c219ba4f3f87260436a6 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 2 Apr 2023 20:46:33 +0200 Subject: [PATCH] :sparkles: Apply clang-format --- resources/shaders/portal.frag | 19 ++++++++++--------- resources/shaders/trex.frag | 11 ++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/resources/shaders/portal.frag b/resources/shaders/portal.frag index 82e502e..e716d7c 100644 --- a/resources/shaders/portal.frag +++ b/resources/shaders/portal.frag @@ -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); diff --git a/resources/shaders/trex.frag b/resources/shaders/trex.frag index 5ef8587..00e9ea0 100644 --- a/resources/shaders/trex.frag +++ b/resources/shaders/trex.frag @@ -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);