BlueGit

timfa kwin-marble

Random colour from a per-window sequence number (internalId is undefined in scripted effects -> hash was constant -> always blue); DebugMarble setting (1 = journal log, 2 = raw window texture in the marble)

timfa Tim Falken · pushed by timfa

Authored 2026-11-02 · 2 weeks ago

Hash
e7964f9a7c6e331b695951d2f0bc0250285e8482
Parent
6922c9c4
8 files changed +32 −10
kwin6_effect_marble/contents/code/main.js +11 −5
@@ -93,6 +93,8 @@ class BurnMyWindowsMarbleEffect {
93 93 this.tintMode = mc;
94 94 this.applyTint(null, false);
95 95 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
96 this.debug = Math.max(0, Number(effect.readConfig('DebugMarble', 0)) | 0);
97 effect.setUniform(this.shader, 'uDebug', this.debug);
96 98 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
97 99 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
98 100 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
@@ -101,7 +103,11 @@ class BurnMyWindowsMarbleEffect {
101 103 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
102 104 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
103 105 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
104 prog(window, m) { return (window.bmwBase || 0) + Math.min(4000, Math.max(0, m)); }
106 prog(window, m) {
107 const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
108 if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
109 return v;
110 }
105 111
106 112 crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }
107 113
@@ -110,13 +116,13 @@ class BurnMyWindowsMarbleEffect {
110 116 let c;
111 117 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
112 118 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
113 else if (window) { // random: window id (internalId) hashed modulo the number of colours; stable per window
114 let h = 0; const id = String(window.internalId);
115 for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) | 0;
116 c = C[Math.abs(h) % C.length]; window.bmwTint = c;
119 else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
120 if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
121 c = C[window.bmwSeq % C.length]; window.bmwTint = c;
117 122 }
118 123 else c = C[0];
119 124 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
125 if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
120 126 effect.setUniform(this.shader, 'uTintR', c[0]);
121 127 effect.setUniform(this.shader, 'uTintG', c[1]);
122 128 effect.setUniform(this.shader, 'uTintB', c[2]);
@@ -93,6 +93,8 @@ class BurnMyWindowsMarbleEffect {
93 this.tintMode = mc;
93 this.tintMode = mc;
94 this.applyTint(null, false);
94 this.applyTint(null, false);
95 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
95 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
96 this.debug = Math.max(0, Number(effect.readConfig('DebugMarble', 0)) | 0);
97 effect.setUniform(this.shader, 'uDebug', this.debug);
96 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
98 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
97 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
99 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
98 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
100 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
@@ -101,7 +103,11 @@ class BurnMyWindowsMarbleEffect {
101 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
103 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
102 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
104 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
103 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
105 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
104 prog(window, m) { return (window.bmwBase || 0) + Math.min(4000, Math.max(0, m)); }
106 prog(window, m) {
107 const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
108 if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
109 return v;
110 }
105
111
106 crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }
112 crumpleEnd() { return Math.max(1e-4, this.duration / Math.max(1, this.duration + this.pause + this.fallDuration)); }
107
113
@@ -110,13 +116,13 @@ class BurnMyWindowsMarbleEffect {
110 let c;
116 let c;
111 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
117 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
112 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
118 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
113 else if (window) { // random: window id (internalId) hashed modulo the number of colours; stable per window
119 else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
114 let h = 0; const id = String(window.internalId);
120 if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
115 for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) | 0;
121 c = C[window.bmwSeq % C.length]; window.bmwTint = c;
116 c = C[Math.abs(h) % C.length]; window.bmwTint = c;
117 }
122 }
118 else c = C[0];
123 else c = C[0];
119 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
124 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
125 if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
120 effect.setUniform(this.shader, 'uTintR', c[0]);
126 effect.setUniform(this.shader, 'uTintR', c[0]);
121 effect.setUniform(this.shader, 'uTintG', c[1]);
127 effect.setUniform(this.shader, 'uTintG', c[1]);
122 effect.setUniform(this.shader, 'uTintB', c[2]);
128 effect.setUniform(this.shader, 'uTintB', c[2]);
kwin6_effect_marble/contents/config/main.xml +1 −0
@@ -9,5 +9,6 @@
9 9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
10 10 <entry name="MixColor" type="Int"><default>0</default></entry>
11 11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
12 <entry name="DebugMarble" type="Int"><default>0</default></entry>
12 13 </group>
13 14 </kcfg>
@@ -9,5 +9,6 @@
9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
10 <entry name="MixColor" type="Int"><default>0</default></entry>
10 <entry name="MixColor" type="Int"><default>0</default></entry>
11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
12 <entry name="DebugMarble" type="Int"><default>0</default></entry>
12 </group>
13 </group>
13</kcfg>
14</kcfg>
kwin6_effect_marble/contents/shaders/marble.frag +2 −0
@@ -748,6 +748,7 @@ uniform float uCrumpleEnd;
748 748 uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749 749 uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750 750 uniform float uMarbleSize; // marble diameter in px
751 uniform float uDebug; // 2 = show the raw window texture inside the marble
751 752 uniform float uMixCenter; // 0..1 black mix, centre/top zone
752 753
753 754 void main() {
@@ -786,6 +787,7 @@ void main() {
786 787 col.a = mix(col.a, 1.0, e); // marble is solid
787 788 col.rgb = clamp(col.rgb, 0.0, 1.0);
788 789
790 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
789 791 // glossy marble shading
790 792 vec3 n = vec3(q * e, z);
791 793 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
@@ -748,6 +748,7 @@ uniform float uCrumpleEnd;
748uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
748uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
749uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750uniform float uMarbleSize; // marble diameter in px
750uniform float uMarbleSize; // marble diameter in px
751uniform float uDebug; // 2 = show the raw window texture inside the marble
751uniform float uMixCenter; // 0..1 black mix, centre/top zone
752uniform float uMixCenter; // 0..1 black mix, centre/top zone
752
753
753void main() {
754void main() {
@@ -786,6 +787,7 @@ void main() {
786 col.a = mix(col.a, 1.0, e); // marble is solid
787 col.a = mix(col.a, 1.0, e); // marble is solid
787 col.rgb = clamp(col.rgb, 0.0, 1.0);
788 col.rgb = clamp(col.rgb, 0.0, 1.0);
788
789
790 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
789 // glossy marble shading
791 // glossy marble shading
790 vec3 n = vec3(q * e, z);
792 vec3 n = vec3(q * e, z);
791 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
793 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
kwin6_effect_marble/contents/shaders/marble_core.frag +2 −0
@@ -749,6 +749,7 @@ uniform float uCrumpleEnd;
749 749 uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
750 750 uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
751 751 uniform float uMarbleSize; // marble diameter in px
752 uniform float uDebug; // 2 = show the raw window texture inside the marble
752 753 uniform float uMixCenter; // 0..1 black mix, centre/top zone
753 754
754 755 void main() {
@@ -787,6 +788,7 @@ void main() {
787 788 col.a = mix(col.a, 1.0, e); // marble is solid
788 789 col.rgb = clamp(col.rgb, 0.0, 1.0);
789 790
791 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
790 792 // glossy marble shading
791 793 vec3 n = vec3(q * e, z);
792 794 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
@@ -749,6 +749,7 @@ uniform float uCrumpleEnd;
749uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
750uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
751uniform float uMarbleSize; // marble diameter in px
751uniform float uMarbleSize; // marble diameter in px
752uniform float uDebug; // 2 = show the raw window texture inside the marble
752uniform float uMixCenter; // 0..1 black mix, centre/top zone
753uniform float uMixCenter; // 0..1 black mix, centre/top zone
753
754
754void main() {
755void main() {
@@ -787,6 +788,7 @@ void main() {
787 col.a = mix(col.a, 1.0, e); // marble is solid
788 col.a = mix(col.a, 1.0, e); // marble is solid
788 col.rgb = clamp(col.rgb, 0.0, 1.0);
789 col.rgb = clamp(col.rgb, 0.0, 1.0);
789
790
791 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
790 // glossy marble shading
792 // glossy marble shading
791 vec3 n = vec3(q * e, z);
793 vec3 n = vec3(q * e, z);
792 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
794 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
kwin6_effect_marble_minimize/contents/code/main.js +11 −5
@@ -99,6 +99,8 @@ class BurnMyWindowsMarbleMinimizeEffect {
99 99 this.tintMode = mc;
100 100 this.applyTint(null, false);
101 101 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
102 this.debug = Math.max(0, Number(effect.readConfig('DebugMarble', 0)) | 0);
103 effect.setUniform(this.shader, 'uDebug', this.debug);
102 104 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
103 105 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
104 106 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
@@ -107,20 +109,24 @@ class BurnMyWindowsMarbleMinimizeEffect {
107 109 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
108 110 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
109 111 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
110 prog(window, m) { return (window.bmwBase || 0) + Math.min(4000, Math.max(0, m)); }
112 prog(window, m) {
113 const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
114 if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
115 return v;
116 }
111 117
112 118 applyTint(window, reuse) {
113 119 const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
114 120 let c;
115 121 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
116 122 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
117 else if (window) { // random: window id (internalId) hashed modulo the number of colours; stable per window
118 let h = 0; const id = String(window.internalId);
119 for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) | 0;
120 c = C[Math.abs(h) % C.length]; window.bmwTint = c;
123 else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
124 if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
125 c = C[window.bmwSeq % C.length]; window.bmwTint = c;
121 126 }
122 127 else c = C[0];
123 128 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
129 if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
124 130 effect.setUniform(this.shader, 'uTintR', c[0]);
125 131 effect.setUniform(this.shader, 'uTintG', c[1]);
126 132 effect.setUniform(this.shader, 'uTintB', c[2]);
@@ -99,6 +99,8 @@ class BurnMyWindowsMarbleMinimizeEffect {
99 this.tintMode = mc;
99 this.tintMode = mc;
100 this.applyTint(null, false);
100 this.applyTint(null, false);
101 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
101 effect.setUniform(this.shader, 'uMarbleSize', Math.max(4, Number(effect.readConfig('MarbleSize', 42))));
102 this.debug = Math.max(0, Number(effect.readConfig('DebugMarble', 0)) | 0);
103 effect.setUniform(this.shader, 'uDebug', this.debug);
102 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
104 effect.setUniform(this.shader, 'uMixOuter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixOuter', 80)))) / 100);
103 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
105 effect.setUniform(this.shader, 'uMixCenter', Math.min(100, Math.max(0, Number(effect.readConfig('BlackMixCenter', 5)))) / 100);
104 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
106 effect.setUniform(this.shader, 'uCrumpleEnd', this.duration / Math.max(1, this.duration + this.pause + this.fallDuration));
@@ -107,20 +109,24 @@ class BurnMyWindowsMarbleMinimizeEffect {
107 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
109 // Mix target colour. tintMode 11 = random; with reuse, a random colour picked for this
108 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
110 // window (e.g. at minimize) is used again (e.g. at unminimize) and then forgotten.
109 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
111 // uProgress value for this window: tint base + morph-normalised progress m (capped, see shader)
110 prog(window, m) { return (window.bmwBase || 0) + Math.min(4000, Math.max(0, m)); }
112 prog(window, m) {
113 const v = (window.bmwBase || 0) + Math.min(4000, Math.max(0, m));
114 if (this.debug) console.log('MARBLEDBG prog caption=' + window.caption + ' m=' + m + ' v=' + v);
115 return v;
116 }
111
117
112 applyTint(window, reuse) {
118 applyTint(window, reuse) {
113 const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
119 const C = [[0.0000,0.0000,0.0000],[0.0000,0.0000,0.6667],[0.6667,0.0000,0.0000],[0.0000,0.6667,0.0000],[0.4000,0.0000,0.6667],[0.6667,0.6667,0.0000],[0.6667,0.3333,0.0000],[0.0000,0.6667,0.6667],[0.6667,0.0000,0.4000],[0.3333,0.3333,0.3333],[0.3333,0.2000,0.0000]];
114 let c;
120 let c;
115 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
121 if (this.tintMode < C.length) { c = C[this.tintMode]; if (window) window.bmwTint = null; }
116 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
122 else if (window && reuse && window.bmwTint) { c = window.bmwTint; window.bmwTint = null; }
117 else if (window) { // random: window id (internalId) hashed modulo the number of colours; stable per window
123 else if (window) { // random: per-window number (window.internalId is undefined in scripted effects)
118 let h = 0; const id = String(window.internalId);
124 if (!(window.bmwSeq >= 1)) window.bmwSeq = (this.seq = (this.seq || 0) + 1);
119 for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) | 0;
125 c = C[window.bmwSeq % C.length]; window.bmwTint = c;
120 c = C[Math.abs(h) % C.length]; window.bmwTint = c;
121 }
126 }
122 else c = C[0];
127 else c = C[0];
123 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
128 if (window) window.bmwBase = 4096 * Math.max(0, C.findIndex(x => x[0] == c[0] && x[1] == c[1] && x[2] == c[2])); // per-window tint, carried in uProgress
129 if (this.debug && window) console.log('MARBLEDBG tint caption=' + window.caption + ' seq=' + window.bmwSeq + ' reuse=' + reuse + ' mode=' + this.tintMode + ' base=' + window.bmwBase + ' internalId=' + typeof window.internalId + ' windowId=' + window.windowId + ' minimized=' + window.minimized);
124 effect.setUniform(this.shader, 'uTintR', c[0]);
130 effect.setUniform(this.shader, 'uTintR', c[0]);
125 effect.setUniform(this.shader, 'uTintG', c[1]);
131 effect.setUniform(this.shader, 'uTintG', c[1]);
126 effect.setUniform(this.shader, 'uTintB', c[2]);
132 effect.setUniform(this.shader, 'uTintB', c[2]);
kwin6_effect_marble_minimize/contents/config/main.xml +1 −0
@@ -9,5 +9,6 @@
9 9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
10 10 <entry name="MixColor" type="Int"><default>0</default></entry>
11 11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
12 <entry name="DebugMarble" type="Int"><default>0</default></entry>
12 13 </group>
13 14 </kcfg>
@@ -9,5 +9,6 @@
9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
9 <entry name="BlackMixCenter" type="UInt"><default>5</default></entry>
10 <entry name="MixColor" type="Int"><default>0</default></entry>
10 <entry name="MixColor" type="Int"><default>0</default></entry>
11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
11 <entry name="MarbleSize" type="UInt"><default>42</default></entry>
12 <entry name="DebugMarble" type="Int"><default>0</default></entry>
12 </group>
13 </group>
13</kcfg>
14</kcfg>
kwin6_effect_marble_minimize/contents/shaders/marble.frag +2 −0
@@ -748,6 +748,7 @@ uniform float uCrumpleEnd;
748 748 uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749 749 uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750 750 uniform float uMarbleSize; // marble diameter in px
751 uniform float uDebug; // 2 = show the raw window texture inside the marble
751 752 uniform float uMixCenter; // 0..1 black mix, centre/top zone
752 753
753 754 void main() {
@@ -786,6 +787,7 @@ void main() {
786 787 col.a = mix(col.a, 1.0, e); // marble is solid
787 788 col.rgb = clamp(col.rgb, 0.0, 1.0);
788 789
790 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
789 791 // glossy marble shading
790 792 vec3 n = vec3(q * e, z);
791 793 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
@@ -748,6 +748,7 @@ uniform float uCrumpleEnd;
748uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
748uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
749uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750uniform float uMarbleSize; // marble diameter in px
750uniform float uMarbleSize; // marble diameter in px
751uniform float uDebug; // 2 = show the raw window texture inside the marble
751uniform float uMixCenter; // 0..1 black mix, centre/top zone
752uniform float uMixCenter; // 0..1 black mix, centre/top zone
752
753
753void main() {
754void main() {
@@ -786,6 +787,7 @@ void main() {
786 col.a = mix(col.a, 1.0, e); // marble is solid
787 col.a = mix(col.a, 1.0, e); // marble is solid
787 col.rgb = clamp(col.rgb, 0.0, 1.0);
788 col.rgb = clamp(col.rgb, 0.0, 1.0);
788
789
790 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
789 // glossy marble shading
791 // glossy marble shading
790 vec3 n = vec3(q * e, z);
792 vec3 n = vec3(q * e, z);
791 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
793 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
kwin6_effect_marble_minimize/contents/shaders/marble_core.frag +2 −0
@@ -749,6 +749,7 @@ uniform float uCrumpleEnd;
749 749 uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
750 750 uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
751 751 uniform float uMarbleSize; // marble diameter in px
752 uniform float uDebug; // 2 = show the raw window texture inside the marble
752 753 uniform float uMixCenter; // 0..1 black mix, centre/top zone
753 754
754 755 void main() {
@@ -787,6 +788,7 @@ void main() {
787 788 col.a = mix(col.a, 1.0, e); // marble is solid
788 789 col.rgb = clamp(col.rgb, 0.0, 1.0);
789 790
791 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
790 792 // glossy marble shading
791 793 vec3 n = vec3(q * e, z);
792 794 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
@@ -749,6 +749,7 @@ uniform float uCrumpleEnd;
749uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
749uniform float uMixOuter; // 0..1 black mix, outer/bottom zone
750uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
750uniform float uTintR; uniform float uTintG; uniform float uTintB; // mix target colour
751uniform float uMarbleSize; // marble diameter in px
751uniform float uMarbleSize; // marble diameter in px
752uniform float uDebug; // 2 = show the raw window texture inside the marble
752uniform float uMixCenter; // 0..1 black mix, centre/top zone
753uniform float uMixCenter; // 0..1 black mix, centre/top zone
753
754
754void main() {
755void main() {
@@ -787,6 +788,7 @@ void main() {
787 col.a = mix(col.a, 1.0, e); // marble is solid
788 col.a = mix(col.a, 1.0, e); // marble is solid
788 col.rgb = clamp(col.rgb, 0.0, 1.0);
789 col.rgb = clamp(col.rgb, 0.0, 1.0);
789
790
791 if (uDebug > 1.5) { setOutputColor(vec4(col.rgb, col.a * clamp(-d, 0.0, 1.0))); return; }
790 // glossy marble shading
792 // glossy marble shading
791 vec3 n = vec3(q * e, z);
793 vec3 n = vec3(q * e, z);
792 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);
794 float diff = clamp(dot(n, vec3(-0.45, -0.55, 0.70)), 0.0, 1.0);