excalibur 0.26.0-alpha.378 → 0.26.0-alpha.379

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,20 @@ export interface DebugFlags {
5
5
  }
6
6
  export declare class ColorBlindFlags {
7
7
  private _engine;
8
+ private _colorBlindPostProcessor;
8
9
  constructor(engine: Engine);
10
+ /**
11
+ * Correct colors for a specified color blindness
12
+ * @param colorBlindness
13
+ */
9
14
  correct(colorBlindness: ColorBlindnessMode): void;
15
+ /**
16
+ * Simulate colors for a specified color blindness
17
+ * @param colorBlindness
18
+ */
10
19
  simulate(colorBlindness: ColorBlindnessMode): void;
20
+ /**
21
+ * Remove color blindness post processor
22
+ */
23
+ clear(): void;
11
24
  }
@@ -1,18 +1,40 @@
1
+ import { ColorBlindnessMode } from '../Graphics/PostProcessor/ColorBlindnessMode';
1
2
  import { ColorBlindnessPostProcessor } from '../Graphics/PostProcessor/ColorBlindnessPostProcessor';
2
3
  import { ExcaliburGraphicsContextWebGL } from '..';
3
4
  export class ColorBlindFlags {
4
5
  constructor(engine) {
5
6
  this._engine = engine;
7
+ this._colorBlindPostProcessor = new ColorBlindnessPostProcessor(ColorBlindnessMode.Protanope);
6
8
  }
9
+ /**
10
+ * Correct colors for a specified color blindness
11
+ * @param colorBlindness
12
+ */
7
13
  correct(colorBlindness) {
8
14
  if (this._engine.graphicsContext instanceof ExcaliburGraphicsContextWebGL) {
9
- this._engine.graphicsContext.addPostProcessor(new ColorBlindnessPostProcessor(colorBlindness, false));
15
+ this.clear();
16
+ this._colorBlindPostProcessor.colorBlindnessMode = colorBlindness;
17
+ this._colorBlindPostProcessor.simulate = false;
18
+ this._engine.graphicsContext.addPostProcessor(this._colorBlindPostProcessor);
10
19
  }
11
20
  }
21
+ /**
22
+ * Simulate colors for a specified color blindness
23
+ * @param colorBlindness
24
+ */
12
25
  simulate(colorBlindness) {
13
26
  if (this._engine.graphicsContext instanceof ExcaliburGraphicsContextWebGL) {
14
- this._engine.graphicsContext.addPostProcessor(new ColorBlindnessPostProcessor(colorBlindness, true));
27
+ this.clear();
28
+ this._colorBlindPostProcessor.colorBlindnessMode = colorBlindness;
29
+ this._colorBlindPostProcessor.simulate = true;
30
+ this._engine.graphicsContext.addPostProcessor(this._colorBlindPostProcessor);
15
31
  }
16
32
  }
33
+ /**
34
+ * Remove color blindness post processor
35
+ */
36
+ clear() {
37
+ this._engine.graphicsContext.removePostProcessor(this._colorBlindPostProcessor);
38
+ }
17
39
  }
18
40
  //# sourceMappingURL=DebugFlags.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DebugFlags.js","sourceRoot":"","sources":["../../../src/engine/Debug/DebugFlags.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AAEpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,IAAI,CAAC;AAMnD,MAAM,OAAO,eAAe;IAG1B,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,OAAO,CAAC,cAAkC;QAC/C,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,YAAY,6BAA6B,EAAE;YACzE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,2BAA2B,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,CAAC;SACvG;IACH,CAAC;IAEM,QAAQ,CAAC,cAAkC;QAChD,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,YAAY,6BAA6B,EAAE;YACzE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,2BAA2B,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC;SACtG;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"DebugFlags.js","sourceRoot":"","sources":["../../../src/engine/Debug/DebugFlags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8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nessMode(colorBlindMode) {
22
- const shader = this._shader.getShader();
23
- shader.use();
24
- if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
25
- shader.setUniformInt('u_type', 0);
26
- }
27
- else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
28
- shader.setUniformInt('u_type', 1);
29
- }
30
- else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
31
- shader.setUniformInt('u_type', 2);
32
- }
33
22
  this._colorBlindnessMode = colorBlindMode;
23
+ if (this._shader) {
24
+ const shader = this._shader.getShader();
25
+ shader.use();
26
+ if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
27
+ shader.setUniformInt('u_type', 0);
28
+ }
29
+ else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
30
+ shader.setUniformInt('u_type', 1);
31
+ }
32
+ else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
33
+ shader.setUniformInt('u_type', 2);
34
+ }
35
+ }
34
36
  }
