var INSPECTOR;!(function(e){var t=(function(){function t(i,n){var r=this;if(this._popupMode=!1,this._scene=i,t.DOCUMENT=window.document,t.WINDOW=window,n)this._buildInspector(n);else{var s=this._scene.getEngine().getRenderingCanvas(),a=s.parentElement,o=t.WINDOW.getComputedStyle(s);this._canvasStyle={width:o.width,height:o.height,position:o.position,padding:o.padding,paddingBottom:o.paddingBottom,paddingLeft:o.paddingLeft,paddingTop:o.paddingTop,paddingRight:o.paddingRight,margin:o.margin,marginBottom:o.marginBottom,marginLeft:o.marginLeft,marginTop:o.marginTop,marginRight:o.marginRight},this._c2diwrapper=e.Helpers.CreateDiv("insp-wrapper");for(var l in this._canvasStyle)this._c2diwrapper.style[l]=this._canvasStyle[l];var p=parseFloat(o.width.substr(0,o.width.length-2))||0,h=parseFloat(o.height.substr(0,o.height.length-2))||0,c=window.innerWidth,u=window.innerHeight,d=p/c*100,_=h/u*100;this._c2diwrapper.style.width=d+"%",this._c2diwrapper.style.height=_+"%",s.style.position="static",s.style.width="100%",s.style.height="100%",s.style.paddingBottom="0",s.style.paddingLeft="0",s.style.paddingTop="0",s.style.paddingRight="0",s.style.margin="0",s.style.marginBottom="0",s.style.marginLeft="0",s.style.marginTop="0",s.style.marginRight="0",a.replaceChild(this._c2diwrapper,s),this._c2diwrapper.appendChild(s);var v=e.Helpers.CreateDiv("insp-right-panel",this._c2diwrapper);Split([s,v],{direction:"horizontal",sizes:[75,25],onDrag:function(){e.Helpers.SEND_EVENT("resize"),r._tabbar&&r._tabbar.updateWidth()}}),this._buildInspector(v),e.Helpers.SEND_EVENT("resize")}this.refresh()}return t.prototype._buildInspector=function(t){this._tabbar=new e.TabBar(this),this._topPanel=e.Helpers.CreateDiv("top-panel",t),this._topPanel.appendChild(this._tabbar.toHtml()),this._tabbar.updateWidth(),this._tabPanel=e.Helpers.CreateDiv("tab-panel-content",this._topPanel)},Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"popupMode",{get:function(){return this._popupMode},enumerable:!0,configurable:!0}),t.prototype.filterItem=function(e){this._tabbar.getActiveTab().filter(e)},t.prototype.displayObjectDetails=function(e){this._tabbar.switchMeshTab(e)},t.prototype.refresh=function(){e.Helpers.CleanDiv(this._tabPanel);var t=this._tabbar.getActiveTab();t.update(),this._tabPanel.appendChild(t.getPanel()),e.Helpers.SEND_EVENT("resize")},t.prototype.dispose=function(){if(!this._popupMode){var t=this._scene.getEngine().getRenderingCanvas();for(var i in this._canvasStyle)t.style[i]=this._canvasStyle[i];var n=t.parentElement.parentElement;n.appendChild(t),e.Helpers.CleanDiv(this._c2diwrapper),this._c2diwrapper.remove(),e.Helpers.SEND_EVENT("resize")}},t.prototype.openPopup=function(){var i=window.open("","Babylon.js INSPECTOR","toolbar=no,resizable=yes,menubar=no,width=750,height=1000");i.document.title="Babylon.js INSPECTOR";for(var n=t.DOCUMENT.querySelectorAll("style"),r=0;r0){for(var n=new e.TreeItem(t,new e.Canvas2DAdapter(i)),a=0,o=i.children;a"+BABYLON.Tools.Format(this._inspector.scene.getEngine().getFps(),0)+" fps",this._updateLoopHandler=this._update.bind(this),s=e.Helpers.CreateDiv("stat-title2",this._panel),s.textContent="Count";var a=this._createStatLabel("Total meshes",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel);this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.meshes.length.toString()}}),a=this._createStatLabel("Draw calls",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.drawCalls.toString()}}),a=this._createStatLabel("Total lights",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.lights.length.toString()}}),a=this._createStatLabel("Total lights",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.lights.length.toString()}}),a=this._createStatLabel("Total vertices",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.getTotalVertices().toString()}}),a=this._createStatLabel("Total materials",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.materials.length.toString()}}),a=this._createStatLabel("Total textures",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.textures.length.toString()}}),a=this._createStatLabel("Active meshes",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.getActiveMeshes().length.toString()}}),a=this._createStatLabel("Active indices",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.getActiveIndices().toString()}}),a=this._createStatLabel("Active bones",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.getActiveBones().toString()}}),a=this._createStatLabel("Active particles",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._scene.getActiveParticles().toString()}}),s=e.Helpers.CreateDiv("stat-title2",this._panel),s.textContent="Duration";var a=this._createStatLabel("Meshes selection",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel);this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getEvaluateActiveMeshesDuration())}}),a=this._createStatLabel("Render targets",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getRenderTargetsDuration())}}),a=this._createStatLabel("Particles",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getParticlesDuration())}}),a=this._createStatLabel("Sprites",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getSpritesDuration())}}),a=this._createStatLabel("Render",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getRenderDuration())}}),a=this._createStatLabel("Frame",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(r._scene.getLastFrameDuration())}}),a=this._createStatLabel("Potential FPS",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return BABYLON.Tools.Format(1e3/r._scene.getLastFrameDuration(),0)}}),a=this._createStatLabel("Resolution",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getRenderWidth()+"x"+r._engine.getRenderHeight()}}),s=e.Helpers.CreateDiv("stat-title2",this._panel),s.textContent="Extensions";var a=this._createStatLabel("Std derivatives",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel);this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().standardDerivatives?"Yes":"No"}}),a=this._createStatLabel("Compressed textures",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().s3tc?"Yes":"No"}}),a=this._createStatLabel("Hardware instances",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().instancedArrays?"Yes":"No"}}),a=this._createStatLabel("Texture float",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().textureFloat?"Yes":"No"}}),a=this._createStatLabel("32bits indices",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().uintIndices?"Yes":"No"}}),a=this._createStatLabel("Fragment depth",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().fragmentDepthSupported?"Yes":"No"}}),a=this._createStatLabel("High precision shaders",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().highPrecisionShaderSupported?"Yes":"No"}}),a=this._createStatLabel("Draw buffers",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().drawBuffersExtension?"Yes":"No"}}),s=e.Helpers.CreateDiv("stat-title2",this._panel),s.textContent="Caps.";var a=this._createStatLabel("Stencil",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel);this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.isStencilEnable?"Enabled":"Disabled"}}),a=this._createStatLabel("Max textures units",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().maxTexturesImageUnits.toString()}}),a=this._createStatLabel("Max textures size",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().maxTextureSize.toString()}}),a=this._createStatLabel("Max anisotropy",this._panel),o=e.Helpers.CreateDiv("stat-value",this._panel),this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.getCaps().maxAnisotropy.toString()}}),s=e.Helpers.CreateDiv("stat-title2",this._panel),s.textContent="Info";var o=e.Helpers.CreateDiv("stat-infos",this._panel);this._updatableProperties.push({elem:o,updateFct:function(){return r._engine.webGLVersion+" - "+r._glInfo.version+" - "+r._glInfo.renderer}}),this._scene.registerAfterRender(this._updateLoopHandler)}return __extends(i,t),i.prototype._createStatLabel=function(t,i){var n=e.Helpers.CreateDiv("stat-label",i);return n.textContent=t,n},i.prototype._update=function(){for(var e=0,t=this._updatableProperties;e0&&i>e;){var n=this._visibleTabs.pop();this._invisibleTabs.push(n),this._div.removeChild(n.toHtml()),i=this.getPixelWidth()+t}if(this._invisibleTabs.length>0&&i+t0&&!this._div.contains(this._moreTabsIcon)&&this._div.appendChild(this._moreTabsIcon)},i})(e.BasicElement);e.TabBar=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(){function t(t,i,n,r){var s=this;this._inspector=n,this._elem=e.Inspector.DOCUMENT.createElement("i"),this._elem.className="tool fa "+t,i.appendChild(this._elem),this._elem.addEventListener("click",(function(e){s.action()})),new e.Tooltip(this._elem,r)}return t.prototype.toHtml=function(){return this._elem},t.prototype.getPixelWidth=function(){var t=e.Inspector.WINDOW.getComputedStyle(this._elem),i=parseFloat(t.marginLeft.substr(0,t.marginLeft.length-2))||0,n=parseFloat(t.marginRight.substr(0,t.marginRight.length-2))||0;return(this._elem.clientWidth||0)+i+n},t.prototype._updateIcon=function(e){this._elem.className="tool fa "+e},t})();e.AbstractTool=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(t){function i(e,i){t.call(this,"fa-pause",e,i,"Pause the automatic update of properties"),this._isPause=!1}return __extends(i,t),i.prototype.action=function(){this._isPause?(e.Scheduler.getInstance().pause=!1,this._updateIcon("fa-pause")):(e.Scheduler.getInstance().pause=!0,this._updateIcon("fa-play")),this._isPause=!this._isPause},i})(e.AbstractTool);e.PauseScheduleTool=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(e){function t(t,i){e.call(this,"fa-mouse-pointer",t,i,"Select a mesh in the scene"),this._isActive=!1,this._pickHandler=this._pickMesh.bind(this)}return __extends(t,e),t.prototype.action=function(){this._isActive?this._deactivate():(this.toHtml().classList.add("active"),this._inspector.scene.getEngine().getRenderingCanvas().addEventListener("click",this._pickHandler),this._isActive=!0)},t.prototype._deactivate=function(){this.toHtml().classList.remove("active"),this._inspector.scene.getEngine().getRenderingCanvas().removeEventListener("click",this._pickHandler),this._isActive=!1},t.prototype._pickMesh=function(e){var t=this._updatePointerPosition(e),i=this._inspector.scene.pick(t.x,t.y,(function(e){return!0}));i.pickedMesh&&(console.log(i.pickedMesh.name),this._inspector.displayObjectDetails(i.pickedMesh)),this._deactivate()},t.prototype._updatePointerPosition=function(e){var t=this._inspector.scene.getEngine().getRenderingCanvasClientRect(),i=e.clientX-t.left,n=e.clientY-t.top;return{x:i,y:n}},t})(e.AbstractTool);e.PickTool=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(e){function t(t,i){e.call(this,"fa-external-link",t,i,"Open the inspector in a popup")}return __extends(t,e),t.prototype.action=function(){this._inspector.openPopup()},t})(e.AbstractTool);e.PopupTool=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(e){function t(t,i){e.call(this,"fa-refresh",t,i,"Refresh the current tab")}return __extends(t,e),t.prototype.action=function(){this._inspector.refresh()},t})(e.AbstractTool);e.RefreshTool=t})(INSPECTOR||(INSPECTOR={}));var INSPECTOR;!(function(e){var t=(function(t){function i(e){t.call(this),this._tools=[],this._inspector=e,this._build(),this._addTools()}return __extends(i,t),i.prototype.update=function(){},i.prototype._build=function(){this._div.className="toolbar"},i.prototype._addTools=function(){this._tools.push(new e.RefreshTool(this._div,this._inspector)),this._tools.push(new e.PickTool(this._div,this._inspector)),this._inspector.popupMode||this._tools.push(new e.PopupTool(this._div,this._inspector)),this._tools.push(new e.PauseScheduleTool(this._div,this._inspector)),this._tools.push(new e.DisposeTool(this._div,this._inspector))},i.prototype.getPixelWidth=function(){for(var e=0,t=0,i=this._tools;t0){for(var e=0,t=this._children;e0){for(var e=0,t=this._children;e0&&(this._div.classList.contains("folded")||this._div.classList.contains("unfolded")||this._div.classList.add("folded")),this.fold()},i.prototype._addEvent=function(){var e=this;this._div.addEventListener("click",(function(t){e._tab.select(e),e._isFolded()?e.unfold():e.fold(),t.stopPropagation()})),this._div.addEventListener("mouseover",(function(t){e._tab.highlightNode(e),t.stopPropagation()})),this._div.addEventListener("mouseout",(function(t){e._tab.highlightNode()}))},i.prototype.highlight=function(e){if(!e)for(var t=0,i=this._children;t