Make squareness factor square 79/320979/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 26 Nov 2024 08:25:48 +0000 (17:25 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 26 Nov 2024 08:25:48 +0000 (17:25 +0900)
From Fernandez Guasti (1992) paper use squared factor as squircle.
Let we follow it.

Change-Id: Icbd6cb18f7dd0b243bc38d069d1e1c47016a5a7b
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-toolkit/internal/graphics/shaders/color-visual-shader.frag
dali-toolkit/internal/graphics/shaders/gradient-visual-shader.frag
dali-toolkit/internal/graphics/shaders/image-visual-shader.frag
dali-toolkit/internal/graphics/shaders/render-effect.frag

index 044494beae60f88c51f843e401fa0f7a5932efff..86967302c1641cb1959d66bd6eb57d85f292bd04 100644 (file)
@@ -134,7 +134,7 @@ void calculatePotential()
   gPotential = sqrt(((positiveDiff.x + positiveDiff.y)
                      + sqrt(positiveDiff.x * positiveDiff.x
                             + positiveDiff.y * positiveDiff.y
-                            + (2.0 - 4.0 * gSquareness) * positiveDiff.x * positiveDiff.y))
+                            + (2.0 - 4.0 * gSquareness * gSquareness) * positiveDiff.x * positiveDiff.y))
                     * 0.5)
                + min(0.0, max(gDiff.x, gDiff.y)); ///< Consider negative potential, to support borderline
 #else
index 561ce4e2e26d605fe18240fb5ef01d592a869bba..90afff5a2a4167fd5b462e5415e061983ff43052 100644 (file)
@@ -123,7 +123,7 @@ void calculatePotential()
   gPotential = sqrt(((positiveDiff.x + positiveDiff.y)
                      + sqrt(positiveDiff.x * positiveDiff.x
                             + positiveDiff.y * positiveDiff.y
-                            + (2.0 - 4.0 * gSquareness) * positiveDiff.x * positiveDiff.y))
+                            + (2.0 - 4.0 * gSquareness * gSquareness) * positiveDiff.x * positiveDiff.y))
                     * 0.5)
                + min(0.0, max(gDiff.x, gDiff.y)); ///< Consider negative potential, to support borderline
 #else
index 1a8198c17c418b50172e559d9238087750b28018..795ff7078d10cbdcc78ad46816923a80fe987970 100644 (file)
@@ -166,7 +166,7 @@ void calculatePotential()
   gPotential = sqrt(((positiveDiff.x + positiveDiff.y)
                      + sqrt(positiveDiff.x * positiveDiff.x
                             + positiveDiff.y * positiveDiff.y
-                            + (2.0 - 4.0 * gSquareness) * positiveDiff.x * positiveDiff.y))
+                            + (2.0 - 4.0 * gSquareness * gSquareness) * positiveDiff.x * positiveDiff.y))
                     * 0.5)
                + min(0.0, max(gDiff.x, gDiff.y)); ///< Consider negative potential, to support borderline
 #else
index 4bf0d811e3fc70b6cd293bc0825563fa7fb09a47..bbe99fe56f35e2550644f535f46b78dddd430239 100644 (file)
@@ -59,7 +59,7 @@ float roundedBoxSDF(vec2 pixelPositionFromCenter, vec2 rectangleEdgePositionFrom
   return sqrt(((positiveDiff.x + positiveDiff.y)
                + sqrt(positiveDiff.x * positiveDiff.x
                       + positiveDiff.y * positiveDiff.y
-                      + (2.0 - 4.0 * squareness) * positiveDiff.x * positiveDiff.y))
+                      + (2.0 - 4.0 * squareness * gSquareness) * positiveDiff.x * positiveDiff.y))
               * 0.5)
          + min(0.0, max(diff.x, diff.y)) ///< Consider negative potential, to avoid visual defect when radius is zero
          - radius;