@eva/plugin-stats 2.0.0-beta.0 → 2.0.0-beta.2

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 (242) hide show
  1. package/dist/EVA.plugin.stats.js +113 -176
  2. package/dist/EVA.plugin.stats.min.js +1 -1
  3. package/dist/plugin-stats.cjs.js +107 -185
  4. package/dist/plugin-stats.cjs.prod.js +1 -15
  5. package/dist/{packages/plugin-stats/lib/StatsSystem.d.ts → plugin-stats.d.ts} +22 -8
  6. package/dist/plugin-stats.esm.js +106 -184
  7. package/package.json +2 -2
  8. package/dist/packages/eva.js/lib/core/Component.d.ts +0 -35
  9. package/dist/packages/eva.js/lib/core/Component.d.ts.map +0 -1
  10. package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts +0 -22
  11. package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts.map +0 -1
  12. package/dist/packages/eva.js/lib/core/GameObject.d.ts +0 -31
  13. package/dist/packages/eva.js/lib/core/GameObject.d.ts.map +0 -1
  14. package/dist/packages/eva.js/lib/core/System.d.ts +0 -30
  15. package/dist/packages/eva.js/lib/core/System.d.ts.map +0 -1
  16. package/dist/packages/eva.js/lib/core/Transform.d.ts +0 -51
  17. package/dist/packages/eva.js/lib/core/Transform.d.ts.map +0 -1
  18. package/dist/packages/eva.js/lib/core/observer.d.ts +0 -23
  19. package/dist/packages/eva.js/lib/core/observer.d.ts.map +0 -1
  20. package/dist/packages/eva.js/lib/decorators/ide.d.ts +0 -2
  21. package/dist/packages/eva.js/lib/decorators/ide.d.ts.map +0 -1
  22. package/dist/packages/eva.js/lib/decorators/system.d.ts +0 -11
  23. package/dist/packages/eva.js/lib/decorators/system.d.ts.map +0 -1
  24. package/dist/packages/eva.js/lib/game/Game.d.ts +0 -72
  25. package/dist/packages/eva.js/lib/game/Game.d.ts.map +0 -1
  26. package/dist/packages/eva.js/lib/game/Scene.d.ts +0 -12
  27. package/dist/packages/eva.js/lib/game/Scene.d.ts.map +0 -1
  28. package/dist/packages/eva.js/lib/game/Ticker.d.ts +0 -25
  29. package/dist/packages/eva.js/lib/game/Ticker.d.ts.map +0 -1
  30. package/dist/packages/eva.js/lib/index.d.ts +0 -26
  31. package/dist/packages/eva.js/lib/index.d.ts.map +0 -1
  32. package/dist/packages/eva.js/lib/loader/Progress.d.ts +0 -21
  33. package/dist/packages/eva.js/lib/loader/Progress.d.ts.map +0 -1
  34. package/dist/packages/eva.js/lib/loader/Resource.d.ts +0 -99
  35. package/dist/packages/eva.js/lib/loader/Resource.d.ts.map +0 -1
  36. package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts +0 -14
  37. package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts.map +0 -1
  38. package/dist/packages/eva.js/lib/timeline/index.d.ts +0 -40
  39. package/dist/packages/eva.js/lib/timeline/index.d.ts.map +0 -1
  40. package/dist/packages/eva.js/lib/timeline/utils.d.ts +0 -2
  41. package/dist/packages/eva.js/lib/timeline/utils.d.ts.map +0 -1
  42. package/dist/packages/plugin-a11y/lib/A11y.d.ts +0 -26
  43. package/dist/packages/plugin-a11y/lib/A11y.d.ts.map +0 -1
  44. package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts +0 -54
  45. package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts.map +0 -1
  46. package/dist/packages/plugin-a11y/lib/constant.d.ts +0 -34
  47. package/dist/packages/plugin-a11y/lib/constant.d.ts.map +0 -1
  48. package/dist/packages/plugin-a11y/lib/index.d.ts +0 -4
  49. package/dist/packages/plugin-a11y/lib/index.d.ts.map +0 -1
  50. package/dist/packages/plugin-a11y/lib/utils.d.ts +0 -6
  51. package/dist/packages/plugin-a11y/lib/utils.d.ts.map +0 -1
  52. package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts +0 -20
  53. package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts.map +0 -1
  54. package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts +0 -33
  55. package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts.map +0 -1
  56. package/dist/packages/plugin-evax/lib/index.d.ts +0 -10
  57. package/dist/packages/plugin-evax/lib/index.d.ts.map +0 -1
  58. package/dist/packages/plugin-evax/lib/utils.d.ts +0 -3
  59. package/dist/packages/plugin-evax/lib/utils.d.ts.map +0 -1
  60. package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts +0 -31
  61. package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts.map +0 -1
  62. package/dist/packages/plugin-matterjs/lib/Physics.d.ts +0 -32
  63. package/dist/packages/plugin-matterjs/lib/Physics.d.ts.map +0 -1
  64. package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts +0 -35
  65. package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts.map +0 -1
  66. package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts +0 -32
  67. package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts.map +0 -1
  68. package/dist/packages/plugin-matterjs/lib/index.d.ts +0 -5
  69. package/dist/packages/plugin-matterjs/lib/index.d.ts.map +0 -1
  70. package/dist/packages/plugin-matterjs/lib/matter.d.ts +0 -3
  71. package/dist/packages/plugin-matterjs/lib/matter.d.ts.map +0 -1
  72. package/dist/packages/plugin-renderer/lib/Renderer.d.ts +0 -19
  73. package/dist/packages/plugin-renderer/lib/Renderer.d.ts.map +0 -1
  74. package/dist/packages/plugin-renderer/lib/System.d.ts +0 -40
  75. package/dist/packages/plugin-renderer/lib/System.d.ts.map +0 -1
  76. package/dist/packages/plugin-renderer/lib/Transform.d.ts +0 -28
  77. package/dist/packages/plugin-renderer/lib/Transform.d.ts.map +0 -1
  78. package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts +0 -20
  79. package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts.map +0 -1
  80. package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts +0 -2
  81. package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts.map +0 -1
  82. package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts +0 -7
  83. package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts.map +0 -1
  84. package/dist/packages/plugin-renderer/lib/index.d.ts +0 -8
  85. package/dist/packages/plugin-renderer/lib/index.d.ts.map +0 -1
  86. package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts +0 -18
  87. package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts.map +0 -1
  88. package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts +0 -17
  89. package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts.map +0 -1
  90. package/dist/packages/plugin-renderer/lib/mixin.d.ts +0 -2
  91. package/dist/packages/plugin-renderer/lib/mixin.d.ts.map +0 -1
  92. package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts +0 -26
  93. package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts.map +0 -1
  94. package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts +0 -3
  95. package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts.map +0 -1
  96. package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts +0 -10
  97. package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts.map +0 -1
  98. package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts +0 -4
  99. package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts.map +0 -1
  100. package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts +0 -24
  101. package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts.map +0 -1
  102. package/dist/packages/plugin-renderer-event/lib/component.d.ts +0 -52
  103. package/dist/packages/plugin-renderer-event/lib/component.d.ts.map +0 -1
  104. package/dist/packages/plugin-renderer-event/lib/index.d.ts +0 -5
  105. package/dist/packages/plugin-renderer-event/lib/index.d.ts.map +0 -1
  106. package/dist/packages/plugin-renderer-event/lib/system.d.ts +0 -19
  107. package/dist/packages/plugin-renderer-event/lib/system.d.ts.map +0 -1
  108. package/dist/packages/plugin-renderer-graphics/lib/component.d.ts +0 -8
  109. package/dist/packages/plugin-renderer-graphics/lib/component.d.ts.map +0 -1
  110. package/dist/packages/plugin-renderer-graphics/lib/index.d.ts +0 -4
  111. package/dist/packages/plugin-renderer-graphics/lib/index.d.ts.map +0 -1
  112. package/dist/packages/plugin-renderer-graphics/lib/system.d.ts +0 -12
  113. package/dist/packages/plugin-renderer-graphics/lib/system.d.ts.map +0 -1
  114. package/dist/packages/plugin-renderer-img/lib/component.d.ts +0 -10
  115. package/dist/packages/plugin-renderer-img/lib/component.d.ts.map +0 -1
  116. package/dist/packages/plugin-renderer-img/lib/index.d.ts +0 -4
  117. package/dist/packages/plugin-renderer-img/lib/index.d.ts.map +0 -1
  118. package/dist/packages/plugin-renderer-img/lib/system.d.ts +0 -18
  119. package/dist/packages/plugin-renderer-img/lib/system.d.ts.map +0 -1
  120. package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts +0 -27
  121. package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts.map +0 -1
  122. package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts +0 -18
  123. package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts.map +0 -1
  124. package/dist/packages/plugin-renderer-lottie/lib/index.d.ts +0 -3
  125. package/dist/packages/plugin-renderer-lottie/lib/index.d.ts.map +0 -1
  126. package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts +0 -180
  127. package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts.map +0 -1
  128. package/dist/packages/plugin-renderer-lottie/lib/types.d.ts +0 -18
  129. package/dist/packages/plugin-renderer-lottie/lib/types.d.ts.map +0 -1
  130. package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts +0 -2
  131. package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts.map +0 -1
  132. package/dist/packages/plugin-renderer-mask/lib/component.d.ts +0 -33
  133. package/dist/packages/plugin-renderer-mask/lib/component.d.ts.map +0 -1
  134. package/dist/packages/plugin-renderer-mask/lib/index.d.ts +0 -4
  135. package/dist/packages/plugin-renderer-mask/lib/index.d.ts.map +0 -1
  136. package/dist/packages/plugin-renderer-mask/lib/system.d.ts +0 -31
  137. package/dist/packages/plugin-renderer-mask/lib/system.d.ts.map +0 -1
  138. package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts +0 -22
  139. package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts.map +0 -1
  140. package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts +0 -4
  141. package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts.map +0 -1
  142. package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts +0 -19
  143. package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts.map +0 -1
  144. package/dist/packages/plugin-renderer-render/lib/component.d.ts +0 -17
  145. package/dist/packages/plugin-renderer-render/lib/component.d.ts.map +0 -1
  146. package/dist/packages/plugin-renderer-render/lib/index.d.ts +0 -4
  147. package/dist/packages/plugin-renderer-render/lib/index.d.ts.map +0 -1
  148. package/dist/packages/plugin-renderer-render/lib/system.d.ts +0 -17
  149. package/dist/packages/plugin-renderer-render/lib/system.d.ts.map +0 -1
  150. package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts +0 -4
  151. package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts.map +0 -1
  152. package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts +0 -5
  153. package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts.map +0 -1
  154. package/dist/packages/plugin-renderer-spine/lib/index.d.ts +0 -4
  155. package/dist/packages/plugin-renderer-spine/lib/index.d.ts.map +0 -1
  156. package/dist/packages/plugin-renderer-sprite/lib/component.d.ts +0 -12
  157. package/dist/packages/plugin-renderer-sprite/lib/component.d.ts.map +0 -1
  158. package/dist/packages/plugin-renderer-sprite/lib/index.d.ts +0 -4
  159. package/dist/packages/plugin-renderer-sprite/lib/index.d.ts.map +0 -1
  160. package/dist/packages/plugin-renderer-sprite/lib/system.d.ts +0 -17
  161. package/dist/packages/plugin-renderer-sprite/lib/system.d.ts.map +0 -1
  162. package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts +0 -31
  163. package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts.map +0 -1
  164. package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts +0 -4
  165. package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts.map +0 -1
  166. package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts +0 -31
  167. package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts.map +0 -1
  168. package/dist/packages/plugin-renderer-test/lib/component.d.ts +0 -20
  169. package/dist/packages/plugin-renderer-test/lib/component.d.ts.map +0 -1
  170. package/dist/packages/plugin-renderer-test/lib/index.d.ts +0 -4
  171. package/dist/packages/plugin-renderer-test/lib/index.d.ts.map +0 -1
  172. package/dist/packages/plugin-renderer-test/lib/system.d.ts +0 -21
  173. package/dist/packages/plugin-renderer-test/lib/system.d.ts.map +0 -1
  174. package/dist/packages/plugin-renderer-test/lib/system2.d.ts +0 -12
  175. package/dist/packages/plugin-renderer-test/lib/system2.d.ts.map +0 -1
  176. package/dist/packages/plugin-renderer-text/lib/component.d.ts +0 -43
  177. package/dist/packages/plugin-renderer-text/lib/component.d.ts.map +0 -1
  178. package/dist/packages/plugin-renderer-text/lib/index.d.ts +0 -4
  179. package/dist/packages/plugin-renderer-text/lib/index.d.ts.map +0 -1
  180. package/dist/packages/plugin-renderer-text/lib/system.d.ts +0 -22
  181. package/dist/packages/plugin-renderer-text/lib/system.d.ts.map +0 -1
  182. package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts +0 -20
  183. package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts.map +0 -1
  184. package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts +0 -4
  185. package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts.map +0 -1
  186. package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts +0 -18
  187. package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts.map +0 -1
  188. package/dist/packages/plugin-sound/lib/Sound.d.ts +0 -44
  189. package/dist/packages/plugin-sound/lib/Sound.d.ts.map +0 -1
  190. package/dist/packages/plugin-sound/lib/SoundSystem.d.ts +0 -37
  191. package/dist/packages/plugin-sound/lib/SoundSystem.d.ts.map +0 -1
  192. package/dist/packages/plugin-sound/lib/index.d.ts +0 -3
  193. package/dist/packages/plugin-sound/lib/index.d.ts.map +0 -1
  194. package/dist/packages/plugin-stats/lib/Stats.d.ts +0 -19
  195. package/dist/packages/plugin-stats/lib/Stats.d.ts.map +0 -1
  196. package/dist/packages/plugin-stats/lib/StatsComponent.d.ts +0 -7
  197. package/dist/packages/plugin-stats/lib/StatsComponent.d.ts.map +0 -1
  198. package/dist/packages/plugin-stats/lib/StatsSystem.d.ts.map +0 -1
  199. package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts +0 -18
  200. package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts.map +0 -1
  201. package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts +0 -11
  202. package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts.map +0 -1
  203. package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts +0 -16
  204. package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts.map +0 -1
  205. package/dist/packages/plugin-stats/lib/index.d.ts +0 -9
  206. package/dist/packages/plugin-stats/lib/index.d.ts.map +0 -1
  207. package/dist/packages/plugin-transition/lib/Animation.d.ts +0 -38
  208. package/dist/packages/plugin-transition/lib/Animation.d.ts.map +0 -1
  209. package/dist/packages/plugin-transition/lib/component.d.ts +0 -35
  210. package/dist/packages/plugin-transition/lib/component.d.ts.map +0 -1
  211. package/dist/packages/plugin-transition/lib/index.d.ts +0 -3
  212. package/dist/packages/plugin-transition/lib/index.d.ts.map +0 -1
  213. package/dist/packages/plugin-transition/lib/system.d.ts +0 -6
  214. package/dist/packages/plugin-transition/lib/system.d.ts.map +0 -1
  215. package/dist/packages/renderer-adapter/lib/Application.d.ts +0 -3
  216. package/dist/packages/renderer-adapter/lib/Application.d.ts.map +0 -1
  217. package/dist/packages/renderer-adapter/lib/Container.d.ts +0 -5
  218. package/dist/packages/renderer-adapter/lib/Container.d.ts.map +0 -1
  219. package/dist/packages/renderer-adapter/lib/Graphics.d.ts +0 -5
  220. package/dist/packages/renderer-adapter/lib/Graphics.d.ts.map +0 -1
  221. package/dist/packages/renderer-adapter/lib/NinePatch.d.ts +0 -5
  222. package/dist/packages/renderer-adapter/lib/NinePatch.d.ts.map +0 -1
  223. package/dist/packages/renderer-adapter/lib/Sprite.d.ts +0 -9
  224. package/dist/packages/renderer-adapter/lib/Sprite.d.ts.map +0 -1
  225. package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts +0 -14
  226. package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts.map +0 -1
  227. package/dist/packages/renderer-adapter/lib/Text.d.ts +0 -6
  228. package/dist/packages/renderer-adapter/lib/Text.d.ts.map +0 -1
  229. package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts +0 -9
  230. package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts.map +0 -1
  231. package/dist/packages/renderer-adapter/lib/index.d.ts +0 -9
  232. package/dist/packages/renderer-adapter/lib/index.d.ts.map +0 -1
  233. package/dist/packages/spine-base/lib/Spine.d.ts +0 -32
  234. package/dist/packages/spine-base/lib/Spine.d.ts.map +0 -1
  235. package/dist/packages/spine-base/lib/SpineData.d.ts +0 -5
  236. package/dist/packages/spine-base/lib/SpineData.d.ts.map +0 -1
  237. package/dist/packages/spine-base/lib/SpineSystem.d.ts +0 -20
  238. package/dist/packages/spine-base/lib/SpineSystem.d.ts.map +0 -1
  239. package/dist/packages/spine-base/lib/TexCache.d.ts +0 -10
  240. package/dist/packages/spine-base/lib/TexCache.d.ts.map +0 -1
  241. package/dist/packages/spine-base/lib/index.d.ts +0 -4
  242. package/dist/packages/spine-base/lib/index.d.ts.map +0 -1
