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.module.d.ts
CHANGED
|
@@ -98,6 +98,14 @@ export class BitmapText extends Renderable {
|
|
|
98
98
|
* @private
|
|
99
99
|
*/
|
|
100
100
|
private fontData;
|
|
101
|
+
public set fillStyle(arg: Color);
|
|
102
|
+
/**
|
|
103
|
+
* defines the color used to tint the bitmap text
|
|
104
|
+
* @public
|
|
105
|
+
* @type {Color}
|
|
106
|
+
* @see Renderable#tint
|
|
107
|
+
*/
|
|
108
|
+
public get fillStyle(): Color;
|
|
101
109
|
metrics: TextMetrics;
|
|
102
110
|
/**
|
|
103
111
|
* change the font settings
|
|
@@ -112,14 +120,6 @@ export class BitmapText extends Renderable {
|
|
|
112
120
|
* @returns {BitmapText} this object for chaining
|
|
113
121
|
*/
|
|
114
122
|
setText(value?: number | string | string[]): BitmapText;
|
|
115
|
-
public set fillStyle(arg: Color);
|
|
116
|
-
/**
|
|
117
|
-
* defines the color used to tint the bitmap text
|
|
118
|
-
* @public
|
|
119
|
-
* @type {Color}
|
|
120
|
-
* @see Renderable#tint
|
|
121
|
-
*/
|
|
122
|
-
public get fillStyle(): Color;
|
|
123
123
|
/**
|
|
124
124
|
* change the font display size
|
|
125
125
|
* @param {number} scale ratio
|
|
@@ -189,10 +189,10 @@ export class BitmapTextData {
|
|
|
189
189
|
export class Body {
|
|
190
190
|
/**
|
|
191
191
|
* @param {Renderable} ancestor the parent object this body is attached to
|
|
192
|
-
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
192
|
+
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] a initial shape, list of shapes, or JSON object defining the body
|
|
193
193
|
* @param {Function} [onBodyUpdate] callback for when the body is updated (e.g. add/remove shapes)
|
|
194
194
|
*/
|
|
195
|
-
constructor(ancestor: Renderable, shapes?: Rect | Rect[] | Polygon | Polygon[] | Line | Line[] | Ellipse | Ellipse[] | Bounds | Bounds[] | object, onBodyUpdate?: Function);
|
|
195
|
+
constructor(ancestor: Renderable, shapes?: Rect | Rect[] | Polygon | Polygon[] | Line | Line[] | Ellipse | Ellipse[] | Point | Point[] | Bounds | Bounds[] | object, onBodyUpdate?: Function);
|
|
196
196
|
/**
|
|
197
197
|
* a reference to the parent object that contains this body,
|
|
198
198
|
* or undefined if it has not been added to one.
|
|
@@ -210,9 +210,9 @@ export class Body {
|
|
|
210
210
|
/**
|
|
211
211
|
* The collision shapes of the body
|
|
212
212
|
* @ignore
|
|
213
|
-
* @type {Polygon[]|Line[]|Ellipse[]}
|
|
213
|
+
* @type {Polygon[]|Line[]|Ellipse[]|Point|Point[]}
|
|
214
214
|
*/
|
|
215
|
-
shapes: Polygon[] | Line[] | Ellipse[];
|
|
215
|
+
shapes: Polygon[] | Line[] | Ellipse[] | Point | Point[];
|
|
216
216
|
/**
|
|
217
217
|
* The body collision mask, that defines what should collide with what.<br>
|
|
218
218
|
* (by default will collide with all entities)
|
|
@@ -348,7 +348,7 @@ export class Body {
|
|
|
348
348
|
/**
|
|
349
349
|
* add a collision shape to this body <br>
|
|
350
350
|
* (note: me.Rect objects will be converted to me.Polygon before being added)
|
|
351
|
-
* @param {Rect|Polygon|Line|Ellipse|Bounds|object} shape a shape or JSON object
|
|
351
|
+
* @param {Rect|Polygon|Line|Ellipse|Point|Point[]|Bounds|object} shape a shape or JSON object
|
|
352
352
|
* @returns {number} the shape array length
|
|
353
353
|
* @example
|
|
354
354
|
* // add a rectangle shape
|
|
@@ -356,7 +356,7 @@ export class Body {
|
|
|
356
356
|
* // add a shape from a JSON object
|
|
357
357
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
358
358
|
*/
|
|
359
|
-
addShape(shape: Rect | Polygon | Line | Ellipse | Bounds | object): number;
|
|
359
|
+
addShape(shape: Rect | Polygon | Line | Ellipse | Point | Point[] | Bounds | object): number;
|
|
360
360
|
/**
|
|
361
361
|
* set the body vertices to the given one
|
|
362
362
|
* @param {Vector2d[]} vertices an array of me.Vector2d points defining a convex hull
|
|
@@ -663,10 +663,10 @@ export class Bounds {
|
|
|
663
663
|
* add the given point to the bounds definition.
|
|
664
664
|
* @name addPoint
|
|
665
665
|
* @memberof Bounds
|
|
666
|
-
* @param {Vector2d}
|
|
667
|
-
* @param {Matrix2d} [m] an optional transform to apply to the given point
|
|
666
|
+
* @param {Vector2d|Point} point the point to be added to the bounds
|
|
667
|
+
* @param {Matrix2d} [m] an optional transform to apply to the given point (only if the given point is a vector)
|
|
668
668
|
*/
|
|
669
|
-
addPoint(
|
|
669
|
+
addPoint(point: Vector2d | Point, m?: Matrix2d): void;
|
|
670
670
|
/**
|
|
671
671
|
* add the given quad coordinates to this bound definition, multiplied by the given matrix
|
|
672
672
|
* @name addFrame
|
|
@@ -1285,6 +1285,24 @@ export class CanvasRenderer extends Renderer {
|
|
|
1285
1285
|
* @param {number} radius
|
|
1286
1286
|
*/
|
|
1287
1287
|
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
1288
|
+
/**
|
|
1289
|
+
* Stroke a Point at the specified coordinates
|
|
1290
|
+
* @name strokePoint
|
|
1291
|
+
* @memberof CanvasRenderer
|
|
1292
|
+
* @param {number} x
|
|
1293
|
+
* @param {number} y
|
|
1294
|
+
*/
|
|
1295
|
+
strokePoint(x: number, y: number): void;
|
|
1296
|
+
/**
|
|
1297
|
+
* Draw a a point at the specified coordinates
|
|
1298
|
+
* @name fillPoint
|
|
1299
|
+
* @memberof CanvasRenderer
|
|
1300
|
+
* @param {number} x
|
|
1301
|
+
* @param {number} y
|
|
1302
|
+
* @param {number} width
|
|
1303
|
+
* @param {number} height
|
|
1304
|
+
*/
|
|
1305
|
+
fillPoint(x: number, y: number): void;
|
|
1288
1306
|
/**
|
|
1289
1307
|
* return a reference to the font 2d Context
|
|
1290
1308
|
* @ignore
|
|
@@ -2420,70 +2438,46 @@ export class GLShader {
|
|
|
2420
2438
|
constructor(gl: WebGLRenderingContext, vertex: string, fragment: string, precision?: string);
|
|
2421
2439
|
/**
|
|
2422
2440
|
* the active gl rendering context
|
|
2423
|
-
* @public
|
|
2424
2441
|
* @type {WebGLRenderingContext}
|
|
2425
|
-
* @name gl
|
|
2426
|
-
* @memberof GLShader
|
|
2427
2442
|
*/
|
|
2428
|
-
|
|
2443
|
+
gl: WebGLRenderingContext;
|
|
2429
2444
|
/**
|
|
2430
2445
|
* the vertex shader source code
|
|
2431
|
-
* @public
|
|
2432
2446
|
* @type {string}
|
|
2433
|
-
* @name vertex
|
|
2434
|
-
* @memberof GLShader
|
|
2435
2447
|
*/
|
|
2436
|
-
|
|
2448
|
+
vertex: string;
|
|
2437
2449
|
/**
|
|
2438
2450
|
* the fragment shader source code
|
|
2439
|
-
* @public
|
|
2440
2451
|
* @type {string}
|
|
2441
|
-
* @name vertex
|
|
2442
|
-
* @memberof GLShader
|
|
2443
2452
|
*/
|
|
2444
|
-
|
|
2453
|
+
fragment: string;
|
|
2445
2454
|
/**
|
|
2446
2455
|
* the location attributes of the shader
|
|
2447
|
-
* @public
|
|
2448
2456
|
* @type {GLint[]}
|
|
2449
|
-
* @name attributes
|
|
2450
|
-
* @memberof GLShader
|
|
2451
2457
|
*/
|
|
2452
|
-
|
|
2458
|
+
attributes: GLint[];
|
|
2453
2459
|
/**
|
|
2454
2460
|
* a reference to the shader program (once compiled)
|
|
2455
|
-
* @public
|
|
2456
2461
|
* @type {WebGLProgram}
|
|
2457
|
-
* @name program
|
|
2458
|
-
* @memberof GLShader
|
|
2459
2462
|
*/
|
|
2460
|
-
|
|
2463
|
+
program: WebGLProgram;
|
|
2461
2464
|
/**
|
|
2462
2465
|
* the uniforms of the shader
|
|
2463
|
-
* @public
|
|
2464
2466
|
* @type {object}
|
|
2465
|
-
* @name uniforms
|
|
2466
|
-
* @memberof GLShader
|
|
2467
2467
|
*/
|
|
2468
|
-
|
|
2468
|
+
uniforms: object;
|
|
2469
2469
|
/**
|
|
2470
2470
|
* Installs this shader program as part of current rendering state
|
|
2471
|
-
* @name bind
|
|
2472
|
-
* @memberof GLShader
|
|
2473
2471
|
*/
|
|
2474
2472
|
bind(): void;
|
|
2475
2473
|
/**
|
|
2476
2474
|
* returns the location of an attribute variable in this shader program
|
|
2477
|
-
* @name getAttribLocation
|
|
2478
|
-
* @memberof GLShader
|
|
2479
2475
|
* @param {string} name the name of the attribute variable whose location to get.
|
|
2480
2476
|
* @returns {GLint} number indicating the location of the variable name if found. Returns -1 otherwise
|
|
2481
2477
|
*/
|
|
2482
2478
|
getAttribLocation(name: string): GLint;
|
|
2483
2479
|
/**
|
|
2484
2480
|
* Set the uniform to the given value
|
|
2485
|
-
* @name setUniform
|
|
2486
|
-
* @memberof GLShader
|
|
2487
2481
|
* @param {string} name the uniform name
|
|
2488
2482
|
* @param {object|Float32Array} value the value to assign to that uniform
|
|
2489
2483
|
* @example
|
|
@@ -2492,8 +2486,6 @@ export class GLShader {
|
|
|
2492
2486
|
setUniform(name: string, value: object | Float32Array): void;
|
|
2493
2487
|
/**
|
|
2494
2488
|
* activate the given vertex attribute for this shader
|
|
2495
|
-
* @name setVertexAttributes
|
|
2496
|
-
* @memberof GLShader
|
|
2497
2489
|
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
2498
2490
|
* @param {object[]} attributes an array of vertex attributes
|
|
2499
2491
|
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
@@ -2501,8 +2493,6 @@ export class GLShader {
|
|
|
2501
2493
|
setVertexAttributes(gl: WebGLRenderingContext, attributes: object[], vertexByteSize: number): void;
|
|
2502
2494
|
/**
|
|
2503
2495
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
2504
|
-
* @name destroy
|
|
2505
|
-
* @memberof GLShader
|
|
2506
2496
|
*/
|
|
2507
2497
|
destroy(): void;
|
|
2508
2498
|
}
|
|
@@ -4881,6 +4871,59 @@ export namespace ParticleEmitterSettings {
|
|
|
4881
4871
|
const duration: number;
|
|
4882
4872
|
const framesToSkip: number;
|
|
4883
4873
|
}
|
|
4874
|
+
/**
|
|
4875
|
+
* @classdesc
|
|
4876
|
+
* represents a point in a 2d space
|
|
4877
|
+
*/
|
|
4878
|
+
export class Point {
|
|
4879
|
+
constructor(x?: number, y?: number);
|
|
4880
|
+
/**
|
|
4881
|
+
* the position of the point on the horizontal axis
|
|
4882
|
+
* @public
|
|
4883
|
+
* @type {Number}
|
|
4884
|
+
* @default 0
|
|
4885
|
+
*/
|
|
4886
|
+
public x: number;
|
|
4887
|
+
/**
|
|
4888
|
+
* the position of the point on the vertical axis
|
|
4889
|
+
* @public
|
|
4890
|
+
* @type {Number}
|
|
4891
|
+
* @default 0
|
|
4892
|
+
*/
|
|
4893
|
+
public y: number;
|
|
4894
|
+
/** @ignore */
|
|
4895
|
+
onResetEvent(x?: number, y?: number): void;
|
|
4896
|
+
/**
|
|
4897
|
+
* set the Point x and y properties to the given values
|
|
4898
|
+
* @param {number} x
|
|
4899
|
+
* @param {number} y
|
|
4900
|
+
* @returns {Point} Reference to this object for method chaining
|
|
4901
|
+
*/
|
|
4902
|
+
set(x?: number, y?: number): Point;
|
|
4903
|
+
/**
|
|
4904
|
+
* return true if the two points are the same
|
|
4905
|
+
* @name equals
|
|
4906
|
+
* @memberof Point
|
|
4907
|
+
* @method
|
|
4908
|
+
* @param {Point} point
|
|
4909
|
+
* @returns {boolean}
|
|
4910
|
+
*/
|
|
4911
|
+
/**
|
|
4912
|
+
* return true if this point is equal to the given values
|
|
4913
|
+
* @name equals
|
|
4914
|
+
* @memberof Point
|
|
4915
|
+
* @param {number} x
|
|
4916
|
+
* @param {number} y
|
|
4917
|
+
* @returns {boolean}
|
|
4918
|
+
*/
|
|
4919
|
+
equals(...args: any[]): boolean;
|
|
4920
|
+
/**
|
|
4921
|
+
* clone this Point
|
|
4922
|
+
* @name clone
|
|
4923
|
+
* @returns {Point} new Point
|
|
4924
|
+
*/
|
|
4925
|
+
clone(): Point;
|
|
4926
|
+
}
|
|
4884
4927
|
/**
|
|
4885
4928
|
* @classdesc
|
|
4886
4929
|
* a pointer object, representing a single finger on a touch enabled device.
|
|
@@ -5637,20 +5680,13 @@ export class Renderable extends Rect {
|
|
|
5637
5680
|
isRenderable: boolean;
|
|
5638
5681
|
/**
|
|
5639
5682
|
* If true then physic collision and input events will not impact this renderable
|
|
5640
|
-
* @public
|
|
5641
5683
|
* @type {boolean}
|
|
5642
5684
|
* @default true
|
|
5643
|
-
* @name isKinematic
|
|
5644
|
-
* @memberof Renderable
|
|
5645
5685
|
*/
|
|
5646
|
-
|
|
5686
|
+
isKinematic: boolean;
|
|
5647
5687
|
/**
|
|
5648
5688
|
* the renderable physic body
|
|
5649
|
-
* @public
|
|
5650
5689
|
* @type {Body}
|
|
5651
|
-
* @see Body
|
|
5652
|
-
* @name body
|
|
5653
|
-
* @memberof Renderable#
|
|
5654
5690
|
* @example
|
|
5655
5691
|
* // define a new Player Class
|
|
5656
5692
|
* class PlayerEntity extends me.Sprite {
|
|
@@ -5683,32 +5719,23 @@ export class Renderable extends Rect {
|
|
|
5683
5719
|
*
|
|
5684
5720
|
* }
|
|
5685
5721
|
*/
|
|
5686
|
-
|
|
5722
|
+
body: Body;
|
|
5687
5723
|
/**
|
|
5688
5724
|
* the renderable default transformation matrix
|
|
5689
|
-
* @public
|
|
5690
5725
|
* @type {Matrix2d}
|
|
5691
|
-
* @name currentTransform
|
|
5692
|
-
* @memberof Renderable#
|
|
5693
5726
|
*/
|
|
5694
|
-
|
|
5727
|
+
currentTransform: Matrix2d;
|
|
5695
5728
|
/**
|
|
5696
5729
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
5697
5730
|
* a GUID will be allocated for any renderable object added <br>
|
|
5698
5731
|
* to an object container (including the `me.game.world` container)
|
|
5699
|
-
* @public
|
|
5700
5732
|
* @type {string}
|
|
5701
|
-
* @name GUID
|
|
5702
|
-
* @memberof Renderable
|
|
5703
5733
|
*/
|
|
5704
|
-
|
|
5734
|
+
GUID: string;
|
|
5705
5735
|
/**
|
|
5706
5736
|
* an event handler that is called when the renderable leave or enter a camera viewport
|
|
5707
|
-
* @public
|
|
5708
5737
|
* @type {Function}
|
|
5709
5738
|
* @default undefined
|
|
5710
|
-
* @name onVisibilityChange
|
|
5711
|
-
* @memberof Renderable#
|
|
5712
5739
|
* @example
|
|
5713
5740
|
* this.onVisibilityChange = function(inViewport) {
|
|
5714
5741
|
* if (inViewport === true) {
|
|
@@ -5716,44 +5743,32 @@ export class Renderable extends Rect {
|
|
|
5716
5743
|
* }
|
|
5717
5744
|
* };
|
|
5718
5745
|
*/
|
|
5719
|
-
|
|
5746
|
+
onVisibilityChange: Function;
|
|
5720
5747
|
/**
|
|
5721
5748
|
* Whether the renderable object will always update, even when outside of the viewport<br>
|
|
5722
|
-
* @public
|
|
5723
5749
|
* @type {boolean}
|
|
5724
5750
|
* @default false
|
|
5725
|
-
* @name alwaysUpdate
|
|
5726
|
-
* @memberof Renderable
|
|
5727
5751
|
*/
|
|
5728
|
-
|
|
5752
|
+
alwaysUpdate: boolean;
|
|
5729
5753
|
/**
|
|
5730
5754
|
* Whether to update this object when the game is paused.
|
|
5731
|
-
* @public
|
|
5732
5755
|
* @type {boolean}
|
|
5733
5756
|
* @default false
|
|
5734
|
-
* @name updateWhenPaused
|
|
5735
|
-
* @memberof Renderable
|
|
5736
5757
|
*/
|
|
5737
|
-
|
|
5758
|
+
updateWhenPaused: boolean;
|
|
5738
5759
|
/**
|
|
5739
5760
|
* make the renderable object persistent over level changes<br>
|
|
5740
|
-
* @public
|
|
5741
5761
|
* @type {boolean}
|
|
5742
5762
|
* @default false
|
|
5743
|
-
* @name isPersistent
|
|
5744
|
-
* @memberof Renderable
|
|
5745
5763
|
*/
|
|
5746
|
-
|
|
5764
|
+
isPersistent: boolean;
|
|
5747
5765
|
/**
|
|
5748
5766
|
* If true, this renderable will be rendered using screen coordinates,
|
|
5749
5767
|
* as opposed to world coordinates. Use this, for example, to define UI elements.
|
|
5750
|
-
* @public
|
|
5751
5768
|
* @type {boolean}
|
|
5752
5769
|
* @default false
|
|
5753
|
-
* @name floating
|
|
5754
|
-
* @memberof Renderable
|
|
5755
5770
|
*/
|
|
5756
|
-
|
|
5771
|
+
floating: boolean;
|
|
5757
5772
|
/**
|
|
5758
5773
|
* The anchor point is used for attachment behavior, and/or when applying transformations.<br>
|
|
5759
5774
|
* The coordinate system places the origin at the top left corner of the frame (0, 0) and (1, 1) means the bottom-right corner<br>
|
|
@@ -5762,21 +5777,15 @@ export class Renderable extends Rect {
|
|
|
5762
5777
|
* <br>
|
|
5763
5778
|
* <i><b>Note:</b> Object created through Tiled will have their anchorPoint set to (0, 0) to match Tiled Level editor implementation.
|
|
5764
5779
|
* To specify a value through Tiled, use a json expression like `json:{"x":0.5,"y":0.5}`. </i>
|
|
5765
|
-
* @public
|
|
5766
5780
|
* @type {ObservableVector2d}
|
|
5767
5781
|
* @default <0.5,0.5>
|
|
5768
|
-
* @name anchorPoint
|
|
5769
|
-
* @memberof Renderable#
|
|
5770
5782
|
*/
|
|
5771
|
-
|
|
5783
|
+
anchorPoint: ObservableVector2d;
|
|
5772
5784
|
/**
|
|
5773
5785
|
* When enabled, an object container will automatically apply
|
|
5774
5786
|
* any defined transformation before calling the child draw method.
|
|
5775
|
-
* @public
|
|
5776
5787
|
* @type {boolean}
|
|
5777
5788
|
* @default true
|
|
5778
|
-
* @name autoTransform
|
|
5779
|
-
* @memberof Renderable
|
|
5780
5789
|
* @example
|
|
5781
5790
|
* // enable "automatic" transformation when the object is activated
|
|
5782
5791
|
* onActivateEvent: function () {
|
|
@@ -5789,34 +5798,27 @@ export class Renderable extends Rect {
|
|
|
5789
5798
|
* ....
|
|
5790
5799
|
* }
|
|
5791
5800
|
*/
|
|
5792
|
-
|
|
5801
|
+
autoTransform: boolean;
|
|
5793
5802
|
/**
|
|
5794
5803
|
* Define the renderable opacity<br>
|
|
5795
5804
|
* Set to zero if you do not wish an object to be drawn
|
|
5796
5805
|
* @see Renderable#setOpacity
|
|
5797
5806
|
* @see Renderable#getOpacity
|
|
5798
|
-
* @public
|
|
5799
5807
|
* @type {number}
|
|
5800
5808
|
* @default 1.0
|
|
5801
|
-
* @name Renderable#alpha
|
|
5802
5809
|
*/
|
|
5803
|
-
|
|
5810
|
+
alpha: number;
|
|
5804
5811
|
/**
|
|
5805
5812
|
* a reference to the parent object that contains this renderable
|
|
5806
|
-
* @public
|
|
5807
5813
|
* @type {Container|Entity}
|
|
5808
5814
|
* @default undefined
|
|
5809
|
-
* @name Renderable#ancestor
|
|
5810
5815
|
*/
|
|
5811
|
-
|
|
5816
|
+
ancestor: Container | Entity;
|
|
5812
5817
|
/**
|
|
5813
5818
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
5814
5819
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
5815
|
-
* @public
|
|
5816
5820
|
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
5817
|
-
* @name mask
|
|
5818
5821
|
* @default undefined
|
|
5819
|
-
* @memberof Renderable#
|
|
5820
5822
|
* @example
|
|
5821
5823
|
* // apply a mask in the shape of a Star
|
|
5822
5824
|
* myNPCSprite.mask = new me.Polygon(myNPCSprite.width / 2, 0, [
|
|
@@ -5833,55 +5835,31 @@ export class Renderable extends Rect {
|
|
|
5833
5835
|
* {x: -14, y: 30}
|
|
5834
5836
|
* ]);
|
|
5835
5837
|
*/
|
|
5836
|
-
|
|
5837
|
-
/**
|
|
5838
|
-
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
5839
|
-
* @public
|
|
5840
|
-
* @type {Color}
|
|
5841
|
-
* @name tint
|
|
5842
|
-
* @default (255, 255, 255)
|
|
5843
|
-
* @memberof Renderable#
|
|
5844
|
-
* @example
|
|
5845
|
-
* // add a red tint to this renderable
|
|
5846
|
-
* this.tint.setColor(255, 128, 128);
|
|
5847
|
-
* // remove the tint
|
|
5848
|
-
* this.tint.setColor(255, 255, 255);
|
|
5849
|
-
*/
|
|
5850
|
-
public tint: Color;
|
|
5838
|
+
mask: Rect | RoundRect | Polygon | Line | Ellipse;
|
|
5851
5839
|
/**
|
|
5852
5840
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
5853
|
-
* @public
|
|
5854
5841
|
* @type {string}
|
|
5855
|
-
* @name blendMode
|
|
5856
5842
|
* @default "normal"
|
|
5857
5843
|
* @see CanvasRenderer#setBlendMode
|
|
5858
5844
|
* @see WebGLRenderer#setBlendMode
|
|
5859
|
-
* @memberof Renderable#
|
|
5860
5845
|
*/
|
|
5861
|
-
|
|
5846
|
+
blendMode: string;
|
|
5862
5847
|
/**
|
|
5863
5848
|
* The name of the renderable
|
|
5864
|
-
* @public
|
|
5865
5849
|
* @type {string}
|
|
5866
|
-
* @name name
|
|
5867
5850
|
* @default ""
|
|
5868
|
-
* @memberof Renderable
|
|
5869
5851
|
*/
|
|
5870
|
-
|
|
5852
|
+
name: string;
|
|
5871
5853
|
/**
|
|
5872
5854
|
* Position of the Renderable relative to its parent container
|
|
5873
5855
|
* @public
|
|
5874
5856
|
* @type {ObservableVector3d}
|
|
5875
|
-
* @name pos
|
|
5876
|
-
* @memberof Renderable#
|
|
5877
5857
|
*/
|
|
5878
5858
|
public pos: ObservableVector3d;
|
|
5879
5859
|
/**
|
|
5880
5860
|
* when true the renderable will be redrawn during the next update cycle
|
|
5881
5861
|
* @type {boolean}
|
|
5882
|
-
* @name isDirty
|
|
5883
5862
|
* @default false
|
|
5884
|
-
* @memberof Renderable#
|
|
5885
5863
|
*/
|
|
5886
5864
|
isDirty: boolean;
|
|
5887
5865
|
_flip: {
|
|
@@ -5891,30 +5869,35 @@ export class Renderable extends Rect {
|
|
|
5891
5869
|
_inViewport: boolean;
|
|
5892
5870
|
/**
|
|
5893
5871
|
* Whether the renderable object is floating, or contained in a floating container
|
|
5894
|
-
* @public
|
|
5895
5872
|
* @see Renderable#floating
|
|
5896
5873
|
* @type {boolean}
|
|
5897
|
-
* @name isFloating
|
|
5898
|
-
* @memberof Renderable
|
|
5899
5874
|
*/
|
|
5900
|
-
|
|
5901
|
-
|
|
5875
|
+
get isFloating(): boolean;
|
|
5876
|
+
set tint(arg: Color);
|
|
5877
|
+
/**
|
|
5878
|
+
* define a tint for this renderable. a (255, 255, 255) r, g, b value will remove the tint effect.
|
|
5879
|
+
* @type {Color}
|
|
5880
|
+
* @default (255, 255, 255)
|
|
5881
|
+
* @example
|
|
5882
|
+
* // add a red tint to this renderable
|
|
5883
|
+
* this.tint.setColor(255, 128, 128);
|
|
5884
|
+
* // remove the tint
|
|
5885
|
+
* this.tint.setColor(255, 255, 255);
|
|
5886
|
+
*/
|
|
5887
|
+
get tint(): Color;
|
|
5888
|
+
_tint: any;
|
|
5889
|
+
set inViewport(arg: boolean);
|
|
5902
5890
|
/**
|
|
5903
5891
|
* Whether the renderable object is visible and within the viewport
|
|
5904
|
-
* @public
|
|
5905
5892
|
* @type {boolean}
|
|
5906
5893
|
* @default false
|
|
5907
|
-
* @name inViewport
|
|
5908
|
-
* @memberof Renderable
|
|
5909
5894
|
*/
|
|
5910
|
-
|
|
5895
|
+
get inViewport(): boolean;
|
|
5911
5896
|
/**
|
|
5912
5897
|
* returns true if this renderable is flipped on the horizontal axis
|
|
5913
5898
|
* @public
|
|
5914
5899
|
* @see Renderable#flipX
|
|
5915
5900
|
* @type {boolean}
|
|
5916
|
-
* @name isFlippedX
|
|
5917
|
-
* @memberof Renderable
|
|
5918
5901
|
*/
|
|
5919
5902
|
public get isFlippedX(): boolean;
|
|
5920
5903
|
/**
|
|
@@ -5922,29 +5905,21 @@ export class Renderable extends Rect {
|
|
|
5922
5905
|
* @public
|
|
5923
5906
|
* @see Renderable#flipY
|
|
5924
5907
|
* @type {boolean}
|
|
5925
|
-
* @name isFlippedY
|
|
5926
|
-
* @memberof Renderable
|
|
5927
5908
|
*/
|
|
5928
5909
|
public get isFlippedY(): boolean;
|
|
5929
5910
|
/**
|
|
5930
5911
|
* get the renderable alpha channel value<br>
|
|
5931
|
-
* @name getOpacity
|
|
5932
|
-
* @memberof Renderable
|
|
5933
5912
|
* @returns {number} current opacity value between 0 and 1
|
|
5934
5913
|
*/
|
|
5935
5914
|
getOpacity(): number;
|
|
5936
5915
|
/**
|
|
5937
5916
|
* set the renderable alpha channel value<br>
|
|
5938
|
-
* @name setOpacity
|
|
5939
|
-
* @memberof Renderable
|
|
5940
5917
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
5941
5918
|
*/
|
|
5942
5919
|
setOpacity(alpha: number): void;
|
|
5943
5920
|
/**
|
|
5944
5921
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
5945
5922
|
* @see Matrix2d#scaleX
|
|
5946
|
-
* @name flipX
|
|
5947
|
-
* @memberof Renderable
|
|
5948
5923
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
5949
5924
|
* @returns {Renderable} Reference to this object for method chaining
|
|
5950
5925
|
*/
|
|
@@ -5952,16 +5927,12 @@ export class Renderable extends Rect {
|
|
|
5952
5927
|
/**
|
|
5953
5928
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
5954
5929
|
* @see Matrix2d#scaleY
|
|
5955
|
-
* @name flipY
|
|
5956
|
-
* @memberof Renderable
|
|
5957
5930
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
5958
5931
|
* @returns {Renderable} Reference to this object for method chaining
|
|
5959
5932
|
*/
|
|
5960
5933
|
flipY(flip?: boolean): Renderable;
|
|
5961
5934
|
/**
|
|
5962
5935
|
* multiply the renderable currentTransform with the given matrix
|
|
5963
|
-
* @name transform
|
|
5964
|
-
* @memberof Renderable
|
|
5965
5936
|
* @see Renderable#currentTransform
|
|
5966
5937
|
* @param {Matrix2d} m the transformation matrix
|
|
5967
5938
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -5969,32 +5940,24 @@ export class Renderable extends Rect {
|
|
|
5969
5940
|
transform(m: Matrix2d): Renderable;
|
|
5970
5941
|
/**
|
|
5971
5942
|
* return the angle to the specified target
|
|
5972
|
-
* @name angleTo
|
|
5973
|
-
* @memberof Renderable
|
|
5974
5943
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
5975
5944
|
* @returns {number} angle in radians
|
|
5976
5945
|
*/
|
|
5977
5946
|
angleTo(target: Renderable | Vector2d | Vector3d): number;
|
|
5978
5947
|
/**
|
|
5979
5948
|
* return the distance to the specified target
|
|
5980
|
-
* @name distanceTo
|
|
5981
|
-
* @memberof Renderable
|
|
5982
5949
|
* @param {Renderable|Vector2d|Vector3d} target
|
|
5983
5950
|
* @returns {number} distance
|
|
5984
5951
|
*/
|
|
5985
5952
|
distanceTo(target: Renderable | Vector2d | Vector3d): number;
|
|
5986
5953
|
/**
|
|
5987
5954
|
* Rotate this renderable towards the given target.
|
|
5988
|
-
* @name lookAt
|
|
5989
|
-
* @memberof Renderable
|
|
5990
5955
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
5991
5956
|
* @returns {Renderable} Reference to this object for method chaining
|
|
5992
5957
|
*/
|
|
5993
5958
|
lookAt(target: Renderable | Vector2d | Vector3d): Renderable;
|
|
5994
5959
|
/**
|
|
5995
5960
|
* Rotate this renderable by the specified angle (in radians).
|
|
5996
|
-
* @name rotate
|
|
5997
|
-
* @memberof Renderable
|
|
5998
5961
|
* @param {number} angle The angle to rotate (in radians)
|
|
5999
5962
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
6000
5963
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -6006,8 +5969,6 @@ export class Renderable extends Rect {
|
|
|
6006
5969
|
* when rendering. It does not scale the object itself. For example if the renderable
|
|
6007
5970
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
6008
5971
|
* member will be changed.
|
|
6009
|
-
* @name scale
|
|
6010
|
-
* @memberof Renderable
|
|
6011
5972
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
6012
5973
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
6013
5974
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -6015,33 +5976,23 @@ export class Renderable extends Rect {
|
|
|
6015
5976
|
scale(x: number, y?: number): Renderable;
|
|
6016
5977
|
/**
|
|
6017
5978
|
* scale the renderable around his anchor point
|
|
6018
|
-
* @name scaleV
|
|
6019
|
-
* @memberof Renderable
|
|
6020
5979
|
* @param {Vector2d} v scaling vector
|
|
6021
5980
|
* @returns {Renderable} Reference to this object for method chaining
|
|
6022
5981
|
*/
|
|
6023
5982
|
scaleV(v: Vector2d): Renderable;
|
|
6024
5983
|
/**
|
|
6025
|
-
* update function.
|
|
6026
|
-
* automatically called by the game manager {@link game}
|
|
6027
|
-
* @name update
|
|
6028
|
-
* @memberof Renderable
|
|
6029
|
-
* @protected
|
|
5984
|
+
* update function (automatically called by melonJS).
|
|
6030
5985
|
* @param {number} dt time since the last update in milliseconds.
|
|
6031
5986
|
* @returns {boolean} true if the renderable is dirty
|
|
6032
5987
|
*/
|
|
6033
|
-
|
|
5988
|
+
update(dt: number): boolean;
|
|
6034
5989
|
/**
|
|
6035
5990
|
* update the renderable's bounding rect (private)
|
|
6036
5991
|
* @ignore
|
|
6037
|
-
* @name updateBoundsPos
|
|
6038
|
-
* @memberof Renderable
|
|
6039
5992
|
*/
|
|
6040
5993
|
updateBoundsPos(newX: any, newY: any): void;
|
|
6041
5994
|
/**
|
|
6042
5995
|
* return the renderable absolute position in the game world
|
|
6043
|
-
* @name getAbsolutePosition
|
|
6044
|
-
* @memberof Renderable
|
|
6045
5996
|
* @returns {Vector2d}
|
|
6046
5997
|
*/
|
|
6047
5998
|
getAbsolutePosition(): Vector2d;
|
|
@@ -6049,45 +6000,42 @@ export class Renderable extends Rect {
|
|
|
6049
6000
|
/**
|
|
6050
6001
|
* called when the anchor point value is changed
|
|
6051
6002
|
* @private
|
|
6052
|
-
* @name onAnchorUpdate
|
|
6053
|
-
* @memberof Renderable
|
|
6054
6003
|
* @param {number} x the new X value to be set for the anchor
|
|
6055
6004
|
* @param {number} y the new Y value to be set for the anchor
|
|
6056
6005
|
*/
|
|
6057
6006
|
private onAnchorUpdate;
|
|
6058
6007
|
/**
|
|
6059
|
-
*
|
|
6060
|
-
*
|
|
6061
|
-
*
|
|
6062
|
-
* @
|
|
6063
|
-
* @memberof Renderable
|
|
6064
|
-
* @protected
|
|
6008
|
+
* Prepare the rendering context before drawing (automatically called by melonJS).
|
|
6009
|
+
* This will apply any defined transforms, anchor point, tint or blend mode and translate the context accordingly to this renderable position.
|
|
6010
|
+
* @see Renderable#draw
|
|
6011
|
+
* @see Renderable#postDraw
|
|
6065
6012
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
6066
6013
|
*/
|
|
6067
|
-
|
|
6068
|
-
/**
|
|
6069
|
-
*
|
|
6070
|
-
*
|
|
6071
|
-
*
|
|
6072
|
-
*
|
|
6014
|
+
preDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6015
|
+
/**
|
|
6016
|
+
* Draw this renderable (automatically called by melonJS).
|
|
6017
|
+
* All draw operations for renderable are made respectively
|
|
6018
|
+
* to the position or transforms set or applied by the preDraw method.
|
|
6019
|
+
* The main draw loop will first call preDraw() to prepare the context for drawing the renderable,
|
|
6020
|
+
* then draw() to draw the renderable, and finally postDraw() to clear the context.
|
|
6021
|
+
* If you override this method, be mindful about the drawing logic; for example if you draw a shape
|
|
6022
|
+
* from the draw method, you should make sure that your draw it at the 0, 0 coordinates.
|
|
6023
|
+
* @see Renderable#preDraw
|
|
6024
|
+
* @see Renderable#postDraw
|
|
6073
6025
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
6074
6026
|
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
6075
6027
|
*/
|
|
6076
|
-
|
|
6028
|
+
draw(renderer: CanvasRenderer | WebGLRenderer, viewport?: Camera2d): void;
|
|
6077
6029
|
/**
|
|
6078
|
-
* restore the rendering context after drawing.
|
|
6079
|
-
*
|
|
6080
|
-
* @
|
|
6081
|
-
* @memberof Renderable
|
|
6082
|
-
* @protected
|
|
6030
|
+
* restore the rendering context after drawing (automatically called by melonJS).
|
|
6031
|
+
* @see Renderable#preDraw
|
|
6032
|
+
* @see Renderable#draw
|
|
6083
6033
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
6084
6034
|
*/
|
|
6085
|
-
|
|
6035
|
+
postDraw(renderer: CanvasRenderer | WebGLRenderer): void;
|
|
6086
6036
|
/**
|
|
6087
6037
|
* onCollision callback, triggered in case of collision,
|
|
6088
6038
|
* when this renderable body is colliding with another one
|
|
6089
|
-
* @name onCollision
|
|
6090
|
-
* @memberof Renderable
|
|
6091
6039
|
* @param {ResponseObject} response the collision response object
|
|
6092
6040
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
6093
6041
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
@@ -6114,8 +6062,6 @@ export class Renderable extends Rect {
|
|
|
6114
6062
|
/**
|
|
6115
6063
|
* OnDestroy Notification function<br>
|
|
6116
6064
|
* Called by engine before deleting the object
|
|
6117
|
-
* @name onDestroyEvent
|
|
6118
|
-
* @memberof Renderable
|
|
6119
6065
|
*/
|
|
6120
6066
|
onDestroyEvent(): void;
|
|
6121
6067
|
}
|
|
@@ -6131,7 +6077,8 @@ export class Renderer {
|
|
|
6131
6077
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
6132
6078
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
6133
6079
|
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
6134
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
6080
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
6081
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
6135
6082
|
* @param {boolean} [options.blendMode="normal"] the default blend mode to use ("normal", "multiply")
|
|
6136
6083
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel rendering (performance hit when enabled)
|
|
6137
6084
|
* @param {boolean} [options.verbose=false] Enable the verbose mode that provides additional details as to what the renderer is doing
|
|
@@ -6145,6 +6092,7 @@ export class Renderer {
|
|
|
6145
6092
|
antiAlias?: boolean;
|
|
6146
6093
|
failIfMajorPerformanceCaveat?: boolean;
|
|
6147
6094
|
transparent?: boolean;
|
|
6095
|
+
premultipliedAlpha?: boolean;
|
|
6148
6096
|
blendMode?: boolean;
|
|
6149
6097
|
subPixel?: boolean;
|
|
6150
6098
|
verbose?: boolean;
|
|
@@ -6154,24 +6102,18 @@ export class Renderer {
|
|
|
6154
6102
|
/**
|
|
6155
6103
|
* The given constructor options
|
|
6156
6104
|
* @public
|
|
6157
|
-
* @name settings
|
|
6158
|
-
* @memberof Renderer#
|
|
6159
6105
|
* @type {object}
|
|
6160
6106
|
*/
|
|
6161
6107
|
public settings: object;
|
|
6162
6108
|
/**
|
|
6163
6109
|
* true if the current rendering context is valid
|
|
6164
|
-
* @name isContextValid
|
|
6165
|
-
* @memberof Renderer#
|
|
6166
6110
|
* @default true
|
|
6167
|
-
* type {boolean}
|
|
6111
|
+
* @type {boolean}
|
|
6168
6112
|
*/
|
|
6169
6113
|
isContextValid: boolean;
|
|
6170
6114
|
/**
|
|
6171
6115
|
* The Path2D instance used by the renderer to draw primitives
|
|
6172
|
-
* @name path2D
|
|
6173
6116
|
* @type {Path2D}
|
|
6174
|
-
* @memberof Renderer#
|
|
6175
6117
|
*/
|
|
6176
6118
|
path2D: Path2D;
|
|
6177
6119
|
/**
|
|
@@ -6193,48 +6135,34 @@ export class Renderer {
|
|
|
6193
6135
|
uvOffset: number;
|
|
6194
6136
|
/**
|
|
6195
6137
|
* prepare the framebuffer for drawing a new frame
|
|
6196
|
-
* @name clear
|
|
6197
|
-
* @memberof Renderer
|
|
6198
6138
|
*/
|
|
6199
6139
|
clear(): void;
|
|
6200
6140
|
/**
|
|
6201
6141
|
* render the main framebuffer on screen
|
|
6202
|
-
* @name flush
|
|
6203
|
-
* @memberof Renderer
|
|
6204
6142
|
*/
|
|
6205
6143
|
flush(): void;
|
|
6206
6144
|
/**
|
|
6207
6145
|
* Reset context state
|
|
6208
|
-
* @name reset
|
|
6209
|
-
* @memberof Renderer
|
|
6210
6146
|
*/
|
|
6211
6147
|
reset(): void;
|
|
6212
6148
|
/**
|
|
6213
6149
|
* return a reference to the canvas which this renderer draws to
|
|
6214
|
-
* @name getCanvas
|
|
6215
|
-
* @memberof Renderer
|
|
6216
6150
|
* @returns {HTMLCanvasElement}
|
|
6217
6151
|
*/
|
|
6218
6152
|
getCanvas(): HTMLCanvasElement;
|
|
6219
6153
|
/**
|
|
6220
6154
|
* return a reference to this renderer canvas corresponding Context
|
|
6221
|
-
* @name getContext
|
|
6222
|
-
* @memberof Renderer
|
|
6223
6155
|
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
6224
6156
|
*/
|
|
6225
6157
|
getContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
6226
6158
|
/**
|
|
6227
6159
|
* returns the current blend mode for this renderer
|
|
6228
|
-
* @name getBlendMode
|
|
6229
|
-
* @memberof Renderer
|
|
6230
6160
|
* @returns {string} blend mode
|
|
6231
6161
|
*/
|
|
6232
6162
|
getBlendMode(): string;
|
|
6233
6163
|
/**
|
|
6234
6164
|
* Returns the 2D Context object of the given Canvas<br>
|
|
6235
6165
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
6236
|
-
* @name getContext2d
|
|
6237
|
-
* @memberof Renderer
|
|
6238
6166
|
* @param {HTMLCanvasElement} canvas
|
|
6239
6167
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
6240
6168
|
* @returns {CanvasRenderingContext2D}
|
|
@@ -6242,67 +6170,49 @@ export class Renderer {
|
|
|
6242
6170
|
getContext2d(canvas: HTMLCanvasElement, transparent?: boolean): CanvasRenderingContext2D;
|
|
6243
6171
|
/**
|
|
6244
6172
|
* return the width of the system Canvas
|
|
6245
|
-
* @name getWidth
|
|
6246
|
-
* @memberof Renderer
|
|
6247
6173
|
* @returns {number}
|
|
6248
6174
|
*/
|
|
6249
6175
|
getWidth(): number;
|
|
6250
6176
|
/**
|
|
6251
6177
|
* return the height of the system Canvas
|
|
6252
|
-
* @name getHeight
|
|
6253
|
-
* @memberof Renderer
|
|
6254
6178
|
* @returns {number} height of the system Canvas
|
|
6255
6179
|
*/
|
|
6256
6180
|
getHeight(): number;
|
|
6257
6181
|
/**
|
|
6258
6182
|
* get the current fill & stroke style color.
|
|
6259
|
-
* @name getColor
|
|
6260
|
-
* @memberof Renderer
|
|
6261
6183
|
* @returns {Color} current global color
|
|
6262
6184
|
*/
|
|
6263
6185
|
getColor(): Color;
|
|
6264
6186
|
/**
|
|
6265
6187
|
* return the current global alpha
|
|
6266
|
-
* @name globalAlpha
|
|
6267
|
-
* @memberof Renderer
|
|
6268
6188
|
* @returns {number}
|
|
6269
6189
|
*/
|
|
6270
6190
|
globalAlpha(): number;
|
|
6271
6191
|
/**
|
|
6272
6192
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
6273
|
-
* @name overlaps
|
|
6274
|
-
* @memberof Renderer
|
|
6275
6193
|
* @param {Rect|Bounds} bounds
|
|
6276
6194
|
* @returns {boolean} true if overlaps
|
|
6277
6195
|
*/
|
|
6278
6196
|
overlaps(bounds: Rect | Bounds): boolean;
|
|
6279
6197
|
/**
|
|
6280
6198
|
* resizes the system canvas
|
|
6281
|
-
* @name resize
|
|
6282
|
-
* @memberof Renderer
|
|
6283
6199
|
* @param {number} width new width of the canvas
|
|
6284
6200
|
* @param {number} height new height of the canvas
|
|
6285
6201
|
*/
|
|
6286
6202
|
resize(width: number, height: number): void;
|
|
6287
6203
|
/**
|
|
6288
6204
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
6289
|
-
* @name setAntiAlias
|
|
6290
|
-
* @memberof Renderer
|
|
6291
6205
|
* @param {CanvasRenderingContext2D} context
|
|
6292
6206
|
* @param {boolean} [enable=false]
|
|
6293
6207
|
*/
|
|
6294
6208
|
setAntiAlias(context: CanvasRenderingContext2D, enable?: boolean): void;
|
|
6295
6209
|
/**
|
|
6296
6210
|
* set/change the current projection matrix (WebGL only)
|
|
6297
|
-
* @name setProjection
|
|
6298
|
-
* @memberof Renderer
|
|
6299
6211
|
* @param {Matrix3d} matrix
|
|
6300
6212
|
*/
|
|
6301
6213
|
setProjection(matrix: Matrix3d): void;
|
|
6302
6214
|
/**
|
|
6303
6215
|
* stroke the given shape
|
|
6304
|
-
* @name stroke
|
|
6305
|
-
* @memberof Renderer
|
|
6306
6216
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
6307
6217
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
6308
6218
|
*/
|
|
@@ -6316,8 +6226,6 @@ export class Renderer {
|
|
|
6316
6226
|
fill(shape: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6317
6227
|
/**
|
|
6318
6228
|
* tint the given image or canvas using the given color
|
|
6319
|
-
* @name tint
|
|
6320
|
-
* @memberof Renderer
|
|
6321
6229
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
6322
6230
|
* @param {Color|string} color the color that will be used to tint the image
|
|
6323
6231
|
* @param {string} [mode="multiply"] the composition mode used to tint the image
|
|
@@ -6328,32 +6236,24 @@ export class Renderer {
|
|
|
6328
6236
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
6329
6237
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
6330
6238
|
* Mask are not preserved through renderer context save and restore.
|
|
6331
|
-
* @name setMask
|
|
6332
|
-
* @memberof Renderer
|
|
6333
6239
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
6334
6240
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
6335
6241
|
*/
|
|
6336
6242
|
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse): void;
|
|
6337
6243
|
/**
|
|
6338
6244
|
* disable (remove) the rendering mask set through setMask.
|
|
6339
|
-
* @name clearMask
|
|
6340
6245
|
* @see Renderer#setMask
|
|
6341
|
-
* @memberof Renderer
|
|
6342
6246
|
*/
|
|
6343
6247
|
clearMask(): void;
|
|
6344
6248
|
/**
|
|
6345
6249
|
* set a coloring tint for sprite based renderables
|
|
6346
|
-
* @name setTint
|
|
6347
|
-
* @memberof Renderer
|
|
6348
6250
|
* @param {Color} tint the tint color
|
|
6349
6251
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
6350
6252
|
*/
|
|
6351
6253
|
setTint(tint: Color, alpha?: number): void;
|
|
6352
6254
|
/**
|
|
6353
6255
|
* clear the rendering tint set through setTint.
|
|
6354
|
-
* @name clearTint
|
|
6355
6256
|
* @see Renderer#setTint
|
|
6356
|
-
* @memberof Renderer
|
|
6357
6257
|
*/
|
|
6358
6258
|
clearTint(): void;
|
|
6359
6259
|
/**
|
|
@@ -8887,40 +8787,33 @@ export class WebGLCompositor {
|
|
|
8887
8787
|
viewMatrix: any;
|
|
8888
8788
|
/**
|
|
8889
8789
|
* a reference to the active WebGL shader
|
|
8890
|
-
* @name activeShader
|
|
8891
|
-
* @memberof WebGLCompositor
|
|
8892
8790
|
* @type {GLShader}
|
|
8893
8791
|
*/
|
|
8894
8792
|
activeShader: GLShader;
|
|
8895
8793
|
/**
|
|
8896
8794
|
* primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
|
|
8897
|
-
* @
|
|
8898
|
-
* @see WebGLCompositor
|
|
8899
|
-
* @memberof WebGLCompositor
|
|
8795
|
+
* @type {number}
|
|
8900
8796
|
* @default gl.TRIANGLES
|
|
8901
8797
|
*/
|
|
8902
|
-
mode:
|
|
8798
|
+
mode: number;
|
|
8903
8799
|
/**
|
|
8904
8800
|
* an array of vertex attribute properties
|
|
8905
|
-
* @name attributes
|
|
8906
8801
|
* @see WebGLCompositor.addAttribute
|
|
8907
|
-
* @
|
|
8802
|
+
* @type {Array}
|
|
8908
8803
|
*/
|
|
8909
8804
|
attributes: any[];
|
|
8910
8805
|
/**
|
|
8911
8806
|
* the size of a single vertex in bytes
|
|
8912
8807
|
* (will automatically be calculated as attributes definitions are added)
|
|
8913
|
-
* @name vertexByteSize
|
|
8914
8808
|
* @see WebGLCompositor.addAttribute
|
|
8915
|
-
* @
|
|
8809
|
+
* @type {number}
|
|
8916
8810
|
*/
|
|
8917
8811
|
vertexByteSize: number;
|
|
8918
8812
|
/**
|
|
8919
8813
|
* the size of a single vertex in floats
|
|
8920
8814
|
* (will automatically be calculated as attributes definitions are added)
|
|
8921
|
-
* @name vertexSize
|
|
8922
8815
|
* @see WebGLCompositor.addAttribute
|
|
8923
|
-
* @
|
|
8816
|
+
* @type {number}
|
|
8924
8817
|
*/
|
|
8925
8818
|
vertexSize: number;
|
|
8926
8819
|
primitiveShader: GLShader;
|
|
@@ -8933,8 +8826,6 @@ export class WebGLCompositor {
|
|
|
8933
8826
|
reset(): void;
|
|
8934
8827
|
/**
|
|
8935
8828
|
* add vertex attribute property definition to the compositor
|
|
8936
|
-
* @name addAttribute
|
|
8937
|
-
* @memberof WebGLCompositor
|
|
8938
8829
|
* @param {string} name name of the attribute in the vertex shader
|
|
8939
8830
|
* @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
|
|
8940
8831
|
* @param {GLenum} type data type of each component in the array
|
|
@@ -8944,8 +8835,6 @@ export class WebGLCompositor {
|
|
|
8944
8835
|
addAttribute(name: string, size: number, type: GLenum, normalized: boolean, offset: number): void;
|
|
8945
8836
|
/**
|
|
8946
8837
|
* Sets the viewport
|
|
8947
|
-
* @name setViewport
|
|
8948
|
-
* @memberof WebGLCompositor
|
|
8949
8838
|
* @param {number} x x position of viewport
|
|
8950
8839
|
* @param {number} y y position of viewport
|
|
8951
8840
|
* @param {number} w width of viewport
|
|
@@ -8954,8 +8843,6 @@ export class WebGLCompositor {
|
|
|
8954
8843
|
setViewport(x: number, y: number, w: number, h: number): void;
|
|
8955
8844
|
/**
|
|
8956
8845
|
* Create a WebGL texture from an image
|
|
8957
|
-
* @name createTexture2D
|
|
8958
|
-
* @memberof WebGLCompositor
|
|
8959
8846
|
* @param {number} unit Destination texture unit
|
|
8960
8847
|
* @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
|
|
8961
8848
|
* @param {number} filter gl.LINEAR or gl.NEAREST
|
|
@@ -8970,32 +8857,24 @@ export class WebGLCompositor {
|
|
|
8970
8857
|
createTexture2D(unit: number, image: (new (width?: number, height?: number) => HTMLImageElement) | HTMLCanvasElement | ImageData | Uint8Array[] | Float32Array[], filter: number, repeat?: string, w?: number, h?: number, b?: number, premultipliedAlpha?: boolean, mipmap?: boolean): WebGLTexture;
|
|
8971
8858
|
/**
|
|
8972
8859
|
* delete the given WebGL texture
|
|
8973
|
-
* @name bindTexture2D
|
|
8974
|
-
* @memberof WebGLCompositor
|
|
8975
8860
|
* @param {WebGLTexture} [texture] a WebGL texture to delete
|
|
8976
8861
|
* @param {number} [unit] Texture unit to delete
|
|
8977
8862
|
*/
|
|
8978
8863
|
deleteTexture2D(texture?: WebGLTexture): void;
|
|
8979
8864
|
/**
|
|
8980
8865
|
* returns the WebGL texture associated to the given texture unit
|
|
8981
|
-
* @name bindTexture2D
|
|
8982
|
-
* @memberof WebGLCompositor
|
|
8983
8866
|
* @param {number} unit Texture unit to which a texture is bound
|
|
8984
8867
|
* @returns {WebGLTexture} texture a WebGL texture
|
|
8985
8868
|
*/
|
|
8986
8869
|
getTexture2D(unit: number): WebGLTexture;
|
|
8987
8870
|
/**
|
|
8988
8871
|
* assign the given WebGL texture to the current batch
|
|
8989
|
-
* @name bindTexture2D
|
|
8990
|
-
* @memberof WebGLCompositor
|
|
8991
8872
|
* @param {WebGLTexture} texture a WebGL texture
|
|
8992
8873
|
* @param {number} unit Texture unit to which the given texture is bound
|
|
8993
8874
|
*/
|
|
8994
8875
|
bindTexture2D(texture: WebGLTexture, unit: number): void;
|
|
8995
8876
|
/**
|
|
8996
8877
|
* unbind the given WebGL texture, forcing it to be reuploaded
|
|
8997
|
-
* @name unbindTexture2D
|
|
8998
|
-
* @memberof WebGLCompositor
|
|
8999
8878
|
* @param {WebGLTexture} [texture] a WebGL texture
|
|
9000
8879
|
* @param {number} [unit] a WebGL texture
|
|
9001
8880
|
* @returns {number} unit the unit number that was associated with the given texture
|
|
@@ -9007,23 +8886,17 @@ export class WebGLCompositor {
|
|
|
9007
8886
|
uploadTexture(texture: any, w: any, h: any, b: any, force?: boolean): any;
|
|
9008
8887
|
/**
|
|
9009
8888
|
* set/change the current projection matrix
|
|
9010
|
-
* @name setProjection
|
|
9011
|
-
* @memberof WebGLCompositor
|
|
9012
8889
|
* @param {Matrix3d} matrix
|
|
9013
8890
|
*/
|
|
9014
8891
|
setProjection(matrix: Matrix3d): void;
|
|
9015
8892
|
/**
|
|
9016
8893
|
* Select the shader to use for compositing
|
|
9017
|
-
* @name useShader
|
|
9018
8894
|
* @see GLShader
|
|
9019
|
-
* @memberof WebGLCompositor
|
|
9020
8895
|
* @param {GLShader} shader a reference to a GLShader instance
|
|
9021
8896
|
*/
|
|
9022
8897
|
useShader(shader: GLShader): void;
|
|
9023
8898
|
/**
|
|
9024
8899
|
* Add a textured quad
|
|
9025
|
-
* @name addQuad
|
|
9026
|
-
* @memberof WebGLCompositor
|
|
9027
8900
|
* @param {TextureAtlas} texture Source texture atlas
|
|
9028
8901
|
* @param {number} x Destination x-coordinate
|
|
9029
8902
|
* @param {number} y Destination y-coordinate
|
|
@@ -9039,34 +8912,28 @@ export class WebGLCompositor {
|
|
|
9039
8912
|
/**
|
|
9040
8913
|
* Flush batched texture operations to the GPU
|
|
9041
8914
|
* @param {number} [mode=gl.TRIANGLES] the GL drawing mode
|
|
9042
|
-
* @memberof WebGLCompositor
|
|
9043
8915
|
*/
|
|
9044
8916
|
flush(mode?: number): void;
|
|
9045
8917
|
/**
|
|
9046
8918
|
* Draw an array of vertices
|
|
9047
|
-
* @name drawVertices
|
|
9048
|
-
* @memberof WebGLCompositor
|
|
9049
8919
|
* @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)
|
|
9050
8920
|
* @param {Vector2d[]} verts vertices
|
|
9051
8921
|
* @param {number} [vertexCount=verts.length] amount of points defined in the points array
|
|
9052
8922
|
*/
|
|
9053
8923
|
drawVertices(mode: GLenum, verts: Vector2d[], vertexCount?: number): void;
|
|
9054
8924
|
/**
|
|
9055
|
-
*
|
|
9056
|
-
* @
|
|
9057
|
-
* @memberof WebGLCompositor
|
|
9058
|
-
* @param {number} [r=0] - the red color value used when the color buffers are cleared
|
|
9059
|
-
* @param {number} [g=0] - the green color value used when the color buffers are cleared
|
|
9060
|
-
* @param {number} [b=0] - the blue color value used when the color buffers are cleared
|
|
9061
|
-
* @param {number} [a=0] - the alpha color value used when the color buffers are cleared
|
|
8925
|
+
* Clear the frame buffer
|
|
8926
|
+
* @param {number} [alpha = 0.0] - the alpha value used when clearing the framebuffer
|
|
9062
8927
|
*/
|
|
9063
|
-
|
|
8928
|
+
clear(alpha?: number): void;
|
|
9064
8929
|
/**
|
|
9065
|
-
*
|
|
9066
|
-
* @
|
|
9067
|
-
* @
|
|
8930
|
+
* Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
|
|
8931
|
+
* @param {number} [r = 0] - the red color value used when the color buffers are cleared
|
|
8932
|
+
* @param {number} [g = 0] - the green color value used when the color buffers are cleared
|
|
8933
|
+
* @param {number} [b = 0] - the blue color value used when the color buffers are cleared
|
|
8934
|
+
* @param {number} [a = 0] - the alpha color value used when the color buffers are cleared
|
|
9068
8935
|
*/
|
|
9069
|
-
|
|
8936
|
+
clearColor(r?: number, g?: number, b?: number, a?: number): void;
|
|
9070
8937
|
}
|
|
9071
8938
|
/**
|
|
9072
8939
|
* @classdesc
|
|
@@ -9081,7 +8948,8 @@ export class WebGLRenderer extends Renderer {
|
|
|
9081
8948
|
* @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
|
|
9082
8949
|
* @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
|
|
9083
8950
|
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
9084
|
-
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
8951
|
+
* @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas
|
|
8952
|
+
* @param {boolean} [options.premultipliedAlpha=true] in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
9085
8953
|
* @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
|
|
9086
8954
|
* @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
|
|
9087
8955
|
* @param {string} [options.powerPreference="default"] a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
@@ -9096,6 +8964,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
9096
8964
|
antiAlias?: boolean;
|
|
9097
8965
|
failIfMajorPerformanceCaveat?: boolean;
|
|
9098
8966
|
transparent?: boolean;
|
|
8967
|
+
premultipliedAlpha?: boolean;
|
|
9099
8968
|
subPixel?: boolean;
|
|
9100
8969
|
preferWebGL1?: boolean;
|
|
9101
8970
|
powerPreference?: string;
|
|
@@ -9105,8 +8974,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9105
8974
|
});
|
|
9106
8975
|
/**
|
|
9107
8976
|
* The WebGL version used by this renderer (1 or 2)
|
|
9108
|
-
* @name WebGLVersion
|
|
9109
|
-
* @memberof WebGLRenderer#
|
|
9110
8977
|
* @type {number}
|
|
9111
8978
|
* @default 1
|
|
9112
8979
|
* @readonly
|
|
@@ -9114,8 +8981,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9114
8981
|
readonly WebGLVersion: number;
|
|
9115
8982
|
/**
|
|
9116
8983
|
* The vendor string of the underlying graphics driver.
|
|
9117
|
-
* @name GPUVendor
|
|
9118
|
-
* @memberof WebGLRenderer#
|
|
9119
8984
|
* @type {string}
|
|
9120
8985
|
* @default null
|
|
9121
8986
|
* @readonly
|
|
@@ -9123,8 +8988,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9123
8988
|
readonly GPUVendor: string;
|
|
9124
8989
|
/**
|
|
9125
8990
|
* The renderer string of the underlying graphics driver.
|
|
9126
|
-
* @name GPURenderer
|
|
9127
|
-
* @memberof WebGLRenderer#
|
|
9128
8991
|
* @type {string}
|
|
9129
8992
|
* @default null
|
|
9130
8993
|
* @readonly
|
|
@@ -9133,15 +8996,12 @@ export class WebGLRenderer extends Renderer {
|
|
|
9133
8996
|
/**
|
|
9134
8997
|
* The WebGL context
|
|
9135
8998
|
* @name gl
|
|
9136
|
-
* @memberof WebGLRenderer
|
|
9137
8999
|
* @type {WebGLRenderingContext}
|
|
9138
9000
|
*/
|
|
9139
9001
|
context: WebGLRenderingContext;
|
|
9140
9002
|
gl: WebGLRenderingContext;
|
|
9141
9003
|
/**
|
|
9142
9004
|
* Maximum number of texture unit supported under the current context
|
|
9143
|
-
* @name maxTextures
|
|
9144
|
-
* @memberof WebGLRenderer#
|
|
9145
9005
|
* @type {number}
|
|
9146
9006
|
* @readonly
|
|
9147
9007
|
*/
|
|
@@ -9164,37 +9024,27 @@ export class WebGLRenderer extends Renderer {
|
|
|
9164
9024
|
_blendStack: any[];
|
|
9165
9025
|
/**
|
|
9166
9026
|
* The current transformation matrix used for transformations on the overall scene
|
|
9167
|
-
* @name currentTransform
|
|
9168
9027
|
* @type {Matrix2d}
|
|
9169
|
-
* @memberof WebGLRenderer#
|
|
9170
9028
|
*/
|
|
9171
9029
|
currentTransform: Matrix2d;
|
|
9172
9030
|
/**
|
|
9173
9031
|
* The current compositor used by the renderer
|
|
9174
|
-
* @name currentCompositor
|
|
9175
9032
|
* @type {WebGLCompositor}
|
|
9176
|
-
* @memberof WebGLRenderer#
|
|
9177
9033
|
*/
|
|
9178
9034
|
currentCompositor: WebGLCompositor;
|
|
9179
9035
|
/**
|
|
9180
9036
|
* The list of active compositors
|
|
9181
|
-
* @name compositors
|
|
9182
9037
|
* @type {Map<WebGLCompositor>}
|
|
9183
|
-
* @memberof WebGLRenderer#
|
|
9184
9038
|
*/
|
|
9185
9039
|
compositors: Map<WebGLCompositor, any>;
|
|
9186
9040
|
cache: TextureCache;
|
|
9187
9041
|
/**
|
|
9188
9042
|
* set the active compositor for this renderer
|
|
9189
|
-
* @name setCompositor
|
|
9190
9043
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
9191
|
-
* @memberof WebGLRenderer
|
|
9192
9044
|
*/
|
|
9193
9045
|
setCompositor(compositor?: WebGLCompositor | string): void;
|
|
9194
9046
|
/**
|
|
9195
9047
|
* Reset the gl transform to identity
|
|
9196
|
-
* @name resetTransform
|
|
9197
|
-
* @memberof WebGLRenderer
|
|
9198
9048
|
*/
|
|
9199
9049
|
resetTransform(): void;
|
|
9200
9050
|
/**
|
|
@@ -9211,8 +9061,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9211
9061
|
fontTexture: TextureAtlas;
|
|
9212
9062
|
/**
|
|
9213
9063
|
* Create a pattern with the specified repetition
|
|
9214
|
-
* @name createPattern
|
|
9215
|
-
* @memberof WebGLRenderer
|
|
9216
9064
|
* @param {Image} image Source image
|
|
9217
9065
|
* @param {string} repeat Define how the pattern should be repeated
|
|
9218
9066
|
* @returns {TextureAtlas}
|
|
@@ -9226,16 +9074,12 @@ export class WebGLRenderer extends Renderer {
|
|
|
9226
9074
|
createPattern(image: new (width?: number, height?: number) => HTMLImageElement, repeat: string): TextureAtlas;
|
|
9227
9075
|
/**
|
|
9228
9076
|
* Clears the gl context with the given color.
|
|
9229
|
-
* @name clearColor
|
|
9230
|
-
* @memberof WebGLRenderer
|
|
9231
9077
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
9232
9078
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
9233
9079
|
*/
|
|
9234
9080
|
clearColor(color?: Color | string, opaque?: boolean): void;
|
|
9235
9081
|
/**
|
|
9236
9082
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
9237
|
-
* @name clearRect
|
|
9238
|
-
* @memberof WebGLRenderer
|
|
9239
9083
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
9240
9084
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
9241
9085
|
* @param {number} width The rectangle's width.
|
|
@@ -9248,8 +9092,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9248
9092
|
drawFont(bounds: any): void;
|
|
9249
9093
|
/**
|
|
9250
9094
|
* Draw an image to the gl context
|
|
9251
|
-
* @name drawImage
|
|
9252
|
-
* @memberof WebGLRenderer
|
|
9253
9095
|
* @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.
|
|
9254
9096
|
* @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.
|
|
9255
9097
|
* @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.
|
|
@@ -9270,8 +9112,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9270
9112
|
drawImage(image: new (width?: number, height?: number) => HTMLImageElement, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
9271
9113
|
/**
|
|
9272
9114
|
* Draw a pattern within the given rectangle.
|
|
9273
|
-
* @name drawPattern
|
|
9274
|
-
* @memberof WebGLRenderer
|
|
9275
9115
|
* @param {TextureAtlas} pattern Pattern object
|
|
9276
9116
|
* @param {number} x
|
|
9277
9117
|
* @param {number} y
|
|
@@ -9281,19 +9121,15 @@ export class WebGLRenderer extends Renderer {
|
|
|
9281
9121
|
*/
|
|
9282
9122
|
drawPattern(pattern: TextureAtlas, x: number, y: number, width: number, height: number): void;
|
|
9283
9123
|
/**
|
|
9284
|
-
* Returns the WebGL Context object of the given
|
|
9285
|
-
* @name getContextGL
|
|
9286
|
-
* @memberof WebGLRenderer
|
|
9124
|
+
* Returns the WebGL Context object of the given canvas element
|
|
9287
9125
|
* @param {HTMLCanvasElement} canvas
|
|
9288
|
-
* @param {boolean} [transparent=
|
|
9126
|
+
* @param {boolean} [transparent=false] use true to enable transparency
|
|
9289
9127
|
* @returns {WebGLRenderingContext}
|
|
9290
9128
|
*/
|
|
9291
9129
|
getContextGL(canvas: HTMLCanvasElement, transparent?: boolean): WebGLRenderingContext;
|
|
9292
9130
|
/**
|
|
9293
9131
|
* Returns the WebGLContext instance for the renderer
|
|
9294
9132
|
* return a reference to the system 2d Context
|
|
9295
|
-
* @name getContext
|
|
9296
|
-
* @memberof WebGLRenderer
|
|
9297
9133
|
* @returns {WebGLRenderingContext}
|
|
9298
9134
|
*/
|
|
9299
9135
|
getContext(): WebGLRenderingContext;
|
|
@@ -9308,9 +9144,7 @@ export class WebGLRenderer extends Renderer {
|
|
|
9308
9144
|
* <img src="images/lighter-blendmode.png" width="510"/> <br>
|
|
9309
9145
|
* - "screen" : The pixels are inverted, multiplied, and inverted again. A lighter picture is the result (opposite of multiply) <br>
|
|
9310
9146
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
9311
|
-
* @name setBlendMode
|
|
9312
9147
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
9313
|
-
* @memberof WebGLRenderer
|
|
9314
9148
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
9315
9149
|
* @param {WebGLRenderingContext} [gl]
|
|
9316
9150
|
*/
|
|
@@ -9323,27 +9157,19 @@ export class WebGLRenderer extends Renderer {
|
|
|
9323
9157
|
getFontContext(): CanvasRenderingContext2D;
|
|
9324
9158
|
/**
|
|
9325
9159
|
* restores the canvas context
|
|
9326
|
-
* @name restore
|
|
9327
|
-
* @memberof WebGLRenderer
|
|
9328
9160
|
*/
|
|
9329
9161
|
restore(): void;
|
|
9330
9162
|
/**
|
|
9331
9163
|
* saves the canvas context
|
|
9332
|
-
* @name save
|
|
9333
|
-
* @memberof WebGLRenderer
|
|
9334
9164
|
*/
|
|
9335
9165
|
save(): void;
|
|
9336
9166
|
/**
|
|
9337
9167
|
* rotates the uniform matrix
|
|
9338
|
-
* @name rotate
|
|
9339
|
-
* @memberof WebGLRenderer
|
|
9340
9168
|
* @param {number} angle in radians
|
|
9341
9169
|
*/
|
|
9342
9170
|
rotate(angle: number): void;
|
|
9343
9171
|
/**
|
|
9344
9172
|
* scales the uniform matrix
|
|
9345
|
-
* @name scale
|
|
9346
|
-
* @memberof WebGLRenderer
|
|
9347
9173
|
* @param {number} x
|
|
9348
9174
|
* @param {number} y
|
|
9349
9175
|
*/
|
|
@@ -9355,37 +9181,27 @@ export class WebGLRenderer extends Renderer {
|
|
|
9355
9181
|
setAntiAlias(context: any, enable: any): void;
|
|
9356
9182
|
/**
|
|
9357
9183
|
* Set the global alpha
|
|
9358
|
-
* @name setGlobalAlpha
|
|
9359
|
-
* @memberof WebGLRenderer
|
|
9360
9184
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
9361
9185
|
*/
|
|
9362
9186
|
setGlobalAlpha(alpha: number): void;
|
|
9363
9187
|
/**
|
|
9364
9188
|
* Return the global alpha
|
|
9365
|
-
* @name getGlobalAlpha
|
|
9366
|
-
* @memberof WebGLRenderer
|
|
9367
9189
|
* @returns {number} global alpha value
|
|
9368
9190
|
*/
|
|
9369
9191
|
getGlobalAlpha(): number;
|
|
9370
9192
|
/**
|
|
9371
9193
|
* Set the current fill & stroke style color.
|
|
9372
9194
|
* By default, or upon reset, the value is set to #000000.
|
|
9373
|
-
* @name setColor
|
|
9374
|
-
* @memberof WebGLRenderer
|
|
9375
9195
|
* @param {Color|string} color css color string.
|
|
9376
9196
|
*/
|
|
9377
9197
|
setColor(color: Color | string): void;
|
|
9378
9198
|
/**
|
|
9379
9199
|
* Set the line width
|
|
9380
|
-
* @name setLineWidth
|
|
9381
|
-
* @memberof WebGLRenderer
|
|
9382
9200
|
* @param {number} width Line width
|
|
9383
9201
|
*/
|
|
9384
9202
|
setLineWidth(width: number): void;
|
|
9385
9203
|
/**
|
|
9386
9204
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
9387
|
-
* @name strokeArc
|
|
9388
|
-
* @memberof WebGLRenderer
|
|
9389
9205
|
* @param {number} x arc center point x-axis
|
|
9390
9206
|
* @param {number} y arc center point y-axis
|
|
9391
9207
|
* @param {number} radius
|
|
@@ -9397,8 +9213,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9397
9213
|
strokeArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean, fill?: boolean): void;
|
|
9398
9214
|
/**
|
|
9399
9215
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
9400
|
-
* @name fillArc
|
|
9401
|
-
* @memberof WebGLRenderer
|
|
9402
9216
|
* @param {number} x arc center point x-axis
|
|
9403
9217
|
* @param {number} y arc center point y-axis
|
|
9404
9218
|
* @param {number} radius
|
|
@@ -9409,8 +9223,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9409
9223
|
fillArc(x: number, y: number, radius: number, start: number, end: number, antiClockwise?: boolean): void;
|
|
9410
9224
|
/**
|
|
9411
9225
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
9412
|
-
* @name strokeEllipse
|
|
9413
|
-
* @memberof WebGLRenderer
|
|
9414
9226
|
* @param {number} x ellipse center point x-axis
|
|
9415
9227
|
* @param {number} y ellipse center point y-axis
|
|
9416
9228
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -9420,8 +9232,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9420
9232
|
strokeEllipse(x: number, y: number, w: number, h: number, fill?: boolean): void;
|
|
9421
9233
|
/**
|
|
9422
9234
|
* Fill an ellipse at the specified coordinates with given radius
|
|
9423
|
-
* @name fillEllipse
|
|
9424
|
-
* @memberof WebGLRenderer
|
|
9425
9235
|
* @param {number} x ellipse center point x-axis
|
|
9426
9236
|
* @param {number} y ellipse center point y-axis
|
|
9427
9237
|
* @param {number} w horizontal radius of the ellipse
|
|
@@ -9430,8 +9240,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9430
9240
|
fillEllipse(x: number, y: number, w: number, h: number): void;
|
|
9431
9241
|
/**
|
|
9432
9242
|
* Stroke a line of the given two points
|
|
9433
|
-
* @name strokeLine
|
|
9434
|
-
* @memberof WebGLRenderer
|
|
9435
9243
|
* @param {number} startX the start x coordinate
|
|
9436
9244
|
* @param {number} startY the start y coordinate
|
|
9437
9245
|
* @param {number} endX the end x coordinate
|
|
@@ -9440,8 +9248,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9440
9248
|
strokeLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
9441
9249
|
/**
|
|
9442
9250
|
* Fill a line of the given two points
|
|
9443
|
-
* @name fillLine
|
|
9444
|
-
* @memberof WebGLRenderer
|
|
9445
9251
|
* @param {number} startX the start x coordinate
|
|
9446
9252
|
* @param {number} startY the start y coordinate
|
|
9447
9253
|
* @param {number} endX the end x coordinate
|
|
@@ -9450,23 +9256,17 @@ export class WebGLRenderer extends Renderer {
|
|
|
9450
9256
|
fillLine(startX: number, startY: number, endX: number, endY: number): void;
|
|
9451
9257
|
/**
|
|
9452
9258
|
* Stroke a me.Polygon on the screen with a specified color
|
|
9453
|
-
* @name strokePolygon
|
|
9454
|
-
* @memberof WebGLRenderer
|
|
9455
9259
|
* @param {Polygon} poly the shape to draw
|
|
9456
9260
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
9457
9261
|
*/
|
|
9458
9262
|
strokePolygon(poly: Polygon, fill?: boolean): void;
|
|
9459
9263
|
/**
|
|
9460
9264
|
* Fill a me.Polygon on the screen
|
|
9461
|
-
* @name fillPolygon
|
|
9462
|
-
* @memberof WebGLRenderer
|
|
9463
9265
|
* @param {Polygon} poly the shape to draw
|
|
9464
9266
|
*/
|
|
9465
9267
|
fillPolygon(poly: Polygon): void;
|
|
9466
9268
|
/**
|
|
9467
9269
|
* Draw a stroke rectangle at the specified coordinates
|
|
9468
|
-
* @name strokeRect
|
|
9469
|
-
* @memberof WebGLRenderer
|
|
9470
9270
|
* @param {number} x
|
|
9471
9271
|
* @param {number} y
|
|
9472
9272
|
* @param {number} width
|
|
@@ -9476,8 +9276,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9476
9276
|
strokeRect(x: number, y: number, width: number, height: number, fill?: boolean): void;
|
|
9477
9277
|
/**
|
|
9478
9278
|
* Draw a filled rectangle at the specified coordinates
|
|
9479
|
-
* @name fillRect
|
|
9480
|
-
* @memberof WebGLRenderer
|
|
9481
9279
|
* @param {number} x
|
|
9482
9280
|
* @param {number} y
|
|
9483
9281
|
* @param {number} width
|
|
@@ -9486,8 +9284,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9486
9284
|
fillRect(x: number, y: number, width: number, height: number): void;
|
|
9487
9285
|
/**
|
|
9488
9286
|
* Stroke a rounded rectangle at the specified coordinates
|
|
9489
|
-
* @name strokeRoundRect
|
|
9490
|
-
* @memberof WebGLRenderer
|
|
9491
9287
|
* @param {number} x
|
|
9492
9288
|
* @param {number} y
|
|
9493
9289
|
* @param {number} width
|
|
@@ -9498,8 +9294,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9498
9294
|
strokeRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: boolean): void;
|
|
9499
9295
|
/**
|
|
9500
9296
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
9501
|
-
* @name fillRoundRect
|
|
9502
|
-
* @memberof WebGLRenderer
|
|
9503
9297
|
* @param {number} x
|
|
9504
9298
|
* @param {number} y
|
|
9505
9299
|
* @param {number} width
|
|
@@ -9507,25 +9301,33 @@ export class WebGLRenderer extends Renderer {
|
|
|
9507
9301
|
* @param {number} radius
|
|
9508
9302
|
*/
|
|
9509
9303
|
fillRoundRect(x: number, y: number, width: number, height: number, radius: number): void;
|
|
9304
|
+
/**
|
|
9305
|
+
* Stroke a Point at the specified coordinates
|
|
9306
|
+
* @param {number} x
|
|
9307
|
+
* @param {number} y
|
|
9308
|
+
*/
|
|
9309
|
+
strokePoint(x: number, y: number): void;
|
|
9310
|
+
/**
|
|
9311
|
+
* Draw a a point at the specified coordinates
|
|
9312
|
+
* @param {number} x
|
|
9313
|
+
* @param {number} y
|
|
9314
|
+
* @param {number} width
|
|
9315
|
+
* @param {number} height
|
|
9316
|
+
*/
|
|
9317
|
+
fillPoint(x: number, y: number): void;
|
|
9510
9318
|
/**
|
|
9511
9319
|
* Reset (overrides) the renderer transformation matrix to the
|
|
9512
9320
|
* identity one, and then apply the given transformation matrix.
|
|
9513
|
-
* @name setTransform
|
|
9514
|
-
* @memberof WebGLRenderer
|
|
9515
9321
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
9516
9322
|
*/
|
|
9517
9323
|
setTransform(mat2d: Matrix2d): void;
|
|
9518
9324
|
/**
|
|
9519
9325
|
* Multiply given matrix into the renderer tranformation matrix
|
|
9520
|
-
* @name transform
|
|
9521
|
-
* @memberof WebGLRenderer
|
|
9522
9326
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
9523
9327
|
*/
|
|
9524
9328
|
transform(mat2d: Matrix2d): void;
|
|
9525
9329
|
/**
|
|
9526
9330
|
* Translates the uniform matrix by the given coordinates
|
|
9527
|
-
* @name translate
|
|
9528
|
-
* @memberof WebGLRenderer
|
|
9529
9331
|
* @param {number} x
|
|
9530
9332
|
* @param {number} y
|
|
9531
9333
|
*/
|
|
@@ -9536,8 +9338,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9536
9338
|
* You can however save the current region using the save(),
|
|
9537
9339
|
* and restore it (with the restore() method) any time in the future.
|
|
9538
9340
|
* (<u>this is an experimental feature !</u>)
|
|
9539
|
-
* @name clipRect
|
|
9540
|
-
* @memberof WebGLRenderer
|
|
9541
9341
|
* @param {number} x
|
|
9542
9342
|
* @param {number} y
|
|
9543
9343
|
* @param {number} width
|
|
@@ -9548,8 +9348,6 @@ export class WebGLRenderer extends Renderer {
|
|
|
9548
9348
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
9549
9349
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
9550
9350
|
* Mask are not preserved through renderer context save and restore.
|
|
9551
|
-
* @name setMask
|
|
9552
|
-
* @memberof WebGLRenderer
|
|
9553
9351
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
9554
9352
|
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
9555
9353
|
*/
|