1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-15 07:35:20 -04:00
This commit is contained in:
purian23
2026-06-12 10:40:18 -04:00
parent 92569d8b4d
commit 8d94117a69
16 changed files with 13 additions and 173 deletions
+1 -14
View File
@@ -1,11 +1,6 @@
#version 450
// Connected Frame Mode silhouette as a signed-distance field: the frame ring
// (an inverted rounded rectangle) smooth-unioned with each active chrome
// (popout/modal, dock, notification). The smooth-min radius IS the connector
// fillet. Antialiasing is analytic via fwidth -> crisp at any scale, no FBO.
// The elevation shadow samples the same field at the light offset, so both
// elevation states render in this one pass.
// Connected frame silhouette: frame ring + chrome bodies as one SDF with elevation shadow.
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
@@ -53,7 +48,6 @@ float sdRoundBox(vec2 p, vec2 c, vec2 hs, float r) {
return min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0))) - r;
}
// Per-corner rounded box. r = (topLeft, topRight, bottomRight, bottomLeft).
float sdRoundBox4(vec2 p, vec2 c, vec2 hs, vec4 r) {
p -= c;
float rr = (p.x >= 0.0) ? (p.y >= 0.0 ? r.z : r.y) : (p.y >= 0.0 ? r.w : r.x);
@@ -62,7 +56,6 @@ float sdRoundBox4(vec2 p, vec2 c, vec2 hs, vec4 r) {
return min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0))) - rr;
}
// Circular smooth-min: blends two SDFs with a fillet of radius k.
float smin(float a, float b, float k) {
if (k <= 0.0)
return min(a, b);
@@ -74,14 +67,12 @@ float chromeDist(vec2 px, vec4 rect, vec4 corner) {
return sdRoundBox4(px, c, rect.zw * 0.5, corner);
}
// Per-corner junction fillet radius, selected by chrome-rect quadrant.
float chromeK(vec2 px, vec4 rect, vec4 ks) {
vec2 p = px - (rect.xy + rect.zw * 0.5);
return (p.x >= 0.0) ? (p.y >= 0.0 ? ks.z : ks.y) : (p.y >= 0.0 ? ks.w : ks.x);
}
float sceneDist(vec2 px) {
// Frame ring: inside the screen rect AND outside the rounded cutout (hole).
vec2 sc = vec2(ubuf.widthPx, ubuf.heightPx) * 0.5;
float dOuter = sdBox(px, sc, sc);
vec2 cutC = vec2((ubuf.cutout.x + ubuf.cutout.z) * 0.5, (ubuf.cutout.y + ubuf.cutout.w) * 0.5);
@@ -89,7 +80,6 @@ float sceneDist(vec2 px) {
float dCut = sdRoundBox(px, cutC, cutH, ubuf.cutoutRadius);
float d = max(dOuter, -dCut);
// Smooth-union the active chrome surfaces; smin radius = junction fillet.
if (ubuf.chromeParam0.x > 0.5)
d = smin(d, chromeDist(px, ubuf.chromeRect0, ubuf.chromeCorner0), chromeK(px, ubuf.chromeRect0, ubuf.chromeK0));
if (ubuf.chromeParam1.x > 0.5)
@@ -106,14 +96,11 @@ void main() {
float d = sceneDist(px);
float fw = max(fwidth(d), 1e-4);
float cov = 1.0 - smoothstep(-fw, fw, d);
// Opaque silhouette over shadow, then the surface alpha applied to the
// whole result — matches the old flattened-FBO + group-opacity look.
vec4 col = vec4(ubuf.surfaceColor.rgb, 1.0) * cov;
if (ubuf.shadowColor.a > 0.0) {
float dk = sceneDist(px - ubuf.shadowParam.zw) - ubuf.shadowParam.y;
float bk = max(ubuf.shadowParam.x, fw);
float covK = 1.0 - smoothstep(-bk, bk, dk);
// Ambient wrap reuses the field already computed for the silhouette.
float ba = max(ubuf.ambientParam.x, fw);
float covA = 1.0 - smoothstep(-ba, ba, d - ubuf.ambientParam.y);
float sh = 1.0 - (1.0 - covK * ubuf.shadowColor.a) * (1.0 - covA * ubuf.ambientParam.z);
@@ -1,9 +1,6 @@
#version 450
// Popout-local connected chrome as a signed-distance field: the body rounded
// rect smooth-unioned against the bar-edge half-plane, so the connector
// fillets form analytically. Key + ambient shadows sample the same field;
// shadow is masked outside the silhouette.
// Popout-local connected chrome body + bar-edge connector as one SDF.
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
@@ -22,7 +19,6 @@ layout(std140, binding = 0) uniform buf {
vec4 edgeParam; // x = bar side (0 top, 1 bottom, 2 left, 3 right), y = fillet k
} ubuf;
// Per-corner rounded box. r = (topLeft, topRight, bottomRight, bottomLeft).
float sdRoundBox4(vec2 p, vec2 c, vec2 hs, vec4 r) {
p -= c;
float rr = (p.x >= 0.0) ? (p.y >= 0.0 ? r.z : r.y) : (p.y >= 0.0 ? r.w : r.x);
@@ -31,7 +27,6 @@ float sdRoundBox4(vec2 p, vec2 c, vec2 hs, vec4 r) {
return min(max(q.x, q.y), 0.0) + length(max(q, vec2(0.0))) - rr;
}
// Circular smooth-min: blends two SDFs with a fillet of radius k.
float smin(float a, float b, float k) {
if (k <= 0.0)
return min(a, b);
@@ -39,8 +34,6 @@ float smin(float a, float b, float k) {
}
float sceneDist(vec2 px) {
// Bar edge as a half-plane whose interior lies off-item, on the bar's
// side; only its fillet contribution is visible.
float side = ubuf.edgeParam.x;
float dEdge = side < 0.5 ? px.y
: side < 1.5 ? (ubuf.heightPx - px.y)
+1 -7
View File
@@ -1,10 +1,6 @@
#version 450
// Standalone elevation surface as a signed-distance field: one quad draws the
// rounded-rect fill, its border, and the M3 two-part shadow (directional key +
// non-directional ambient) analytically — no FBO, no blur passes. The shadow
// is masked to outside the silhouette, so translucent fills never get
// interior darkening.
// Standalone rounded rect with border and M3 elevation shadow as one SDF.
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
@@ -24,7 +20,6 @@ layout(std140, binding = 0) uniform buf {
vec4 ambientParam; // ambient: x = blur px, y = spread px, z = alpha
} ubuf;
// Per-corner rounded box. r = (topLeft, topRight, bottomRight, bottomLeft).
float sdRoundBox4(vec2 p, vec2 c, vec2 hs, vec4 r) {
p -= c;
float rr = (p.x >= 0.0) ? (p.y >= 0.0 ? r.z : r.y) : (p.y >= 0.0 ? r.w : r.x);
@@ -43,7 +38,6 @@ void main() {
float d = rectDist(px);
float fw = max(fwidth(d), 1e-4);
float cov = 1.0 - smoothstep(-fw, fw, d);
// Qt Rectangle semantics: border band on the rim, fill inset inside it.
float covInner = 1.0 - smoothstep(-fw, fw, d + ubuf.borderWidth);
vec4 col = vec4(ubuf.fillColor.rgb, 1.0) * (ubuf.fillColor.a * covInner)
+ vec4(ubuf.borderColor.rgb, 1.0) * (ubuf.borderColor.a * max(0.0, cov - covInner));
+1 -3
View File
@@ -1,8 +1,6 @@
#version 450
// Frame perimeter ring as a signed-distance field: the window rectangle minus
// a rounded-rectangle cutout. Antialiasing is analytic via fwidth -> crisp at
// any scale, no FBO and no mask textures.
// Frame perimeter ring with rounded cutout as one SDF.
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;