@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
@@ -3,7 +3,7 @@ import { NormalShader } from './shader/normal.js';
3
3
 
4
4
  export class WebGLSpriteBatch {
5
5
  /**
6
- * TBD.
6
+ * Creates a new SpriteBatch instance.
7
7
  */
8
8
  constructor() {
9
9
  this.vertSize = 5;
@@ -45,8 +45,8 @@ export class WebGLSpriteBatch {
45
45
  }
46
46
 
47
47
  /**
48
- * TBD.
49
- * @param {WebGLRenderingContext & { id: number }} gl - TBD.
48
+ * Renders a sprite using WebGL.
49
+ * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
50
50
  */
51
51
  setContext(gl) {
52
52
  this.gl = gl;
@@ -68,8 +68,8 @@ export class WebGLSpriteBatch {
68
68
  }
69
69
 
70
70
  /**
71
- * TBD.
72
- * @param {object} renderSession - TBD.
71
+ * Renders the sprite batch using WebGL.
72
+ * @param {object} renderSession - The render session to use.
73
73
  */
74
74
  begin(renderSession) {
75
75
  this.renderSession = renderSession;
@@ -78,16 +78,16 @@ export class WebGLSpriteBatch {
78
78
  }
79
79
 
80
80
  /**
81
- * TBD.
81
+ * Updates the sprite batch.
82
82
  */
83
83
  end() {
84
84
  this.flush();
85
85
  }
86
86
 
87
87
  /**
88
- * TBD.
89
- * @param {import('../../display/image.js').Image} sprite - TBD.
90
- * @param {import('../../geom/matrix.js').Matrix} matrix - TBD.
88
+ * Renders a sprite using the sprite batch.
89
+ * @param {import('../../display/image.js').Image} sprite - The sprite to render.
90
+ * @param {import('../../geom/matrix.js').Matrix} matrix - The transformation matrix.
91
91
  */
92
92
  render(sprite, matrix) {
93
93
  const texture = sprite.texture;
@@ -187,14 +187,14 @@ export class WebGLSpriteBatch {
187
187
  }
188
188
 
189
189
  /**
190
- * TBD.
190
+ * Binds the sprite batch to the WebGL context.
191
191
  */
192
192
  renderTilingSprite() {
193
193
  // TODO
194
194
  }
195
195
 
196
196
  /**
197
- * TBD.
197
+ * Updates the sprite batch.
198
198
  */
199
199
  flush() {
200
200
  // If the batch is length 0 then return as there is nothing to draw
@@ -293,10 +293,10 @@ export class WebGLSpriteBatch {
293
293
  }
294
294
 
295
295
  /**
296
- * TBD.
297
- * @param {import('./base_texture.js').BaseTexture} texture - TBD.
298
- * @param {number} size - TBD.
299
- * @param {number} startIndex - TBD.
296
+ * Updates the sprite batch with a new texture.
297
+ * @param {import('./base_texture.js').BaseTexture} texture - The texture to use.
298
+ * @param {number} size - The size of the batch.
299
+ * @param {number} startIndex - The start index in the batch.
300
300
  */
301
301
  renderBatch(texture, size, startIndex) {
302
302
  if (size === 0) {
@@ -320,7 +320,7 @@ export class WebGLSpriteBatch {
320
320
  }
321
321
 
322
322
  /**
323
- * TBD.
323
+ * Destroys this sprite batch and cleans up resources.
324
324
  */
325
325
  stop() {
326
326
  this.flush();
@@ -328,14 +328,14 @@ export class WebGLSpriteBatch {
328
328
  }
329
329
 
330
330
  /**
331
- * TBD.
331
+ * Renders the sprite batch using Canvas.
332
332
  */
333
333
  start() {
334
334
  this.dirty = true;
335
335
  }
336
336
 
337
337
  /**
338
- * TBD.
338
+ * Destroys the sprite batch instance.
339
339
  */
340
340
  destroy() {
341
341
  this.vertices = null;
@@ -2,7 +2,7 @@ import { hex2rgb } from '../../util/math.js';
2
2
 
3
3
  export class WebGLStencilManager {
4
4
  /**
5
- * TBD.
5
+ * Initializes the stencil manager.
6
6
  */
7
7
  constructor() {
8
8
  this.stencilStack = [];
@@ -11,15 +11,15 @@ export class WebGLStencilManager {
11
11
  }
12
12
 
13
13
  /**
14
- * TBD.
15
- * @param {WebGLRenderingContext} gl - TBD.
14
+ * Binds the stencil buffer for rendering.
15
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
16
16
  */
17
17
  setContext(gl) {
18
18
  this.gl = gl;
19
19
  }
20
20
 
21
21
  /**
22
- * TBD.
22
+ * Sets up the stencil buffer for rendering.
23
23
  */
24
24
  destroy() {
25
25
  this.stencilStack = null;
@@ -27,10 +27,10 @@ export class WebGLStencilManager {
27
27
  }
28
28
 
29
29
  /**
30
- * TBD.
31
- * @param {import('../graphics.js').Graphics} graphics - TBD.
32
- * @param {import('./graphics_data.js').GraphicsData} webGLData - TBD.
33
- * @param {object} renderSession - TBD.
30
+ * Renders the stencil buffer for graphics.
31
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
32
+ * @param {import('./graphics_data.js').GraphicsData} webGLData - The WebGL graphics data.
33
+ * @param {object} renderSession - The rendering session.
34
34
  */
35
35
  pushStencil(graphics, webGLData, renderSession) {
36
36
  const gl = renderSession.gl;
@@ -85,10 +85,10 @@ export class WebGLStencilManager {
85
85
  }
86
86
 
87
87
  /**
88
- * TBD.
89
- * @param {import('../graphics.js').Graphics} graphics - TBD.
90
- * @param {import('./graphics_data.js').GraphicsData} webGLData - TBD.
91
- * @param {object} renderSession - TBD.
88
+ * Renders the stencil buffer for graphics.
89
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
90
+ * @param {import('./graphics_data.js').GraphicsData} webGLData - The WebGL graphics data.
91
+ * @param {object} renderSession - The rendering session.
92
92
  */
93
93
  bindGraphics(graphics, webGLData, renderSession) {
94
94
  // if(this._currentGraphics === graphics)return;
@@ -132,10 +132,10 @@ export class WebGLStencilManager {
132
132
  }
133
133
 
134
134
  /**
135
- * TBD.
136
- * @param {import('../graphics.js').Graphics} graphics - TBD.
137
- * @param {import('./graphics_data.js').GraphicsData} webGLData - TBD.
138
- * @param {object} renderSession - TBD.
135
+ * Renders the stencil buffer for graphics.
136
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
137
+ * @param {import('./graphics_data.js').GraphicsData} webGLData - The WebGL graphics data.
138
+ * @param {object} renderSession - The rendering session.
139
139
  */
140
140
  popStencil(graphics, webGLData, renderSession) {
141
141
  const gl = renderSession.gl;
@@ -2,7 +2,7 @@ import { Rectangle } from '../../geom/rectangle.js';
2
2
 
3
3
  export class TextureUvs {
4
4
  /**
5
- * TBD.
5
+ * Creates a new Texture instance.
6
6
  */
7
7
  constructor() {
8
8
  this.x0 = 0;
@@ -18,11 +18,11 @@ export class TextureUvs {
18
18
 
19
19
  export class Texture {
20
20
  /**
21
- * TBD.
22
- * @param {import('./base_texture.js').BaseTexture} baseTexture - TBD.
23
- * @param {Rectangle | null | undefined} frame - TBD.
24
- * @param {Rectangle | null | undefined} crop - TBD.
25
- * @param {Rectangle | null | undefined} trim - TBD.
21
+ * Creates a new Texture instance.
22
+ * @param {import('./base_texture.js').BaseTexture} baseTexture - The base texture to use.
23
+ * @param {Rectangle | null | undefined} frame - The frame rectangle.
24
+ * @param {Rectangle | null | undefined} crop - The crop rectangle.
25
+ * @param {Rectangle | null | undefined} trim - The trim rectangle.
26
26
  */
27
27
  constructor(baseTexture, frame = null, crop = null, trim = null) {
28
28
  this.noFrame = false;
@@ -63,7 +63,7 @@ export class Texture {
63
63
  }
64
64
 
65
65
  /**
66
- * TBD.
66
+ * Destroys this texture and cleans up resources.
67
67
  */
68
68
  onBaseTextureLoaded() {
69
69
  if (this.noFrame) {
@@ -73,8 +73,8 @@ export class Texture {
73
73
  }
74
74
 
75
75
  /**
76
- * TBD.
77
- * @param {boolean} destroyBase - TBD.
76
+ * Destroys this texture and cleans up resources.
77
+ * @param {boolean} destroyBase - Whether to destroy the base texture as well.
78
78
  */
79
79
  destroy(destroyBase = false) {
80
80
  if (destroyBase) {
@@ -84,9 +84,9 @@ export class Texture {
84
84
  }
85
85
 
86
86
  /**
87
- * TBD.
88
- * @param {Rectangle} frame - TBD.
89
- * @throws {Error}.
87
+ * Sets the frame of this texture.
88
+ * @param {Rectangle} frame - The new frame rectangle.
89
+ * @throws {Error} If the operation fails.
90
90
  */
91
91
  setFrame(frame) {
92
92
  this.noFrame = false;
@@ -124,7 +124,7 @@ export class Texture {
124
124
  }
125
125
 
126
126
  /**
127
- * TBD.
127
+ * Updates the texture UVs based on the crop frame.
128
128
  */
129
129
  _updateUvs() {
130
130
  if (!this._uvs) {
@@ -2,10 +2,10 @@ import { BaseTexture } from './base_texture.js';
2
2
  import { Texture } from './texture.js';
3
3
 
4
4
  /**
5
- * TBD.
6
- * @param {HTMLCanvasElement} canvas - TBD.
7
- * @param {number} [scaleMode] - TBD.
8
- * @returns {BaseTexture} TBD.
5
+ * Creates a new BaseTexture from a canvas element.
6
+ * @param {HTMLCanvasElement} canvas - The canvas element to use as the texture source.
7
+ * @param {number} [scaleMode] - The scale mode to use for the texture.
8
+ * @returns {BaseTexture} The newly created BaseTexture instance.
9
9
  */
10
10
  export const baseTextureFromCanvas = (canvas, scaleMode) => {
11
11
  if (canvas.width === 0) {
@@ -18,10 +18,10 @@ export const baseTextureFromCanvas = (canvas, scaleMode) => {
18
18
  };
19
19
 
20
20
  /**
21
- * TBD.
22
- * @param {HTMLCanvasElement} canvas - TBD.
23
- * @param {number} [scaleMode] - TBD.
24
- * @returns {Texture} TBD.
21
+ * Creates a new Texture from a canvas element.
22
+ * @param {HTMLCanvasElement} canvas - The canvas element to use as the texture source.
23
+ * @param {number} [scaleMode] - The scale mode to use for the texture.
24
+ * @returns {Texture} The newly created Texture instance.
25
25
  */
26
26
  export const textureFromCanvas = (canvas, scaleMode) => {
27
27
  return new Texture(baseTextureFromCanvas(canvas, scaleMode));
@@ -14,18 +14,18 @@ export const OUT_OF_MEMORY = 0x0505;
14
14
  export const CONTEXT_LOST_WEBGL = 0x9242;
15
15
 
16
16
  /**
17
- * TBD.
18
- * @param {WebGLRenderingContext} gl - TBD.
19
- * @returns {number} TBD.
17
+ * Gets the WebGL context error code.
18
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
19
+ * @returns {number} The error code from the WebGL context.
20
20
  */
21
21
  export const getWebGLContextErrorCode = (gl) => {
22
22
  return gl?.getError() ?? 0;
23
23
  };
24
24
 
25
25
  /**
26
- * TBD.
27
- * @param {number} errorCode - TBD.
28
- * @returns {string} TBD.
26
+ * Gets the WebGL context error name from an error code.
27
+ * @param {number} errorCode - The error code to look up.
28
+ * @returns {string} The name of the WebGL error.
29
29
  */
30
30
  export const getWebGLContextErrorName = (errorCode) => {
31
31
  switch (errorCode) {
@@ -49,16 +49,16 @@ export const getWebGLContextErrorName = (errorCode) => {
49
49
  };
50
50
 
51
51
  /**
52
- * TBD.
52
+ * Initializes default shaders.
53
53
  */
54
54
  export const initDefaultShaders = () => {};
55
55
 
56
56
  /**
57
- * TBD.
58
- * @param {WebGLRenderingContext} gl - TBD.
59
- * @param {string[]|string} shaderSrc - TBD.
60
- * @param {object} shaderType - TBD.
61
- * @returns {WebGLShader} TBD.
57
+ * Compiles a WebGL shader.
58
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
59
+ * @param {string[]|string} shaderSrc - The shader source code.
60
+ * @param {object} shaderType - The type of shader to compile.
61
+ * @returns {WebGLShader} The compiled WebGL shader or null if compilation failed.
62
62
  */
63
63
  export const compileShader = (gl, shaderSrc, shaderType) => {
64
64
  const src = Array.isArray(shaderSrc) ? shaderSrc.join('\n') : shaderSrc;
@@ -76,31 +76,31 @@ export const compileShader = (gl, shaderSrc, shaderType) => {
76
76
  };
77
77
 
78
78
  /**
79
- * TBD.
80
- * @param {WebGLRenderingContext} gl - TBD.
81
- * @param {string[]|string} shaderSrc - TBD.
82
- * @returns {WebGLShader} TBD.
79
+ * Compiles a WebGL vertex shader.
80
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
81
+ * @param {string[]|string} shaderSrc - The vertex shader source code.
82
+ * @returns {WebGLShader} The compiled WebGL vertex shader or null if compilation failed.
83
83
  */
84
84
  export const compileVertexShader = (gl, shaderSrc) => {
85
85
  return compileShader(gl, shaderSrc, gl.VERTEX_SHADER);
86
86
  };
87
87
 
88
88
  /**
89
- * TBD.
90
- * @param {WebGLRenderingContext} gl - TBD.
91
- * @param {string[]|string} shaderSrc - TBD.
92
- * @returns {WebGLShader} TBD.
89
+ * Compiles a WebGL fragment shader.
90
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
91
+ * @param {string[]|string} shaderSrc - The fragment shader source code.
92
+ * @returns {WebGLShader} The compiled WebGL fragment shader or null if compilation failed.
93
93
  */
94
94
  export const compileFragmentShader = (gl, shaderSrc) => {
95
95
  return compileShader(gl, shaderSrc, gl.FRAGMENT_SHADER);
96
96
  };
97
97
 
98
98
  /**
99
- * TBD.
100
- * @param {WebGLRenderingContext} gl - TBD.
101
- * @param {string[]|string} vertexSrc - TBD.
102
- * @param {string[]|string} fragmentSrc - TBD.
103
- * @returns {WebGLProgram} TBD.
99
+ * Compiles a WebGL shader program.
100
+ * @param {WebGLRenderingContext} gl - The WebGL rendering context.
101
+ * @param {string[]|string} vertexSrc - The vertex shader source code.
102
+ * @param {string[]|string} fragmentSrc - The fragment shader source code.
103
+ * @returns {WebGLProgram} The compiled WebGL shader program or null if compilation failed.
104
104
  */
105
105
  export const compileProgram = (gl, vertexSrc, fragmentSrc) => {
106
106
  const fragmentShader = compileFragmentShader(gl, fragmentSrc);