@vpmedia/phaser 1.95.0 → 1.97.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 (184) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +10 -10
  3. package/src/phaser/core/animation.js +61 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/cache.js +154 -154
  6. package/src/phaser/core/device.js +2 -1
  7. package/src/phaser/core/device_util.js +27 -27
  8. package/src/phaser/core/dom.js +43 -43
  9. package/src/phaser/core/event_manager.js +63 -63
  10. package/src/phaser/core/factory.js +47 -47
  11. package/src/phaser/core/frame.js +30 -30
  12. package/src/phaser/core/frame_data.js +30 -28
  13. package/src/phaser/core/frame_util.js +8 -8
  14. package/src/phaser/core/game.js +34 -18
  15. package/src/phaser/core/loader.js +170 -170
  16. package/src/phaser/core/loader_parser.js +22 -22
  17. package/src/phaser/core/raf.js +1 -1
  18. package/src/phaser/core/scene.js +16 -10
  19. package/src/phaser/core/scene_manager.js +51 -43
  20. package/src/phaser/core/signal.js +68 -52
  21. package/src/phaser/core/signal.test.js +37 -0
  22. package/src/phaser/core/sound.js +54 -54
  23. package/src/phaser/core/sound_manager.js +49 -49
  24. package/src/phaser/core/stage.js +16 -16
  25. package/src/phaser/core/time.js +30 -30
  26. package/src/phaser/core/timer.js +79 -64
  27. package/src/phaser/core/timer_event.js +9 -9
  28. package/src/phaser/core/tween.js +90 -90
  29. package/src/phaser/core/tween_data.js +30 -30
  30. package/src/phaser/core/tween_manager.js +29 -24
  31. package/src/phaser/core/world.js +4 -3
  32. package/src/phaser/display/bitmap_text.js +61 -54
  33. package/src/phaser/display/button.js +48 -47
  34. package/src/phaser/display/canvas/buffer.js +8 -8
  35. package/src/phaser/display/canvas/graphics.js +8 -8
  36. package/src/phaser/display/canvas/masker.js +5 -5
  37. package/src/phaser/display/canvas/pool.js +18 -18
  38. package/src/phaser/display/canvas/renderer.js +16 -16
  39. package/src/phaser/display/canvas/tinter.js +22 -22
  40. package/src/phaser/display/canvas/util.js +42 -42
  41. package/src/phaser/display/display_object.js +119 -108
  42. package/src/phaser/display/graphics.js +112 -112
  43. package/src/phaser/display/graphics_data.js +10 -10
  44. package/src/phaser/display/graphics_data_util.js +3 -3
  45. package/src/phaser/display/group.js +50 -50
  46. package/src/phaser/display/image.js +54 -50
  47. package/src/phaser/display/sprite_batch.js +2 -2
  48. package/src/phaser/display/sprite_util.js +19 -19
  49. package/src/phaser/display/text.js +212 -187
  50. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  51. package/src/phaser/display/webgl/base_texture.js +9 -9
  52. package/src/phaser/display/webgl/blend_manager.js +7 -7
  53. package/src/phaser/display/webgl/earcut.js +95 -95
  54. package/src/phaser/display/webgl/earcut_node.js +4 -4
  55. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  56. package/src/phaser/display/webgl/filter_manager.js +9 -9
  57. package/src/phaser/display/webgl/filter_texture.js +10 -10
  58. package/src/phaser/display/webgl/graphics.js +37 -37
  59. package/src/phaser/display/webgl/graphics_data.js +4 -4
  60. package/src/phaser/display/webgl/mask_manager.js +6 -6
  61. package/src/phaser/display/webgl/render_texture.js +16 -16
  62. package/src/phaser/display/webgl/renderer.js +20 -20
  63. package/src/phaser/display/webgl/shader/complex.js +4 -4
  64. package/src/phaser/display/webgl/shader/fast.js +4 -4
  65. package/src/phaser/display/webgl/shader/normal.js +8 -8
  66. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  67. package/src/phaser/display/webgl/shader/strip.js +4 -4
  68. package/src/phaser/display/webgl/shader_manager.js +9 -9
  69. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  70. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  71. package/src/phaser/display/webgl/texture.js +13 -13
  72. package/src/phaser/display/webgl/texture_util.js +8 -8
  73. package/src/phaser/display/webgl/util.js +25 -25
  74. package/src/phaser/geom/circle.js +69 -69
  75. package/src/phaser/geom/circle.test.js +1 -0
  76. package/src/phaser/geom/ellipse.js +28 -28
  77. package/src/phaser/geom/ellipse.test.js +1 -0
  78. package/src/phaser/geom/line.js +93 -93
  79. package/src/phaser/geom/line.test.js +1 -0
  80. package/src/phaser/geom/matrix.js +54 -54
  81. package/src/phaser/geom/matrix.test.js +1 -0
  82. package/src/phaser/geom/point.js +96 -96
  83. package/src/phaser/geom/point.test.js +1 -0
  84. package/src/phaser/geom/polygon.js +22 -22
  85. package/src/phaser/geom/rectangle.js +132 -132
  86. package/src/phaser/geom/rectangle.test.js +1 -0
  87. package/src/phaser/geom/rounded_rectangle.js +12 -12
  88. package/src/phaser/geom/rounded_rectangle.test.js +1 -0
  89. package/src/phaser/geom/util/circle.js +33 -33
  90. package/src/phaser/geom/util/circle.test.js +1 -0
  91. package/src/phaser/geom/util/ellipse.js +5 -5
  92. package/src/phaser/geom/util/ellipse.test.js +1 -0
  93. package/src/phaser/geom/util/line.js +26 -26
  94. package/src/phaser/geom/util/line.test.js +1 -0
  95. package/src/phaser/geom/util/matrix.js +8 -8
  96. package/src/phaser/geom/util/matrix.test.js +1 -0
  97. package/src/phaser/geom/util/point.js +97 -97
  98. package/src/phaser/geom/util/point.test.js +1 -0
  99. package/src/phaser/geom/util/polygon.js +4 -4
  100. package/src/phaser/geom/util/polygon.test.js +1 -0
  101. package/src/phaser/geom/util/rectangle.js +74 -74
  102. package/src/phaser/geom/util/rectangle.test.js +1 -0
  103. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  104. package/src/phaser/geom/util/rounded_rectangle.test.js +1 -0
  105. package/src/phaser/util/math.js +81 -81
  106. package/src/phaser/util/math.test.js +1 -0
  107. package/types/phaser/core/animation.d.ts +61 -56
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +55 -55
  110. package/types/phaser/core/cache.d.ts +154 -154
  111. package/types/phaser/core/device.d.ts.map +1 -1
  112. package/types/phaser/core/dom.d.ts +43 -43
  113. package/types/phaser/core/event_manager.d.ts +63 -63
  114. package/types/phaser/core/factory.d.ts +47 -47
  115. package/types/phaser/core/frame.d.ts +30 -30
  116. package/types/phaser/core/frame_data.d.ts +28 -27
  117. package/types/phaser/core/frame_data.d.ts.map +1 -1
  118. package/types/phaser/core/game.d.ts +52 -19
  119. package/types/phaser/core/game.d.ts.map +1 -1
  120. package/types/phaser/core/loader.d.ts +170 -170
  121. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  122. package/types/phaser/core/raf.d.ts +1 -1
  123. package/types/phaser/core/scene.d.ts +15 -9
  124. package/types/phaser/core/scene.d.ts.map +1 -1
  125. package/types/phaser/core/scene_manager.d.ts +51 -43
  126. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  127. package/types/phaser/core/signal.d.ts +54 -51
  128. package/types/phaser/core/signal.d.ts.map +1 -1
  129. package/types/phaser/core/sound.d.ts +54 -54
  130. package/types/phaser/core/sound_manager.d.ts +49 -49
  131. package/types/phaser/core/stage.d.ts +10 -10
  132. package/types/phaser/core/time.d.ts +30 -30
  133. package/types/phaser/core/timer.d.ts +64 -64
  134. package/types/phaser/core/timer_event.d.ts +9 -9
  135. package/types/phaser/core/tween.d.ts +90 -90
  136. package/types/phaser/core/tween_data.d.ts +30 -30
  137. package/types/phaser/core/tween_manager.d.ts +29 -24
  138. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  139. package/types/phaser/core/world.d.ts +4 -3
  140. package/types/phaser/core/world.d.ts.map +1 -1
  141. package/types/phaser/display/bitmap_text.d.ts +59 -52
  142. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  143. package/types/phaser/display/button.d.ts +47 -46
  144. package/types/phaser/display/button.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  146. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  147. package/types/phaser/display/display_object.d.ts +119 -108
  148. package/types/phaser/display/display_object.d.ts.map +1 -1
  149. package/types/phaser/display/graphics.d.ts +101 -101
  150. package/types/phaser/display/graphics_data.d.ts +10 -10
  151. package/types/phaser/display/group.d.ts +47 -47
  152. package/types/phaser/display/image.d.ts +42 -40
  153. package/types/phaser/display/image.d.ts.map +1 -1
  154. package/types/phaser/display/text.d.ts +207 -184
  155. package/types/phaser/display/text.d.ts.map +1 -1
  156. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  157. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  158. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  159. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  160. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  161. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  162. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  163. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  165. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  166. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  167. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  168. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  169. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  170. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  171. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  172. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  173. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  174. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  175. package/types/phaser/display/webgl/texture.d.ts +12 -12
  176. package/types/phaser/geom/circle.d.ts +69 -69
  177. package/types/phaser/geom/ellipse.d.ts +28 -28
  178. package/types/phaser/geom/line.d.ts +93 -93
  179. package/types/phaser/geom/matrix.d.ts +54 -54
  180. package/types/phaser/geom/point.d.ts +96 -96
  181. package/types/phaser/geom/polygon.d.ts +22 -22
  182. package/types/phaser/geom/rectangle.d.ts +132 -132
  183. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  184. package/pnpm-workspace.yaml +0 -4
