• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

excaliburjs / Excalibur / 14804036802

02 May 2025 09:58PM UTC coverage: 5.927% (-83.4%) from 89.28%
14804036802

Pull #3404

github

web-flow
Merge 5c103d7f8 into 0f2ccaeb2
Pull Request #3404: feat: added Graph module to Math

234 of 8383 branches covered (2.79%)

229 of 246 new or added lines in 1 file covered. (93.09%)

13145 existing lines in 208 files now uncovered.

934 of 15759 relevant lines covered (5.93%)

4.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/engine/Graphics/PostProcessor/ColorBlindnessPostProcessor.ts
1
import colorBlindCorrectSource from './color-blind-fragment.glsl';
2
import { PostProcessor } from './PostProcessor';
3
import { ColorBlindnessMode } from './ColorBlindnessMode';
4
import { Shader } from '../Context/shader';
5
import { VertexLayout } from '../Context/vertex-layout';
6
import { ScreenShader } from './ScreenShader';
7
import { ExcaliburGraphicsContextWebGL } from '../Context/ExcaliburGraphicsContextWebGL';
8

9
export class ColorBlindnessPostProcessor implements PostProcessor {
10
  private _shader!: ScreenShader;
UNCOV
11
  private _simulate = false;
×
12
  constructor(
UNCOV
13
    private _colorBlindnessMode: ColorBlindnessMode,
×
14
    simulate = false
×
15
  ) {
UNCOV
16
    this._simulate = simulate;
×
17
  }
18

19
  initialize(graphicsContext: ExcaliburGraphicsContextWebGL): void {
UNCOV
20
    this._shader = new ScreenShader(graphicsContext, colorBlindCorrectSource);
×
UNCOV
21
    this.simulate = this._simulate;
×
UNCOV
22
    this.colorBlindnessMode = this._colorBlindnessMode;
×
23
  }
24

25
  getShader(): Shader {
UNCOV
26
    return this._shader.getShader();
×
27
  }
28

29
  getLayout(): VertexLayout {
UNCOV
30
    return this._shader.getLayout();
×
31
  }
32

33
  set colorBlindnessMode(colorBlindMode: ColorBlindnessMode) {
UNCOV
34
    this._colorBlindnessMode = colorBlindMode;
×
UNCOV
35
    if (this._shader) {
×
UNCOV
36
      const shader = this._shader.getShader();
×
UNCOV
37
      shader.use();
×
UNCOV
38
      if (this._colorBlindnessMode === ColorBlindnessMode.Protanope) {
×
UNCOV
39
        shader.setUniformInt('u_type', 0);
×
UNCOV
40
      } else if (this._colorBlindnessMode === ColorBlindnessMode.Deuteranope) {
×
UNCOV
41
        shader.setUniformInt('u_type', 1);
×
UNCOV
42
      } else if (this._colorBlindnessMode === ColorBlindnessMode.Tritanope) {
×
UNCOV
43
        shader.setUniformInt('u_type', 2);
×
44
      }
45
    }
46
  }
47

48
  get colorBlindnessMode(): ColorBlindnessMode {
49
    return this._colorBlindnessMode;
×
50
  }
51

52
  set simulate(value: boolean) {
UNCOV
53
    this._simulate = value;
×
UNCOV
54
    if (this._shader) {
×
UNCOV
55
      const shader = this._shader.getShader();
×
UNCOV
56
      shader.use();
×
UNCOV
57
      shader.setUniformBoolean('u_simulate', value);
×
58
    }
59
  }
60

61
  get simulate(): boolean {
62
    return this._simulate;
×
63
  }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc