@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,13 +1,33 @@
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 { RENDER_WEBGL, SCALE_LINEAR, BLEND_NORMAL, BLEND_ADD, BLEND_MULTIPLY, BLEND_SCREEN, BLEND_OVERLAY, BLEND_DARKEN, BLEND_LIGHTEN, BLEND_COLOR_DODGE, BLEND_COLOR_BURN, BLEND_HARD_LIGHT, BLEND_SOFT_LIGHT, BLEND_DIFFERENCE, BLEND_EXCLUSION, BLEND_HUE, BLEND_SATURATION, BLEND_COLOR, BLEND_LUMINOSITY } from '../../core/const';
7
+ import {
8
+ RENDER_WEBGL,
9
+ SCALE_LINEAR,
10
+ BLEND_NORMAL,
11
+ BLEND_ADD,
12
+ BLEND_MULTIPLY,
13
+ BLEND_SCREEN,
14
+ BLEND_OVERLAY,
15
+ BLEND_DARKEN,
16
+ BLEND_LIGHTEN,
17
+ BLEND_COLOR_DODGE,
18
+ BLEND_COLOR_BURN,
19
+ BLEND_HARD_LIGHT,
20
+ BLEND_SOFT_LIGHT,
21
+ BLEND_DIFFERENCE,
22
+ BLEND_EXCLUSION,
23
+ BLEND_HUE,
24
+ BLEND_SATURATION,
25
+ BLEND_COLOR,
26
+ BLEND_LUMINOSITY,
27
+ } from '../../core/const';
8
28
  import { remove } from '../canvas/pool';
9
29
  import { isPowerOfTwo } from '../../util/math';
10
- import Point from '../../geom/point';
30
+ import { Point } from '../../geom/point';
11
31
  import WebGLShaderManager from './shader_manager';
12
32
  import WebGLSpriteBatch from './sprite_batch';
13
33
  import * as WebGLMaskManager from './mask_manager';
@@ -16,7 +36,6 @@ import WebGLStencilManager from './stencil_manager';
16
36
  import WebGLBlendModeManager from './blend_manager';
17
37
 
18
38
  export default class {
19
-
20
39
  constructor(game) {
21
40
  this.type = RENDER_WEBGL;
22
41
  this.resolution = game.config.resolution;
@@ -94,7 +113,9 @@ export default class {
94
113
  }
95
114
 
96
115
  initContext() {
97
- const gl = this.view.getContext('webgl', this._contextOptions) || this.view.getContext('experimental-webgl', this._contextOptions);
116
+ const gl =
117
+ this.view.getContext('webgl', this._contextOptions) ||
118
+ this.view.getContext('experimental-webgl', this._contextOptions);
98
119
  this.gl = gl;
99
120
  if (!gl) {
100
121
  // fail, not able to get a context
@@ -184,12 +205,24 @@ export default class {
184
205
  gl.bindTexture(gl.TEXTURE_2D, texture._glTextures[gl.id]);
185
206
  gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultipliedAlpha);
186
207
  gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture.source);
187
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST);
208
+ gl.texParameteri(
209
+ gl.TEXTURE_2D,
210
+ gl.TEXTURE_MAG_FILTER,
211
+ texture.scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST
212
+ );
188
213
  if (texture.mipmap && isPowerOfTwo(texture.width, texture.height)) {
189
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);
214
+ gl.texParameteri(
215
+ gl.TEXTURE_2D,
216
+ gl.TEXTURE_MIN_FILTER,
217
+ texture.scaleMode === SCALE_LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST
218
+ );
190
219
  gl.generateMipmap(gl.TEXTURE_2D);
191
220
  } else {
192
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST);
221
+ gl.texParameteri(
222
+ gl.TEXTURE_2D,
223
+ gl.TEXTURE_MIN_FILTER,
224
+ texture.scaleMode === SCALE_LINEAR ? gl.LINEAR : gl.NEAREST
225
+ );
193
226
  }