35
37
  get colorBlindnessMode() {
36
38
  return this._colorBlindnessMode;
37
39
  }
38
40
  set simulate(value) {
39
- const shader = this._shader.getShader();
40
- shader.use();
41
41
  this._simulate = value;
42
- shader.setUniformBoolean('u_simulate', value);
42
+ if (this._shader) {
43
+ const shader = this._shader.getShader();
44
+ shader.use();
45
+ shader.setUniformBoolean('u_simulate', value);
46
+ }
43
47
  }
44
48
  get simulate() {
45
49
  return this._simulate;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorBlindnessPostProcessor.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/ColorBlindnessPostProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAO,2BAA2B;IAGtC,YAAoB,mBAAuC,EAAE,QAAQ,GAAG,KAAK;QA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AAS,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
1
+ {"version":3,"file":"ColorBlindnessPostProcessor.js","sourceRoot":"","sources":["../../../../src/engine/Graphics/PostProcessor/ColorBlindnessPostProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAO,2BAA2B;IAGtC,YAAoB,mBAAuC,EAAE,QAAQ,GAAG,KAAK;QAAzD,wBAAmB,GAAnB,mBAAmB,CAAoB;QADnD,cAAS,GAAG,KAAK,CAAC;QAExB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,GAA0B;QACnC,IAAI,CAAC,OAAO,GAAG,IAAI,YAAY,CAAC,uBAAuB,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC;IACrD,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAClC,CAAC;IAED,IAAI,kBAAkB,CAAC,cAAkC;QACvD,IAAI,CAAC,mBAAmB,GAAG,cAAc,CAAC;QAC1C,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,EAAE,CAAC;YACb,IAAI,IAAI,CAAC,mBAAmB,KAAK,kBAAkB,CAAC,SAAS,EAAE;gBAC7D,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aACnC;iBAAM,IAAI,IAAI,CAAC,mBAAmB,KAAK,kBAAkB,CAAC,WAAW,EAAE;gBACtE,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aACnC;iBAAM,IAAI,IAAI,CAAC,mBAAmB,KAAK,kBAAkB,CAAC,SAAS,EAAE;gBACpE,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aACnC;SACF;IACH,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAI,QAAQ,CAAC,KAAc;QACzB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI,CAAC,OAAO,EAAE;YAEhB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;SAC/C;IACH,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * excalibur - 0.26.0-alpha.378+e63c96f - 2022-1-19
2
+ * excalibur - 0.26.0-alpha.379+f4d3bed - 2022-1-21
3
3
  * https://github.com/excaliburjs/Excalibur
4
4
  * Copyright (c) 2022 Excalibur.js <https://github.com/excaliburjs/Excalibur/graphs/contributors>
5
5
  * Licensed BSD-2-Clause
@@ -24555,8 +24555,6 @@ Scene_decorate([
24555
24555
  obsolete({ message: 'Will be removed in excalibur v0.26.0', alternateMethod: 'Use Scene.remove' })
24556
24556
  ], Scene.prototype, "removeTileMap", null);
24557
24557
 
24558
- ;// CONCATENATED MODULE: ./Graphics/PostProcessor/color-blind-fragment.glsl
24559
- /* harmony default export */ const color_blind_fragment = ("precision mediump float;\n// our texture\nuniform sampler2D u_image;\n// the texCoords passed in from the vertex shader.\nvarying vec2 v_texcoord;\n\n// color blind type\nuniform int u_type;\n\n// simulation?\nuniform bool u_simulate;\n\nvoid main() {\n vec4 o = texture2D(u_image, v_texcoord);\n // RGB to LMS matrix conversion\n float L = (17.8824 * o.r) + (43.5161 * o.g) + (4.11935 * o.b);\n float M = (3.45565 * o.r) + (27.1554 * o.g) + (3.86714 * o.b);\n float S = (0.0299566 * o.r) + (0.184309 * o.g) + (1.46709 * o.b);\n // Simulate color blindness\n float l;\n float m;\n float s;\n //MODE CODE//\n if (u_type == 0) {\n // Protanope\n l = 0.0 * L + 2.02344 * M + -2.52581 * S;\n m = 0.0 * L + 1.0 * M + 0.0 * S;\n s = 0.0 * L + 0.0 * M + 1.0 * S;;\n } else if (u_type == 1) {\n // Deuteranope\n l = 1.0 * L + 0.0 * M + 0.0 * S;\n m = 0.494207 * L + 0.0 * M + 1.24827 * S;\n s = 0.0 * L + 0.0 * M + 1.0 * S;\n } else if (u_type == 2) {\n // Tritanope\n l = 1.0 * L + 0.0 * M + 0.0 * S;\n m = 0.0 * L + 1.0 * M + 0.0 * S;\n s = -0.395913 * L + 0.801109 * M + 0.0 * S;\n }\n\n // LMS to RGB matrix conversion\n vec4 error; // simulate the colors\n error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s);\n error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s);\n error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s);\n error.a = 1.0;\n vec4 diff = o - error;\n vec4 correction; // correct the colors\n correction.r = 0.0;\n correction.g = (diff.r * 0.7) + (diff.g * 1.0);\n correction.b = (diff.r * 0.7) + (diff.b * 1.0);\n correction = o + correction;\n correction.a = o.a;\n //SIMULATE//\n\n // sim \n if (u_simulate) {\n gl_FragColor = error.rgba;\n } else {\n gl_FragColor = correction.rgba;\n }\n}");
24560
24558
  ;// CONCATENATED MODULE: ./Graphics/PostProcessor/ColorBlindnessMode.ts
24561
24559
  var ColorBlindnessMode;
24562
24560
  (function (ColorBlindnessMode) {
@@ -24565,6 +24563,8 @@ var ColorBlindnessMode;
24565
24563
  ColorBlindnessMode["Tritanope"] = "Tritanope";
24566
24564
  })(ColorBlindnessMode || (ColorBlindnessMode = {}));
24567
24565
 
24566
+ ;// CONCATENATED MODULE: ./Graphics/PostProcessor/color-blind-fragment.glsl
24567
+ /* harmony default export */ const color_blind_fragment = ("precision mediump float;\n// our texture\nuniform sampler2D u_image;\n// the texCoords passed in from the vertex shader.\nvarying vec2 v_texcoord;\n\n// color blind type\nuniform int u_type;\n\n// simulation?\nuniform bool u_simulate;\n\nvoid main() {\n vec4 o = texture2D(u_image, v_texcoord);\n // RGB to LMS matrix conversion\n float L = (17.8824 * o.r) + (43.5161 * o.g) + (4.11935 * o.b);\n float M = (3.45565 * o.r) + (27.1554 * o.g) + (3.86714 * o.b);\n float S = (0.0299566 * o.r) + (0.184309 * o.g) + (1.46709 * o.b);\n // Simulate color blindness\n float l;\n float m;\n float s;\n //MODE CODE//\n if (u_type == 0) {\n // Protanope\n l = 0.0 * L + 2.02344 * M + -2.52581 * S;\n m = 0.0 * L + 1.0 * M + 0.0 * S;\n s = 0.0 * L + 0.0 * M + 1.0 * S;;\n } else if (u_type == 1) {\n // Deuteranope\n l = 1.0 * L + 0.0 * M + 0.0 * S;\n m = 0.494207 * L + 0.0 * M + 1.24827 * S;\n s = 0.0 * L + 0.0 * M + 1.0 * S;\n } else if (u_type == 2) {\n // Tritanope\n l = 1.0 * L + 0.0 * M + 0.0 * S;\n m = 0.0 * L + 1.0 * M + 0.0 * S;\n s = -0.395913 * L + 0.801109 * M + 0.0 * S;\n }\n\n // LMS to RGB matrix conversion\n vec4 error; // simulate the colors\n error.r = (0.0809444479 * l) + (-0.130504409 * m) + (0.116721066 * s);\n error.g = (-0.0102485335 * l) + (0.0540193266 * m) + (-0.113614708 * s);\n error.b = (-0.000365296938 * l) + (-0.00412161469 * m) + (0.693511405 * s);\n error.a = 1.0;\n vec4 diff = o - error;\n vec4 correction; // correct the colors\n correction.r = 0.0;\n correction.g = (diff.r * 0.7) + (diff.g * 1.0);\n correction.b = (diff.r * 0.7) + (diff.b * 1.0);\n correction = o + correction;\n correction.a = o.a;\n //SIMULATE//\n\n // sim \n if (u_simulate) {\n gl_FragColor = error.rgba;\n } else {\n gl_FragColor = correction.rgba;\n }\n}");
24568
24568
  ;// CONCATENATED MODULE: ./Graphics/PostProcessor/ScreenShader.ts
24569
24569
 
24570
24570
 
@@ -24644,27 +24644,31 @@ class ColorBlindnessPostProcessor {
24644
24644
  return this._shader.getLayout();
24645
24645
  }
24646
24646
  set colorBlindnessMode(colorBlindMode) {
24647
- const shader = this._shader.getShader();
24648
- shader.use();
24649
- if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
24650
- shader.setUniformInt('u_type', 0);
24651
- }
24652
- else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
24653
- shader.setUniformInt('u_type', 1);
24654
- }
24655
- else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
24656
- shader.setUniformInt('u_type', 2);
24657
- }
24658
24647
  this._colorBlindnessMode = colorBlindMode;
24648
+ if (this._shader) {
24649
+ const shader = this._shader.getShader();
24650
+ shader.use();
24651
+ if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
24652
+ shader.setUniformInt('u_type', 0);
24653
+ }
24654
+ else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
24655
+ shader.setUniformInt('u_type', 1);
24656
+ }
24657
+ else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
24658
+ shader.setUniformInt('u_type', 2);
24659
+ }
24660
+ }
24659
24661
  }
