diff --git a/extension.js b/extension.js index b0f2dd2..f186385 100644 --- a/extension.js +++ b/extension.js @@ -161,8 +161,10 @@ class Extension { tweakTransition('scale-y', 0.5); } else if (mode == 4) { shader = new TRexShader(this._settings); - tweakTransition('scale-x', 1.05); - tweakTransition('scale-y', 1.05); + + const warp = 0.5 * this._settings.get_double('claw-scratch-warp'); + tweakTransition('scale-x', 1.0 + warp); + tweakTransition('scale-y', 1.0 + warp); } if (shader) { diff --git a/prefs.js b/prefs.js index 562b30c..ec05e87 100644 --- a/prefs.js +++ b/prefs.js @@ -58,8 +58,12 @@ var PreferencesDialog = class PreferencesDialog { this._bindColorButton('matrix-trail-color'); this._bindColorButton('matrix-tip-color'); this._bindColorButton('tv-effect-color'); + this._bindColorButton('claw-scratch-color'); + this._bindAdjustment('claw-scratch-scale'); + this._bindAdjustment('claw-scratch-count'); + this._bindAdjustment('claw-scratch-warp'); - // The fire-gradient-reset button needs to by bound explicitly. + // The fire-gradient-reset button needs to be bound explicitly. this._builder.get_object('reset-fire-colors').connect('clicked', () => { this._settings.reset('fire-color-1'); this._settings.reset('fire-color-2'); diff --git a/resources/ui/gtk4.ui b/resources/ui/gtk4.ui index 6593c58..f0fefb9 100644 --- a/resources/ui/gtk4.ui +++ b/resources/ui/gtk4.ui @@ -578,6 +578,211 @@ + + + 30 + 10 + + + T-Rex Attack Options + 0 + 1 + + + + + + + + + + + none + 1 + + + + + 0 + + + + + Claw Scratch Scale + 0 + start + center + 1 + + + + + end + center + 1 + 1 + left + 300 + + + 10 + 0.1 + 0.1 + 1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Claw Scratch Count + 0 + start + center + 1 + + + + + end + center + 1 + 0 + left + 300 + + + 50 + 1 + 1 + 10 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Warp Effect + 0 + start + center + 1 + + + + + end + center + 1 + 2 + left + 300 + + + 1 + 0 + 0.01 + 0.1 + + + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + 0 + + + + + Flash Color + 0 + start + center + 1 + + + + + 1 + 1 + + + + + edit-clear-symbolic + Reset to Default Value + + + + + + + + + + + + + + 30 diff --git a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml index 8b79fa2..4b5caa2 100644 --- a/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml +++ b/schemas/org.gnome.shell.extensions.burn-my-windows.gschema.xml @@ -96,6 +96,7 @@ The color matrix trails. + "rgb(255, 255, 255)" TV Effect Color @@ -103,6 +104,31 @@ + + "rgb(255, 0, 0)" + Claw Scratch Color + The color of the claw scratches. + + + + 1.0 + Claw Scratch Scale + Size of the claw scratches. + + + + 0.1 + Claw Scratch Warp + Intensity of the claw scratch warp effect. + + + + 5 + Claw Scratch Count + Number of claw scratches drawn on top of each other. + + + \ No newline at end of file diff --git a/src/extension/TRexShader.js b/src/extension/TRexShader.js index 7d5c6dc..0562373 100644 --- a/src/extension/TRexShader.js +++ b/src/extension/TRexShader.js @@ -35,6 +35,8 @@ var TRexShader = GObject.registerClass({Properties: {}, Signals: {}}, clawData.get_pixels(), Cogl.PixelFormat.RGB_888, clawData.width, clawData.height, clawData.rowstride); + const color = Clutter.Color.from_string(settings.get_string('claw-scratch-color'))[1]; + // This is partially based on https://www.shadertoy.com/view/ldccW4 (CC-BY-NC-SA). this.set_shader_source(` @@ -74,10 +76,10 @@ var TRexShader = GObject.registerClass({Properties: {}, Signals: {}}, void main() { - - - const float CLAW_SIZE = 1; - const float NUM_CLAWS = 5; + const float CLAW_SIZE = ${settings.get_double('claw-scratch-scale')}; + const float NUM_CLAWS = ${settings.get_int('claw-scratch-count')}; + const float WARP_INTENSITY = 1.0 + ${settings.get_double('claw-scratch-warp')}; + const float FLASH_INTENSITY = 0.1; const float MAX_SPAWN_TIME = 0.5; const float FF_TIME = 0.5; // Relative time for the final fade to transparency. @@ -88,7 +90,7 @@ var TRexShader = GObject.registerClass({Properties: {}, Signals: {}}, vec2 coords = cogl_tex_coord_in[0].st * 2.0 - 1.0; float dist = length(coords); - coords = (coords/dist * pow(dist, 1.1)) * 0.5 + 0.5; + coords = (coords/dist * pow(dist, WARP_INTENSITY)) * 0.5 + 0.5; coords = mix(cogl_tex_coord_in[0].st, coords, uProgress); @@ -104,13 +106,17 @@ var TRexShader = GObject.registerClass({Properties: {}, Signals: {}}, vec2 dir = vec2(dFdx(mask), dFdy(mask))*uProgress*mask*0.5; cogl_color_out = texture2D(uTexture, coords + dir); - float flash = 25 * (mask - uProgress) + 1; + float flash = 1.0 / FLASH_INTENSITY * (mask - uProgress) + 1; if (flash < 0 || flash >= 1) { flash = 0; } + vec3 flashColor = vec3(${color.red / 255}, + ${color.green / 255}, + ${color.blue / 255}) * ${color.alpha / 255}; + cogl_color_out *= (mask > uProgress ? 1 : 0); - cogl_color_out.rgb += flash * mix(vec3(1, 0, 0), vec3(0), uProgress); + cogl_color_out.rgb += flash * mix(flashColor, vec3(0), uProgress);