194
227
  if (!texture._powerOf2) {
195
228
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
@@ -228,5 +261,4 @@ export default class {
228
261
  b[BLEND_LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];
229
262
  window.PhaserRegistry.blendModesWebGL = b;
230
263
  }
231
-
232
264
  }
@@ -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';
@@ -10,7 +10,6 @@ import { compileProgram } from '../util';
10
10
  // the next one is used for rendering triangle strips
11
11
 
12
12
  export default class {
13
-
14
13
  constructor(gl) {
15
14
  this.gl = gl;
16
15
  this._UID = generateShaderID();
@@ -70,5 +69,4 @@ export default class {
70
69
  this.gl = null;
71
70
  this.attribute = null;
72
71
  }
73
-
74
72
  }
@@ -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';
@@ -10,7 +10,6 @@ import { compileProgram } from '../util';
10
10
  // this shader is used for the fast sprite rendering
11
11
 
12
12
  export default class {
13
-
14
13
  constructor(gl) {
15
14
  this.gl = gl;
16
15
  this._UID = generateShaderID();
@@ -82,7 +81,14 @@ export default class {
82
81
  if (this.colorAttribute === -1) {
83
82
  this.colorAttribute = 2;
84
83
  }
85
- this.attributes = [this.aVertexPosition, this.aPositionCoord, this.aScale, this.aRotation, this.aTextureCoord, this.colorAttribute];
84
+ this.attributes = [
85
+ this.aVertexPosition,
86
+ this.aPositionCoord,
87
+ this.aScale,
88
+ this.aRotation,
89
+ this.aTextureCoord,
90
+ this.colorAttribute,
91
+ ];
86
92
  // End worst hack eva //
87
93
  this.program = program;
88
94
  }
@@ -93,5 +99,4 @@ export default class {
93
99
  this.gl = null;
94
100
  this.attributes = null;
95
101
  }
96
-
97
102
  }
@@ -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';
@@ -30,7 +30,6 @@ const defaultVertexSrc = [
30
30
  // this shader is used for the default sprite rendering
31
31
 
32
32
  export default class {
33
-
34
33
  constructor(gl) {
35
34
  this.gl = gl;
36
35
  this._UID = generateShaderID();
@@ -144,26 +143,43 @@ export default class {
144
143
  // KeyTexture = whatever + luminance + width 256, height 2, border 0
145
144
  // magFilter can be: gl.LINEAR, gl.LINEAR_MIPMAP_LINEAR or gl.NEAREST
146
145
  // wrapS/T can be: gl.CLAMP_TO_EDGE or gl.REPEAT
147
- const magFilter = (data.magFilter) ? data.magFilter : gl.LINEAR;
148
- const minFilter = (data.minFilter) ? data.minFilter : gl.LINEAR;
149
- let wrapS = (data.wrapS) ? data.wrapS : gl.CLAMP_TO_EDGE;
150
- let wrapT = (data.wrapT) ? data.wrapT : gl.CLAMP_TO_EDGE;
151
- const format = (data.luminance) ? gl.LUMINANCE : gl.RGBA;
146
+ const magFilter = data.magFilter ? data.magFilter : gl.LINEAR;
147
+ const minFilter = data.minFilter ? data.minFilter : gl.LINEAR;
148
+ let wrapS = data.wrapS ? data.wrapS : gl.CLAMP_TO_EDGE;
149
+ let wrapT = data.wrapT ? data.wrapT : gl.CLAMP_TO_EDGE;
150
+ const format = data.luminance ? gl.LUMINANCE : gl.RGBA;
152
151
  if (data.repeat) {
153
152
  wrapS = gl.REPEAT;
154
153
  wrapT = gl.REPEAT;
155
154
  }
156
155
  gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, !!data.flipY);
157
156
  if (data.width) {
158
- const width = (data.width) ? data.width : 512;
159
- const height = (data.height) ? data.height : 2;
160
- const border = (data.border) ? data.border : 0;
157
+ const width = data.width ? data.width : 512;
158
+ const height = data.height ? data.height : 2;
159
+ const border = data.border ? data.border : 0;
161
160
 
162
161
  // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView? pixels);
163
- gl.texImage2D(gl.TEXTURE_2D, 0, format, width, height, border, format, gl.UNSIGNED_BYTE, null);
162
+ gl.texImage2D(
163
+ gl.TEXTURE_2D,
164
+ 0,
165
+ format,
166
+ width,
167
+ height,
168
+ border,
169
+ format,
170
+ gl.UNSIGNED_BYTE,
171
+ null
172
+ );
164
173
  } else {
165
174
  // void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData? pixels);
166
- gl.texImage2D(gl.TEXTURE_2D, 0, format, gl.RGBA, gl.UNSIGNED_BYTE, uniform.value.baseTexture.source);
175
+ gl.texImage2D(
176
+ gl.TEXTURE_2D,
177
+ 0,
178
+ format,
179
+ gl.RGBA,
180
+ gl.UNSIGNED_BYTE,
181
+ uniform.value.baseTexture.source
182
+ );
167
183
  }
168
184
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter);
169
185
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
@@ -193,9 +209,22 @@ export default class {
193
209
  } else if (uniform.glValueLength === 2) {
194
210
  uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y);
195
211
  } else if (uniform.glValueLength === 3) {
196
- uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z);
212
+ uniform.glFunc.call(
213
+ gl,
214
+ uniform.uniformLocation,
215
+ uniform.value.x,
216
+ uniform.value.y,
217
+ uniform.value.z
218
+ );
197
219
  } else if (uniform.glValueLength === 4) {
198
- uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z, uniform.value.w);
220
+ uniform.glFunc.call(
221
+ gl,
222
+ uniform.uniformLocation,
223
+ uniform.value.x,
224
+ uniform.value.y,
225
+ uniform.value.z,
226
+ uniform.value.w
227
+ );
199
228
  } else if (uniform.type === 'sampler2D') {
200
229
  if (uniform._init) {
201
230
  gl.activeTexture(gl['TEXTURE' + this.textureCount]);
@@ -221,5 +250,4 @@ export default class {
221
250
  this.gl = null;
222
251
  this.attributes = null;
223
252
  }
224
-
225
253
  }
@@ -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';
@@ -10,7 +10,6 @@ import { compileProgram } from '../util';
10
10
  // the next one is used for rendering primitives
11
11
 
12
12
  export default class {
13
-
14
13
  constructor(gl) {
15
14
  this.gl = gl;
16
15
  this._UID = generateShaderID();
@@ -68,5 +67,4 @@ export default class {
68
67
  this.gl = null;
69
68
  this.attributes = null;
70
69
  }
71
-
72
70
  }
@@ -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';
@@ -10,7 +10,6 @@ import { compileProgram } from '../util';
10
10
  // the next one is used for rendering triangle strips
11
11
 
12
12
  export default class {
13
-
14
13
  constructor(gl) {
15
14
  this.gl = gl;
16
15
  this._UID = generateShaderID();
@@ -73,5 +72,4 @@ export default class {
73
72
  this.gl = null;
74
73
  this.attribute = null;
75
74
  }
76
-
77
75
  }
@@ -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';
@@ -11,7 +11,6 @@ import FastShader from './shader/fast';
11
11
  import StripShader from './shader/strip';
12
12
 
13
13
  export default class {
14
-
15
14
  constructor() {
16
15
  this.gl = null;
17
16
  this.primitiveShader = null;
@@ -85,5 +84,4 @@ export default class {
85
84
  this.stripShader.destroy();
86
85
  this.gl = null;
87
86
  }
88
-
89
87
  }
@@ -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';
@@ -10,7 +10,6 @@ import NormalShader from './shader/normal';
10
10
  // TODO: fix ++ +=1 conversion issues (when a is 0 than a++ is 0 but a+=1 is 1)
11
11
 
12
12
  export default class {
13
-
14
13
  constructor() {
15
14
  this.vertSize = 5;
16
15
  this.size = 2000; // Math.pow(2, 16) / this.vertSize;
@@ -111,8 +110,8 @@ export default class {
111
110
  h1 = trim.y - aY * trim.height;
112
111
  h0 = h1 + texture.crop.height;
113
112
  } else {
114
- w0 = (texture.frame.width) * (1 - aX);
115
- w1 = (texture.frame.width) * -aX;
113
+ w0 = texture.frame.width * (1 - aX);
114
+ w1 = texture.frame.width * -aX;
116
115
  h0 = texture.frame.height * (1 - aY);
117
116
  h1 = texture.frame.height * -aY;
118
117
  }
@@ -128,17 +127,17 @@ export default class {
128
127
  const positions = this.positions;
129
128
  if (this.renderSession.roundPixels) {
130
129
  // xy
131
- positions[i] = a * w1 + c * h1 + tx | 0;
132
- positions[i + 1] = d * h1 + b * w1 + ty | 0;
130
+ positions[i] = (a * w1 + c * h1 + tx) | 0;
131
+ positions[i + 1] = (d * h1 + b * w1 + ty) | 0;
133
132
  // xy
134
- positions[i + 5] = a * w0 + c * h1 + tx | 0;
135
- positions[i + 6] = d * h1 + b * w0 + ty | 0;
133
+ positions[i + 5] = (a * w0 + c * h1 + tx) | 0;
134
+ positions[i + 6] = (d * h1 + b * w0 + ty) | 0;
136
135
  // xy
137
- positions[i + 10] = a * w0 + c * h0 + tx | 0;
138
- positions[i + 11] = d * h0 + b * w0 + ty | 0;
136
+ positions[i + 10] = (a * w0 + c * h0 + tx) | 0;
137
+ positions[i + 11] = (d * h0 + b * w0 + ty) | 0;
139
138
  // xy
140
- positions[i + 15] = a * w1 + c * h0 + tx | 0;
141
- positions[i + 16] = d * h0 + b * w1 + ty | 0;
139
+ positions[i + 15] = (a * w1 + c * h0 + tx) | 0;
140
+ positions[i + 16] = (d * h0 + b * w1 + ty) | 0;
142
141
  } else {
143
142
  // xy
144
143
  positions[i] = a * w1 + c * h1 + tx;
@@ -167,7 +166,8 @@ export default class {
167
166
  positions[i + 18] = uvs.y3;
168
167
  // color and alpha
169
168
  const tint = sprite.tint;
170
- colors[i + 4] = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + (sprite.worldAlpha * 255 << 24);
169
+ colors[i + 4] =
170
+ (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + ((sprite.worldAlpha * 255) << 24);
171
171
  colors[i + 9] = colors[i + 4];
172
172
  colors[i + 14] = colors[i + 4];
173
173
  colors[i + 19] = colors[i + 4];
@@ -203,7 +203,7 @@ export default class {
203
203
  gl.vertexAttribPointer(shader.colorAttribute, 4, gl.UNSIGNED_BYTE, true, stride, 4 * 4);
204
204
  }
205
205
  // upload the verts to the buffer
206
- if (this.currentBatchSize > (this.size * 0.5)) {
206
+ if (this.currentBatchSize > this.size * 0.5) {
207
207
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
208
208
  } else {
209
209
  const view = this.positions.subarray(0, this.currentBatchSize * 4 * this.vertSize);
@@ -316,5 +316,4 @@ export default class {
316
316
  this.currentBaseTexture = null;
317
317
  this.gl = null;
318
318
  }
319
-
320
319
  }
@@ -1,13 +1,12 @@
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
 
9
9
  export default class {
10
-
11
10
  constructor() {
12
11
  this.stencilStack = [];
13
12
  this.reverse = true;
@@ -35,39 +34,39 @@ export default class {
35
34
  this.stencilStack.push(webGLData);
36
35
  const level = this.count;
37
36
  gl.colorMask(false, false, false, false);
38
- gl.stencilFunc(gl.ALWAYS, 0, 0xFF);
37
+ gl.stencilFunc(gl.ALWAYS, 0, 0xff);
39
38
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INVERT);
40
39
  // draw the triangle strip!
41
40
  if (webGLData.mode === 1) {
42
41
  gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0);
43
42
  if (this.reverse) {
44
- gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF);
43
+ gl.stencilFunc(gl.EQUAL, 0xff - level, 0xff);
45
44
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);
46
45
  } else {
47
- gl.stencilFunc(gl.EQUAL, level, 0xFF);
46
+ gl.stencilFunc(gl.EQUAL, level, 0xff);
48
47
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);
49
48
  }
50
49
  // draw a quad to increment..
51
50
  gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, (webGLData.indices.length - 4) * 2);
52
51
  if (this.reverse) {
53
- gl.stencilFunc(gl.EQUAL, 0xFF - (level + 1), 0xFF);
52
+ gl.stencilFunc(gl.EQUAL, 0xff - (level + 1), 0xff);
54
53
  } else {
55
- gl.stencilFunc(gl.EQUAL, level + 1, 0xFF);
54
+ gl.stencilFunc(gl.EQUAL, level + 1, 0xff);
56
55
  }
57
56
  this.reverse = !this.reverse;
58
57
  } else {
59
58
  if (!this.reverse) {
60
- gl.stencilFunc(gl.EQUAL, 0xFF - level, 0xFF);
59
+ gl.stencilFunc(gl.EQUAL, 0xff - level, 0xff);
61
60
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);
62
61
  } else {
63
- gl.stencilFunc(gl.EQUAL, level, 0xFF);
62
+ gl.stencilFunc(gl.EQUAL, level, 0xff);
64
63
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);
65
64
  }
66
65
  gl.drawElements(gl.TRIANGLE_STRIP, webGLData.indices.length, gl.UNSIGNED_SHORT, 0);
67
66
  if (!this.reverse) {
68
- gl.stencilFunc(gl.EQUAL, 0xFF - (level + 1), 0xFF);
67
+ gl.stencilFunc(gl.EQUAL, 0xff - (level + 1), 0xff);
69
68
  } else {
70
- gl.stencilFunc(gl.EQUAL, level + 1, 0xFF);
69
+ gl.stencilFunc(gl.EQUAL, level + 1, 0xff);
71
70
  }
72
71
  }
73
72
  gl.colorMask(true, true, true, true);
@@ -130,41 +129,40 @@ export default class {
130
129
  if (webGLData.mode === 1) {
131
130
  this.reverse = !this.reverse;
132
131
  if (this.reverse) {
133
- gl.stencilFunc(gl.EQUAL, 0xFF - (level + 1), 0xFF);
132
+ gl.stencilFunc(gl.EQUAL, 0xff - (level + 1), 0xff);
134
133
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);
135
134
  } else {
136
- gl.stencilFunc(gl.EQUAL, level + 1, 0xFF);
135
+ gl.stencilFunc(gl.EQUAL, level + 1, 0xff);
137
136
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);
138
137
  }
139
138
  // draw a quad to increment..
140
139
  gl.drawElements(gl.TRIANGLE_FAN, 4, gl.UNSIGNED_SHORT, (webGLData.indices.length - 4) * 2);
141
- gl.stencilFunc(gl.ALWAYS, 0, 0xFF);
140
+ gl.stencilFunc(gl.ALWAYS, 0, 0xff);
142
141
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INVERT);
143
142
  // draw the triangle strip!
144
143
  gl.drawElements(gl.TRIANGLE_FAN, webGLData.indices.length - 4, gl.UNSIGNED_SHORT, 0);
145
144
  if (!this.reverse) {
146
- gl.stencilFunc(gl.EQUAL, 0xFF - (level), 0xFF);
145
+ gl.stencilFunc(gl.EQUAL, 0xff - level, 0xff);
147
146
  } else {
148
- gl.stencilFunc(gl.EQUAL, level, 0xFF);
147
+ gl.stencilFunc(gl.EQUAL, level, 0xff);
149
148
  }
150
149
  } else {
151
150
  if (!this.reverse) {
152
- gl.stencilFunc(gl.EQUAL, 0xFF - (level + 1), 0xFF);
151
+ gl.stencilFunc(gl.EQUAL, 0xff - (level + 1), 0xff);
153
152
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);
154
153
  } else {
155
- gl.stencilFunc(gl.EQUAL, level + 1, 0xFF);
154
+ gl.stencilFunc(gl.EQUAL, level + 1, 0xff);
156
155
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);
157
156
  }
158
157
  gl.drawElements(gl.TRIANGLE_STRIP, webGLData.indices.length, gl.UNSIGNED_SHORT, 0);
159
158
  if (!this.reverse) {
160
- gl.stencilFunc(gl.EQUAL, 0xFF - (level), 0xFF);
159
+ gl.stencilFunc(gl.EQUAL, 0xff - level, 0xff);
161
160
  } else {
162
- gl.stencilFunc(gl.EQUAL, level, 0xFF);
161
+ gl.stencilFunc(gl.EQUAL, level, 0xff);
163
162
  }
164
163
  }
165
164
  gl.colorMask(true, true, true, true);
166
165
  gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
167
166
  }
168
167
  }
169
-
170
168
  }
