• 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/ScreenShader.ts
1
import { Logger } from '../../Util/Log';
2
import { ExcaliburGraphicsContextWebGL } from '../Context/ExcaliburGraphicsContextWebGL';
3
import { Shader } from '../Context/shader';
4
import { VertexBuffer } from '../Context/vertex-buffer';
5
import { VertexLayout } from '../Context/vertex-layout';
6

7
/**
8
 * Helper that defines a whole screen renderer, just provide a fragment source!
9
 *
10
 * Currently supports 1 varying
11
 * - vec2 a_texcoord between 0-1 which corresponds to screen position
12
 */
13
export class ScreenShader {
14
  private _shader: Shader;
15
  private _buffer: VertexBuffer;
16
  private _layout: VertexLayout;
17
  constructor(context: ExcaliburGraphicsContextWebGL, fragmentSource: string) {
UNCOV
18
    if (process.env.NODE_ENV === 'development') {
×
UNCOV
19
      if (fragmentSource.includes('v_texcoord')) {
×
UNCOV
20
        Logger.getInstance().warn(
×
21
          `ScreenShader: "v_texcoord" is deprecated in postprocessing fragment shaders will be removed in v1.0,` +
22
            ` use "v_uv" instead. Source [${fragmentSource}]`
23
        );
24
      }
25
    }
UNCOV
26
    const gl = context.__gl;
×
UNCOV
27
    this._shader = new Shader({
×
28
      graphicsContext: context,
29
      vertexSource: `#version 300 es
30
      in vec2 a_position;
31
      in vec2 a_uv;
32
      out vec2 v_texcoord;
33
      out vec2 v_uv;
34

35
      void main() {
36
        gl_Position = vec4(a_position, 0.0, 1.0);
37
        // Pass the texcoord to the fragment shader.
38
        v_texcoord = a_uv;
39
        v_uv = a_uv;
40
      }`,
41
      fragmentSource: fragmentSource
42
    });
UNCOV
43
    this._shader.compile();
×
44
    // Setup memory layout
UNCOV
45
    this._buffer = new VertexBuffer({
×
46
      gl,
47
      type: 'static',
48
      // clip space quad + uv since we don't need a camera
49
      data: new Float32Array([
50
        -1, -1, 0, 0, -1, 1, 0, 1, 1, -1, 1, 0,
51

52
        1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1
53
      ])
54
    });
UNCOV
55
    this._layout = new VertexLayout({
×
56
      gl,
57
      shader: this._shader,
58
      vertexBuffer: this._buffer,
59
      attributes: [
60
        ['a_position', 2],
61
        ['a_uv', 2]
62
      ]
63
    });
UNCOV
64
    this._buffer.upload();
×
65
  }
66

67
  public getShader() {
UNCOV
68
    return this._shader;
×
69
  }
70
  public getLayout() {
UNCOV
71
    return this._layout;
×
72
  }
73
}
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