@eva/plugin-stats 1.3.0-alpha.0 → 2.0.0-beta.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 (243) hide show
  1. package/dist/EVA.plugin.stats.js +210 -73
  2. package/dist/EVA.plugin.stats.min.js +1 -1
  3. package/dist/packages/eva.js/lib/core/Component.d.ts +35 -0
  4. package/dist/packages/eva.js/lib/core/Component.d.ts.map +1 -0
  5. package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts +22 -0
  6. package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts.map +1 -0
  7. package/dist/packages/eva.js/lib/core/GameObject.d.ts +31 -0
  8. package/dist/packages/eva.js/lib/core/GameObject.d.ts.map +1 -0
  9. package/dist/packages/eva.js/lib/core/System.d.ts +30 -0
  10. package/dist/packages/eva.js/lib/core/System.d.ts.map +1 -0
  11. package/dist/packages/eva.js/lib/core/Transform.d.ts +51 -0
  12. package/dist/packages/eva.js/lib/core/Transform.d.ts.map +1 -0
  13. package/dist/packages/eva.js/lib/core/observer.d.ts +23 -0
  14. package/dist/packages/eva.js/lib/core/observer.d.ts.map +1 -0
  15. package/dist/packages/eva.js/lib/decorators/ide.d.ts +2 -0
  16. package/dist/packages/eva.js/lib/decorators/ide.d.ts.map +1 -0
  17. package/dist/packages/eva.js/lib/decorators/system.d.ts +11 -0
  18. package/dist/packages/eva.js/lib/decorators/system.d.ts.map +1 -0
  19. package/dist/packages/eva.js/lib/game/Game.d.ts +72 -0
  20. package/dist/packages/eva.js/lib/game/Game.d.ts.map +1 -0
  21. package/dist/packages/eva.js/lib/game/Scene.d.ts +12 -0
  22. package/dist/packages/eva.js/lib/game/Scene.d.ts.map +1 -0
  23. package/dist/packages/eva.js/lib/game/Ticker.d.ts +25 -0
  24. package/dist/packages/eva.js/lib/game/Ticker.d.ts.map +1 -0
  25. package/dist/packages/eva.js/lib/index.d.ts +26 -0
  26. package/dist/packages/eva.js/lib/index.d.ts.map +1 -0
  27. package/dist/packages/eva.js/lib/loader/Progress.d.ts +21 -0
  28. package/dist/packages/eva.js/lib/loader/Progress.d.ts.map +1 -0
  29. package/dist/packages/eva.js/lib/loader/Resource.d.ts +99 -0
  30. package/dist/packages/eva.js/lib/loader/Resource.d.ts.map +1 -0
  31. package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts +14 -0
  32. package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts.map +1 -0
  33. package/dist/packages/eva.js/lib/timeline/index.d.ts +40 -0
  34. package/dist/packages/eva.js/lib/timeline/index.d.ts.map +1 -0
  35. package/dist/packages/eva.js/lib/timeline/utils.d.ts +2 -0
  36. package/dist/packages/eva.js/lib/timeline/utils.d.ts.map +1 -0
  37. package/dist/packages/plugin-a11y/lib/A11y.d.ts +26 -0
  38. package/dist/packages/plugin-a11y/lib/A11y.d.ts.map +1 -0
  39. package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts +54 -0
  40. package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts.map +1 -0
  41. package/dist/packages/plugin-a11y/lib/constant.d.ts +34 -0
  42. package/dist/packages/plugin-a11y/lib/constant.d.ts.map +1 -0
  43. package/dist/packages/plugin-a11y/lib/index.d.ts +4 -0
  44. package/dist/packages/plugin-a11y/lib/index.d.ts.map +1 -0
  45. package/dist/packages/plugin-a11y/lib/utils.d.ts +6 -0
  46. package/dist/packages/plugin-a11y/lib/utils.d.ts.map +1 -0
  47. package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts +20 -0
  48. package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts.map +1 -0
  49. package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts +33 -0
  50. package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts.map +1 -0
  51. package/dist/packages/plugin-evax/lib/index.d.ts +10 -0
  52. package/dist/packages/plugin-evax/lib/index.d.ts.map +1 -0
  53. package/dist/packages/plugin-evax/lib/utils.d.ts +3 -0
  54. package/dist/packages/plugin-evax/lib/utils.d.ts.map +1 -0
  55. package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts +31 -0
  56. package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts.map +1 -0
  57. package/dist/packages/plugin-matterjs/lib/Physics.d.ts +32 -0
  58. package/dist/packages/plugin-matterjs/lib/Physics.d.ts.map +1 -0
  59. package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts +35 -0
  60. package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts.map +1 -0
  61. package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts +32 -0
  62. package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts.map +1 -0
  63. package/dist/packages/plugin-matterjs/lib/index.d.ts +5 -0
  64. package/dist/packages/plugin-matterjs/lib/index.d.ts.map +1 -0
  65. package/dist/packages/plugin-matterjs/lib/matter.d.ts +3 -0
  66. package/dist/packages/plugin-matterjs/lib/matter.d.ts.map +1 -0
  67. package/dist/packages/plugin-renderer/lib/Renderer.d.ts +19 -0
  68. package/dist/packages/plugin-renderer/lib/Renderer.d.ts.map +1 -0
  69. package/dist/packages/plugin-renderer/lib/System.d.ts +40 -0
  70. package/dist/packages/plugin-renderer/lib/System.d.ts.map +1 -0
  71. package/dist/packages/plugin-renderer/lib/Transform.d.ts +28 -0
  72. package/dist/packages/plugin-renderer/lib/Transform.d.ts.map +1 -0
  73. package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts +20 -0
  74. package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts.map +1 -0
  75. package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts +2 -0
  76. package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts.map +1 -0
  77. package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts +7 -0
  78. package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts.map +1 -0
  79. package/dist/packages/plugin-renderer/lib/index.d.ts +8 -0
  80. package/dist/packages/plugin-renderer/lib/index.d.ts.map +1 -0
  81. package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts +18 -0
  82. package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts.map +1 -0
  83. package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts +17 -0
  84. package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts.map +1 -0
  85. package/dist/packages/plugin-renderer/lib/mixin.d.ts +2 -0
  86. package/dist/packages/plugin-renderer/lib/mixin.d.ts.map +1 -0
  87. package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts +26 -0
  88. package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts.map +1 -0
  89. package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts +3 -0
  90. package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts.map +1 -0
  91. package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts +10 -0
  92. package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts.map +1 -0
  93. package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts +4 -0
  94. package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts.map +1 -0
  95. package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts +24 -0
  96. package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts.map +1 -0
  97. package/dist/packages/plugin-renderer-event/lib/component.d.ts +52 -0
  98. package/dist/packages/plugin-renderer-event/lib/component.d.ts.map +1 -0
  99. package/dist/packages/plugin-renderer-event/lib/index.d.ts +5 -0
  100. package/dist/packages/plugin-renderer-event/lib/index.d.ts.map +1 -0
  101. package/dist/packages/plugin-renderer-event/lib/system.d.ts +19 -0
  102. package/dist/packages/plugin-renderer-event/lib/system.d.ts.map +1 -0
  103. package/dist/packages/plugin-renderer-graphics/lib/component.d.ts +8 -0
  104. package/dist/packages/plugin-renderer-graphics/lib/component.d.ts.map +1 -0
  105. package/dist/packages/plugin-renderer-graphics/lib/index.d.ts +4 -0
  106. package/dist/packages/plugin-renderer-graphics/lib/index.d.ts.map +1 -0
  107. package/dist/packages/plugin-renderer-graphics/lib/system.d.ts +12 -0
  108. package/dist/packages/plugin-renderer-graphics/lib/system.d.ts.map +1 -0
  109. package/dist/packages/plugin-renderer-img/lib/component.d.ts +10 -0
  110. package/dist/packages/plugin-renderer-img/lib/component.d.ts.map +1 -0
  111. package/dist/packages/plugin-renderer-img/lib/index.d.ts +4 -0
  112. package/dist/packages/plugin-renderer-img/lib/index.d.ts.map +1 -0
  113. package/dist/packages/plugin-renderer-img/lib/system.d.ts +18 -0
  114. package/dist/packages/plugin-renderer-img/lib/system.d.ts.map +1 -0
  115. package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts +27 -0
  116. package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts.map +1 -0
  117. package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts +18 -0
  118. package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts.map +1 -0
  119. package/dist/packages/plugin-renderer-lottie/lib/index.d.ts +3 -0
  120. package/dist/packages/plugin-renderer-lottie/lib/index.d.ts.map +1 -0
  121. package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts +180 -0
  122. package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts.map +1 -0
  123. package/dist/packages/plugin-renderer-lottie/lib/types.d.ts +18 -0
  124. package/dist/packages/plugin-renderer-lottie/lib/types.d.ts.map +1 -0
  125. package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts +2 -0
  126. package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts.map +1 -0
  127. package/dist/packages/plugin-renderer-mask/lib/component.d.ts +33 -0
  128. package/dist/packages/plugin-renderer-mask/lib/component.d.ts.map +1 -0
  129. package/dist/packages/plugin-renderer-mask/lib/index.d.ts +4 -0
  130. package/dist/packages/plugin-renderer-mask/lib/index.d.ts.map +1 -0
  131. package/dist/packages/plugin-renderer-mask/lib/system.d.ts +31 -0
  132. package/dist/packages/plugin-renderer-mask/lib/system.d.ts.map +1 -0
  133. package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts +22 -0
  134. package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts.map +1 -0
  135. package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts +4 -0
  136. package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts.map +1 -0
  137. package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts +19 -0
  138. package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts.map +1 -0
  139. package/dist/packages/plugin-renderer-render/lib/component.d.ts +17 -0
  140. package/dist/packages/plugin-renderer-render/lib/component.d.ts.map +1 -0
  141. package/dist/packages/plugin-renderer-render/lib/index.d.ts +4 -0
  142. package/dist/packages/plugin-renderer-render/lib/index.d.ts.map +1 -0
  143. package/dist/packages/plugin-renderer-render/lib/system.d.ts +17 -0
  144. package/dist/packages/plugin-renderer-render/lib/system.d.ts.map +1 -0
  145. package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts +4 -0
  146. package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts.map +1 -0
  147. package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts +5 -0
  148. package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts.map +1 -0
  149. package/dist/packages/plugin-renderer-spine/lib/index.d.ts +4 -0
  150. package/dist/packages/plugin-renderer-spine/lib/index.d.ts.map +1 -0
  151. package/dist/packages/plugin-renderer-sprite/lib/component.d.ts +12 -0
  152. package/dist/packages/plugin-renderer-sprite/lib/component.d.ts.map +1 -0
  153. package/dist/packages/plugin-renderer-sprite/lib/index.d.ts +4 -0
  154. package/dist/packages/plugin-renderer-sprite/lib/index.d.ts.map +1 -0
  155. package/dist/packages/plugin-renderer-sprite/lib/system.d.ts +17 -0
  156. package/dist/packages/plugin-renderer-sprite/lib/system.d.ts.map +1 -0
  157. package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts +31 -0
  158. package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts.map +1 -0
  159. package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts +4 -0
  160. package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts.map +1 -0
  161. package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts +31 -0
  162. package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts.map +1 -0
  163. package/dist/packages/plugin-renderer-test/lib/component.d.ts +20 -0
  164. package/dist/packages/plugin-renderer-test/lib/component.d.ts.map +1 -0
  165. package/dist/packages/plugin-renderer-test/lib/index.d.ts +4 -0
  166. package/dist/packages/plugin-renderer-test/lib/index.d.ts.map +1 -0
  167. package/dist/packages/plugin-renderer-test/lib/system.d.ts +21 -0
  168. package/dist/packages/plugin-renderer-test/lib/system.d.ts.map +1 -0
  169. package/dist/packages/plugin-renderer-test/lib/system2.d.ts +12 -0
  170. package/dist/packages/plugin-renderer-test/lib/system2.d.ts.map +1 -0
  171. package/dist/packages/plugin-renderer-text/lib/component.d.ts +43 -0
  172. package/dist/packages/plugin-renderer-text/lib/component.d.ts.map +1 -0
  173. package/dist/packages/plugin-renderer-text/lib/index.d.ts +4 -0
  174. package/dist/packages/plugin-renderer-text/lib/index.d.ts.map +1 -0
  175. package/dist/packages/plugin-renderer-text/lib/system.d.ts +22 -0
  176. package/dist/packages/plugin-renderer-text/lib/system.d.ts.map +1 -0
  177. package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts +20 -0
  178. package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts.map +1 -0
  179. package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts +4 -0
  180. package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts.map +1 -0
  181. package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts +18 -0
  182. package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts.map +1 -0
  183. package/dist/packages/plugin-sound/lib/Sound.d.ts +44 -0
  184. package/dist/packages/plugin-sound/lib/Sound.d.ts.map +1 -0
  185. package/dist/packages/plugin-sound/lib/SoundSystem.d.ts +37 -0
  186. package/dist/packages/plugin-sound/lib/SoundSystem.d.ts.map +1 -0
  187. package/dist/packages/plugin-sound/lib/index.d.ts +3 -0
  188. package/dist/packages/plugin-sound/lib/index.d.ts.map +1 -0
  189. package/dist/packages/plugin-stats/lib/Stats.d.ts +19 -0
  190. package/dist/packages/plugin-stats/lib/Stats.d.ts.map +1 -0
  191. package/dist/packages/plugin-stats/lib/StatsComponent.d.ts +7 -0
  192. package/dist/packages/plugin-stats/lib/StatsComponent.d.ts.map +1 -0
  193. package/dist/packages/plugin-stats/lib/StatsSystem.d.ts +28 -0
  194. package/dist/packages/plugin-stats/lib/StatsSystem.d.ts.map +1 -0
  195. package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts +18 -0
  196. package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts.map +1 -0
  197. package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts +11 -0
  198. package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts.map +1 -0
  199. package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts +16 -0
  200. package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts.map +1 -0
  201. package/dist/packages/plugin-stats/lib/index.d.ts +9 -0
  202. package/dist/packages/plugin-stats/lib/index.d.ts.map +1 -0
  203. package/dist/packages/plugin-transition/lib/Animation.d.ts +38 -0
  204. package/dist/packages/plugin-transition/lib/Animation.d.ts.map +1 -0
  205. package/dist/packages/plugin-transition/lib/component.d.ts +35 -0
  206. package/dist/packages/plugin-transition/lib/component.d.ts.map +1 -0
  207. package/dist/packages/plugin-transition/lib/index.d.ts +3 -0
  208. package/dist/packages/plugin-transition/lib/index.d.ts.map +1 -0
  209. package/dist/packages/plugin-transition/lib/system.d.ts +6 -0
  210. package/dist/packages/plugin-transition/lib/system.d.ts.map +1 -0
  211. package/dist/packages/renderer-adapter/lib/Application.d.ts +3 -0
  212. package/dist/packages/renderer-adapter/lib/Application.d.ts.map +1 -0
  213. package/dist/packages/renderer-adapter/lib/Container.d.ts +5 -0
  214. package/dist/packages/renderer-adapter/lib/Container.d.ts.map +1 -0
  215. package/dist/packages/renderer-adapter/lib/Graphics.d.ts +5 -0
  216. package/dist/packages/renderer-adapter/lib/Graphics.d.ts.map +1 -0
  217. package/dist/packages/renderer-adapter/lib/NinePatch.d.ts +5 -0
  218. package/dist/packages/renderer-adapter/lib/NinePatch.d.ts.map +1 -0
  219. package/dist/packages/renderer-adapter/lib/Sprite.d.ts +9 -0
  220. package/dist/packages/renderer-adapter/lib/Sprite.d.ts.map +1 -0
  221. package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts +14 -0
  222. package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts.map +1 -0
  223. package/dist/packages/renderer-adapter/lib/Text.d.ts +6 -0
  224. package/dist/packages/renderer-adapter/lib/Text.d.ts.map +1 -0
  225. package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts +9 -0
  226. package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts.map +1 -0
  227. package/dist/packages/renderer-adapter/lib/index.d.ts +9 -0
  228. package/dist/packages/renderer-adapter/lib/index.d.ts.map +1 -0
  229. package/dist/packages/spine-base/lib/Spine.d.ts +32 -0
  230. package/dist/packages/spine-base/lib/Spine.d.ts.map +1 -0
  231. package/dist/packages/spine-base/lib/SpineData.d.ts +5 -0
  232. package/dist/packages/spine-base/lib/SpineData.d.ts.map +1 -0
  233. package/dist/packages/spine-base/lib/SpineSystem.d.ts +20 -0
  234. package/dist/packages/spine-base/lib/SpineSystem.d.ts.map +1 -0
  235. package/dist/packages/spine-base/lib/TexCache.d.ts +10 -0
  236. package/dist/packages/spine-base/lib/TexCache.d.ts.map +1 -0
  237. package/dist/packages/spine-base/lib/index.d.ts +4 -0
  238. package/dist/packages/spine-base/lib/index.d.ts.map +1 -0
  239. package/dist/plugin-stats.cjs.js +190 -3
  240. package/dist/plugin-stats.cjs.prod.js +2 -2
  241. package/dist/plugin-stats.esm.js +189 -2
  242. package/package.json +2 -2
  243. package/dist/plugin-stats.d.ts +0 -37
