@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.
- package/dist/EVA.plugin.stats.js +210 -73
- package/dist/EVA.plugin.stats.min.js +1 -1
- package/dist/packages/eva.js/lib/core/Component.d.ts +35 -0
- package/dist/packages/eva.js/lib/core/Component.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts +22 -0
- package/dist/packages/eva.js/lib/core/ComponentObserver.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/core/GameObject.d.ts +31 -0
- package/dist/packages/eva.js/lib/core/GameObject.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/core/System.d.ts +30 -0
- package/dist/packages/eva.js/lib/core/System.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/core/Transform.d.ts +51 -0
- package/dist/packages/eva.js/lib/core/Transform.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/core/observer.d.ts +23 -0
- package/dist/packages/eva.js/lib/core/observer.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/decorators/ide.d.ts +2 -0
- package/dist/packages/eva.js/lib/decorators/ide.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/decorators/system.d.ts +11 -0
- package/dist/packages/eva.js/lib/decorators/system.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/game/Game.d.ts +72 -0
- package/dist/packages/eva.js/lib/game/Game.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/game/Scene.d.ts +12 -0
- package/dist/packages/eva.js/lib/game/Scene.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/game/Ticker.d.ts +25 -0
- package/dist/packages/eva.js/lib/game/Ticker.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/index.d.ts +26 -0
- package/dist/packages/eva.js/lib/index.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/loader/Progress.d.ts +21 -0
- package/dist/packages/eva.js/lib/loader/Progress.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/loader/Resource.d.ts +99 -0
- package/dist/packages/eva.js/lib/loader/Resource.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts +14 -0
- package/dist/packages/eva.js/lib/loader/resourceLoader.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/timeline/index.d.ts +40 -0
- package/dist/packages/eva.js/lib/timeline/index.d.ts.map +1 -0
- package/dist/packages/eva.js/lib/timeline/utils.d.ts +2 -0
- package/dist/packages/eva.js/lib/timeline/utils.d.ts.map +1 -0
- package/dist/packages/plugin-a11y/lib/A11y.d.ts +26 -0
- package/dist/packages/plugin-a11y/lib/A11y.d.ts.map +1 -0
- package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts +54 -0
- package/dist/packages/plugin-a11y/lib/A11ySystem.d.ts.map +1 -0
- package/dist/packages/plugin-a11y/lib/constant.d.ts +34 -0
- package/dist/packages/plugin-a11y/lib/constant.d.ts.map +1 -0
- package/dist/packages/plugin-a11y/lib/index.d.ts +4 -0
- package/dist/packages/plugin-a11y/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-a11y/lib/utils.d.ts +6 -0
- package/dist/packages/plugin-a11y/lib/utils.d.ts.map +1 -0
- package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts +20 -0
- package/dist/packages/plugin-evax/lib/EvaXComponent.d.ts.map +1 -0
- package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts +33 -0
- package/dist/packages/plugin-evax/lib/EvaXSystem.d.ts.map +1 -0
- package/dist/packages/plugin-evax/lib/index.d.ts +10 -0
- package/dist/packages/plugin-evax/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-evax/lib/utils.d.ts +3 -0
- package/dist/packages/plugin-evax/lib/utils.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts +31 -0
- package/dist/packages/plugin-matterjs/lib/BodiesFactory.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/Physics.d.ts +32 -0
- package/dist/packages/plugin-matterjs/lib/Physics.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts +35 -0
- package/dist/packages/plugin-matterjs/lib/PhysicsEngine.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts +32 -0
- package/dist/packages/plugin-matterjs/lib/PhysicsSystem.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/index.d.ts +5 -0
- package/dist/packages/plugin-matterjs/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-matterjs/lib/matter.d.ts +3 -0
- package/dist/packages/plugin-matterjs/lib/matter.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/Renderer.d.ts +19 -0
- package/dist/packages/plugin-renderer/lib/Renderer.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/System.d.ts +40 -0
- package/dist/packages/plugin-renderer/lib/System.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/Transform.d.ts +28 -0
- package/dist/packages/plugin-renderer/lib/Transform.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts +20 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/ability.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts +2 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/fix/loader.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts +7 -0
- package/dist/packages/plugin-renderer/lib/compressedTexture/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/index.d.ts +8 -0
- package/dist/packages/plugin-renderer/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts +18 -0
- package/dist/packages/plugin-renderer/lib/manager/ContainerManager.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts +17 -0
- package/dist/packages/plugin-renderer/lib/manager/RendererManager.d.ts.map +1 -0
- package/dist/packages/plugin-renderer/lib/mixin.d.ts +2 -0
- package/dist/packages/plugin-renderer/lib/mixin.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts +26 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts +3 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/db.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts +10 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/engine.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts +24 -0
- package/dist/packages/plugin-renderer-dragonbone/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-event/lib/component.d.ts +52 -0
- package/dist/packages/plugin-renderer-event/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-event/lib/index.d.ts +5 -0
- package/dist/packages/plugin-renderer-event/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-event/lib/system.d.ts +19 -0
- package/dist/packages/plugin-renderer-event/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-graphics/lib/component.d.ts +8 -0
- package/dist/packages/plugin-renderer-graphics/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-graphics/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-graphics/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-graphics/lib/system.d.ts +12 -0
- package/dist/packages/plugin-renderer-graphics/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-img/lib/component.d.ts +10 -0
- package/dist/packages/plugin-renderer-img/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-img/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-img/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-img/lib/system.d.ts +18 -0
- package/dist/packages/plugin-renderer-img/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts +27 -0
- package/dist/packages/plugin-renderer-lottie/lib/Lottie.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts +18 -0
- package/dist/packages/plugin-renderer-lottie/lib/LottieSystem.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/index.d.ts +3 -0
- package/dist/packages/plugin-renderer-lottie/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts +180 -0
- package/dist/packages/plugin-renderer-lottie/lib/lottie-pixi.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/types.d.ts +18 -0
- package/dist/packages/plugin-renderer-lottie/lib/types.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts +2 -0
- package/dist/packages/plugin-renderer-lottie/lib/utils.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-mask/lib/component.d.ts +33 -0
- package/dist/packages/plugin-renderer-mask/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-mask/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-mask/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-mask/lib/system.d.ts +31 -0
- package/dist/packages/plugin-renderer-mask/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts +22 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts +19 -0
- package/dist/packages/plugin-renderer-nine-patch/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-render/lib/component.d.ts +17 -0
- package/dist/packages/plugin-renderer-render/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-render/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-render/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-render/lib/system.d.ts +17 -0
- package/dist/packages/plugin-renderer-render/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts +4 -0
- package/dist/packages/plugin-renderer-spine/lib/Spine.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts +5 -0
- package/dist/packages/plugin-renderer-spine/lib/SpineSystem.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-spine/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-spine/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite/lib/component.d.ts +12 -0
- package/dist/packages/plugin-renderer-sprite/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-sprite/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite/lib/system.d.ts +17 -0
- package/dist/packages/plugin-renderer-sprite/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts +31 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts +31 -0
- package/dist/packages/plugin-renderer-sprite-animation/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-test/lib/component.d.ts +20 -0
- package/dist/packages/plugin-renderer-test/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-test/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-test/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-test/lib/system.d.ts +21 -0
- package/dist/packages/plugin-renderer-test/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-test/lib/system2.d.ts +12 -0
- package/dist/packages/plugin-renderer-test/lib/system2.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-text/lib/component.d.ts +43 -0
- package/dist/packages/plugin-renderer-text/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-text/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-text/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-text/lib/system.d.ts +22 -0
- package/dist/packages/plugin-renderer-text/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts +20 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts +4 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts +18 -0
- package/dist/packages/plugin-renderer-tiling-sprite/lib/system.d.ts.map +1 -0
- package/dist/packages/plugin-sound/lib/Sound.d.ts +44 -0
- package/dist/packages/plugin-sound/lib/Sound.d.ts.map +1 -0
- package/dist/packages/plugin-sound/lib/SoundSystem.d.ts +37 -0
- package/dist/packages/plugin-sound/lib/SoundSystem.d.ts.map +1 -0
- package/dist/packages/plugin-sound/lib/index.d.ts +3 -0
- package/dist/packages/plugin-sound/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/Stats.d.ts +19 -0
- package/dist/packages/plugin-stats/lib/Stats.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/StatsComponent.d.ts +7 -0
- package/dist/packages/plugin-stats/lib/StatsComponent.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/StatsSystem.d.ts +28 -0
- package/dist/packages/plugin-stats/lib/StatsSystem.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts +18 -0
- package/dist/packages/plugin-stats/lib/hooks/BaseHooks.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts +11 -0
- package/dist/packages/plugin-stats/lib/hooks/GLHook.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts +16 -0
- package/dist/packages/plugin-stats/lib/hooks/TextureHook.d.ts.map +1 -0
- package/dist/packages/plugin-stats/lib/index.d.ts +9 -0
- package/dist/packages/plugin-stats/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-transition/lib/Animation.d.ts +38 -0
- package/dist/packages/plugin-transition/lib/Animation.d.ts.map +1 -0
- package/dist/packages/plugin-transition/lib/component.d.ts +35 -0
- package/dist/packages/plugin-transition/lib/component.d.ts.map +1 -0
- package/dist/packages/plugin-transition/lib/index.d.ts +3 -0
- package/dist/packages/plugin-transition/lib/index.d.ts.map +1 -0
- package/dist/packages/plugin-transition/lib/system.d.ts +6 -0
- package/dist/packages/plugin-transition/lib/system.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/Application.d.ts +3 -0
- package/dist/packages/renderer-adapter/lib/Application.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/Container.d.ts +5 -0
- package/dist/packages/renderer-adapter/lib/Container.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/Graphics.d.ts +5 -0
- package/dist/packages/renderer-adapter/lib/Graphics.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/NinePatch.d.ts +5 -0
- package/dist/packages/renderer-adapter/lib/NinePatch.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/Sprite.d.ts +9 -0
- package/dist/packages/renderer-adapter/lib/Sprite.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts +14 -0
- package/dist/packages/renderer-adapter/lib/SpriteAnimation.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/Text.d.ts +6 -0
- package/dist/packages/renderer-adapter/lib/Text.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts +9 -0
- package/dist/packages/renderer-adapter/lib/TilingSprite.d.ts.map +1 -0
- package/dist/packages/renderer-adapter/lib/index.d.ts +9 -0
- package/dist/packages/renderer-adapter/lib/index.d.ts.map +1 -0
- package/dist/packages/spine-base/lib/Spine.d.ts +32 -0
- package/dist/packages/spine-base/lib/Spine.d.ts.map +1 -0
- package/dist/packages/spine-base/lib/SpineData.d.ts +5 -0
- package/dist/packages/spine-base/lib/SpineData.d.ts.map +1 -0
- package/dist/packages/spine-base/lib/SpineSystem.d.ts +20 -0
- package/dist/packages/spine-base/lib/SpineSystem.d.ts.map +1 -0
- package/dist/packages/spine-base/lib/TexCache.d.ts +10 -0
- package/dist/packages/spine-base/lib/TexCache.d.ts.map +1 -0
- package/dist/packages/spine-base/lib/index.d.ts +4 -0
- package/dist/packages/spine-base/lib/index.d.ts.map +1 -0
- package/dist/plugin-stats.cjs.js +190 -3
- package/dist/plugin-stats.cjs.prod.js +2 -2
- package/dist/plugin-stats.esm.js +189 -2
- package/package.json +2 -2
- package/dist/plugin-stats.d.ts +0 -37
package/dist/plugin-stats.esm.js
CHANGED
|
@@ -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": "
|
|
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": "
|
|
21
|
+
"@eva/eva.js": "2.0.0-beta.0",
|
|
22
22
|
"lodash-es": "^4.17.21"
|
|
23
23
|
}
|
|
24
24
|
}
|
package/dist/plugin-stats.d.ts
DELETED
|
@@ -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 { }
|