24660
24662
  get colorBlindnessMode() {
24661
24663
  return this._colorBlindnessMode;
24662
24664
  }
24663
24665
  set simulate(value) {
24664
- const shader = this._shader.getShader();
24665
- shader.use();
24666
24666
  this._simulate = value;
24667
- shader.setUniformBoolean('u_simulate', value);
24667
+ if (this._shader) {
24668
+ const shader = this._shader.getShader();
24669
+ shader.use();
24670
+ shader.setUniformBoolean('u_simulate', value);
24671
+ }
24668
24672
  }
24669
24673
  get simulate() {
24670
24674
  return this._simulate;
@@ -24674,20 +24678,42 @@ class ColorBlindnessPostProcessor {
24674
24678
  ;// CONCATENATED MODULE: ./Debug/DebugFlags.ts
24675
24679
 
24676
24680
 
24681
+
24677
24682
  class ColorBlindFlags {
24678
24683
  constructor(engine) {
24679
24684
  this._engine = engine;
24685
+ this._colorBlindPostProcessor = new ColorBlindnessPostProcessor(ColorBlindnessMode.Protanope);
24680
24686
  }
24687
+ /**
24688
+ * Correct colors for a specified color blindness
24689
+ * @param colorBlindness
24690
+ */
24681
24691
  correct(colorBlindness) {
24682
24692
  if (this._engine.graphicsContext instanceof ExcaliburGraphicsContextWebGL) {
24683
- this._engine.graphicsContext.addPostProcessor(new ColorBlindnessPostProcessor(colorBlindness, false));
24693
+ this.clear();
24694
+ this._colorBlindPostProcessor.colorBlindnessMode = colorBlindness;
24695
+ this._colorBlindPostProcessor.simulate = false;
24696
+ this._engine.graphicsContext.addPostProcessor(this._colorBlindPostProcessor);
24684
24697
  }
24685
24698
  }
24699
+ /**
24700
+ * Simulate colors for a specified color blindness
24701
+ * @param colorBlindness
24702
+ */
24686
24703
  simulate(colorBlindness) {
24687
24704
  if (this._engine.graphicsContext instanceof ExcaliburGraphicsContextWebGL) {
24688
- this._engine.graphicsContext.addPostProcessor(new ColorBlindnessPostProcessor(colorBlindness, true));
24705
+ this.clear();
24706
+ this._colorBlindPostProcessor.colorBlindnessMode = colorBlindness;
24707
+ this._colorBlindPostProcessor.simulate = true;
24708
+ this._engine.graphicsContext.addPostProcessor(this._colorBlindPostProcessor);
24689
24709
  }
24690
24710
  }
24711
+ /**
24712
+ * Remove color blindness post processor
24713
+ */
24714
+ clear() {
24715
+ this._engine.graphicsContext.removePostProcessor(this._colorBlindPostProcessor);
24716
+ }
24691
24717
  }
24692
24718
 
24693
24719
  ;// CONCATENATED MODULE: ./Debug/Debug.ts
@@ -30095,7 +30121,7 @@ Promises_Promise = Promise_1 = Promises_decorate([
30095
30121
  * The current Excalibur version string
30096
30122
  * @description `process.env.__EX_VERSION` gets replaced by Webpack on build
30097
30123
  */
30098
- const EX_VERSION = "0.26.0-alpha.378+e63c96f";
30124
+ const EX_VERSION = "0.26.0-alpha.379+f4d3bed";
30099
30125
 
30100
30126
  polyfill();
30101
30127
  // This file is used as the bundle entry point and exports everything