@@ -4,65 +4,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var eva_js = require('@eva/eva.js');
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
17
-
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- var StatsComponent = (function (_super) {
48
- __extends(StatsComponent, _super);
49
- function StatsComponent() {
50
- return _super !== null && _super.apply(this, arguments) || this;
51
- }
52
- StatsComponent.prototype.update = function () {
7
+ class StatsComponent extends eva_js.Component {
8
+ update() {
53
9
  this.stats && this.stats.begin();
54
- };
55
- StatsComponent.componentName = 'Stats';
56
- return StatsComponent;
57
- }(eva_js.Component));
58
- var Stats$2 = StatsComponent;
10
+ }
11
+ }
12
+ StatsComponent.componentName = 'Stats';
59
13
 
60
- var Stats = function (style) {
61
- style = __assign({ width: 20, height: 12, x: 0, y: 0 }, style);
62
- var width = style.width, height = style.height, x = style.x, y = style.y;
63
- var mode = 0;
64
- var container = document.createElement('div');
65
- container.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000;width: " + width + "vw;height: " + height + "vw;left: " + x + "vw;top: " + y + "vw;";
14
+ const Stats = function (style) {
15
+ style = Object.assign({ width: 20, height: 12, x: 0, y: 0 }, style);
16
+ const { width, height, x, y } = style;
17
+ let mode = 0;
18
+ const container = document.createElement('div');
19
+ container.style.cssText = `position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000;width: ${width}vw;height: ${height}vw;left: ${x}vw;top: ${y}vw;`;
66
20
  container.addEventListener('click', function (event) {
67
21
  event.preventDefault();
68
22
  showPanel(++mode % container.children.length);
@@ -72,17 +26,17 @@ var Stats = function (style) {
72
26
  return panel;
73
27
  }
74
28
  function showPanel(id) {
75
- for (var i = 0; i < container.children.length; i++) {
29
+ for (let i = 0; i < container.children.length; i++) {
76
30
  container.children[i].style.display = i === id ? 'block' : 'none';
77
31
  }
78
32
  mode = id;
79
33
  }
80
- var beginTime = (performance || Date).now(), prevTime = beginTime, frames = 0;
81
- var fpsPanel = addPanel(Stats.Panel('FPS', '#0ff', '#002'));
82
- var msPanel = addPanel(Stats.Panel('MS', '#0f0', '#020'));
83
- var dcPanel = addPanel(Stats.Panel('DrawCall', '#330570', '#A69700'));
84
- var tcPanel = addPanel(Stats.Panel('TC:', '#A62500', '#00B454'));
85
- var memPanel;
34
+ let beginTime = (performance || Date).now(), prevTime = beginTime, frames = 0;
35
+ const fpsPanel = addPanel(Stats.Panel('FPS', '#0ff', '#002'));
36
+ const msPanel = addPanel(Stats.Panel('MS', '#0f0', '#020'));
37
+ const dcPanel = addPanel(Stats.Panel('DrawCall', '#330570', '#A69700'));
38
+ const tcPanel = addPanel(Stats.Panel('TC:', '#A62500', '#00B454'));
39
+ let memPanel;
86
40
  if (self.performance && self.performance.memory) {
87
41
  memPanel = addPanel(Stats.Panel('MB', '#f08', '#201'));
88
42
  }
@@ -97,7 +51,7 @@ var Stats = function (style) {
97
51
  },
98
52
  end: function (hook) {
99
53
  frames++;
100
- var time = (performance || Date).now();
54
+ const time = (performance || Date).now();
101
55
  msPanel.update(time - beginTime, 200);
102
56
  if (hook) {
103
57
  dcPanel.update(hook.deltaDrawCalls, Math.max(50, hook.maxDeltaDrawCalls));
@@ -108,7 +62,7 @@ var Stats = function (style) {
108
62
  prevTime = time;
109
63
  frames = 0;
110
64
  if (memPanel) {
111
- var memory = performance.memory;
65
+ const memory = performance.memory;
112
66
  memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576);
113
67
  }
114
68
  }
@@ -122,15 +76,15 @@ var Stats = function (style) {
122
76
  };
123
77
  };
124
78
  Stats.Panel = function (name, fg, bg) {
125
- var min = Infinity, max = 0;
126
- var round = Math.round;
127
- var PR = round(window.devicePixelRatio || 1);
128
- var WIDTH = 80 * PR, HEIGHT = 48 * PR, TEXT_X = 3 * PR, TEXT_Y = 2 * PR, GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR, GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
129
- var canvas = document.createElement('canvas');
79
+ let min = Infinity, max = 0;
80
+ const round = Math.round;
81
+ const PR = round(window.devicePixelRatio || 1);
82
+ const WIDTH = 80 * PR, HEIGHT = 48 * PR, TEXT_X = 3 * PR, TEXT_Y = 2 * PR, GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR, GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
83
+ const canvas = document.createElement('canvas');
130
84
  canvas.width = WIDTH;
131
85
  canvas.height = HEIGHT;
132
86
  canvas.style.cssText = 'width:100%;height:100%';
133
- var context = canvas.getContext('2d');
87
+ const context = canvas.getContext('2d');
134
88
  context.font = 'bold ' + 9 * PR + 'px Helvetica,Arial,sans-serif';
135
89
  context.textBaseline = 'top';
136
90
  context.fillStyle = bg;
@@ -161,8 +115,8 @@ Stats.Panel = function (name, fg, bg) {
161
115
  };
162
116
  var Stats$1 = Stats;
163
117
 
164
- var GLHook = (function () {
165
- function GLHook(_gl) {
118
+ class GLHook {
119
+ constructor(_gl) {
166
120
  this.drawPasses = 0;
167
121
  this.isInit = false;
168
122
  this.realGLDrawElements = function () { };
@@ -178,26 +132,25 @@ var GLHook = (function () {
178
132
  console.error("[GLHook] GL can't be NULL");
179
133
  }
180
134
  }
181
- GLHook.prototype.fakeGLdrawElements = function (context) {
135
+ fakeGLdrawElements(context) {
182
136
  return function (mode, count, type, offset) {
183
137
  context.drawPasses++;
184
138
  context.realGLDrawElements.call(this, mode, count, type, offset);
185
139
  };
186
- };
187
- GLHook.prototype.reset = function () {
140
+ }
141
+ reset() {
188
142
  this.drawPasses = 0;
189
- };
190
- GLHook.prototype.release = function () {
143
+ }
144
+ release() {
191
145
  if (this.isInit) {
192
146
  this.gl.__proto__.drawElements = this.realGLDrawElements;
193
147
  }
194
148
  this.isInit = false;
195
- };
196
- return GLHook;
197
- }());
149
+ }
150
+ }
198
151
 
199
- var TextureHook = (function () {
200
- function TextureHook(_gl) {
152
+ class TextureHook {
153
+ constructor(_gl) {
201
154
  this.createdTextures = new Array();
202
155
  this.maxTexturesCount = 0;
203
156
  this.isInit = false;
@@ -217,25 +170,21 @@ var TextureHook = (function () {
217
170
  console.error("[TextureHook] GL can't be NULL");
218
171
  }
219
172
  }
220
- Object.defineProperty(TextureHook.prototype, "currentTextureCount", {
221
- get: function () {
222
- return this.createdTextures.length;
223
- },
224
- enumerable: false,
225
- configurable: true
226
- });
227
- TextureHook.prototype.registerTexture = function (texture) {
173
+ get currentTextureCount() {
174
+ return this.createdTextures.length;
175
+ }
176
+ registerTexture(texture) {
228
177
  this.createdTextures.push(texture);
229
178
  this.maxTexturesCount = Math.max(this.createdTextures.length, this.maxTexturesCount);
230
- };
231
- TextureHook.prototype.fakeGLCreateTexture = function (context) {
179
+ }
180
+ fakeGLCreateTexture(context) {
232
181
  return function () {
233
182
  var texture = context.realGLCreateTexture.call(this);
234
183
  context.registerTexture(texture);
235
184
  return texture;
236
185
  };
237
- };
238
- TextureHook.prototype.fakeGLDeleteTexture = function (context) {
186
+ }
187
+ fakeGLDeleteTexture(context) {
239
188
  return function (texture) {
240
189
  var index = context.createdTextures.indexOf(texture);
241
190
  if (index > -1) {
@@ -243,141 +192,114 @@ var TextureHook = (function () {
243
192
  }
244
193
  context.realGLDeleteTexture.call(this, texture);
245
194
  };
246
- };
247
- TextureHook.prototype.reset = function () {
195
+ }
196
+ reset() {
248
197
  this.createdTextures = new Array();
249
198
  this.maxTexturesCount = 0;
250
- };
251
- TextureHook.prototype.release = function () {
199
+ }
200
+ release() {
252
201
  if (this.isInit) {
253
202
  this.gl.__proto__.createTexture = this.realGLCreateTexture;
254
203
  this.gl.__proto__.deleteTexture = this.realGLDeleteTexture;
255
204
  console.log('[TextureHook] Hook was removed!');
256
205
  }
257
206
  this.isInit = false;
258
- };
259
- return TextureHook;
260
- }());
207
+ }
208
+ }
261
209
 
262
- var BaseHooks = (function () {
263
- function BaseHooks() {
210
+ class BaseHooks {
211
+ constructor() {
264
212
  this._drawCalls = -1;
265
213
  this._maxDeltaDrawCalls = -1;
266
214
  }
267
- BaseHooks.prototype.attach = function (gl) {
215
+ attach(gl) {
268
216
  this.glhook = new GLHook(gl);
269
217
  this.texturehook = new TextureHook(gl);
270
- };
271
- Object.defineProperty(BaseHooks.prototype, "drawCalls", {
272
- get: function () {
273
- if (this.glhook && this.glhook.isInit) {
274
- return this.glhook.drawPasses;
275
- }
276
- return -1;
277
- },
278
- enumerable: false,
279
- configurable: true
280
- });
281
- Object.defineProperty(BaseHooks.prototype, "maxDeltaDrawCalls", {
282
- get: function () {
283
- return this._maxDeltaDrawCalls;
284
- },
285
- enumerable: false,
286
- configurable: true
287
- });
288
- Object.defineProperty(BaseHooks.prototype, "deltaDrawCalls", {
289
- get: function () {
290
- if (this._drawCalls == -1) {
291
- this._drawCalls = this.drawCalls;
292
- return 0;
293
- }
294
- var dc = this.drawCalls;
295
- var delta = dc - this._drawCalls;
296
- this._drawCalls = dc;
297
- this._maxDeltaDrawCalls = Math.max(this._maxDeltaDrawCalls, delta);
298
- return delta;
299
- },
300
- enumerable: false,
301
- configurable: true
302
- });
303
- Object.defineProperty(BaseHooks.prototype, "maxTextureCount", {
304
- get: function () {
305
- if (this.texturehook && this.texturehook.isInit)
306
- return this.texturehook.maxTexturesCount;
307
- return 0;
308
- },
309
- enumerable: false,
310
- configurable: true
311
- });
312
- Object.defineProperty(BaseHooks.prototype, "texturesCount", {
313
- get: function () {
314
- if (this.texturehook && this.texturehook.isInit)
315
- return this.texturehook.currentTextureCount;
218
+ }
219
+ get drawCalls() {
220
+ if (this.glhook && this.glhook.isInit) {
221
+ return this.glhook.drawPasses;
222
+ }
223
+ return -1;
224
+ }
225
+ get maxDeltaDrawCalls() {
226
+ return this._maxDeltaDrawCalls;
227
+ }
228
+ get deltaDrawCalls() {
229
+ if (this._drawCalls == -1) {
230
+ this._drawCalls = this.drawCalls;
316
231
  return 0;
317
- },
318
- enumerable: false,
319
- configurable: true
320
- });
321
- BaseHooks.prototype.reset = function () {
232
+ }
233
+ var dc = this.drawCalls;
234
+ var delta = dc - this._drawCalls;
235
+ this._drawCalls = dc;
236
+ this._maxDeltaDrawCalls = Math.max(this._maxDeltaDrawCalls, delta);
237
+ return delta;
238
+ }
239
+ get maxTextureCount() {
240
+ if (this.texturehook && this.texturehook.isInit)
241
+ return this.texturehook.maxTexturesCount;
242
+ return 0;
243
+ }
244
+ get texturesCount() {
245
+ if (this.texturehook && this.texturehook.isInit)
246
+ return this.texturehook.currentTextureCount;
247
+ return 0;
248
+ }
249
+ reset() {
322
250
  this._maxDeltaDrawCalls = -1;
323
251
  this._drawCalls = -1;
324
252
  if (this.glhook)
325
253
  this.glhook.reset();
326
254
  if (this.texturehook)
327
255
  this.texturehook.reset();
328
- };
329
- BaseHooks.prototype.release = function () {
256
+ }
257
+ release() {
330
258
  if (this.glhook)
331
259
  this.glhook.release();
332
260
  if (this.texturehook)
333
261
  this.texturehook.release();
334
- };
335
- return BaseHooks;
336
- }());
262
+ }
263
+ }
337
264
 
338
- var StatsSystem = (function (_super) {
339
- __extends(StatsSystem, _super);
340
- function StatsSystem() {
341
- var _this = _super !== null && _super.apply(this, arguments) || this;
342
- _this.show = true;
343
- return _this;
265
+ class StatsSystem extends eva_js.System {
266
+ constructor() {
267
+ super(...arguments);
268
+ this.show = true;
344
269
  }
345
- StatsSystem.prototype.init = function (param) {
346
- if (param === void 0) { param = { show: true }; }
270
+ init(param = { show: true }) {
347
271
  this.show = param.show;
348
272
  this.style = param.style;
349
273
  this.renderSystem = this.game.getSystem('Renderer');
350
274
  this.app = this.renderSystem.application;
351
275
  if (this.app && this.show) {
352
- var gl = this.app.renderer.gl;
276
+ const gl = this.app.renderer.gl;
353
277
  this.hook = new BaseHooks();
354
278
  this.hook.attach(gl);
355
279
  }
356
- };
357
- StatsSystem.prototype.start = function () {
280
+ }
281
+ start() {
358
282
  if (!this.show)
359
283
  return;
360
- this.component = this.game.scene.addComponent(new Stats$2());
284
+ this.component = this.game.scene.addComponent(new StatsComponent());
361
285
  this.stats = Stats$1(this.style);
362
286
  this.component.stats = this.stats;
363
287
  this.stats.showPanel(0);
364
288
  document.body.appendChild(this.stats.dom);
365
- };
366
- StatsSystem.prototype.lateUpdate = function () {
289
+ }
290
+ lateUpdate() {
367
291
  if (!this.show)
368
292
  return;
369
293
  this.stats && this.stats.end(this.hook);
370
- };
371
- StatsSystem.systemName = 'Stats';
372
- return StatsSystem;
373
- }(eva_js.System));
374
- var StatsSystem$1 = StatsSystem;
294
+ }
295
+ }
296
+ StatsSystem.systemName = 'Stats';
375
297
 
376
298
  var index = {
377
- Components: [Stats$2],
378
- Systems: [StatsSystem$1],
299
+ Components: [StatsComponent],
300
+ Systems: [StatsSystem],
379
301
  };
380
302
 
381
- exports.Stats = Stats$2;
382
- exports.StatsSystem = StatsSystem$1;
303
+ exports.Stats = StatsComponent;
304
+ exports.StatsSystem = StatsSystem;
383
305
  exports["default"] = index;
@@ -1,15 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@eva/eva.js"),e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},e(t,r)};
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
- this file except in compliance with the License. You may obtain a copy of the
6
- License at http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
- MERCHANTABLITY OR NON-INFRINGEMENT.
12
-
13
- See the Apache Version 2.0 License for specific language governing permissions
14
- and limitations under the License.
15
- ***************************************************************************** */function r(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}var o=function(){return o=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)},n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.update=function(){this.stats&&this.stats.begin()},e.componentName="Stats",e}(t.Component),s=function(t){var e=(t=o({width:20,height:12,x:0,y:0},t)).width,r=t.height,n=t.x,i=t.y,a=0,l=document.createElement("div");function u(t){return l.appendChild(t.dom),t}function h(t){for(var e=0;e<l.children.length;e++)l.children[e].style.display=e===t?"block":"none";a=t}l.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000;width: "+e+"vw;height: "+r+"vw;left: "+n+"vw;top: "+i+"vw;",l.addEventListener("click",(function(t){t.preventDefault(),h(++a%l.children.length)}),!1);var c,p=(performance||Date).now(),f=p,d=0,x=u(s.Panel("FPS","#0ff","#002")),m=u(s.Panel("MS","#0f0","#020")),w=u(s.Panel("DrawCall","#330570","#A69700")),y=u(s.Panel("TC:","#A62500","#00B454"));return self.performance&&self.performance.memory&&(c=u(s.Panel("MB","#f08","#201"))),h(0),{REVISION:16,dom:l,addPanel:u,showPanel:h,begin:function(t){p=t||(performance||Date).now()},end:function(t){d++;var e=(performance||Date).now();if(m.update(e-p,200),t&&(w.update(t.deltaDrawCalls,Math.max(50,t.maxDeltaDrawCalls)),y.update(t.texturesCount,Math.max(20,t.maxTextureCount))),e>=f+1e3&&(x.update(1e3*d/(e-f),100),f=e,d=0,c)){var r=performance.memory;c.update(r.usedJSHeapSize/1048576,r.jsHeapSizeLimit/1048576)}return e},update:function(){p=this.end()},domElement:l,setMode:h}};s.Panel=function(t,e,r){var o=1/0,n=0,s=Math.round,i=s(window.devicePixelRatio||1),a=80*i,l=48*i,u=3*i,h=2*i,c=3*i,p=15*i,f=74*i,d=30*i,x=document.createElement("canvas");x.width=a,x.height=l,x.style.cssText="width:100%;height:100%";var m=x.getContext("2d");return m.font="bold "+9*i+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=r,m.fillRect(0,0,a,l),m.fillStyle=e,m.fillText(t,u,h),m.fillRect(c,p,f,d),m.fillStyle=r,m.globalAlpha=.9,m.fillRect(c,p,f,d),{dom:x,update:function(l,w){o=Math.min(o,l),n=Math.max(n,l),m.fillStyle=r,m.globalAlpha=1,m.fillRect(0,0,a,p),m.fillStyle=e,m.fillText(s(l)+" "+t+" ("+s(o)+"-"+s(n)+")",u,h),m.drawImage(x,c+i,p,f-i,d,c,p,f-i,d),m.fillRect(c+f-i,p,i,d),m.fillStyle=r,m.globalAlpha=.9,m.fillRect(c+f-i,p,i,s((1-l/w)*d))}}};var i=s,a=function(){function t(t){this.drawPasses=0,this.isInit=!1,this.realGLDrawElements=function(){},t?t.__proto__.drawElements&&(this.gl=t,this.realGLDrawElements=t.__proto__.drawElements,t.__proto__.drawElements=this.fakeGLdrawElements(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}return t.prototype.fakeGLdrawElements=function(t){return function(e,r,o,n){t.drawPasses++,t.realGLDrawElements.call(this,e,r,o,n)}},t.prototype.reset=function(){this.drawPasses=0},t.prototype.release=function(){this.isInit&&(this.gl.__proto__.drawElements=this.realGLDrawElements),this.isInit=!1},t}(),l=function(){function t(t){this.createdTextures=new Array,this.maxTexturesCount=0,this.isInit=!1,this.realGLCreateTexture=function(){},this.realGLDeleteTexture=function(){},t?t.__proto__.createTexture&&(this.gl=t,this.realGLCreateTexture=t.__proto__.createTexture,this.realGLDeleteTexture=t.__proto__.deleteTexture,t.__proto__.createTexture=this.fakeGLCreateTexture(this),t.__proto__.deleteTexture=this.fakeGLDeleteTexture(this),this.isInit=!0):console.error("[TextureHook] GL can't be NULL")}return Object.defineProperty(t.prototype,"currentTextureCount",{get:function(){return this.createdTextures.length},enumerable:!1,configurable:!0}),t.prototype.registerTexture=function(t){this.createdTextures.push(t),this.maxTexturesCount=Math.max(this.createdTextures.length,this.maxTexturesCount)},t.prototype.fakeGLCreateTexture=function(t){return function(){var e=t.realGLCreateTexture.call(this);return t.registerTexture(e),e}},t.prototype.fakeGLDeleteTexture=function(t){return function(e){var r=t.createdTextures.indexOf(e);r>-1&&t.createdTextures.splice(r,1),t.realGLDeleteTexture.call(this,e)}},t.prototype.reset=function(){this.createdTextures=new Array,this.maxTexturesCount=0},t.prototype.release=function(){this.isInit&&(this.gl.__proto__.createTexture=this.realGLCreateTexture,this.gl.__proto__.deleteTexture=this.realGLDeleteTexture,console.log("[TextureHook] Hook was removed!")),this.isInit=!1},t}(),u=function(){function t(){this._drawCalls=-1,this._maxDeltaDrawCalls=-1}return t.prototype.attach=function(t){this.glhook=new a(t),this.texturehook=new l(t)},Object.defineProperty(t.prototype,"drawCalls",{get:function(){return this.glhook&&this.glhook.isInit?this.glhook.drawPasses:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxDeltaDrawCalls",{get:function(){return this._maxDeltaDrawCalls},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deltaDrawCalls",{get:function(){if(-1==this._drawCalls)return this._drawCalls=this.drawCalls,0;var t=this.drawCalls,e=t-this._drawCalls;return this._drawCalls=t,this._maxDeltaDrawCalls=Math.max(this._maxDeltaDrawCalls,e),e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxTextureCount",{get:function(){return this.texturehook&&this.texturehook.isInit?this.texturehook.maxTexturesCount:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texturesCount",{get:function(){return this.texturehook&&this.texturehook.isInit?this.texturehook.currentTextureCount:0},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._maxDeltaDrawCalls=-1,this._drawCalls=-1,this.glhook&&this.glhook.reset(),this.texturehook&&this.texturehook.reset()},t.prototype.release=function(){this.glhook&&this.glhook.release(),this.texturehook&&this.texturehook.release()},t}(),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.show=!0,e}return r(e,t),e.prototype.init=function(t){if(void 0===t&&(t={show:!0}),this.show=t.show,this.style=t.style,this.renderSystem=this.game.getSystem("Renderer"),this.app=this.renderSystem.application,this.app&&this.show){var e=this.app.renderer.gl;this.hook=new u,this.hook.attach(e)}},e.prototype.start=function(){this.show&&(this.component=this.game.scene.addComponent(new n),this.stats=i(this.style),this.component.stats=this.stats,this.stats.showPanel(0),document.body.appendChild(this.stats.dom))},e.prototype.lateUpdate=function(){this.show&&this.stats&&this.stats.end(this.hook)},e.systemName="Stats",e}(t.System),c={Components:[n],Systems:[h]};exports.Stats=n,exports.StatsSystem=h,exports.default=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js");class t extends e.Component{update(){this.stats&&this.stats.begin()}}t.componentName="Stats";const s=function(e){e=Object.assign({width:20,height:12,x:0,y:0},e);const{width:t,height:r,x:a,y:i}=e;let l=0;const o=document.createElement("div");function n(e){return o.appendChild(e.dom),e}function h(e){for(let t=0;t<o.children.length;t++)o.children[t].style.display=t===e?"block":"none";l=e}o.style.cssText=`position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000;width: ${t}vw;height: ${r}vw;left: ${a}vw;top: ${i}vw;`,o.addEventListener("click",(function(e){e.preventDefault(),h(++l%o.children.length)}),!1);let u=(performance||Date).now(),c=u,d=0;const x=n(s.Panel("FPS","#0ff","#002")),m=n(s.Panel("MS","#0f0","#020")),p=n(s.Panel("DrawCall","#330570","#A69700")),w=n(s.Panel("TC:","#A62500","#00B454"));let f;return self.performance&&self.performance.memory&&(f=n(s.Panel("MB","#f08","#201"))),h(0),{REVISION:16,dom:o,addPanel:n,showPanel:h,begin:function(e){u=e||(performance||Date).now()},end:function(e){d++;const t=(performance||Date).now();if(m.update(t-u,200),e&&(p.update(e.deltaDrawCalls,Math.max(50,e.maxDeltaDrawCalls)),w.update(e.texturesCount,Math.max(20,e.maxTextureCount))),t>=c+1e3&&(x.update(1e3*d/(t-c),100),c=t,d=0,f)){const e=performance.memory;f.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576)}return t},update:function(){u=this.end()},domElement:o,setMode:h}};s.Panel=function(e,t,s){let r=1/0,a=0;const i=Math.round,l=i(window.devicePixelRatio||1),o=80*l,n=48*l,h=3*l,u=2*l,c=3*l,d=15*l,x=74*l,m=30*l,p=document.createElement("canvas");p.width=o,p.height=n,p.style.cssText="width:100%;height:100%";const w=p.getContext("2d");return w.font="bold "+9*l+"px Helvetica,Arial,sans-serif",w.textBaseline="top",w.fillStyle=s,w.fillRect(0,0,o,n),w.fillStyle=t,w.fillText(e,h,u),w.fillRect(c,d,x,m),w.fillStyle=s,w.globalAlpha=.9,w.fillRect(c,d,x,m),{dom:p,update:function(n,f){r=Math.min(r,n),a=Math.max(a,n),w.fillStyle=s,w.globalAlpha=1,w.fillRect(0,0,o,d),w.fillStyle=t,w.fillText(i(n)+" "+e+" ("+i(r)+"-"+i(a)+")",h,u),w.drawImage(p,c+l,d,x-l,m,c,d,x-l,m),w.fillRect(c+x-l,d,l,m),w.fillStyle=s,w.globalAlpha=.9,w.fillRect(c+x-l,d,l,i((1-n/f)*m))}}};var r=s;class a{constructor(e){this.drawPasses=0,this.isInit=!1,this.realGLDrawElements=function(){},e?e.__proto__.drawElements&&(this.gl=e,this.realGLDrawElements=e.__proto__.drawElements,e.__proto__.drawElements=this.fakeGLdrawElements(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}fakeGLdrawElements(e){return function(t,s,r,a){e.drawPasses++,e.realGLDrawElements.call(this,t,s,r,a)}}reset(){this.drawPasses=0}release(){this.isInit&&(this.gl.__proto__.drawElements=this.realGLDrawElements),this.isInit=!1}}class i{constructor(e){this.createdTextures=new Array,this.maxTexturesCount=0,this.isInit=!1,this.realGLCreateTexture=function(){},this.realGLDeleteTexture=function(){},e?e.__proto__.createTexture&&(this.gl=e,this.realGLCreateTexture=e.__proto__.createTexture,this.realGLDeleteTexture=e.__proto__.deleteTexture,e.__proto__.createTexture=this.fakeGLCreateTexture(this),e.__proto__.deleteTexture=this.fakeGLDeleteTexture(this),this.isInit=!0):console.error("[TextureHook] GL can't be NULL")}get currentTextureCount(){return this.createdTextures.length}registerTexture(e){this.createdTextures.push(e),this.maxTexturesCount=Math.max(this.createdTextures.length,this.maxTexturesCount)}fakeGLCreateTexture(e){return function(){var t=e.realGLCreateTexture.call(this);return e.registerTexture(t),t}}fakeGLDeleteTexture(e){return function(t){var s=e.createdTextures.indexOf(t);s>-1&&e.createdTextures.splice(s,1),e.realGLDeleteTexture.call(this,t)}}reset(){this.createdTextures=new Array,this.maxTexturesCount=0}release(){this.isInit&&(this.gl.__proto__.createTexture=this.realGLCreateTexture,this.gl.__proto__.deleteTexture=this.realGLDeleteTexture,console.log("[TextureHook] Hook was removed!")),this.isInit=!1}}class l{constructor(){this._drawCalls=-1,this._maxDeltaDrawCalls=-1}attach(e){this.glhook=new a(e),this.texturehook=new i(e)}get drawCalls(){return this.glhook&&this.glhook.isInit?this.glhook.drawPasses:-1}get maxDeltaDrawCalls(){return this._maxDeltaDrawCalls}get deltaDrawCalls(){if(-1==this._drawCalls)return this._drawCalls=this.drawCalls,0;var e=this.drawCalls,t=e-this._drawCalls;return this._drawCalls=e,this._maxDeltaDrawCalls=Math.max(this._maxDeltaDrawCalls,t),t}get maxTextureCount(){return this.texturehook&&this.texturehook.isInit?this.texturehook.maxTexturesCount:0}get texturesCount(){return this.texturehook&&this.texturehook.isInit?this.texturehook.currentTextureCount:0}reset(){this._maxDeltaDrawCalls=-1,this._drawCalls=-1,this.glhook&&this.glhook.reset(),this.texturehook&&this.texturehook.reset()}release(){this.glhook&&this.glhook.release(),this.texturehook&&this.texturehook.release()}}class o extends e.System{constructor(){super(...arguments),this.show=!0}init(e={show:!0}){if(this.show=e.show,this.style=e.style,this.renderSystem=this.game.getSystem("Renderer"),this.app=this.renderSystem.application,this.app&&this.show){const e=this.app.renderer.gl;this.hook=new l,this.hook.attach(e)}}start(){this.show&&(this.component=this.game.scene.addComponent(new t),this.stats=r(this.style),this.component.stats=this.stats,this.stats.showPanel(0),document.body.appendChild(this.stats.dom))}lateUpdate(){this.show&&this.stats&&this.stats.end(this.hook)}}o.systemName="Stats";var n={Components:[t],Systems:[o]};exports.Stats=t,exports.StatsSystem=o,exports.default=n;
@@ -1,8 +1,21 @@
1
- import { System } from '@eva/eva.js';
2
- import type { RendererSystem } from '@eva/plugin-renderer';
3
1
  import type { Application } from '@eva/renderer-adapter';
4
- import StatsComponent from './StatsComponent';
5
- interface StatsParams {
2
+ import { Component } from '@eva/eva.js';
3
+ import type { RendererSystem } from '@eva/plugin-renderer';
4
+ import { System } from '@eva/eva.js';
5
+
6
+ declare const _default: {
7
+ Components: (typeof Stats)[];
8
+ Systems: (typeof StatsSystem)[];
9
+ };
10
+ export default _default;
11
+
12
+ export declare class Stats extends Component {
13
+ static componentName: string;
14
+ stats: any;
15
+ update(): void;
16
+ }
17
+
18
+ declare interface StatsParams {
6
19
  show?: boolean;
7
20
  style?: {
8
21
  width: number;
@@ -11,7 +24,8 @@ interface StatsParams {
11
24
  y: number;
12
25
  };
13
26
  }
14
- export default class StatsSystem extends System {
27
+
28
+ export declare class StatsSystem extends System {
15
29
  static systemName: string;
16
30
  app: Application;
17
31
  renderSystem: RendererSystem;
@@ -19,10 +33,10 @@ export default class StatsSystem extends System {
19
33
  stats: any;
20
34
  style: any;
21
35
  hook: any;
22
- component: StatsComponent;
36
+ component: Stats;
23
37
  init(param?: StatsParams): void;
24
38
  start(): void;
25
39
  lateUpdate(): void;
26
40
  }
27
- export {};
28
- //# sourceMappingURL=StatsSystem.d.ts.map
41
+
42
+ export { }