diff --git a/.eslintrc.json b/.eslintrc.json index c78da4c..e96b061 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,8 @@ { "extends": "eslint-config-fluid", "env": { - "node": true + "node": true, + "es6": true }, "rules": { "dot-notation": [ diff --git a/package.json b/package.json index dbfaea0..d02a668 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "electron": "17.4.0", "electron-icon-builder": "2.0.1", "electron-packager": "15.4.0", - "fluid-lint-all": "1.1.5", + "fluid-lint-all": "1.2.2", "node-jqunit": "1.1.9" }, "dependencies": { diff --git a/src/renderer-process/css/score-panel.css b/src/renderer-process/css/score-panel.css index 4ff81b1..9a208e5 100644 --- a/src/renderer-process/css/score-panel.css +++ b/src/renderer-process/css/score-panel.css @@ -15,11 +15,11 @@ } .bubbles-osc-panel { + border-bottom: 0.1em solid #aaa; color: #fff; font-family: sans-serif; font-size: 0.8em; font-weight: 600; opacity: 1; padding: 0 0.5em 1.5em 0.5em; - border-bottom: 0.1em solid #aaa; } diff --git a/src/renderer-process/js/modulation-matrix-view.js b/src/renderer-process/js/modulation-matrix-view.js index 88ef69c..a22437a 100644 --- a/src/renderer-process/js/modulation-matrix-view.js +++ b/src/renderer-process/js/modulation-matrix-view.js @@ -7,6 +7,8 @@ https://github.com/colinbdclark/bubbles/raw/master/LICENSE "use strict"; +var bubbles = fluid.registerNamespace("bubbles"); + fluid.defaults("bubbles.modulationMatrixView", { gradeNames: "fluid.containerRenderingView", diff --git a/src/renderer-process/js/osc-relayer.js b/src/renderer-process/js/osc-relayer.js index 7a63090..e2dea0c 100644 --- a/src/renderer-process/js/osc-relayer.js +++ b/src/renderer-process/js/osc-relayer.js @@ -7,8 +7,6 @@ https://github.com/colinbdclark/bubbles/raw/master/LICENSE "use strict"; -var bubbles = fluid.registerNamespace("bubbles"); - fluid.defaults("bubbles.oscRelayer", { gradeNames: "fluid.modelComponent", diff --git a/src/renderer-process/js/osc-source.js b/src/renderer-process/js/osc-source.js index 4448d73..a0c0b50 100644 --- a/src/renderer-process/js/osc-source.js +++ b/src/renderer-process/js/osc-source.js @@ -27,7 +27,7 @@ fluid.defaults("bubbles.oscSource", { }, model: { - isListening: false, + isListening: false /* gain: 1.0, layers: { diff --git a/src/renderer-process/shaders/bubbles.frag b/src/renderer-process/shaders/bubbles.frag index abb843e..6280a34 100644 --- a/src/renderer-process/shaders/bubbles.frag +++ b/src/renderer-process/shaders/bubbles.frag @@ -17,11 +17,20 @@ uniform float saturation[MAX_LAYERS]; uniform sampler2D samplers[MAX_LAYERS]; uniform vec2 textureSize; +float clampUnipolar (float value) { + if (value < 0.0) { + value = 0.0; + } + + return value; +} + float luma (vec3 fragment) { return dot(fragment, W); } -vec3 brightnessContrast (vec3 fragment, float brightness, float contrast) { +vec3 brightnessContrast (vec3 fragment, float brightness, + float contrast) { return (fragment - 0.5) * contrast + 0.5 + brightness; } @@ -52,15 +61,18 @@ void main(void) { colour = brightnessContrast(colour, brightness[i], contrast[i]); // 2. Scale colour channels. - vec3 colourScale = vec3(redScale[i], greenScale[i], - blueScale[i]); + vec3 colourScale = vec3( + clampUnipolar(redScale[i]), + clampUnipolar(greenScale[i]), + clampUnipolar(blueScale[i])); + colour = colour * colourScale; // 3. Apply saturation. colour = saturate(colour, saturation[i]); // 4. Adjust overall opacity - colour = colour * opacity[i]; + colour = colour * clampUnipolar(opacity[i]); // 5. Apply luma key. // TODO: Add some smoothstepping. @@ -69,10 +81,10 @@ void main(void) { // 6. Sum pixel with other layers if it isn't keyed out. layerSum = layerSum + colour; } - - // 7. Apply gain to all layers. - layerSum = layerSum * gain; } + // 7. Apply gain to all layers. + layerSum = layerSum * clampUnipolar(gain); + gl_FragColor = vec4(layerSum.r, layerSum.g, layerSum.b, 1.0); } diff --git a/tests/js/main-window-tests.js b/tests/js/main-window-tests.js index 946c043..b2a92c0 100644 --- a/tests/js/main-window-tests.js +++ b/tests/js/main-window-tests.js @@ -16,7 +16,26 @@ fluid.defaults("bubbles.tests.mainWindowTestEnvironment", { components: { app: { - type: "bubbles.app" + type: "bubbles.app", + options: { + components: { + mainWindow: { + options: { + model: { + url: { + expander: { + funcName: "fluid.stringTemplate", + args: [ + "%url/../src/renderer-process/html/main-window.html", + "{app}.env.appRoot" + ] + } + } + } + } + } + } + } }, tester: {