melonjs 10.8.0 → 10.11.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 (95) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +32 -25
  3. package/dist/melonjs.js +1833 -2267
  4. package/dist/melonjs.min.js +4 -4
  5. package/dist/melonjs.module.d.ts +642 -1416
  6. package/dist/melonjs.module.js +1778 -2237
  7. package/package.json +16 -16
  8. package/src/audio/audio.js +0 -1
  9. package/src/camera/camera2d.js +1 -16
  10. package/src/entity/entity.js +1 -4
  11. package/src/game.js +2 -2
  12. package/src/geometries/ellipse.js +18 -27
  13. package/src/geometries/line.js +5 -8
  14. package/src/geometries/path2d.js +10 -20
  15. package/src/geometries/poly.js +28 -45
  16. package/src/geometries/rectangle.js +24 -36
  17. package/src/geometries/roundrect.js +96 -3
  18. package/src/index.js +7 -2
  19. package/src/input/gamepad.js +5 -16
  20. package/src/input/keyboard.js +1 -9
  21. package/src/input/pointer.js +0 -1
  22. package/src/input/pointerevent.js +14 -23
  23. package/src/lang/deprecated.js +9 -6
  24. package/src/level/level.js +0 -9
  25. package/src/level/tiled/TMXGroup.js +0 -4
  26. package/src/level/tiled/TMXLayer.js +0 -8
  27. package/src/level/tiled/TMXObject.js +0 -3
  28. package/src/level/tiled/TMXTile.js +4 -5
  29. package/src/level/tiled/TMXTileMap.js +1 -7
  30. package/src/level/tiled/TMXTileset.js +0 -5
  31. package/src/level/tiled/TMXTilesetGroup.js +1 -4
  32. package/src/level/tiled/TMXUtils.js +1 -4
  33. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
  34. package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
  35. package/src/level/tiled/renderer/TMXRenderer.js +1 -7
  36. package/src/loader/loader.js +0 -11
  37. package/src/loader/loadingscreen.js +16 -5
  38. package/src/math/color.js +10 -30
  39. package/src/math/math.js +0 -10
  40. package/src/math/matrix2.js +12 -27
  41. package/src/math/matrix3.js +1 -22
  42. package/src/math/observable_vector2.js +0 -29
  43. package/src/math/observable_vector3.js +0 -29
  44. package/src/math/vector2.js +3 -40
  45. package/src/math/vector3.js +4 -41
  46. package/src/particles/emitter.js +11 -12
  47. package/src/physics/body.js +1 -1
  48. package/src/physics/bounds.js +5 -19
  49. package/src/physics/collision.js +0 -1
  50. package/src/physics/detector.js +0 -4
  51. package/src/physics/quadtree.js +0 -7
  52. package/src/physics/sat.js +3 -3
  53. package/src/physics/world.js +0 -4
  54. package/src/plugin/plugin.js +0 -2
  55. package/src/polyfill/index.js +1 -0
  56. package/src/polyfill/roundrect.js +237 -0
  57. package/src/renderable/GUI.js +5 -10
  58. package/src/renderable/collectable.js +1 -0
  59. package/src/renderable/container.js +26 -54
  60. package/src/renderable/dragndrop.js +0 -9
  61. package/src/renderable/imagelayer.js +3 -7
  62. package/src/renderable/light2d.js +114 -0
  63. package/src/renderable/renderable.js +22 -43
  64. package/src/renderable/sprite.js +13 -25
  65. package/src/renderable/trigger.js +1 -1
  66. package/src/state/stage.js +72 -6
  67. package/src/state/state.js +3 -20
  68. package/src/system/device.js +14 -53
  69. package/src/system/event.js +11 -0
  70. package/src/system/pooling.js +19 -8
  71. package/src/system/save.js +9 -11
  72. package/src/system/timer.js +239 -218
  73. package/src/text/bitmaptextdata.js +1 -4
  74. package/src/text/glyph.js +2 -2
  75. package/src/text/text.js +19 -21
  76. package/src/text/textmetrics.js +0 -2
  77. package/src/tweens/easing.js +1 -1
  78. package/src/tweens/interpolation.js +2 -2
  79. package/src/tweens/tween.js +1 -13
  80. package/src/utils/agent.js +1 -3
  81. package/src/utils/array.js +0 -3
  82. package/src/utils/file.js +0 -2
  83. package/src/utils/function.js +0 -2
  84. package/src/utils/string.js +0 -6
  85. package/src/utils/utils.js +2 -5
  86. package/src/video/canvas/canvas_renderer.js +76 -103
  87. package/src/video/renderer.js +43 -50
  88. package/src/video/{texture.js → texture/atlas.js} +8 -8
  89. package/src/video/{texture_cache.js → texture/cache.js} +4 -5
  90. package/src/video/texture/canvas_texture.js +99 -0
  91. package/src/video/video.js +3 -3
  92. package/src/video/webgl/glshader.js +0 -5
  93. package/src/video/webgl/utils/uniforms.js +4 -7
  94. package/src/video/webgl/webgl_compositor.js +0 -14
  95. package/src/video/webgl/webgl_renderer.js +73 -97
