@eva/plugin-stats 1.2.7-editor.7 → 1.2.8-fix.1

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.
@@ -436,7 +436,7 @@ var _EVA_IIFE_stats = function (exports, eva_js) {
436
436
  };
437
437
  exports.Stats = Stats$2;
438
438
  exports.StatsSystem = StatsSystem$1;
439
- exports["default"] = index;
439
+ exports['default'] = index;
440
440
  Object.defineProperty(exports, '__esModule', {
441
441
  value: true
442
442
  });
@@ -1 +1 @@
1
- window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_stats=function(t,e){"use strict";var r=function(t,e){return r=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])},r(t,e)};function o(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var n=function(){return n=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},n.apply(this,arguments)},i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.update=function(){this.stats&&this.stats.begin()},e.componentName="Stats",e}(e.Component),s=i,a=function t(e){var r=(e=n({width:20,height:12,x:0,y:0},e)).width,o=e.height,i=e.x,s=e.y,a=0,l=document.createElement("div");function h(t){return l.appendChild(t.dom),t}function u(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: "+r+"vw;height: "+o+"vw;left: "+i+"vw;top: "+s+"vw;",l.addEventListener("click",(function(t){t.preventDefault(),u(++a%l.children.length)}),!1);var c,p=(performance||Date).now(),f=p,d=0,x=h(t.Panel("FPS","#0ff","#002")),w=h(t.Panel("MS","#0f0","#020")),m=h(t.Panel("DrawCall","#330570","#A69700")),_=h(t.Panel("TC:","#A62500","#00B454"));return self.performance&&self.performance.memory&&(c=h(t.Panel("MB","#f08","#201"))),u(0),{REVISION:16,dom:l,addPanel:h,showPanel:u,begin:function(t){p=t||(performance||Date).now()},end:function(t){d++;var e=(performance||Date).now();if(w.update(e-p,200),t&&(m.update(t.deltaDrawCalls,Math.max(50,t.maxDeltaDrawCalls)),_.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:u}};a.Panel=function(t,e,r){var o=1/0,n=0,i=Math.round,s=i(window.devicePixelRatio||1),a=80*s,l=48*s,h=3*s,u=2*s,c=3*s,p=15*s,f=74*s,d=30*s,x=document.createElement("canvas");x.width=a,x.height=l,x.style.cssText="width:100%;height:100%";var w=x.getContext("2d");return w.font="bold "+9*s+"px Helvetica,Arial,sans-serif",w.textBaseline="top",w.fillStyle=r,w.fillRect(0,0,a,l),w.fillStyle=e,w.fillText(t,h,u),w.fillRect(c,p,f,d),w.fillStyle=r,w.globalAlpha=.9,w.fillRect(c,p,f,d),{dom:x,update:function(l,m){o=Math.min(o,l),n=Math.max(n,l),w.fillStyle=r,w.globalAlpha=1,w.fillRect(0,0,a,p),w.fillStyle=e,w.fillText(i(l)+" "+t+" ("+i(o)+"-"+i(n)+")",h,u),w.drawImage(x,c+s,p,f-s,d,c,p,f-s,d),w.fillRect(c+f-s,p,s,d),w.fillStyle=r,w.globalAlpha=.9,w.fillRect(c+f-s,p,s,i((1-l/m)*d))}}};var l=a,h=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.bind(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}return t.prototype.fakeGLdrawElements=function(t,e,r,o){this.drawPasses++,this.realGLDrawElements.call(this.gl,t,e,r,o)},t.prototype.reset=function(){this.drawPasses=0},t.prototype.release=function(){this.isInit&&(this.gl.__proto__.drawElements=this.realGLDrawElements),this.isInit=!1},t}(),u=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.bind(this),t.__proto__.deleteTexture=this.fakeGLDeleteTexture.bind(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(){var t=this.realGLCreateTexture.call(this.gl);return this.registerTexture(t),t},t.prototype.fakeGLDeleteTexture=function(t){var e=this.createdTextures.indexOf(t);e>-1&&this.createdTextures.splice(e,1),this.realGLDeleteTexture.call(this.gl,t)},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}(),c=function(){function t(){this._drawCalls=-1,this._maxDeltaDrawCalls=-1}return t.prototype.attach=function(t){this.glhook=new h(t),this.texturehook=new u(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}(),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.show=!0,e}return o(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 c,this.hook.attach(e)}},e.prototype.start=function(){this.show&&(this.component=this.game.scene.addComponent(new s),this.stats=l(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}(e.System),f=p,d={Components:[s],Systems:[f]};return t.Stats=s,t.StatsSystem=f,t.default=d,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.stats=window.EVA.plugin.stats||_EVA_IIFE_stats;
1
+ window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_stats=function(t,e){"use strict";var r=function(t,e){return(r=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])})(t,e)};function o(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var n=function(){return(n=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}).apply(this,arguments)},i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.update=function(){this.stats&&this.stats.begin()},e.componentName="Stats",e}(e.Component),s=function t(e){var r=(e=n({width:20,height:12,x:0,y:0},e)).width,o=e.height,i=e.x,s=e.y,a=0,l=document.createElement("div");function h(t){return l.appendChild(t.dom),t}function u(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: "+r+"vw;height: "+o+"vw;left: "+i+"vw;top: "+s+"vw;",l.addEventListener("click",(function(t){t.preventDefault(),u(++a%l.children.length)}),!1);var c,p=(performance||Date).now(),f=p,d=0,x=h(t.Panel("FPS","#0ff","#002")),w=h(t.Panel("MS","#0f0","#020")),m=h(t.Panel("DrawCall","#330570","#A69700")),_=h(t.Panel("TC:","#A62500","#00B454"));return self.performance&&self.performance.memory&&(c=h(t.Panel("MB","#f08","#201"))),u(0),{REVISION:16,dom:l,addPanel:h,showPanel:u,begin:function(t){p=t||(performance||Date).now()},end:function(t){d++;var e=(performance||Date).now();if(w.update(e-p,200),t&&(m.update(t.deltaDrawCalls,Math.max(50,t.maxDeltaDrawCalls)),_.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:u}};s.Panel=function(t,e,r){var o=1/0,n=0,i=Math.round,s=i(window.devicePixelRatio||1),a=80*s,l=48*s,h=3*s,u=2*s,c=3*s,p=15*s,f=74*s,d=30*s,x=document.createElement("canvas");x.width=a,x.height=l,x.style.cssText="width:100%;height:100%";var w=x.getContext("2d");return w.font="bold "+9*s+"px Helvetica,Arial,sans-serif",w.textBaseline="top",w.fillStyle=r,w.fillRect(0,0,a,l),w.fillStyle=e,w.fillText(t,h,u),w.fillRect(c,p,f,d),w.fillStyle=r,w.globalAlpha=.9,w.fillRect(c,p,f,d),{dom:x,update:function(l,m){o=Math.min(o,l),n=Math.max(n,l),w.fillStyle=r,w.globalAlpha=1,w.fillRect(0,0,a,p),w.fillStyle=e,w.fillText(i(l)+" "+t+" ("+i(o)+"-"+i(n)+")",h,u),w.drawImage(x,c+s,p,f-s,d,c,p,f-s,d),w.fillRect(c+f-s,p,s,d),w.fillStyle=r,w.globalAlpha=.9,w.fillRect(c+f-s,p,s,i((1-l/m)*d))}}};var a=s,l=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.bind(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}return t.prototype.fakeGLdrawElements=function(t,e,r,o){this.drawPasses++,this.realGLDrawElements.call(this.gl,t,e,r,o)},t.prototype.reset=function(){this.drawPasses=0},t.prototype.release=function(){this.isInit&&(this.gl.__proto__.drawElements=this.realGLDrawElements),this.isInit=!1},t}(),h=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.bind(this),t.__proto__.deleteTexture=this.fakeGLDeleteTexture.bind(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(){var t=this.realGLCreateTexture.call(this.gl);return this.registerTexture(t),t},t.prototype.fakeGLDeleteTexture=function(t){var e=this.createdTextures.indexOf(t);e>-1&&this.createdTextures.splice(e,1),this.realGLDeleteTexture.call(this.gl,t)},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 l(t),this.texturehook=new h(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}(),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.show=!0,e}return o(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 i),this.stats=a(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}(e.System),p={Components:[i],Systems:[c]};return t.Stats=i,t.StatsSystem=c,t.default=p,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA);window.EVA.plugin.stats=window.EVA.plugin.stats||_EVA_IIFE_stats;
@@ -374,4 +374,4 @@ var index = {
374
374
 
375
375
  exports.Stats = Stats$2;
376
376
  exports.StatsSystem = StatsSystem$1;
377
- exports["default"] = index;
377
+ exports['default'] = index;
@@ -1,4 +1,4 @@
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)};
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])})(t,r)};
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation. All rights reserved.
4
4
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -12,4 +12,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
12
12
 
13
13
  See the Apache Version 2.0 License for specific language governing permissions
14
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 s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},o.apply(this,arguments)},s=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),n=function(t){var e=(t=o({width:20,height:12,x:0,y:0},t)).width,r=t.height,s=t.x,i=t.y,a=0,l=document.createElement("div");function h(t){return l.appendChild(t.dom),t}function u(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: "+s+"vw;top: "+i+"vw;",l.addEventListener("click",(function(t){t.preventDefault(),u(++a%l.children.length)}),!1);var c,p=(performance||Date).now(),f=p,d=0,x=h(n.Panel("FPS","#0ff","#002")),m=h(n.Panel("MS","#0f0","#020")),w=h(n.Panel("DrawCall","#330570","#A69700")),y=h(n.Panel("TC:","#A62500","#00B454"));return self.performance&&self.performance.memory&&(c=h(n.Panel("MB","#f08","#201"))),u(0),{REVISION:16,dom:l,addPanel:h,showPanel:u,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:u}};n.Panel=function(t,e,r){var o=1/0,s=0,n=Math.round,i=n(window.devicePixelRatio||1),a=80*i,l=48*i,h=3*i,u=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,h,u),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),s=Math.max(s,l),m.fillStyle=r,m.globalAlpha=1,m.fillRect(0,0,a,p),m.fillStyle=e,m.fillText(n(l)+" "+t+" ("+n(o)+"-"+n(s)+")",h,u),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,n((1-l/w)*d))}}};var i=n,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.bind(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}return t.prototype.fakeGLdrawElements=function(t,e,r,o){this.drawPasses++,this.realGLDrawElements.call(this.gl,t,e,r,o)},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.bind(this),t.__proto__.deleteTexture=this.fakeGLDeleteTexture.bind(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(){var t=this.realGLCreateTexture.call(this.gl);return this.registerTexture(t),t},t.prototype.fakeGLDeleteTexture=function(t){var e=this.createdTextures.indexOf(t);e>-1&&this.createdTextures.splice(e,1),this.realGLDeleteTexture.call(this.gl,t)},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}(),h=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}(),u=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 h,this.hook.attach(e)}},e.prototype.start=function(){this.show&&(this.component=this.game.scene.addComponent(new s),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:[s],Systems:[u]};exports.Stats=s,exports.StatsSystem=u,exports.default=c;
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 s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},s=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),n=function(t){var e=(t=o({width:20,height:12,x:0,y:0},t)).width,r=t.height,s=t.x,i=t.y,a=0,l=document.createElement("div");function h(t){return l.appendChild(t.dom),t}function u(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: "+s+"vw;top: "+i+"vw;",l.addEventListener("click",(function(t){t.preventDefault(),u(++a%l.children.length)}),!1);var c,p=(performance||Date).now(),f=p,d=0,x=h(n.Panel("FPS","#0ff","#002")),m=h(n.Panel("MS","#0f0","#020")),w=h(n.Panel("DrawCall","#330570","#A69700")),y=h(n.Panel("TC:","#A62500","#00B454"));return self.performance&&self.performance.memory&&(c=h(n.Panel("MB","#f08","#201"))),u(0),{REVISION:16,dom:l,addPanel:h,showPanel:u,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:u}};n.Panel=function(t,e,r){var o=1/0,s=0,n=Math.round,i=n(window.devicePixelRatio||1),a=80*i,l=48*i,h=3*i,u=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,h,u),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),s=Math.max(s,l),m.fillStyle=r,m.globalAlpha=1,m.fillRect(0,0,a,p),m.fillStyle=e,m.fillText(n(l)+" "+t+" ("+n(o)+"-"+n(s)+")",h,u),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,n((1-l/w)*d))}}};var i=n,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.bind(this),this.isInit=!0):console.error("[GLHook] GL can't be NULL")}return t.prototype.fakeGLdrawElements=function(t,e,r,o){this.drawPasses++,this.realGLDrawElements.call(this.gl,t,e,r,o)},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.bind(this),t.__proto__.deleteTexture=this.fakeGLDeleteTexture.bind(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(){var t=this.realGLCreateTexture.call(this.gl);return this.registerTexture(t),t},t.prototype.fakeGLDeleteTexture=function(t){var e=this.createdTextures.indexOf(t);e>-1&&this.createdTextures.splice(e,1),this.realGLDeleteTexture.call(this.gl,t)},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}(),h=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}(),u=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 h,this.hook.attach(e)}},e.prototype.start=function(){this.show&&(this.component=this.game.scene.addComponent(new s),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:[s],Systems:[u]};exports.Stats=s,exports.StatsSystem=u,exports.default=c;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-stats",
3
- "version": "1.2.7-editor.7",
3
+ "version": "1.2.8-fix.1",
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.2.7-editor.7",
21
+ "@eva/eva.js": "1.2.8-fix.1",
22
22
  "lodash-es": "^4.17.21"
23
23
  }
24
24
  }
@@ -1,395 +0,0 @@
1
- import { __extends, __assign } from 'tslib';
2
- import { Component, System } from '@eva/eva.js/dist/miniprogram';
3
- import { documentAlias, performance, windowAlias } from '@eva/miniprogram-adapter';
4
-
5
- var StatsComponent = function (_super) {
6
- __extends(StatsComponent, _super);
7
-
8
- function StatsComponent() {
9
- return _super !== null && _super.apply(this, arguments) || this;
10
- }
11
-
12
- StatsComponent.prototype.update = function () {
13
- this.stats && this.stats.begin();
14
- };
15
-
16
- StatsComponent.componentName = 'Stats';
17
- return StatsComponent;
18
- }(Component);
19
-
20
- var Stats$2 = StatsComponent;
21
-
22
- var Stats = function Stats(style) {
23
- style = __assign({
24
- width: 20,
25
- height: 12,
26
- x: 0,
27
- y: 0
28
- }, style);
29
- var width = style.width,
30
- height = style.height,
31
- x = style.x,
32
- y = style.y;
33
- var mode = 0;
34
- var container = documentAlias.createElement('div');
35
- 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;";
36
- container.addEventListener('click', function (event) {
37
- event.preventDefault();
38
- showPanel(++mode % container.children.length);
39
- }, false);
40
-
41
- function addPanel(panel) {
42
- container.appendChild(panel.dom);
43
- return panel;
44
- }
45
-
46
- function showPanel(id) {
47
- for (var i = 0; i < container.children.length; i++) {
48
- container.children[i].style.display = i === id ? 'block' : 'none';
49
- }
50
-
51
- mode = id;
52
- }
53
-
54
- var beginTime = (performance || Date).now(),
55
- prevTime = beginTime,
56
- frames = 0;
57
- var fpsPanel = addPanel(Stats.Panel('FPS', '#0ff', '#002'));
58
- var msPanel = addPanel(Stats.Panel('MS', '#0f0', '#020'));
59
- var dcPanel = addPanel(Stats.Panel('DrawCall', '#330570', '#A69700'));
60
- var tcPanel = addPanel(Stats.Panel('TC:', '#A62500', '#00B454'));
61
- var memPanel;
62
-
63
- if (self.performance && self.performance.memory) {
64
- memPanel = addPanel(Stats.Panel('MB', '#f08', '#201'));
65
- }
66
-
67
- showPanel(0);
68
- return {
69
- REVISION: 16,
70
- dom: container,
71
- addPanel: addPanel,
72
- showPanel: showPanel,
73
- begin: function begin(time) {
74
- beginTime = time || (performance || Date).now();
75
- },
76
- end: function end(hook) {
77
- frames++;
78
- var time = (performance || Date).now();
79
- msPanel.update(time - beginTime, 200);
80
-
81
- if (hook) {
82
- dcPanel.update(hook.deltaDrawCalls, Math.max(50, hook.maxDeltaDrawCalls));
83
- tcPanel.update(hook.texturesCount, Math.max(20, hook.maxTextureCount));
84
- }
85
-
86
- if (time >= prevTime + 1000) {
87
- fpsPanel.update(frames * 1000 / (time - prevTime), 100);
88
- prevTime = time;
89
- frames = 0;
90
-
91
- if (memPanel) {
92
- var memory = performance.memory;
93
- memPanel.update(memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576);
94
- }
95
- }
96
-
97
- return time;
98
- },
99
- update: function update() {
100
- beginTime = this.end();
101
- },
102
- domElement: container,
103
- setMode: showPanel
104
- };
105
- };
106
-
107
- Stats.Panel = function (name, fg, bg) {
108
- var min = Infinity,
109
- max = 0;
110
- var round = Math.round;
111
- var PR = round(windowAlias.devicePixelRatio || 1);
112
- var WIDTH = 80 * PR,
113
- HEIGHT = 48 * PR,
114
- TEXT_X = 3 * PR,
115
- TEXT_Y = 2 * PR,
116
- GRAPH_X = 3 * PR,
117
- GRAPH_Y = 15 * PR,
118
- GRAPH_WIDTH = 74 * PR,
119
- GRAPH_HEIGHT = 30 * PR;
120
- var canvas = documentAlias.createElement('canvas');
121
- canvas.width = WIDTH;
122
- canvas.height = HEIGHT;
123
- canvas.style.cssText = 'width:100%;height:100%';
124
- var context = canvas.getContext('2d');
125
- context.font = 'bold ' + 9 * PR + 'px Helvetica,Arial,sans-serif';
126
- context.textBaseline = 'top';
127
- context.fillStyle = bg;
128
- context.fillRect(0, 0, WIDTH, HEIGHT);
129
- context.fillStyle = fg;
130
- context.fillText(name, TEXT_X, TEXT_Y);
131
- context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
132
- context.fillStyle = bg;
133
- context.globalAlpha = 0.9;
134
- context.fillRect(GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT);
135
- return {
136
- dom: canvas,
137
- update: function update(value, maxValue) {
138
- min = Math.min(min, value);
139
- max = Math.max(max, value);
140
- context.fillStyle = bg;
141
- context.globalAlpha = 1;
142
- context.fillRect(0, 0, WIDTH, GRAPH_Y);
143
- context.fillStyle = fg;
144
- context.fillText(round(value) + ' ' + name + ' (' + round(min) + '-' + round(max) + ')', TEXT_X, TEXT_Y);
145
- context.drawImage(canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT);
146
- context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT);
147
- context.fillStyle = bg;
148
- context.globalAlpha = 0.9;
149
- context.fillRect(GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round((1 - value / maxValue) * GRAPH_HEIGHT));
150
- }
151
- };
152
- };
153
-
154
- var Stats$1 = Stats;
155
-
156
- var GLHook = function () {
157
- function GLHook(_gl) {
158
- this.drawPasses = 0;
159
- this.isInit = false;
160
-
161
- this.realGLDrawElements = function () {};
162
-
163
- if (_gl) {
164
- if (_gl.__proto__.drawElements) {
165
- this.gl = _gl;
166
- this.realGLDrawElements = _gl.__proto__.drawElements;
167
- _gl.__proto__.drawElements = this.fakeGLdrawElements.bind(this);
168
- this.isInit = true;
169
- }
170
- } else {
171
- console.error("[GLHook] GL can't be NULL");
172
- }
173
- }
174
-
175
- GLHook.prototype.fakeGLdrawElements = function (mode, count, type, offset) {
176
- this.drawPasses++;
177
- this.realGLDrawElements.call(this.gl, mode, count, type, offset);
178
- };
179
-
180
- GLHook.prototype.reset = function () {
181
- this.drawPasses = 0;
182
- };
183
-
184
- GLHook.prototype.release = function () {
185
- if (this.isInit) {
186
- this.gl.__proto__.drawElements = this.realGLDrawElements;
187
- }
188
-
189
- this.isInit = false;
190
- };
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
-
201
- this.realGLCreateTexture = function () {};
202
-
203
- this.realGLDeleteTexture = function () {};
204
-
205
- if (_gl) {
206
- if (_gl.__proto__.createTexture) {
207
- this.gl = _gl;
208
- this.realGLCreateTexture = _gl.__proto__.createTexture;
209
- this.realGLDeleteTexture = _gl.__proto__.deleteTexture;
210
- _gl.__proto__.createTexture = this.fakeGLCreateTexture.bind(this);
211
- _gl.__proto__.deleteTexture = this.fakeGLDeleteTexture.bind(this);
212
- this.isInit = true;
213
- }
214
- } else {
215
- console.error("[TextureHook] GL can't be NULL");
216
- }
217
- }
218
-
219
- Object.defineProperty(TextureHook.prototype, "currentTextureCount", {
220
- get: function get() {
221
- return this.createdTextures.length;
222
- },
223
- enumerable: false,
224
- configurable: true
225
- });
226
-
227
- TextureHook.prototype.registerTexture = function (texture) {
228
- this.createdTextures.push(texture);
229
- this.maxTexturesCount = Math.max(this.createdTextures.length, this.maxTexturesCount);
230
- };
231
-
232
- TextureHook.prototype.fakeGLCreateTexture = function () {
233
- var texture = this.realGLCreateTexture.call(this.gl);
234
- this.registerTexture(texture);
235
- return texture;
236
- };
237
-
238
- TextureHook.prototype.fakeGLDeleteTexture = function (texture) {
239
- var index = this.createdTextures.indexOf(texture);
240
-
241
- if (index > -1) {
242
- this.createdTextures.splice(index, 1);
243
- }
244
-
245
- this.realGLDeleteTexture.call(this.gl, texture);
246
- };
247
-
248
- TextureHook.prototype.reset = function () {
249
- this.createdTextures = new Array();
250
- this.maxTexturesCount = 0;
251
- };
252
-
253
- TextureHook.prototype.release = function () {
254
- if (this.isInit) {
255
- this.gl.__proto__.createTexture = this.realGLCreateTexture;
256
- this.gl.__proto__.deleteTexture = this.realGLDeleteTexture;
257
- console.log('[TextureHook] Hook was removed!');
258
- }
259
-
260
- this.isInit = false;
261
- };
262
-
263
- return TextureHook;
264
- }();
265
-
266
- var BaseHooks = function () {
267
- function BaseHooks() {
268
- this._drawCalls = -1;
269
- this._maxDeltaDrawCalls = -1;
270
- }
271
-
272
- BaseHooks.prototype.attach = function (gl) {
273
- this.glhook = new GLHook(gl);
274
- this.texturehook = new TextureHook(gl);
275
- };
276
-
277
- Object.defineProperty(BaseHooks.prototype, "drawCalls", {
278
- get: function get() {
279
- if (this.glhook && this.glhook.isInit) {
280
- return this.glhook.drawPasses;
281
- }
282
-
283
- return -1;
284
- },
285
- enumerable: false,
286
- configurable: true
287
- });
288
- Object.defineProperty(BaseHooks.prototype, "maxDeltaDrawCalls", {
289
- get: function get() {
290
- return this._maxDeltaDrawCalls;
291
- },
292
- enumerable: false,
293
- configurable: true
294
- });
295
- Object.defineProperty(BaseHooks.prototype, "deltaDrawCalls", {
296
- get: function get() {
297
- if (this._drawCalls == -1) {
298
- this._drawCalls = this.drawCalls;
299
- return 0;
300
- }
301
-
302
- var dc = this.drawCalls;
303
- var delta = dc - this._drawCalls;
304
- this._drawCalls = dc;
305
- this._maxDeltaDrawCalls = Math.max(this._maxDeltaDrawCalls, delta);
306
- return delta;
307
- },
308
- enumerable: false,
309
- configurable: true
310
- });
311
- Object.defineProperty(BaseHooks.prototype, "maxTextureCount", {
312
- get: function get() {
313
- if (this.texturehook && this.texturehook.isInit) return this.texturehook.maxTexturesCount;
314
- return 0;
315
- },
316
- enumerable: false,
317
- configurable: true
318
- });
319
- Object.defineProperty(BaseHooks.prototype, "texturesCount", {
320
- get: function get() {
321
- if (this.texturehook && this.texturehook.isInit) return this.texturehook.currentTextureCount;
322
- return 0;
323
- },
324
- enumerable: false,
325
- configurable: true
326
- });
327
-
328
- BaseHooks.prototype.reset = function () {
329
- this._maxDeltaDrawCalls = -1;
330
- this._drawCalls = -1;
331
- if (this.glhook) this.glhook.reset();
332
- if (this.texturehook) this.texturehook.reset();
333
- };
334
-
335
- BaseHooks.prototype.release = function () {
336
- if (this.glhook) this.glhook.release();
337
- if (this.texturehook) this.texturehook.release();
338
- };
339
-
340
- return BaseHooks;
341
- }();
342
-
343
- var StatsSystem = function (_super) {
344
- __extends(StatsSystem, _super);
345
-
346
- function StatsSystem() {
347
- var _this = _super !== null && _super.apply(this, arguments) || this;
348
-
349
- _this.show = true;
350
- return _this;
351
- }
352
-
353
- StatsSystem.prototype.init = function (param) {
354
- if (param === void 0) {
355
- param = {
356
- show: true
357
- };
358
- }
359
-
360
- this.show = param.show;
361
- this.style = param.style;
362
- this.renderSystem = this.game.getSystem('Renderer');
363
- this.app = this.renderSystem.application;
364
-
365
- if (this.app && this.show) {
366
- var gl = this.app.renderer.gl;
367
- this.hook = new BaseHooks();
368
- this.hook.attach(gl);
369
- }
370
- };
371
-
372
- StatsSystem.prototype.start = function () {
373
- if (!this.show) return;
374
- this.component = this.game.scene.addComponent(new Stats$2());
375
- this.stats = Stats$1(this.style);
376
- this.component.stats = this.stats;
377
- this.stats.showPanel(0);
378
- documentAlias.body.appendChild(this.stats.dom);
379
- };
380
-
381
- StatsSystem.prototype.lateUpdate = function () {
382
- if (!this.show) return;
383
- this.stats && this.stats.end(this.hook);
384
- };
385
-
386
- StatsSystem.systemName = 'Stats';
387
- return StatsSystem;
388
- }(System);
389
-
390
- var StatsSystem$1 = StatsSystem;
391
- var index = {
392
- Components: [Stats$2],
393
- Systems: [StatsSystem$1]
394
- };
395
- export { Stats$2 as Stats, StatsSystem$1 as StatsSystem, index as default };