melonjs 19.0.0 → 19.2.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.
Files changed (94) hide show
  1. package/README.md +7 -5
  2. package/build/application/application.d.ts +33 -0
  3. package/build/application/application.d.ts.map +1 -1
  4. package/build/application/defaultApplicationSettings.d.ts +1 -0
  5. package/build/application/defaultApplicationSettings.d.ts.map +1 -1
  6. package/build/application/settings.d.ts +47 -1
  7. package/build/application/settings.d.ts.map +1 -1
  8. package/build/camera/camera2d.d.ts +45 -22
  9. package/build/camera/camera2d.d.ts.map +1 -1
  10. package/build/camera/effects/camera_effect.d.ts +45 -0
  11. package/build/camera/effects/camera_effect.d.ts.map +1 -0
  12. package/build/camera/effects/fade_effect.d.ts +60 -0
  13. package/build/camera/effects/fade_effect.d.ts.map +1 -0
  14. package/build/camera/effects/mask_effect.d.ts +88 -0
  15. package/build/camera/effects/mask_effect.d.ts.map +1 -0
  16. package/build/camera/effects/shake_effect.d.ts +47 -0
  17. package/build/camera/effects/shake_effect.d.ts.map +1 -0
  18. package/build/index.d.ts +10 -2
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +2928 -935
  21. package/build/index.js.map +4 -4
  22. package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
  23. package/build/math/color_matrix.d.ts +51 -0
  24. package/build/math/color_matrix.d.ts.map +1 -0
  25. package/build/math/matrix2d.d.ts +6 -6
  26. package/build/math/matrix3d.d.ts +17 -0
  27. package/build/math/matrix3d.d.ts.map +1 -1
  28. package/build/particles/emitter.d.ts +19 -5
  29. package/build/particles/emitter.d.ts.map +1 -1
  30. package/build/particles/particle.d.ts +4 -1
  31. package/build/particles/particle.d.ts.map +1 -1
  32. package/build/particles/settings.d.ts +200 -31
  33. package/build/particles/settings.d.ts.map +1 -1
  34. package/build/physics/quadtree.d.ts.map +1 -1
  35. package/build/renderable/imagelayer.d.ts +13 -2
  36. package/build/renderable/imagelayer.d.ts.map +1 -1
  37. package/build/renderable/renderable.d.ts +54 -35
  38. package/build/renderable/renderable.d.ts.map +1 -1
  39. package/build/renderable/text/bitmaptext.d.ts +33 -5
  40. package/build/renderable/text/bitmaptext.d.ts.map +1 -1
  41. package/build/renderable/text/text.d.ts +27 -1
  42. package/build/renderable/text/text.d.ts.map +1 -1
  43. package/build/renderable/trigger.d.ts +44 -19
  44. package/build/renderable/trigger.d.ts.map +1 -1
  45. package/build/state/state.d.ts +44 -2
  46. package/build/state/state.d.ts.map +1 -1
  47. package/build/tweens/tween.d.ts +9 -0
  48. package/build/tweens/tween.d.ts.map +1 -1
  49. package/build/video/buffer/index.d.ts +40 -0
  50. package/build/video/buffer/index.d.ts.map +1 -0
  51. package/build/video/{webgl/buffer → buffer}/vertex.d.ts +11 -4
  52. package/build/video/buffer/vertex.d.ts.map +1 -0
  53. package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
  54. package/build/video/renderer.d.ts +79 -0
  55. package/build/video/renderer.d.ts.map +1 -1
  56. package/build/video/renderstate.d.ts +7 -0
  57. package/build/video/renderstate.d.ts.map +1 -1
  58. package/build/video/rendertarget/canvasrendertarget.d.ts +26 -63
  59. package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
  60. package/build/video/rendertarget/render_target_pool.d.ts +73 -0
  61. package/build/video/rendertarget/render_target_pool.d.ts.map +1 -0
  62. package/build/video/rendertarget/rendertarget.d.ts +77 -0
  63. package/build/video/rendertarget/rendertarget.d.ts.map +1 -0
  64. package/build/video/rendertarget/webglrendertarget.d.ts +30 -0
  65. package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -0
  66. package/build/video/texture/cache.d.ts +6 -0
  67. package/build/video/texture/cache.d.ts.map +1 -1
  68. package/build/video/webgl/batchers/batcher.d.ts +4 -4
  69. package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
  70. package/build/video/webgl/batchers/material_batcher.d.ts +3 -3
  71. package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
  72. package/build/video/webgl/batchers/quad_batcher.d.ts +34 -0
  73. package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
  74. package/build/video/webgl/buffer/index.d.ts +5 -34
  75. package/build/video/webgl/buffer/index.d.ts.map +1 -1
  76. package/build/video/webgl/effects/colorMatrix.d.ts +92 -0
  77. package/build/video/webgl/effects/colorMatrix.d.ts.map +1 -0
  78. package/build/video/webgl/effects/desaturate.d.ts +2 -4
  79. package/build/video/webgl/effects/desaturate.d.ts.map +1 -1
  80. package/build/video/webgl/effects/invert.d.ts +2 -2
  81. package/build/video/webgl/effects/invert.d.ts.map +1 -1
  82. package/build/video/webgl/effects/sepia.d.ts +2 -2
  83. package/build/video/webgl/effects/sepia.d.ts.map +1 -1
  84. package/build/video/webgl/effects/vignette.d.ts +42 -0
  85. package/build/video/webgl/effects/vignette.d.ts.map +1 -0
  86. package/build/video/webgl/shadereffect.d.ts.map +1 -1
  87. package/build/video/webgl/shaders/multitexture.d.ts +10 -0
  88. package/build/video/webgl/shaders/multitexture.d.ts.map +1 -0
  89. package/build/video/webgl/utils/precision.d.ts +4 -3
  90. package/build/video/webgl/utils/precision.d.ts.map +1 -1
  91. package/build/video/webgl/webgl_renderer.d.ts +15 -8
  92. package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
  93. package/package.json +1 -1
  94. package/build/video/webgl/buffer/vertex.d.ts.map +0 -1
