@vpmedia/phaser 1.12.0 → 1.13.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 +1 -1
- package/package.json +2 -2
- package/src/index.js +19 -19
- package/src/phaser/core/animation.js +3 -3
- package/src/phaser/core/animation_manager.js +2 -2
- package/src/phaser/core/animation_parser.js +16 -14
- package/src/phaser/core/array_set.js +2 -2
- package/src/phaser/core/cache.js +6 -6
- package/src/phaser/core/const.js +1 -1
- package/src/phaser/core/device.js +2 -2
- package/src/phaser/core/device_util.js +29 -11
- package/src/phaser/core/dom.js +2 -2
- package/src/phaser/core/event_manager.js +2 -2
- package/src/phaser/core/factory.js +8 -8
- package/src/phaser/core/frame.js +3 -3
- package/src/phaser/core/frame_data.js +2 -2
- package/src/phaser/core/frame_util.js +11 -9
- package/src/phaser/core/game.js +14 -13
- package/src/phaser/core/input.js +7 -7
- package/src/phaser/core/input_handler.js +2 -2
- package/src/phaser/core/input_mouse.js +2 -2
- package/src/phaser/core/input_mspointer.js +1 -1
- package/src/phaser/core/input_pointer.js +3 -3
- package/src/phaser/core/input_touch.js +1 -1
- package/src/phaser/core/loader.js +3 -3
- package/src/phaser/core/loader_parser.js +25 -21
- package/src/phaser/core/raf.js +2 -2
- package/src/phaser/core/scale_manager.js +5 -5
- package/src/phaser/core/scene.js +2 -2
- package/src/phaser/core/scene_manager.js +3 -3
- package/src/phaser/core/signal.js +4 -3
- package/src/phaser/core/signal_binding.js +2 -2
- package/src/phaser/core/sound.js +3 -3
- package/src/phaser/core/sound_manager.js +6 -6
- package/src/phaser/core/sound_sprite.js +2 -2
- package/src/phaser/core/stage.js +4 -4
- package/src/phaser/core/time.js +3 -3
- package/src/phaser/core/timer.js +3 -3
- package/src/phaser/core/timer_event.js +1 -1
- package/src/phaser/core/tween.js +4 -4
- package/src/phaser/core/tween_data.js +2 -2
- package/src/phaser/core/tween_easing.js +63 -63
- package/src/phaser/core/tween_manager.js +3 -3
- package/src/phaser/core/world.js +3 -3
- package/src/phaser/display/bitmap_text.js +17 -5
- package/src/phaser/display/button.js +19 -4
- package/src/phaser/display/canvas/buffer.js +1 -1
- package/src/phaser/display/canvas/graphics.js +9 -6
- package/src/phaser/display/canvas/masker.js +6 -4
- package/src/phaser/display/canvas/pool.js +18 -11
- package/src/phaser/display/canvas/renderer.js +1 -1
- package/src/phaser/display/canvas/tinter.js +18 -13
- package/src/phaser/display/canvas/util.js +43 -34
- package/src/phaser/display/display_object.js +9 -5
- package/src/phaser/display/graphics.js +19 -11
- package/src/phaser/display/graphics_data.js +3 -2
- package/src/phaser/display/graphics_data_util.js +6 -4
- package/src/phaser/display/group.js +14 -5
- package/src/phaser/display/image.js +15 -5
- package/src/phaser/display/sprite_batch.js +8 -2
- package/src/phaser/display/sprite_util.js +21 -15
- package/src/phaser/display/text.js +15 -5
- package/src/phaser/display/webgl/abstract_filter.js +1 -1
- package/src/phaser/display/webgl/base_texture.js +3 -2
- package/src/phaser/display/webgl/blend_manager.js +1 -1
- package/src/phaser/display/webgl/earcut.js +107 -107
- package/src/phaser/display/webgl/earcut_node.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +1 -1
- package/src/phaser/display/webgl/filter_manager.js +1 -1
- package/src/phaser/display/webgl/filter_texture.js +1 -1
- package/src/phaser/display/webgl/graphics.js +34 -34
- package/src/phaser/display/webgl/graphics_data.js +2 -2
- package/src/phaser/display/webgl/mask_manager.js +7 -5
- package/src/phaser/display/webgl/render_texture.js +5 -5
- package/src/phaser/display/webgl/renderer.js +2 -2
- package/src/phaser/display/webgl/shader/complex.js +1 -1
- package/src/phaser/display/webgl/shader/fast.js +1 -1
- package/src/phaser/display/webgl/shader/normal.js +1 -1
- package/src/phaser/display/webgl/shader/primitive.js +1 -1
- package/src/phaser/display/webgl/shader/strip.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +1 -1
- package/src/phaser/display/webgl/sprite_batch.js +1 -1
- package/src/phaser/display/webgl/stencil_manager.js +1 -1
- package/src/phaser/display/webgl/texture.js +4 -3
- package/src/phaser/display/webgl/texture_util.js +11 -9
- package/src/phaser/display/webgl/util.js +20 -16
- package/src/phaser/geom/circle.js +12 -4
- package/src/phaser/geom/ellipse.js +13 -4
- package/src/phaser/geom/line.js +12 -3
- package/src/phaser/geom/matrix.js +14 -3
- package/src/phaser/geom/point.js +9 -2
- package/src/phaser/geom/polygon.js +4 -3
- package/src/phaser/geom/rectangle.js +12 -3
- package/src/phaser/geom/rounded_rectangle.js +12 -2
- package/src/phaser/geom/util/circle.js +37 -29
- package/src/phaser/geom/util/ellipse.js +7 -15
- package/src/phaser/geom/util/line.js +30 -24
- package/src/phaser/geom/util/matrix.js +11 -9
- package/src/phaser/geom/util/point.js +100 -78
- package/src/phaser/geom/util/polygon.js +7 -15
- package/src/phaser/geom/util/rectangle.js +78 -62
- package/src/phaser/geom/util/rounded_rectangle.js +7 -15
- package/src/phaser/util/math.js +86 -66
- package/types/global.d.ts +7 -0
- package/types/index.d.ts +18 -18
- package/types/index.d.ts.map +1 -1
- package/types/phaser/core/animation.d.ts +5 -5
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +13 -11
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/array_set.d.ts +2 -2
- package/types/phaser/core/cache.d.ts +4 -4
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +1 -1
- package/types/phaser/core/device.d.ts +2 -2
- package/types/phaser/core/device_util.d.ts +31 -21
- package/types/phaser/core/device_util.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +1 -1
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +2 -2
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame.d.ts +2 -2
- package/types/phaser/core/frame.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +1 -1
- package/types/phaser/core/frame_util.d.ts +8 -6
- package/types/phaser/core/frame_util.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +12 -12
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +4 -4
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +1 -1
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +1 -1
- package/types/phaser/core/input_pointer.d.ts +2 -2
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +1 -1
- package/types/phaser/core/loader.d.ts +1 -1
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/loader_parser.d.ts +22 -18
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +2 -2
- package/types/phaser/core/scale_manager.d.ts +4 -4
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene.d.ts +2 -2
- package/types/phaser/core/scene_manager.d.ts +1 -1
- package/types/phaser/core/signal.d.ts +1 -1
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +2 -2
- package/types/phaser/core/sound.d.ts +4 -4
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +5 -5
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +2 -2
- package/types/phaser/core/stage.d.ts +2 -2
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +2 -2
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +2 -2
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +1 -1
- package/types/phaser/core/tween.d.ts +18 -18
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +5 -5
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_easing.d.ts +63 -63
- package/types/phaser/core/tween_manager.d.ts +2 -2
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +2 -2
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +16 -5
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +18 -4
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/graphics.d.ts +8 -5
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/types/phaser/display/canvas/masker.d.ts +5 -3
- package/types/phaser/display/canvas/masker.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +20 -13
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/tinter.d.ts +19 -14
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +47 -38
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +5 -5
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +28 -21
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +1 -1
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/graphics_data_util.d.ts +3 -2
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +14 -6
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +14 -5
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +8 -3
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +19 -14
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +25 -16
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +1 -1
- package/types/phaser/display/webgl/earcut.d.ts +106 -106
- package/types/phaser/display/webgl/earcut_node.d.ts +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +31 -31
- package/types/phaser/display/webgl/graphics_data.d.ts +2 -2
- package/types/phaser/display/webgl/mask_manager.d.ts +6 -4
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +3 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +1 -1
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +1 -1
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture_util.d.ts +10 -8
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +20 -16
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
- package/types/phaser/geom/circle.d.ts +16 -9
- package/types/phaser/geom/circle.d.ts.map +1 -1
- package/types/phaser/geom/ellipse.d.ts +13 -5
- package/types/phaser/geom/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/line.d.ts +16 -8
- package/types/phaser/geom/line.d.ts.map +1 -1
- package/types/phaser/geom/matrix.d.ts +21 -11
- package/types/phaser/geom/matrix.d.ts.map +1 -1
- package/types/phaser/geom/point.d.ts +26 -20
- package/types/phaser/geom/point.d.ts.map +1 -1
- package/types/phaser/geom/polygon.d.ts +4 -4
- package/types/phaser/geom/polygon.d.ts.map +1 -1
- package/types/phaser/geom/rectangle.d.ts +22 -14
- package/types/phaser/geom/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/circle.d.ts +42 -33
- package/types/phaser/geom/util/circle.d.ts.map +1 -1
- package/types/phaser/geom/util/ellipse.d.ts +7 -12
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/util/line.d.ts +30 -23
- package/types/phaser/geom/util/line.d.ts.map +1 -1
- package/types/phaser/geom/util/matrix.d.ts +12 -10
- package/types/phaser/geom/util/matrix.d.ts.map +1 -1
- package/types/phaser/geom/util/point.d.ts +118 -96
- package/types/phaser/geom/util/point.d.ts.map +1 -1
- package/types/phaser/geom/util/polygon.d.ts +6 -11
- package/types/phaser/geom/util/polygon.d.ts.map +1 -1
- package/types/phaser/geom/util/rectangle.d.ts +91 -74
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts +6 -11
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/util/math.d.ts +89 -69
- package/types/phaser/util/math.d.ts.map +1 -1
- package/tsconfig.json +0 -110
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
|
-
import GraphicsData from
|
|
8
|
-
import Point from '../../geom/point';
|
|
7
|
+
import { GraphicsData } from './graphics_data';
|
|
8
|
+
import { Point } from '../../geom/point';
|
|
9
9
|
import {
|
|
10
10
|
GEOM_CIRCLE,
|
|
11
11
|
GEOM_ELLIPSE,
|
|
@@ -17,9 +17,9 @@ import { hex2rgb } from '../../util/math';
|
|
|
17
17
|
import { triangulate } from './earcut';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* TBD
|
|
20
|
+
* TBD.
|
|
21
21
|
*
|
|
22
|
-
* @returns {number} TBD
|
|
22
|
+
* @returns {number} TBD.
|
|
23
23
|
*/
|
|
24
24
|
export function getStencilBufferLimit() {
|
|
25
25
|
if (!window.PhaserRegistry.stencilBufferLimit) {
|
|
@@ -29,9 +29,9 @@ export function getStencilBufferLimit() {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* TBD
|
|
32
|
+
* TBD.
|
|
33
33
|
*
|
|
34
|
-
* @returns {object[]} TBD
|
|
34
|
+
* @returns {object[]} TBD.
|
|
35
35
|
*/
|
|
36
36
|
export function getGraphicsDataPool() {
|
|
37
37
|
if (!window.PhaserRegistry.graphicsDataPool) {
|
|
@@ -42,9 +42,9 @@ export function getGraphicsDataPool() {
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
|
-
* @param {object} webGL TBD
|
|
46
|
-
* @param {number} type TBD
|
|
47
|
-
* @returns {object} TBD
|
|
45
|
+
* @param {object} webGL - TBD.
|
|
46
|
+
* @param {number} type - TBD.
|
|
47
|
+
* @returns {object} TBD.
|
|
48
48
|
*/
|
|
49
49
|
export function switchMode(webGL, type) {
|
|
50
50
|
let webGLData;
|
|
@@ -66,8 +66,8 @@ export function switchMode(webGL, type) {
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
*
|
|
69
|
-
* @param {object} graphicsData TBD
|
|
70
|
-
* @param {object} webGLData TBD
|
|
69
|
+
* @param {object} graphicsData - TBD.
|
|
70
|
+
* @param {object} webGLData - TBD.
|
|
71
71
|
*/
|
|
72
72
|
export function buildLine(graphicsData, webGLData) {
|
|
73
73
|
// TODO OPTIMISE!
|
|
@@ -231,8 +231,8 @@ export function buildLine(graphicsData, webGLData) {
|
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
*
|
|
234
|
-
* @param {object} graphicsData TBD
|
|
235
|
-
* @param {object} webGLData TBD
|
|
234
|
+
* @param {object} graphicsData - TBD.
|
|
235
|
+
* @param {object} webGLData - TBD.
|
|
236
236
|
*/
|
|
237
237
|
export function buildRectangle(graphicsData, webGLData) {
|
|
238
238
|
//
|
|
@@ -275,13 +275,13 @@ export function buildRectangle(graphicsData, webGLData) {
|
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
277
|
*
|
|
278
|
-
* @param {number} fromX TBD
|
|
279
|
-
* @param {number} fromY TBD
|
|
280
|
-
* @param {number} cpX TBD
|
|
281
|
-
* @param {number} cpY TBD
|
|
282
|
-
* @param {number} toX TBD
|
|
283
|
-
* @param {number} toY TBD
|
|
284
|
-
* @returns {number[]} TBD
|
|
278
|
+
* @param {number} fromX - TBD.
|
|
279
|
+
* @param {number} fromY - TBD.
|
|
280
|
+
* @param {number} cpX - TBD.
|
|
281
|
+
* @param {number} cpY - TBD.
|
|
282
|
+
* @param {number} toX - TBD.
|
|
283
|
+
* @param {number} toY - TBD.
|
|
284
|
+
* @returns {number[]} TBD.
|
|
285
285
|
*/
|
|
286
286
|
export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
|
|
287
287
|
let xa;
|
|
@@ -314,8 +314,8 @@ export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
|
|
|
314
314
|
|
|
315
315
|
/**
|
|
316
316
|
*
|
|
317
|
-
* @param {object} graphicsData TBD
|
|
318
|
-
* @param {object} webGLData TBD
|
|
317
|
+
* @param {object} graphicsData - TBD.
|
|
318
|
+
* @param {object} webGLData - TBD.
|
|
319
319
|
*/
|
|
320
320
|
export function buildRoundedRectangle(graphicsData, webGLData) {
|
|
321
321
|
const rrectData = graphicsData.shape;
|
|
@@ -375,8 +375,8 @@ export function buildRoundedRectangle(graphicsData, webGLData) {
|
|
|
375
375
|
|
|
376
376
|
/**
|
|
377
377
|
*
|
|
378
|
-
* @param {object} graphicsData TBD
|
|
379
|
-
* @param {object} webGLData TBD
|
|
378
|
+
* @param {object} graphicsData - TBD.
|
|
379
|
+
* @param {object} webGLData - TBD.
|
|
380
380
|
*/
|
|
381
381
|
export function buildCircle(graphicsData, webGLData) {
|
|
382
382
|
// need to convert points to a nice regular data
|
|
@@ -426,8 +426,8 @@ export function buildCircle(graphicsData, webGLData) {
|
|
|
426
426
|
|
|
427
427
|
/**
|
|
428
428
|
*
|
|
429
|
-
* @param {object} graphicsData TBD
|
|
430
|
-
* @param {object} webGLData TBD
|
|
429
|
+
* @param {object} graphicsData - TBD.
|
|
430
|
+
* @param {object} webGLData - TBD.
|
|
431
431
|
*/
|
|
432
432
|
export function buildComplexPoly(graphicsData, webGLData) {
|
|
433
433
|
// TODO - no need to copy this as it gets turned into a Float32Array anyways..
|
|
@@ -470,9 +470,9 @@ export function buildComplexPoly(graphicsData, webGLData) {
|
|
|
470
470
|
|
|
471
471
|
/**
|
|
472
472
|
*
|
|
473
|
-
* @param {object} graphicsData TBD
|
|
474
|
-
* @param {object} webGLData TBD
|
|
475
|
-
* @returns {boolean} TBD
|
|
473
|
+
* @param {object} graphicsData - TBD.
|
|
474
|
+
* @param {object} webGLData - TBD.
|
|
475
|
+
* @returns {boolean} TBD.
|
|
476
476
|
*/
|
|
477
477
|
export function buildPoly(graphicsData, webGLData) {
|
|
478
478
|
const points = graphicsData.points;
|
|
@@ -509,8 +509,8 @@ export function buildPoly(graphicsData, webGLData) {
|
|
|
509
509
|
|
|
510
510
|
/**
|
|
511
511
|
*
|
|
512
|
-
* @param {object} graphics TBD
|
|
513
|
-
* @param {object} gl TBD
|
|
512
|
+
* @param {object} graphics - TBD.
|
|
513
|
+
* @param {object} gl - TBD.
|
|
514
514
|
*/
|
|
515
515
|
export function updateGraphics(graphics, gl) {
|
|
516
516
|
const stencilBufferLimit = getStencilBufferLimit();
|
|
@@ -598,8 +598,8 @@ export function updateGraphics(graphics, gl) {
|
|
|
598
598
|
|
|
599
599
|
/**
|
|
600
600
|
*
|
|
601
|
-
* @param {object} graphics TBD
|
|
602
|
-
* @param {object} renderSession TBD
|
|
601
|
+
* @param {object} graphics - TBD.
|
|
602
|
+
* @param {object} renderSession - TBD.
|
|
603
603
|
*/
|
|
604
604
|
export function renderGraphics(graphics, renderSession) {
|
|
605
605
|
const gl = renderSession.gl;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export class GraphicsData {
|
|
9
9
|
constructor(gl) {
|
|
10
10
|
this.gl = gl;
|
|
11
11
|
// TODO does this need to be split before uploading??
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { updateGraphics } from './graphics';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
+
* TBD.
|
|
10
11
|
*
|
|
11
|
-
* @param {object} maskData TBD
|
|
12
|
-
* @param {object} renderSession TBD
|
|
12
|
+
* @param {object} maskData - TBD.
|
|
13
|
+
* @param {object} renderSession - TBD.
|
|
13
14
|
*/
|
|
14
15
|
export function pushMask(maskData, renderSession) {
|
|
15
16
|
const gl = renderSession.gl;
|
|
@@ -27,9 +28,10 @@ export function pushMask(maskData, renderSession) {
|
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/**
|
|
31
|
+
* TBD.
|
|
30
32
|
*
|
|
31
|
-
* @param {object} maskData TBD
|
|
32
|
-
* @param {object} renderSession TBD
|
|
33
|
+
* @param {object} maskData - TBD.
|
|
34
|
+
* @param {object} renderSession - TBD.
|
|
33
35
|
*/
|
|
34
36
|
export function popMask(maskData, renderSession) {
|
|
35
37
|
const gl = renderSession.gl;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
|
-
import Rectangle from
|
|
8
|
-
import Point from '../../geom/point';
|
|
9
|
-
import Texture from './texture';
|
|
10
|
-
import BaseTexture from './base_texture';
|
|
7
|
+
import { Rectangle } from '../../geom/rectangle';
|
|
8
|
+
import { Point } from '../../geom/point';
|
|
9
|
+
import { Texture } from './texture';
|
|
10
|
+
import { BaseTexture } from './base_texture';
|
|
11
11
|
import FilterTexture from './filter_texture';
|
|
12
12
|
import CanvasBuffer from '../canvas/buffer';
|
|
13
13
|
import { RENDER_WEBGL } from '../../core/const';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import {
|
|
8
8
|
RENDER_WEBGL,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from '../../core/const';
|
|
28
28
|
import { remove } from '../canvas/pool';
|
|
29
29
|
import { isPowerOfTwo } from '../../util/math';
|
|
30
|
-
import Point from '../../geom/point';
|
|
30
|
+
import { Point } from '../../geom/point';
|
|
31
31
|
import WebGLShaderManager from './shader_manager';
|
|
32
32
|
import WebGLSpriteBatch from './sprite_batch';
|
|
33
33
|
import * as WebGLMaskManager from './mask_manager';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { generateShaderID } from '../../../util/math';
|
|
8
8
|
import { compileProgram } from '../util';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { generateShaderID } from '../../../util/math';
|
|
8
8
|
import { compileProgram } from '../util';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { generateShaderID } from '../../../util/math';
|
|
8
8
|
import { compileProgram } from '../util';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { generateShaderID } from '../../../util/math';
|
|
8
8
|
import { compileProgram } from '../util';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { generateShaderID } from '../../../util/math';
|
|
8
8
|
import { compileProgram } from '../util';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import PrimitiveShader from './shader/primitive';
|
|
8
8
|
import ComplexPrimitiveShader from './shader/complex';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import AbstractFilter from './abstract_filter';
|
|
8
8
|
import NormalShader from './shader/normal';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
import { hex2rgb } from '../../util/math';
|
|
8
8
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module display/webgl/texture
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
6
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
7
|
*/
|
|
7
|
-
import Rectangle from
|
|
8
|
+
import { Rectangle } from '../../geom/rectangle';
|
|
8
9
|
|
|
9
10
|
export class TextureUvs {
|
|
10
11
|
constructor() {
|
|
@@ -19,7 +20,7 @@ export class TextureUvs {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export
|
|
23
|
+
export class Texture {
|
|
23
24
|
constructor(baseTexture, frame, crop, trim) {
|
|
24
25
|
this.noFrame = false;
|
|
25
26
|
if (!frame) {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
|
-
import BaseTexture from './base_texture';
|
|
8
|
-
import Texture from './texture';
|
|
7
|
+
import { BaseTexture } from './base_texture';
|
|
8
|
+
import { Texture } from './texture';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
+
* TBD.
|
|
11
12
|
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {number} scaleMode TBD
|
|
14
|
-
* @returns {object} TBD
|
|
13
|
+
* @param {HTMLCanvasElement} canvas - TBD.
|
|
14
|
+
* @param {number} scaleMode - TBD.
|
|
15
|
+
* @returns {object} TBD.
|
|
15
16
|
*/
|
|
16
17
|
export function baseTextureFromCanvas(canvas, scaleMode) {
|
|
17
18
|
if (canvas.width === 0) {
|
|
@@ -24,10 +25,11 @@ export function baseTextureFromCanvas(canvas, scaleMode) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
28
|
+
* TBD.
|
|
27
29
|
*
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {number} scaleMode TBD
|
|
30
|
-
* @returns {object} TBD
|
|
30
|
+
* @param {HTMLCanvasElement} canvas - TBD.
|
|
31
|
+
* @param {number} scaleMode - TBD.
|
|
32
|
+
* @returns {object} TBD.
|
|
31
33
|
*/
|
|
32
34
|
export function textureFromCanvas(canvas, scaleMode) {
|
|
33
35
|
return new Texture(baseTextureFromCanvas(canvas, scaleMode));
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
3
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
4
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
5
|
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
5
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* TBD.
|
|
10
10
|
*/
|
|
11
11
|
export function initDefaultShaders() {}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
+
* TBD.
|
|
14
15
|
*
|
|
15
|
-
* @param {object} gl TBD
|
|
16
|
-
* @param {string[]|string} shaderSrc TBD
|
|
17
|
-
* @param {object} shaderType TBD
|
|
18
|
-
* @returns {object} TBD
|
|
16
|
+
* @param {object} gl - TBD.
|
|
17
|
+
* @param {string[]|string} shaderSrc - TBD.
|
|
18
|
+
* @param {object} shaderType - TBD.
|
|
19
|
+
* @returns {object} TBD.
|
|
19
20
|
*/
|
|
20
21
|
export function compileShader(gl, shaderSrc, shaderType) {
|
|
21
22
|
let src = shaderSrc;
|
|
@@ -35,31 +36,34 @@ export function compileShader(gl, shaderSrc, shaderType) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
/**
|
|
39
|
+
* TBD.
|
|
38
40
|
*
|
|
39
|
-
* @param {object} gl TBD
|
|
40
|
-
* @param {string[]|string} shaderSrc TBD
|
|
41
|
-
* @returns {object} TBD
|
|
41
|
+
* @param {object} gl - TBD.
|
|
42
|
+
* @param {string[]|string} shaderSrc - TBD.
|
|
43
|
+
* @returns {object} TBD.
|
|
42
44
|
*/
|
|
43
45
|
export function compileVertexShader(gl, shaderSrc) {
|
|
44
46
|
return compileShader(gl, shaderSrc, gl.VERTEX_SHADER);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
/**
|
|
50
|
+
* TBD.
|
|
48
51
|
*
|
|
49
|
-
* @param {object} gl TBD
|
|
50
|
-
* @param {string[]|string} shaderSrc TBD
|
|
51
|
-
* @returns {object} TBD
|
|
52
|
+
* @param {object} gl - TBD.
|
|
53
|
+
* @param {string[]|string} shaderSrc - TBD.
|
|
54
|
+
* @returns {object} TBD.
|
|
52
55
|
*/
|
|
53
56
|
export function compileFragmentShader(gl, shaderSrc) {
|
|
54
57
|
return compileShader(gl, shaderSrc, gl.FRAGMENT_SHADER);
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/**
|
|
61
|
+
* TBD.
|
|
58
62
|
*
|
|
59
|
-
* @param {object} gl TBD
|
|
60
|
-
* @param {string[]|string} vertexSrc TBD
|
|
61
|
-
* @param {string[]|string} fragmentSrc TBD
|
|
62
|
-
* @returns {object} TBD
|
|
63
|
+
* @param {object} gl - TBD.
|
|
64
|
+
* @param {string[]|string} vertexSrc - TBD.
|
|
65
|
+
* @param {string[]|string} fragmentSrc - TBD.
|
|
66
|
+
* @returns {object} TBD.
|
|
63
67
|
*/
|
|
64
68
|
export function compileProgram(gl, vertexSrc, fragmentSrc) {
|
|
65
69
|
const fragmentShader = compileFragmentShader(gl, fragmentSrc);
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/circle
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
-
import Rectangle from
|
|
7
|
+
import { Point } from './point';
|
|
8
|
+
import { Rectangle } from './rectangle';
|
|
8
9
|
import { distance } from '../util/math';
|
|
9
10
|
import { clone, contains, circumferencePoint } from './util/circle';
|
|
10
11
|
import { GEOM_CIRCLE } from '../core/const';
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
+
export class Circle {
|
|
14
|
+
/**
|
|
15
|
+
* TBD.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} x - TBD.
|
|
18
|
+
* @param {number} y - TBD.
|
|
19
|
+
* @param {number} diameter - TBD.
|
|
20
|
+
*/
|
|
13
21
|
constructor(x = 0, y = 0, diameter = 0) {
|
|
14
22
|
this.x = x;
|
|
15
23
|
this.y = y;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/ellipse
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
-
import Rectangle from
|
|
7
|
+
import { Point } from './point';
|
|
8
|
+
import { Rectangle } from './rectangle';
|
|
8
9
|
import { contains } from './util/ellipse';
|
|
9
10
|
import { GEOM_ELLIPSE } from '../core/const';
|
|
10
11
|
|
|
11
|
-
export
|
|
12
|
+
export class Ellipse {
|
|
13
|
+
/**
|
|
14
|
+
* TBD.
|
|
15
|
+
*
|
|
16
|
+
* @param {number} x - TBD.
|
|
17
|
+
* @param {number} y - TBD.
|
|
18
|
+
* @param {number} width - TBD.
|
|
19
|
+
* @param {number} height - TBD.
|
|
20
|
+
*/
|
|
12
21
|
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
13
22
|
this.x = x;
|
|
14
23
|
this.y = y;
|
package/src/phaser/geom/line.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/line
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
+
import { Point } from './point';
|
|
7
8
|
import { clone, intersectsPoints, reflect } from './util/line';
|
|
8
9
|
import { wrap } from '../util/math';
|
|
9
10
|
import { GEOM_LINE } from '../core/const';
|
|
10
11
|
|
|
11
|
-
export
|
|
12
|
+
export class Line {
|
|
13
|
+
/**
|
|
14
|
+
* TBD.
|
|
15
|
+
*
|
|
16
|
+
* @param {number} x1 - TBD.
|
|
17
|
+
* @param {number} y1 - TBD.
|
|
18
|
+
* @param {number} x2 - TBD.
|
|
19
|
+
* @param {number} y2 - TBD.
|
|
20
|
+
*/
|
|
12
21
|
constructor(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
|
|
13
22
|
this.start = new Point(x1, y1);
|
|
14
23
|
this.end = new Point(x2, y2);
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/matrix
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
+
import { Point } from './point';
|
|
7
8
|
import { clone } from './util/matrix';
|
|
8
9
|
import { GEOM_MATRIX } from '../core/const';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
+
export class Matrix {
|
|
12
|
+
/**
|
|
13
|
+
* TBD.
|
|
14
|
+
*
|
|
15
|
+
* @param {number} a - TBD.
|
|
16
|
+
* @param {number} b - TBD.
|
|
17
|
+
* @param {number} c - TBD.
|
|
18
|
+
* @param {number} d - TBD.
|
|
19
|
+
* @param {number} tx - TBD.
|
|
20
|
+
* @param {number} ty - TBD.
|
|
21
|
+
*/
|
|
11
22
|
constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
|
|
12
23
|
this.a = a;
|
|
13
24
|
this.b = b;
|
package/src/phaser/geom/point.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/point
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
7
|
import { distance, rotate, clone } from './util/point';
|
|
7
8
|
import { GEOM_POINT } from '../core/const';
|
|
8
9
|
|
|
9
|
-
export
|
|
10
|
+
export class Point {
|
|
11
|
+
/**
|
|
12
|
+
* TBD.
|
|
13
|
+
*
|
|
14
|
+
* @param {number} x - TBD.
|
|
15
|
+
* @param {number} y - TBD.
|
|
16
|
+
*/
|
|
10
17
|
constructor(x = 0, y = 0) {
|
|
11
18
|
this.x = x;
|
|
12
19
|
this.y = y;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/polygon
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
+
import { Point } from './point';
|
|
7
8
|
import { clone } from './util/polygon';
|
|
8
9
|
import { GEOM_POLYGON } from '../core/const';
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
+
export class Polygon {
|
|
11
12
|
constructor(points = null) {
|
|
12
13
|
this.area = 0;
|
|
13
14
|
this._points = [];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @module geom/rectangle
|
|
3
|
+
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
2
4
|
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
3
5
|
* @author Richard Davey <rich@photonstorm.com>
|
|
4
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
5
6
|
*/
|
|
6
|
-
import Point from './point';
|
|
7
|
+
import { Point } from './point';
|
|
7
8
|
import {
|
|
8
9
|
inflate,
|
|
9
10
|
size,
|
|
@@ -29,7 +30,15 @@ import {
|
|
|
29
30
|
BOTTOM_RIGHT,
|
|
30
31
|
} from '../core/const';
|
|
31
32
|
|
|
32
|
-
export
|
|
33
|
+
export class Rectangle {
|
|
34
|
+
/**
|
|
35
|
+
* TBD.
|
|
36
|
+
*
|
|
37
|
+
* @param {number} x - TBD.
|
|
38
|
+
* @param {number} y - TBD.
|
|
39
|
+
* @param {number} width - TBD.
|
|
40
|
+
* @param {number} height - TBD.
|
|
41
|
+
*/
|
|
33
42
|
constructor(x = 0, y = 0, width = 0, height = 0) {
|
|
34
43
|
this.x = x;
|
|
35
44
|
this.y = y;
|