@vpmedia/phaser 1.11.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.
Files changed (306) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -5
  3. package/src/index.js +19 -19
  4. package/src/phaser/core/animation.js +12 -9
  5. package/src/phaser/core/animation_manager.js +16 -6
  6. package/src/phaser/core/animation_parser.js +40 -17
  7. package/src/phaser/core/array_set.js +3 -5
  8. package/src/phaser/core/cache.js +12 -12
  9. package/src/phaser/core/const.js +1 -1
  10. package/src/phaser/core/device.js +2 -4
  11. package/src/phaser/core/device_util.js +50 -17
  12. package/src/phaser/core/dom.js +36 -27
  13. package/src/phaser/core/event_manager.js +47 -19
  14. package/src/phaser/core/factory.js +34 -12
  15. package/src/phaser/core/frame.js +3 -5
  16. package/src/phaser/core/frame_data.js +2 -4
  17. package/src/phaser/core/frame_util.js +11 -9
  18. package/src/phaser/core/game.js +22 -19
  19. package/src/phaser/core/input.js +24 -16
  20. package/src/phaser/core/input_handler.js +102 -28
  21. package/src/phaser/core/input_mouse.js +12 -16
  22. package/src/phaser/core/input_mspointer.js +11 -10
  23. package/src/phaser/core/input_pointer.js +61 -20
  24. package/src/phaser/core/input_touch.js +7 -9
  25. package/src/phaser/core/loader.js +171 -54
  26. package/src/phaser/core/loader_parser.js +29 -22
  27. package/src/phaser/core/raf.js +2 -4
  28. package/src/phaser/core/scale_manager.js +75 -31
  29. package/src/phaser/core/scene.js +2 -4
  30. package/src/phaser/core/scene_manager.js +9 -6
  31. package/src/phaser/core/signal.js +19 -11
  32. package/src/phaser/core/signal_binding.js +12 -7
  33. package/src/phaser/core/sound.js +23 -14
  34. package/src/phaser/core/sound_manager.js +62 -26
  35. package/src/phaser/core/sound_sprite.js +34 -34
  36. package/src/phaser/core/stage.js +4 -7
  37. package/src/phaser/core/time.js +3 -5
  38. package/src/phaser/core/timer.js +27 -10
  39. package/src/phaser/core/timer_event.js +1 -3
  40. package/src/phaser/core/tween.js +36 -12
  41. package/src/phaser/core/tween_data.js +17 -9
  42. package/src/phaser/core/tween_easing.js +87 -83
  43. package/src/phaser/core/tween_manager.js +34 -16
  44. package/src/phaser/core/world.js +3 -5
  45. package/src/phaser/display/bitmap_text.js +25 -14
  46. package/src/phaser/display/button.js +35 -8
  47. package/src/phaser/display/canvas/buffer.js +1 -3
  48. package/src/phaser/display/canvas/graphics.js +30 -15
  49. package/src/phaser/display/canvas/masker.js +7 -5
  50. package/src/phaser/display/canvas/pool.js +18 -11
  51. package/src/phaser/display/canvas/renderer.js +40 -20
  52. package/src/phaser/display/canvas/tinter.js +61 -19
  53. package/src/phaser/display/canvas/util.js +44 -35
  54. package/src/phaser/display/display_object.js +42 -24
  55. package/src/phaser/display/graphics.js +72 -39
  56. package/src/phaser/display/graphics_data.js +3 -4
  57. package/src/phaser/display/graphics_data_util.js +15 -5
  58. package/src/phaser/display/group.js +15 -9
  59. package/src/phaser/display/image.js +17 -9
  60. package/src/phaser/display/sprite_batch.js +8 -4
  61. package/src/phaser/display/sprite_util.js +67 -26
  62. package/src/phaser/display/text.js +92 -31
  63. package/src/phaser/display/webgl/abstract_filter.js +1 -3
  64. package/src/phaser/display/webgl/base_texture.js +8 -5
  65. package/src/phaser/display/webgl/blend_manager.js +1 -3
  66. package/src/phaser/display/webgl/earcut.js +170 -129
  67. package/src/phaser/display/webgl/earcut_node.js +1 -3
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +48 -47
  69. package/src/phaser/display/webgl/filter_manager.js +1 -3
  70. package/src/phaser/display/webgl/filter_texture.js +17 -6
  71. package/src/phaser/display/webgl/graphics.js +72 -50
  72. package/src/phaser/display/webgl/graphics_data.js +2 -4
  73. package/src/phaser/display/webgl/mask_manager.js +17 -7
  74. package/src/phaser/display/webgl/render_texture.js +19 -10
  75. package/src/phaser/display/webgl/renderer.js +41 -9
  76. package/src/phaser/display/webgl/shader/complex.js +1 -3
  77. package/src/phaser/display/webgl/shader/fast.js +9 -4
  78. package/src/phaser/display/webgl/shader/normal.js +43 -15
  79. package/src/phaser/display/webgl/shader/primitive.js +1 -3
  80. package/src/phaser/display/webgl/shader/strip.js +1 -3
  81. package/src/phaser/display/webgl/shader_manager.js +1 -3
  82. package/src/phaser/display/webgl/sprite_batch.js +14 -15
  83. package/src/phaser/display/webgl/stencil_manager.js +19 -21
  84. package/src/phaser/display/webgl/texture.js +14 -10
  85. package/src/phaser/display/webgl/texture_util.js +11 -9
  86. package/src/phaser/display/webgl/util.js +21 -18
  87. package/src/phaser/geom/circle.js +27 -11
  88. package/src/phaser/geom/ellipse.js +26 -10
  89. package/src/phaser/geom/line.js +31 -13
  90. package/src/phaser/geom/matrix.js +14 -5
  91. package/src/phaser/geom/point.js +18 -13
  92. package/src/phaser/geom/polygon.js +13 -8
  93. package/src/phaser/geom/rectangle.js +57 -14
  94. package/src/phaser/geom/rounded_rectangle.js +12 -4
  95. package/src/phaser/geom/util/circle.js +40 -32
  96. package/src/phaser/geom/util/ellipse.js +10 -18
  97. package/src/phaser/geom/util/line.js +46 -37
  98. package/src/phaser/geom/util/matrix.js +11 -9
  99. package/src/phaser/geom/util/point.js +101 -79
  100. package/src/phaser/geom/util/polygon.js +7 -15
  101. package/src/phaser/geom/util/rectangle.js +95 -69
  102. package/src/phaser/geom/util/rounded_rectangle.js +7 -15
  103. package/src/phaser/util/math.js +123 -89
  104. package/types/global.d.ts +7 -0
  105. package/types/index.d.ts +22 -0
  106. package/types/index.d.ts.map +1 -0
  107. package/types/phaser/core/animation.d.ts +55 -0
  108. package/types/phaser/core/animation.d.ts.map +1 -0
  109. package/types/phaser/core/animation_manager.d.ts +35 -0
  110. package/types/phaser/core/animation_manager.d.ts.map +1 -0
  111. package/types/phaser/core/animation_parser.d.ts +22 -0
  112. package/types/phaser/core/animation_parser.d.ts.map +1 -0
  113. package/types/phaser/core/array_set.d.ts +23 -0
  114. package/types/phaser/core/array_set.d.ts.map +1 -0
  115. package/types/phaser/core/cache.d.ts +106 -0
  116. package/types/phaser/core/cache.d.ts.map +1 -0
  117. package/types/phaser/core/const.d.ts +81 -0
  118. package/types/phaser/core/const.d.ts.map +1 -0
  119. package/types/phaser/core/device.d.ts +36 -0
  120. package/types/phaser/core/device.d.ts.map +1 -0
  121. package/types/phaser/core/device_util.d.ts +58 -0
  122. package/types/phaser/core/device_util.d.ts.map +1 -0
  123. package/types/phaser/core/dom.d.ts +63 -0
  124. package/types/phaser/core/dom.d.ts.map +1 -0
  125. package/types/phaser/core/event_manager.d.ts +53 -0
  126. package/types/phaser/core/event_manager.d.ts.map +1 -0
  127. package/types/phaser/core/factory.d.ts +12 -0
  128. package/types/phaser/core/factory.d.ts.map +1 -0
  129. package/types/phaser/core/frame.d.ts +30 -0
  130. package/types/phaser/core/frame.d.ts.map +1 -0
  131. package/types/phaser/core/frame_data.d.ts +14 -0
  132. package/types/phaser/core/frame_data.d.ts.map +1 -0
  133. package/types/phaser/core/frame_util.d.ts +17 -0
  134. package/types/phaser/core/frame_util.d.ts.map +1 -0
  135. package/types/phaser/core/game.d.ts +57 -0
  136. package/types/phaser/core/game.d.ts.map +1 -0
  137. package/types/phaser/core/input.d.ts +92 -0
  138. package/types/phaser/core/input.d.ts.map +1 -0
  139. package/types/phaser/core/input_handler.d.ts +111 -0
  140. package/types/phaser/core/input_handler.d.ts.map +1 -0
  141. package/types/phaser/core/input_mouse.d.ts +39 -0
  142. package/types/phaser/core/input_mouse.d.ts.map +1 -0
  143. package/types/phaser/core/input_mspointer.d.ts +34 -0
  144. package/types/phaser/core/input_mspointer.d.ts.map +1 -0
  145. package/types/phaser/core/input_pointer.d.ts +68 -0
  146. package/types/phaser/core/input_pointer.d.ts.map +1 -0
  147. package/types/phaser/core/input_touch.d.ts +37 -0
  148. package/types/phaser/core/input_touch.d.ts.map +1 -0
  149. package/types/phaser/core/loader.d.ts +94 -0
  150. package/types/phaser/core/loader.d.ts.map +1 -0
  151. package/types/phaser/core/loader_parser.d.ts +39 -0
  152. package/types/phaser/core/loader_parser.d.ts.map +1 -0
  153. package/types/phaser/core/raf.d.ts +15 -0
  154. package/types/phaser/core/raf.d.ts.map +1 -0
  155. package/types/phaser/core/scale_manager.d.ts +137 -0
  156. package/types/phaser/core/scale_manager.d.ts.map +1 -0
  157. package/types/phaser/core/scene.d.ts +17 -0
  158. package/types/phaser/core/scene.d.ts.map +1 -0
  159. package/types/phaser/core/scene_manager.d.ts +39 -0
  160. package/types/phaser/core/scene_manager.d.ts.map +1 -0
  161. package/types/phaser/core/signal.d.ts +25 -0
  162. package/types/phaser/core/signal.d.ts.map +1 -0
  163. package/types/phaser/core/signal_binding.d.ts +26 -0
  164. package/types/phaser/core/signal_binding.d.ts.map +1 -0
  165. package/types/phaser/core/sound.d.ts +72 -0
  166. package/types/phaser/core/sound.d.ts.map +1 -0
  167. package/types/phaser/core/sound_manager.d.ts +50 -0
  168. package/types/phaser/core/sound_manager.d.ts.map +1 -0
  169. package/types/phaser/core/sound_sprite.d.ts +18 -0
  170. package/types/phaser/core/sound_sprite.d.ts.map +1 -0
  171. package/types/phaser/core/stage.d.ts +23 -0
  172. package/types/phaser/core/stage.d.ts.map +1 -0
  173. package/types/phaser/core/time.d.ts +49 -0
  174. package/types/phaser/core/time.d.ts.map +1 -0
  175. package/types/phaser/core/timer.d.ts +49 -0
  176. package/types/phaser/core/timer.d.ts.map +1 -0
  177. package/types/phaser/core/timer_event.d.ts +18 -0
  178. package/types/phaser/core/timer_event.d.ts.map +1 -0
  179. package/types/phaser/core/tween.d.ts +52 -0
  180. package/types/phaser/core/tween.d.ts.map +1 -0
  181. package/types/phaser/core/tween_data.d.ts +37 -0
  182. package/types/phaser/core/tween_data.d.ts.map +1 -0
  183. package/types/phaser/core/tween_easing.d.ts +192 -0
  184. package/types/phaser/core/tween_easing.d.ts.map +1 -0
  185. package/types/phaser/core/tween_manager.d.ts +94 -0
  186. package/types/phaser/core/tween_manager.d.ts.map +1 -0
  187. package/types/phaser/core/world.d.ts +6 -0
  188. package/types/phaser/core/world.d.ts.map +1 -0
  189. package/types/phaser/display/bitmap_text.d.ts +59 -0
  190. package/types/phaser/display/bitmap_text.d.ts.map +1 -0
  191. package/types/phaser/display/button.d.ts +47 -0
  192. package/types/phaser/display/button.d.ts.map +1 -0
  193. package/types/phaser/display/canvas/buffer.d.ts +11 -0
  194. package/types/phaser/display/canvas/buffer.d.ts.map +1 -0
  195. package/types/phaser/display/canvas/graphics.d.ts +21 -0
  196. package/types/phaser/display/canvas/graphics.d.ts.map +1 -0
  197. package/types/phaser/display/canvas/masker.d.ts +14 -0
  198. package/types/phaser/display/canvas/masker.d.ts.map +1 -0
  199. package/types/phaser/display/canvas/pool.d.ts +52 -0
  200. package/types/phaser/display/canvas/pool.d.ts.map +1 -0
  201. package/types/phaser/display/canvas/renderer.d.ts +28 -0
  202. package/types/phaser/display/canvas/renderer.d.ts.map +1 -0
  203. package/types/phaser/display/canvas/tinter.d.ts +41 -0
  204. package/types/phaser/display/canvas/tinter.d.ts.map +1 -0
  205. package/types/phaser/display/canvas/util.d.ts +79 -0
  206. package/types/phaser/display/canvas/util.d.ts.map +1 -0
  207. package/types/phaser/display/display_object.d.ts +83 -0
  208. package/types/phaser/display/display_object.d.ts.map +1 -0
  209. package/types/phaser/display/graphics.d.ts +60 -0
  210. package/types/phaser/display/graphics.d.ts.map +1 -0
  211. package/types/phaser/display/graphics_data.d.ts +15 -0
  212. package/types/phaser/display/graphics_data.d.ts.map +1 -0
  213. package/types/phaser/display/graphics_data_util.d.ts +8 -0
  214. package/types/phaser/display/graphics_data_util.d.ts.map +1 -0
  215. package/types/phaser/display/group.d.ts +49 -0
  216. package/types/phaser/display/group.d.ts.map +1 -0
  217. package/types/phaser/display/image.d.ts +52 -0
  218. package/types/phaser/display/image.d.ts.map +1 -0
  219. package/types/phaser/display/sprite_batch.d.ts +11 -0
  220. package/types/phaser/display/sprite_batch.d.ts.map +1 -0
  221. package/types/phaser/display/sprite_util.d.ts +40 -0
  222. package/types/phaser/display/sprite_util.d.ts.map +1 -0
  223. package/types/phaser/display/text.d.ts +125 -0
  224. package/types/phaser/display/text.d.ts.map +1 -0
  225. package/types/phaser/display/webgl/abstract_filter.d.ts +17 -0
  226. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -0
  227. package/types/phaser/display/webgl/base_texture.d.ts +20 -0
  228. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -0
  229. package/types/phaser/display/webgl/blend_manager.d.ts +14 -0
  230. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -0
  231. package/types/phaser/display/webgl/earcut.d.ts +215 -0
  232. package/types/phaser/display/webgl/earcut.d.ts.map +1 -0
  233. package/types/phaser/display/webgl/earcut_node.d.ts +19 -0
  234. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -0
  235. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +34 -0
  236. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -0
  237. package/types/phaser/display/webgl/filter_manager.d.ts +21 -0
  238. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -0
  239. package/types/phaser/display/webgl/filter_texture.d.ts +13 -0
  240. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -0
  241. package/types/phaser/display/webgl/graphics.d.ts +80 -0
  242. package/types/phaser/display/webgl/graphics.d.ts.map +1 -0
  243. package/types/phaser/display/webgl/graphics_data.d.ts +23 -0
  244. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -0
  245. package/types/phaser/display/webgl/mask_manager.d.ts +15 -0
  246. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -0
  247. package/types/phaser/display/webgl/render_texture.d.ts +25 -0
  248. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -0
  249. package/types/phaser/display/webgl/renderer.d.ts +44 -0
  250. package/types/phaser/display/webgl/renderer.d.ts.map +1 -0
  251. package/types/phaser/display/webgl/shader/complex.d.ts +22 -0
  252. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -0
  253. package/types/phaser/display/webgl/shader/fast.d.ts +25 -0
  254. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -0
  255. package/types/phaser/display/webgl/shader/normal.d.ts +25 -0
  256. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -0
  257. package/types/phaser/display/webgl/shader/primitive.d.ts +21 -0
  258. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -0
  259. package/types/phaser/display/webgl/shader/strip.d.ts +22 -0
  260. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -0
  261. package/types/phaser/display/webgl/shader_manager.d.ts +24 -0
  262. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -0
  263. package/types/phaser/display/webgl/sprite_batch.d.ts +36 -0
  264. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -0
  265. package/types/phaser/display/webgl/stencil_manager.d.ts +12 -0
  266. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -0
  267. package/types/phaser/display/webgl/texture.d.ts +30 -0
  268. package/types/phaser/display/webgl/texture.d.ts.map +1 -0
  269. package/types/phaser/display/webgl/texture_util.d.ts +17 -0
  270. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -0
  271. package/types/phaser/display/webgl/util.d.ts +45 -0
  272. package/types/phaser/display/webgl/util.d.ts.map +1 -0
  273. package/types/phaser/geom/circle.d.ts +46 -0
  274. package/types/phaser/geom/circle.d.ts.map +1 -0
  275. package/types/phaser/geom/ellipse.d.ts +26 -0
  276. package/types/phaser/geom/ellipse.d.ts.map +1 -0
  277. package/types/phaser/geom/line.d.ts +45 -0
  278. package/types/phaser/geom/line.d.ts.map +1 -0
  279. package/types/phaser/geom/matrix.d.ts +35 -0
  280. package/types/phaser/geom/matrix.d.ts.map +1 -0
  281. package/types/phaser/geom/point.d.ts +43 -0
  282. package/types/phaser/geom/point.d.ts.map +1 -0
  283. package/types/phaser/geom/polygon.d.ts +17 -0
  284. package/types/phaser/geom/polygon.d.ts.map +1 -0
  285. package/types/phaser/geom/rectangle.d.ts +71 -0
  286. package/types/phaser/geom/rectangle.d.ts.map +1 -0
  287. package/types/phaser/geom/rounded_rectangle.d.ts +21 -0
  288. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -0
  289. package/types/phaser/geom/util/circle.d.ts +64 -0
  290. package/types/phaser/geom/util/circle.d.ts.map +1 -0
  291. package/types/phaser/geom/util/ellipse.d.ts +16 -0
  292. package/types/phaser/geom/util/ellipse.d.ts.map +1 -0
  293. package/types/phaser/geom/util/line.d.ts +49 -0
  294. package/types/phaser/geom/util/line.d.ts.map +1 -0
  295. package/types/phaser/geom/util/matrix.d.ts +22 -0
  296. package/types/phaser/geom/util/matrix.d.ts.map +1 -0
  297. package/types/phaser/geom/util/point.d.ts +179 -0
  298. package/types/phaser/geom/util/point.d.ts.map +1 -0
  299. package/types/phaser/geom/util/polygon.d.ts +10 -0
  300. package/types/phaser/geom/util/polygon.d.ts.map +1 -0
  301. package/types/phaser/geom/util/rectangle.d.ts +141 -0
  302. package/types/phaser/geom/util/rectangle.d.ts.map +1 -0
  303. package/types/phaser/geom/util/rounded_rectangle.d.ts +10 -0
  304. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -0
  305. package/types/phaser/util/math.d.ts +182 -0
  306. package/types/phaser/util/math.d.ts.map +1 -0
