melonjs 19.1.0 → 19.3.0
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.
- package/README.md +19 -15
- package/build/application/application.d.ts +33 -0
- package/build/application/application.d.ts.map +1 -1
- package/build/application/settings.d.ts +1 -0
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +45 -22
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/effects/camera_effect.d.ts +45 -0
- package/build/camera/effects/camera_effect.d.ts.map +1 -0
- package/build/camera/effects/fade_effect.d.ts +60 -0
- package/build/camera/effects/fade_effect.d.ts.map +1 -0
- package/build/camera/effects/mask_effect.d.ts +88 -0
- package/build/camera/effects/mask_effect.d.ts.map +1 -0
- package/build/camera/effects/shake_effect.d.ts +47 -0
- package/build/camera/effects/shake_effect.d.ts.map +1 -0
- package/build/index.d.ts +10 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4283 -1315
- package/build/index.js.map +4 -4
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/math/color_matrix.d.ts +51 -0
- package/build/math/color_matrix.d.ts.map +1 -0
- package/build/math/matrix2d.d.ts +6 -6
- package/build/math/matrix3d.d.ts +17 -0
- package/build/math/matrix3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +19 -5
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +4 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +200 -31
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/bounds.d.ts +5 -2
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/quadtree.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -1
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +13 -2
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/light2d.d.ts +128 -18
- package/build/renderable/light2d.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +54 -35
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +38 -6
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +33 -5
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +27 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +44 -19
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/state/stage.d.ts +65 -9
- package/build/state/stage.d.ts.map +1 -1
- package/build/state/state.d.ts +44 -2
- package/build/state/state.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +9 -0
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/buffer/index.d.ts +40 -0
- package/build/video/buffer/index.d.ts.map +1 -0
- package/build/video/{webgl/buffer → buffer}/vertex.d.ts +5 -3
- package/build/video/buffer/vertex.d.ts.map +1 -0
- package/build/video/canvas/canvas_renderer.d.ts +2 -0
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/renderer.d.ts +141 -0
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +27 -0
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +26 -63
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +73 -0
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -0
- package/build/video/rendertarget/rendertarget.d.ts +77 -0
- package/build/video/rendertarget/rendertarget.d.ts.map +1 -0
- package/build/video/rendertarget/webglrendertarget.d.ts +30 -0
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts +26 -2
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +10 -4
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +109 -0
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgl/batchers/quad_batcher.d.ts +34 -3
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +5 -34
- package/build/video/webgl/buffer/index.d.ts.map +1 -1
- package/build/video/webgl/effects/colorMatrix.d.ts +92 -0
- package/build/video/webgl/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/webgl/effects/desaturate.d.ts +2 -4
- package/build/video/webgl/effects/desaturate.d.ts.map +1 -1
- package/build/video/webgl/effects/invert.d.ts +2 -2
- package/build/video/webgl/effects/invert.d.ts.map +1 -1
- package/build/video/webgl/effects/radialGradient.d.ts +105 -0
- package/build/video/webgl/effects/radialGradient.d.ts.map +1 -0
- package/build/video/webgl/effects/sepia.d.ts +2 -2
- package/build/video/webgl/effects/sepia.d.ts.map +1 -1
- package/build/video/webgl/effects/vignette.d.ts +42 -0
- package/build/video/webgl/effects/vignette.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +13 -0
- package/build/video/webgl/lighting/constants.d.ts.map +1 -0
- package/build/video/webgl/lighting/pack.d.ts +76 -0
- package/build/video/webgl/lighting/pack.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +23 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +24 -7
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/video/webgl/buffer/vertex.d.ts.map +0 -1
|
@@ -1,54 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A WebGL Index Buffer
|
|
3
|
-
* Can be used for static patterns (e.g. quad indices) or dynamic indexed drawing.
|
|
2
|
+
* A WebGL Index Buffer — extends {@link IndexBuffer} with GL buffer binding and upload.
|
|
4
3
|
* @ignore
|
|
5
4
|
*/
|
|
6
|
-
export default class IndexBuffer {
|
|
5
|
+
export default class WebGLIndexBuffer extends IndexBuffer {
|
|
7
6
|
/**
|
|
8
7
|
* @param {WebGLRenderingContext|WebGL2RenderingContext} gl - the WebGL context
|
|
9
8
|
* @param {number} maxIndices - maximum number of indices this buffer can hold
|
|
10
9
|
* @param {boolean} [useUint32=false] - use Uint32 indices (WebGL2) instead of Uint16 (WebGL1)
|
|
11
|
-
* @param {boolean} [dynamic=false] - if true, use STREAM_DRAW for frequent updates; if false, use STATIC_DRAW
|
|
12
10
|
*/
|
|
13
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, maxIndices: number, useUint32?: boolean
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, maxIndices: number, useUint32?: boolean);
|
|
14
12
|
gl: WebGLRenderingContext | WebGL2RenderingContext;
|
|
15
|
-
dynamic: boolean;
|
|
16
13
|
type: 5123 | 5125;
|
|
17
|
-
data: Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>;
|
|
18
|
-
/**
|
|
19
|
-
* the current number of indices in the buffer
|
|
20
|
-
* @type {number}
|
|
21
|
-
*/
|
|
22
|
-
length: number;
|
|
23
14
|
buffer: WebGLBuffer;
|
|
24
|
-
/**
|
|
25
|
-
* Fill the buffer with a repeating quad index pattern [0,1,2, 2,1,3, 4,5,6, ...]
|
|
26
|
-
* and upload as a static buffer.
|
|
27
|
-
* @param {number} maxQuads - number of quads to generate indices for
|
|
28
|
-
*/
|
|
29
|
-
fillQuadPattern(maxQuads: number): void;
|
|
30
|
-
/**
|
|
31
|
-
* Reset the index count (for dynamic buffers)
|
|
32
|
-
*/
|
|
33
|
-
clear(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Add indices to the buffer, rebased by the given vertex offset
|
|
36
|
-
* @param {number[]} indices - source indices to add
|
|
37
|
-
* @param {number} vertexOffset - value to add to each index (vertex count at time of insertion)
|
|
38
|
-
*/
|
|
39
|
-
add(indices: number[], vertexOffset: number): void;
|
|
40
|
-
/**
|
|
41
|
-
* Add pre-computed absolute indices to the buffer (no rebasing)
|
|
42
|
-
* @param {number[]} indices - absolute index values to add
|
|
43
|
-
*/
|
|
44
|
-
addRaw(indices: number[]): void;
|
|
45
15
|
/**
|
|
46
16
|
* Upload the current index data to the GPU (for dynamic buffers)
|
|
47
17
|
*/
|
|
48
18
|
upload(): void;
|
|
49
19
|
/**
|
|
50
|
-
*
|
|
20
|
+
* Bind this index buffer
|
|
51
21
|
*/
|
|
52
22
|
bind(): void;
|
|
53
23
|
}
|
|
24
|
+
import IndexBuffer from "../../buffer/index.js";
|
|
54
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/index.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;IACC;;;;OAIG;IACH,gBAJW,qBAAqB,GAAC,sBAAsB,cAC5C,MAAM,cACN,OAAO,EAOjB;IAHA,mDAAY;IACZ,kBAA2D;IAC3D,oBAA+B;IAiBhC;;OAEG;IACH,eAOC;IAED;;OAEG;IACH,aAEC;CACD;wBApDuB,uBAAuB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shader effect that applies a 4x4 color transformation matrix.
|
|
3
|
+
* Provides chainable color adjustment methods that automatically update the GPU uniform.
|
|
4
|
+
* @category Effects
|
|
5
|
+
* @see {@link Renderable.shader} for usage
|
|
6
|
+
* @example
|
|
7
|
+
* // desaturate a sprite
|
|
8
|
+
* mySprite.shader = new ColorMatrixEffect(renderer).saturate(0.0);
|
|
9
|
+
* @example
|
|
10
|
+
* // combine brightness + contrast on a camera
|
|
11
|
+
* camera.shader = new ColorMatrixEffect(renderer).brightness(1.3).contrast(1.5);
|
|
12
|
+
* @example
|
|
13
|
+
* // update dynamically
|
|
14
|
+
* effect.reset().brightness(1.5).saturate(0.5);
|
|
15
|
+
*/
|
|
16
|
+
export default class ColorMatrixEffect extends ShaderEffect {
|
|
17
|
+
/**
|
|
18
|
+
* @param {import("../webgl_renderer.js").default} renderer - the current renderer instance
|
|
19
|
+
* @param {object} [options] - effect options
|
|
20
|
+
* @param {ColorMatrix} [options.matrix] - an initial color matrix. Defaults to identity.
|
|
21
|
+
*/
|
|
22
|
+
constructor(renderer: import("../webgl_renderer.js").default, options?: {
|
|
23
|
+
matrix?: ColorMatrix | undefined;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* the internal color matrix
|
|
27
|
+
* @ignore
|
|
28
|
+
*/
|
|
29
|
+
_matrix: ColorMatrix;
|
|
30
|
+
/**
|
|
31
|
+
* Push the current matrix values to the GPU.
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
34
|
+
_syncUniform(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Reset the color matrix to identity (no color change).
|
|
37
|
+
* @returns {this} this instance for chaining
|
|
38
|
+
*/
|
|
39
|
+
reset(): this;
|
|
40
|
+
/**
|
|
41
|
+
* Apply a brightness adjustment.
|
|
42
|
+
* @param {number} amount - brightness multiplier (1.0 = normal, >1 brighter, <1 darker)
|
|
43
|
+
* @returns {this} this instance for chaining
|
|
44
|
+
*/
|
|
45
|
+
brightness(amount: number): this;
|
|
46
|
+
/**
|
|
47
|
+
* Apply a contrast adjustment.
|
|
48
|
+
* @param {number} amount - contrast multiplier (1.0 = normal, >1 more contrast, <1 less)
|
|
49
|
+
* @returns {this} this instance for chaining
|
|
50
|
+
*/
|
|
51
|
+
contrast(amount: number): this;
|
|
52
|
+
/**
|
|
53
|
+
* Apply a saturation adjustment.
|
|
54
|
+
* @param {number} amount - saturation level (0.0 = grayscale, 1.0 = normal, >1 over-saturated)
|
|
55
|
+
* @returns {this} this instance for chaining
|
|
56
|
+
*/
|
|
57
|
+
saturate(amount: number): this;
|
|
58
|
+
/**
|
|
59
|
+
* Apply a hue rotation.
|
|
60
|
+
* @param {number} angle - rotation angle in radians
|
|
61
|
+
* @returns {this} this instance for chaining
|
|
62
|
+
*/
|
|
63
|
+
hueRotate(angle: number): this;
|
|
64
|
+
/**
|
|
65
|
+
* Apply a sepia tone.
|
|
66
|
+
* @param {number} [amount=1.0] - sepia intensity (0.0 = original, 1.0 = full sepia)
|
|
67
|
+
* @returns {this} this instance for chaining
|
|
68
|
+
*/
|
|
69
|
+
sepia(amount?: number): this;
|
|
70
|
+
/**
|
|
71
|
+
* Apply a color inversion.
|
|
72
|
+
* @param {number} [amount=1.0] - inversion amount (0.0 = original, 1.0 = fully inverted)
|
|
73
|
+
* @returns {this} this instance for chaining
|
|
74
|
+
*/
|
|
75
|
+
invertColors(amount?: number): this;
|
|
76
|
+
/**
|
|
77
|
+
* Multiply the current matrix by another color matrix.
|
|
78
|
+
* @param {ColorMatrix} matrix - the matrix to multiply with
|
|
79
|
+
* @returns {this} this instance for chaining
|
|
80
|
+
*/
|
|
81
|
+
multiply(matrix: ColorMatrix): this;
|
|
82
|
+
/**
|
|
83
|
+
* Multiplies the current matrix with a transform described by individual values.
|
|
84
|
+
* Accepts either 6 values (2D affine: a, b, c, d, e, f) or 16 values (full 4x4 column-major).
|
|
85
|
+
* @param {...number} args - 6 or 16 numeric values
|
|
86
|
+
* @returns {this} this instance for chaining
|
|
87
|
+
*/
|
|
88
|
+
transform(...args: number[]): this;
|
|
89
|
+
}
|
|
90
|
+
import ShaderEffect from "../shadereffect.js";
|
|
91
|
+
import { ColorMatrix } from "../../../math/color_matrix.ts";
|
|
92
|
+
//# sourceMappingURL=colorMatrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorMatrix.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/colorMatrix.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAA8B,MAAM;KACtC,EAkBA;IANA;;;OAGG;IACH,qBAAkD;IAInD;;;OAGG;IACH,qBAEC;IAED;;;OAGG;IACH,SAFa,IAAI,CAMhB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,IAAI,CAMhB;IAED;;;;OAIG;IACH,iBAHW,WAAW,GACT,IAAI,CAMhB;IAED;;;;;OAKG;IACH,mBAHc,MAAM,EAAA,GACP,IAAI,CAMhB;CACD;yBApJwB,oBAAoB;4BADjB,+BAA+B"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A shader effect that desaturates (grayscales) the sprite.
|
|
3
|
-
* The `intensity` uniform controls how much color is removed
|
|
4
|
-
* (0.0 = full color, 1.0 = fully grayscale).
|
|
5
3
|
* Commonly used for disabled states, death effects, or petrification.
|
|
6
4
|
* @category Effects
|
|
7
5
|
* @see {@link Renderable.shader} for usage
|
|
@@ -12,7 +10,7 @@
|
|
|
12
10
|
* // partial desaturation (50%)
|
|
13
11
|
* mySprite.shader = new DesaturateEffect(renderer, { intensity: 0.5 });
|
|
14
12
|
*/
|
|
15
|
-
export default class DesaturateEffect extends
|
|
13
|
+
export default class DesaturateEffect extends ColorMatrixEffect {
|
|
16
14
|
/**
|
|
17
15
|
* @param {import("../webgl_renderer.js").default} renderer - the current renderer instance
|
|
18
16
|
* @param {object} [options] - effect options
|
|
@@ -28,5 +26,5 @@ export default class DesaturateEffect extends ShaderEffect {
|
|
|
28
26
|
*/
|
|
29
27
|
setIntensity(value: number): void;
|
|
30
28
|
}
|
|
31
|
-
import
|
|
29
|
+
import ColorMatrixEffect from "./colorMatrix.js";
|
|
32
30
|
//# sourceMappingURL=desaturate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"desaturate.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/desaturate.js"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"desaturate.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/desaturate.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,SAAS;KACpC,EAMA;IAHA,kBACgE;IAIjE;;;OAGG;IACH,oBAFW,MAAM,QAKhB;CACD;8BAnC6B,kBAAkB"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* // partial inversion
|
|
10
10
|
* mySprite.shader = new InvertEffect(renderer, { intensity: 0.5 });
|
|
11
11
|
*/
|
|
12
|
-
export default class InvertEffect extends
|
|
12
|
+
export default class InvertEffect extends ColorMatrixEffect {
|
|
13
13
|
/**
|
|
14
14
|
* @param {import("../webgl_renderer.js").default} renderer - the current renderer instance
|
|
15
15
|
* @param {object} [options] - effect options
|
|
@@ -25,5 +25,5 @@ export default class InvertEffect extends ShaderEffect {
|
|
|
25
25
|
*/
|
|
26
26
|
setIntensity(value: number): void;
|
|
27
27
|
}
|
|
28
|
-
import
|
|
28
|
+
import ColorMatrixEffect from "./colorMatrix.js";
|
|
29
29
|
//# sourceMappingURL=invert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/invert.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,SAAS;KACpC,
|
|
1
|
+
{"version":3,"file":"invert.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/invert.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,SAAS;KACpC,EAMA;IAHA,kBACgE;IAIjE;;;OAGG;IACH,oBAFW,MAAM,QAKhB;CACD;8BAlC6B,kBAAkB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* additional import for TypeScript
|
|
3
|
+
* @import { Color } from "../../../math/color.ts";
|
|
4
|
+
* @import { default as WebGLRenderer } from "../webgl_renderer.js";
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A procedural radial-gradient shader effect: solid color at the center
|
|
8
|
+
* fading linearly to fully transparent at the edge of the host quad.
|
|
9
|
+
* The falloff is naturally elliptical for non-square quads.
|
|
10
|
+
*
|
|
11
|
+
* **UV-space caveat.** The `apply(color, uv)` function receives
|
|
12
|
+
* `vRegion` — the atlas UVs of the host quad. The falloff math
|
|
13
|
+
* (`length(uv * 2 - 1)`) assumes those UVs span `[0, 1] × [0, 1]`,
|
|
14
|
+
* which is true when the quad samples a full-rect texture (a
|
|
15
|
+
* dedicated 1×1 white pixel, a non-atlased Sprite, an FBO blit, or
|
|
16
|
+
* the engine-provided light atlas used by `WebGLRenderer.drawLight`).
|
|
17
|
+
* If you attach this effect to a Sprite that uses a *sub-region* of a
|
|
18
|
+
* larger atlas, `uv` will be in `[u0..u1] × [v0..v1]` and the radial
|
|
19
|
+
* center will be misplaced. For atlas-based renderables, set the
|
|
20
|
+
* effect's `uColor`/`uIntensity` and pair it with a Sprite whose
|
|
21
|
+
* texture covers a full atlas, or use a Sprite created from a
|
|
22
|
+
* standalone image.
|
|
23
|
+
*
|
|
24
|
+
* The falloff curve is **linear** (`f = clamp(1 - d, 0, 1)`) to match
|
|
25
|
+
* the Canvas 2D `createRadialGradient` two-stop output exactly. Output
|
|
26
|
+
* is premultiplied so the result composes correctly under additive
|
|
27
|
+
* (`"lighter"`) blending across overlapping quads.
|
|
28
|
+
*
|
|
29
|
+
* Color & intensity come from **two stacked sources**, multiplied
|
|
30
|
+
* together: the `uColor`/`uIntensity` uniforms (set per-effect via
|
|
31
|
+
* `setColor` / `setIntensity` — the natural API for a single-instance
|
|
32
|
+
* shader attached to a renderable) AND the per-vertex tint coming
|
|
33
|
+
* through `aColor` (used by `WebGLRenderer.drawLight` to encode each
|
|
34
|
+
* light's color + intensity in the vertex stream so multiple lights
|
|
35
|
+
* sharing this shader can batch into a single draw call). For typical
|
|
36
|
+
* standalone usage the per-vertex tint is `(1,1,1,1)` and the uniforms
|
|
37
|
+
* drive the look; for the Light2d batching path the uniforms stay at
|
|
38
|
+
* defaults and the tint carries everything.
|
|
39
|
+
* @category Effects
|
|
40
|
+
* @example
|
|
41
|
+
* // Soft white spot, 50% peak alpha at center
|
|
42
|
+
* const spot = new RadialGradientEffect(renderer, { intensity: 0.5 });
|
|
43
|
+
* @example
|
|
44
|
+
* // Tinted hotspot — orange center, full brightness, sized via the
|
|
45
|
+
* // host quad's bounds
|
|
46
|
+
* const hot = new RadialGradientEffect(renderer, {
|
|
47
|
+
* color: new Color(255, 128, 64),
|
|
48
|
+
* intensity: 1.0,
|
|
49
|
+
* });
|
|
50
|
+
* hot.setIntensity(2.0); // pulse brighter at runtime
|
|
51
|
+
* @example
|
|
52
|
+
* // Pickup highlight — attach to any Renderable so it renders inside
|
|
53
|
+
* // the renderable's bounding rect (anchorPoint applies). Combine with
|
|
54
|
+
* // `blendMode = "lighter"` for the additive glow look.
|
|
55
|
+
* pickup.shader = new RadialGradientEffect(renderer, {
|
|
56
|
+
* color: new Color(120, 255, 200), // mint green
|
|
57
|
+
* intensity: 0.8,
|
|
58
|
+
* });
|
|
59
|
+
* pickup.blendMode = "lighter";
|
|
60
|
+
* @example
|
|
61
|
+
* // Damage / impact indicator — short-lived elliptical flash on hit.
|
|
62
|
+
* // The quad's width/height drive the falloff aspect for free.
|
|
63
|
+
* const flash = new RadialGradientEffect(renderer, {
|
|
64
|
+
* color: new Color(255, 32, 32),
|
|
65
|
+
* intensity: 1.5,
|
|
66
|
+
* });
|
|
67
|
+
* // animate intensity to fade out
|
|
68
|
+
* tween.to({ intensity: 0 }, 200).onUpdate((s) => flash.setIntensity(s.intensity));
|
|
69
|
+
* @example
|
|
70
|
+
* // Debug overlay — draw a soft circle wherever the player is to mark
|
|
71
|
+
* // a trigger zone, without baking a texture per zone.
|
|
72
|
+
* const zoneMarker = new RadialGradientEffect(renderer, {
|
|
73
|
+
* color: new Color(80, 160, 255),
|
|
74
|
+
* intensity: 0.4,
|
|
75
|
+
* });
|
|
76
|
+
*/
|
|
77
|
+
export default class RadialGradientEffect extends ShaderEffect {
|
|
78
|
+
/**
|
|
79
|
+
* @param {WebGLRenderer} renderer - the current renderer instance
|
|
80
|
+
* @param {object} [options] - initial uniform values
|
|
81
|
+
* @param {Color} [options.color] - center color (0..255 RGB); defaults to white
|
|
82
|
+
* @param {number} [options.intensity=1] - peak alpha at the center (0..1+)
|
|
83
|
+
*/
|
|
84
|
+
constructor(renderer: WebGLRenderer, options?: {
|
|
85
|
+
color?: Color | undefined;
|
|
86
|
+
intensity?: number | undefined;
|
|
87
|
+
});
|
|
88
|
+
_colorBuf: Float32Array<ArrayBuffer>;
|
|
89
|
+
/**
|
|
90
|
+
* Set the center color. RGB only — alpha is ignored (the radial
|
|
91
|
+
* falloff supplies the per-pixel alpha).
|
|
92
|
+
* @param {Color} color - 0..255 RGB color
|
|
93
|
+
*/
|
|
94
|
+
setColor(color: Color): void;
|
|
95
|
+
/**
|
|
96
|
+
* Set the peak intensity. Acts as a brightness multiplier on the
|
|
97
|
+
* falloff curve; values above 1 over-saturate the center of the gradient.
|
|
98
|
+
* @param {number} intensity - 0..1+ multiplier
|
|
99
|
+
*/
|
|
100
|
+
setIntensity(intensity: number): void;
|
|
101
|
+
}
|
|
102
|
+
import ShaderEffect from "../shadereffect.js";
|
|
103
|
+
import type { Color } from "../../../math/color.ts";
|
|
104
|
+
import type { default as WebGLRenderer } from "../webgl_renderer.js";
|
|
105
|
+
//# sourceMappingURL=radialGradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radialGradient.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/radialGradient.js"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH;IACC;;;;;OAKG;IACH,sBALW,aAAa,YAErB;QAAwB,KAAK;QACJ,SAAS;KACpC,EA0CA;IAZA,qCAAoC;IAcrC;;;;OAIG;IACH,gBAFW,KAAK,QAOf;IAED;;;;OAIG;IACH,wBAFW,MAAM,QAIhB;CACD;yBArJwB,oBAAoB;2BAInB,wBAAwB;8CACL,sBAAsB"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* // partial sepia
|
|
9
9
|
* mySprite.shader = new SepiaEffect(renderer, { intensity: 0.5 });
|
|
10
10
|
*/
|
|
11
|
-
export default class SepiaEffect extends
|
|
11
|
+
export default class SepiaEffect extends ColorMatrixEffect {
|
|
12
12
|
/**
|
|
13
13
|
* @param {import("../webgl_renderer.js").default} renderer - the current renderer instance
|
|
14
14
|
* @param {object} [options] - effect options
|
|
@@ -24,5 +24,5 @@ export default class SepiaEffect extends ShaderEffect {
|
|
|
24
24
|
*/
|
|
25
25
|
setIntensity(value: number): void;
|
|
26
26
|
}
|
|
27
|
-
import
|
|
27
|
+
import ColorMatrixEffect from "./colorMatrix.js";
|
|
28
28
|
//# sourceMappingURL=sepia.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sepia.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/sepia.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,SAAS;KACpC,
|
|
1
|
+
{"version":3,"file":"sepia.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/sepia.js"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,SAAS;KACpC,EAMA;IAHA,kBACgE;IAIjE;;;OAGG;IACH,oBAFW,MAAM,QAKhB;CACD;8BAjC6B,kBAAkB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shader effect that darkens the edges of the screen, drawing focus
|
|
3
|
+
* to the center. Commonly used for atmosphere, cinematic feel, or to
|
|
4
|
+
* naturally frame a camera viewport (e.g. minimap).
|
|
5
|
+
* @category Effects
|
|
6
|
+
* @see {@link Renderable.shader} for usage
|
|
7
|
+
* @example
|
|
8
|
+
* // subtle vignette on the main camera
|
|
9
|
+
* app.viewport.shader = new VignetteEffect(renderer);
|
|
10
|
+
* @example
|
|
11
|
+
* // stronger cinematic vignette
|
|
12
|
+
* app.viewport.shader = new VignetteEffect(renderer, {
|
|
13
|
+
* strength: 0.3,
|
|
14
|
+
* size: 20.0,
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
export default class VignetteEffect extends ShaderEffect {
|
|
18
|
+
/**
|
|
19
|
+
* @param {import("../webgl_renderer.js").default} renderer - the current renderer instance
|
|
20
|
+
* @param {object} [options] - effect options
|
|
21
|
+
* @param {number} [options.strength=0.15] - edge darkening power (lower = stronger darkening, higher = softer falloff)
|
|
22
|
+
* @param {number} [options.size=25.0] - vignette spread multiplier (higher = smaller dark area)
|
|
23
|
+
*/
|
|
24
|
+
constructor(renderer: import("../webgl_renderer.js").default, options?: {
|
|
25
|
+
strength?: number | undefined;
|
|
26
|
+
size?: number | undefined;
|
|
27
|
+
});
|
|
28
|
+
strength: number;
|
|
29
|
+
size: number;
|
|
30
|
+
/**
|
|
31
|
+
* set the vignette strength
|
|
32
|
+
* @param {number} strength - edge darkening power (lower = stronger, higher = softer)
|
|
33
|
+
*/
|
|
34
|
+
setStrength(strength: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* set the vignette size
|
|
37
|
+
* @param {number} size - spread multiplier (higher = smaller dark area)
|
|
38
|
+
*/
|
|
39
|
+
setSize(size: number): void;
|
|
40
|
+
}
|
|
41
|
+
import ShaderEffect from "../shadereffect.js";
|
|
42
|
+
//# sourceMappingURL=vignette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vignette.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/effects/vignette.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH;IACC;;;;;OAKG;IACH,sBALW,OAAO,sBAAsB,EAAE,OAAO,YAE9C;QAAyB,QAAQ;QACR,IAAI;KAC/B,EAoBA;IALA,iBAAwC;IACxC,aAAgC;IAMjC;;;OAGG;IACH,sBAFW,MAAM,QAKhB;IAED;;;OAGG;IACH,cAFW,MAAM,QAKhB;CACD;yBA/DwB,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;OAGG;IACH,QAFU,MAAM,CAKf;IAED;;;OAGG;IACH,UAFU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,KAAK,EAAE,CAEiC;IAElD;;;OAGG;IACH,SAFU,YAAY,CAOrB;IAED;;;OAGG;IACH,UAFU,MAAM,CAE8B;IAM/C;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CASjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QAiB7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,
|
|
1
|
+
{"version":3,"file":"glshader.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/glshader.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,gBA1BW,qBAAqB,UACrB,MAAM,YACN,MAAM,cACN,MAAM,EAyEhB;IAjDA;;;OAGG;IACH,IAFU,qBAAqB,CAEnB;IAEZ;;;OAGG;IACH,QAFU,MAAM,CAKf;IAED;;;OAGG;IACH,UAFU,MAAM,CAKf;IAED;;;OAGG;IACH,YAFU,KAAK,EAAE,CAEiC;IAElD;;;OAGG;IACH,SAFU,YAAY,CAOrB;IAED;;;OAGG;IACH,UAFU,MAAM,CAE8B;IAM/C;;OAEG;IACH,aAEC;IAED;;;;OAIG;IACH,wBAHW,MAAM,GACJ,KAAK,CASjB;IAED;;;;;;OAMG;IACH,iBALW,MAAM,SACN,MAAM,GAAC,YAAY,QAiB7B;IAED;;;;;OAKG;IACH,wBAJW,qBAAqB,cACrB,MAAM,EAAE,UACR,MAAM,QAmBhB;IAED;;OAEG;IACH,gBAQC;CACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants shared between the lit fragment shader (`multitexture-lit.js`),
|
|
3
|
+
* the lit batcher (`LitQuadBatcher`), and the uniform packer (`pack.ts`).
|
|
4
|
+
* Kept in a tiny standalone module so the three consumers don't depend on
|
|
5
|
+
* each other transitively for a single integer.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of `Light2d` instances the lit fragment shader supports
|
|
9
|
+
* concurrently per draw call. Lights past this index are ignored. Sized
|
|
10
|
+
* to keep the GLSL uniform arrays comfortably within WebGL1 limits.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MAX_LIGHTS = 8;
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/lighting/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU,IAAI,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-frame scratch buffer for `packLights()`. Pre-allocates one entry
|
|
3
|
+
* per light slot so the per-camera-per-frame upload doesn't allocate.
|
|
4
|
+
*/
|
|
5
|
+
export interface LightUniformScratch {
|
|
6
|
+
positions: Float32Array;
|
|
7
|
+
colors: Float32Array;
|
|
8
|
+
heights: Float32Array;
|
|
9
|
+
ambient: number[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Result of `packLights()` — typed-array views into the scratch plus the
|
|
13
|
+
* actual count. `WebGLRenderer.setLightUniforms` forwards this to
|
|
14
|
+
* `LitQuadBatcher.setLightUniforms` for upload.
|
|
15
|
+
*/
|
|
16
|
+
export interface LightUniforms extends LightUniformScratch {
|
|
17
|
+
count: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Allocate a fresh scratch buffer sized for `MAX_LIGHTS` slots. One per
|
|
21
|
+
* renderer is enough; reuse across frames.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createLightUniformScratch(): LightUniformScratch;
|
|
24
|
+
/**
|
|
25
|
+
* Light2d-shaped duck-type — anything `packLights()` reads from. Avoids
|
|
26
|
+
* importing `Light2d` directly (keeps this module renderer-agnostic).
|
|
27
|
+
*/
|
|
28
|
+
interface LightLike {
|
|
29
|
+
getBounds(): {
|
|
30
|
+
centerX: number;
|
|
31
|
+
centerY: number;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
};
|
|
35
|
+
intensity: number;
|
|
36
|
+
color: {
|
|
37
|
+
r: number;
|
|
38
|
+
g: number;
|
|
39
|
+
b: number;
|
|
40
|
+
};
|
|
41
|
+
lightHeight: number;
|
|
42
|
+
}
|
|
43
|
+
/** Color-shaped duck-type for the ambient floor. */
|
|
44
|
+
interface ColorLike {
|
|
45
|
+
r: number;
|
|
46
|
+
g: number;
|
|
47
|
+
b: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Pack the active scene lights into the scratch buffer in a shape the
|
|
51
|
+
* lit fragment shader uploads directly.
|
|
52
|
+
*
|
|
53
|
+
* Light positions are translated from world-space (where
|
|
54
|
+
* `light.getBounds().centerX/Y` lives) into the renderer's
|
|
55
|
+
* pre-projection coords by subtracting `(translateX, translateY)` —
|
|
56
|
+
* the same translate `Camera2d.draw()` applies to the world container.
|
|
57
|
+
* This matches what `Stage.drawLighting` does for the cutout pass, so
|
|
58
|
+
* the lit fragment's `lightPos - vWorldPos` math lines up with the
|
|
59
|
+
* camera's view.
|
|
60
|
+
*
|
|
61
|
+
* Lights past `MAX_LIGHTS` (8) are silently dropped. Unused slots are
|
|
62
|
+
* zero-filled so stale data from a previous frame can't leak into the
|
|
63
|
+
* shader.
|
|
64
|
+
*
|
|
65
|
+
* Pure function: deterministic given the same inputs, no I/O, scratch
|
|
66
|
+
* is the only mutable target.
|
|
67
|
+
* @param lights - active lights iterable (e.g. `Stage._activeLights`); falsy treated as empty
|
|
68
|
+
* @param ambient - ambient floor color (0..255 RGB); falsy treated as black
|
|
69
|
+
* @param translateX - world-to-screen X translate (matches `Camera2d.draw()`)
|
|
70
|
+
* @param translateY - world-to-screen Y translate
|
|
71
|
+
* @param scratch - pre-allocated scratch (see `createLightUniformScratch`)
|
|
72
|
+
* @returns the scratch with `count` filled in
|
|
73
|
+
*/
|
|
74
|
+
export declare function packLights(lights: Iterable<LightLike> | null | undefined, ambient: ColorLike | null | undefined, translateX: number, translateY: number, scratch: LightUniformScratch): LightUniforms;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/lighting/pack.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,YAAY,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACzD,KAAK,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,CAO/D;AAED;;;GAGG;AACH,UAAU,SAAS;IAClB,SAAS,IAAI;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KACf,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,oDAAoD;AACpD,UAAU,SAAS;IAClB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,CACzB,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,EAAE,SAAS,GAAG,IAAI,GAAG,SAAS,EACrC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,mBAAmB,GAC1B,aAAa,CA4Cf"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate the fragment shader for `LitQuadBatcher` — the SpriteIlluminator
|
|
3
|
+
* path that supports per-pixel normal-map lighting from up to `MAX_LIGHTS`
|
|
4
|
+
* point lights.
|
|
5
|
+
*
|
|
6
|
+
* Sprites without a `normalMap` push `aNormalTextureId = -1` and take the
|
|
7
|
+
* unlit fast path inside this same shader (sample color, multiply by
|
|
8
|
+
* vertex color, return) so lit and unlit sprites can share the lit batch
|
|
9
|
+
* when they coexist with active lights. The cost vs the truly-unlit
|
|
10
|
+
* `QuadBatcher` shader is one varying read + one comparison per fragment.
|
|
11
|
+
*
|
|
12
|
+
* The light's "height above the sprite plane" is encoded as a small
|
|
13
|
+
* fraction of the light's radius (default `0.075`) so that lights
|
|
14
|
+
* exactly at a fragment's screen position don't produce degenerate
|
|
15
|
+
* flat shading.
|
|
16
|
+
* @param {number} maxTextures - the number of color/normal texture units to support
|
|
17
|
+
* @returns {string} GLSL fragment shader source
|
|
18
|
+
* @ignore
|
|
19
|
+
*/
|
|
20
|
+
export function buildLitMultiTextureFragment(maxTextures: number): string;
|
|
21
|
+
export { MAX_LIGHTS };
|
|
22
|
+
import { MAX_LIGHTS } from "../lighting/constants.ts";
|
|
23
|
+
//# sourceMappingURL=multitexture-lit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multitexture-lit.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/shaders/multitexture-lit.js"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,0DAJW,MAAM,GACJ,MAAM,CAiFlB;;2BAjI0B,0BAA0B"}
|
|
@@ -16,6 +16,12 @@ export default class WebGLRenderer extends Renderer {
|
|
|
16
16
|
* @type {WebGLRenderingContext}
|
|
17
17
|
*/
|
|
18
18
|
gl: WebGLRenderingContext;
|
|
19
|
+
/**
|
|
20
|
+
* Saved projection matrix for begin/endPostEffect.
|
|
21
|
+
* @type {Matrix3d}
|
|
22
|
+
* @ignore
|
|
23
|
+
*/
|
|
24
|
+
_savedEffectProjection: Matrix3d;
|
|
19
25
|
/**
|
|
20
26
|
* sets or returns the thickness of lines for shape drawing
|
|
21
27
|
* @type {number}
|
|
@@ -54,6 +60,7 @@ export default class WebGLRenderer extends Renderer {
|
|
|
54
60
|
x: number;
|
|
55
61
|
y: number;
|
|
56
62
|
}[];
|
|
63
|
+
_clipAABB: Bounds;
|
|
57
64
|
_polyVerts: any[];
|
|
58
65
|
_currentGradient: any;
|
|
59
66
|
/**
|
|
@@ -85,6 +92,8 @@ export default class WebGLRenderer extends Renderer {
|
|
|
85
92
|
* @default 1
|
|
86
93
|
*/
|
|
87
94
|
get WebGLVersion(): number;
|
|
95
|
+
_lightShader: RadialGradientEffect | undefined;
|
|
96
|
+
_lightAtlas: TextureAtlas | undefined;
|
|
88
97
|
/**
|
|
89
98
|
* add a new batcher to this renderer
|
|
90
99
|
* @param {Batcher} batcher - a batcher instance
|
|
@@ -116,14 +125,20 @@ export default class WebGLRenderer extends Renderer {
|
|
|
116
125
|
* let basic = renderer.createPattern(image, "no-repeat");
|
|
117
126
|
*/
|
|
118
127
|
createPattern(image: HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | VideoFrame, repeat: string): TextureAtlas;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
128
|
+
_lightUniformsScratch: import("./lighting/pack.ts").LightUniformScratch | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Lazy-init a shared 1×1 white `TextureAtlas` used as the source
|
|
131
|
+
* texture for `drawLight`'s procedural shader. The shader ignores
|
|
132
|
+
* the sampled color, but `addQuad`'s vertex format includes a
|
|
133
|
+
* texture-unit attribute so we still need a real texture; sharing
|
|
134
|
+
* one across every light keeps them on the same multi-texture slot
|
|
135
|
+
* (no flush on light switch).
|
|
136
|
+
* @returns {TextureAtlas}
|
|
137
|
+
* @ignore
|
|
125
138
|
*/
|
|
126
|
-
|
|
139
|
+
_getLightAtlas(): TextureAtlas;
|
|
140
|
+
/** @ignore */
|
|
141
|
+
endPostEffect(renderable: any): void;
|
|
127
142
|
/**
|
|
128
143
|
* Clears the gl context with the given color.
|
|
129
144
|
* @param {Color|string} [color="#000000"] - CSS color.
|
|
@@ -512,8 +527,10 @@ export default class WebGLRenderer extends Renderer {
|
|
|
512
527
|
}
|
|
513
528
|
import Renderer from "./../renderer.js";
|
|
514
529
|
import { Matrix3d } from "../../math/matrix3d.ts";
|
|
530
|
+
import { Bounds } from "../../physics/bounds.ts";
|
|
515
531
|
import type { Batcher } from "./batchers/batcher.js";
|
|
516
532
|
import TextureCache from "./../texture/cache.js";
|
|
533
|
+
import RadialGradientEffect from "./effects/radialGradient.js";
|
|
517
534
|
import { TextureAtlas } from "./../texture/atlas.js";
|
|
518
535
|
import { Color } from "./../../math/color.ts";
|
|
519
536
|
import type { Rect } from "./../../geometries/rectangle.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/webgl/webgl_renderer.js"],"names":[],"mappings":"AAqDA;;;GAGG;AACH;IAQE;;;;;OAKG;IACH,oBAJU,MAAM,CAIU;IAU1B;;;;OAIG;IACH,IAFU,qBAAqB,CAEI;IAYnC;;;;OAIG;IACH,wBAHU,QAAQ,CAG0B;IAE5C;;;;OAIG;IACH,WAHU,MAAM,CAGE;IAElB;;;;;OAKG;IACH,UAHU,MAAM,CAGO;IAEvB;;;OAGG;IACH,cAFU,WAAW,CAEqB;IAE1C;;;;OAIG;IACH,sBAHU,MAAM,CAGwD;IAExE;;;;OAIG;IACH,iBAHU,MAAM,CAMf;IAED;;;OAGG;IACH;;;QAEE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G;IACH,YALW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,QA+EhB;IAED;;;;;;;OAOG;IACH,eAHW,IAAI,GAAC,SAAS,GAAC,OAAO,GAAC,IAAI,GAAC,OAAO,WACnC,OAAO,QA6CjB;;CAcD;qBA7yEoB,kBAAkB;yBAXd,wBAAwB;uBAC1B,yBAAyB;6BAqCtB,uBAAuB;yBAvBxB,uBAAuB;iCAUf,6BAA6B;6BAXpB,uBAAuB;sBAhBhC,uBAAuB;0BAiCjC,iCAAiC;+BAC5B,iCAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;IACC,6CAeC;IAbA,gBAA4B;IAE5B,eAA0B;IAE1B,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAG9C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;;;;;;OASG;IACH,QARW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QACN,MAAM,cACN,MAAM,QAkBhB;IAED;;;;;;OAMG;IACH,iBALW,SAAS,CAAC,MAAM,CAAC,aACjB,MAAM,SACN,MAAM,QAahB;IAED;;;OAGG;IACH,kEAaC;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;CACD"}
|