@@ -38,7 +38,7 @@ class Renderer {
38
38
  * @public
39
39
  * @name settings
40
40
  * @memberof Renderer#
41
- * @enum {object}
41
+ * @type {object}
42
42
  */
43
43
  this.settings = options;
44
44
 
@@ -64,6 +64,11 @@ class Renderer {
64
64
  */
65
65
  this.currentScissor = new Int32Array([ 0, 0, this.settings.width, this.settings.height ]);
66
66
 
67
+ /**
68
+ * @ignore
69
+ */
70
+ this.maskLevel = 0;
71
+
67
72
  /**
68
73
  * @ignore
69
74
  */
@@ -107,16 +112,14 @@ class Renderer {
107
112
  /**
108
113
  * prepare the framebuffer for drawing a new frame
109
114
  * @name clear
110
- * @memberof Renderer.prototype
111
- * @function
115
+ * @memberof Renderer
112
116
  */
113
117
  clear() {}
114
118
 
115
119
  /**
116
120
  * Reset context state
117
121
  * @name reset
118
- * @memberof Renderer.prototype
119
- * @function
122
+ * @memberof Renderer
120
123
  */
121
124
  reset() {
122
125
  this.resetTransform();
@@ -128,13 +131,13 @@ class Renderer {
128
131
  this.currentScissor[1] = 0;
129
132
  this.currentScissor[2] = this.backBufferCanvas.width;
130
133
  this.currentScissor[3] = this.backBufferCanvas.height;
134
+ this.clearMask();
131
135
  }
132
136
 
133
137
  /**
134
138
  * return a reference to the system canvas
135
139
  * @name getCanvas
136
- * @memberof Renderer.prototype
137
- * @function
140
+ * @memberof Renderer
138
141
  * @returns {HTMLCanvasElement}
139
142
  */
140
143
  getCanvas() {
@@ -144,8 +147,7 @@ class Renderer {
144
147
  /**
145
148
  * return a reference to the screen canvas
146
149
  * @name getScreenCanvas
147
- * @memberof Renderer.prototype
148
- * @function
150
+ * @memberof Renderer
149
151
  * @returns {HTMLCanvasElement}
150
152
  */
151
153
  getScreenCanvas() {
@@ -156,8 +158,7 @@ class Renderer {
156
158
  * return a reference to the screen canvas corresponding 2d Context<br>
157
159
  * (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
158
160
  * @name getScreenContext
159
- * @memberof Renderer.prototype
160
- * @function
161
+ * @memberof Renderer
161
162
  * @returns {CanvasRenderingContext2D}
162
163
  */
163
164
  getScreenContext() {
@@ -167,8 +168,7 @@ class Renderer {
167
168
  /**
168
169
  * returns the current blend mode for this renderer
169
170
  * @name getBlendMode
170
- * @memberof Renderer.prototype
171
- * @function
171
+ * @memberof Renderer
172
172
  * @returns {string} blend mode
173
173
  */
174
174
  getBlendMode() {
@@ -179,8 +179,7 @@ class Renderer {
179
179
  * Returns the 2D Context object of the given Canvas<br>
180
180
  * Also configures anti-aliasing and blend modes based on constructor options.
181
181
  * @name getContext2d
182
- * @memberof Renderer.prototype
183
- * @function
182
+ * @memberof Renderer
184
183
  * @param {HTMLCanvasElement} canvas
185
184
  * @param {boolean} [transparent=true] use false to disable transparency
186
185
  * @returns {CanvasRenderingContext2D}
@@ -217,8 +216,7 @@ class Renderer {
217
216
  /**
218
217
  * return the width of the system Canvas
219
218
  * @name getWidth
220
- * @memberof Renderer.prototype
221
- * @function
219
+ * @memberof Renderer
222
220
  * @returns {number}
223
221
  */
224
222
  getWidth() {
@@ -228,8 +226,7 @@ class Renderer {
228
226
  /**
229
227
  * return the height of the system Canvas
230
228
  * @name getHeight
231
- * @memberof Renderer.prototype
232
- * @function
229
+ * @memberof Renderer
233
230
  * @returns {number} height of the system Canvas
234
231
  */
235
232
  getHeight() {
@@ -239,8 +236,7 @@ class Renderer {
239
236
  /**
240
237
  * get the current fill & stroke style color.
241
238
  * @name getColor
242
- * @memberof Renderer.prototype
243
- * @function
239
+ * @memberof Renderer
244
240
  * @returns {Color} current global color
245
241
  */
246
242
  getColor() {
@@ -250,8 +246,7 @@ class Renderer {
250
246
  /**
251
247
  * return the current global alpha
252
248
  * @name globalAlpha
253
- * @memberof Renderer.prototype
254
- * @function
249
+ * @memberof Renderer
255
250
  * @returns {number}
256
251
  */
257
252
  globalAlpha() {
@@ -261,8 +256,7 @@ class Renderer {
261
256
  /**
262
257
  * check if the given rect or bounds overlaps with the renderer screen coordinates
263
258
  * @name overlaps
264
- * @memberof Renderer.prototype
265
- * @function
259
+ * @memberof Renderer
266
260
  * @param {Rect|Bounds} bounds
267
261
  * @returns {boolean} true if overlaps
268
262
  */
@@ -277,8 +271,7 @@ class Renderer {
277
271
  /**
278
272
  * resizes the system canvas
279
273
  * @name resize
280
- * @memberof Renderer.prototype
281
- * @function
274
+ * @memberof Renderer
282
275
  * @param {number} width new width of the canvas
283
276
  * @param {number} height new height of the canvas
284
277
  */
@@ -298,8 +291,7 @@ class Renderer {
298
291
  /**
299
292
  * enable/disable image smoothing (scaling interpolation) for the given context
300
293
  * @name setAntiAlias
301
- * @memberof Renderer.prototype
302
- * @function
294
+ * @memberof Renderer
303
295
  * @param {CanvasRenderingContext2D} context
304
296
  * @param {boolean} [enable=false]
305
297
  */
@@ -328,8 +320,7 @@ class Renderer {
328
320
  /**
329
321
  * set/change the current projection matrix (WebGL only)
330
322
  * @name setProjection
331
- * @memberof Renderer.prototype
332
- * @function
323
+ * @memberof Renderer
333
324
  * @param {Matrix3d} matrix
334
325
  */
335
326
  setProjection(matrix) {
@@ -339,19 +330,24 @@ class Renderer {
339
330
  /**
340
331
  * stroke the given shape
341
332
  * @name stroke
342
- * @memberof Renderer.prototype
343
- * @function
333
+ * @memberof Renderer
344
334
  * @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
345
335
  * @param {boolean} [fill=false] fill the shape with the current color if true
346
336
  */
347
337
  stroke(shape, fill) {
348
338
  if (shape instanceof RoundRect) {
349
339
  this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
350
- } else if (shape instanceof Rect || shape instanceof Bounds) {
340
+ return;
341
+ }
342
+ if (shape instanceof Rect || shape instanceof Bounds) {
351
343
  this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
352
- } else if (shape instanceof Line || shape instanceof Polygon) {
344
+ return;
345
+ }
346
+ if (shape instanceof Line || shape instanceof Polygon) {
353
347
  this.strokePolygon(shape, fill);
354
- } else if (shape instanceof Ellipse) {
348
+ return;
349
+ }
350
+ if (shape instanceof Ellipse) {
355
351
  this.strokeEllipse(
356
352
  shape.pos.x,
357
353
  shape.pos.y,
@@ -359,15 +355,16 @@ class Renderer {
359
355
  shape.radiusV.y,
360
356
  fill
361
357
  );
358
+ return;
362
359
  }
360
+ throw new Error("Invalid geometry for fill/stroke");
363
361
  }
364
362
 
365
363
  /**
366
364
  * fill the given shape
367
365
  * @name fill
368
- * @memberof Renderer.prototype
369
- * @function
370
- * @param {Rect|Polygon|Line|Ellipse} shape a shape object to fill
366
+ * @memberof Renderer
367
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
371
368
  */
372
369
  fill(shape) {
373
370
  this.stroke(shape, true);
@@ -376,8 +373,7 @@ class Renderer {
376
373
  /**
377
374
  * tint the given image or canvas using the given color
378
375
  * @name tint
379
- * @memberof Renderer.prototype
380
- * @function
376
+ * @memberof Renderer
381
377
  * @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
382
378
  * @param {Color|string} color the color that will be used to tint the image
383
379
  * @param {string} [mode="multiply"] the composition mode used to tint the image
@@ -407,9 +403,9 @@ class Renderer {
407
403
  * So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
408
404
  * Mask are not preserved through renderer context save and restore.
409
405
  * @name setMask
410
- * @memberof Renderer.prototype
411
- * @function
412
- * @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
406
+ * @memberof Renderer
407
+ * @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
408
+ * @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
413
409
  */
414
410
  // eslint-disable-next-line no-unused-vars
415
411
  setMask(mask) {}
@@ -418,16 +414,14 @@ class Renderer {
418
414
  * disable (remove) the rendering mask set through setMask.
419
415
  * @name clearMask
420
416
  * @see Renderer#setMask
421
- * @memberof Renderer.prototype
422
- * @function
417
+ * @memberof Renderer
423
418
  */
424
419
  clearMask() {}
425
420
 
426
421
  /**
427
422
  * set a coloring tint for sprite based renderables
428
423
  * @name setTint
429
- * @memberof Renderer.prototype
430
- * @function
424
+ * @memberof Renderer
431
425
  * @param {Color} tint the tint color
432
426
  * @param {number} [alpha] an alpha value to be applied to the tint
433
427
  */
@@ -441,8 +435,7 @@ class Renderer {
441
435
  * clear the rendering tint set through setTint.
442
436
  * @name clearTint
443
437
  * @see Renderer#setTint
444
- * @memberof Renderer.prototype
445
- * @function
438
+ * @memberof Renderer
446
439
  */
447
440
  clearTint() {
448
441
  // reset to default
@@ -1,11 +1,11 @@
1
- import Vector2d from "./../math/vector2.js";
2
- import WebGLRenderer from "./webgl/webgl_renderer.js";
3
- import TextureCache from "./texture_cache.js";
4
- import Sprite from "./../renderable/sprite.js";
5
- import { renderer } from "./video.js";
6
- import pool from "./../system/pooling.js";
7
- import loader from "./../loader/loader.js";
8
- import { ETA } from "./../math/math.js";
1
+ import Vector2d from "./../../math/vector2.js";
2
+ import WebGLRenderer from "./../webgl/webgl_renderer.js";
3
+ import TextureCache from "./../texture/cache.js";
4
+ import Sprite from "./../../renderable/sprite.js";
5
+ import { renderer } from "./../video.js";
6
+ import pool from "./../../system/pooling.js";
7
+ import loader from "./../../loader/loader.js";
8
+ import { ETA } from "./../../math/math.js";
9
9
 
10
10
  /**
11
11
  * create a simple 1 frame texture atlas based on the given parameters
@@ -1,10 +1,9 @@
1
- import { renderer } from "./video.js";
2
- import * as fileUtil from "./../utils/file.js";
3
- import { TextureAtlas, createAtlas } from "./texture.js";
4
- import { isPowerOfTwo} from "./../math/math.js";
1
+ import { renderer } from "./../video.js";
2
+ import * as fileUtil from "./../../utils/file.js";
3
+ import { TextureAtlas, createAtlas } from "./atlas.js";
4
+ import { isPowerOfTwo} from "./../../math/math.js";
5
5
  import {ArrayMultimap} from "@teppeis/multimaps";
6
6
 
7
-
8
7
  /**
9
8
  * a basic texture cache object
10
9
  * @ignore
@@ -0,0 +1,99 @@
1
+ import { createCanvas } from "./../video.js";
2
+
3
+ // default video settings
4
+ var defaultAttributes = {
5
+ offscreenCanvas : false,
6
+ willReadFrequently : false
7
+ };
8
+
9
+ /**
10
+ * Creates a Canvas Texture of the given size
11
+ */
12
+ class CanvasTexture {
13
+ /**
14
+ * @param {number} width the desired width of the canvas
15
+ * @param {number} height the desired height of the canvas
16
+ * @param {object} attributes The attributes to create both the canvas and 2d context
17
+ * @param {boolean} [attributes.offscreenCanvas=false] will create an offscreenCanvas if true instead of a standard canvas
18
+ * @param {boolean} [attributes.willReadFrequently=false] Indicates whether or not a lot of read-back operations are planned
19
+ */
20
+ constructor(width, height, attributes = defaultAttributes) {
21
+
22
+ // clean up the given attributes
23
+ attributes = Object.assign(defaultAttributes, attributes || {});
24
+
25
+ /**
26
+ * the canvas created for this CanvasTexture
27
+ * @type {HTMLCanvasElement|OffscreenCanvas}
28
+ */
29
+ this.canvas = createCanvas(width, height, attributes.offscreenCanvas);
30
+
31
+ /**
32
+ * the rendering context of this CanvasTexture
33
+ * @type {CanvasRenderingContext2D}
34
+ */
35
+ this.context = this.canvas.getContext("2d", { willReadFrequently: attributes.willReadFrequently });
36
+ }
37
+
38
+ /**
39
+ * @ignore
40
+ */
41
+ onResetEvent(width, height) {
42
+ this.clear();
43
+ this.resize(width, height);
44
+ }
45
+
46
+ /**
47
+ * Clears the content of the canvas texture
48
+ */
49
+ clear() {
50
+ this.context.setTransform(1, 0, 0, 1, 0, 0);
51
+ this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
52
+ }
53
+
54
+ /**
55
+ * Resizes the canvas texture to the given width and height.
56
+ * @param {number} width the desired width
57
+ * @param {number} height the desired height
58
+ */
59
+ resize(width, height) {
60
+ this.canvas.width = Math.round(width);
61
+ this.canvas.height = Math.round(height);
62
+ }
63
+
64
+ /**
65
+ * @ignore
66
+ */
67
+ destroy() {
68
+ this.context = undefined;
69
+ this.canvas = undefined;
70
+ }
71
+
72
+ /**
73
+ * The width of this canvas texture in pixels
74
+ * @public
75
+ * @type {number}
76
+ */
77
+ get width() {
78
+ return this.canvas.width;
79
+ }
80
+
81
+ set width(val) {
82
+ this.canvas.width = Math.round(val);
83
+ }
84
+
85
+ /**
86
+ * The height of this canvas texture in pixels
87
+ * @public
88
+ * @type {number}
89
+ */
90
+ get height() {
91
+ return this.canvas.height;
92
+ }
93
+
94
+ set height(val) {
95
+ this.canvas.height = Math.round(val);
96
+ }
97
+ }
98
+
99
+ export default CanvasTexture;
@@ -382,17 +382,17 @@ export function init(width, height, options) {
382
382
  * @function video.createCanvas
383
383
  * @param {number} width width
384
384
  * @param {number} height height
385
- * @param {boolean} [offscreen=false] will returns an OffscreenCanvas if supported
385
+ * @param {boolean} [offscreenCanvas=false] will return an OffscreenCanvas if supported
386
386
  * @returns {HTMLCanvasElement|OffscreenCanvas}
387
387
  */
388
- export function createCanvas(width, height, offscreen = false) {
388
+ export function createCanvas(width, height, offscreenCanvas = false) {
389
389
  var _canvas;
390
390
 
391
391
  if (width === 0 || height === 0) {
392
392
  throw new Error("width or height was zero, Canvas could not be initialized !");
393
393
  }
394
394
 
395
- if (device.OffscreenCanvas === true && offscreen === true) {
395
+ if (device.OffscreenCanvas === true && offscreenCanvas === true) {
396
396
  _canvas = new OffscreenCanvas(0, 0);
397
397
  // stubbing style for compatibility,
398
398
  // as OffscreenCanvas is detached from the DOM
@@ -103,7 +103,6 @@ class GLShader {
103
103
  * Installs this shader program as part of current rendering state
104
104
  * @name bind
105
105
  * @memberof GLShader
106
- * @function
107
106
  */
108
107
  bind() {
109
108
  this.gl.useProgram(this.program);
@@ -113,7 +112,6 @@ class GLShader {
113
112
  * returns the location of an attribute variable in this shader program
114
113
  * @name getAttribLocation
115
114
  * @memberof GLShader
116
- * @function
117
115
  * @param {string} name the name of the attribute variable whose location to get.
118
116
  * @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
119
117
  */
@@ -130,7 +128,6 @@ class GLShader {
130
128
  * Set the uniform to the given value
131
129
  * @name setUniform
132
130
  * @memberof GLShader
133
- * @function
134
131
  * @param {string} name the uniform name
135
132
  * @param {object|Float32Array} value the value to assign to that uniform
136
133
  * @example
@@ -153,7 +150,6 @@ class GLShader {
153
150
  * activate the given vertex attribute for this shader
154
151
  * @name setVertexAttributes
155
152
  * @memberof GLShader
156
- * @function
157
153
  * @param {WebGLRenderingContext} gl the current WebGL rendering context
158
154
  * @param {object[]} attributes an array of vertex attributes
159
155
  * @param {number} vertexByteSize the size of a single vertex in bytes
@@ -177,7 +173,6 @@ class GLShader {
177
173
  * destroy this shader objects resources (program, attributes, uniforms)
178
174
  * @name destroy
179
175
  * @memberof GLShader
180
- * @function
181
176
  */
182
177
  destroy() {
183
178
  this.uniforms = null;
@@ -47,9 +47,8 @@ export function extractUniforms(gl, shader) {
47
47
 
48
48
  descriptor[name] = {
49
49
  "get" : (function (name) {
50
- /**
50
+ /*
51
51
  * A getter for the uniform location
52
- * @ignore
53
52
  */
54
53
  return function () {
55
54
  return locations[name];
@@ -57,22 +56,20 @@ export function extractUniforms(gl, shader) {
57
56
  })(name),
58
57
  "set" : (function (name, type, fn) {
59
58
  if (type.indexOf("mat") === 0) {
60
- /**
59
+ /*
61
60
  * A generic setter for uniform matrices
62
- * @ignore
63
61
  */
64
62
  return function (val) {
65
63
  gl[fn](locations[name], false, val);
66
64
  };
67
65
  }
68
66
  else {
69
- /**
67
+ /*
70
68
  * A generic setter for uniform vectors
71
- * @ignore
72
69
  */
73
70
  return function (val) {
74
71
  var fnv = fn;
75
- if (val.length && fn.substr(-1) !== "v") {
72
+ if (val.length && fn.slice(-1) !== "v") {
76
73
  fnv += "v";
77
74
  }
78
75
  gl[fnv](locations[name], val);
@@ -156,7 +156,6 @@ class WebGLCompositor {
156
156
  * add vertex attribute property definition to the compositor
157
157
  * @name addAttribute
158
158
  * @memberof WebGLCompositor
159
- * @function
160
159
  * @param {string} name name of the attribute in the vertex shader
161
160
  * @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
162
161
  * @param {GLenum} type data type of each component in the array
@@ -204,7 +203,6 @@ class WebGLCompositor {
204
203
  * Sets the viewport
205
204
  * @name setViewport
206
205
  * @memberof WebGLCompositor
207
- * @function
208
206
  * @param {number} x x position of viewport
209
207
  * @param {number} y y position of viewport
210
208
  * @param {number} w width of viewport
@@ -218,7 +216,6 @@ class WebGLCompositor {
218
216
  * Create a WebGL texture from an image
219
217
  * @name createTexture2D
220
218
  * @memberof WebGLCompositor
221
- * @function
222
219
  * @param {number} unit Destination texture unit
223
220
  * @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
224
221
  * @param {number} filter gl.LINEAR or gl.NEAREST
@@ -263,7 +260,6 @@ class WebGLCompositor {
263
260
  * delete the given WebGL texture
264
261
  * @name bindTexture2D
265
262
  * @memberof WebGLCompositor
266
- * @function
267
263
  * @param {WebGLTexture} [texture] a WebGL texture to delete
268
264
  * @param {number} [unit] Texture unit to delete
269
265
  */
@@ -276,7 +272,6 @@ class WebGLCompositor {
276
272
  * returns the WebGL texture associated to the given texture unit
277
273
  * @name bindTexture2D
278
274
  * @memberof WebGLCompositor
279
- * @function
280
275
  * @param {number} unit Texture unit to which a texture is bound
281
276
  * @returns {WebGLTexture} texture a WebGL texture
282
277
  */
@@ -288,7 +283,6 @@ class WebGLCompositor {
288
283
  * assign the given WebGL texture to the current batch
289
284
  * @name bindTexture2D
290
285
  * @memberof WebGLCompositor
291
- * @function
292
286
  * @param {WebGLTexture} texture a WebGL texture
293
287
  * @param {number} unit Texture unit to which the given texture is bound
294
288
  */
@@ -316,7 +310,6 @@ class WebGLCompositor {
316
310
  * unbind the given WebGL texture, forcing it to be reuploaded
317
311
  * @name unbindTexture2D
318
312
  * @memberof WebGLCompositor
319
- * @function
320
313
  * @param {WebGLTexture} [texture] a WebGL texture
321
314
  * @param {number} [unit] a WebGL texture
322
315
  * @returns {number} unit the unit number that was associated with the given texture
@@ -363,7 +356,6 @@ class WebGLCompositor {
363
356
  * set/change the current projection matrix
364
357
  * @name setProjection
365
358
  * @memberof WebGLCompositor
366
- * @function
367
359
  * @param {Matrix3d} matrix
368
360
  */
369
361
  setProjection(matrix) {
@@ -375,7 +367,6 @@ class WebGLCompositor {
375
367
  * @name useShader
376
368
  * @see GLShader
377
369
  * @memberof WebGLCompositor
378
- * @function
379
370
  * @param {GLShader} shader a reference to a GLShader instance
380
371
  */
381
372
  useShader(shader) {
@@ -392,7 +383,6 @@ class WebGLCompositor {
392
383
  * Add a textured quad
393
384
  * @name addQuad
394
385
  * @memberof WebGLCompositor
395
- * @function
396
386
  * @param {TextureAtlas} texture Source texture atlas
397
387
  * @param {number} x Destination x-coordinate
398
388
  * @param {number} y Destination y-coordinate
@@ -449,7 +439,6 @@ class WebGLCompositor {
449
439
  * Flush batched texture operations to the GPU
450
440
  * @param {number} [mode=gl.TRIANGLES] the GL drawing mode
451
441
  * @memberof WebGLCompositor
452
- * @function
453
442
  */
454
443
  flush(mode = this.mode) {
455
444
  var vertex = this.vertexBuffer;
@@ -477,7 +466,6 @@ class WebGLCompositor {
477
466
  * Draw an array of vertices
478
467
  * @name drawVertices
479
468
  * @memberof WebGLCompositor
480
- * @function
481
469
  * @param {GLenum} mode primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
482
470
  * @param {Vector2d[]} verts vertices
483
471
  * @param {number} [vertexCount=verts.length] amount of points defined in the points array
@@ -507,7 +495,6 @@ class WebGLCompositor {
507
495
  * Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
508
496
  * @name clearColor
509
497
  * @memberof WebGLCompositor
510
- * @function
511
498
  * @param {number} [r=0] - the red color value used when the color buffers are cleared
512
499
  * @param {number} [g=0] - the green color value used when the color buffers are cleared
513
500
  * @param {number} [b=0] - the blue color value used when the color buffers are cleared
@@ -521,7 +508,6 @@ class WebGLCompositor {
521
508
  * Clear the frame buffer
522
509
  * @name clear
523
510
  * @memberof WebGLCompositor
524
- * @function
525
511
  */
526
512
  clear() {
527
513
  this.gl.clear(this.gl.COLOR_BUFFER_BIT);