@@ -5,8 +5,8 @@ import { triangulate } from './earcut.js';
5
5
  import { GraphicsData } from './graphics_data.js';
6
6
 
7
7
  /**
8
- * TBD.
9
- * @returns {number} TBD.
8
+ * Updates the graphics data for WebGL rendering.
9
+ * @returns {number} The number of vertices in the graphics data.
10
10
  */
11
11
  export const getStencilBufferLimit = () => {
12
12
  if (!window.PhaserRegistry.stencilBufferLimit) {
@@ -16,8 +16,8 @@ export const getStencilBufferLimit = () => {
16
16
  };
17
17
 
18
18
  /**
19
- * TBD.
20
- * @returns {object[]} TBD.
19
+ * Updates the graphics data for WebGL rendering.
20
+ * @returns {object[]} The graphics data array.
21
21
  */
22
22
  export const getGraphicsDataPool = () => {
23
23
  if (!window.PhaserRegistry.graphicsDataPool) {
@@ -27,10 +27,10 @@ export const getGraphicsDataPool = () => {
27
27
  };
28
28
 
29
29
  /**
30
- * TBD.
31
- * @param {object} webGL - TBD.
32
- * @param {number} type - TBD.
33
- * @returns {object} TBD.
30
+ * Updates the graphics data for WebGL rendering.
31
+ * @param {object} webGL - The WebGL context.
32
+ * @param {number} type - The type of graphics data to create.
33
+ * @returns {object} The newly created graphics data object.
34
34
  */
35
35
  export const switchMode = (webGL, type) => {
36
36
  let webGLData;
@@ -51,9 +51,9 @@ export const switchMode = (webGL, type) => {
51
51
  };
52
52
 
53
53
  /**
54
- * TBD.
55
- * @param {object} graphicsData - TBD.
56
- * @param {GraphicsData} webGLData - TBD.
54
+ * Updates the graphics data for WebGL rendering.
55
+ * @param {object} graphicsData - The graphics data to update.
56
+ * @param {GraphicsData} webGLData - The WebGL graphics data object.
57
57
  */
58
58
  export const buildLine = (graphicsData, webGLData) => {
59
59
  // TODO OPTIMISE!
@@ -216,9 +216,9 @@ export const buildLine = (graphicsData, webGLData) => {
216
216
  };
217
217
 
218
218
  /**
219
- * TBD.
220
- * @param {object} graphicsData - TBD.
221
- * @param {GraphicsData} webGLData - TBD.
219
+ * Updates the graphics data for WebGL rendering.
220
+ * @param {object} graphicsData - The graphics data to update.
221
+ * @param {GraphicsData} webGLData - The WebGL graphics data object.
222
222
  */
223
223
  export const buildRectangle = (graphicsData, webGLData) => {
224
224
  //
@@ -260,14 +260,14 @@ export const buildRectangle = (graphicsData, webGLData) => {
260
260
  };
261
261
 
262
262
  /**
263
- * TBD.
264
- * @param {number} fromX - TBD.
265
- * @param {number} fromY - TBD.
266
- * @param {number} cpX - TBD.
267
- * @param {number} cpY - TBD.
268
- * @param {number} toX - TBD.
269
- * @param {number} toY - TBD.
270
- * @returns {number[]} TBD.
263
+ * Updates the graphics data for WebGL rendering.
264
+ * @param {number} fromX - The starting x-coordinate.
265
+ * @param {number} fromY - The starting y-coordinate.
266
+ * @param {number} cpX - The control point x-coordinate.
267
+ * @param {number} cpY - The control point y-coordinate.
268
+ * @param {number} toX - The ending x-coordinate.
269
+ * @param {number} toY - The ending y-coordinate.
270
+ * @returns {number[]} The calculated points for the quadratic bezier curve.
271
271
  */
272
272
  export const quadraticBezierCurve = (fromX, fromY, cpX, cpY, toX, toY) => {
273
273
  let xa;
@@ -299,9 +299,9 @@ export const quadraticBezierCurve = (fromX, fromY, cpX, cpY, toX, toY) => {
299
299
  };
300
300
 
301
301
  /**
302
- * TBD.
303
- * @param {object} graphicsData - TBD.
304
- * @param {GraphicsData} webGLData - TBD.
302
+ * Updates the graphics data for WebGL rendering.
303
+ * @param {object} graphicsData - The graphics data to update.
304
+ * @param {GraphicsData} webGLData - The WebGL graphics data object.
305
305
  */
306
306
  export const buildRoundedRectangle = (graphicsData, webGLData) => {
307
307
  const rrectData = graphicsData.shape;
@@ -349,9 +349,9 @@ export const buildRoundedRectangle = (graphicsData, webGLData) => {
349
349
  };
350
350
 
351
351
  /**
352
- * TBD.
353
- * @param {object} graphicsData - TBD.
354
- * @param {GraphicsData} webGLData - TBD.
352
+ * Updates the graphics data for WebGL rendering.
353
+ * @param {object} graphicsData - The graphics data to update.
354
+ * @param {GraphicsData} webGLData - The WebGL graphics data object.
355
355
  */
356
356
  export const buildCircle = (graphicsData, webGLData) => {
357
357
  // need to convert points to a nice regular data
@@ -400,9 +400,9 @@ export const buildCircle = (graphicsData, webGLData) => {
400
400
  };
401
401
 
402
402
  /**
403
- * TBD.
404
- * @param {object} graphicsData - TBD.
405
- * @param {GraphicsData} webGLData - TBD.
403
+ * Updates the graphics data for WebGL rendering.
404
+ * @param {object} graphicsData - The graphics data to update.
405
+ * @param {GraphicsData} webGLData - The WebGL graphics data object.
406
406
  */
407
407
  export const buildComplexPoly = (graphicsData, webGLData) => {
408
408
  // TODO - no need to copy this as it gets turned into a Float32Array anyways..
@@ -444,7 +444,7 @@ export const buildComplexPoly = (graphicsData, webGLData) => {
444
444
  };
445
445
 
446
446
  /**
447
- * TBD.
447
+ * Updates the graphics data for WebGL rendering.
448
448
  * @param {object} graphicsData - TBD.
449
449
  * @param {GraphicsData} webGLData - TBD.
450
450
  * @returns {boolean} TBD.
@@ -484,8 +484,8 @@ export const buildPoly = (graphicsData, webGLData) => {
484
484
 
485
485
  /**
486
486
  * TBD.
487
- * @param {import('../graphics.js').Graphics} graphics - TBD.
488
- * @param {WebGLRenderingContext & { id: number }} gl - TBD.
487
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to update.
488
+ * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
489
489
  */
490
490
  export const updateGraphics = (graphics, gl) => {
491
491
  const stencilBufferLimit = getStencilBufferLimit();
@@ -572,9 +572,9 @@ export const updateGraphics = (graphics, gl) => {
572
572
  };
573
573
 
574
574
  /**
575
- * TBD.
576
- * @param {import('../graphics.js').Graphics} graphics - TBD.
577
- * @param {object} renderSession - TBD.
575
+ * Updates the graphics data for WebGL rendering.
576
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to update.
577
+ * @param {object} renderSession - The rendering session.
578
578
  */
579
579
  export const renderGraphics = (graphics, renderSession) => {
580
580
  const gl = renderSession.gl;
@@ -1,7 +1,7 @@
1
1
  export class GraphicsData {
2
2
  /**
3
- * TBD.
4
- * @param {WebGLRenderingContext} gl - TBD.
3
+ * Creates a new GraphicsData instance.
4
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
5
5
  */
6
6
  constructor(gl) {
7
7
  this.gl = gl;
@@ -17,7 +17,7 @@ export class GraphicsData {
17
17
  }
18
18
 
19
19
  /**
20
- * TBD.
20
+ * Destroys this graphics data and cleans up resources.
21
21
  */
22
22
  reset() {
23
23
  this.points = [];
@@ -27,7 +27,7 @@ export class GraphicsData {
27
27
  }
28
28
 
29
29
  /**
30
- * TBD.
30
+ * Updates the graphics data for WebGL rendering.
31
31
  */
32
32
  upload() {
33
33
  const gl = this.gl;
@@ -1,9 +1,9 @@
1
1
  import { updateGraphics } from './graphics.js';
2
2
 
3
3
  /**
4
- * TBD.
5
- * @param {object} maskData - TBD.
6
- * @param {object} renderSession - TBD.
4
+ * Sets up the mask manager for WebGL rendering.
5
+ * @param {object} maskData - The mask data to apply.
6
+ * @param {object} renderSession - The rendering session.
7
7
  */
8
8
  export const pushMask = (maskData, renderSession) => {
9
9
  const gl = renderSession.gl;
@@ -21,9 +21,9 @@ export const pushMask = (maskData, renderSession) => {
21
21
  };
22
22
 
23
23
  /**
24
- * TBD.
25
- * @param {object} maskData - TBD.
26
- * @param {object} renderSession - TBD.
24
+ * Sets up the mask manager for WebGL rendering.
25
+ * @param {object} maskData - The mask data to apply.
26
+ * @param {object} renderSession - The rendering session.
27
27
  */
28
28
  export const popMask = (maskData, renderSession) => {
29
29
  const gl = renderSession.gl;
@@ -8,12 +8,12 @@ import { Texture } from './texture.js';
8
8
 
9
9
  export class RenderTexture extends Texture {
10
10
  /**
11
- * TBD.
12
- * @param {number} width - TBD.
13
- * @param {number} height - TBD.
14
- * @param {import('./renderer.js').WebGLRenderer|import('../canvas/renderer.js').CanvasRenderer} renderer - TBD.
15
- * @param {number} scaleMode - TBD.
16
- * @param {number} resolution - TBD.
11
+ * Creates a new RenderTexture instance.
12
+ * @param {number} width - The width of the render texture.
13
+ * @param {number} height - The height of the render texture.
14
+ * @param {import('./renderer.js').WebGLRenderer|import('../canvas/renderer.js').CanvasRenderer} renderer - The renderer to use.
15
+ * @param {number} scaleMode - The scale mode to use.
16
+ * @param {number} resolution - The resolution to use.
17
17
  */
18
18
  constructor(width, height, renderer, scaleMode, resolution = 1) {
19
19
  const w = width || 100;
@@ -51,36 +51,36 @@ export class RenderTexture extends Texture {
51
51
  }
52
52
 
53
53
  /**
54
- * TBD.
54
+ * Destroys this render texture and cleans up resources.
55
55
  */
56
56
  resize() {
57
57
  // TODO
58
58
  }
59
59
 
60
60
  /**
61
- * TBD.
61
+ * Updates the size of this render texture.
62
62
  */
63
63
  clear() {
64
64
  // TODO
65
65
  }
66
66
 
67
67
  /**
68
- * TBD.
68
+ * Updates the resolution of this render texture.
69
69
  */
70
70
  renderWebGL() {
71
71
  // TODO
72
72
  }
73
73
 
74
74
  /**
75
- * TBD.
75
+ * Updates the scale mode of this render texture.
76
76
  */
77
77
  renderCanvas() {
78
78
  // TODO
79
79
  }
80
80
 
81
81
  /**
82
- * TBD.
83
- * @returns {HTMLImageElement} TBD.
82
+ * Gets the HTML image element for this render texture.
83
+ * @returns {HTMLImageElement} The HTML image element.
84
84
  */
85
85
  getImage() {
86
86
  const image = new Image();
@@ -89,16 +89,16 @@ export class RenderTexture extends Texture {
89
89
  }
90
90
 
91
91
  /**
92
- * TBD.
93
- * @returns {string} TBD.
92
+ * Gets the base64 string representation of this render texture.
93
+ * @returns {string} The base64 string representation.
94
94
  */
95
95
  getBase64() {
96
96
  return this.getCanvas().toDataURL();
97
97
  }
98
98
 
99
99
  /**
100
- * TBD.
101
- * @returns {HTMLCanvasElement} TBD.
100
+ * Gets the canvas element for this render texture.
101
+ * @returns {HTMLCanvasElement} The canvas element.
102
102
  */
103
103
  getCanvas() {
104
104
  // TODO
@@ -33,8 +33,8 @@ import { getWebGLContextErrorCode, getWebGLContextErrorName } from './util.js';
33
33
 
34
34
  export class WebGLRenderer {
35
35
  /**
36
- * TBD.
37
- * @param {import('../../core/game.js').Game} game - TBD.
36
+ * Creates a new WebGLRenderer instance.
37
+ * @param {import('../../core/game.js').Game} game - The game instance.
38
38
  */
39
39
  constructor(game) {
40
40
  /** @type {number} */
@@ -78,7 +78,7 @@ export class WebGLRenderer {
78
78
  }
79
79
 
80
80
  /**
81
- * TBD.
81
+ * Destroys this renderer and cleans up resources.
82
82
  */
83
83
  destroy() {
84
84
  window.PhaserRegistry.GL_CONTEXTS[this.glContextId] = null;
@@ -106,7 +106,7 @@ export class WebGLRenderer {
106
106
  }
107
107
 
108
108
  /**
109
- * TBD.
109
+ * Initializes the WebGL registry.
110
110
  */
111
111
  initRegistry() {
112
112
  if (!window.PhaserRegistry.GL_CONTEXT_ID) {
@@ -121,8 +121,8 @@ export class WebGLRenderer {
121
121
  }
122
122
 
123
123
  /**
124
- * TBD.
125
- * @param {import('../../core/game.js').Game} game - TBD.
124
+ * Initializes the WebGL context for rendering.
125
+ * @param {import('../../core/game.js').Game} game - The game instance.
126
126
  * @throws {Error}
127
127
  */
128
128
  initContext(game) {
@@ -166,8 +166,8 @@ export class WebGLRenderer {
166
166
  }
167
167
 
168
168
  /**
169
- * TBD.
170
- * @param {import('../../core/stage.js').Stage} stage - TBD.
169
+ * Renders the stage to WebGL.
170
+ * @param {import('../../core/stage.js').Stage} stage - The root stage to render.
171
171
  */
172
172
  render(stage) {
173
173
  if (this.contextLost) {
@@ -188,11 +188,11 @@ export class WebGLRenderer {
188
188
  }
189
189
 
190
190
  /**
191
- * TBD.
192
- * @param {import('../../display/display_object.js').DisplayObject} displayObject - TBD.
193
- * @param {Point} projection - TBD.
194
- * @param {object} buffer - TBD.
195
- * @param {import('../../geom/matrix.js').Matrix} matrix - TBD.
191
+ * Renders a display object to WebGL.
192
+ * @param {import('../../display/display_object.js').DisplayObject} displayObject - The display object to render.
193
+ * @param {Point} projection - The projection matrix.
194
+ * @param {object} buffer - The render buffer.
195
+ * @param {import('../../geom/matrix.js').Matrix} matrix - The transformation matrix.
196
196
  */
197
197
  renderDisplayObject(displayObject, projection, buffer, matrix) {
198
198
  this.renderSession.blendModeManager.setBlendMode(BLEND_NORMAL);
@@ -215,9 +215,9 @@ export class WebGLRenderer {
215
215
  }
216
216
 
217
217
  /**
218
- * TBD.
219
- * @param {number} width - TBD.
220
- * @param {number} height - TBD.
218
+ * Resizes the WebGL canvas to the specified dimensions.
219
+ * @param {number} width - The new width of the canvas.
220
+ * @param {number} height - The new height of the canvas.
221
221
  */
222
222
  resize(width, height) {
223
223
  this.width = width * this.resolution;
@@ -234,9 +234,9 @@ export class WebGLRenderer {
234
234
  }
235
235
 
236
236
  /**
237
- * TBD.
238
- * @param {import('./base_texture.js').BaseTexture} texture - TBD.
239
- * @returns {boolean} TBD.
237
+ * Updates a texture in the WebGL context.
238
+ * @param {import('./base_texture.js').BaseTexture} texture - The base texture to update.
239
+ * @returns {boolean} Whether the update was successful.
240
240
  */
241
241
  updateTexture(texture) {
242
242
  if (!texture.hasLoaded) {
@@ -277,7 +277,7 @@ export class WebGLRenderer {
277
277
  }
278
278
 
279
279
  /**
280
- * TBD.
280
+ * Maps blend modes to WebGL rendering operations.
281
281
  */
282
282
  mapBlendModes() {
283
283
  if (window.PhaserRegistry.blendModesWebGL) {
@@ -5,8 +5,8 @@ import { compileProgram } from '../util.js';
5
5
 
6
6
  export class ComplexPrimitiveShader {
7
7
  /**
8
- * TBD.
9
- * @param {WebGLRenderingContext} gl - TBD.
8
+ * Creates a new ComplexShader instance.
9
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
10
10
  */
11
11
  constructor(gl) {
12
12
  this.gl = gl;
@@ -44,7 +44,7 @@ export class ComplexPrimitiveShader {
44
44
  }
45
45
 
46
46
  /**
47
- * TBD.
47
+ * Destroys this shader and cleans up resources.
48
48
  */
49
49
  init() {
50
50
  const gl = this.gl;
@@ -66,7 +66,7 @@ export class ComplexPrimitiveShader {
66
66
  }
67
67
 
68
68
  /**
69
- * TBD.
69
+ * Binds this shader to the WebGL context.
70
70
  */
71
71
  destroy() {
72
72
  this.gl.deleteProgram(this.program);
@@ -5,8 +5,8 @@ import { compileProgram } from '../util.js';
5
5
 
6
6
  export class FastShader {
7
7
  /**
8
- * TBD.
9
- * @param {WebGLRenderingContext} gl - TBD.
8
+ * Creates a new FastShader instance.
9
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
10
10
  */
11
11
  constructor(gl) {
12
12
  this.gl = gl;
@@ -56,7 +56,7 @@ export class FastShader {
56
56
  }
57
57
 
58
58
  /**
59
- * TBD.
59
+ * Creates a new FastShader instance.
60
60
  */
61
61
  init() {
62
62
  const gl = this.gl;
@@ -96,7 +96,7 @@ export class FastShader {
96
96
  }
97
97
 
98
98
  /**
99
- * TBD.
99
+ * Destroys this shader and cleans up resources.
100
100
  */
101
101
  destroy() {
102
102
  this.gl.deleteProgram(this.program);
@@ -25,8 +25,8 @@ const defaultVertexSrc = [
25
25
 
26
26
  export class NormalShader {
27
27
  /**
28
- * TBD.
29
- * @param {WebGLRenderingContext & { id: number }} gl - TBD.
28
+ * Creates a new NormalShader instance.
29
+ * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
30
30
  */
31
31
  constructor(gl) {
32
32
  this.gl = gl;
@@ -53,7 +53,7 @@ export class NormalShader {
53
53
  }
54
54
 
55
55
  /**
56
- * TBD.
56
+ * Destroys this shader and cleans up resources.
57
57
  */
58
58
  init() {
59
59
  const gl = this.gl;
@@ -89,7 +89,7 @@ export class NormalShader {
89
89
  }
90
90
 
91
91
  /**
92
- * TBD.
92
+ * Binds this shader to the WebGL context.
93
93
  */
94
94
  initUniforms() {
95
95
  this.textureCount = 1;
@@ -133,8 +133,8 @@ export class NormalShader {
133
133
  }
134
134
 
135
135
  /**
136
- * TBD.
137
- * @param {object} uniform - TBD.
136
+ * Sets a uniform value for this shader.
137
+ * @param {object} uniform - The uniform to set.
138
138
  */
139
139
  initSampler2D(uniform) {
140
140
  if (!uniform.value || !uniform.value.baseTexture || !uniform.value.baseTexture.hasLoaded) {
@@ -186,7 +186,7 @@ export class NormalShader {
186
186
  }
187
187
 
188
188
  /**
189
- * TBD.
189
+ * Sets the shader to use for rendering.
190
190
  */
191
191
  syncUniforms() {
192
192
  this.textureCount = 1;
@@ -236,7 +236,7 @@ export class NormalShader {
236
236
  }
237
237
 
238
238
  /**
239
- * TBD.
239
+ * Destroys this shader and cleans up resources.
240
240
  */
241
241
  destroy() {
242
242
  this.gl.deleteProgram(this.program);
@@ -5,8 +5,8 @@ import { compileProgram } from '../util.js';
5
5
 
6
6
  export class PrimitiveShader {
7
7
  /**
8
- * TBD.
9
- * @param {WebGLRenderingContext} gl - TBD.
8
+ * Creates a new PrimitiveShader instance.
9
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
10
10
  */
11
11
  constructor(gl) {
12
12
  this.gl = gl;
@@ -43,7 +43,7 @@ export class PrimitiveShader {
43
43
  }
44
44
 
45
45
  /**
46
- * TBD.
46
+ * Destroys this shader and cleans up resources.
47
47
  */
48
48
  init() {
49
49
  const gl = this.gl;
@@ -64,7 +64,7 @@ export class PrimitiveShader {
64
64
  }
65
65
 
66
66
  /**
67
- * TBD.
67
+ * Binds this shader to the WebGL context.
68
68
  */
69
69
  destroy() {
70
70
  this.gl.deleteProgram(this.program);
@@ -5,8 +5,8 @@ import { compileProgram } from '../util.js';
5
5
 
6
6
  export class StripShader {
7
7
  /**
8
- * TBD.
9
- * @param {WebGLRenderingContext} gl - TBD.
8
+ * Creates a new StripShader instance.
9
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
10
10
  */
11
11
  constructor(gl) {
12
12
  this.gl = gl;
@@ -47,7 +47,7 @@ export class StripShader {
47
47
  }
48
48
 
49
49
  /**
50
- * TBD.
50
+ * Destroys this shader and cleans up resources.
51
51
  */
52
52
  init() {
53
53
  const gl = this.gl;
@@ -69,7 +69,7 @@ export class StripShader {
69
69
  }
70
70
 
71
71
  /**
72
- * TBD.
72
+ * Binds this shader to the WebGL context.
73
73
  */
74
74
  destroy() {
75
75
  this.gl.deleteProgram(this.program);
@@ -6,7 +6,7 @@ import { StripShader } from './shader/strip.js';
6
6
 
7
7
  export class WebGLShaderManager {
8
8
  /**
9
- * TBD.
9
+ * Initializes the shader manager with a WebGL context.
10
10
  */
11
11
  constructor() {
12
12
  this.gl = null;
@@ -25,8 +25,8 @@ export class WebGLShaderManager {
25
25
  }
26
26
 
27
27
  /**
28
- * TBD.
29
- * @param {WebGLRenderingContext & { id: number }} gl - TBD.
28
+ * Initializes the shader manager with a WebGL context.
29
+ * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
30
30
  */
31
31
  setContext(gl) {
32
32
  this.gl = gl;
@@ -39,8 +39,8 @@ export class WebGLShaderManager {
39
39
  }
40
40
 
41
41
  /**
42
- * TBD.
43
- * @param {number[]} attribs - TBD.
42
+ * Sets up the shader manager for WebGL rendering.
43
+ * @param {number[]} attribs - The attribute locations to set up.
44
44
  */
45
45
  setAttribs(attribs) {
46
46
  // reset temp state
@@ -67,9 +67,9 @@ export class WebGLShaderManager {
67
67
  }
68
68
 
69
69
  /**
70
- * TBD.
71
- * @param {NormalShader} shader - TBD.
72
- * @returns {boolean} TBD.
70
+ * Sets up the shader manager for WebGL rendering.
71
+ * @param {NormalShader} shader - The shader to set up.
72
+ * @returns {boolean} Whether the shader setup was successful.
73
73
  */
74
74
  setShader(shader) {
75
75
  if (this._currentId === shader._UID) {
@@ -83,7 +83,7 @@ export class WebGLShaderManager {
83
83
  }
84
84
 
85
85
  /**
86
- * TBD.
86
+ * Destroys the manager.
87
87
  */
88
88
  destroy() {
89
89
  this.attribState = null;