@@ -1,14 +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
7
 
8
8
  // TODO: fix ++ +=1 conversion issues (when a is 0 than a++ is 0 but a+=1 is 1)
9
9
 
10
10
  export default class {
11
-
12
11
  constructor(gl) {
13
12
  this.vertSize = 10;
14
13
  this.maxSize = 6000; // Math.pow(2, 16) / this.vertSize;
@@ -89,7 +88,10 @@ export default class {
89
88
  return;
90
89
  }
91
90
  // TODO trim??
92
- if (sprite.texture.baseTexture !== this.currentBaseTexture && !sprite.texture.baseTexture.skipRender) {
91
+ if (
92
+ sprite.texture.baseTexture !== this.currentBaseTexture &&
93
+ !sprite.texture.baseTexture.skipRender
94
+ ) {
93
95
  this.flush();
94
96
  this.currentBaseTexture = sprite.texture.baseTexture;
95
97
  if (!sprite.texture._uvs) {
@@ -113,73 +115,73 @@ export default class {
113
115
  h1 = trim.y - sprite.anchor.y * trim.height;
114
116
  h0 = h1 + sprite.texture.crop.height;
115
117
  } else {
116
- w0 = (sprite.texture.frame.width) * (1 - sprite.anchor.x);
117
- w1 = (sprite.texture.frame.width) * -sprite.anchor.x;
118
+ w0 = sprite.texture.frame.width * (1 - sprite.anchor.x);
119
+ w1 = sprite.texture.frame.width * -sprite.anchor.x;
118
120
  h0 = sprite.texture.frame.height * (1 - sprite.anchor.y);
119
121
  h1 = sprite.texture.frame.height * -sprite.anchor.y;
120
122
  }
121
123
  index = this.currentBatchSize * 4 * this.vertSize;
122
124
  index -= 1;
123
125
  // xy
124
- vertices[index += 1] = w1;
125
- vertices[index += 1] = h1;
126
- vertices[index += 1] = sprite.position.x;
127
- vertices[index += 1] = sprite.position.y;
126
+ vertices[(index += 1)] = w1;
127
+ vertices[(index += 1)] = h1;
128
+ vertices[(index += 1)] = sprite.position.x;
129
+ vertices[(index += 1)] = sprite.position.y;
128
130
  // scale
129
- vertices[index += 1] = sprite.scale.x;
130
- vertices[index += 1] = sprite.scale.y;
131
+ vertices[(index += 1)] = sprite.scale.x;
132
+ vertices[(index += 1)] = sprite.scale.y;
131
133
  // rotation
132
- vertices[index += 1] = sprite.rotation;
134
+ vertices[(index += 1)] = sprite.rotation;
133
135
  // uv
134
- vertices[index += 1] = uvs.x0;
135
- vertices[index += 1] = uvs.y1;
136
+ vertices[(index += 1)] = uvs.x0;
137
+ vertices[(index += 1)] = uvs.y1;
136
138
  // color
137
- vertices[index += 1] = sprite.alpha;
139
+ vertices[(index += 1)] = sprite.alpha;
138
140
  // xy
139
- vertices[index += 1] = w0;
140
- vertices[index += 1] = h1;
141
- vertices[index += 1] = sprite.position.x;
142
- vertices[index += 1] = sprite.position.y;
141
+ vertices[(index += 1)] = w0;
142
+ vertices[(index += 1)] = h1;
143
+ vertices[(index += 1)] = sprite.position.x;
144
+ vertices[(index += 1)] = sprite.position.y;
143
145
  // scale
144
- vertices[index += 1] = sprite.scale.x;
145
- vertices[index += 1] = sprite.scale.y;
146
+ vertices[(index += 1)] = sprite.scale.x;
147
+ vertices[(index += 1)] = sprite.scale.y;
146
148
  // rotation
147
- vertices[index += 1] = sprite.rotation;
149
+ vertices[(index += 1)] = sprite.rotation;
148
150
  // uv
149
- vertices[index += 1] = uvs.x1;
150
- vertices[index += 1] = uvs.y1;
151
+ vertices[(index += 1)] = uvs.x1;
152
+ vertices[(index += 1)] = uvs.y1;
151
153
  // color
152
- vertices[index += 1] = sprite.alpha;
154
+ vertices[(index += 1)] = sprite.alpha;
153
155
  // xy
154
- vertices[index += 1] = w0;
155
- vertices[index += 1] = h0;
156
- vertices[index += 1] = sprite.position.x;
157
- vertices[index += 1] = sprite.position.y;
156
+ vertices[(index += 1)] = w0;
157
+ vertices[(index += 1)] = h0;
158
+ vertices[(index += 1)] = sprite.position.x;
159
+ vertices[(index += 1)] = sprite.position.y;
158
160
  // scale
159
- vertices[index += 1] = sprite.scale.x;
160
- vertices[index += 1] = sprite.scale.y;
161
+ vertices[(index += 1)] = sprite.scale.x;
162
+ vertices[(index += 1)] = sprite.scale.y;
161
163
  // rotation
162
- vertices[index += 1] = sprite.rotation;
164
+ vertices[(index += 1)] = sprite.rotation;
163
165
  // uv
164
- vertices[index += 1] = uvs.x2;
165
- vertices[index += 1] = uvs.y2;
166
+ vertices[(index += 1)] = uvs.x2;
167
+ vertices[(index += 1)] = uvs.y2;
166
168
  // color
167
- vertices[index += 1] = sprite.alpha;
169
+ vertices[(index += 1)] = sprite.alpha;
168
170
  // xy
169
- vertices[index += 1] = w1;
170
- vertices[index += 1] = h0;
171
- vertices[index += 1] = sprite.position.x;
172
- vertices[index += 1] = sprite.position.y;
171
+ vertices[(index += 1)] = w1;
172
+ vertices[(index += 1)] = h0;
173
+ vertices[(index += 1)] = sprite.position.x;
174
+ vertices[(index += 1)] = sprite.position.y;
173
175
  // scale
174
- vertices[index += 1] = sprite.scale.x;
175
- vertices[index += 1] = sprite.scale.y;
176
+ vertices[(index += 1)] = sprite.scale.x;
177
+ vertices[(index += 1)] = sprite.scale.y;
176
178
  // rotation
177
- vertices[index += 1] = sprite.rotation;
179
+ vertices[(index += 1)] = sprite.rotation;
178
180
  // uv
179
- vertices[index += 1] = uvs.x3;
180
- vertices[index += 1] = uvs.y3;
181
+ vertices[(index += 1)] = uvs.x3;
182
+ vertices[(index += 1)] = uvs.y3;
181
183
  // color
182
- vertices[index += 1] = sprite.alpha;
184
+ vertices[(index += 1)] = sprite.alpha;
183
185
  // increment the batch
184
186
  this.currentBatchSize += 1;
185
187
  if (this.currentBatchSize >= this.size) {
@@ -199,7 +201,7 @@ export default class {
199
201
  }
200
202
  gl.bindTexture(gl.TEXTURE_2D, this.currentBaseTexture._glTextures[gl.id]);
201
203
  // upload the verts to the buffer
202
- if (this.currentBatchSize > (this.size * 0.5)) {
204
+ if (this.currentBatchSize > this.size * 0.5) {
203
205
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
204
206
  } else {
205
207
  const view = this.vertices.subarray(0, this.currentBatchSize * 4 * this.vertSize);
@@ -238,5 +240,4 @@ export default class {
238
240
  gl.vertexAttribPointer(this.shader.aTextureCoord, 2, gl.FLOAT, false, stride, 7 * 4);
239
241
  gl.vertexAttribPointer(this.shader.colorAttribute, 1, gl.FLOAT, false, stride, 9 * 4);
240
242
  }
241
-
242
243
  }
@@ -1,12 +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
8
  export default class {
9
-
10
9
  constructor() {
11
10
  this.filterStack = [];
12
11
  this.offsetX = 0;
@@ -42,5 +41,4 @@ export default class {
42
41
  destroy() {
43
42
  // TODO
44
43
  }
45
-
46
44
  }
@@ -1,21 +1,28 @@
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 { SCALE_LINEAR } from '../../core/const';
8
8
 
9
9
  export default class {
10
-
11
10
  constructor(gl, width, height, scaleMode) {
12
11
  this.gl = gl;
13
12
  this.frameBuffer = gl.createFramebuffer();
14
13
  this.texture = gl.createTexture();
15
14
  scaleMode = scaleMode || window.PhaserRegistry.TEXTURE_SCALE_MODE;
16
15
  gl.bindTexture(gl.TEXTURE_2D, this.texture);
17
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST);
18
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST);
16
+ gl.texParameteri(
17
+ gl.TEXTURE_2D,
18
+ gl.TEXTURE_MAG_FILTER,
19
+ scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST
20
+ );
21
+ gl.texParameteri(
22
+ gl.TEXTURE_2D,
23
+ gl.TEXTURE_MIN_FILTER,
24
+ scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST
25
+ );
19
26
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
20
27
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
21
28
  gl.bindFramebuffer(gl.FRAMEBUFFER, this.frameBuffer);
@@ -24,7 +31,12 @@ export default class {
24
31
  // required for masking a mask??
25
32
  this.renderBuffer = gl.createRenderbuffer();
26
33
  gl.bindRenderbuffer(gl.RENDERBUFFER, this.renderBuffer);
27
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, this.renderBuffer);
34
+ gl.framebufferRenderbuffer(
35
+ gl.FRAMEBUFFER,
36
+ gl.DEPTH_STENCIL_ATTACHMENT,
37
+ gl.RENDERBUFFER,
38
+ this.renderBuffer
39
+ );
28
40
  this.resize(width, height);
29
41
  }
30
42
 
@@ -57,5 +69,4 @@ export default class {
57
69
  this.renderBuffer = null;
58
70
  this.gl = null;
59
71
  }
60
-
61
72
  }
@@ -1,19 +1,25 @@
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 './graphics_data';
8
- import Point from '../../geom/point';
9
- import { GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_POLYGON, GEOM_RECTANGLE, GEOM_ROUNDED_RECTANGLE } from '../../core/const';
7
+ import { GraphicsData } from './graphics_data';
8
+ import { Point } from '../../geom/point';
9
+ import {
10
+ GEOM_CIRCLE,
11
+ GEOM_ELLIPSE,
12
+ GEOM_POLYGON,
13
+ GEOM_RECTANGLE,
14
+ GEOM_ROUNDED_RECTANGLE,
15
+ } from '../../core/const';
10
16
  import { hex2rgb } from '../../util/math';
11
17
  import { triangulate } from './earcut';
12
18
 
13
19
  /**
14
- * TBD
20
+ * TBD.
15
21
  *
16
- * @returns {number} TBD
22
+ * @returns {number} TBD.
17
23
  */
18
24
  export function getStencilBufferLimit() {
19
25
  if (!window.PhaserRegistry.stencilBufferLimit) {
@@ -23,9 +29,9 @@ export function getStencilBufferLimit() {
23
29
  }
24
30
 
25
31
  /**
26
- * TBD
32
+ * TBD.
27
33
  *
28
- * @returns {object[]} TBD
34
+ * @returns {object[]} TBD.
29
35
  */
30
36
  export function getGraphicsDataPool() {
31
37
  if (!window.PhaserRegistry.graphicsDataPool) {
@@ -36,9 +42,9 @@ export function getGraphicsDataPool() {
36
42
 
37
43
  /**
38
44
  *
39
- * @param {object} webGL TBD
40
- * @param {number} type TBD
41
- * @returns {object} TBD
45
+ * @param {object} webGL - TBD.
46
+ * @param {number} type - TBD.
47
+ * @returns {object} TBD.
42
48
  */
43
49
  export function switchMode(webGL, type) {
44
50
  let webGLData;
@@ -60,8 +66,8 @@ export function switchMode(webGL, type) {
60
66
 
61
67
  /**
62
68
  *
63
- * @param {object} graphicsData TBD
64
- * @param {object} webGLData TBD
69
+ * @param {object} graphicsData - TBD.
70
+ * @param {object} webGLData - TBD.
65
71
  */
66
72
  export function buildLine(graphicsData, webGLData) {
67
73
  // TODO OPTIMISE!
@@ -133,7 +139,7 @@ export function buildLine(graphicsData, webGLData) {
133
139
  p2y = points[3];
134
140
  perpx = -(p1y - p2y);
135
141
  perpy = p1x - p2x;
136
- dist = Math.sqrt((perpx * perpx) + (perpy * perpy));
142
+ dist = Math.sqrt(perpx * perpx + perpy * perpy);
137
143
  perpx /= dist;
138
144
  perpy /= dist;
139
145
  perpx *= width;
@@ -144,13 +150,13 @@ export function buildLine(graphicsData, webGLData) {
144
150
  for (i = 1; i < length - 1; i += 1) {
145
151
  p1x = points[(i - 1) * 2];
146
152
  p1y = points[(i - 1) * 2 + 1];
147
- p2x = points[(i) * 2];
148
- p2y = points[(i) * 2 + 1];
153
+ p2x = points[i * 2];
154
+ p2y = points[i * 2 + 1];
149
155
  p3x = points[(i + 1) * 2];
150
156
  p3y = points[(i + 1) * 2 + 1];
151
157
  perpx = -(p1y - p2y);
152
158
  perpy = p1x - p2x;
153
- dist = Math.sqrt((perpx * perpx) + (perpy * perpy));
159
+ dist = Math.sqrt(perpx * perpx + perpy * perpy);
154
160
  perpx /= dist;
155
161
  perpy /= dist;
156
162
  perpx *= width;
@@ -162,13 +168,13 @@ export function buildLine(graphicsData, webGLData) {
162
168
  perp2y /= dist;
163
169
  perp2x *= width;
164
170
  perp2y *= width;
165
- a1 = (-perpy + p1y) - (-perpy + p2y);
166
- b1 = (-perpx + p2x) - (-perpx + p1x);
171
+ a1 = -perpy + p1y - (-perpy + p2y);
172
+ b1 = -perpx + p2x - (-perpx + p1x);
167
173
  c1 = (-perpx + p1x) * (-perpy + p2y) - (-perpx + p2x) * (-perpy + p1y);
168
- a2 = (-perp2y + p3y) - (-perp2y + p2y);
169
- b2 = (-perp2x + p2x) - (-perp2x + p3x);
174
+ a2 = -perp2y + p3y - (-perp2y + p2y);
175
+ b2 = -perp2x + p2x - (-perp2x + p3x);
170
176
  c2 = (-perp2x + p3x) * (-perp2y + p2y) - (-perp2x + p2x) * (-perp2y + p3y);
171
- denom = (a1 * b2) - (a2 * b1);
177
+ denom = a1 * b2 - a2 * b1;
172
178
  if (Math.abs(denom) < 0.1) {
173
179
  denom += 10.1;
174
180
  verts.push(p2x - perpx, p2y - perpy, r, g, b, alpha);
@@ -206,7 +212,7 @@ export function buildLine(graphicsData, webGLData) {
206
212
  p2y = points[(length - 1) * 2 + 1];
207
213
  perpx = -(p1y - p2y);
208
214
  perpy = p1x - p2x;
209
- dist = Math.sqrt((perpx * perpx) + (perpy * perpy));
215
+ dist = Math.sqrt(perpx * perpx + perpy * perpy);
210
216
  perpx /= dist;
211
217
  perpy /= dist;
212
218
  perpx *= width;
@@ -225,8 +231,8 @@ export function buildLine(graphicsData, webGLData) {
225
231
 
226
232
  /**
227
233
  *
228
- * @param {object} graphicsData TBD
229
- * @param {object} webGLData TBD
234
+ * @param {object} graphicsData - TBD.
235
+ * @param {object} webGLData - TBD.
230
236
  */
231
237
  export function buildRectangle(graphicsData, webGLData) {
232
238
  //
@@ -269,13 +275,13 @@ export function buildRectangle(graphicsData, webGLData) {
269
275
 
270
276
  /**
271
277
  *
272
- * @param {number} fromX TBD
273
- * @param {number} fromY TBD
274
- * @param {number} cpX TBD
275
- * @param {number} cpY TBD
276
- * @param {number} toX TBD
277
- * @param {number} toY TBD
278
- * @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.
279
285
  */
280
286
  export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
281
287
  let xa;
@@ -288,7 +294,7 @@ export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
288
294
  const points = [];
289
295
  const getPt = (n1, n2, perc) => {
290
296
  const diff = n2 - n1;
291
- return n1 + (diff * perc);
297
+ return n1 + diff * perc;
292
298
  };
293
299
  let j = 0;
294
300
  for (let i = 0; i <= n; i += 1) {
@@ -308,8 +314,8 @@ export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
308
314
 
309
315
  /**
310
316
  *
311
- * @param {object} graphicsData TBD
312
- * @param {object} webGLData TBD
317
+ * @param {object} graphicsData - TBD.
318
+ * @param {object} webGLData - TBD.
313
319
  */
314
320
  export function buildRoundedRectangle(graphicsData, webGLData) {
315
321
  const rrectData = graphicsData.shape;
@@ -320,9 +326,22 @@ export function buildRoundedRectangle(graphicsData, webGLData) {
320
326
  const radius = rrectData.radius;
321
327
  let recPoints = [];
322
328
  recPoints.push(x, y + radius);
323
- recPoints = recPoints.concat(quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height));
324
- recPoints = recPoints.concat(quadraticBezierCurve(x + width - radius, y + height, x + width, y + height, x + width, y + height - radius));
325
- recPoints = recPoints.concat(quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y));
329
+ recPoints = recPoints.concat(
330
+ quadraticBezierCurve(x, y + height - radius, x, y + height, x + radius, y + height)
331
+ );
332
+ recPoints = recPoints.concat(
333
+ quadraticBezierCurve(
334
+ x + width - radius,
335
+ y + height,
336
+ x + width,
337
+ y + height,
338
+ x + width,
339
+ y + height - radius
340
+ )
341
+ );
342
+ recPoints = recPoints.concat(
343
+ quadraticBezierCurve(x + width, y + radius, x + width, y, x + width - radius, y)
344
+ );
326
345
  recPoints = recPoints.concat(quadraticBezierCurve(x + radius, y, x, y, x, y + radius));
327
346
  if (graphicsData.fill) {
328
347
  const color = hex2rgb(graphicsData.fillColor);
@@ -356,8 +375,8 @@ export function buildRoundedRectangle(graphicsData, webGLData) {
356
375
 
357
376
  /**
358
377
  *
359
- * @param {object} graphicsData TBD
360
- * @param {object} webGLData TBD
378
+ * @param {object} graphicsData - TBD.
379
+ * @param {object} webGLData - TBD.
361
380
  */
362
381
  export function buildCircle(graphicsData, webGLData) {
363
382
  // need to convert points to a nice regular data
@@ -407,8 +426,8 @@ export function buildCircle(graphicsData, webGLData) {
407
426
 
408
427
  /**
409
428
  *
410
- * @param {object} graphicsData TBD
411
- * @param {object} webGLData TBD
429
+ * @param {object} graphicsData - TBD.
430
+ * @param {object} webGLData - TBD.
412
431
  */
413
432
  export function buildComplexPoly(graphicsData, webGLData) {
414
433
  // TODO - no need to copy this as it gets turned into a Float32Array anyways..
@@ -451,9 +470,9 @@ export function buildComplexPoly(graphicsData, webGLData) {
451
470
 
452
471
  /**
453
472
  *
454
- * @param {object} graphicsData TBD
455
- * @param {object} webGLData TBD
456
- * @returns {boolean} TBD
473
+ * @param {object} graphicsData - TBD.
474
+ * @param {object} webGLData - TBD.
475
+ * @returns {boolean} TBD.
457
476
  */
458
477
  export function buildPoly(graphicsData, webGLData) {
459
478
  const points = graphicsData.points;
@@ -490,8 +509,8 @@ export function buildPoly(graphicsData, webGLData) {
490
509
 
491
510
  /**
492
511
  *
493
- * @param {object} graphics TBD
494
- * @param {object} gl TBD
512
+ * @param {object} graphics - TBD.
513
+ * @param {object} gl - TBD.
495
514
  */
496
515
  export function updateGraphics(graphics, gl) {
497
516
  const stencilBufferLimit = getStencilBufferLimit();
@@ -529,7 +548,10 @@ export function updateGraphics(graphics, gl) {
529
548
  data.points = data.shape.points.slice();
530
549
  if (data.shape.closed) {
531
550
  // close the poly if the value is true!
532
- if (data.points[0] !== data.points[data.points.length - 2] || data.points[1] !== data.points[data.points.length - 1]) {
551
+ if (
552
+ data.points[0] !== data.points[data.points.length - 2] ||
553
+ data.points[1] !== data.points[data.points.length - 1]
554
+ ) {
533
555
  data.points.push(data.points[0], data.points[1]);
534
556
  }
535
557
  }
@@ -576,8 +598,8 @@ export function updateGraphics(graphics, gl) {
576
598
 
577
599
  /**
578
600
  *
579
- * @param {object} graphics TBD
580
- * @param {object} renderSession TBD
601
+ * @param {object} graphics - TBD.
602
+ * @param {object} renderSession - TBD.
581
603
  */
582
604
  export function renderGraphics(graphics, renderSession) {
583
605
  const gl = renderSession.gl;
@@ -1,12 +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 default class {
9
-
8
+ export class GraphicsData {
10
9
  constructor(gl) {
11
10
  this.gl = gl;
12
11
  // TODO does this need to be split before uploading??
@@ -38,5 +37,4 @@ export default class {
38
37
  gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.glIndicies, gl.STATIC_DRAW);
39
38
  this.dirty = false;
40
39
  }
41
-
42
40
  }
@@ -1,35 +1,45 @@
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;
16
17
  if (maskData.dirty) {
17
18
  updateGraphics(maskData, gl);
18
19
  }
19
- if (maskData._webGL[gl.id] === undefined || maskData._webGL[gl.id].data === undefined || maskData._webGL[gl.id].data.length === 0) {
20
+ if (
21
+ maskData._webGL[gl.id] === undefined ||
22
+ maskData._webGL[gl.id].data === undefined ||
23
+ maskData._webGL[gl.id].data.length === 0
24
+ ) {
20
25
  return;
21
26
  }
22
27
  renderSession.stencilManager.pushStencil(maskData, maskData._webGL[gl.id].data[0], renderSession);
23
28
  }
24
29
 
25
30
  /**
31
+ * TBD.
26
32
  *
27
- * @param {object} maskData TBD
28
- * @param {object} renderSession TBD
33
+ * @param {object} maskData - TBD.
34
+ * @param {object} renderSession - TBD.
29
35
  */
30
36
  export function popMask(maskData, renderSession) {
31
37
  const gl = renderSession.gl;
32
- if (maskData._webGL[gl.id] === undefined || maskData._webGL[gl.id].data === undefined || maskData._webGL[gl.id].data.length === 0) {
38
+ if (
39
+ maskData._webGL[gl.id] === undefined ||
40
+ maskData._webGL[gl.id].data === undefined ||
41
+ maskData._webGL[gl.id].data.length === 0
42
+ ) {
33
43
  return;
34
44
  }
35
45
  renderSession.stencilManager.popStencil(maskData, maskData._webGL[gl.id].data[0], renderSession);
@@ -1,24 +1,26 @@
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 '../../geom/rectangle';
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';
14
14
 
15
15
  export default class extends Texture {
16
-
17
16
  constructor(width, height, renderer, scaleMode, resolution = 1) {
18
17
  const w = width || 100;
19
18
  const h = height || 100;
20
19
  const res = resolution || 1;
21
- const baseTexture = new BaseTexture(null, scaleMode || window.PhaserRegistry.TEXTURE_SCALE_MODE);
20
+ const baseTexture = new BaseTexture(
21
+ null,
22
+ scaleMode || window.PhaserRegistry.TEXTURE_SCALE_MODE
23
+ );
22
24
  baseTexture.width = width * res;
23
25
  baseTexture.height = height * res;
24
26
  baseTexture._glTextures = [];
@@ -35,13 +37,21 @@ export default class extends Texture {
35
37
  if (this.renderer.type === RENDER_WEBGL) {
36
38
  const gl = this.renderer.gl;
37
39
  this.baseTexture._dirty[gl.id] = false;
38
- this.textureBuffer = new FilterTexture(gl, this.width, this.height, this.baseTexture.scaleMode);
40
+ this.textureBuffer = new FilterTexture(
41
+ gl,
42
+ this.width,
43
+ this.height,
44
+ this.baseTexture.scaleMode
45
+ );
39
46
  this.baseTexture._glTextures[gl.id] = this.textureBuffer.texture;
40
47
  this.render = this.renderWebGL;
41
48
  this.projection = new Point(this.width * 0.5, -this.height * 0.5);
42
49
  } else {
43
50
  this.render = this.renderCanvas;
44
- this.textureBuffer = new CanvasBuffer(this.width * this.resolution, this.height * this.resolution);
51
+ this.textureBuffer = new CanvasBuffer(
52
+ this.width * this.resolution,
53
+ this.height * this.resolution
54
+ );
45
55
  this.baseTexture.source = this.textureBuffer.canvas;
46
56
  }
47
57
  this.valid = true;
@@ -77,5 +87,4 @@ export default class extends Texture {
77
87
  getCanvas() {
78
88
  // TODO
79
89
  }
80
-
81
90
  }