@@ -1,9 +1,12 @@
1
1
  export default CanvasRenderTarget;
2
2
  /**
3
- * CanvasRenderTarget is 2D render target which exposes a Canvas interface.
3
+ * A 2D canvas render target for offscreen texture generation.
4
+ * Used by Text, Gradient, Light2d and Particle systems to render into
5
+ * a canvas that is then uploaded as a WebGL texture.
6
+ * @augments RenderTarget
4
7
  * @category Rendering
5
8
  */
6
- declare class CanvasRenderTarget {
9
+ declare class CanvasRenderTarget extends RenderTarget {
7
10
  /**
8
11
  * @param {number} width - the desired width of the canvas
9
12
  * @param {number} height - the desired height of the canvas
@@ -23,15 +26,26 @@ declare class CanvasRenderTarget {
23
26
  willReadFrequently?: boolean | undefined;
24
27
  antiAlias?: boolean | undefined;
25
28
  });
26
- /**
27
- * the canvas created for this CanvasRenderTarget
28
- * @type {HTMLCanvasElement|OffscreenCanvas}
29
- */
30
- /**
31
- * the rendering context of this CanvasRenderTarget
32
- * @type {CanvasRenderingContext2D|WebGLRenderingContext}
33
- */
34
- attributes: CanvasRenderingContext2D | WebGLRenderingContext;
29
+ attributes: {
30
+ offscreenCanvas: boolean;
31
+ willReadFrequently: boolean;
32
+ antiAlias: boolean;
33
+ context: string;
34
+ transparent: boolean;
35
+ premultipliedAlpha: boolean;
36
+ stencil: boolean;
37
+ blendMode: string;
38
+ failIfMajorPerformanceCaveat: boolean;
39
+ preferWebGL1: boolean;
40
+ powerPreference: string;
41
+ } & {
42
+ context?: string | undefined;
43
+ preferWebGL1?: boolean | undefined;
44
+ transparent?: boolean | undefined;
45
+ offscreenCanvas?: boolean | undefined;
46
+ willReadFrequently?: boolean | undefined;
47
+ antiAlias?: boolean | undefined;
48
+ };
35
49
  canvas: any;
36
50
  context: any;
37
51
  WebGLVersion: any;
@@ -39,21 +53,11 @@ declare class CanvasRenderTarget {
39
53
  * @ignore
40
54
  */
41
55
  onResetEvent(width: any, height: any): void;
42
- /**
43
- * Clears the content of the canvas texture
44
- */
45
- clear(): void;
46
56
  /**
47
57
  * enable/disable image smoothing (scaling interpolation)
48
58
  * @param {boolean} [enable=false] - whether to enable or not image smoothing (scaling interpolation)
49
59
  */
50
60
  setAntiAlias(enable?: boolean): void;
51
- /**
52
- * Resizes the canvas texture to the given width and height.
53
- * @param {number} width - the desired width
54
- * @param {number} height - the desired height
55
- */
56
- resize(width: number, height: number): void;
57
61
  /**
58
62
  * Returns an ImageData object representing the underlying pixel data for a specified portion of this canvas texture.
59
63
  * (Note: when using getImageData(), it is highly recommended to use the `willReadFrequently` attribute when creatimg the corresponding canvas texture)
@@ -64,34 +68,6 @@ declare class CanvasRenderTarget {
64
68
  * @returns {ImageData} The ImageData extracted from this CanvasRenderTarget.
65
69
  */
66
70
  getImageData(x: number, y: number, width: number, height: number): ImageData;
67
- /**
68
- * creates a Blob object representing the image contained in this canvas texture
69
- * @param {string} [type="image/png"] - A string indicating the image format
70
- * @param {number} [quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
71
- * @returns {Promise} A Promise returning a Blob object representing the image contained in this canvas texture
72
- * @example
73
- * renderTarget.convertToBlob().then((blob) => console.log(blob));
74
- */
75
- toBlob(type?: string, quality?: number): Promise<any>;
76
- /**
77
- * creates an ImageBitmap object from the most recently rendered image of this canvas texture
78
- * @param {string} [type="image/png"] - A string indicating the image format
79
- * @param {number} [quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
80
- * @returns {Promise} A Promise returning an ImageBitmap.
81
- * @example
82
- * renderTarget.transferToImageBitmap().then((bitmap) => console.log(bitmap));
83
- */
84
- toImageBitmap(type?: string, quality?: number): Promise<any>;
85
- /**
86
- * returns a data URL containing a representation of the most recently rendered image of this canvas texture
87
- * (not supported by OffscreenCanvas)
88
- * @param {string} [type="image/png"] - A string indicating the image format
89
- * @param {number} [quality] - A Number between 0 and 1 indicating the image quality to be used when creating images using file formats that support lossy compression (such as image/jpeg or image/webp). A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range.
90
- * @returns {Promise} A Promise returning a string containing the requested data URL.
91
- * @example
92
- * renderer.toDataURL().then((dataURL) => console.log(dataURL));
93
- */
94
- toDataURL(type?: string, quality?: number): Promise<any>;
95
71
  /**
96
72
  * invalidate the current CanvasRenderTarget, and force a reupload of the corresponding texture
97
73
  * (call this if you modify the canvas content between two draw calls)
@@ -105,21 +81,8 @@ declare class CanvasRenderTarget {
105
81
  * @ignore
106
82
  */
107
83
  destroy(renderer?: CanvasRenderer | WebGLRenderer): void;
108
- public set width(val: number);
109
- /**
110
- * The width of this canvas texture in pixels
111
- * @public
112
- * @type {number}
113
- */
114
- public get width(): number;
115
- public set height(val: number);
116
- /**
117
- * The height of this canvas texture in pixels
118
- * @public
119
- * @type {number}
120
- */
121
- public get height(): number;
122
84
  }
85
+ import RenderTarget from "./rendertarget.ts";
123
86
  import type CanvasRenderer from "./../canvas/canvas_renderer.js";
124
87
  import type WebGLRenderer from "./../webgl/webgl_renderer.js";
125
88
  //# sourceMappingURL=canvasrendertarget.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";AA8EA;;;GAGG;AACH;IACC;;;;;;;;;;OAUG;IACH,mBAVW,MAAM,UACN,MAAM,eAEd;QAA4B,OAAO;QACN,YAAY;QACZ,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EAuCA;IArCA;;;OAGG;IAGH;;;OAGG;IAGH,YAJU,wBAAwB,GAAC,qBAAqB,CAIU;IASjE,YAA+B;IAUhC,aAA0D;IAE1D,kBAAgC;IAMjC;;OAEG;IACH,4CAGC;IAED;;OAEG;IACH,cAGC;IAED;;;OAGG;IACH,sBAFW,OAAO,QAwBjB;IAED;;;;OAIG;IACH,cAHW,MAAM,UACN,MAAM,QAKhB;IAED;;;;;;;;OAQG;IACH,gBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,SAAS,CAUrB;IAED;;;;;;;OAOG;IACH,cANW,MAAM,YACN,MAAM,gBAmBhB;IAED;;;;;;;OAOG;IACH,qBANW,MAAM,YACN,MAAM,gBAmBhB;IAED;;;;;;;;OAQG;IACH,iBANW,MAAM,YACN,MAAM,gBAShB;IAED;;;;OAIG;IACH,qBAFW,cAAc,GAAC,aAAa,QAYtC;IALC,mBAEC;IAKH;;;;OAIG;IACH,mBAHW,cAAc,GAAC,aAAa,QAoBtC;IAWD,sBANU,MAAM,EAQf;IAXD;;;;OAIG;IACH,oBAFU,MAAM,CAIf;IAeD,uBANU,MAAM,EAQf;IAXD;;;;OAIG;IACH,qBAFU,MAAM,CAIf;CAKD;gCA1U8B,gCAAgC;+BACjC,8BAA8B"}
1
+ {"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";AA+EA;;;;;;GAMG;AACH;IACC;;;;;;;;;;OAUG;IACH,mBAVW,MAAM,UACN,MAAM,eAEd;QAA4B,OAAO;QACN,YAAY;QACZ,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EA6BA;IAzBA;;;;;;;;;;;;;;;;;;;MAAkE;IASjE,YAA+B;IAUhC,aAA0D;IAE1D,kBAAgC;IAMjC;;OAEG;IACH,4CAGC;IAUD;;;OAGG;IACH,sBAFW,OAAO,QAwBjB;IAYD;;;;;;;;OAQG;IACH,gBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,SAAS,CAUrB;IAoDD;;;;OAIG;IACH,qBAFW,cAAc,GAAC,aAAa,QAatC;IALC,mBAEC;IAKH;;;;OAIG;IACH,mBAHW,cAAc,GAAC,aAAa,QAoBtC;CA2BD;yBA3TwB,mBAAmB;gCAIb,gCAAgC;+BACjC,8BAA8B"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @import RenderTarget from "./rendertarget.ts";
3
+ */
4
+ /**
5
+ * Manages a pool of {@link RenderTarget} instances for post-effect processing.
6
+ * Renderer-agnostic — the actual RenderTarget creation is delegated to a
7
+ * factory function provided by the renderer (WebGL, WebGPU, etc.).
8
+ *
9
+ * Camera effects use pool indices 0 and 1 (capture + ping-pong),
10
+ * sprite effects use indices 2 and 3.
11
+ * Render targets are lazily created and resized to match the required dimensions.
12
+ * @ignore
13
+ */
14
+ export default class RenderTargetPool {
15
+ /**
16
+ * @param {function(number, number): RenderTarget} factory - creates a RenderTarget with the given width and height
17
+ */
18
+ constructor(factory: (arg0: number, arg1: number) => RenderTarget);
19
+ /** @type {function(number, number): RenderTarget} */
20
+ _factory: (arg0: number, arg1: number) => RenderTarget;
21
+ /** @type {RenderTarget[]} */
22
+ _pool: RenderTarget[];
23
+ /** @type {number} */
24
+ _activeBase: number;
25
+ /** @type {number} */
26
+ _previousBase: number;
27
+ /**
28
+ * Get or create a render target at the given pool index, resized to the given dimensions.
29
+ * @param {number} index - pool index
30
+ * @param {number} width - desired width in pixels
31
+ * @param {number} height - desired height in pixels
32
+ * @returns {RenderTarget} the render target
33
+ */
34
+ get(index: number, width: number, height: number): RenderTarget;
35
+ /**
36
+ * Prepare render targets for a post-effect pass.
37
+ * Allocates/resizes the capture target and optionally the ping-pong target.
38
+ * @param {boolean} isCamera - true for camera effects (indices 0+1), false for sprite (indices 2+3)
39
+ * @param {number} effectCount - number of enabled effects
40
+ * @param {number} width - target width in pixels
41
+ * @param {number} height - target height in pixels
42
+ * @returns {RenderTarget} the capture target (ready to bind)
43
+ */
44
+ begin(isCamera: boolean, effectCount: number, width: number, height: number): RenderTarget;
45
+ /**
46
+ * Get the capture render target for the current active pass.
47
+ * @returns {RenderTarget|undefined} the capture target, or undefined if no active pass
48
+ */
49
+ getCaptureTarget(): RenderTarget | undefined;
50
+ /**
51
+ * Get the ping-pong render target for the current active pass.
52
+ * @returns {RenderTarget|undefined} the ping-pong target, or undefined if no active pass
53
+ */
54
+ getPingPongTarget(): RenderTarget | undefined;
55
+ /**
56
+ * End the current pass and restore the previous active base.
57
+ * Returns the parent render target to rebind (or null for screen).
58
+ * @returns {RenderTarget|null} the parent target, or null if returning to screen
59
+ */
60
+ end(): RenderTarget | null;
61
+ /**
62
+ * Resize all existing render targets in the pool to the given dimensions.
63
+ * @param {number} width - new width in pixels
64
+ * @param {number} height - new height in pixels
65
+ */
66
+ resizeAll(width: number, height: number): void;
67
+ /**
68
+ * Destroy all render targets and clear the pool.
69
+ */
70
+ destroy(): void;
71
+ }
72
+ import type RenderTarget from "./rendertarget.ts";
73
+ //# sourceMappingURL=render_target_pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render_target_pool.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/render_target_pool.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AACH;IACC;;OAEG;IACH,qBAFW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,EAWhD;IARA,qDAAqD;IACrD,UADW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,CAC1B;IACvB,6BAA6B;IAC7B,OADW,YAAY,EAAE,CACV;IACf,qBAAqB;IACrB,aADW,MAAM,CACI;IACrB,qBAAqB;IACrB,eADW,MAAM,CACM;IAGxB;;;;;;OAMG;IACH,WALW,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CASxB;IAED;;;;;;;;OAQG;IACH,gBANW,OAAO,eACP,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CAexB;IAED;;;OAGG;IACH,oBAFa,YAAY,GAAC,SAAS,CAOlC;IAED;;;OAGG;IACH,qBAFa,YAAY,GAAC,SAAS,CAOlC;IAED;;;;OAIG;IACH,OAFa,YAAY,GAAC,IAAI,CAS7B;IAED;;;;OAIG;IACH,iBAHW,MAAM,UACN,MAAM,QAQhB;IAED;;OAEG;IACH,gBASC;CACD;8BAlI4B,mBAAmB"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Abstract base class for offscreen render targets.
3
+ * Provides a renderer-agnostic interface for binding, clearing, resizing,
4
+ * and reading back pixel data from an offscreen surface.
5
+ * Concrete implementations:
6
+ * - {@link WebGLRenderTarget} — WebGL framebuffer object (FBO) for post-processing
7
+ * - {@link CanvasRenderTarget} — 2D canvas surface for texture generation
8
+ *
9
+ * A future WebGPU implementation would extend this class with
10
+ * GPUTexture / GPURenderPassDescriptor management.
11
+ * @category Rendering
12
+ */
13
+ export default abstract class RenderTarget {
14
+ /**
15
+ * The width of this render target in pixels.
16
+ */
17
+ width: number;
18
+ /**
19
+ * The height of this render target in pixels.
20
+ */
21
+ height: number;
22
+ /**
23
+ * Bind this render target as the active draw destination.
24
+ * All subsequent draw calls will render into this target until {@link unbind} is called.
25
+ * No-op by default — subclasses override for GPU render targets (e.g. WebGL FBOs).
26
+ */
27
+ bind(): void;
28
+ /**
29
+ * Unbind this render target, restoring the default (screen) output.
30
+ * No-op by default — subclasses override for GPU render targets.
31
+ */
32
+ unbind(): void;
33
+ /**
34
+ * Resize the render target's backing storage to the given dimensions.
35
+ * @param width - new width in pixels
36
+ * @param height - new height in pixels
37
+ */
38
+ abstract resize(width: number, height: number): void;
39
+ /**
40
+ * Clear the render target contents.
41
+ */
42
+ abstract clear(): void;
43
+ /**
44
+ * Release all resources held by this render target.
45
+ * The target must not be used after calling destroy.
46
+ */
47
+ abstract destroy(): void;
48
+ /**
49
+ * Read back pixel data from this render target.
50
+ * @param x - x coordinate of the top-left corner (default 0)
51
+ * @param y - y coordinate of the top-left corner (default 0)
52
+ * @param width - width of the area to read (default full width)
53
+ * @param height - height of the area to read (default full height)
54
+ * @returns an ImageData object containing the pixel data
55
+ */
56
+ abstract getImageData(x?: number, y?: number, width?: number, height?: number): ImageData;
57
+ /**
58
+ * Creates a Blob object representing the image contained in this render target.
59
+ * @param type - a string indicating the image format (default "image/png")
60
+ * @param quality - a number between 0 and 1 for lossy formats (e.g. image/jpeg)
61
+ * @returns a Promise resolving to a Blob
62
+ */
63
+ toBlob(type?: string, quality?: number): Promise<Blob>;
64
+ /**
65
+ * Creates an ImageBitmap object from the current contents of this render target.
66
+ * @returns a Promise resolving to an ImageBitmap
67
+ */
68
+ toImageBitmap(): Promise<ImageBitmap>;
69
+ /**
70
+ * Returns a data URL containing a representation of the current contents.
71
+ * @param type - a string indicating the image format (default "image/png")
72
+ * @param quality - a number between 0 and 1 for lossy formats (e.g. image/jpeg)
73
+ * @returns a Promise resolving to a data URL string
74
+ */
75
+ toDataURL(type?: string, quality?: number): Promise<string>;
76
+ }
77
+ //# sourceMappingURL=rendertarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/rendertarget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACzC;;OAEG;IACK,KAAK,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACK,MAAM,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,IAAI,IAAI,IAAI;IAEZ;;;OAGG;IACH,MAAM,IAAI,IAAI;IAEd;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAEpD;;OAEG;IACH,QAAQ,CAAC,KAAK,IAAI,IAAI;IAEtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CACpB,CAAC,CAAC,EAAE,MAAM,EACV,CAAC,CAAC,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,GACb,SAAS;IAEZ;;;;;OAKG;IACH,MAAM,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsC3D;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;IAKrC;;;;;OAKG;IACH,SAAS,CAAC,IAAI,SAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAiBhE"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A WebGL Framebuffer Object (FBO) render target for offscreen rendering.
3
+ * Used by the post-processing pipeline to render a camera's output to a texture,
4
+ * which can then be drawn to the screen through a post-process shader.
5
+ * @augments RenderTarget
6
+ * @ignore
7
+ */
8
+ export default class WebGLRenderTarget extends RenderTarget {
9
+ /**
10
+ * @param {WebGLRenderingContext|WebGL2RenderingContext} gl - the WebGL context
11
+ * @param {number} width - initial width in pixels
12
+ * @param {number} height - initial height in pixels
13
+ */
14
+ constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, width: number, height: number);
15
+ gl: WebGLRenderingContext | WebGL2RenderingContext;
16
+ framebuffer: WebGLFramebuffer;
17
+ texture: WebGLTexture;
18
+ depthStencilBuffer: WebGLRenderbuffer;
19
+ /**
20
+ * (Re)attach the depth/stencil renderbuffer at the given size and
21
+ * update `_hasStencil` based on the resulting framebuffer status.
22
+ * Falls back to depth-only when packed depth+stencil fails; warns
23
+ * once if even depth-only is incomplete.
24
+ * @ignore
25
+ */
26
+ _applyDepthStencil(width: any, height: any): void;
27
+ _hasStencil: boolean | undefined;
28
+ }
29
+ import RenderTarget from "./rendertarget.ts";
30
+ //# sourceMappingURL=webglrendertarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webglrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/webglrendertarget.js"],"names":[],"mappings":"AA8DA;;;;;;GAMG;AACH;IACC;;;;OAIG;IACH,gBAJW,qBAAqB,GAAC,sBAAsB,SAC5C,MAAM,UACN,MAAM,EAqDhB;IAjDA,mDAAY;IAKZ,8BAAyC;IAMzC,sBAAiC;IAoBjC,sCAAiD;IAoBlD;;;;;;OAMG;IACH,kDAkBC;IAVA,iCAAoC;CAmIrC;yBAlRwB,mBAAmB"}
@@ -22,6 +22,12 @@ declare class TextureCache {
22
22
  * @ignore
23
23
  */
24
24
  allocateTextureUnit(): number;
25
+ /**
26
+ * Reset all texture unit assignments without clearing the texture cache.
27
+ * Used by multi-texture batching when the shader's sampler range is exceeded.
28
+ * @ignore
29
+ */
30
+ resetUnitAssignments(): void;
25
31
  /**
26
32
  * @ignore
27
33
  */
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAKA;;;GAGG;AACH;IACC;;OAEG;IACH,8CAUC;IARA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IACvB,qBAAsB;IACtB,oBAA0B;IAC1B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BAuBC;IAED;;OAEG;IACH,oCAQC;IAED;;OAEG;IACH,2BAMC;IAED;;;OAGG;IACH,4BAGC;IAED;;;OAGG;IACH,yCAsBC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAQC;IAED;;OAEG;IACH,gCAcC;CACD;8BA/M6B,+BAA+B"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/video/texture/cache.js"],"names":[],"mappings":";AAKA;;;GAGG;AACH;IACC;;OAEG;IACH,8CAUC;IARA,cAAwB;IAExB,qBAAgC;IAChC,sBAAuB;IACvB,qBAAsB;IACtB,oBAA0B;IAC1B,iBAAwB;IAIzB;;OAEG;IACH,cAKC;IAED;;OAEG;IACH,8BAuBC;IAED;;;;OAIG;IACH,6BAOC;IAED;;OAEG;IACH,oCAQC;IAED;;OAEG;IACH,2BAMC;IAED;;;OAGG;IACH,4BAGC;IAED;;;OAGG;IACH,yCAsBC;IAED;;OAEG;IACH,yBAEC;IAED;;;OAGG;IACH,iCAwCC;IAED;;OAEG;IACH,yBAQC;IAED;;OAEG;IACH,gCAcC;CACD;8BA7N6B,+BAA+B"}
@@ -103,10 +103,10 @@ export class Batcher {
103
103
  glVertexBuffer: WebGLBuffer | null | undefined;
104
104
  /**
105
105
  * the dynamic index buffer (only for indexed batchers)
106
- * @type {IndexBuffer|null}
106
+ * @type {WebGLIndexBuffer|null}
107
107
  * @ignore
108
108
  */
109
- indexBuffer: IndexBuffer | null | undefined;
109
+ indexBuffer: WebGLIndexBuffer | null | undefined;
110
110
  /**
111
111
  * Reset batcher internal state
112
112
  * @ignore
@@ -151,8 +151,8 @@ export class Batcher {
151
151
  }
152
152
  export default Batcher;
153
153
  import GLShader from "../glshader.js";
154
- import VertexArrayBuffer from "../buffer/vertex.js";
155
- import IndexBuffer from "../buffer/index.js";
154
+ import VertexArrayBuffer from "../../buffer/vertex.js";
155
+ import WebGLIndexBuffer from "../buffer/index.js";
156
156
  import type { Matrix3d } from "../../../math/matrix3d.ts";
157
157
  import type WebGLRenderer from "./../webgl_renderer.js";
158
158
  //# sourceMappingURL=batcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA4HC;IA1HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAoCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,4CAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QAqBlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAyEhB;CACD;;qBA/WoB,gBAAgB;8BADP,qBAAqB;wBAD3B,oBAAoB;8BAOjB,2BAA2B;+BADxB,wBAAwB"}
1
+ {"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;OAeG;IACH,sBAfW,aAAa,YAErB;QAA2B,UAAU,EACrC;YAAoC,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACsB,IAAI,EAAhC,MAAM;YACuB,UAAU,EAAvC,OAAO;YACqB,MAAM,EAAlC,MAAM;SACd;QAAyB,MAAM,EAC/B;YAAgC,MAAM,EAA9B,MAAM;YACkB,QAAQ,EAAhC,MAAM;SACd;QAA0B,WAAW;QACV,OAAO;QACR,iBAAiB;KAC7C,EAGA;IAED;;;OAGG;IACH,yCA6HC;IA3HA,cAAwB;IAGxB,QAAqB;IAGrB,gBAA2C;IAE3C;;;OAGG;IACH,oCAA8B;IAE9B;;;OAGG;IACH,oCAA8B;IAE9B;;;;OAIG;IACH,yBAA6B;IAE7B;;;;OAIG;IACH,iCAAoB;IAEpB;;;;;OAKG;IACH,2BAAe;IAEf;;;;;OAKG;IACH,+BAAmB;IAEnB;;;OAGG;IACH,0CAAsB;IAqCtB;;;OAGG;IACH,sCAA0E;IAE1E;;;OAGG;IACH,oCAA+C;IAE/C;;;;OAIG;IACH,+CAA0B;IAE1B;;;;OAIG;IACH,iDAAuB;IAUxB;;;OAGG;IACH,cAUC;IAED;;OAEG;IACH,aAYC;IAED;;;;OAIG;IACH,kBAFW,QAAQ,QAqBlB;IAHE,uCAA4B;IAK/B;;;;;;;OAOG;IACH,mBANW,MAAM,QACN,MAAM,QACN,MAAM,cACN,OAAO,UACP,MAAM,QA+BhB;IAED;;;OAGG;IACH,sBAFW,QAAQ,QAIlB;IAED;;;;OAIG;IACH,oBAFW,MAAM,EAAE,QAOlB;IAED;;;OAGG;IACH,aAFW,MAAM,QAyEhB;CACD;;qBAhXoB,gBAAgB;8BAFP,wBAAwB;6BACzB,oBAAoB;8BAMtB,2BAA2B;+BADxB,wBAAwB"}
@@ -30,7 +30,7 @@ export class MaterialBatcher extends Batcher {
30
30
  * @param {boolean} [mipmap=true] - Whether mipmap levels should be generated
31
31
  * @returns {WebGLTexture} a WebGL texture
32
32
  */
33
- createTexture2D(unit: number, pixels?: (new (width?: number, height?: number) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string, w?: number, h?: number, premultipliedAlpha?: boolean, mipmap?: boolean, texture: any): WebGLTexture;
33
+ createTexture2D(unit: number, pixels?: (new (width?: number, height?: number) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string, w?: number, h?: number, premultipliedAlpha?: boolean, mipmap?: boolean, texture: any, flush?: boolean): WebGLTexture;
34
34
  /**
35
35
  * delete the given WebGL texture
36
36
  * @param {WebGLTexture|TextureAtlas} texture - a WebGL texture or TextureAtlas to delete
@@ -47,7 +47,7 @@ export class MaterialBatcher extends Batcher {
47
47
  * @param {WebGLTexture} texture - a WebGL texture
48
48
  * @param {number} unit - Texture unit to which the given texture is bound
49
49
  */
50
- bindTexture2D(texture: WebGLTexture, unit: number): void;
50
+ bindTexture2D(texture: WebGLTexture, unit: number, flush?: boolean): void;
51
51
  /**
52
52
  * unbind the given WebGL texture, forcing it to be reuploaded
53
53
  * @param {WebGLTexture} [texture] - a WebGL texture
@@ -58,7 +58,7 @@ export class MaterialBatcher extends Batcher {
58
58
  /**
59
59
  * @ignore
60
60
  */
61
- uploadTexture(texture: any, w: any, h: any, force?: boolean): any;
61
+ uploadTexture(texture: any, w: any, h: any, force?: boolean, flush?: boolean): any;
62
62
  }
63
63
  import { Batcher } from "./batcher.js";
64
64
  import type { TextureAtlas } from "./../../texture/atlas.js";
@@ -1 +1 @@
1
- {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IA0BxB;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,iBACL,YAAY,CAkHxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAiBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,QAkBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;OAEG;IACH,kEAqBC;CACD;wBAvRuB,cAAc;kCAIP,0BAA0B"}
1
+ {"version":3,"file":"material_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/material_batcher.js"],"names":[],"mappings":"AAGA;;;GAGG;AAEH;;;;GAIG;AACH;IAQE;;;OAGG;IACH,wBAA4B;IAE5B;;;OAGG;IACH,iCAAuB;IA0BxB;;;;;;;;;;;OAWG;IACH,sBAVW,MAAM,WACN,8DAAM,iBAAiB,GAAC,SAAS,GAAC,UAAU,EAAE,GAAC,YAAY,EAAE,UAC7D,MAAM,WACN,MAAM,MACN,MAAM,MACN,MAAM,uBACN,OAAO,WACP,OAAO,kCACL,YAAY,CAmHxB;IAED;;;OAGG;IACH,yBAFW,YAAY,GAAC,YAAY,QAiBnC;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,YAAY,CAIxB;IAED;;;;OAIG;IACH,uBAHW,YAAY,QACZ,MAAM,yBAsBhB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,SACZ,MAAM,GACJ,MAAM,CAalB;IAED;;OAEG;IACH,mFAsBC;CACD;wBA7RuB,cAAc;kCAIP,0BAA0B"}
@@ -9,6 +9,40 @@ export default class QuadBatcher extends MaterialBatcher {
9
9
  * @ignore
10
10
  */
11
11
  init(renderer: any): void;
12
+ /**
13
+ * the maximum number of texture units used for multi-texture batching
14
+ * @type {number}
15
+ * @ignore
16
+ */
17
+ maxBatchTextures: number | undefined;
18
+ /**
19
+ * whether multi-texture batching is currently active
20
+ * (disabled when a custom ShaderEffect is applied)
21
+ * @type {boolean}
22
+ * @ignore
23
+ */
24
+ useMultiTexture: boolean | undefined;
25
+ /**
26
+ * Select the shader to use for compositing.
27
+ * Multi-texture batching is automatically enabled when the default
28
+ * shader is active, and disabled for custom ShaderEffect shaders.
29
+ * @see GLShader
30
+ * @see ShaderEffect
31
+ * @param {GLShader|ShaderEffect} shader - a reference to a GLShader or ShaderEffect instance
32
+ */
33
+ useShader(shader: GLShader | ShaderEffect): void;
34
+ /**
35
+ * Draw a screen-aligned quad with the given raw WebGL texture through the given shader.
36
+ * Binds the texture to unit 0, pushes 4 vertices (Y-flipped UVs), flushes,
37
+ * then unbinds the texture.
38
+ * @param {WebGLTexture} source - the raw GL texture to blit
39
+ * @param {number} x - destination x
40
+ * @param {number} y - destination y
41
+ * @param {number} width - destination width
42
+ * @param {number} height - destination height
43
+ * @param {GLShader|ShaderEffect} shader - the shader effect to apply
44
+ */
45
+ blitTexture(source: WebGLTexture, x: number, y: number, width: number, height: number, shader: GLShader | ShaderEffect): void;
12
46
  /**
13
47
  * Add a textured quad
14
48
  * @param {TextureAtlas} texture - Source texture atlas
@@ -1 +1 @@
1
- {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAuCC;IA0DD;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAmCjB;CACD;gCA1K+B,uBAAuB;kCAIxB,0BAA0B"}
1
+ {"version":3,"file":"quad_batcher.d.ts","sourceRoot":"","sources":["../../../../src/video/webgl/batchers/quad_batcher.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IACC;;;OAGG;IACH,0BAkEC;IAjEA;;;;OAIG;IACH,qCAA0D;IA4C1D;;;;;OAKG;IACH,qCAA2B;IAY5B;;;;;;;OAOG;IACH,kBAFW,QAAQ,GAAC,YAAY,QAK/B;IAgED;;;;;;;;;;OAUG;IACH,oBAPW,YAAY,KACZ,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,UACN,QAAQ,GAAC,YAAY,QA4B/B;IAED;;;;;;;;;;;;;OAaG;IACH,iBAZW,YAAY,KACZ,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,QACN,MAAM,aACN,OAAO,QAqDjB;CACD;gCAjR+B,uBAAuB;kCAIxB,0BAA0B"}
@@ -1,54 +1,25 @@
1
1
  /**
2
- * A WebGL Index Buffer object.
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, dynamic?: 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
- * bind this index buffer
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":"AAAA;;;;GAIG;AAEH;IACC;;;;;OAKG;IACH,gBALW,qBAAqB,GAAC,sBAAsB,cAC5C,MAAM,cACN,OAAO,YACP,OAAO,EAqBjB;IAlBA,mDAAY;IACZ,iBAAsB;IAGrB,kBAA2B;IAC3B,0DAAuC;IAMxC;;;OAGG;IACH,QAFU,MAAM,CAED;IAEf,oBAA+B;IAGhC;;;;OAIG;IACH,0BAFW,MAAM,QAkBhB;IAED;;OAEG;IACH,cAEC;IAED;;;;OAIG;IACH,aAHW,MAAM,EAAE,gBACR,MAAM,QAOhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAOlB;IAED;;OAEG;IACH,eAOC;IAED;;OAEG;IACH,aAEC;CACD"}
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"}