@@ -1,13 +1,13 @@
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 '../../geom/rectangle';
8
+ import { Rectangle } from '../../geom/rectangle';
8
9
 
9
10
  export class TextureUvs {
10
-
11
11
  constructor() {
12
12
  this.x0 = 0;
13
13
  this.y0 = 0;
@@ -18,11 +18,9 @@ export class TextureUvs {
18
18
  this.x3 = 0;
19
19
  this.y3 = 0;
20
20
  }
21
-
22
21
  }
23
22
 
24
- export default class {
25
-
23
+ export class Texture {
26
24
  constructor(baseTexture, frame, crop, trim) {
27
25
  this.noFrame = false;
28
26
  if (!frame) {
@@ -74,18 +72,25 @@ export default class {
74
72
  this.crop.y = frame.y;
75
73
  this.crop.width = frame.width;
76
74
  this.crop.height = frame.height;
77
- if (!this.trim && (frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height)) {
75
+ if (
76
+ !this.trim &&
77
+ (frame.x + frame.width > this.baseTexture.width ||
78
+ frame.y + frame.height > this.baseTexture.height)
79
+ ) {
78
80
  // If `true` then `PIXI.Texture.setFrame` will no longer throw an error if the texture dimensions are incorrect.
79
81
  // Instead `Texture.valid` will be set to `false` (#1556)
80
82
  // TODO: make this configurable
81
83
  const isTextureSilentFail = true;
82
84
  if (!isTextureSilentFail) {
83
- throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this);
85
+ throw new Error(
86
+ 'Texture Error: frame does not fit inside the base Texture dimensions ' + this
87
+ );
84
88
  }
85
89
  this.valid = false;
86
90
  return;
87
91
  }
88
- this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
92
+ this.valid =
93
+ frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
89
94
  if (this.trim) {
90
95
  this.width = this.trim.width;
91
96
  this.height = this.trim.height;
@@ -113,5 +118,4 @@ export default class {
113
118
  this._uvs.x3 = frame.x / tw;
114
119
  this._uvs.y3 = (frame.y + frame.height) / th;
115
120
  }
116
-
117
121
  }
@@ -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 {object} canvas TBD
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 {object} canvas TBD
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));