melonjs 13.1.1 → 13.3.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 +5 -5
- package/dist/melonjs.js +327 -425
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +185 -387
- package/dist/melonjs.module.js +316 -430
- package/package.json +7 -7
- package/src/geometries/point.js +80 -0
- package/src/index.js +4 -0
- package/src/level/tiled/TMXObject.js +21 -9
- package/src/math/color.js +1 -1
- package/src/physics/body.js +10 -3
- package/src/physics/bounds.js +10 -9
- package/src/polyfill/index.js +2 -2
- package/src/renderable/renderable.js +49 -135
- package/src/renderable/sprite.js +7 -1
- package/src/text/bitmaptext.js +8 -8
- package/src/text/text.js +1 -1
- package/src/text/textmetrics.js +1 -1
- package/src/video/canvas/canvas_renderer.js +31 -4
- package/src/video/renderer.js +8 -50
- package/src/video/video.js +1 -0
- package/src/video/webgl/glshader.js +0 -28
- package/src/video/webgl/webgl_compositor.js +19 -48
- package/src/video/webgl/webgl_renderer.js +36 -112
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v13.
|
|
2
|
+
* melonJS Game Engine - v13.3.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -128,12 +128,20 @@
|
|
|
128
128
|
return classof$2(it) == 'String' ? split(it, '') : $Object$3(it);
|
|
129
129
|
} : $Object$3;
|
|
130
130
|
|
|
131
|
+
// we can't use just `it == null` since of `document.all` special case
|
|
132
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
133
|
+
var isNullOrUndefined$2 = function (it) {
|
|
134
|
+
return it === null || it === undefined;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
var isNullOrUndefined$1 = isNullOrUndefined$2;
|
|
138
|
+
|
|
131
139
|
var $TypeError$5 = TypeError;
|
|
132
140
|
|
|
133
141
|
// `RequireObjectCoercible` abstract operation
|
|
134
142
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
135
143
|
var requireObjectCoercible$3 = function (it) {
|
|
136
|
-
if (it
|
|
144
|
+
if (isNullOrUndefined$1(it)) { throw $TypeError$5("Can't call method on " + it); }
|
|
137
145
|
return it;
|
|
138
146
|
};
|
|
139
147
|
|
|
@@ -153,7 +161,14 @@
|
|
|
153
161
|
|
|
154
162
|
var isCallable$a = isCallable$b;
|
|
155
163
|
|
|
156
|
-
var
|
|
164
|
+
var documentAll = typeof document == 'object' && document.all;
|
|
165
|
+
|
|
166
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
167
|
+
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
168
|
+
|
|
169
|
+
var isObject$5 = SPECIAL_DOCUMENT_ALL ? function (it) {
|
|
170
|
+
return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
|
|
171
|
+
} : function (it) {
|
|
157
172
|
return typeof it == 'object' ? it !== null : isCallable$a(it);
|
|
158
173
|
};
|
|
159
174
|
|
|
@@ -210,7 +225,7 @@
|
|
|
210
225
|
var fails$5 = fails$9;
|
|
211
226
|
|
|
212
227
|
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
213
|
-
var
|
|
228
|
+
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
|
|
214
229
|
var symbol = Symbol();
|
|
215
230
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
216
231
|
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
@@ -221,7 +236,7 @@
|
|
|
221
236
|
|
|
222
237
|
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
223
238
|
|
|
224
|
-
var NATIVE_SYMBOL$1 =
|
|
239
|
+
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
225
240
|
|
|
226
241
|
var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
227
242
|
&& !Symbol.sham
|
|
@@ -263,12 +278,13 @@
|
|
|
263
278
|
};
|
|
264
279
|
|
|
265
280
|
var aCallable = aCallable$1;
|
|
281
|
+
var isNullOrUndefined = isNullOrUndefined$2;
|
|
266
282
|
|
|
267
283
|
// `GetMethod` abstract operation
|
|
268
284
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
269
285
|
var getMethod$1 = function (V, P) {
|
|
270
286
|
var func = V[P];
|
|
271
|
-
return func
|
|
287
|
+
return isNullOrUndefined(func) ? undefined : aCallable(func);
|
|
272
288
|
};
|
|
273
289
|
|
|
274
290
|
var call$2 = functionCall;
|
|
@@ -315,10 +331,10 @@
|
|
|
315
331
|
(shared$3.exports = function (key, value) {
|
|
316
332
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
317
333
|
})('versions', []).push({
|
|
318
|
-
version: '3.
|
|
334
|
+
version: '3.25.0',
|
|
319
335
|
mode: 'global',
|
|
320
336
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
321
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
337
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.0/LICENSE',
|
|
322
338
|
source: 'https://github.com/zloirock/core-js'
|
|
323
339
|
});
|
|
324
340
|
|
|
@@ -358,7 +374,7 @@
|
|
|
358
374
|
var shared$2 = shared$3.exports;
|
|
359
375
|
var hasOwn$6 = hasOwnProperty_1;
|
|
360
376
|
var uid$1 = uid$2;
|
|
361
|
-
var NATIVE_SYMBOL =
|
|
377
|
+
var NATIVE_SYMBOL = symbolConstructorDetection;
|
|
362
378
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
363
379
|
|
|
364
380
|
var WellKnownSymbolsStore = shared$2('wks');
|
|
@@ -575,15 +591,14 @@
|
|
|
575
591
|
};
|
|
576
592
|
}
|
|
577
593
|
|
|
578
|
-
var inspectSource$
|
|
594
|
+
var inspectSource$1 = store$1.inspectSource;
|
|
579
595
|
|
|
580
596
|
var global$5 = global$c;
|
|
581
597
|
var isCallable$4 = isCallable$b;
|
|
582
|
-
var inspectSource$1 = inspectSource$2;
|
|
583
598
|
|
|
584
599
|
var WeakMap$1 = global$5.WeakMap;
|
|
585
600
|
|
|
586
|
-
var
|
|
601
|
+
var weakMapBasicDetection = isCallable$4(WeakMap$1) && /native code/.test(String(WeakMap$1));
|
|
587
602
|
|
|
588
603
|
var shared$1 = shared$3.exports;
|
|
589
604
|
var uid = uid$2;
|
|
@@ -596,7 +611,7 @@
|
|
|
596
611
|
|
|
597
612
|
var hiddenKeys$3 = {};
|
|
598
613
|
|
|
599
|
-
var NATIVE_WEAK_MAP =
|
|
614
|
+
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
600
615
|
var global$4 = global$c;
|
|
601
616
|
var uncurryThis$4 = functionUncurryThis;
|
|
602
617
|
var isObject = isObject$5;
|
|
@@ -630,7 +645,7 @@
|
|
|
630
645
|
var wmhas = uncurryThis$4(store.has);
|
|
631
646
|
var wmset = uncurryThis$4(store.set);
|
|
632
647
|
set = function (it, metadata) {
|
|
633
|
-
if (wmhas(store, it)) { throw
|
|
648
|
+
if (wmhas(store, it)) { throw TypeError$1(OBJECT_ALREADY_INITIALIZED); }
|
|
634
649
|
metadata.facade = it;
|
|
635
650
|
wmset(store, it, metadata);
|
|
636
651
|
return metadata;
|
|
@@ -645,7 +660,7 @@
|
|
|
645
660
|
var STATE = sharedKey('state');
|
|
646
661
|
hiddenKeys$2[STATE] = true;
|
|
647
662
|
set = function (it, metadata) {
|
|
648
|
-
if (hasOwn$3(it, STATE)) { throw
|
|
663
|
+
if (hasOwn$3(it, STATE)) { throw TypeError$1(OBJECT_ALREADY_INITIALIZED); }
|
|
649
664
|
metadata.facade = it;
|
|
650
665
|
createNonEnumerableProperty$1(it, STATE, metadata);
|
|
651
666
|
return metadata;
|
|
@@ -671,7 +686,7 @@
|
|
|
671
686
|
var hasOwn$2 = hasOwnProperty_1;
|
|
672
687
|
var DESCRIPTORS = descriptors;
|
|
673
688
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
674
|
-
var inspectSource = inspectSource$
|
|
689
|
+
var inspectSource = inspectSource$1;
|
|
675
690
|
var InternalStateModule = internalState;
|
|
676
691
|
|
|
677
692
|
var enforceInternalState = InternalStateModule.enforce;
|
|
@@ -2999,7 +3014,7 @@
|
|
|
2999
3014
|
* @returns {number}
|
|
3000
3015
|
*/
|
|
3001
3016
|
Color.prototype.toUint32 = function toUint32 (alpha) {
|
|
3002
|
-
if ( alpha === void 0 ) alpha =
|
|
3017
|
+
if ( alpha === void 0 ) alpha = 1.0;
|
|
3003
3018
|
|
|
3004
3019
|
var ur = this.r & 0xff;
|
|
3005
3020
|
var ug = this.g & 0xff;
|
|
@@ -6543,56 +6558,38 @@
|
|
|
6543
6558
|
|
|
6544
6559
|
/**
|
|
6545
6560
|
* the active gl rendering context
|
|
6546
|
-
* @public
|
|
6547
6561
|
* @type {WebGLRenderingContext}
|
|
6548
|
-
* @name gl
|
|
6549
|
-
* @memberof GLShader
|
|
6550
6562
|
*/
|
|
6551
6563
|
this.gl = gl;
|
|
6552
6564
|
|
|
6553
6565
|
/**
|
|
6554
6566
|
* the vertex shader source code
|
|
6555
|
-
* @public
|
|
6556
6567
|
* @type {string}
|
|
6557
|
-
* @name vertex
|
|
6558
|
-
* @memberof GLShader
|
|
6559
6568
|
*/
|
|
6560
6569
|
this.vertex = setPrecision(minify(vertex), precision || getMaxShaderPrecision(this.gl));
|
|
6561
6570
|
|
|
6562
6571
|
/**
|
|
6563
6572
|
* the fragment shader source code
|
|
6564
|
-
* @public
|
|
6565
6573
|
* @type {string}
|
|
6566
|
-
* @name vertex
|
|
6567
|
-
* @memberof GLShader
|
|
6568
6574
|
*/
|
|
6569
6575
|
this.fragment = setPrecision(minify(fragment), precision || getMaxShaderPrecision(this.gl));
|
|
6570
6576
|
|
|
6571
6577
|
/**
|
|
6572
6578
|
* the location attributes of the shader
|
|
6573
|
-
* @public
|
|
6574
6579
|
* @type {GLint[]}
|
|
6575
|
-
* @name attributes
|
|
6576
|
-
* @memberof GLShader
|
|
6577
6580
|
*/
|
|
6578
6581
|
this.attributes = extractAttributes(this.gl, this);
|
|
6579
6582
|
|
|
6580
6583
|
|
|
6581
6584
|
/**
|
|
6582
6585
|
* a reference to the shader program (once compiled)
|
|
6583
|
-
* @public
|
|
6584
6586
|
* @type {WebGLProgram}
|
|
6585
|
-
* @name program
|
|
6586
|
-
* @memberof GLShader
|
|
6587
6587
|
*/
|
|
6588
6588
|
this.program = compileProgram(this.gl, this.vertex, this.fragment, this.attributes);
|
|
6589
6589
|
|
|
6590
6590
|
/**
|
|
6591
6591
|
* the uniforms of the shader
|
|
6592
|
-
* @public
|
|
6593
6592
|
* @type {object}
|
|
6594
|
-
* @name uniforms
|
|
6595
|
-
* @memberof GLShader
|
|
6596
6593
|
*/
|
|
6597
6594
|
this.uniforms = extractUniforms(this.gl, this);
|
|
6598
6595
|
|
|
@@ -6602,8 +6599,6 @@
|
|
|
6602
6599
|
|
|
6603
6600
|
/**
|
|
6604
6601
|
* Installs this shader program as part of current rendering state
|
|
6605
|
-
* @name bind
|
|
6606
|
-
* @memberof GLShader
|
|
6607
6602
|
*/
|
|
6608
6603
|
GLShader.prototype.bind = function bind () {
|
|
6609
6604
|
this.gl.useProgram(this.program);
|
|
@@ -6611,8 +6606,6 @@
|
|
|
6611
6606
|
|
|
6612
6607
|
/**
|
|
6613
6608
|
* returns the location of an attribute variable in this shader program
|
|
6614
|
-
* @name getAttribLocation
|
|
6615
|
-
* @memberof GLShader
|
|
6616
6609
|
* @param {string} name the name of the attribute variable whose location to get.
|
|
6617
6610
|
* @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
|
|
6618
6611
|
*/
|
|
@@ -6627,8 +6620,6 @@
|
|
|
6627
6620
|
|
|
6628
6621
|
/**
|
|
6629
6622
|
* Set the uniform to the given value
|
|
6630
|
-
* @name setUniform
|
|
6631
|
-
* @memberof GLShader
|
|
6632
6623
|
* @param {string} name the uniform name
|
|
6633
6624
|
* @param {object|Float32Array} value the value to assign to that uniform
|
|
6634
6625
|
* @example
|
|
@@ -6649,8 +6640,6 @@
|
|
|
6649
6640
|
|
|
6650
6641
|
/**
|
|
6651
6642
|
* activate the given vertex attribute for this shader
|
|
6652
|
-
* @name setVertexAttributes
|
|
6653
|
-
* @memberof GLShader
|
|
6654
6643
|
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
6655
6644
|
* @param {object[]} attributes an array of vertex attributes
|
|
6656
6645
|
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
@@ -6672,8 +6661,6 @@
|
|
|
6672
6661
|
|
|
6673
6662
|
/**
|
|
6674
6663
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
6675
|
-
* @name destroy
|
|
6676
|
-
* @memberof GLShader
|
|
6677
6664
|
*/
|
|
6678
6665
|
GLShader.prototype.destroy = function destroy () {
|
|
6679
6666
|
this.uniforms = null;
|
|
@@ -6870,44 +6857,37 @@
|
|
|
6870
6857
|
|
|
6871
6858
|
/**
|
|
6872
6859
|
* a reference to the active WebGL shader
|
|
6873
|
-
* @name activeShader
|
|
6874
|
-
* @memberof WebGLCompositor
|
|
6875
6860
|
* @type {GLShader}
|
|
6876
6861
|
*/
|
|
6877
6862
|
this.activeShader = null;
|
|
6878
6863
|
|
|
6879
6864
|
/**
|
|
6880
6865
|
* primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
6881
|
-
* @
|
|
6882
|
-
* @see WebGLCompositor
|
|
6883
|
-
* @memberof WebGLCompositor
|
|
6866
|
+
* @type {number}
|
|
6884
6867
|
* @default gl.TRIANGLES
|
|
6885
6868
|
*/
|
|
6886
6869
|
this.mode = gl.TRIANGLES;
|
|
6887
6870
|
|
|
6888
6871
|
/**
|
|
6889
6872
|
* an array of vertex attribute properties
|
|
6890
|
-
* @name attributes
|
|
6891
6873
|
* @see WebGLCompositor.addAttribute
|
|
6892
|
-
* @
|
|
6874
|
+
* @type {Array}
|
|
6893
6875
|
*/
|
|
6894
6876
|
this.attributes = [];
|
|
6895
6877
|
|
|
6896
6878
|
/**
|
|
6897
6879
|
* the size of a single vertex in bytes
|
|
6898
6880
|
* (will automatically be calculated as attributes definitions are added)
|
|
6899
|
-
* @name vertexByteSize
|
|
6900
6881
|
* @see WebGLCompositor.addAttribute
|
|
6901
|
-
* @
|
|
6882
|
+
* @type {number}
|
|
6902
6883
|
*/
|
|
6903
6884
|
this.vertexByteSize = 0;
|
|
6904
6885
|
|
|
6905
6886
|
/**
|
|
6906
6887
|
* the size of a single vertex in floats
|
|
6907
6888
|
* (will automatically be calculated as attributes definitions are added)
|
|
6908
|
-
* @name vertexSize
|
|
6909
6889
|
* @see WebGLCompositor.addAttribute
|
|
6910
|
-
* @
|
|
6890
|
+
* @type {number}
|
|
6911
6891
|
*/
|
|
6912
6892
|
this.vertexSize = 0;
|
|
6913
6893
|
|
|
@@ -6968,8 +6948,6 @@
|
|
|
6968
6948
|
|
|
6969
6949
|
/**
|
|
6970
6950
|
* add vertex attribute property definition to the compositor
|
|
6971
|
-
* @name addAttribute
|
|
6972
|
-
* @memberof WebGLCompositor
|
|
6973
6951
|
* @param {string} name name of the attribute in the vertex shader
|
|
6974
6952
|
* @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
6975
6953
|
* @param {GLenum} type data type of each component in the array
|
|
@@ -7015,8 +6993,6 @@
|
|
|
7015
6993
|
|
|
7016
6994
|
/**
|
|
7017
6995
|
* Sets the viewport
|
|
7018
|
-
* @name setViewport
|
|
7019
|
-
* @memberof WebGLCompositor
|
|
7020
6996
|
* @param {number} x x position of viewport
|
|
7021
6997
|
* @param {number} y y position of viewport
|
|
7022
6998
|
* @param {number} w width of viewport
|
|
@@ -7028,8 +7004,6 @@
|
|
|
7028
7004
|
|
|
7029
7005
|
/**
|
|
7030
7006
|
* Create a WebGL texture from an image
|
|
7031
|
-
* @name createTexture2D
|
|
7032
|
-
* @memberof WebGLCompositor
|
|
7033
7007
|
* @param {number} unit Destination texture unit
|
|
7034
7008
|
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
|
|
7035
7009
|
* @param {number} filter gl.LINEAR or gl.NEAREST
|
|
@@ -7076,8 +7050,6 @@
|
|
|
7076
7050
|
|
|
7077
7051
|
/**
|
|
7078
7052
|
* delete the given WebGL texture
|
|
7079
|
-
* @name bindTexture2D
|
|
7080
|
-
* @memberof WebGLCompositor
|
|
7081
7053
|
* @param {WebGLTexture} [texture] a WebGL texture to delete
|
|
7082
7054
|
* @param {number} [unit] Texture unit to delete
|
|
7083
7055
|
*/
|
|
@@ -7088,8 +7060,6 @@
|
|
|
7088
7060
|
|
|
7089
7061
|
/**
|
|
7090
7062
|
* returns the WebGL texture associated to the given texture unit
|
|
7091
|
-
* @name bindTexture2D
|
|
7092
|
-
* @memberof WebGLCompositor
|
|
7093
7063
|
* @param {number} unit Texture unit to which a texture is bound
|
|
7094
7064
|
* @returns {WebGLTexture} texture a WebGL texture
|
|
7095
7065
|
*/
|
|
@@ -7099,8 +7069,6 @@
|
|
|
7099
7069
|
|
|
7100
7070
|
/**
|
|
7101
7071
|
* assign the given WebGL texture to the current batch
|
|
7102
|
-
* @name bindTexture2D
|
|
7103
|
-
* @memberof WebGLCompositor
|
|
7104
7072
|
* @param {WebGLTexture} texture a WebGL texture
|
|
7105
7073
|
* @param {number} unit Texture unit to which the given texture is bound
|
|
7106
7074
|
*/
|
|
@@ -7126,8 +7094,6 @@
|
|
|
7126
7094
|
|
|
7127
7095
|
/**
|
|
7128
7096
|
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
7129
|
-
* @name unbindTexture2D
|
|
7130
|
-
* @memberof WebGLCompositor
|
|
7131
7097
|
* @param {WebGLTexture} [texture] a WebGL texture
|
|
7132
7098
|
* @param {number} [unit] a WebGL texture
|
|
7133
7099
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
@@ -7174,8 +7140,6 @@
|
|
|
7174
7140
|
|
|
7175
7141
|
/**
|
|
7176
7142
|
* set/change the current projection matrix
|
|
7177
|
-
* @name setProjection
|
|
7178
|
-
* @memberof WebGLCompositor
|
|
7179
7143
|
* @param {Matrix3d} matrix
|
|
7180
7144
|
*/
|
|
7181
7145
|
WebGLCompositor.prototype.setProjection = function setProjection (matrix) {
|
|
@@ -7184,9 +7148,7 @@
|
|
|
7184
7148
|
|
|
7185
7149
|
/**
|
|
7186
7150
|
* Select the shader to use for compositing
|
|
7187
|
-
* @name useShader
|
|
7188
7151
|
* @see GLShader
|
|
7189
|
-
* @memberof WebGLCompositor
|
|
7190
7152
|
* @param {GLShader} shader a reference to a GLShader instance
|
|
7191
7153
|
*/
|
|
7192
7154
|
WebGLCompositor.prototype.useShader = function useShader (shader) {
|
|
@@ -7201,8 +7163,6 @@
|
|
|
7201
7163
|
|
|
7202
7164
|
/**
|
|
7203
7165
|
* Add a textured quad
|
|
7204
|
-
* @name addQuad
|
|
7205
|
-
* @memberof WebGLCompositor
|
|
7206
7166
|
* @param {TextureAtlas} texture Source texture atlas
|
|
7207
7167
|
* @param {number} x Destination x-coordinate
|
|
7208
7168
|
* @param {number} y Destination y-coordinate
|
|
@@ -7258,7 +7218,6 @@
|
|
|
7258
7218
|
/**
|
|
7259
7219
|
* Flush batched texture operations to the GPU
|
|
7260
7220
|
* @param {number} [mode=gl.TRIANGLES] the GL drawing mode
|
|
7261
|
-
* @memberof WebGLCompositor
|
|
7262
7221
|
*/
|
|
7263
7222
|
WebGLCompositor.prototype.flush = function flush (mode) {
|
|
7264
7223
|
if ( mode === void 0 ) mode = this.mode;
|
|
@@ -7286,8 +7245,6 @@
|
|
|
7286
7245
|
|
|
7287
7246
|
/**
|
|
7288
7247
|
* Draw an array of vertices
|
|
7289
|
-
* @name drawVertices
|
|
7290
|
-
* @memberof WebGLCompositor
|
|
7291
7248
|
* @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)
|
|
7292
7249
|
* @param {Vector2d[]} verts vertices
|
|
7293
7250
|
* @param {number} [vertexCount=verts.length] amount of points defined in the points array
|
|
@@ -7316,25 +7273,33 @@
|
|
|
7316
7273
|
};
|
|
7317
7274
|
|
|
7318
7275
|
/**
|
|
7319
|
-
*
|
|
7320
|
-
* @
|
|
7321
|
-
* @memberof WebGLCompositor
|
|
7322
|
-
* @param {number} [r=0] - the red color value used when the color buffers are cleared
|
|
7323
|
-
* @param {number} [g=0] - the green color value used when the color buffers are cleared
|
|
7324
|
-
* @param {number} [b=0] - the blue color value used when the color buffers are cleared
|
|
7325
|
-
* @param {number} [a=0] - the alpha color value used when the color buffers are cleared
|
|
7276
|
+
* Clear the frame buffer
|
|
7277
|
+
* @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
|
|
7326
7278
|
*/
|
|
7327
|
-
WebGLCompositor.prototype.
|
|
7328
|
-
|
|
7279
|
+
WebGLCompositor.prototype.clear = function clear (alpha) {
|
|
7280
|
+
if ( alpha === void 0 ) alpha = 0;
|
|
7281
|
+
|
|
7282
|
+
var gl = this.gl;
|
|
7283
|
+
gl.clearColor(0, 0, 0, alpha);
|
|
7284
|
+
gl.clear(gl.COLOR_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
|
|
7329
7285
|
};
|
|
7330
7286
|
|
|
7331
7287
|
/**
|
|
7332
|
-
*
|
|
7333
|
-
* @
|
|
7334
|
-
* @
|
|
7288
|
+
* Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
|
|
7289
|
+
* @param {number} [r = 0] - the red color value used when the color buffers are cleared
|
|
7290
|
+
* @param {number} [g = 0] - the green color value used when the color buffers are cleared
|
|
7291
|
+
* @param {number} [b = 0] - the blue color value used when the color buffers are cleared
|
|
7292
|
+
* @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
|
|
7335
7293
|
*/
|
|
7336
|
-
WebGLCompositor.prototype.
|
|
7337
|
-
|
|
7294
|
+
WebGLCompositor.prototype.clearColor = function clearColor (r, g, b, a) {
|
|
7295
|
+
if ( r === void 0 ) r = 0;
|
|
7296
|
+
if ( g === void 0 ) g = 0;
|
|
7297
|
+
if ( b === void 0 ) b = 0;
|
|
7298
|
+
if ( a === void 0 ) a = 0;
|
|
7299
|
+
|
|
7300
|
+
var gl = this.gl;
|
|
7301
|
+
gl.clearColor(r, g, b, a);
|
|
7302
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
7338
7303
|
};
|
|
7339
7304
|
|
|
7340
7305
|
var earcut$1 = {exports: {}};
|
|
@@ -9632,17 +9597,18 @@
|
|
|
9632
9597
|
* add the given point to the bounds definition.
|
|
9633
9598
|
* @name addPoint
|
|
9634
9599
|
* @memberof Bounds
|
|
9635
|
-
* @param {Vector2d}
|
|
9636
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given point
|
|
9600
|
+
* @param {Vector2d|Point} point the point to be added to the bounds
|
|
9601
|
+
* @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
|
|
9637
9602
|
*/
|
|
9638
|
-
Bounds.prototype.addPoint = function addPoint (
|
|
9639
|
-
if (typeof m !== "undefined") {
|
|
9640
|
-
|
|
9603
|
+
Bounds.prototype.addPoint = function addPoint (point, m) {
|
|
9604
|
+
if ((typeof m !== "undefined") && (typeof point.rotate === "function")) {
|
|
9605
|
+
// only Vectors object have a rotate function
|
|
9606
|
+
point = m.apply(point);
|
|
9641
9607
|
}
|
|
9642
|
-
this.min.x = Math.min(this.min.x,
|
|
9643
|
-
this.max.x = Math.max(this.max.x,
|
|
9644
|
-
this.min.y = Math.min(this.min.y,
|
|
9645
|
-
this.max.y = Math.max(this.max.y,
|
|
9608
|
+
this.min.x = Math.min(this.min.x, point.x);
|
|
9609
|
+
this.max.x = Math.max(this.max.x, point.x);
|
|
9610
|
+
this.min.y = Math.min(this.min.y, point.y);
|
|
9611
|
+
this.max.y = Math.max(this.max.y, point.y);
|
|
9646
9612
|
};
|
|
9647
9613
|
|
|
9648
9614
|
/**
|
|
@@ -10133,6 +10099,93 @@
|
|
|
10133
10099
|
this.arcTo(x, y, x + radius, y, radius);
|
|
10134
10100
|
};
|
|
10135
10101
|
|
|
10102
|
+
/**
|
|
10103
|
+
* @classdesc
|
|
10104
|
+
* represents a point in a 2d space
|
|
10105
|
+
*/
|
|
10106
|
+
var Point = function Point(x, y) {
|
|
10107
|
+
if ( x === void 0 ) x = 0;
|
|
10108
|
+
if ( y === void 0 ) y = 0;
|
|
10109
|
+
|
|
10110
|
+
/**
|
|
10111
|
+
* the position of the point on the horizontal axis
|
|
10112
|
+
* @public
|
|
10113
|
+
* @type {Number}
|
|
10114
|
+
* @default 0
|
|
10115
|
+
*/
|
|
10116
|
+
this.x = x;
|
|
10117
|
+
|
|
10118
|
+
/**
|
|
10119
|
+
* the position of the point on the vertical axis
|
|
10120
|
+
* @public
|
|
10121
|
+
* @type {Number}
|
|
10122
|
+
* @default 0
|
|
10123
|
+
*/
|
|
10124
|
+
this.y = y;
|
|
10125
|
+
};
|
|
10126
|
+
|
|
10127
|
+
/** @ignore */
|
|
10128
|
+
Point.prototype.onResetEvent = function onResetEvent (x, y) {
|
|
10129
|
+
if ( x === void 0 ) x = 0;
|
|
10130
|
+
if ( y === void 0 ) y = 0;
|
|
10131
|
+
|
|
10132
|
+
this.set(x, y);
|
|
10133
|
+
};
|
|
10134
|
+
|
|
10135
|
+
/**
|
|
10136
|
+
* set the Point x and y properties to the given values
|
|
10137
|
+
* @param {number} x
|
|
10138
|
+
* @param {number} y
|
|
10139
|
+
* @returns {Point} Reference to this object for method chaining
|
|
10140
|
+
*/
|
|
10141
|
+
Point.prototype.set = function set (x, y) {
|
|
10142
|
+
if ( x === void 0 ) x = 0;
|
|
10143
|
+
if ( y === void 0 ) y = 0;
|
|
10144
|
+
|
|
10145
|
+
this.x = x;
|
|
10146
|
+
this.y = y;
|
|
10147
|
+
return this;
|
|
10148
|
+
};
|
|
10149
|
+
|
|
10150
|
+
/**
|
|
10151
|
+
* return true if the two points are the same
|
|
10152
|
+
* @name equals
|
|
10153
|
+
* @memberof Point
|
|
10154
|
+
* @method
|
|
10155
|
+
* @param {Point} point
|
|
10156
|
+
* @returns {boolean}
|
|
10157
|
+
*/
|
|
10158
|
+
/**
|
|
10159
|
+
* return true if this point is equal to the given values
|
|
10160
|
+
* @name equals
|
|
10161
|
+
* @memberof Point
|
|
10162
|
+
* @param {number} x
|
|
10163
|
+
* @param {number} y
|
|
10164
|
+
* @returns {boolean}
|
|
10165
|
+
*/
|
|
10166
|
+
Point.prototype.equals = function equals () {
|
|
10167
|
+
var _x, _y;
|
|
10168
|
+
if (arguments.length === 2) {
|
|
10169
|
+
// x, y
|
|
10170
|
+
_x = arguments[0];
|
|
10171
|
+
_y = arguments[1];
|
|
10172
|
+
} else {
|
|
10173
|
+
// point
|
|
10174
|
+
_x = arguments[0].x;
|
|
10175
|
+
_y = arguments[0].y;
|
|
10176
|
+
}
|
|
10177
|
+
return ((this.x === _x) && (this.y === _y));
|
|
10178
|
+
};
|
|
10179
|
+
|
|
10180
|
+
/**
|
|
10181
|
+
* clone this Point
|
|
10182
|
+
* @name clone
|
|
10183
|
+
* @returns {Point} new Point
|
|
10184
|
+
*/
|
|
10185
|
+
Point.prototype.clone = function clone () {
|
|
10186
|
+
return new Point(this.x, this.y);
|
|
10187
|
+
};
|
|
10188
|
+
|
|
10136
10189
|
/**
|
|
10137
10190
|
* @classdesc
|
|
10138
10191
|
* a base renderer object
|
|
@@ -10141,26 +10194,20 @@
|
|
|
10141
10194
|
/**
|
|
10142
10195
|
* The given constructor options
|
|
10143
10196
|
* @public
|
|
10144
|
-
* @name settings
|
|
10145
|
-
* @memberof Renderer#
|
|
10146
10197
|
* @type {object}
|
|
10147
10198
|
*/
|
|
10148
10199
|
this.settings = options;
|
|
10149
10200
|
|
|
10150
10201
|
/**
|
|
10151
10202
|
* true if the current rendering context is valid
|
|
10152
|
-
* @name isContextValid
|
|
10153
|
-
* @memberof Renderer#
|
|
10154
10203
|
* @default true
|
|
10155
|
-
* type {boolean}
|
|
10204
|
+
* @type {boolean}
|
|
10156
10205
|
*/
|
|
10157
10206
|
this.isContextValid = true;
|
|
10158
10207
|
|
|
10159
10208
|
/**
|
|
10160
10209
|
* The Path2D instance used by the renderer to draw primitives
|
|
10161
|
-
* @name path2D
|
|
10162
10210
|
* @type {Path2D}
|
|
10163
|
-
* @memberof Renderer#
|
|
10164
10211
|
*/
|
|
10165
10212
|
this.path2D = new Path2D();
|
|
10166
10213
|
|
|
@@ -10212,22 +10259,16 @@
|
|
|
10212
10259
|
|
|
10213
10260
|
/**
|
|
10214
10261
|
* prepare the framebuffer for drawing a new frame
|
|
10215
|
-
* @name clear
|
|
10216
|
-
* @memberof Renderer
|
|
10217
10262
|
*/
|
|
10218
10263
|
Renderer.prototype.clear = function clear () {};
|
|
10219
10264
|
|
|
10220
10265
|
/**
|
|
10221
10266
|
* render the main framebuffer on screen
|
|
10222
|
-
* @name flush
|
|
10223
|
-
* @memberof Renderer
|
|
10224
10267
|
*/
|
|
10225
10268
|
Renderer.prototype.flush = function flush () {};
|
|
10226
10269
|
|
|
10227
10270
|
/**
|
|
10228
10271
|
* Reset context state
|
|
10229
|
-
* @name reset
|
|
10230
|
-
* @memberof Renderer
|
|
10231
10272
|
*/
|
|
10232
10273
|
Renderer.prototype.reset = function reset () {
|
|
10233
10274
|
this.resetTransform();
|
|
@@ -10244,8 +10285,6 @@
|
|
|
10244
10285
|
|
|
10245
10286
|
/**
|
|
10246
10287
|
* return a reference to the canvas which this renderer draws to
|
|
10247
|
-
* @name getCanvas
|
|
10248
|
-
* @memberof Renderer
|
|
10249
10288
|
* @returns {HTMLCanvasElement}
|
|
10250
10289
|
*/
|
|
10251
10290
|
Renderer.prototype.getCanvas = function getCanvas () {
|
|
@@ -10255,8 +10294,6 @@
|
|
|
10255
10294
|
|
|
10256
10295
|
/**
|
|
10257
10296
|
* return a reference to this renderer canvas corresponding Context
|
|
10258
|
-
* @name getContext
|
|
10259
|
-
* @memberof Renderer
|
|
10260
10297
|
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
10261
10298
|
*/
|
|
10262
10299
|
Renderer.prototype.getContext = function getContext () {
|
|
@@ -10265,8 +10302,6 @@
|
|
|
10265
10302
|
|
|
10266
10303
|
/**
|
|
10267
10304
|
* returns the current blend mode for this renderer
|
|
10268
|
-
* @name getBlendMode
|
|
10269
|
-
* @memberof Renderer
|
|
10270
10305
|
* @returns {string} blend mode
|
|
10271
10306
|
*/
|
|
10272
10307
|
Renderer.prototype.getBlendMode = function getBlendMode () {
|
|
@@ -10276,8 +10311,6 @@
|
|
|
10276
10311
|
/**
|
|
10277
10312
|
* Returns the 2D Context object of the given Canvas<br>
|
|
10278
10313
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
10279
|
-
* @name getContext2d
|
|
10280
|
-
* @memberof Renderer
|
|
10281
10314
|
* @param {HTMLCanvasElement} canvas
|
|
10282
10315
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
10283
10316
|
* @returns {CanvasRenderingContext2D}
|
|
@@ -10313,8 +10346,6 @@
|
|
|
10313
10346
|
|
|
10314
10347
|
/**
|
|
10315
10348
|
* return the width of the system Canvas
|
|
10316
|
-
* @name getWidth
|
|
10317
|
-
* @memberof Renderer
|
|
10318
10349
|
* @returns {number}
|
|
10319
10350
|
*/
|
|
10320
10351
|
Renderer.prototype.getWidth = function getWidth () {
|
|
@@ -10323,8 +10354,6 @@
|
|
|
10323
10354
|
|
|
10324
10355
|
/**
|
|
10325
10356
|
* return the height of the system Canvas
|
|
10326
|
-
* @name getHeight
|
|
10327
|
-
* @memberof Renderer
|
|
10328
10357
|
* @returns {number} height of the system Canvas
|
|
10329
10358
|
*/
|
|
10330
10359
|
Renderer.prototype.getHeight = function getHeight () {
|
|
@@ -10333,8 +10362,6 @@
|
|
|
10333
10362
|
|
|
10334
10363
|
/**
|
|
10335
10364
|
* get the current fill & stroke style color.
|
|
10336
|
-
* @name getColor
|
|
10337
|
-
* @memberof Renderer
|
|
10338
10365
|
* @returns {Color} current global color
|
|
10339
10366
|
*/
|
|
10340
10367
|
Renderer.prototype.getColor = function getColor () {
|
|
@@ -10343,8 +10370,6 @@
|
|
|
10343
10370
|
|
|
10344
10371
|
/**
|
|
10345
10372
|
* return the current global alpha
|
|
10346
|
-
* @name globalAlpha
|
|
10347
|
-
* @memberof Renderer
|
|
10348
10373
|
* @returns {number}
|
|
10349
10374
|
*/
|
|
10350
10375
|
Renderer.prototype.globalAlpha = function globalAlpha () {
|
|
@@ -10353,8 +10378,6 @@
|
|
|
10353
10378
|
|
|
10354
10379
|
/**
|
|
10355
10380
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
10356
|
-
* @name overlaps
|
|
10357
|
-
* @memberof Renderer
|
|
10358
10381
|
* @param {Rect|Bounds} bounds
|
|
10359
10382
|
* @returns {boolean} true if overlaps
|
|
10360
10383
|
*/
|
|
@@ -10368,8 +10391,6 @@
|
|
|
10368
10391
|
|
|
10369
10392
|
/**
|
|
10370
10393
|
* resizes the system canvas
|
|
10371
|
-
* @name resize
|
|
10372
|
-
* @memberof Renderer
|
|
10373
10394
|
* @param {number} width new width of the canvas
|
|
10374
10395
|
* @param {number} height new height of the canvas
|
|
10375
10396
|
*/
|
|
@@ -10389,8 +10410,6 @@
|
|
|
10389
10410
|
|
|
10390
10411
|
/**
|
|
10391
10412
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
10392
|
-
* @name setAntiAlias
|
|
10393
|
-
* @memberof Renderer
|
|
10394
10413
|
* @param {CanvasRenderingContext2D} context
|
|
10395
10414
|
* @param {boolean} [enable=false]
|
|
10396
10415
|
*/
|
|
@@ -10418,8 +10437,6 @@
|
|
|
10418
10437
|
|
|
10419
10438
|
/**
|
|
10420
10439
|
* set/change the current projection matrix (WebGL only)
|
|
10421
|
-
* @name setProjection
|
|
10422
|
-
* @memberof Renderer
|
|
10423
10440
|
* @param {Matrix3d} matrix
|
|
10424
10441
|
*/
|
|
10425
10442
|
Renderer.prototype.setProjection = function setProjection (matrix) {
|
|
@@ -10428,8 +10445,6 @@
|
|
|
10428
10445
|
|
|
10429
10446
|
/**
|
|
10430
10447
|
* stroke the given shape
|
|
10431
|
-
* @name stroke
|
|
10432
|
-
* @memberof Renderer
|
|
10433
10448
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
10434
10449
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
10435
10450
|
*/
|
|
@@ -10456,6 +10471,10 @@
|
|
|
10456
10471
|
);
|
|
10457
10472
|
return;
|
|
10458
10473
|
}
|
|
10474
|
+
if (shape instanceof Point) {
|
|
10475
|
+
this.strokePoint(shape.x, shape.y);
|
|
10476
|
+
return;
|
|
10477
|
+
}
|
|
10459
10478
|
throw new Error("Invalid geometry for fill/stroke");
|
|
10460
10479
|
};
|
|
10461
10480
|
|
|
@@ -10471,8 +10490,6 @@
|
|
|
10471
10490
|
|
|
10472
10491
|
/**
|
|
10473
10492
|
* tint the given image or canvas using the given color
|
|
10474
|
-
* @name tint
|
|
10475
|
-
* @memberof Renderer
|
|
10476
10493
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
10477
10494
|
* @param {Color|string} color the color that will be used to tint the image
|
|
10478
10495
|
* @param {string} [mode="multiply"] the composition mode used to tint the image
|
|
@@ -10501,8 +10518,6 @@
|
|
|
10501
10518
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
10502
10519
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
10503
10520
|
* Mask are not preserved through renderer context save and restore.
|
|
10504
|
-
* @name setMask
|
|
10505
|
-
* @memberof Renderer
|
|
10506
10521
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
10507
10522
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
10508
10523
|
*/
|
|
@@ -10511,16 +10526,12 @@
|
|
|
10511
10526
|
|
|
10512
10527
|
/**
|
|
10513
10528
|
* disable (remove) the rendering mask set through setMask.
|
|
10514
|
-
* @name clearMask
|
|
10515
10529
|
* @see Renderer#setMask
|
|
10516
|
-
* @memberof Renderer
|
|
10517
10530
|
*/
|
|
10518
10531
|
Renderer.prototype.clearMask = function clearMask () {};
|
|
10519
10532
|
|
|
10520
10533
|
/**
|
|
10521
10534
|
* set a coloring tint for sprite based renderables
|
|
10522
|
-
* @name setTint
|
|
10523
|
-
* @memberof Renderer
|
|
10524
10535
|
* @param {Color} tint the tint color
|
|
10525
10536
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
10526
10537
|
*/
|
|
@@ -10534,9 +10545,7 @@
|
|
|
10534
10545
|
|
|
10535
10546
|
/**
|
|
10536
10547
|
* clear the rendering tint set through setTint.
|
|
10537
|
-
* @name clearTint
|
|
10538
10548
|
* @see Renderer#setTint
|
|
10539
|
-
* @memberof Renderer
|
|
10540
10549
|
*/
|
|
10541
10550
|
Renderer.prototype.clearTint = function clearTint () {
|
|
10542
10551
|
// reset to default
|
|
@@ -18092,21 +18101,14 @@
|
|
|
18092
18101
|
|
|
18093
18102
|
/**
|
|
18094
18103
|
* If true then physic collision and input events will not impact this renderable
|
|
18095
|
-
* @public
|
|
18096
18104
|
* @type {boolean}
|
|
18097
18105
|
* @default true
|
|
18098
|
-
* @name isKinematic
|
|
18099
|
-
* @memberof Renderable
|
|
18100
18106
|
*/
|
|
18101
18107
|
this.isKinematic = true;
|
|
18102
18108
|
|
|
18103
18109
|
/**
|
|
18104
18110
|
* the renderable physic body
|
|
18105
|
-
* @public
|
|
18106
18111
|
* @type {Body}
|
|
18107
|
-
* @see Body
|
|
18108
|
-
* @name body
|
|
18109
|
-
* @memberof Renderable#
|
|
18110
18112
|
* @example
|
|
18111
18113
|
* // define a new Player Class
|
|
18112
18114
|
* class PlayerEntity extends me.Sprite {
|
|
@@ -18144,10 +18146,7 @@
|
|
|
18144
18146
|
if (typeof this.currentTransform === "undefined") {
|
|
18145
18147
|
/**
|
|
18146
18148
|
* the renderable default transformation matrix
|
|
18147
|
-
* @public
|
|
18148
18149
|
* @type {Matrix2d}
|
|
18149
|
-
* @name currentTransform
|
|
18150
|
-
* @memberof Renderable#
|
|
18151
18150
|
*/
|
|
18152
18151
|
this.currentTransform = pool.pull("Matrix2d");
|
|
18153
18152
|
}
|
|
@@ -18157,20 +18156,14 @@
|
|
|
18157
18156
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
18158
18157
|
* a GUID will be allocated for any renderable object added <br>
|
|
18159
18158
|
* to an object container (including the `me.game.world` container)
|
|
18160
|
-
* @public
|
|
18161
18159
|
* @type {string}
|
|
18162
|
-
* @name GUID
|
|
18163
|
-
* @memberof Renderable
|
|
18164
18160
|
*/
|
|
18165
18161
|
this.GUID = undefined;
|
|
18166
18162
|
|
|
18167
18163
|
/**
|
|
18168
18164
|
* an event handler that is called when the renderable leave or enter a camera viewport
|
|
18169
|
-
* @public
|
|
18170
18165
|
* @type {Function}
|
|
18171
18166
|
* @default undefined
|
|
18172
|
-
* @name onVisibilityChange
|
|
18173
|
-
* @memberof Renderable#
|
|
18174
18167
|
* @example
|
|
18175
18168
|
* this.onVisibilityChange = function(inViewport) {
|
|
18176
18169
|
* if (inViewport === true) {
|
|
@@ -18182,42 +18175,30 @@
|
|
|
18182
18175
|
|
|
18183
18176
|
/**
|
|
18184
18177
|
* Whether the renderable object will always update, even when outside of the viewport<br>
|
|
18185
|
-
* @public
|
|
18186
18178
|
* @type {boolean}
|
|
18187
18179
|
* @default false
|
|
18188
|
-
* @name alwaysUpdate
|
|
18189
|
-
* @memberof Renderable
|
|
18190
18180
|
*/
|
|
18191
18181
|
this.alwaysUpdate = false;
|
|
18192
18182
|
|
|
18193
18183
|
/**
|
|
18194
18184
|
* Whether to update this object when the game is paused.
|
|
18195
|
-
* @public
|
|
18196
18185
|
* @type {boolean}
|
|
18197
18186
|
* @default false
|
|
18198
|
-
* @name updateWhenPaused
|
|
18199
|
-
* @memberof Renderable
|
|
18200
18187
|
*/
|
|
18201
18188
|
this.updateWhenPaused = false;
|
|
18202
18189
|
|
|
18203
18190
|
/**
|
|
18204
18191
|
* make the renderable object persistent over level changes<br>
|
|
18205
|
-
* @public
|
|
18206
18192
|
* @type {boolean}
|
|
18207
18193
|
* @default false
|
|
18208
|
-
* @name isPersistent
|
|
18209
|
-
* @memberof Renderable
|
|
18210
18194
|
*/
|
|
18211
18195
|
this.isPersistent = false;
|
|
18212
18196
|
|
|
18213
18197
|
/**
|
|
18214
18198
|
* If true, this renderable will be rendered using screen coordinates,
|
|
18215
18199
|
* as opposed to world coordinates. Use this, for example, to define UI elements.
|
|
18216
|
-
* @public
|
|
18217
18200
|
* @type {boolean}
|
|
18218
18201
|
* @default false
|
|
18219
|
-
* @name floating
|
|
18220
|
-
* @memberof Renderable
|
|
18221
18202
|
*/
|
|
18222
18203
|
this.floating = false;
|
|
18223
18204
|
|
|
@@ -18232,11 +18213,8 @@
|
|
|
18232
18213
|
* <br>
|
|
18233
18214
|
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
18234
18215
|
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
18235
|
-
* @public
|
|
18236
18216
|
* @type {ObservableVector2d}
|
|
18237
18217
|
* @default <0.5,0.5>
|
|
18238
|
-
* @name anchorPoint
|
|
18239
|
-
* @memberof Renderable#
|
|
18240
18218
|
*/
|
|
18241
18219
|
this.anchorPoint = pool.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
18242
18220
|
}
|
|
@@ -18244,11 +18222,8 @@
|
|
|
18244
18222
|
/**
|
|
18245
18223
|
* When enabled, an object container will automatically apply
|
|
18246
18224
|
* any defined transformation before calling the child draw method.
|
|
18247
|
-
* @public
|
|
18248
18225
|
* @type {boolean}
|
|
18249
18226
|
* @default true
|
|
18250
|
-
* @name autoTransform
|
|
18251
|
-
* @memberof Renderable
|
|
18252
18227
|
* @example
|
|
18253
18228
|
* // enable "automatic" transformation when the object is activated
|
|
18254
18229
|
* onActivateEvent: function () {
|
|
@@ -18268,30 +18243,23 @@
|
|
|
18268
18243
|
* Set to zero if you do not wish an object to be drawn
|
|
18269
18244
|
* @see Renderable#setOpacity
|
|
18270
18245
|
* @see Renderable#getOpacity
|
|
18271
|
-
* @public
|
|
18272
18246
|
* @type {number}
|
|
18273
18247
|
* @default 1.0
|
|
18274
|
-
* @name Renderable#alpha
|
|
18275
18248
|
*/
|
|
18276
18249
|
this.alpha = 1.0;
|
|
18277
18250
|
|
|
18278
18251
|
/**
|
|
18279
18252
|
* a reference to the parent object that contains this renderable
|
|
18280
|
-
* @public
|
|
18281
18253
|
* @type {Container|Entity}
|
|
18282
18254
|
* @default undefined
|
|
18283
|
-
* @name Renderable#ancestor
|
|
18284
18255
|
*/
|
|
18285
18256
|
this.ancestor = undefined;
|
|
18286
18257
|
|
|
18287
18258
|
/**
|
|
18288
18259
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
18289
18260
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
18290
|
-
* @public
|
|
18291
18261
|
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
18292
|
-
* @name mask
|
|
18293
18262
|
* @default undefined
|
|
18294
|
-
* @memberof Renderable#
|
|
18295
18263
|
* @example
|
|
18296
18264
|
* // apply a mask in the shape of a Star
|
|
18297
18265
|
* myNPCSprite.mask = new me.Polygon(myNPCSprite.width / 2, 0, [
|
|
@@ -18310,40 +18278,19 @@
|
|
|
18310
18278
|
*/
|
|
18311
18279
|
this.mask = undefined;
|
|
18312
18280
|
|
|
18313
|
-
/**
|
|
18314
|
-
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
18315
|
-
* @public
|
|
18316
|
-
* @type {Color}
|
|
18317
|
-
* @name tint
|
|
18318
|
-
* @default (255, 255, 255)
|
|
18319
|
-
* @memberof Renderable#
|
|
18320
|
-
* @example
|
|
18321
|
-
* // add a red tint to this renderable
|
|
18322
|
-
* this.tint.setColor(255, 128, 128);
|
|
18323
|
-
* // remove the tint
|
|
18324
|
-
* this.tint.setColor(255, 255, 255);
|
|
18325
|
-
*/
|
|
18326
|
-
this.tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18327
|
-
|
|
18328
18281
|
/**
|
|
18329
18282
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
18330
|
-
* @public
|
|
18331
18283
|
* @type {string}
|
|
18332
|
-
* @name blendMode
|
|
18333
18284
|
* @default "normal"
|
|
18334
18285
|
* @see CanvasRenderer#setBlendMode
|
|
18335
18286
|
* @see WebGLRenderer#setBlendMode
|
|
18336
|
-
* @memberof Renderable#
|
|
18337
18287
|
*/
|
|
18338
18288
|
this.blendMode = "normal";
|
|
18339
18289
|
|
|
18340
18290
|
/**
|
|
18341
18291
|
* The name of the renderable
|
|
18342
|
-
* @public
|
|
18343
18292
|
* @type {string}
|
|
18344
|
-
* @name name
|
|
18345
18293
|
* @default ""
|
|
18346
|
-
* @memberof Renderable
|
|
18347
18294
|
*/
|
|
18348
18295
|
this.name = "";
|
|
18349
18296
|
|
|
@@ -18354,8 +18301,6 @@
|
|
|
18354
18301
|
* Position of the Renderable relative to its parent container
|
|
18355
18302
|
* @public
|
|
18356
18303
|
* @type {ObservableVector3d}
|
|
18357
|
-
* @name pos
|
|
18358
|
-
* @memberof Renderable#
|
|
18359
18304
|
*/
|
|
18360
18305
|
this.pos = pool.pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
|
|
18361
18306
|
}
|
|
@@ -18363,9 +18308,7 @@
|
|
|
18363
18308
|
/**
|
|
18364
18309
|
* when true the renderable will be redrawn during the next update cycle
|
|
18365
18310
|
* @type {boolean}
|
|
18366
|
-
* @name isDirty
|
|
18367
18311
|
* @default false
|
|
18368
|
-
* @memberof Renderable#
|
|
18369
18312
|
*/
|
|
18370
18313
|
this.isDirty = false;
|
|
18371
18314
|
|
|
@@ -18386,27 +18329,49 @@
|
|
|
18386
18329
|
Renderable.prototype = Object.create( Rect && Rect.prototype );
|
|
18387
18330
|
Renderable.prototype.constructor = Renderable;
|
|
18388
18331
|
|
|
18389
|
-
var prototypeAccessors = { isFloating: { configurable: true },inViewport: { configurable: true },isFlippedX: { configurable: true },isFlippedY: { configurable: true } };
|
|
18332
|
+
var prototypeAccessors = { isFloating: { configurable: true },tint: { configurable: true },inViewport: { configurable: true },isFlippedX: { configurable: true },isFlippedY: { configurable: true } };
|
|
18390
18333
|
|
|
18391
18334
|
/**
|
|
18392
18335
|
* Whether the renderable object is floating, or contained in a floating container
|
|
18393
|
-
* @public
|
|
18394
18336
|
* @see Renderable#floating
|
|
18395
18337
|
* @type {boolean}
|
|
18396
|
-
* @name isFloating
|
|
18397
|
-
* @memberof Renderable
|
|
18398
18338
|
*/
|
|
18399
18339
|
prototypeAccessors.isFloating.get = function () {
|
|
18400
18340
|
return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.floating === true);
|
|
18401
18341
|
};
|
|
18402
18342
|
|
|
18343
|
+
/**
|
|
18344
|
+
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
18345
|
+
* @type {Color}
|
|
18346
|
+
* @default (255, 255, 255)
|
|
18347
|
+
* @example
|
|
18348
|
+
* // add a red tint to this renderable
|
|
18349
|
+
* this.tint.setColor(255, 128, 128);
|
|
18350
|
+
* // remove the tint
|
|
18351
|
+
* this.tint.setColor(255, 255, 255);
|
|
18352
|
+
*/
|
|
18353
|
+
prototypeAccessors.tint.get = function () {
|
|
18354
|
+
if (typeof this._tint === "undefined") {
|
|
18355
|
+
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18356
|
+
}
|
|
18357
|
+
return this._tint;
|
|
18358
|
+
};
|
|
18359
|
+
prototypeAccessors.tint.set = function (value) {
|
|
18360
|
+
if (typeof this._tint === "undefined") {
|
|
18361
|
+
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
18362
|
+
}
|
|
18363
|
+
if (value instanceof Color) {
|
|
18364
|
+
this._tint.copy(value);
|
|
18365
|
+
} else {
|
|
18366
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
18367
|
+
this._tint.parseCSS(value);
|
|
18368
|
+
}
|
|
18369
|
+
};
|
|
18370
|
+
|
|
18403
18371
|
/**
|
|
18404
18372
|
* Whether the renderable object is visible and within the viewport
|
|
18405
|
-
* @public
|
|
18406
18373
|
* @type {boolean}
|
|
18407
18374
|
* @default false
|
|
18408
|
-
* @name inViewport
|
|
18409
|
-
* @memberof Renderable
|
|
18410
18375
|
*/
|
|
18411
18376
|
prototypeAccessors.inViewport.get = function () {
|
|
18412
18377
|
return this._inViewport;
|
|
@@ -18425,8 +18390,6 @@
|
|
|
18425
18390
|
* @public
|
|
18426
18391
|
* @see Renderable#flipX
|
|
18427
18392
|
* @type {boolean}
|
|
18428
|
-
* @name isFlippedX
|
|
18429
|
-
* @memberof Renderable
|
|
18430
18393
|
*/
|
|
18431
18394
|
prototypeAccessors.isFlippedX.get = function () {
|
|
18432
18395
|
return this._flip.x === true;
|
|
@@ -18437,8 +18400,6 @@
|
|
|
18437
18400
|
* @public
|
|
18438
18401
|
* @see Renderable#flipY
|
|
18439
18402
|
* @type {boolean}
|
|
18440
|
-
* @name isFlippedY
|
|
18441
|
-
* @memberof Renderable
|
|
18442
18403
|
*/
|
|
18443
18404
|
prototypeAccessors.isFlippedY.get = function () {
|
|
18444
18405
|
return this._flip.y === true;
|
|
@@ -18446,8 +18407,6 @@
|
|
|
18446
18407
|
|
|
18447
18408
|
/**
|
|
18448
18409
|
* returns the bounding box for this renderable
|
|
18449
|
-
* @name getBounds
|
|
18450
|
-
* @memberof Renderable
|
|
18451
18410
|
* @returns {Bounds} bounding box Rectangle object
|
|
18452
18411
|
*/
|
|
18453
18412
|
Renderable.prototype.getBounds = function getBounds () {
|
|
@@ -18466,8 +18425,6 @@
|
|
|
18466
18425
|
|
|
18467
18426
|
/**
|
|
18468
18427
|
* get the renderable alpha channel value<br>
|
|
18469
|
-
* @name getOpacity
|
|
18470
|
-
* @memberof Renderable
|
|
18471
18428
|
* @returns {number} current opacity value between 0 and 1
|
|
18472
18429
|
*/
|
|
18473
18430
|
Renderable.prototype.getOpacity = function getOpacity () {
|
|
@@ -18476,8 +18433,6 @@
|
|
|
18476
18433
|
|
|
18477
18434
|
/**
|
|
18478
18435
|
* set the renderable alpha channel value<br>
|
|
18479
|
-
* @name setOpacity
|
|
18480
|
-
* @memberof Renderable
|
|
18481
18436
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
18482
18437
|
*/
|
|
18483
18438
|
Renderable.prototype.setOpacity = function setOpacity (alpha) {
|
|
@@ -18494,8 +18449,6 @@
|
|
|
18494
18449
|
/**
|
|
18495
18450
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
18496
18451
|
* @see Matrix2d#scaleX
|
|
18497
|
-
* @name flipX
|
|
18498
|
-
* @memberof Renderable
|
|
18499
18452
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
18500
18453
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18501
18454
|
*/
|
|
@@ -18510,8 +18463,6 @@
|
|
|
18510
18463
|
/**
|
|
18511
18464
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
18512
18465
|
* @see Matrix2d#scaleY
|
|
18513
|
-
* @name flipY
|
|
18514
|
-
* @memberof Renderable
|
|
18515
18466
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
18516
18467
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18517
18468
|
*/
|
|
@@ -18525,8 +18476,6 @@
|
|
|
18525
18476
|
|
|
18526
18477
|
/**
|
|
18527
18478
|
* multiply the renderable currentTransform with the given matrix
|
|
18528
|
-
* @name transform
|
|
18529
|
-
* @memberof Renderable
|
|
18530
18479
|
* @see Renderable#currentTransform
|
|
18531
18480
|
* @param {Matrix2d} m the transformation matrix
|
|
18532
18481
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18541,8 +18490,6 @@
|
|
|
18541
18490
|
|
|
18542
18491
|
/**
|
|
18543
18492
|
* return the angle to the specified target
|
|
18544
|
-
* @name angleTo
|
|
18545
|
-
* @memberof Renderable
|
|
18546
18493
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
18547
18494
|
* @returns {number} angle in radians
|
|
18548
18495
|
*/
|
|
@@ -18564,8 +18511,6 @@
|
|
|
18564
18511
|
|
|
18565
18512
|
/**
|
|
18566
18513
|
* return the distance to the specified target
|
|
18567
|
-
* @name distanceTo
|
|
18568
|
-
* @memberof Renderable
|
|
18569
18514
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
18570
18515
|
* @returns {number} distance
|
|
18571
18516
|
*/
|
|
@@ -18587,8 +18532,6 @@
|
|
|
18587
18532
|
|
|
18588
18533
|
/**
|
|
18589
18534
|
* Rotate this renderable towards the given target.
|
|
18590
|
-
* @name lookAt
|
|
18591
|
-
* @memberof Renderable
|
|
18592
18535
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
18593
18536
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18594
18537
|
*/
|
|
@@ -18610,8 +18553,6 @@
|
|
|
18610
18553
|
|
|
18611
18554
|
/**
|
|
18612
18555
|
* Rotate this renderable by the specified angle (in radians).
|
|
18613
|
-
* @name rotate
|
|
18614
|
-
* @memberof Renderable
|
|
18615
18556
|
* @param {number} angle The angle to rotate (in radians)
|
|
18616
18557
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
18617
18558
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18631,8 +18572,6 @@
|
|
|
18631
18572
|
* when rendering. It does not scale the object itself. For example if the renderable
|
|
18632
18573
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
18633
18574
|
* member will be changed.
|
|
18634
|
-
* @name scale
|
|
18635
|
-
* @memberof Renderable
|
|
18636
18575
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
18637
18576
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
18638
18577
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -18646,8 +18585,6 @@
|
|
|
18646
18585
|
|
|
18647
18586
|
/**
|
|
18648
18587
|
* scale the renderable around his anchor point
|
|
18649
|
-
* @name scaleV
|
|
18650
|
-
* @memberof Renderable
|
|
18651
18588
|
* @param {Vector2d} v scaling vector
|
|
18652
18589
|
* @returns {Renderable} Reference to this object for method chaining
|
|
18653
18590
|
*/
|
|
@@ -18657,11 +18594,7 @@
|
|
|
18657
18594
|
};
|
|
18658
18595
|
|
|
18659
18596
|
/**
|
|
18660
|
-
* update function.
|
|
18661
|
-
* automatically called by the game manager {@link game}
|
|
18662
|
-
* @name update
|
|
18663
|
-
* @memberof Renderable
|
|
18664
|
-
* @protected
|
|
18597
|
+
* update function (automatically called by melonJS).
|
|
18665
18598
|
* @param {number} dt time since the last update in milliseconds.
|
|
18666
18599
|
* @returns {boolean} true if the renderable is dirty
|
|
18667
18600
|
*/
|
|
@@ -18672,8 +18605,6 @@
|
|
|
18672
18605
|
/**
|
|
18673
18606
|
* update the bounding box for this shape.
|
|
18674
18607
|
* @ignore
|
|
18675
|
-
* @name updateBounds
|
|
18676
|
-
* @memberof Renderable
|
|
18677
18608
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
18678
18609
|
*/
|
|
18679
18610
|
Renderable.prototype.updateBounds = function updateBounds () {
|
|
@@ -18685,8 +18616,6 @@
|
|
|
18685
18616
|
/**
|
|
18686
18617
|
* update the renderable's bounding rect (private)
|
|
18687
18618
|
* @ignore
|
|
18688
|
-
* @name updateBoundsPos
|
|
18689
|
-
* @memberof Renderable
|
|
18690
18619
|
*/
|
|
18691
18620
|
Renderable.prototype.updateBoundsPos = function updateBoundsPos (newX, newY) {
|
|
18692
18621
|
var bounds = this.getBounds();
|
|
@@ -18717,8 +18646,6 @@
|
|
|
18717
18646
|
|
|
18718
18647
|
/**
|
|
18719
18648
|
* return the renderable absolute position in the game world
|
|
18720
|
-
* @name getAbsolutePosition
|
|
18721
|
-
* @memberof Renderable
|
|
18722
18649
|
* @returns {Vector2d}
|
|
18723
18650
|
*/
|
|
18724
18651
|
Renderable.prototype.getAbsolutePosition = function getAbsolutePosition () {
|
|
@@ -18736,8 +18663,6 @@
|
|
|
18736
18663
|
/**
|
|
18737
18664
|
* called when the anchor point value is changed
|
|
18738
18665
|
* @private
|
|
18739
|
-
* @name onAnchorUpdate
|
|
18740
|
-
* @memberof Renderable
|
|
18741
18666
|
* @param {number} x the new X value to be set for the anchor
|
|
18742
18667
|
* @param {number} y the new Y value to be set for the anchor
|
|
18743
18668
|
*/
|
|
@@ -18750,12 +18675,10 @@
|
|
|
18750
18675
|
};
|
|
18751
18676
|
|
|
18752
18677
|
/**
|
|
18753
|
-
*
|
|
18754
|
-
*
|
|
18755
|
-
*
|
|
18756
|
-
* @
|
|
18757
|
-
* @memberof Renderable
|
|
18758
|
-
* @protected
|
|
18678
|
+
* Prepare the rendering context before drawing (automatically called by melonJS).
|
|
18679
|
+
* This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
|
|
18680
|
+
* @see Renderable#draw
|
|
18681
|
+
* @see Renderable#postDraw
|
|
18759
18682
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
18760
18683
|
*/
|
|
18761
18684
|
Renderable.prototype.preDraw = function preDraw (renderer) {
|
|
@@ -18806,10 +18729,15 @@
|
|
|
18806
18729
|
};
|
|
18807
18730
|
|
|
18808
18731
|
/**
|
|
18809
|
-
*
|
|
18810
|
-
*
|
|
18811
|
-
*
|
|
18812
|
-
*
|
|
18732
|
+
* Draw this renderable (automatically called by melonJS).
|
|
18733
|
+
* All draw operations for renderable are made respectively
|
|
18734
|
+
* to the position or transforms set or applied by the preDraw method.
|
|
18735
|
+
* The main draw loop will first call preDraw() to prepare the context for drawing the renderable,
|
|
18736
|
+
* then draw() to draw the renderable, and finally postDraw() to clear the context.
|
|
18737
|
+
* If you override this method, be mindful about the drawing logic; for example if you draw a shape
|
|
18738
|
+
* from the draw method, you should make sure that your draw it at the 0, 0 coordinates.
|
|
18739
|
+
* @see Renderable#preDraw
|
|
18740
|
+
* @see Renderable#postDraw
|
|
18813
18741
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
18814
18742
|
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
18815
18743
|
*/
|
|
@@ -18818,11 +18746,9 @@
|
|
|
18818
18746
|
};
|
|
18819
18747
|
|
|
18820
18748
|
/**
|
|
18821
|
-
* restore the rendering context after drawing.
|
|
18822
|
-
*
|
|
18823
|
-
* @
|
|
18824
|
-
* @memberof Renderable
|
|
18825
|
-
* @protected
|
|
18749
|
+
* restore the rendering context after drawing (automatically called by melonJS).
|
|
18750
|
+
* @see Renderable#preDraw
|
|
18751
|
+
* @see Renderable#draw
|
|
18826
18752
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
18827
18753
|
*/
|
|
18828
18754
|
Renderable.prototype.postDraw = function postDraw (renderer) {
|
|
@@ -18844,8 +18770,6 @@
|
|
|
18844
18770
|
/**
|
|
18845
18771
|
* onCollision callback, triggered in case of collision,
|
|
18846
18772
|
* when this renderable body is colliding with another one
|
|
18847
|
-
* @name onCollision
|
|
18848
|
-
* @memberof Renderable
|
|
18849
18773
|
* @param {ResponseObject} response the collision response object
|
|
18850
18774
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
18851
18775
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
@@ -18897,9 +18821,9 @@
|
|
|
18897
18821
|
this.mask = undefined;
|
|
18898
18822
|
}
|
|
18899
18823
|
|
|
18900
|
-
if (typeof this.
|
|
18901
|
-
pool.push(this.
|
|
18902
|
-
this.
|
|
18824
|
+
if (typeof this._tint !== "undefined") {
|
|
18825
|
+
pool.push(this._tint);
|
|
18826
|
+
this._tint = undefined;
|
|
18903
18827
|
}
|
|
18904
18828
|
|
|
18905
18829
|
this.ancestor = undefined;
|
|
@@ -18920,8 +18844,6 @@
|
|
|
18920
18844
|
/**
|
|
18921
18845
|
* OnDestroy Notification function<br>
|
|
18922
18846
|
* Called by engine before deleting the object
|
|
18923
|
-
* @name onDestroyEvent
|
|
18924
|
-
* @memberof Renderable
|
|
18925
18847
|
*/
|
|
18926
18848
|
Renderable.prototype.onDestroyEvent = function onDestroyEvent () {
|
|
18927
18849
|
// to be extended !
|
|
@@ -19790,7 +19712,7 @@
|
|
|
19790
19712
|
/**
|
|
19791
19713
|
* The collision shapes of the body
|
|
19792
19714
|
* @ignore
|
|
19793
|
-
* @type {Polygon[]|Line[]|Ellipse[]}
|
|
19715
|
+
* @type {Polygon[]|Line[]|Ellipse[]|Point|Point[]}
|
|
19794
19716
|
*/
|
|
19795
19717
|
this.shapes = [];
|
|
19796
19718
|
}
|
|
@@ -19984,7 +19906,7 @@
|
|
|
19984
19906
|
/**
|
|
19985
19907
|
* add a collision shape to this body <br>
|
|
19986
19908
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
19987
|
-
* @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
|
|
19909
|
+
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
|
|
19988
19910
|
* @returns {number} the shape array length
|
|
19989
19911
|
* @example
|
|
19990
19912
|
* // add a rectangle shape
|
|
@@ -20019,6 +19941,12 @@
|
|
|
20019
19941
|
// update the body bounds
|
|
20020
19942
|
this.bounds.add(shape.points);
|
|
20021
19943
|
this.bounds.translate(shape.pos);
|
|
19944
|
+
} else if (shape instanceof Point) {
|
|
19945
|
+
if (!this.shapes.includes(shape)) {
|
|
19946
|
+
// see removeShape
|
|
19947
|
+
this.shapes.push(shape);
|
|
19948
|
+
}
|
|
19949
|
+
this.bounds.addPoint(shape);
|
|
20022
19950
|
} else {
|
|
20023
19951
|
// JSON object
|
|
20024
19952
|
this.fromJSON(shape);
|
|
@@ -24548,8 +24476,10 @@
|
|
|
24548
24476
|
* @memberof CanvasRenderer
|
|
24549
24477
|
*/
|
|
24550
24478
|
CanvasRenderer.prototype.clear = function clear () {
|
|
24551
|
-
if (this.settings.transparent) {
|
|
24552
|
-
this.
|
|
24479
|
+
if (this.settings.transparent === false) {
|
|
24480
|
+
var canvas = this.getCanvas();
|
|
24481
|
+
var context = this.getContext();
|
|
24482
|
+
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
24553
24483
|
}
|
|
24554
24484
|
};
|
|
24555
24485
|
|
|
@@ -24562,13 +24492,15 @@
|
|
|
24562
24492
|
*/
|
|
24563
24493
|
CanvasRenderer.prototype.clearColor = function clearColor (color, opaque) {
|
|
24564
24494
|
if ( color === void 0 ) color = "#000000";
|
|
24495
|
+
if ( opaque === void 0 ) opaque = false;
|
|
24565
24496
|
|
|
24566
24497
|
var canvas = this.getCanvas();
|
|
24567
24498
|
var context = this.getContext();
|
|
24568
24499
|
|
|
24569
24500
|
this.save();
|
|
24570
24501
|
this.resetTransform();
|
|
24571
|
-
context.
|
|
24502
|
+
context.globalAlpha = 1;
|
|
24503
|
+
context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
|
|
24572
24504
|
context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
|
|
24573
24505
|
this.fillRect(0, 0, canvas.width, canvas.height);
|
|
24574
24506
|
this.restore();
|
|
@@ -24940,6 +24872,30 @@
|
|
|
24940
24872
|
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
24941
24873
|
};
|
|
24942
24874
|
|
|
24875
|
+
/**
|
|
24876
|
+
* Stroke a Point at the specified coordinates
|
|
24877
|
+
* @name strokePoint
|
|
24878
|
+
* @memberof CanvasRenderer
|
|
24879
|
+
* @param {number} x
|
|
24880
|
+
* @param {number} y
|
|
24881
|
+
*/
|
|
24882
|
+
CanvasRenderer.prototype.strokePoint = function strokePoint (x, y) {
|
|
24883
|
+
this.strokeLine(x, y, x + 1, y + 1);
|
|
24884
|
+
};
|
|
24885
|
+
|
|
24886
|
+
/**
|
|
24887
|
+
* Draw a a point at the specified coordinates
|
|
24888
|
+
* @name fillPoint
|
|
24889
|
+
* @memberof CanvasRenderer
|
|
24890
|
+
* @param {number} x
|
|
24891
|
+
* @param {number} y
|
|
24892
|
+
* @param {number} width
|
|
24893
|
+
* @param {number} height
|
|
24894
|
+
*/
|
|
24895
|
+
CanvasRenderer.prototype.fillPoint = function fillPoint (x, y) {
|
|
24896
|
+
this.strokePoint(x, y);
|
|
24897
|
+
};
|
|
24898
|
+
|
|
24943
24899
|
/**
|
|
24944
24900
|
* return a reference to the font 2d Context
|
|
24945
24901
|
* @ignore
|
|
@@ -27146,7 +27102,7 @@
|
|
|
27146
27102
|
this.type = settings.type;
|
|
27147
27103
|
|
|
27148
27104
|
/**
|
|
27149
|
-
* the
|
|
27105
|
+
* the object class
|
|
27150
27106
|
* @public
|
|
27151
27107
|
* @type {string}
|
|
27152
27108
|
* @name class
|
|
@@ -27209,6 +27165,15 @@
|
|
|
27209
27165
|
*/
|
|
27210
27166
|
this.isEllipse = false;
|
|
27211
27167
|
|
|
27168
|
+
/**
|
|
27169
|
+
* if true, the object is a Point
|
|
27170
|
+
* @public
|
|
27171
|
+
* @type {boolean}
|
|
27172
|
+
* @name isPoint
|
|
27173
|
+
* @memberof TMXObject
|
|
27174
|
+
*/
|
|
27175
|
+
this.isPoint = false;
|
|
27176
|
+
|
|
27212
27177
|
/**
|
|
27213
27178
|
* if true, the object is a Polygon
|
|
27214
27179
|
* @public
|
|
@@ -27232,12 +27197,14 @@
|
|
|
27232
27197
|
this.setTile(map.tilesets);
|
|
27233
27198
|
}
|
|
27234
27199
|
else {
|
|
27235
|
-
if (typeof
|
|
27200
|
+
if (typeof settings.ellipse !== "undefined") {
|
|
27236
27201
|
this.isEllipse = true;
|
|
27237
|
-
} else if (typeof
|
|
27202
|
+
} else if (typeof settings.point !== "undefined") {
|
|
27203
|
+
this.isPoint = true;
|
|
27204
|
+
} else if (typeof settings.polygon !== "undefined") {
|
|
27238
27205
|
this.points = settings.polygon;
|
|
27239
27206
|
this.isPolygon = true;
|
|
27240
|
-
} else if (typeof
|
|
27207
|
+
} else if (typeof settings.polyline !== "undefined") {
|
|
27241
27208
|
this.points = settings.polyline;
|
|
27242
27209
|
this.isPolyLine = true;
|
|
27243
27210
|
}
|
|
@@ -27311,8 +27278,9 @@
|
|
|
27311
27278
|
this.width,
|
|
27312
27279
|
this.height
|
|
27313
27280
|
)).rotate(this.rotation));
|
|
27281
|
+
} else if (this.isPoint === true) {
|
|
27282
|
+
shapes.push(pool.pull("Point", this.x, this.y));
|
|
27314
27283
|
} else {
|
|
27315
|
-
|
|
27316
27284
|
// add a polygon
|
|
27317
27285
|
if (this.isPolygon === true) {
|
|
27318
27286
|
var _polygon = pool.pull("Polygon", 0, 0, this.points);
|
|
@@ -27321,10 +27289,8 @@
|
|
|
27321
27289
|
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
27322
27290
|
}
|
|
27323
27291
|
shapes.push(_polygon.rotate(this.rotation));
|
|
27324
|
-
}
|
|
27325
27292
|
|
|
27326
|
-
|
|
27327
|
-
else if (this.isPolyLine === true) {
|
|
27293
|
+
} else if (this.isPolyLine === true) {
|
|
27328
27294
|
var p = this.points;
|
|
27329
27295
|
var p1, p2;
|
|
27330
27296
|
var segments = p.length - 1;
|
|
@@ -27356,7 +27322,9 @@
|
|
|
27356
27322
|
// Apply isometric projection
|
|
27357
27323
|
if (this.orientation === "isometric") {
|
|
27358
27324
|
for (i = 0; i < shapes.length; i++) {
|
|
27359
|
-
shapes[i].toIso
|
|
27325
|
+
if (typeof shapes[i].toIso === "function") {
|
|
27326
|
+
shapes[i].toIso();
|
|
27327
|
+
}
|
|
27360
27328
|
}
|
|
27361
27329
|
}
|
|
27362
27330
|
|
|
@@ -29302,7 +29270,12 @@
|
|
|
29302
29270
|
}
|
|
29303
29271
|
|
|
29304
29272
|
if (typeof (settings.tint) !== "undefined") {
|
|
29305
|
-
|
|
29273
|
+
if (settings.tint instanceof Color) {
|
|
29274
|
+
this.tint.copy(settings.tint);
|
|
29275
|
+
} else {
|
|
29276
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
29277
|
+
this.tint.parseCSS(settings.tint);
|
|
29278
|
+
}
|
|
29306
29279
|
}
|
|
29307
29280
|
|
|
29308
29281
|
// set the sprite name if specified
|
|
@@ -30829,8 +30802,6 @@
|
|
|
30829
30802
|
|
|
30830
30803
|
/**
|
|
30831
30804
|
* The WebGL version used by this renderer (1 or 2)
|
|
30832
|
-
* @name WebGLVersion
|
|
30833
|
-
* @memberof WebGLRenderer#
|
|
30834
30805
|
* @type {number}
|
|
30835
30806
|
* @default 1
|
|
30836
30807
|
* @readonly
|
|
@@ -30839,8 +30810,6 @@
|
|
|
30839
30810
|
|
|
30840
30811
|
/**
|
|
30841
30812
|
* The vendor string of the underlying graphics driver.
|
|
30842
|
-
* @name GPUVendor
|
|
30843
|
-
* @memberof WebGLRenderer#
|
|
30844
30813
|
* @type {string}
|
|
30845
30814
|
* @default null
|
|
30846
30815
|
* @readonly
|
|
@@ -30849,8 +30818,6 @@
|
|
|
30849
30818
|
|
|
30850
30819
|
/**
|
|
30851
30820
|
* The renderer string of the underlying graphics driver.
|
|
30852
|
-
* @name GPURenderer
|
|
30853
|
-
* @memberof WebGLRenderer#
|
|
30854
30821
|
* @type {string}
|
|
30855
30822
|
* @default null
|
|
30856
30823
|
* @readonly
|
|
@@ -30860,15 +30827,12 @@
|
|
|
30860
30827
|
/**
|
|
30861
30828
|
* The WebGL context
|
|
30862
30829
|
* @name gl
|
|
30863
|
-
* @memberof WebGLRenderer
|
|
30864
30830
|
* @type {WebGLRenderingContext}
|
|
30865
30831
|
*/
|
|
30866
30832
|
this.context = this.gl = this.getContextGL(this.getCanvas(), options.transparent);
|
|
30867
30833
|
|
|
30868
30834
|
/**
|
|
30869
30835
|
* Maximum number of texture unit supported under the current context
|
|
30870
|
-
* @name maxTextures
|
|
30871
|
-
* @memberof WebGLRenderer#
|
|
30872
30836
|
* @type {number}
|
|
30873
30837
|
* @readonly
|
|
30874
30838
|
*/
|
|
@@ -30896,25 +30860,19 @@
|
|
|
30896
30860
|
|
|
30897
30861
|
/**
|
|
30898
30862
|
* The current transformation matrix used for transformations on the overall scene
|
|
30899
|
-
* @name currentTransform
|
|
30900
30863
|
* @type {Matrix2d}
|
|
30901
|
-
* @memberof WebGLRenderer#
|
|
30902
30864
|
*/
|
|
30903
30865
|
this.currentTransform = new Matrix2d();
|
|
30904
30866
|
|
|
30905
30867
|
/**
|
|
30906
30868
|
* The current compositor used by the renderer
|
|
30907
|
-
* @name currentCompositor
|
|
30908
30869
|
* @type {WebGLCompositor}
|
|
30909
|
-
* @memberof WebGLRenderer#
|
|
30910
30870
|
*/
|
|
30911
30871
|
this.currentCompositor = null;
|
|
30912
30872
|
|
|
30913
30873
|
/**
|
|
30914
30874
|
* The list of active compositors
|
|
30915
|
-
* @name compositors
|
|
30916
30875
|
* @type {Map<WebGLCompositor>}
|
|
30917
|
-
* @memberof WebGLRenderer#
|
|
30918
30876
|
*/
|
|
30919
30877
|
this.compositors = new Map();
|
|
30920
30878
|
|
|
@@ -30964,8 +30922,6 @@
|
|
|
30964
30922
|
|
|
30965
30923
|
/**
|
|
30966
30924
|
* Reset context state
|
|
30967
|
-
* @name reset
|
|
30968
|
-
* @memberof WebGLRenderer
|
|
30969
30925
|
*/
|
|
30970
30926
|
WebGLRenderer.prototype.reset = function reset () {
|
|
30971
30927
|
var this$1$1 = this;
|
|
@@ -30990,9 +30946,7 @@
|
|
|
30990
30946
|
|
|
30991
30947
|
/**
|
|
30992
30948
|
* set the active compositor for this renderer
|
|
30993
|
-
* @name setCompositor
|
|
30994
30949
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
30995
|
-
* @memberof WebGLRenderer
|
|
30996
30950
|
*/
|
|
30997
30951
|
WebGLRenderer.prototype.setCompositor = function setCompositor (compositor) {
|
|
30998
30952
|
if ( compositor === void 0 ) compositor = "default";
|
|
@@ -31018,8 +30972,6 @@
|
|
|
31018
30972
|
|
|
31019
30973
|
/**
|
|
31020
30974
|
* Reset the gl transform to identity
|
|
31021
|
-
* @name resetTransform
|
|
31022
|
-
* @memberof WebGLRenderer
|
|
31023
30975
|
*/
|
|
31024
30976
|
WebGLRenderer.prototype.resetTransform = function resetTransform () {
|
|
31025
30977
|
this.currentTransform.identity();
|
|
@@ -31064,8 +31016,6 @@
|
|
|
31064
31016
|
|
|
31065
31017
|
/**
|
|
31066
31018
|
* Create a pattern with the specified repetition
|
|
31067
|
-
* @name createPattern
|
|
31068
|
-
* @memberof WebGLRenderer
|
|
31069
31019
|
* @param {Image} image Source image
|
|
31070
31020
|
* @param {string} repeat Define how the pattern should be repeated
|
|
31071
31021
|
* @returns {TextureAtlas}
|
|
@@ -31096,8 +31046,6 @@
|
|
|
31096
31046
|
|
|
31097
31047
|
/**
|
|
31098
31048
|
* Flush the compositor to the frame buffer
|
|
31099
|
-
* @name flush
|
|
31100
|
-
* @memberof WebGLRenderer
|
|
31101
31049
|
*/
|
|
31102
31050
|
WebGLRenderer.prototype.flush = function flush () {
|
|
31103
31051
|
this.currentCompositor.flush();
|
|
@@ -31105,8 +31053,6 @@
|
|
|
31105
31053
|
|
|
31106
31054
|
/**
|
|
31107
31055
|
* set/change the current projection matrix (WebGL only)
|
|
31108
|
-
* @name setProjection
|
|
31109
|
-
* @memberof WebGLRenderer
|
|
31110
31056
|
* @param {Matrix3d} matrix
|
|
31111
31057
|
*/
|
|
31112
31058
|
WebGLRenderer.prototype.setProjection = function setProjection (matrix) {
|
|
@@ -31114,10 +31060,15 @@
|
|
|
31114
31060
|
this.currentCompositor.setProjection(matrix);
|
|
31115
31061
|
};
|
|
31116
31062
|
|
|
31063
|
+
/**
|
|
31064
|
+
* prepare the framebuffer for drawing a new frame
|
|
31065
|
+
*/
|
|
31066
|
+
WebGLRenderer.prototype.clear = function clear () {
|
|
31067
|
+
this.currentCompositor.clear(this.settings.transparent ? 0.0 : 1.0);
|
|
31068
|
+
};
|
|
31069
|
+
|
|
31117
31070
|
/**
|
|
31118
31071
|
* Clears the gl context with the given color.
|
|
31119
|
-
* @name clearColor
|
|
31120
|
-
* @memberof WebGLRenderer
|
|
31121
31072
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
31122
31073
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
31123
31074
|
*/
|
|
@@ -31137,17 +31088,10 @@
|
|
|
31137
31088
|
}
|
|
31138
31089
|
// clear gl context with the specified color
|
|
31139
31090
|
this.currentCompositor.clearColor(glArray[0], glArray[1], glArray[2], (opaque === true) ? 1.0 : glArray[3]);
|
|
31140
|
-
this.currentCompositor.clear();
|
|
31141
|
-
|
|
31142
|
-
// restore default clear Color black
|
|
31143
|
-
this.currentCompositor.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
31144
|
-
|
|
31145
31091
|
};
|
|
31146
31092
|
|
|
31147
31093
|
/**
|
|
31148
31094
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
31149
|
-
* @name clearRect
|
|
31150
|
-
* @memberof WebGLRenderer
|
|
31151
31095
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
31152
31096
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
31153
31097
|
* @param {number} width The rectangle's width.
|
|
@@ -31181,7 +31125,7 @@
|
|
|
31181
31125
|
uvs[1],
|
|
31182
31126
|
uvs[2],
|
|
31183
31127
|
uvs[3],
|
|
31184
|
-
this.currentTint.toUint32()
|
|
31128
|
+
this.currentTint.toUint32(this.getGlobalAlpha())
|
|
31185
31129
|
);
|
|
31186
31130
|
|
|
31187
31131
|
// Clear font context2D
|
|
@@ -31195,8 +31139,6 @@
|
|
|
31195
31139
|
|
|
31196
31140
|
/**
|
|
31197
31141
|
* Draw an image to the gl context
|
|
31198
|
-
* @name drawImage
|
|
31199
|
-
* @memberof WebGLRenderer
|
|
31200
31142
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
31201
31143
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
31202
31144
|
* @param {number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -31242,13 +31184,11 @@
|
|
|
31242
31184
|
|
|
31243
31185
|
var texture = this.cache.get(image);
|
|
31244
31186
|
var uvs = texture.getUVs(sx + "," + sy + "," + sw + "," + sh);
|
|
31245
|
-
this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
|
|
31187
|
+
this.currentCompositor.addQuad(texture, dx, dy, dw, dh, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
|
|
31246
31188
|
};
|
|
31247
31189
|
|
|
31248
31190
|
/**
|
|
31249
31191
|
* Draw a pattern within the given rectangle.
|
|
31250
|
-
* @name drawPattern
|
|
31251
|
-
* @memberof WebGLRenderer
|
|
31252
31192
|
* @param {TextureAtlas} pattern Pattern object
|
|
31253
31193
|
* @param {number} x
|
|
31254
31194
|
* @param {number} y
|
|
@@ -31258,18 +31198,18 @@
|
|
|
31258
31198
|
*/
|
|
31259
31199
|
WebGLRenderer.prototype.drawPattern = function drawPattern (pattern, x, y, width, height) {
|
|
31260
31200
|
var uvs = pattern.getUVs("0,0," + width + "," + height);
|
|
31261
|
-
this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32());
|
|
31201
|
+
this.currentCompositor.addQuad(pattern, x, y, width, height, uvs[0], uvs[1], uvs[2], uvs[3], this.currentTint.toUint32(this.getGlobalAlpha()));
|
|
31262
31202
|
};
|
|
31263
31203
|
|
|
31264
31204
|
/**
|
|
31265
|
-
* Returns the WebGL Context object of the given
|
|
31266
|
-
* @name getContextGL
|
|
31267
|
-
* @memberof WebGLRenderer
|
|
31205
|
+
* Returns the WebGL Context object of the given canvas element
|
|
31268
31206
|
* @param {HTMLCanvasElement} canvas
|
|
31269
|
-
* @param {boolean} [transparent=
|
|
31207
|
+
* @param {boolean} [transparent=false] use true to enable transparency
|
|
31270
31208
|
* @returns {WebGLRenderingContext}
|
|
31271
31209
|
*/
|
|
31272
31210
|
WebGLRenderer.prototype.getContextGL = function getContextGL (canvas, transparent) {
|
|
31211
|
+
if ( transparent === void 0 ) transparent = false;
|
|
31212
|
+
|
|
31273
31213
|
if (typeof canvas === "undefined" || canvas === null) {
|
|
31274
31214
|
throw new Error(
|
|
31275
31215
|
"You must pass a canvas element in order to create " +
|
|
@@ -31277,17 +31217,13 @@
|
|
|
31277
31217
|
);
|
|
31278
31218
|
}
|
|
31279
31219
|
|
|
31280
|
-
if (typeof transparent !== "boolean") {
|
|
31281
|
-
transparent = true;
|
|
31282
|
-
}
|
|
31283
|
-
|
|
31284
31220
|
var attr = {
|
|
31285
31221
|
alpha : transparent,
|
|
31286
31222
|
antialias : this.settings.antiAlias,
|
|
31287
31223
|
depth : false,
|
|
31288
31224
|
stencil: true,
|
|
31289
31225
|
preserveDrawingBuffer : false,
|
|
31290
|
-
premultipliedAlpha: transparent,
|
|
31226
|
+
premultipliedAlpha: transparent ? this.settings.premultipliedAlpha : false,
|
|
31291
31227
|
powerPreference: this.settings.powerPreference,
|
|
31292
31228
|
failIfMajorPerformanceCaveat : this.settings.failIfMajorPerformanceCaveat
|
|
31293
31229
|
};
|
|
@@ -31320,8 +31256,6 @@
|
|
|
31320
31256
|
/**
|
|
31321
31257
|
* Returns the WebGLContext instance for the renderer
|
|
31322
31258
|
* return a reference to the system 2d Context
|
|
31323
|
-
* @name getContext
|
|
31324
|
-
* @memberof WebGLRenderer
|
|
31325
31259
|
* @returns {WebGLRenderingContext}
|
|
31326
31260
|
*/
|
|
31327
31261
|
WebGLRenderer.prototype.getContext = function getContext () {
|
|
@@ -31339,9 +31273,7 @@
|
|
|
31339
31273
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
31340
31274
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
31341
31275
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
31342
|
-
* @name setBlendMode
|
|
31343
31276
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
31344
|
-
* @memberof WebGLRenderer
|
|
31345
31277
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
31346
31278
|
* @param {WebGLRenderingContext} [gl]
|
|
31347
31279
|
*/
|
|
@@ -31393,8 +31325,6 @@
|
|
|
31393
31325
|
|
|
31394
31326
|
/**
|
|
31395
31327
|
* restores the canvas context
|
|
31396
|
-
* @name restore
|
|
31397
|
-
* @memberof WebGLRenderer
|
|
31398
31328
|
*/
|
|
31399
31329
|
WebGLRenderer.prototype.restore = function restore () {
|
|
31400
31330
|
// do nothing if there is no saved states
|
|
@@ -31428,8 +31358,6 @@
|
|
|
31428
31358
|
|
|
31429
31359
|
/**
|
|
31430
31360
|
* saves the canvas context
|
|
31431
|
-
* @name save
|
|
31432
|
-
* @memberof WebGLRenderer
|
|
31433
31361
|
*/
|
|
31434
31362
|
WebGLRenderer.prototype.save = function save () {
|
|
31435
31363
|
this._colorStack.push(this.currentColor.clone());
|
|
@@ -31445,8 +31373,6 @@
|
|
|
31445
31373
|
|
|
31446
31374
|
/**
|
|
31447
31375
|
* rotates the uniform matrix
|
|
31448
|
-
* @name rotate
|
|
31449
|
-
* @memberof WebGLRenderer
|
|
31450
31376
|
* @param {number} angle in radians
|
|
31451
31377
|
*/
|
|
31452
31378
|
WebGLRenderer.prototype.rotate = function rotate (angle) {
|
|
@@ -31455,8 +31381,6 @@
|
|
|
31455
31381
|
|
|
31456
31382
|
/**
|
|
31457
31383
|
* scales the uniform matrix
|
|
31458
|
-
* @name scale
|
|
31459
|
-
* @memberof WebGLRenderer
|
|
31460
31384
|
* @param {number} x
|
|
31461
31385
|
* @param {number} y
|
|
31462
31386
|
*/
|
|
@@ -31475,8 +31399,6 @@
|
|
|
31475
31399
|
|
|
31476
31400
|
/**
|
|
31477
31401
|
* Set the global alpha
|
|
31478
|
-
* @name setGlobalAlpha
|
|
31479
|
-
* @memberof WebGLRenderer
|
|
31480
31402
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
31481
31403
|
*/
|
|
31482
31404
|
WebGLRenderer.prototype.setGlobalAlpha = function setGlobalAlpha (alpha) {
|
|
@@ -31485,8 +31407,6 @@
|
|
|
31485
31407
|
|
|
31486
31408
|
/**
|
|
31487
31409
|
* Return the global alpha
|
|
31488
|
-
* @name getGlobalAlpha
|
|
31489
|
-
* @memberof WebGLRenderer
|
|
31490
31410
|
* @returns {number} global alpha value
|
|
31491
31411
|
*/
|
|
31492
31412
|
WebGLRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
|
|
@@ -31496,8 +31416,6 @@
|
|
|
31496
31416
|
/**
|
|
31497
31417
|
* Set the current fill & stroke style color.
|
|
31498
31418
|
* By default, or upon reset, the value is set to #000000.
|
|
31499
|
-
* @name setColor
|
|
31500
|
-
* @memberof WebGLRenderer
|
|
31501
31419
|
* @param {Color|string} color css color string.
|
|
31502
31420
|
*/
|
|
31503
31421
|
WebGLRenderer.prototype.setColor = function setColor (color) {
|
|
@@ -31508,8 +31426,6 @@
|
|
|
31508
31426
|
|
|
31509
31427
|
/**
|
|
31510
31428
|
* Set the line width
|
|
31511
|
-
* @name setLineWidth
|
|
31512
|
-
* @memberof WebGLRenderer
|
|
31513
31429
|
* @param {number} width Line width
|
|
31514
31430
|
*/
|
|
31515
31431
|
WebGLRenderer.prototype.setLineWidth = function setLineWidth (width) {
|
|
@@ -31518,8 +31434,6 @@
|
|
|
31518
31434
|
|
|
31519
31435
|
/**
|
|
31520
31436
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
31521
|
-
* @name strokeArc
|
|
31522
|
-
* @memberof WebGLRenderer
|
|
31523
31437
|
* @param {number} x arc center point x-axis
|
|
31524
31438
|
* @param {number} y arc center point y-axis
|
|
31525
31439
|
* @param {number} radius
|
|
@@ -31548,8 +31462,6 @@
|
|
|
31548
31462
|
|
|
31549
31463
|
/**
|
|
31550
31464
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
31551
|
-
* @name fillArc
|
|
31552
|
-
* @memberof WebGLRenderer
|
|
31553
31465
|
* @param {number} x arc center point x-axis
|
|
31554
31466
|
* @param {number} y arc center point y-axis
|
|
31555
31467
|
* @param {number} radius
|
|
@@ -31565,8 +31477,6 @@
|
|
|
31565
31477
|
|
|
31566
31478
|
/**
|
|
31567
31479
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
31568
|
-
* @name strokeEllipse
|
|
31569
|
-
* @memberof WebGLRenderer
|
|
31570
31480
|
* @param {number} x ellipse center point x-axis
|
|
31571
31481
|
* @param {number} y ellipse center point y-axis
|
|
31572
31482
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -31592,8 +31502,6 @@
|
|
|
31592
31502
|
|
|
31593
31503
|
/**
|
|
31594
31504
|
* Fill an ellipse at the specified coordinates with given radius
|
|
31595
|
-
* @name fillEllipse
|
|
31596
|
-
* @memberof WebGLRenderer
|
|
31597
31505
|
* @param {number} x ellipse center point x-axis
|
|
31598
31506
|
* @param {number} y ellipse center point y-axis
|
|
31599
31507
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -31605,8 +31513,6 @@
|
|
|
31605
31513
|
|
|
31606
31514
|
/**
|
|
31607
31515
|
* Stroke a line of the given two points
|
|
31608
|
-
* @name strokeLine
|
|
31609
|
-
* @memberof WebGLRenderer
|
|
31610
31516
|
* @param {number} startX the start x coordinate
|
|
31611
31517
|
* @param {number} startY the start y coordinate
|
|
31612
31518
|
* @param {number} endX the end x coordinate
|
|
@@ -31626,8 +31532,6 @@
|
|
|
31626
31532
|
|
|
31627
31533
|
/**
|
|
31628
31534
|
* Fill a line of the given two points
|
|
31629
|
-
* @name fillLine
|
|
31630
|
-
* @memberof WebGLRenderer
|
|
31631
31535
|
* @param {number} startX the start x coordinate
|
|
31632
31536
|
* @param {number} startY the start y coordinate
|
|
31633
31537
|
* @param {number} endX the end x coordinate
|
|
@@ -31639,8 +31543,6 @@
|
|
|
31639
31543
|
|
|
31640
31544
|
/**
|
|
31641
31545
|
* Stroke a me.Polygon on the screen with a specified color
|
|
31642
|
-
* @name strokePolygon
|
|
31643
|
-
* @memberof WebGLRenderer
|
|
31644
31546
|
* @param {Polygon} poly the shape to draw
|
|
31645
31547
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
31646
31548
|
*/
|
|
@@ -31672,8 +31574,6 @@
|
|
|
31672
31574
|
|
|
31673
31575
|
/**
|
|
31674
31576
|
* Fill a me.Polygon on the screen
|
|
31675
|
-
* @name fillPolygon
|
|
31676
|
-
* @memberof WebGLRenderer
|
|
31677
31577
|
* @param {Polygon} poly the shape to draw
|
|
31678
31578
|
*/
|
|
31679
31579
|
WebGLRenderer.prototype.fillPolygon = function fillPolygon (poly) {
|
|
@@ -31682,8 +31582,6 @@
|
|
|
31682
31582
|
|
|
31683
31583
|
/**
|
|
31684
31584
|
* Draw a stroke rectangle at the specified coordinates
|
|
31685
|
-
* @name strokeRect
|
|
31686
|
-
* @memberof WebGLRenderer
|
|
31687
31585
|
* @param {number} x
|
|
31688
31586
|
* @param {number} y
|
|
31689
31587
|
* @param {number} width
|
|
@@ -31708,8 +31606,6 @@
|
|
|
31708
31606
|
|
|
31709
31607
|
/**
|
|
31710
31608
|
* Draw a filled rectangle at the specified coordinates
|
|
31711
|
-
* @name fillRect
|
|
31712
|
-
* @memberof WebGLRenderer
|
|
31713
31609
|
* @param {number} x
|
|
31714
31610
|
* @param {number} y
|
|
31715
31611
|
* @param {number} width
|
|
@@ -31721,8 +31617,6 @@
|
|
|
31721
31617
|
|
|
31722
31618
|
/**
|
|
31723
31619
|
* Stroke a rounded rectangle at the specified coordinates
|
|
31724
|
-
* @name strokeRoundRect
|
|
31725
|
-
* @memberof WebGLRenderer
|
|
31726
31620
|
* @param {number} x
|
|
31727
31621
|
* @param {number} y
|
|
31728
31622
|
* @param {number} width
|
|
@@ -31749,8 +31643,6 @@
|
|
|
31749
31643
|
|
|
31750
31644
|
/**
|
|
31751
31645
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
31752
|
-
* @name fillRoundRect
|
|
31753
|
-
* @memberof WebGLRenderer
|
|
31754
31646
|
* @param {number} x
|
|
31755
31647
|
* @param {number} y
|
|
31756
31648
|
* @param {number} width
|
|
@@ -31761,11 +31653,29 @@
|
|
|
31761
31653
|
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
31762
31654
|
};
|
|
31763
31655
|
|
|
31656
|
+
/**
|
|
31657
|
+
* Stroke a Point at the specified coordinates
|
|
31658
|
+
* @param {number} x
|
|
31659
|
+
* @param {number} y
|
|
31660
|
+
*/
|
|
31661
|
+
WebGLRenderer.prototype.strokePoint = function strokePoint (x, y) {
|
|
31662
|
+
this.strokeLine(x, y, x + 1, y + 1);
|
|
31663
|
+
};
|
|
31664
|
+
|
|
31665
|
+
/**
|
|
31666
|
+
* Draw a a point at the specified coordinates
|
|
31667
|
+
* @param {number} x
|
|
31668
|
+
* @param {number} y
|
|
31669
|
+
* @param {number} width
|
|
31670
|
+
* @param {number} height
|
|
31671
|
+
*/
|
|
31672
|
+
WebGLRenderer.prototype.fillPoint = function fillPoint (x, y) {
|
|
31673
|
+
this.strokePoint(x, y);
|
|
31674
|
+
};
|
|
31675
|
+
|
|
31764
31676
|
/**
|
|
31765
31677
|
* Reset (overrides) the renderer transformation matrix to the
|
|
31766
31678
|
* identity one, and then apply the given transformation matrix.
|
|
31767
|
-
* @name setTransform
|
|
31768
|
-
* @memberof WebGLRenderer
|
|
31769
31679
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
31770
31680
|
*/
|
|
31771
31681
|
WebGLRenderer.prototype.setTransform = function setTransform (mat2d) {
|
|
@@ -31775,8 +31685,6 @@
|
|
|
31775
31685
|
|
|
31776
31686
|
/**
|
|
31777
31687
|
* Multiply given matrix into the renderer tranformation matrix
|
|
31778
|
-
* @name transform
|
|
31779
|
-
* @memberof WebGLRenderer
|
|
31780
31688
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
31781
31689
|
*/
|
|
31782
31690
|
WebGLRenderer.prototype.transform = function transform (mat2d) {
|
|
@@ -31792,8 +31700,6 @@
|
|
|
31792
31700
|
|
|
31793
31701
|
/**
|
|
31794
31702
|
* Translates the uniform matrix by the given coordinates
|
|
31795
|
-
* @name translate
|
|
31796
|
-
* @memberof WebGLRenderer
|
|
31797
31703
|
* @param {number} x
|
|
31798
31704
|
* @param {number} y
|
|
31799
31705
|
*/
|
|
@@ -31814,8 +31720,6 @@
|
|
|
31814
31720
|
* You can however save the current region using the save(),
|
|
31815
31721
|
* and restore it (with the restore() method) any time in the future.
|
|
31816
31722
|
* (<u>this is an experimental feature !</u>)
|
|
31817
|
-
* @name clipRect
|
|
31818
|
-
* @memberof WebGLRenderer
|
|
31819
31723
|
* @param {number} x
|
|
31820
31724
|
* @param {number} y
|
|
31821
31725
|
* @param {number} width
|
|
@@ -31861,8 +31765,6 @@
|
|
|
31861
31765
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
31862
31766
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
31863
31767
|
* Mask are not preserved through renderer context save and restore.
|
|
31864
|
-
* @name setMask
|
|
31865
|
-
* @memberof WebGLRenderer
|
|
31866
31768
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
31867
31769
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
31868
31770
|
*/
|
|
@@ -31878,8 +31780,6 @@
|
|
|
31878
31780
|
// Enable and setup GL state to write to stencil buffer
|
|
31879
31781
|
gl.enable(gl.STENCIL_TEST);
|
|
31880
31782
|
gl.clear(gl.STENCIL_BUFFER_BIT);
|
|
31881
|
-
|
|
31882
|
-
|
|
31883
31783
|
}
|
|
31884
31784
|
|
|
31885
31785
|
this.maskLevel++;
|
|
@@ -31908,9 +31808,7 @@
|
|
|
31908
31808
|
|
|
31909
31809
|
/**
|
|
31910
31810
|
* disable (remove) the rendering mask set through setMask.
|
|
31911
|
-
* @name clearMask
|
|
31912
31811
|
* @see WebGLRenderer#setMask
|
|
31913
|
-
* @memberof WebGLRenderer
|
|
31914
31812
|
*/
|
|
31915
31813
|
WebGLRenderer.prototype.clearMask = function clearMask () {
|
|
31916
31814
|
if (this.maskLevel > 0) {
|
|
@@ -31941,6 +31839,7 @@
|
|
|
31941
31839
|
scale : 1.0,
|
|
31942
31840
|
scaleMethod : "manual",
|
|
31943
31841
|
transparent : false,
|
|
31842
|
+
premultipliedAlpha: true,
|
|
31944
31843
|
blendMode : "normal",
|
|
31945
31844
|
antiAlias : false,
|
|
31946
31845
|
failIfMajorPerformanceCaveat : true,
|
|
@@ -33105,10 +33004,10 @@
|
|
|
33105
33004
|
* this can be overridden by the plugin
|
|
33106
33005
|
* @public
|
|
33107
33006
|
* @type {string}
|
|
33108
|
-
* @default "13.
|
|
33007
|
+
* @default "13.3.0"
|
|
33109
33008
|
* @name plugin.Base#version
|
|
33110
33009
|
*/
|
|
33111
|
-
this.version = "13.
|
|
33010
|
+
this.version = "13.3.0";
|
|
33112
33011
|
};
|
|
33113
33012
|
|
|
33114
33013
|
/**
|
|
@@ -34338,7 +34237,7 @@
|
|
|
34338
34237
|
this.width = this.height = 0;
|
|
34339
34238
|
|
|
34340
34239
|
for (var i = 0; i < strings.length; i++) {
|
|
34341
|
-
this.width = Math.max(this.lineWidth(strings[i].
|
|
34240
|
+
this.width = Math.max(this.lineWidth(strings[i].trimEnd(), context), this.width);
|
|
34342
34241
|
this.height += this.lineHeight();
|
|
34343
34242
|
}
|
|
34344
34243
|
this.width = Math.ceil(this.width);
|
|
@@ -34812,7 +34711,7 @@
|
|
|
34812
34711
|
setContextStyle(context, this, stroke);
|
|
34813
34712
|
|
|
34814
34713
|
for (var i = 0; i < text.length; i++) {
|
|
34815
|
-
var string = text[i].
|
|
34714
|
+
var string = text[i].trimEnd();
|
|
34816
34715
|
// draw the string
|
|
34817
34716
|
context[stroke ? "strokeText" : "fillText"](string, x, y);
|
|
34818
34717
|
// add leading space
|
|
@@ -34930,12 +34829,7 @@
|
|
|
34930
34829
|
|
|
34931
34830
|
// apply given fillstyle
|
|
34932
34831
|
if (typeof settings.fillStyle !== "undefined") {
|
|
34933
|
-
|
|
34934
|
-
this.fillStyle.setColor(settings.fillStyle);
|
|
34935
|
-
} else {
|
|
34936
|
-
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34937
|
-
this.fillStyle.parseCSS(settings.fillStyle);
|
|
34938
|
-
}
|
|
34832
|
+
this.fillStyle = settings.fillStyle;
|
|
34939
34833
|
}
|
|
34940
34834
|
|
|
34941
34835
|
// update anchorPoint if provided
|
|
@@ -35016,7 +34910,12 @@
|
|
|
35016
34910
|
return this.tint;
|
|
35017
34911
|
};
|
|
35018
34912
|
prototypeAccessors.fillStyle.set = function (value) {
|
|
35019
|
-
|
|
34913
|
+
if (value instanceof Color) {
|
|
34914
|
+
this.tint.copy(value);
|
|
34915
|
+
} else {
|
|
34916
|
+
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34917
|
+
this.tint.parseCSS(value);
|
|
34918
|
+
}
|
|
35020
34919
|
};
|
|
35021
34920
|
|
|
35022
34921
|
/**
|
|
@@ -35075,7 +34974,7 @@
|
|
|
35075
34974
|
|
|
35076
34975
|
for (var i = 0; i < this._text.length; i++) {
|
|
35077
34976
|
x = lX;
|
|
35078
|
-
var string = this._text[i].
|
|
34977
|
+
var string = this._text[i].trimEnd();
|
|
35079
34978
|
// adjust x pos based on alignment value
|
|
35080
34979
|
var stringWidth = this.metrics.lineWidth(string);
|
|
35081
34980
|
switch (this.textAlign) {
|
|
@@ -37802,7 +37701,7 @@
|
|
|
37802
37701
|
* @name version
|
|
37803
37702
|
* @type {string}
|
|
37804
37703
|
*/
|
|
37805
|
-
var version = "13.
|
|
37704
|
+
var version = "13.3.0";
|
|
37806
37705
|
|
|
37807
37706
|
|
|
37808
37707
|
/**
|
|
@@ -37861,6 +37760,7 @@
|
|
|
37861
37760
|
pool.register("me.RoundRect", RoundRect, true);
|
|
37862
37761
|
pool.register("me.Polygon", Polygon, true);
|
|
37863
37762
|
pool.register("me.Line", Line, true);
|
|
37763
|
+
pool.register("me.Point", Point, true);
|
|
37864
37764
|
pool.register("me.Ellipse", Ellipse, true);
|
|
37865
37765
|
pool.register("me.Bounds", Bounds, true);
|
|
37866
37766
|
|
|
@@ -37890,6 +37790,7 @@
|
|
|
37890
37790
|
pool.register("RoundRect", RoundRect, true);
|
|
37891
37791
|
pool.register("Polygon", Polygon, true);
|
|
37892
37792
|
pool.register("Line", Line, true);
|
|
37793
|
+
pool.register("Point", Point, true);
|
|
37893
37794
|
pool.register("Ellipse", Ellipse, true);
|
|
37894
37795
|
pool.register("Bounds", Bounds, true);
|
|
37895
37796
|
pool.register("CanvasTexture", CanvasTexture, true);
|
|
@@ -37943,6 +37844,7 @@
|
|
|
37943
37844
|
exports.Particle = Particle;
|
|
37944
37845
|
exports.ParticleEmitter = ParticleEmitter;
|
|
37945
37846
|
exports.ParticleEmitterSettings = ParticleEmitterSettings;
|
|
37847
|
+
exports.Point = Point;
|
|
37946
37848
|
exports.Pointer = Pointer;
|
|
37947
37849
|
exports.Polygon = Polygon;
|
|
37948
37850
|
exports.QuadTree = QuadTree;
|