@@ -76,6 +76,8 @@ var Stats = function (style) {
76
76
  var beginTime = (performance || Date).now(), prevTime = beginTime, frames = 0;
77
77
  var fpsPanel = addPanel(Stats.Panel('FPS', '#0ff', '#002'));
78
78
  var msPanel = addPanel(Stats.Panel('MS', '#0f0', '#020'));
79
+ var dcPanel = addPanel(Stats.Panel('DrawCall', '#330570', '#A69700'));
80
+ var tcPanel = addPanel(Stats.Panel('TC:', '#A62500', '#00B454'));
79
81
  var memPanel;
80
82
  if (self.performance && self.performance.memory) {
81
83
  memPanel = addPanel(Stats.Panel('MB', '#f08', '#201'));
@@ -89,10 +91,14 @@ var Stats = function (style) {
89
91
  begin: function (time) {
90
92
  beginTime = time || (performance || Date).now();
91
93
  },
92
- end: function () {
94
+ end: function (hook) {
93
95
  frames++;
94
96
  var time = (performance || Date).now();
95
97
  msPanel.update(time - beginTime, 200);
98
+ if (hook) {
99
+ dcPanel.update(hook.deltaDrawCalls, Math.max(50, hook.maxDeltaDrawCalls));
100
+ tcPanel.update(hook.texturesCount, Math.max(20, hook.maxTextureCount));
101
+ }
96
102
  if (time >= prevTime + 1000) {
97
103
  fpsPanel.update((frames * 1000) / (time - prevTime), 100);
98
104
  prevTime = time;
@@ -151,6 +157,180 @@ Stats.Panel = function (name, fg, bg) {
151
157
  };
152
158
  var Stats$1 = Stats;
153
159
 
160
+ var GLHook = (function () {
161
+ function GLHook(_gl) {
162
+ this.drawPasses = 0;
163
+ this.isInit = false;
164
+ this.realGLDrawElements = function () { };
165
+ if (_gl) {
166
+ if (_gl.__proto__.drawElements) {
167
+ this.gl = _gl;
168
+ this.realGLDrawElements = _gl.__proto__.drawElements;
169
+ _gl.__proto__.drawElements = this.fakeGLdrawElements(this);
170
+ this.isInit = true;
171
+ }
172
+ }
173
+ else {
174
+ console.error("[GLHook] GL can't be NULL");
175
+ }
176
+ }
177
+ GLHook.prototype.fakeGLdrawElements = function (context) {
178
+ return function (mode, count, type, offset) {
179
+ context.drawPasses++;
180
+ context.realGLDrawElements.call(this, mode, count, type, offset);
181
+ };
182
+ };
183
+ GLHook.prototype.reset = function () {
184
+ this.drawPasses = 0;
185
+ };
186
+ GLHook.prototype.release = function () {
187
+ if (this.isInit) {
188
+ this.gl.__proto__.drawElements = this.realGLDrawElements;
189
+ }
190
+ this.isInit = false;
191
+ };
192
+ return GLHook;
193
+ }());
194
+
195
+ var TextureHook = (function () {
196
+ function TextureHook(_gl) {
197
+ this.createdTextures = new Array();
198
+ this.maxTexturesCount = 0;
199
+ this.isInit = false;
200
+ this.realGLCreateTexture = function () { };
201
+ this.realGLDeleteTexture = function () { };
202
+ if (_gl) {
203
+ if (_gl.__proto__.createTexture) {
204
+ this.gl = _gl;
205
+ this.realGLCreateTexture = _gl.__proto__.createTexture;
206
+ this.realGLDeleteTexture = _gl.__proto__.deleteTexture;
207
+ _gl.__proto__.createTexture = this.fakeGLCreateTexture(this);
208
+ _gl.__proto__.deleteTexture = this.fakeGLDeleteTexture(this);
209
+ this.isInit = true;
210
+ }
211
+ }
212
+ else {
213
+ console.error("[TextureHook] GL can't be NULL");
214
+ }
215
+ }
216
+ Object.defineProperty(TextureHook.prototype, "currentTextureCount", {
217
+ get: function () {
218
+ return this.createdTextures.length;
219
+ },
220
+ enumerable: false,
221
+ configurable: true
222
+ });
223
+ TextureHook.prototype.registerTexture = function (texture) {
224
+ this.createdTextures.push(texture);
225
+ this.maxTexturesCount = Math.max(this.createdTextures.length, this.maxTexturesCount);
226
+ };
227
+ TextureHook.prototype.fakeGLCreateTexture = function (context) {
228
+ return function () {
229
+ var texture = context.realGLCreateTexture.call(this);
230
+ context.registerTexture(texture);
231
+ return texture;
232
+ };
233
+ };
234
+ TextureHook.prototype.fakeGLDeleteTexture = function (context) {
235
+ return function (texture) {
236
+ var index = context.createdTextures.indexOf(texture);
237
+ if (index > -1) {
238
+ context.createdTextures.splice(index, 1);
239
+ }
240
+ context.realGLDeleteTexture.call(this, texture);
241
+ };
242
+ };
243
+ TextureHook.prototype.reset = function () {
244
+ this.createdTextures = new Array();
245
+ this.maxTexturesCount = 0;
246
+ };
247
+ TextureHook.prototype.release = function () {
248
+ if (this.isInit) {
249
+ this.gl.__proto__.createTexture = this.realGLCreateTexture;
250
+ this.gl.__proto__.deleteTexture = this.realGLDeleteTexture;
251
+ console.log('[TextureHook] Hook was removed!');
252
+ }
253
+ this.isInit = false;
254
+ };
255
+ return TextureHook;
256
+ }());
257
+
258
+ var BaseHooks = (function () {
259
+ function BaseHooks() {
260
+ this._drawCalls = -1;
261
+ this._maxDeltaDrawCalls = -1;
262
+ }
263
+ BaseHooks.prototype.attach = function (gl) {
264
+ this.glhook = new GLHook(gl);
265
+ this.texturehook = new TextureHook(gl);
266
+ };
267
+ Object.defineProperty(BaseHooks.prototype, "drawCalls", {
268
+ get: function () {
269
+ if (this.glhook && this.glhook.isInit) {
270
+ return this.glhook.drawPasses;
271
+ }
272
+ return -1;
273
+ },
274
+ enumerable: false,
275
+ configurable: true
276
+ });
277
+ Object.defineProperty(BaseHooks.prototype, "maxDeltaDrawCalls", {
278
+ get: function () {
279
+ return this._maxDeltaDrawCalls;
280
+ },
281
+ enumerable: false,
282
+ configurable: true
283
+ });
284
+ Object.defineProperty(BaseHooks.prototype, "deltaDrawCalls", {
285
+ get: function () {
286
+ if (this._drawCalls == -1) {
287
+ this._drawCalls = this.drawCalls;
288
+ return 0;
289
+ }
290
+ var dc = this.drawCalls;
291
+ var delta = dc - this._drawCalls;
292
+ this._drawCalls = dc;
293
+ this._maxDeltaDrawCalls = Math.max(this._maxDeltaDrawCalls, delta);
294
+ return delta;
295
+ },
296
+ enumerable: false,
297
+ configurable: true
298
+ });
299
+ Object.defineProperty(BaseHooks.prototype, "maxTextureCount", {
300
+ get: function () {
301
+ if (this.texturehook && this.texturehook.isInit)
302
+ return this.texturehook.maxTexturesCount;
303
+ return 0;
304
+ },
305
+ enumerable: false,
306
+ configurable: true
307
+ });
308
+ Object.defineProperty(BaseHooks.prototype, "texturesCount", {
309
+ get: function () {
310
+ if (this.texturehook && this.texturehook.isInit)
311
+ return this.texturehook.currentTextureCount;
312
+ return 0;
313
+ },
314
+ enumerable: false,
315
+ configurable: true
316
+ });
317
+ BaseHooks.prototype.reset = function () {
318
+ this._maxDeltaDrawCalls = -1;
319
+ this._drawCalls = -1;
320
+ if (this.glhook)
321
+ this.glhook.reset();
322
+ if (this.texturehook)
323
+ this.texturehook.reset();
324
+ };
325
+ BaseHooks.prototype.release = function () {
326
+ if (this.glhook)
327
+ this.glhook.release();
328
+ if (this.texturehook)
329
+ this.texturehook.release();
330
+ };
331
+ return BaseHooks;
332
+ }());
333
+
154
334
  var StatsSystem = (function (_super) {
155
335
  __extends(StatsSystem, _super);
156
336
  function StatsSystem() {
@@ -162,6 +342,13 @@ var StatsSystem = (function (_super) {
162
342
  if (param === void 0) { param = { show: true }; }
163
343
  this.show = param.show;
164
344
  this.style = param.style;
345
+ this.renderSystem = this.game.getSystem('Renderer');
346
+ this.app = this.renderSystem.application;
347
+ if (this.app && this.show) {
348
+ var gl = this.app.renderer.gl;
349
+ this.hook = new BaseHooks();
350
+ this.hook.attach(gl);
351
+ }
165
352
  };
166
353
  StatsSystem.prototype.start = function () {
167
354
  if (!this.show)
@@ -175,7 +362,7 @@ var StatsSystem = (function (_super) {
175
362
  StatsSystem.prototype.lateUpdate = function () {
176
363
  if (!this.show)
177
364
  return;
178
- this.stats && this.stats.end();
365
+ this.stats && this.stats.end(this.hook);
179
366
  };
180
367
  StatsSystem.systemName = 'Stats';
181
368
  return StatsSystem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-stats",
3
- "version": "1.3.0-alpha.0",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "@eva/plugin-stats",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-stats.esm.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/eva.js": "1.3.0-alpha.0",
21
+ "@eva/eva.js": "2.0.0-beta.0",
22
22
  "lodash-es": "^4.17.21"
23
23
  }
24
24
  }
@@ -1,37 +0,0 @@
1
- import { Component } from '@eva/eva.js';
2
- import { System } from '@eva/eva.js';
3
-
4
- declare const _default: {
5
- Components: (typeof Stats)[];
6
- Systems: (typeof StatsSystem)[];
7
- };
8
- export default _default;
9
-
10
- export declare class Stats extends Component {
11
- static componentName: string;
12
- stats: any;
13
- update(): void;
14
- }
15
-
16
- declare interface StatsParams {
17
- show?: boolean;
18
- style?: {
19
- width: number;
20
- height: number;
21
- x: number;
22
- y: number;
23
- };
24
- }
25
-
26
- export declare class StatsSystem extends System {
27
- static systemName: string;
28
- show: boolean;
29
- stats: any;
30
- style: any;
31
- component: Stats;
32
- init(param?: StatsParams): void;
33
- start(): void;
34
- lateUpdate(): void;
35
- }
36
-
37
- export { }