melonjs 10.10.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/melonjs.js +1071 -2102
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +600 -1351
- package/dist/melonjs.module.js +996 -2029
- package/package.json +16 -19
- package/src/audio/audio.js +0 -1
- package/src/camera/camera2d.js +1 -16
- package/src/entity/entity.js +6 -11
- package/src/geometries/ellipse.js +3 -12
- package/src/geometries/line.js +1 -4
- package/src/geometries/path2d.js +4 -14
- package/src/geometries/poly.js +6 -24
- package/src/geometries/rectangle.js +3 -15
- package/src/geometries/roundrect.js +2 -6
- package/src/index.js +0 -1
- package/src/input/gamepad.js +3 -14
- package/src/input/keyboard.js +1 -9
- package/src/input/pointer.js +0 -1
- package/src/input/pointerevent.js +14 -23
- package/src/lang/deprecated.js +4 -3
- package/src/level/level.js +0 -9
- package/src/level/tiled/TMXGroup.js +0 -4
- package/src/level/tiled/TMXLayer.js +0 -8
- package/src/level/tiled/TMXObject.js +0 -3
- package/src/level/tiled/TMXTile.js +4 -5
- package/src/level/tiled/TMXTileMap.js +1 -7
- package/src/level/tiled/TMXTileset.js +0 -5
- package/src/level/tiled/TMXTilesetGroup.js +1 -4
- package/src/level/tiled/TMXUtils.js +0 -3
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -7
- package/src/loader/loader.js +0 -11
- package/src/loader/loadingscreen.js +1 -1
- package/src/math/color.js +5 -26
- package/src/math/math.js +0 -10
- package/src/math/matrix2.js +12 -27
- package/src/math/matrix3.js +1 -22
- package/src/math/observable_vector2.js +0 -29
- package/src/math/observable_vector3.js +0 -29
- package/src/math/vector2.js +3 -40
- package/src/math/vector3.js +4 -41
- package/src/particles/emitter.js +1 -1
- package/src/physics/body.js +4 -5
- package/src/physics/bounds.js +5 -19
- package/src/physics/collision.js +1 -13
- package/src/physics/detector.js +6 -56
- package/src/physics/quadtree.js +0 -7
- package/src/physics/response.js +48 -0
- package/src/physics/sat.js +4 -4
- package/src/physics/world.js +0 -4
- package/src/plugin/plugin.js +0 -2
- package/src/polyfill/roundrect.js +4 -2
- package/src/renderable/GUI.js +6 -9
- package/src/renderable/collectable.js +1 -0
- package/src/renderable/colorlayer.js +9 -7
- package/src/renderable/container.js +12 -38
- package/src/renderable/dragndrop.js +1 -10
- package/src/renderable/imagelayer.js +6 -10
- package/src/renderable/light2d.js +48 -16
- package/src/renderable/renderable.js +6 -28
- package/src/renderable/sprite.js +4 -16
- package/src/renderable/trigger.js +10 -3
- package/src/state/stage.js +0 -4
- package/src/state/state.js +22 -23
- package/src/system/device.js +16 -119
- package/src/system/dom.js +69 -0
- package/src/system/event.js +22 -0
- package/src/system/pooling.js +20 -9
- package/src/system/save.js +9 -11
- package/src/system/timer.js +239 -218
- package/src/text/bitmaptextdata.js +1 -4
- package/src/text/glyph.js +2 -2
- package/src/text/text.js +13 -8
- package/src/text/textmetrics.js +0 -2
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +2 -2
- package/src/tweens/tween.js +1 -13
- package/src/utils/agent.js +1 -3
- package/src/utils/array.js +0 -3
- package/src/utils/file.js +0 -2
- package/src/utils/function.js +0 -2
- package/src/utils/string.js +0 -6
- package/src/utils/utils.js +0 -3
- package/src/video/canvas/canvas_renderer.js +4 -39
- package/src/video/renderer.js +1 -23
- package/src/video/texture/atlas.js +2 -0
- package/src/video/texture/cache.js +0 -1
- package/src/video/texture/canvas_texture.js +16 -4
- package/src/video/video.js +3 -3
- package/src/video/webgl/glshader.js +0 -5
- package/src/video/webgl/utils/uniforms.js +3 -6
- package/src/video/webgl/webgl_compositor.js +0 -14
- package/src/video/webgl/webgl_renderer.js +0 -42
package/src/video/renderer.js
CHANGED
|
@@ -38,7 +38,7 @@ class Renderer {
|
|
|
38
38
|
* @public
|
|
39
39
|
* @name settings
|
|
40
40
|
* @memberof Renderer#
|
|
41
|
-
* @
|
|
41
|
+
* @type {object}
|
|
42
42
|
*/
|
|
43
43
|
this.settings = options;
|
|
44
44
|
|
|
@@ -113,7 +113,6 @@ class Renderer {
|
|
|
113
113
|
* prepare the framebuffer for drawing a new frame
|
|
114
114
|
* @name clear
|
|
115
115
|
* @memberof Renderer
|
|
116
|
-
* @function
|
|
117
116
|
*/
|
|
118
117
|
clear() {}
|
|
119
118
|
|
|
@@ -121,7 +120,6 @@ class Renderer {
|
|
|
121
120
|
* Reset context state
|
|
122
121
|
* @name reset
|
|
123
122
|
* @memberof Renderer
|
|
124
|
-
* @function
|
|
125
123
|
*/
|
|
126
124
|
reset() {
|
|
127
125
|
this.resetTransform();
|
|
@@ -140,7 +138,6 @@ class Renderer {
|
|
|
140
138
|
* return a reference to the system canvas
|
|
141
139
|
* @name getCanvas
|
|
142
140
|
* @memberof Renderer
|
|
143
|
-
* @function
|
|
144
141
|
* @returns {HTMLCanvasElement}
|
|
145
142
|
*/
|
|
146
143
|
getCanvas() {
|
|
@@ -151,7 +148,6 @@ class Renderer {
|
|
|
151
148
|
* return a reference to the screen canvas
|
|
152
149
|
* @name getScreenCanvas
|
|
153
150
|
* @memberof Renderer
|
|
154
|
-
* @function
|
|
155
151
|
* @returns {HTMLCanvasElement}
|
|
156
152
|
*/
|
|
157
153
|
getScreenCanvas() {
|
|
@@ -163,7 +159,6 @@ class Renderer {
|
|
|
163
159
|
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
164
160
|
* @name getScreenContext
|
|
165
161
|
* @memberof Renderer
|
|
166
|
-
* @function
|
|
167
162
|
* @returns {CanvasRenderingContext2D}
|
|
168
163
|
*/
|
|
169
164
|
getScreenContext() {
|
|
@@ -174,7 +169,6 @@ class Renderer {
|
|
|
174
169
|
* returns the current blend mode for this renderer
|
|
175
170
|
* @name getBlendMode
|
|
176
171
|
* @memberof Renderer
|
|
177
|
-
* @function
|
|
178
172
|
* @returns {string} blend mode
|
|
179
173
|
*/
|
|
180
174
|
getBlendMode() {
|
|
@@ -186,7 +180,6 @@ class Renderer {
|
|
|
186
180
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
187
181
|
* @name getContext2d
|
|
188
182
|
* @memberof Renderer
|
|
189
|
-
* @function
|
|
190
183
|
* @param {HTMLCanvasElement} canvas
|
|
191
184
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
192
185
|
* @returns {CanvasRenderingContext2D}
|
|
@@ -224,7 +217,6 @@ class Renderer {
|
|
|
224
217
|
* return the width of the system Canvas
|
|
225
218
|
* @name getWidth
|
|
226
219
|
* @memberof Renderer
|
|
227
|
-
* @function
|
|
228
220
|
* @returns {number}
|
|
229
221
|
*/
|
|
230
222
|
getWidth() {
|
|
@@ -235,7 +227,6 @@ class Renderer {
|
|
|
235
227
|
* return the height of the system Canvas
|
|
236
228
|
* @name getHeight
|
|
237
229
|
* @memberof Renderer
|
|
238
|
-
* @function
|
|
239
230
|
* @returns {number} height of the system Canvas
|
|
240
231
|
*/
|
|
241
232
|
getHeight() {
|
|
@@ -246,7 +237,6 @@ class Renderer {
|
|
|
246
237
|
* get the current fill & stroke style color.
|
|
247
238
|
* @name getColor
|
|
248
239
|
* @memberof Renderer
|
|
249
|
-
* @function
|
|
250
240
|
* @returns {Color} current global color
|
|
251
241
|
*/
|
|
252
242
|
getColor() {
|
|
@@ -257,7 +247,6 @@ class Renderer {
|
|
|
257
247
|
* return the current global alpha
|
|
258
248
|
* @name globalAlpha
|
|
259
249
|
* @memberof Renderer
|
|
260
|
-
* @function
|
|
261
250
|
* @returns {number}
|
|
262
251
|
*/
|
|
263
252
|
globalAlpha() {
|
|
@@ -268,7 +257,6 @@ class Renderer {
|
|
|
268
257
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
269
258
|
* @name overlaps
|
|
270
259
|
* @memberof Renderer
|
|
271
|
-
* @function
|
|
272
260
|
* @param {Rect|Bounds} bounds
|
|
273
261
|
* @returns {boolean} true if overlaps
|
|
274
262
|
*/
|
|
@@ -284,7 +272,6 @@ class Renderer {
|
|
|
284
272
|
* resizes the system canvas
|
|
285
273
|
* @name resize
|
|
286
274
|
* @memberof Renderer
|
|
287
|
-
* @function
|
|
288
275
|
* @param {number} width new width of the canvas
|
|
289
276
|
* @param {number} height new height of the canvas
|
|
290
277
|
*/
|
|
@@ -305,7 +292,6 @@ class Renderer {
|
|
|
305
292
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
306
293
|
* @name setAntiAlias
|
|
307
294
|
* @memberof Renderer
|
|
308
|
-
* @function
|
|
309
295
|
* @param {CanvasRenderingContext2D} context
|
|
310
296
|
* @param {boolean} [enable=false]
|
|
311
297
|
*/
|
|
@@ -335,7 +321,6 @@ class Renderer {
|
|
|
335
321
|
* set/change the current projection matrix (WebGL only)
|
|
336
322
|
* @name setProjection
|
|
337
323
|
* @memberof Renderer
|
|
338
|
-
* @function
|
|
339
324
|
* @param {Matrix3d} matrix
|
|
340
325
|
*/
|
|
341
326
|
setProjection(matrix) {
|
|
@@ -346,7 +331,6 @@ class Renderer {
|
|
|
346
331
|
* stroke the given shape
|
|
347
332
|
* @name stroke
|
|
348
333
|
* @memberof Renderer
|
|
349
|
-
* @function
|
|
350
334
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
351
335
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
352
336
|
*/
|
|
@@ -380,7 +364,6 @@ class Renderer {
|
|
|
380
364
|
* fill the given shape
|
|
381
365
|
* @name fill
|
|
382
366
|
* @memberof Renderer
|
|
383
|
-
* @function
|
|
384
367
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
385
368
|
*/
|
|
386
369
|
fill(shape) {
|
|
@@ -391,7 +374,6 @@ class Renderer {
|
|
|
391
374
|
* tint the given image or canvas using the given color
|
|
392
375
|
* @name tint
|
|
393
376
|
* @memberof Renderer
|
|
394
|
-
* @function
|
|
395
377
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
396
378
|
* @param {Color|string} color the color that will be used to tint the image
|
|
397
379
|
* @param {string} [mode="multiply"] the composition mode used to tint the image
|
|
@@ -422,7 +404,6 @@ class Renderer {
|
|
|
422
404
|
* Mask are not preserved through renderer context save and restore.
|
|
423
405
|
* @name setMask
|
|
424
406
|
* @memberof Renderer
|
|
425
|
-
* @function
|
|
426
407
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
427
408
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
428
409
|
*/
|
|
@@ -434,7 +415,6 @@ class Renderer {
|
|
|
434
415
|
* @name clearMask
|
|
435
416
|
* @see Renderer#setMask
|
|
436
417
|
* @memberof Renderer
|
|
437
|
-
* @function
|
|
438
418
|
*/
|
|
439
419
|
clearMask() {}
|
|
440
420
|
|
|
@@ -442,7 +422,6 @@ class Renderer {
|
|
|
442
422
|
* set a coloring tint for sprite based renderables
|
|
443
423
|
* @name setTint
|
|
444
424
|
* @memberof Renderer
|
|
445
|
-
* @function
|
|
446
425
|
* @param {Color} tint the tint color
|
|
447
426
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
448
427
|
*/
|
|
@@ -457,7 +436,6 @@ class Renderer {
|
|
|
457
436
|
* @name clearTint
|
|
458
437
|
* @see Renderer#setTint
|
|
459
438
|
* @memberof Renderer
|
|
460
|
-
* @function
|
|
461
439
|
*/
|
|
462
440
|
clearTint() {
|
|
463
441
|
// reset to default
|
|
@@ -381,6 +381,8 @@ export class TextureAtlas {
|
|
|
381
381
|
* add uvs mapping for the given region
|
|
382
382
|
* @param {object} atlas the atlas dictionnary where the region is define
|
|
383
383
|
* @param {object} name region (or frame) name
|
|
384
|
+
* @param {number} w the width of the region
|
|
385
|
+
* @param {number} h the height of the region
|
|
384
386
|
* @returns {Float32Array} the created region UVs
|
|
385
387
|
*/
|
|
386
388
|
addUVs(atlas, name, w, h) {
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createCanvas } from "./../video.js";
|
|
2
2
|
|
|
3
|
+
// default video settings
|
|
4
|
+
var defaultAttributes = {
|
|
5
|
+
offscreenCanvas : false,
|
|
6
|
+
willReadFrequently : false
|
|
7
|
+
};
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* Creates a Canvas Texture of the given size
|
|
5
11
|
*/
|
|
@@ -7,20 +13,26 @@ class CanvasTexture {
|
|
|
7
13
|
/**
|
|
8
14
|
* @param {number} width the desired width of the canvas
|
|
9
15
|
* @param {number} height the desired height of the canvas
|
|
10
|
-
* @param {
|
|
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
|
|
11
19
|
*/
|
|
12
|
-
constructor(width, height,
|
|
20
|
+
constructor(width, height, attributes = defaultAttributes) {
|
|
21
|
+
|
|
22
|
+
// clean up the given attributes
|
|
23
|
+
attributes = Object.assign(defaultAttributes, attributes || {});
|
|
24
|
+
|
|
13
25
|
/**
|
|
14
26
|
* the canvas created for this CanvasTexture
|
|
15
27
|
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
16
28
|
*/
|
|
17
|
-
this.canvas = createCanvas(width, height, offscreenCanvas);
|
|
29
|
+
this.canvas = createCanvas(width, height, attributes.offscreenCanvas);
|
|
18
30
|
|
|
19
31
|
/**
|
|
20
32
|
* the rendering context of this CanvasTexture
|
|
21
33
|
* @type {CanvasRenderingContext2D}
|
|
22
34
|
*/
|
|
23
|
-
this.context = this.canvas.getContext("2d");
|
|
35
|
+
this.context = this.canvas.getContext("2d", { willReadFrequently: attributes.willReadFrequently });
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
/**
|
package/src/video/video.js
CHANGED
|
@@ -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} [
|
|
385
|
+
* @param {boolean} [offscreenCanvas=false] will return an OffscreenCanvas if supported
|
|
386
386
|
* @returns {HTMLCanvasElement|OffscreenCanvas}
|
|
387
387
|
*/
|
|
388
|
-
export function createCanvas(width, height,
|
|
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 &&
|
|
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,18 +56,16 @@ 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;
|
|
@@ -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);
|