1234567891011121314151617181920212223242526272829303132333435363738 |
- !(function(e,t){var r=[];"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("babylonjs-viewer",r,t):"object"==typeof exports?exports["babylonjs-viewer"]=t():e.BabylonViewer=t()})(this,(function(){return (function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)})([(function(e,t,r){(function(t){!(function(t,i){var n=t.CANNON||this.CANNON,o=t.OIMO||this.OIMO,s=t.earcut||this.earcut;try{n=n||r(18)}catch(e){}try{o=o||r(19)}catch(e){}try{s=s||r(20)}catch(e){}e.exports=i(n,o,s)})(this,(function(e,r,i){e=e||this.CANNON,r=r||this.OIMO,i=i||this.earcut;var n,o=this&&this.__decorate||function(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},s=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}})();!(function(e){var t=(function(){function e(){this._defines={},this._currentRank=32,this._maxRank=-1}return e.prototype.unBindMesh=function(){this._mesh=null},e.prototype.addFallback=function(e,t){this._defines[e]||(e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"isMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!0,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&this._mesh.numBoneInfluencers>0&&this._mesh.material){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var r=this._mesh.getScene(),i=0;i<r.meshes.length;i++){var n=r.meshes[i];if(n.material&&(n.computeBonesUsingShaders&&0!==n.numBoneInfluencers))if(n.material.getEffect()===t)n.computeBonesUsingShaders=!1;else if(n.subMeshes)for(var o=0,s=n.subMeshes;o<s.length;o++){var a=s[o],l=a.effect;if(l===t){n.computeBonesUsingShaders=!1;break}}}}else{var u=this._defines[this._currentRank];if(u)for(var i=0;i<u.length;i++)e=e.replace("#define "+u[i],"");this._currentRank++}return e},e})();e.EffectFallbacks=t;var r=(function(){function e(){}return e})();e.EffectCreationOptions=r;var i=(function(){function t(r,i,n,o,s,a,l,u,h,c){void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===u&&(u=null),void 0===h&&(h=null);var f=this;if(this.uniqueId=0,this.onCompileObservable=new e.Observable,this.onErrorObservable=new e.Observable,this.onBindObservable=new e.Observable,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._isReady=!1,this._compilationError="",this.name=r,i.attributes){var d=i;if(this._engine=n,this._attributesNames=d.attributes,this._uniformsNames=d.uniformsNames.concat(d.samplers),this._samplers=d.samplers.slice(),this.defines=d.defines,this.onError=d.onError,this.onCompiled=d.onCompiled,this._fallbacks=d.fallbacks,this._indexParameters=d.indexParameters,this._transformFeedbackVaryings=d.transformFeedbackVaryings,d.uniformBuffersNames)for(var p=0;p<d.uniformBuffersNames.length;p++)this._uniformBuffersNames[d.uniformBuffersNames[p]]=p}else this._engine=s,this.defines=a,this._uniformsNames=n.concat(o),this._samplers=o?o.slice():[],this._attributesNames=i,this.onError=h,this.onCompiled=u,this._indexParameters=c,this._fallbacks=l;this.uniqueId=t._uniqueIdSeed++;var A,m;r.vertexElement?(A=document.getElementById(r.vertexElement))||(A=r.vertexElement):A=r.vertex||r,r.fragmentElement?(m=document.getElementById(r.fragmentElement))||(m=r.fragmentElement):m=r.fragment||r,this._loadVertexShader(A,(function(e){f._processIncludes(e,(function(e){f._processShaderConversion(e,!1,(function(e){f._loadFragmentShader(m,(function(t){f._processIncludes(t,(function(t){f._processShaderConversion(t,!0,(function(t){if(r){var i=r.vertexElement||r.vertex||r,n=r.fragmentElement||r.fragment||r;f._vertexSourceCode="#define SHADER_NAME vertex:"+i+"\n"+e,f._fragmentSourceCode="#define SHADER_NAME fragment:"+n+"\n"+t}else f._vertexSourceCode=e,f._fragmentSourceCode=t;f._prepareEffect()}))}))}))}))}))}))}return Object.defineProperty(t.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),t.prototype.isReady=function(){return this._isReady},t.prototype.getEngine=function(){return this._engine},t.prototype.getProgram=function(){return this._program},t.prototype.getAttributesNames=function(){return this._attributesNames},t.prototype.getAttributeLocation=function(e){return this._attributes[e]},t.prototype.getAttributeLocationByName=function(e){var t=this._attributesNames.indexOf(e);return this._attributes[t]},t.prototype.getAttributesCount=function(){return this._attributes.length},t.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},t.prototype.getUniform=function(e){return this._uniforms[this._uniformsNames.indexOf(e)]},t.prototype.getSamplers=function(){return this._samplers},t.prototype.getCompilationError=function(){return this._compilationError},t.prototype.executeWhenCompiled=function(e){if(this.isReady())return void e(this);this.onCompileObservable.add((function(t){e(t)}))},t.prototype._loadVertexShader=function(r,i){if(e.Tools.IsWindowObjectExist()&&r instanceof HTMLElement){return void i(e.Tools.GetDOMTextContent(r))}if("base64:"===r.substr(0,7)){return void i(window.atob(r.substr(7)))}if(t.ShadersStore[r+"VertexShader"])return void i(t.ShadersStore[r+"VertexShader"]);var n;n="."===r[0]||"/"===r[0]||r.indexOf("http")>-1?r:e.Engine.ShadersRepository+r,this._engine._loadFile(n+".vertex.fx",i)},t.prototype._loadFragmentShader=function(r,i){if(e.Tools.IsWindowObjectExist()&&r instanceof HTMLElement){return void i(e.Tools.GetDOMTextContent(r))}if("base64:"===r.substr(0,7)){return void i(window.atob(r.substr(7)))}if(t.ShadersStore[r+"PixelShader"])return void i(t.ShadersStore[r+"PixelShader"]);if(t.ShadersStore[r+"FragmentShader"])return void i(t.ShadersStore[r+"FragmentShader"]);var n;n="."===r[0]||"/"===r[0]||r.indexOf("http")>-1?r:e.Engine.ShadersRepository+r,this._engine._loadFile(n+".fragment.fx",i)},t.prototype._dumpShadersSource=function(t,r,i){var n=this._engine.webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"",o=n+(i?i+"\n":"");t=o+t,r=o+r;var s=2,a=/\n/gm,l="\n1\t"+t.replace(a,(function(){return"\n"+s+++"\t"}));s=2;var u="\n1\t"+r.replace(a,(function(){return"\n"+s+++"\t"}));this.name.vertexElement?(e.Tools.Error("Vertex shader: "+this.name.vertexElement+l),e.Tools.Error("Fragment shader: "+this.name.fragmentElement+u)):this.name.vertex?(e.Tools.Error("Vertex shader: "+this.name.vertex+l),e.Tools.Error("Fragment shader: "+this.name.fragment+u)):(e.Tools.Error("Vertex shader: "+this.name+l),e.Tools.Error("Fragment shader: "+this.name+u))},t.prototype._processShaderConversion=function(e,t,r){var i=this._processPrecision(e);if(1==this._engine.webGLVersion)return void r(i);if(-1!==i.indexOf("#version 3"))return void r(i.replace("#version 300 es",""));var n=-1!==i.search(/#extension.+GL_EXT_draw_buffers.+require/),o=/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,s=i.replace(o,"");s=s.replace(/varying(?![\n\r])\s/g,t?"in ":"out "),s=s.replace(/attribute[ \t]/g,"in "),s=s.replace(/[ \t]attribute/g," in"),t&&(s=s.replace(/texture2DLodEXT\s*\(/g,"textureLod("),s=s.replace(/textureCubeLodEXT\s*\(/g,"textureLod("),s=s.replace(/texture2D\s*\(/g,"texture("),s=s.replace(/textureCube\s*\(/g,"texture("),s=s.replace(/gl_FragDepthEXT/g,"gl_FragDepth"),s=s.replace(/gl_FragColor/g,"glFragColor"),s=s.replace(/gl_FragData/g,"glFragData"),s=s.replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(")),r(s)},t.prototype._processIncludes=function(r,i){for(var n=this,o=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,s=o.exec(r),a=new String(r);null!=s;){var l=s[1];if(-1!==l.indexOf("__decl__")&&(l=l.replace(/__decl__/,""),this._engine.supportsUniformBuffers&&(l=l.replace(/Vertex/,"Ubo"),l=l.replace(/Fragment/,"Ubo")),l+="Declaration"),!t.IncludesShadersStore[l]){var u=e.Engine.ShadersRepository+"ShadersInclude/"+l+".fx";return void this._engine._loadFile(u,(function(e){t.IncludesShadersStore[l]=e,n._processIncludes(a,i)}))}var h=t.IncludesShadersStore[l];if(s[2])for(var c=s[3].split(","),f=0;f<c.length;f+=2){var d=new RegExp(c[f],"g"),p=c[f+1];h=h.replace(d,p)}if(s[4]){var A=s[5];if(-1!==A.indexOf("..")){var m=A.split(".."),g=parseInt(m[0]),_=parseInt(m[1]),v=h.slice(0);h="",isNaN(_)&&(_=this._indexParameters[m[1]]);for(var y=g;y<_;y++)this._engine.supportsUniformBuffers||(v=v.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))),h+=v.replace(/\{X\}/g,y.toString())+"\n"}else this._engine.supportsUniformBuffers||(h=h.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))),h=h.replace(/\{X\}/g,A)}a=a.replace(s[0],h),s=o.exec(r)}i(a)},t.prototype._processPrecision=function(e){return-1===e.indexOf("precision highp float")?e=this._engine.getCaps().highPrecisionShaderSupported?"precision highp float;\n"+e:"precision mediump float;\n"+e:this._engine.getCaps().highPrecisionShaderSupported||(e=e.replace("precision highp float","precision mediump float")),e},t.prototype._rebuildProgram=function(t,r,i,n){var o=this;this._isReady=!1,this._vertexSourceCodeOverride=t,this._fragmentSourceCodeOverride=r,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){for(var t=o.getEngine().scenes,r=0;r<t.length;r++)t[r].markAllMaterialsAsDirty(e.Material.TextureDirtyFlag);i&&i(o._program)},this._fallbacks=null,this._prepareEffect()},t.prototype.getSpecificUniformLocations=function(e){return this._engine.getUniforms(this._program,e)},t.prototype._prepareEffect=function(){var t=this._attributesNames,r=this.defines,i=this._fallbacks;this._valueCache={};var n=this._program;try{var o=this._engine;if(this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._program=o.createRawShaderProgram(this._vertexSourceCodeOverride,this._fragmentSourceCodeOverride,void 0,this._transformFeedbackVaryings):this._program=o.createShaderProgram(this._vertexSourceCode,this._fragmentSourceCode,r,void 0,this._transformFeedbackVaryings),this._program.__SPECTOR_rebuildProgram=this._rebuildProgram.bind(this),o.supportsUniformBuffers)for(var s in this._uniformBuffersNames)this.bindUniformBlock(s,this._uniformBuffersNames[s]);this._uniforms=o.getUniforms(this._program,this._uniformsNames),this._attributes=o.getAttributes(this._program,t);var a;for(a=0;a<this._samplers.length;a++){null==this.getUniform(this._samplers[a])&&(this._samplers.splice(a,1),a--)}o.bindSamplers(this),this._compilationError="",this._isReady=!0,this.onCompiled&&this.onCompiled(this),this.onCompileObservable.notifyObservers(this),this.onCompileObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh(),n&&this.getEngine()._deleteProgram(n)}catch(o){this._compilationError=o.message,e.Tools.Error("Unable to compile effect:"),e.Tools.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),e.Tools.Error("Attributes: "+t.map((function(e){return" "+e}))),this._dumpShadersSource(this._vertexSourceCode,this._fragmentSourceCode,r),e.Tools.Error("Error: "+this._compilationError),n&&(this._program=n,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)),i&&i.isMoreFallbacks?(e.Tools.Error("Trying next fallback."),this.defines=i.reduce(this.defines,this),this._prepareEffect()):(this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())}},Object.defineProperty(t.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!0,configurable:!0}),t.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers.indexOf(e),t)},t.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers.indexOf(e),this.getUniform(e),t)},t.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers.indexOf(e),this.getUniform(e),t)},t.prototype.setTextureArray=function(e,t){if(-1===this._samplers.indexOf(e+"Ex"))for(var r=this._samplers.indexOf(e),i=1;i<t.length;i++)this._samplers.splice(r+i,0,e+"Ex");this._engine.setTextureArray(this._samplers.indexOf(e),this.getUniform(e),t)},t.prototype.setTextureFromPostProcess=function(e,t){this._engine.setTextureFromPostProcess(this._samplers.indexOf(e),t)},t.prototype.setTextureFromPostProcessOutput=function(e,t){this._engine.setTextureFromPostProcessOutput(this._samplers.indexOf(e),t)},t.prototype._cacheMatrix=function(e,t){var r=this._valueCache[e],i=t.updateFlag;return(void 0===r||r!==i)&&(this._valueCache[e]=i,!0)},t.prototype._cacheFloat2=function(e,t,r){var i=this._valueCache[e];if(!i)return i=[t,r],this._valueCache[e]=i,!0;var n=!1;return i[0]!==t&&(i[0]=t,n=!0),i[1]!==r&&(i[1]=r,n=!0),n},t.prototype._cacheFloat3=function(e,t,r,i){var n=this._valueCache[e];if(!n)return n=[t,r,i],this._valueCache[e]=n,!0;var o=!1;return n[0]!==t&&(n[0]=t,o=!0),n[1]!==r&&(n[1]=r,o=!0),n[2]!==i&&(n[2]=i,o=!0),o},t.prototype._cacheFloat4=function(e,t,r,i,n){var o=this._valueCache[e];if(!o)return o=[t,r,i,n],this._valueCache[e]=o,!0;var s=!1;return o[0]!==t&&(o[0]=t,s=!0),o[1]!==r&&(o[1]=r,s=!0),o[2]!==i&&(o[2]=i,s=!0),o[3]!==n&&(o[3]=n,s=!0),s},t.prototype.bindUniformBuffer=function(e,r){var i=this._uniformBuffersNames[r];void 0!==i&&t._baseCache[i]!==e&&(t._baseCache[i]=e,this._engine.bindUniformBufferBase(e,i))},t.prototype.bindUniformBlock=function(e,t){this._engine.bindUniformBlock(this._program,e,t)},t.prototype.setInt=function(e,t){var r=this._valueCache[e];return void 0!==r&&r===t?this:(this._valueCache[e]=t,this._engine.setInt(this.getUniform(e),t),this)},t.prototype.setIntArray=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray(this.getUniform(e),t),this},t.prototype.setIntArray2=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray2(this.getUniform(e),t),this},t.prototype.setIntArray3=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray3(this.getUniform(e),t),this},t.prototype.setIntArray4=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray4(this.getUniform(e),t),this},t.prototype.setFloatArray=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray(this.getUniform(e),t),this},t.prototype.setFloatArray2=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray2(this.getUniform(e),t),this},t.prototype.setFloatArray3=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray3(this.getUniform(e),t),this},t.prototype.setFloatArray4=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray4(this.getUniform(e),t),this},t.prototype.setArray=function(e,t){return this._valueCache[e]=null,this._engine.setArray(this.getUniform(e),t),this},t.prototype.setArray2=function(e,t){return this._valueCache[e]=null,this._engine.setArray2(this.getUniform(e),t),this},t.prototype.setArray3=function(e,t){return this._valueCache[e]=null,this._engine.setArray3(this.getUniform(e),t),this},t.prototype.setArray4=function(e,t){return this._valueCache[e]=null,this._engine.setArray4(this.getUniform(e),t),this},t.prototype.setMatrices=function(e,t){return t?(this._valueCache[e]=null,this._engine.setMatrices(this.getUniform(e),t),this):this},t.prototype.setMatrix=function(e,t){return this._cacheMatrix(e,t)&&this._engine.setMatrix(this.getUniform(e),t),this},t.prototype.setMatrix3x3=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix3x3(this.getUniform(e),t),this},t.prototype.setMatrix2x2=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix2x2(this.getUniform(e),t),this},t.prototype.setFloat=function(e,t){var r=this._valueCache[e];return void 0!==r&&r===t?this:(this._valueCache[e]=t,this._engine.setFloat(this.getUniform(e),t),this)},t.prototype.setBool=function(e,t){var r=this._valueCache[e];return void 0!==r&&r===t?this:(this._valueCache[e]=t,this._engine.setBool(this.getUniform(e),t?1:0),this)},t.prototype.setVector2=function(e,t){return this._cacheFloat2(e,t.x,t.y)&&this._engine.setFloat2(this.getUniform(e),t.x,t.y),this},t.prototype.setFloat2=function(e,t,r){return this._cacheFloat2(e,t,r)&&this._engine.setFloat2(this.getUniform(e),t,r),this},t.prototype.setVector3=function(e,t){return this._cacheFloat3(e,t.x,t.y,t.z)&&this._engine.setFloat3(this.getUniform(e),t.x,t.y,t.z),this},t.prototype.setFloat3=function(e,t,r,i){return this._cacheFloat3(e,t,r,i)&&this._engine.setFloat3(this.getUniform(e),t,r,i),this},t.prototype.setVector4=function(e,t){return this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&this._engine.setFloat4(this.getUniform(e),t.x,t.y,t.z,t.w),this},t.prototype.setFloat4=function(e,t,r,i,n){return this._cacheFloat4(e,t,r,i,n)&&this._engine.setFloat4(this.getUniform(e),t,r,i,n),this},t.prototype.setColor3=function(e,t){return this._cacheFloat3(e,t.r,t.g,t.b)&&this._engine.setColor3(this.getUniform(e),t),this},t.prototype.setColor4=function(e,t,r){return this._cacheFloat4(e,t.r,t.g,t.b,r)&&this._engine.setColor4(this.getUniform(e),t,r),this},t.prototype.setDirectColor4=function(e,t){return this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&this._engine.setDirectColor4(this.getUniform(e),t),this},t.ResetCache=function(){t._baseCache={}},t._uniqueIdSeed=0,t._baseCache={},t.ShadersStore={},t.IncludesShadersStore={},t})();e.Effect=i})(n||(n={}));var n;!(function(e){var t=(function(){function e(){}return Object.defineProperty(e,"KEYDOWN",{get:function(){return e._KEYDOWN},enumerable:!0,configurable:!0}),Object.defineProperty(e,"KEYUP",{get:function(){return e._KEYUP},enumerable:!0,configurable:!0}),e._KEYDOWN=1,e._KEYUP=2,e})();e.KeyboardEventTypes=t;var r=(function(){function e(e,t){this.type=e,this.event=t}return e})();e.KeyboardInfo=r;var i=(function(e){function t(t,r){var i=e.call(this,t,r)||this;return i.skipOnPointerObservable=!1,i}return s(t,e),t})(r);e.KeyboardInfoPre=i})(n||(n={}));var n;!(function(e){var t=(function(){function e(){}return Object.defineProperty(e,"POINTERDOWN",{get:function(){return e._POINTERDOWN},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERUP",{get:function(){return e._POINTERUP},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERMOVE",{get:function(){return e._POINTERMOVE},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERWHEEL",{get:function(){return e._POINTERWHEEL},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERPICK",{get:function(){return e._POINTERPICK},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERTAP",{get:function(){return e._POINTERTAP},enumerable:!0,configurable:!0}),Object.defineProperty(e,"POINTERDOUBLETAP",{get:function(){return e._POINTERDOUBLETAP},enumerable:!0,configurable:!0}),e._POINTERDOWN=1,e._POINTERUP=2,e._POINTERMOVE=4,e._POINTERWHEEL=8,e._POINTERPICK=16,e._POINTERTAP=32,e._POINTERDOUBLETAP=64,e})();e.PointerEventTypes=t;var r=(function(){function e(e,t){this.type=e,this.event=t}return e})();e.PointerInfoBase=r;var i=(function(t){function r(r,i,n,o){var s=t.call(this,r,i)||this;return s.ray=null,s.skipOnPointerObservable=!1,s.localPosition=new e.Vector2(n,o),s}return s(r,t),r})(r);e.PointerInfoPre=i;var n=(function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return n.pickInfo=i,n}return s(t,e),t})(r);e.PointerInfo=n})(n||(n={}));var n;!(function(e){e.ToGammaSpace=1/2.2,e.ToLinearSpace=2.2,e.Epsilon=.001;var t=(function(){function t(e,t,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),this.r=e,this.g=t,this.b=r}return t.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},t.prototype.getClassName=function(){return"Color3"},t.prototype.getHashCode=function(){var e=this.r||0;return e=397*e^(this.g||0),e=397*e^(this.b||0)},t.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},t.prototype.toColor4=function(e){return void 0===e&&(e=1),new r(this.r,this.g,this.b,e)},t.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},t.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.multiply=function(e){return new t(this.r*e.r,this.g*e.g,this.b*e.b)},t.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},t.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},t.prototype.equalsFloats=function(e,t,r){return this.r===e&&this.g===t&&this.b===r},t.prototype.scale=function(e){return new t(this.r*e,this.g*e,this.b*e)},t.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},t.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},t.prototype.clampToRef=function(t,r,i){return void 0===t&&(t=0),void 0===r&&(r=1),i.r=e.Scalar.Clamp(this.r,t,r),i.g=e.Scalar.Clamp(this.g,t,r),i.b=e.Scalar.Clamp(this.b,t,r),this},t.prototype.add=function(e){return new t(this.r+e.r,this.g+e.g,this.b+e.b)},t.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},t.prototype.subtract=function(e){return new t(this.r-e.r,this.g-e.g,this.b-e.b)},t.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b)},t.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},t.prototype.copyFromFloats=function(e,t,r){return this.r=e,this.g=t,this.b=r,this},t.prototype.set=function(e,t,r){return this.copyFromFloats(e,t,r)},t.prototype.toHexString=function(){var t=255*this.r|0,r=255*this.g|0,i=255*this.b|0;return"#"+e.Scalar.ToHex(t)+e.Scalar.ToHex(r)+e.Scalar.ToHex(i)},t.prototype.toLinearSpace=function(){var e=new t;return this.toLinearSpaceToRef(e),e},t.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,e.ToLinearSpace),t.g=Math.pow(this.g,e.ToLinearSpace),t.b=Math.pow(this.b,e.ToLinearSpace),this},t.prototype.toGammaSpace=function(){var e=new t;return this.toGammaSpaceToRef(e),e},t.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,e.ToGammaSpace),t.g=Math.pow(this.g,e.ToGammaSpace),t.b=Math.pow(this.b,e.ToGammaSpace),this},t.FromHexString=function(e){if("#"!==e.substring(0,1)||7!==e.length)return new t(0,0,0);var r=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16);return t.FromInts(r,i,n)},t.FromArray=function(e,r){return void 0===r&&(r=0),new t(e[r],e[r+1],e[r+2])},t.FromInts=function(e,r,i){return new t(e/255,r/255,i/255)},t.Lerp=function(e,r,i){return new t(e.r+(r.r-e.r)*i,e.g+(r.g-e.g)*i,e.b+(r.b-e.b)*i)},t.Red=function(){return new t(1,0,0)},t.Green=function(){return new t(0,1,0)},t.Blue=function(){return new t(0,0,1)},t.Black=function(){return new t(0,0,0)},t.White=function(){return new t(1,1,1)},t.Purple=function(){return new t(.5,0,.5)},t.Magenta=function(){return new t(1,0,1)},t.Yellow=function(){return new t(1,1,0)},t.Gray=function(){return new t(.5,.5,.5)},t.Teal=function(){return new t(0,1,1)},t.Random=function(){return new t(Math.random(),Math.random(),Math.random())},t})();e.Color3=t;var r=(function(){function t(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=1),this.r=e,this.g=t,this.b=r,this.a=i}return t.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},t.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},t.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},t.prototype.add=function(e){return new t(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)},t.prototype.subtract=function(e){return new t(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)},t.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},t.prototype.scale=function(e){return new t(this.r*e,this.g*e,this.b*e,this.a*e)},t.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},t.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},t.prototype.clampToRef=function(t,r,i){return void 0===t&&(t=0),void 0===r&&(r=1),i.r=e.Scalar.Clamp(this.r,t,r),i.g=e.Scalar.Clamp(this.g,t,r),i.b=e.Scalar.Clamp(this.b,t,r),i.a=e.Scalar.Clamp(this.a,t,r),this},t.prototype.multiply=function(e){return new t(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)},t.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},t.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},t.prototype.getClassName=function(){return"Color4"},t.prototype.getHashCode=function(){var e=this.r||0;return e=397*e^(this.g||0),e=397*e^(this.b||0),e=397*e^(this.a||0)},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},t.prototype.copyFromFloats=function(e,t,r,i){return this.r=e,this.g=t,this.b=r,this.a=i,this},t.prototype.set=function(e,t,r,i){return this.copyFromFloats(e,t,r,i)},t.prototype.toHexString=function(){var t=255*this.r|0,r=255*this.g|0,i=255*this.b|0,n=255*this.a|0;return"#"+e.Scalar.ToHex(t)+e.Scalar.ToHex(r)+e.Scalar.ToHex(i)+e.Scalar.ToHex(n)},t.prototype.toLinearSpace=function(){var e=new t;return this.toLinearSpaceToRef(e),e},t.prototype.toLinearSpaceToRef=function(t){return t.r=Math.pow(this.r,e.ToLinearSpace),t.g=Math.pow(this.g,e.ToLinearSpace),t.b=Math.pow(this.b,e.ToLinearSpace),t.a=this.a,this},t.prototype.toGammaSpace=function(){var e=new t;return this.toGammaSpaceToRef(e),e},t.prototype.toGammaSpaceToRef=function(t){return t.r=Math.pow(this.r,e.ToGammaSpace),t.g=Math.pow(this.g,e.ToGammaSpace),t.b=Math.pow(this.b,e.ToGammaSpace),t.a=this.a,this},t.FromHexString=function(e){if("#"!==e.substring(0,1)||9!==e.length)return new t(0,0,0,0);var r=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),n=parseInt(e.substring(5,7),16),o=parseInt(e.substring(7,9),16);return t.FromInts(r,i,n,o)},t.Lerp=function(e,r,i){var n=new t(0,0,0,0);return t.LerpToRef(e,r,i,n),n},t.LerpToRef=function(e,t,r,i){i.r=e.r+(t.r-e.r)*r,i.g=e.g+(t.g-e.g)*r,i.b=e.b+(t.b-e.b)*r,i.a=e.a+(t.a-e.a)*r},t.FromArray=function(e,r){return void 0===r&&(r=0),new t(e[r],e[r+1],e[r+2],e[r+3])},t.FromInts=function(e,r,i,n){return new t(e/255,r/255,i/255,n/255)},t.CheckColors4=function(e,t){if(e.length===3*t){for(var r=[],i=0;i<e.length;i+=3){var n=i/3*4;r[n]=e[i],r[n+1]=e[i+1],r[n+2]=e[i+2],r[n+3]=1}return r}return e},t})();e.Color4=r;var i=(function(){function t(e,t){this.x=e,this.y=t}return t.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+"}"},t.prototype.getClassName=function(){return"Vector2"},t.prototype.getHashCode=function(){var e=this.x||0;return e=397*e^(this.y||0)},t.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},t.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},t.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},t.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},t.prototype.set=function(e,t){return this.copyFromFloats(e,t)},t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this},t.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},t.prototype.addVector3=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.subtract=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this},t.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},t.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},t.prototype.multiply=function(e){return new t(this.x*e.x,this.y*e.y)},t.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this},t.prototype.multiplyByFloats=function(e,r){return new t(this.x*e,this.y*r)},t.prototype.divide=function(e){return new t(this.x/e.x,this.y/e.y)},t.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this},t.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},t.prototype.negate=function(){return new t(-this.x,-this.y)},t.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},t.prototype.scale=function(e){var r=new t(0,0);return this.scaleToRef(e,r),r},t.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,this},t.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,this},t.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},t.prototype.equalsWithEpsilon=function(t,r){return void 0===r&&(r=e.Epsilon),t&&e.Scalar.WithinEpsilon(this.x,t.x,r)&&e.Scalar.WithinEpsilon(this.y,t.y,r)},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.Zero=function(){return new t(0,0)},t.One=function(){return new t(1,1)},t.FromArray=function(e,r){return void 0===r&&(r=0),new t(e[r],e[r+1])},t.FromArrayToRef=function(e,t,r){r.x=e[t],r.y=e[t+1]},t.CatmullRom=function(e,r,i,n,o){var s=o*o,a=o*s;return new t(.5*(2*r.x+(-e.x+i.x)*o+(2*e.x-5*r.x+4*i.x-n.x)*s+(-e.x+3*r.x-3*i.x+n.x)*a),.5*(2*r.y+(-e.y+i.y)*o+(2*e.y-5*r.y+4*i.y-n.y)*s+(-e.y+3*r.y-3*i.y+n.y)*a))},t.Clamp=function(e,r,i){var n=e.x;n=n>i.x?i.x:n,n=n<r.x?r.x:n;var o=e.y;return o=o>i.y?i.y:o,o=o<r.y?r.y:o,new t(n,o)},t.Hermite=function(e,r,i,n,o){var s=o*o,a=o*s,l=2*a-3*s+1,u=-2*a+3*s,h=a-2*s+o,c=a-s;return new t(e.x*l+i.x*u+r.x*h+n.x*c,e.y*l+i.y*u+r.y*h+n.y*c)},t.Lerp=function(e,r,i){return new t(e.x+(r.x-e.x)*i,e.y+(r.y-e.y)*i)},t.Dot=function(e,t){return e.x*t.x+e.y*t.y},t.Normalize=function(e){var t=e.clone();return t.normalize(),t},t.Minimize=function(e,r){return new t(e.x<r.x?e.x:r.x,e.y<r.y?e.y:r.y)},t.Maximize=function(e,r){return new t(e.x>r.x?e.x:r.x,e.y>r.y?e.y:r.y)},t.Transform=function(e,r){var i=t.Zero();return t.TransformToRef(e,r,i),i},t.TransformToRef=function(e,t,r){var i=e.x*t.m[0]+e.y*t.m[4]+t.m[12],n=e.x*t.m[1]+e.y*t.m[5]+t.m[13];r.x=i,r.y=n},t.PointInTriangle=function(e,t,r,i){var n=.5*(-r.y*i.x+t.y*(-r.x+i.x)+t.x*(r.y-i.y)+r.x*i.y),o=n<0?-1:1,s=(t.y*i.x-t.x*i.y+(i.y-t.y)*e.x+(t.x-i.x)*e.y)*o,a=(t.x*r.y-t.y*r.x+(t.y-r.y)*e.x+(r.x-t.x)*e.y)*o;return s>0&&a>0&&s+a<2*n*o},t.Distance=function(e,r){return Math.sqrt(t.DistanceSquared(e,r))},t.DistanceSquared=function(e,t){var r=e.x-t.x,i=e.y-t.y;return r*r+i*i},t.Center=function(e,t){var r=e.add(t);return r.scaleInPlace(.5),r},t.DistanceOfPointFromSegment=function(e,r,i){var n=t.DistanceSquared(r,i);if(0===n)return t.Distance(e,r)
- ;var o=i.subtract(r),s=Math.max(0,Math.min(1,t.Dot(e.subtract(r),o)/n)),a=r.add(o.multiplyByFloats(s,s));return t.Distance(e,a)},t})();e.Vector2=i;var n=(function(){function t(e,t,r){this.x=e,this.y=t,this.z=r}return t.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+"}"},t.prototype.getClassName=function(){return"Vector3"},t.prototype.getHashCode=function(){var e=this.x||0;return e=397*e^(this.y||0),e=397*e^(this.z||0)},t.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},t.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,this},t.prototype.toQuaternion=function(){return e.Quaternion.RotationYawPitchRoll(this.x,this.y,this.z)},t.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y,this.z+e.z)},t.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,this},t.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},t.prototype.subtract=function(e){return new t(this.x-e.x,this.y-e.y,this.z-e.z)},t.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,this},t.prototype.subtractFromFloats=function(e,r,i){return new t(this.x-e,this.y-r,this.z-i)},t.prototype.subtractFromFloatsToRef=function(e,t,r,i){return i.x=this.x-e,i.y=this.y-t,i.z=this.z-r,this},t.prototype.negate=function(){return new t(-this.x,-this.y,-this.z)},t.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},t.prototype.scale=function(e){return new t(this.x*e,this.y*e,this.z*e)},t.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,this},t.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,this},t.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z},t.prototype.equalsWithEpsilon=function(t,r){return void 0===r&&(r=e.Epsilon),t&&e.Scalar.WithinEpsilon(this.x,t.x,r)&&e.Scalar.WithinEpsilon(this.y,t.y,r)&&e.Scalar.WithinEpsilon(this.z,t.z,r)},t.prototype.equalsToFloats=function(e,t,r){return this.x===e&&this.y===t&&this.z===r},t.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},t.prototype.multiply=function(e){return new t(this.x*e.x,this.y*e.y,this.z*e.z)},t.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,this},t.prototype.multiplyByFloats=function(e,r,i){return new t(this.x*e,this.y*r,this.z*i)},t.prototype.divide=function(e){return new t(this.x/e.x,this.y/e.y,this.z/e.z)},t.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,this},t.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},t.prototype.minimizeInPlace=function(e){return e.x<this.x&&(this.x=e.x),e.y<this.y&&(this.y=e.y),e.z<this.z&&(this.z=e.z),this},t.prototype.maximizeInPlace=function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),this},Object.defineProperty(t.prototype,"isNonUniform",{get:function(){var e=Math.abs(this.x),t=Math.abs(this.y);if(e!==t)return!0;var r=Math.abs(this.z);return e!==r||t!==r},enumerable:!0,configurable:!0}),t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){var e=this.length();if(0===e||1===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.normalizeToNew=function(){var e=new t(0,0,0);return this.normalizeToRef(e),e},t.prototype.normalizeToRef=function(e){var t=this.length();if(0===t||1===t)return e.set(this.x,this.y,this.z),e;var r=1/t;return this.scaleToRef(r,e),e},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},t.prototype.copyFromFloats=function(e,t,r){return this.x=e,this.y=t,this.z=r,this},t.prototype.set=function(e,t,r){return this.copyFromFloats(e,t,r)},t.GetClipFactor=function(e,r,i,n){var o=t.Dot(e,i)-n;return o/(o-(t.Dot(r,i)-n))},t.GetAngleBetweenVectors=function(e,r,i){var n=e.clone().normalize(),o=r.clone().normalize(),s=t.Dot(n,o),a=t.Cross(n,o);return t.Dot(a,i)>0?Math.acos(s):-Math.acos(s)},t.FromArray=function(e,r){return r||(r=0),new t(e[r],e[r+1],e[r+2])},t.FromFloatArray=function(e,r){return t.FromArray(e,r)},t.FromArrayToRef=function(e,t,r){r.x=e[t],r.y=e[t+1],r.z=e[t+2]},t.FromFloatArrayToRef=function(e,r,i){return t.FromArrayToRef(e,r,i)},t.FromFloatsToRef=function(e,t,r,i){i.x=e,i.y=t,i.z=r},t.Zero=function(){return new t(0,0,0)},t.One=function(){return new t(1,1,1)},t.Up=function(){return new t(0,1,0)},t.Forward=function(){return new t(0,0,1)},t.Right=function(){return new t(1,0,0)},t.Left=function(){return new t(-1,0,0)},t.TransformCoordinates=function(e,r){var i=t.Zero();return t.TransformCoordinatesToRef(e,r,i),i},t.TransformCoordinatesToRef=function(e,t,r){var i=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8]+t.m[12],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9]+t.m[13],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10]+t.m[14],s=e.x*t.m[3]+e.y*t.m[7]+e.z*t.m[11]+t.m[15];r.x=i/s,r.y=n/s,r.z=o/s},t.TransformCoordinatesFromFloatsToRef=function(e,t,r,i,n){var o=e*i.m[0]+t*i.m[4]+r*i.m[8]+i.m[12],s=e*i.m[1]+t*i.m[5]+r*i.m[9]+i.m[13],a=e*i.m[2]+t*i.m[6]+r*i.m[10]+i.m[14],l=e*i.m[3]+t*i.m[7]+r*i.m[11]+i.m[15];n.x=o/l,n.y=s/l,n.z=a/l},t.TransformNormal=function(e,r){var i=t.Zero();return t.TransformNormalToRef(e,r,i),i},t.TransformNormalToRef=function(e,t,r){var i=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10];r.x=i,r.y=n,r.z=o},t.TransformNormalFromFloatsToRef=function(e,t,r,i,n){n.x=e*i.m[0]+t*i.m[4]+r*i.m[8],n.y=e*i.m[1]+t*i.m[5]+r*i.m[9],n.z=e*i.m[2]+t*i.m[6]+r*i.m[10]},t.CatmullRom=function(e,r,i,n,o){var s=o*o,a=o*s;return new t(.5*(2*r.x+(-e.x+i.x)*o+(2*e.x-5*r.x+4*i.x-n.x)*s+(-e.x+3*r.x-3*i.x+n.x)*a),.5*(2*r.y+(-e.y+i.y)*o+(2*e.y-5*r.y+4*i.y-n.y)*s+(-e.y+3*r.y-3*i.y+n.y)*a),.5*(2*r.z+(-e.z+i.z)*o+(2*e.z-5*r.z+4*i.z-n.z)*s+(-e.z+3*r.z-3*i.z+n.z)*a))},t.Clamp=function(e,r,i){var n=e.x;n=n>i.x?i.x:n,n=n<r.x?r.x:n;var o=e.y;o=o>i.y?i.y:o,o=o<r.y?r.y:o;var s=e.z;return s=s>i.z?i.z:s,s=s<r.z?r.z:s,new t(n,o,s)},t.Hermite=function(e,r,i,n,o){var s=o*o,a=o*s,l=2*a-3*s+1,u=-2*a+3*s,h=a-2*s+o,c=a-s;return new t(e.x*l+i.x*u+r.x*h+n.x*c,e.y*l+i.y*u+r.y*h+n.y*c,e.z*l+i.z*u+r.z*h+n.z*c)},t.Lerp=function(e,r,i){var n=new t(0,0,0);return t.LerpToRef(e,r,i,n),n},t.LerpToRef=function(e,t,r,i){i.x=e.x+(t.x-e.x)*r,i.y=e.y+(t.y-e.y)*r,i.z=e.z+(t.z-e.z)*r},t.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},t.Cross=function(e,r){var i=t.Zero();return t.CrossToRef(e,r,i),i},t.CrossToRef=function(e,t,r){T.Vector3[0].x=e.y*t.z-e.z*t.y,T.Vector3[0].y=e.z*t.x-e.x*t.z,T.Vector3[0].z=e.x*t.y-e.y*t.x,r.copyFrom(T.Vector3[0])},t.Normalize=function(e){var r=t.Zero();return t.NormalizeToRef(e,r),r},t.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},t.Project=function(e,r,i,n){var o=n.width,s=n.height,a=n.x,u=n.y,h=t._viewportMatrixCache?t._viewportMatrixCache:t._viewportMatrixCache=new l;l.FromValuesToRef(o/2,0,0,0,0,-s/2,0,0,0,0,.5,0,a+o/2,s/2+u,.5,1,h);var c=T.Matrix[0];return r.multiplyToRef(i,c),c.multiplyToRef(h,c),t.TransformCoordinates(e,c)},t.UnprojectFromTransform=function(r,i,n,o,s){var a=T.Matrix[0];o.multiplyToRef(s,a),a.invert(),r.x=r.x/i*2-1,r.y=-(r.y/n*2-1);var l=t.TransformCoordinates(r,a),u=r.x*a.m[3]+r.y*a.m[7]+r.z*a.m[11]+a.m[15];return e.Scalar.WithinEpsilon(u,1)&&(l=l.scale(1/u)),l},t.Unproject=function(e,r,i,n,o,s){var a=t.Zero();return t.UnprojectToRef(e,r,i,n,o,s,a),a},t.UnprojectToRef=function(e,r,i,n,o,s,a){t.UnprojectFloatsToRef(e.x,e.y,e.z,r,i,n,o,s,a)},t.UnprojectFloatsToRef=function(r,i,n,o,s,a,l,u,h){var c=T.Matrix[0];a.multiplyToRef(l,c),c.multiplyToRef(u,c),c.invert();var f=T.Vector3[0];f.x=r/o*2-1,f.y=-(i/s*2-1),f.z=2*n-1,t.TransformCoordinatesToRef(f,c,h);var d=f.x*c.m[3]+f.y*c.m[7]+f.z*c.m[11]+c.m[15];e.Scalar.WithinEpsilon(d,1)&&h.scaleInPlace(1/d)},t.Minimize=function(e,t){var r=e.clone();return r.minimizeInPlace(t),r},t.Maximize=function(e,t){var r=e.clone();return r.maximizeInPlace(t),r},t.Distance=function(e,r){return Math.sqrt(t.DistanceSquared(e,r))},t.DistanceSquared=function(e,t){var r=e.x-t.x,i=e.y-t.y,n=e.z-t.z;return r*r+i*i+n*n},t.Center=function(e,t){var r=e.add(t);return r.scaleInPlace(.5),r},t.RotationFromAxis=function(e,r,i){var n=t.Zero();return t.RotationFromAxisToRef(e,r,i,n),n},t.RotationFromAxisToRef=function(e,t,r,i){var n=T.Quaternion[0];a.RotationQuaternionFromAxisToRef(e,t,r,n),n.toEulerAnglesToRef(i)},t})();e.Vector3=n;var o=(function(){function t(e,t,r,i){this.x=e,this.y=t,this.z=r,this.w=i}return t.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},t.prototype.getClassName=function(){return"Vector4"},t.prototype.getHashCode=function(){var e=this.x||0;return e=397*e^(this.y||0),e=397*e^(this.z||0),e=397*e^(this.w||0)},t.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},t.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},t.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},t.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,this},t.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},t.prototype.subtract=function(e){return new t(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},t.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,this},t.prototype.subtractFromFloats=function(e,r,i,n){return new t(this.x-e,this.y-r,this.z-i,this.w-n)},t.prototype.subtractFromFloatsToRef=function(e,t,r,i,n){return n.x=this.x-e,n.y=this.y-t,n.z=this.z-r,n.w=this.w-i,this},t.prototype.negate=function(){return new t(-this.x,-this.y,-this.z,-this.w)},t.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},t.prototype.scale=function(e){return new t(this.x*e,this.y*e,this.z*e,this.w*e)},t.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},t.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},t.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},t.prototype.equalsWithEpsilon=function(t,r){return void 0===r&&(r=e.Epsilon),t&&e.Scalar.WithinEpsilon(this.x,t.x,r)&&e.Scalar.WithinEpsilon(this.y,t.y,r)&&e.Scalar.WithinEpsilon(this.z,t.z,r)&&e.Scalar.WithinEpsilon(this.w,t.w,r)},t.prototype.equalsToFloats=function(e,t,r,i){return this.x===e&&this.y===t&&this.z===r&&this.w===i},t.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},t.prototype.multiply=function(e){return new t(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)},t.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,this},t.prototype.multiplyByFloats=function(e,r,i,n){return new t(this.x*e,this.y*r,this.z*i,this.w*n)},t.prototype.divide=function(e){return new t(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)},t.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,this},t.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},t.prototype.minimizeInPlace=function(e){return e.x<this.x&&(this.x=e.x),e.y<this.y&&(this.y=e.y),e.z<this.z&&(this.z=e.z),e.w<this.w&&(this.w=e.w),this},t.prototype.maximizeInPlace=function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.toVector3=function(){return new n(this.x,this.y,this.z)},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},t.prototype.copyFromFloats=function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},t.prototype.set=function(e,t,r,i){return this.copyFromFloats(e,t,r,i)},t.FromArray=function(e,r){return r||(r=0),new t(e[r],e[r+1],e[r+2],e[r+3])},t.FromArrayToRef=function(e,t,r){r.x=e[t],r.y=e[t+1],r.z=e[t+2],r.w=e[t+3]},t.FromFloatArrayToRef=function(e,r,i){t.FromArrayToRef(e,r,i)},t.FromFloatsToRef=function(e,t,r,i,n){n.x=e,n.y=t,n.z=r,n.w=i},t.Zero=function(){return new t(0,0,0,0)},t.One=function(){return new t(1,1,1,1)},t.Normalize=function(e){var r=t.Zero();return t.NormalizeToRef(e,r),r},t.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},t.Minimize=function(e,t){var r=e.clone();return r.minimizeInPlace(t),r},t.Maximize=function(e,t){var r=e.clone();return r.maximizeInPlace(t),r},t.Distance=function(e,r){return Math.sqrt(t.DistanceSquared(e,r))},t.DistanceSquared=function(e,t){var r=e.x-t.x,i=e.y-t.y,n=e.z-t.z,o=e.w-t.w;return r*r+i*i+n*n+o*o},t.Center=function(e,t){var r=e.add(t);return r.scaleInPlace(.5),r},t.TransformNormal=function(e,r){var i=t.Zero();return t.TransformNormalToRef(e,r,i),i},t.TransformNormalToRef=function(e,t,r){var i=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10];r.x=i,r.y=n,r.z=o,r.w=e.w},t.TransformNormalFromFloatsToRef=function(e,t,r,i,n,o){o.x=e*n.m[0]+t*n.m[4]+r*n.m[8],o.y=e*n.m[1]+t*n.m[5]+r*n.m[9],o.z=e*n.m[2]+t*n.m[6]+r*n.m[10],o.w=i},t})();e.Vector4=o;var s=(function(){function e(e,t){this.width=e,this.height=t}return e.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},e.prototype.getClassName=function(){return"Size"},e.prototype.getHashCode=function(){var e=this.width||0;return e=397*e^(this.height||0)},e.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},e.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},e.prototype.set=function(e,t){return this.copyFromFloats(e,t)},e.prototype.multiplyByFloats=function(t,r){return new e(this.width*t,this.height*r)},e.prototype.clone=function(){return new e(this.width,this.height)},e.prototype.equals=function(e){return!!e&&(this.width===e.width&&this.height===e.height)},Object.defineProperty(e.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),e.Zero=function(){return new e(0,0)},e.prototype.add=function(t){return new e(this.width+t.width,this.height+t.height)},e.prototype.subtract=function(t){return new e(this.width-t.width,this.height-t.height)},e.Lerp=function(t,r,i){return new e(t.width+(r.width-t.width)*i,t.height+(r.height-t.height)*i)},e})();e.Size=s;var a=(function(){function e(e,t,r,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=e,this.y=t,this.z=r,this.w=i}return e.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},e.prototype.getClassName=function(){return"Quaternion"},e.prototype.getHashCode=function(){var e=this.x||0;return e=397*e^(this.y||0),e=397*e^(this.z||0),e=397*e^(this.w||0)},e.prototype.asArray=function(){return[this.x,this.y,this.z,this.w]},e.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},e.prototype.clone=function(){return new e(this.x,this.y,this.z,this.w)},e.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e.prototype.copyFromFloats=function(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this},e.prototype.set=function(e,t,r,i){return this.copyFromFloats(e,t,r,i)},e.prototype.add=function(t){return new e(this.x+t.x,this.y+t.y,this.z+t.z,this.w+t.w)},e.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},e.prototype.subtract=function(t){return new e(this.x-t.x,this.y-t.y,this.z-t.z,this.w-t.w)},e.prototype.scale=function(t){return new e(this.x*t,this.y*t,this.z*t,this.w*t)},e.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},e.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},e.prototype.multiply=function(t){var r=new e(0,0,0,1);return this.multiplyToRef(t,r),r},e.prototype.multiplyToRef=function(e,t){var r=this.x*e.w+this.y*e.z-this.z*e.y+this.w*e.x,i=-this.x*e.z+this.y*e.w+this.z*e.x+this.w*e.y,n=this.x*e.y-this.y*e.x+this.z*e.w+this.w*e.z,o=-this.x*e.x-this.y*e.y-this.z*e.z+this.w*e.w;return t.copyFromFloats(r,i,n,o),this},e.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},e.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this.x,-this.y,-this.z,this.w),this},e.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},e.prototype.conjugate=function(){return new e(-this.x,-this.y,-this.z,this.w)},e.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.prototype.normalize=function(){var e=1/this.length();return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},e.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=n.Zero();return this.toEulerAnglesToRef(t,e),t},e.prototype.toEulerAnglesToRef=function(e,t){void 0===t&&(t="YZX");var r=this.z,i=this.x,n=this.y,o=this.w,s=o*o,a=r*r,l=i*i,u=n*n,h=n*r-i*o;return h<-.4999999?(e.y=2*Math.atan2(n,o),e.x=Math.PI/2,e.z=0):h>.4999999?(e.y=2*Math.atan2(n,o),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(i*n+r*o),-a-l+u+s),e.x=Math.asin(-2*(r*n-i*o)),e.y=Math.atan2(2*(r*i+n*o),a-l-u+s)),this},e.prototype.toRotationMatrix=function(e){var t=this.x*this.x,r=this.y*this.y,i=this.z*this.z,n=this.x*this.y,o=this.z*this.w,s=this.z*this.x,a=this.y*this.w,l=this.y*this.z,u=this.x*this.w;return e.m[0]=1-2*(r+i),e.m[1]=2*(n+o),e.m[2]=2*(s-a),e.m[3]=0,e.m[4]=2*(n-o),e.m[5]=1-2*(i+t),e.m[6]=2*(l+u),e.m[7]=0,e.m[8]=2*(s+a),e.m[9]=2*(l-u),e.m[10]=1-2*(r+t),e.m[11]=0,e.m[12]=0,e.m[13]=0,e.m[14]=0,e.m[15]=1,e._markAsUpdated(),this},e.prototype.fromRotationMatrix=function(t){return e.FromRotationMatrixToRef(t,this),this},e.FromRotationMatrix=function(t){var r=new e;return e.FromRotationMatrixToRef(t,r),r},e.FromRotationMatrixToRef=function(e,t){var r,i=e.m,n=i[0],o=i[4],s=i[8],a=i[1],l=i[5],u=i[9],h=i[2],c=i[6],f=i[10],d=n+l+f;d>0?(r=.5/Math.sqrt(d+1),t.w=.25/r,t.x=(c-u)*r,t.y=(s-h)*r,t.z=(a-o)*r):n>l&&n>f?(r=2*Math.sqrt(1+n-l-f),t.w=(c-u)/r,t.x=.25*r,t.y=(o+a)/r,t.z=(s+h)/r):l>f?(r=2*Math.sqrt(1+l-n-f),t.w=(s-h)/r,t.x=(o+a)/r,t.y=.25*r,t.z=(u+c)/r):(r=2*Math.sqrt(1+f-n-l),t.w=(a-o)/r,t.x=(s+h)/r,t.y=(u+c)/r,t.z=.25*r)},e.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},e.AreClose=function(t,r){return e.Dot(t,r)>=0},e.Zero=function(){return new e(0,0,0,0)},e.Inverse=function(t){return new e(-t.x,-t.y,-t.z,t.w)},e.Identity=function(){return new e(0,0,0,1)},e.IsIdentity=function(e){return e&&0===e.x&&0===e.y&&0===e.z&&1===e.w},e.RotationAxis=function(t,r){return e.RotationAxisToRef(t,r,new e)},e.RotationAxisToRef=function(e,t,r){var i=Math.sin(t/2);return e.normalize(),r.w=Math.cos(t/2),r.x=e.x*i,r.y=e.y*i,r.z=e.z*i,r},e.FromArray=function(t,r){return r||(r=0),new e(t[r],t[r+1],t[r+2],t[r+3])},e.RotationYawPitchRoll=function(t,r,i){var n=new e;return e.RotationYawPitchRollToRef(t,r,i,n),n},e.RotationYawPitchRollToRef=function(e,t,r,i){var n=.5*r,o=.5*t,s=.5*e,a=Math.sin(n),l=Math.cos(n),u=Math.sin(o),h=Math.cos(o),c=Math.sin(s),f=Math.cos(s);i.x=f*u*l+c*h*a,i.y=c*h*l-f*u*a,i.z=f*h*a-c*u*l,i.w=f*h*l+c*u*a},e.RotationAlphaBetaGamma=function(t,r,i){var n=new e;return e.RotationAlphaBetaGammaToRef(t,r,i,n),n},e.RotationAlphaBetaGammaToRef=function(e,t,r,i){var n=.5*(r+e),o=.5*(r-e),s=.5*t;i.x=Math.cos(o)*Math.sin(s),i.y=Math.sin(o)*Math.sin(s),i.z=Math.sin(n)*Math.cos(s),i.w=Math.cos(n)*Math.cos(s)},e.RotationQuaternionFromAxis=function(t,r,i){var n=new e(0,0,0,0);return e.RotationQuaternionFromAxisToRef(t,r,i,n),n},e.RotationQuaternionFromAxisToRef=function(t,r,i,n){var o=T.Matrix[0];l.FromXYZAxesToRef(t.normalize(),r.normalize(),i.normalize(),o),e.FromRotationMatrixToRef(o,n)},e.Slerp=function(t,r,i){var n=e.Identity();return e.SlerpToRef(t,r,i,n),n},e.SlerpToRef=function(e,t,r,i){var n,o,s=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,a=!1;if(s<0&&(a=!0,s=-s),s>.999999)o=1-r,n=a?-r:r;else{var l=Math.acos(s),u=1/Math.sin(l);o=Math.sin((1-r)*l)*u,n=a?-Math.sin(r*l)*u:Math.sin(r*l)*u}i.x=o*e.x+n*t.x,i.y=o*e.y+n*t.y,i.z=o*e.z+n*t.z,i.w=o*e.w+n*t.w},e.Hermite=function(t,r,i,n,o){var s=o*o,a=o*s,l=2*a-3*s+1,u=-2*a+3*s,h=a-2*s+o,c=a-s;return new e(t.x*l+i.x*u+r.x*h+n.x*c,t.y*l+i.y*u+r.y*h+n.y*c,t.z*l+i.z*u+r.z*h+n.z*c,t.w*l+i.w*u+r.w*h+n.w*c)},e})();e.Quaternion=a;var l=(function(){function e(){this._isIdentity=!1,this._isIdentityDirty=!0,this.m=new Float32Array(16),this._markAsUpdated()}return e.prototype._markAsUpdated=function(){this.updateFlag=e._updateFlagSeed++,this._isIdentityDirty=!0},e.prototype.isIdentity=function(e){return void 0===e&&(e=!1),this._isIdentityDirty&&(this._isIdentityDirty=!1,1!==this.m[0]||1!==this.m[5]||1!==this.m[15]?this._isIdentity=!1:0!==this.m[1]||0!==this.m[2]||0!==this.m[3]||0!==this.m[4]||0!==this.m[6]||0!==this.m[7]||0!==this.m[8]||0!==this.m[9]||0!==this.m[11]||0!==this.m[12]||0!==this.m[13]||0!==this.m[14]?this._isIdentity=!1:this._isIdentity=!0,e||1===this.m[10]||(this._isIdentity=!1)),this._isIdentity},e.prototype.determinant=function(){var e=this.m[10]*this.m[15]-this.m[11]*this.m[14],t=this.m[9]*this.m[15]-this.m[11]*this.m[13],r=this.m[9]*this.m[14]-this.m[10]*this.m[13],i=this.m[8]*this.m[15]-this.m[11]*this.m[12],n=this.m[8]*this.m[14]-this.m[10]*this.m[12],o=this.m[8]*this.m[13]-this.m[9]*this.m[12];return this.m[0]*(this.m[5]*e-this.m[6]*t+this.m[7]*r)-this.m[1]*(this.m[4]*e-this.m[6]*i+this.m[7]*n)+this.m[2]*(this.m[4]*t-this.m[5]*i+this.m[7]*o)-this.m[3]*(this.m[4]*r-this.m[5]*n+this.m[6]*o)},e.prototype.toArray=function(){return this.m},e.prototype.asArray=function(){return this.toArray()},e.prototype.invert=function(){return this.invertToRef(this),this},e.prototype.reset=function(){for(var e=0;e<16;e++)this.m[e]=0;return this._markAsUpdated(),this},e.prototype.add=function(t){var r=new e;return this.addToRef(t,r),r},e.prototype.addToRef=function(e,t){for(var r=0;r<16;r++)t.m[r]=this.m[r]+e.m[r];return t._markAsUpdated(),this},e.prototype.addToSelf=function(e){for(var t=0;t<16;t++)this.m[t]+=e.m[t];return this._markAsUpdated(),this},e.prototype.invertToRef=function(e){var t=this.m[0],r=this.m[1],i=this.m[2],n=this.m[3],o=this.m[4],s=this.m[5],a=this.m[6],l=this.m[7],u=this.m[8],h=this.m[9],c=this.m[10],f=this.m[11],d=this.m[12],p=this.m[13],A=this.m[14],m=this.m[15],g=c*m-f*A,_=h*m-f*p,v=h*A-c*p,y=u*m-f*d,b=u*A-c*d,E=u*p-h*d,T=s*g-a*_+l*v,x=-(o*g-a*y+l*b),M=o*_-s*y+l*E,C=-(o*v-s*b+a*E),P=1/(t*T+r*x+i*M+n*C),S=a*m-l*A,R=s*m-l*p,O=s*A-a*p,D=o*m-l*d,w=o*A-a*d,I=o*p-s*d,L=a*f-l*c,B=s*f-l*h,F=s*c-a*h,N=o*f-l*u,U=o*c-a*u,V=o*h-s*u;return e.m[0]=T*P,e.m[4]=x*P,e.m[8]=M*P,e.m[12]=C*P,e.m[1]=-(r*g-i*_+n*v)*P,e.m[5]=(t*g-i*y+n*b)*P,e.m[9]=-(t*_-r*y+n*E)*P,e.m[13]=(t*v-r*b+i*E)*P,e.m[2]=(r*S-i*R+n*O)*P,e.m[6]=-(t*S-i*D+n*w)*P,e.m[10]=(t*R-r*D+n*I)*P,e.m[14]=-(t*O-r*w+i*I)*P,e.m[3]=-(r*L-i*B+n*F)*P,e.m[7]=(t*L-i*N+n*U)*P,e.m[11]=-(t*B-r*N+n*V)*P,e.m[15]=(t*F-r*U+i*V)*P,e._markAsUpdated(),this},e.prototype.setTranslationFromFloats=function(e,t,r){return this.m[12]=e,this.m[13]=t,this.m[14]=r,this._markAsUpdated(),this},e.prototype.setTranslation=function(e){return this.m[12]=e.x,this.m[13]=e.y,this.m[14]=e.z,this._markAsUpdated(),this},e.prototype.getTranslation=function(){return new n(this.m[12],this.m[13],this.m[14])},e.prototype.getTranslationToRef=function(e){return e.x=this.m[12],e.y=this.m[13],e.z=this.m[14],this},e.prototype.removeRotationAndScaling=function(){return this.setRowFromFloats(0,1,0,0,0),this.setRowFromFloats(1,0,1,0,0),this.setRowFromFloats(2,0,0,1,0),this},e.prototype.multiply=function(t){var r=new e;return this.multiplyToRef(t,r),r},e.prototype.copyFrom=function(e){for(var t=0;t<16;t++)this.m[t]=e.m[t];return this._markAsUpdated(),this},e.prototype.copyToArray=function(e,t){void 0===t&&(t=0);for(var r=0;r<16;r++)e[t+r]=this.m[r];return this},e.prototype.multiplyToRef=function(e,t){return this.multiplyToArray(e,t.m,0),t._markAsUpdated(),this},e.prototype.multiplyToArray=function(e,t,r){var i=this.m[0],n=this.m[1],o=this.m[2],s=this.m[3],a=this.m[4],l=this.m[5],u=this.m[6],h=this.m[7],c=this.m[8],f=this.m[9],d=this.m[10],p=this.m[11],A=this.m[12],m=this.m[13],g=this.m[14],_=this.m[15],v=e.m[0],y=e.m[1],b=e.m[2],E=e.m[3],T=e.m[4],x=e.m[5],M=e.m[6],C=e.m[7],P=e.m[8],S=e.m[9],R=e.m[10],O=e.m[11],D=e.m[12],w=e.m[13],I=e.m[14],L=e.m[15];return t[r]=i*v+n*T+o*P+s*D,t[r+1]=i*y+n*x+o*S+s*w,t[r+2]=i*b+n*M+o*R+s*I,t[r+3]=i*E+n*C+o*O+s*L,t[r+4]=a*v+l*T+u*P+h*D,t[r+5]=a*y+l*x+u*S+h*w,t[r+6]=a*b+l*M+u*R+h*I,t[r+7]=a*E+l*C+u*O+h*L,t[r+8]=c*v+f*T+d*P+p*D,t[r+9]=c*y+f*x+d*S+p*w,t[r+10]=c*b+f*M+d*R+p*I,t[r+11]=c*E+f*C+d*O+p*L,t[r+12]=A*v+m*T+g*P+_*D,t[r+13]=A*y+m*x+g*S+_*w,t[r+14]=A*b+m*M+g*R+_*I,t[r+15]=A*E+m*C+g*O+_*L,this},e.prototype.equals=function(e){return e&&this.m[0]===e.m[0]&&this.m[1]===e.m[1]&&this.m[2]===e.m[2]&&this.m[3]===e.m[3]&&this.m[4]===e.m[4]&&this.m[5]===e.m[5]&&this.m[6]===e.m[6]&&this.m[7]===e.m[7]&&this.m[8]===e.m[8]&&this.m[9]===e.m[9]&&this.m[10]===e.m[10]&&this.m[11]===e.m[11]&&this.m[12]===e.m[12]&&this.m[13]===e.m[13]&&this.m[14]===e.m[14]&&this.m[15]===e.m[15]},e.prototype.clone=function(){return e.FromValues(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5],this.m[6],this.m[7],this.m[8],this.m[9],this.m[10],this.m[11],this.m[12],this.m[13],this.m[14],this.m[15])},e.prototype.getClassName=function(){return"Matrix"},e.prototype.getHashCode=function(){for(var e=this.m[0]||0,t=1;t<16;t++)e=397*e^(this.m[t]||0);return e},e.prototype.decompose=function(t,r,i){return i&&(i.x=this.m[12],i.y=this.m[13],i.z=this.m[14]),t=t||T.Vector3[0],t.x=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]+this.m[2]*this.m[2]),t.y=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]+this.m[6]*this.m[6]),t.z=Math.sqrt(this.m[8]*this.m[8]+this.m[9]*this.m[9]+this.m[10]*this.m[10]),this.determinant()<=0&&(t.y*=-1),0===t.x||0===t.y||0===t.z?(r&&(r.x=0,r.y=0,r.z=0,r.w=1),!1):(r&&(e.FromValuesToRef(this.m[0]/t.x,this.m[1]/t.x,this.m[2]/t.x,0,this.m[4]/t.y,this.m[5]/t.y,this.m[6]/t.y,0,this.m[8]/t.z,this.m[9]/t.z,this.m[10]/t.z,0,0,0,0,1,T.Matrix[0]),a.FromRotationMatrixToRef(T.Matrix[0],r)),!0)},e.prototype.getRow=function(e){if(e<0||e>3)return null;var t=4*e;return new o(this.m[t+0],this.m[t+1],this.m[t+2],this.m[t+3])},e.prototype.setRow=function(e,t){if(e<0||e>3)return this;var r=4*e;return this.m[r+0]=t.x,this.m[r+1]=t.y,this.m[r+2]=t.z,this.m[r+3]=t.w,this._markAsUpdated(),this},e.prototype.transpose=function(){return e.Transpose(this)},e.prototype.transposeToRef=function(t){return e.TransposeToRef(this,t),this},e.prototype.setRowFromFloats=function(e,t,r,i,n){if(e<0||e>3)return this;var o=4*e;return this.m[o+0]=t,this.m[o+1]=r,this.m[o+2]=i,this.m[o+3]=n,this._markAsUpdated(),this},e.prototype.scale=function(t){var r=new e;return this.scaleToRef(t,r),r},e.prototype.scaleToRef=function(e,t){for(var r=0;r<16;r++)t.m[r]=this.m[r]*e;return t._markAsUpdated(),this},e.prototype.scaleAndAddToRef=function(e,t){for(var r=0;r<16;r++)t.m[r]+=this.m[r]*e;return t._markAsUpdated(),this},e.prototype.toNormalMatrix=function(t){this.invertToRef(t),t.transpose();var r=t.m;e.FromValuesToRef(r[0],r[1],r[2],0,r[4],r[5],r[6],0,r[8],r[9],r[10],0,0,0,0,1,t)},e.prototype.getRotationMatrix=function(){var t=e.Identity();return this.getRotationMatrixToRef(t),t},e.prototype.getRotationMatrixToRef=function(t){var r=this.m,i=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]),n=Math.sqrt(r[4]*r[4]+r[5]*r[5]+r[6]*r[6]),o=Math.sqrt(r[8]*r[8]+r[9]*r[9]+r[10]*r[10]);return this.determinant()<=0&&(n*=-1),0===i||0===n||0===o?e.IdentityToRef(t):e.FromValuesToRef(r[0]/i,r[1]/i,r[2]/i,0,r[4]/n,r[5]/n,r[6]/n,0,r[8]/o,r[9]/o,r[10]/o,0,0,0,0,1,t),this},e.FromArray=function(t,r){var i=new e;return r||(r=0),e.FromArrayToRef(t,r,i),i},e.FromArrayToRef=function(e,t,r){for(var i=0;i<16;i++)r.m[i]=e[i+t];r._markAsUpdated()},e.FromFloat32ArrayToRefScaled=function(e,t,r,i){for(var n=0;n<16;n++)i.m[n]=e[n+t]*r;i._markAsUpdated()},e.FromValuesToRef=function(e,t,r,i,n,o,s,a,l,u,h,c,f,d,p,A,m){m.m[0]=e,m.m[1]=t,m.m[2]=r,m.m[3]=i,m.m[4]=n,m.m[5]=o,m.m[6]=s,m.m[7]=a,m.m[8]=l,m.m[9]=u,m.m[10]=h,m.m[11]=c,m.m[12]=f,m.m[13]=d,m.m[14]=p,m.m[15]=A,m._markAsUpdated()},Object.defineProperty(e,"IdentityReadOnly",{get:function(){return e._identityReadOnly},enumerable:!0,configurable:!0}),e.FromValues=function(t,r,i,n,o,s,a,l,u,h,c,f,d,p,A,m){var g=new e;return g.m[0]=t,g.m[1]=r,g.m[2]=i,g.m[3]=n,g.m[4]=o,g.m[5]=s,g.m[6]=a,g.m[7]=l,g.m[8]=u,g.m[9]=h,g.m[10]=c,g.m[11]=f,g.m[12]=d,g.m[13]=p,g.m[14]=A,g.m[15]=m,g},e.Compose=function(t,r,i){var n=e.Identity();return e.ComposeToRef(t,r,i,n),n},e.ComposeToRef=function(t,r,i,n){e.FromValuesToRef(t.x,0,0,0,0,t.y,0,0,0,0,t.z,0,0,0,0,1,T.Matrix[1]),r.toRotationMatrix(T.Matrix[0]),T.Matrix[1].multiplyToRef(T.Matrix[0],n),n.setTranslation(i)},e.Identity=function(){return e.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.IdentityToRef=function(t){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,t)},e.Zero=function(){return e.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},e.RotationX=function(t){var r=new e;return e.RotationXToRef(t,r),r},e.Invert=function(t){var r=new e;return t.invertToRef(r),r},e.RotationXToRef=function(e,t){var r=Math.sin(e),i=Math.cos(e);t.m[0]=1,t.m[15]=1,t.m[5]=i,t.m[10]=i,t.m[9]=-r,t.m[6]=r,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[7]=0,t.m[8]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},e.RotationY=function(t){var r=new e;return e.RotationYToRef(t,r),r},e.RotationYToRef=function(e,t){var r=Math.sin(e),i=Math.cos(e);t.m[5]=1,t.m[15]=1,t.m[0]=i,t.m[2]=-r,t.m[8]=r,t.m[10]=i,t.m[1]=0,t.m[3]=0,t.m[4]=0,t.m[6]=0,t.m[7]=0,t.m[9]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},e.RotationZ=function(t){var r=new e;return e.RotationZToRef(t,r),r},e.RotationZToRef=function(e,t){var r=Math.sin(e),i=Math.cos(e);t.m[10]=1,t.m[15]=1,t.m[0]=i,t.m[1]=r,t.m[4]=-r,t.m[5]=i,t.m[2]=0,t.m[3]=0,t.m[6]=0,t.m[7]=0,t.m[8]=0,t.m[9]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},e.RotationAxis=function(t,r){var i=e.Zero();return e.RotationAxisToRef(t,r,i),i},e.RotationAxisToRef=function(e,t,r){var i=Math.sin(-t),n=Math.cos(-t),o=1-n;e.normalize(),r.m[0]=e.x*e.x*o+n,r.m[1]=e.x*e.y*o-e.z*i,r.m[2]=e.x*e.z*o+e.y*i,r.m[3]=0,r.m[4]=e.y*e.x*o+e.z*i,r.m[5]=e.y*e.y*o+n,r.m[6]=e.y*e.z*o-e.x*i,r.m[7]=0,r.m[8]=e.z*e.x*o-e.y*i,r.m[9]=e.z*e.y*o+e.x*i,r.m[10]=e.z*e.z*o+n,r.m[11]=0,r.m[15]=1,r._markAsUpdated()},e.RotationYawPitchRoll=function(t,r,i){var n=new e;return e.RotationYawPitchRollToRef(t,r,i,n),n},e.RotationYawPitchRollToRef=function(e,t,r,i){a.RotationYawPitchRollToRef(e,t,r,this._tempQuaternion),this._tempQuaternion.toRotationMatrix(i)},e.Scaling=function(t,r,i){var n=e.Zero();return e.ScalingToRef(t,r,i,n),n},e.ScalingToRef=function(e,t,r,i){i.m[0]=e,i.m[1]=0,i.m[2]=0,i.m[3]=0,i.m[4]=0,i.m[5]=t,i.m[6]=0,i.m[7]=0,i.m[8]=0,i.m[9]=0,i.m[10]=r,i.m[11]=0,i.m[12]=0,i.m[13]=0,i.m[14]=0,i.m[15]=1,i._markAsUpdated()},e.Translation=function(t,r,i){var n=e.Identity();return e.TranslationToRef(t,r,i,n),n},
- e.TranslationToRef=function(t,r,i,n){e.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,t,r,i,1,n)},e.Lerp=function(t,r,i){var n=e.Zero();return e.LerpToRef(t,r,i,n),n},e.LerpToRef=function(e,t,r,i){for(var n=0;n<16;n++)i.m[n]=e.m[n]*(1-r)+t.m[n]*r;i._markAsUpdated()},e.DecomposeLerp=function(t,r,i){var n=e.Zero();return e.DecomposeLerpToRef(t,r,i,n),n},e.DecomposeLerpToRef=function(t,r,i,o){var s=T.Vector3[0],l=T.Quaternion[0],u=T.Vector3[1];t.decompose(s,l,u);var h=T.Vector3[2],c=T.Quaternion[1],f=T.Vector3[3];r.decompose(h,c,f);var d=T.Vector3[4];n.LerpToRef(s,h,i,d);var p=T.Quaternion[2];a.SlerpToRef(l,c,i,p);var A=T.Vector3[5];n.LerpToRef(u,f,i,A),e.ComposeToRef(d,p,A,o)},e.LookAtLH=function(t,r,i){var n=e.Zero();return e.LookAtLHToRef(t,r,i,n),n},e.LookAtLHToRef=function(t,r,i,o){r.subtractToRef(t,this._zAxis),this._zAxis.normalize(),n.CrossToRef(i,this._zAxis,this._xAxis),0===this._xAxis.lengthSquared()?this._xAxis.x=1:this._xAxis.normalize(),n.CrossToRef(this._zAxis,this._xAxis,this._yAxis),this._yAxis.normalize();var s=-n.Dot(this._xAxis,t),a=-n.Dot(this._yAxis,t),l=-n.Dot(this._zAxis,t);return e.FromValuesToRef(this._xAxis.x,this._yAxis.x,this._zAxis.x,0,this._xAxis.y,this._yAxis.y,this._zAxis.y,0,this._xAxis.z,this._yAxis.z,this._zAxis.z,0,s,a,l,1,o)},e.LookAtRH=function(t,r,i){var n=e.Zero();return e.LookAtRHToRef(t,r,i,n),n},e.LookAtRHToRef=function(t,r,i,o){t.subtractToRef(r,this._zAxis),this._zAxis.normalize(),n.CrossToRef(i,this._zAxis,this._xAxis),0===this._xAxis.lengthSquared()?this._xAxis.x=1:this._xAxis.normalize(),n.CrossToRef(this._zAxis,this._xAxis,this._yAxis),this._yAxis.normalize();var s=-n.Dot(this._xAxis,t),a=-n.Dot(this._yAxis,t),l=-n.Dot(this._zAxis,t);return e.FromValuesToRef(this._xAxis.x,this._yAxis.x,this._zAxis.x,0,this._xAxis.y,this._yAxis.y,this._zAxis.y,0,this._xAxis.z,this._yAxis.z,this._zAxis.z,0,s,a,l,1,o)},e.OrthoLH=function(t,r,i,n){var o=e.Zero();return e.OrthoLHToRef(t,r,i,n,o),o},e.OrthoLHToRef=function(t,r,i,n,o){var s=i,a=n,l=2/t,u=2/r,h=2/(a-s),c=-(a+s)/(a-s);e.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,h,0,0,0,c,1,o)},e.OrthoOffCenterLH=function(t,r,i,n,o,s){var a=e.Zero();return e.OrthoOffCenterLHToRef(t,r,i,n,o,s,a),a},e.OrthoOffCenterLHToRef=function(t,r,i,n,o,s,a){var l=o,u=s,h=2/(r-t),c=2/(n-i),f=2/(u-l),d=-(u+l)/(u-l),p=(t+r)/(t-r),A=(n+i)/(i-n);e.FromValuesToRef(h,0,0,0,0,c,0,0,0,0,f,0,p,A,d,1,a)},e.OrthoOffCenterRH=function(t,r,i,n,o,s){var a=e.Zero();return e.OrthoOffCenterRHToRef(t,r,i,n,o,s,a),a},e.OrthoOffCenterRHToRef=function(t,r,i,n,o,s,a){e.OrthoOffCenterLHToRef(t,r,i,n,o,s,a),a.m[10]*=-1},e.PerspectiveLH=function(t,r,i,n){var o=e.Zero(),s=i,a=n,l=2*s/t,u=2*s/r,h=(a+s)/(a-s),c=-2*a*s/(a-s);return e.FromValuesToRef(l,0,0,0,0,u,0,0,0,0,h,1,0,0,c,0,o),o},e.PerspectiveFovLH=function(t,r,i,n){var o=e.Zero();return e.PerspectiveFovLHToRef(t,r,i,n,o),o},e.PerspectiveFovLHToRef=function(t,r,i,n,o,s){void 0===s&&(s=!0);var a=i,l=n,u=1/Math.tan(.5*t),h=s?u/r:u,c=s?u:u*r,f=(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(h,0,0,0,0,c,0,0,0,0,f,1,0,0,d,0,o)},e.PerspectiveFovRH=function(t,r,i,n){var o=e.Zero();return e.PerspectiveFovRHToRef(t,r,i,n,o),o},e.PerspectiveFovRHToRef=function(t,r,i,n,o,s){void 0===s&&(s=!0);var a=i,l=n,u=1/Math.tan(.5*t),h=s?u/r:u,c=s?u:u*r,f=-(l+a)/(l-a),d=-2*l*a/(l-a);e.FromValuesToRef(h,0,0,0,0,c,0,0,0,0,f,-1,0,0,d,0,o)},e.PerspectiveFovWebVRToRef=function(e,t,r,i,n){void 0===n&&(n=!1);var o=n?-1:1,s=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),l=Math.tan(e.leftDegrees*Math.PI/180),u=Math.tan(e.rightDegrees*Math.PI/180),h=2/(l+u),c=2/(s+a);i.m[0]=h,i.m[1]=i.m[2]=i.m[3]=i.m[4]=0,i.m[5]=c,i.m[6]=i.m[7]=0,i.m[8]=(l-u)*h*.5,i.m[9]=-(s-a)*c*.5,i.m[10]=-r/(t-r),i.m[11]=1*o,i.m[12]=i.m[13]=i.m[15]=0,i.m[14]=-2*r*t/(r-t),i._markAsUpdated()},e.GetFinalMatrix=function(t,r,i,n,o,s){var a=t.width,l=t.height,u=t.x,h=t.y,c=e.FromValues(a/2,0,0,0,0,-l/2,0,0,0,0,s-o,0,u+a/2,l/2+h,o,1);return r.multiply(i).multiply(n).multiply(c)},e.GetAsMatrix2x2=function(e){return new Float32Array([e.m[0],e.m[1],e.m[4],e.m[5]])},e.GetAsMatrix3x3=function(e){return new Float32Array([e.m[0],e.m[1],e.m[2],e.m[4],e.m[5],e.m[6],e.m[8],e.m[9],e.m[10]])},e.Transpose=function(t){var r=new e;return e.TransposeToRef(t,r),r},e.TransposeToRef=function(e,t){t.m[0]=e.m[0],t.m[1]=e.m[4],t.m[2]=e.m[8],t.m[3]=e.m[12],t.m[4]=e.m[1],t.m[5]=e.m[5],t.m[6]=e.m[9],t.m[7]=e.m[13],t.m[8]=e.m[2],t.m[9]=e.m[6],t.m[10]=e.m[10],t.m[11]=e.m[14],t.m[12]=e.m[3],t.m[13]=e.m[7],t.m[14]=e.m[11],t.m[15]=e.m[15]},e.Reflection=function(t){var r=new e;return e.ReflectionToRef(t,r),r},e.ReflectionToRef=function(e,t){e.normalize();var r=e.normal.x,i=e.normal.y,n=e.normal.z,o=-2*r,s=-2*i,a=-2*n;t.m[0]=o*r+1,t.m[1]=s*r,t.m[2]=a*r,t.m[3]=0,t.m[4]=o*i,t.m[5]=s*i+1,t.m[6]=a*i,t.m[7]=0,t.m[8]=o*n,t.m[9]=s*n,t.m[10]=a*n+1,t.m[11]=0,t.m[12]=o*e.d,t.m[13]=s*e.d,t.m[14]=a*e.d,t.m[15]=1,t._markAsUpdated()},e.FromXYZAxesToRef=function(e,t,r,i){i.m[0]=e.x,i.m[1]=e.y,i.m[2]=e.z,i.m[3]=0,i.m[4]=t.x,i.m[5]=t.y,i.m[6]=t.z,i.m[7]=0,i.m[8]=r.x,i.m[9]=r.y,i.m[10]=r.z,i.m[11]=0,i.m[12]=0,i.m[13]=0,i.m[14]=0,i.m[15]=1,i._markAsUpdated()},e.FromQuaternionToRef=function(e,t){var r=e.x*e.x,i=e.y*e.y,n=e.z*e.z,o=e.x*e.y,s=e.z*e.w,a=e.z*e.x,l=e.y*e.w,u=e.y*e.z,h=e.x*e.w;t.m[0]=1-2*(i+n),t.m[1]=2*(o+s),t.m[2]=2*(a-l),t.m[3]=0,t.m[4]=2*(o-s),t.m[5]=1-2*(n+r),t.m[6]=2*(u+h),t.m[7]=0,t.m[8]=2*(a+l),t.m[9]=2*(u-h),t.m[10]=1-2*(i+r),t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t.m[15]=1,t._markAsUpdated()},e._tempQuaternion=new a,e._xAxis=n.Zero(),e._yAxis=n.Zero(),e._zAxis=n.Zero(),e._updateFlagSeed=0,e._identityReadOnly=e.Identity(),e})();e.Matrix=l;var u=(function(){function e(e,t,r,i){this.normal=new n(e,t,r),this.d=i}return e.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},e.prototype.clone=function(){return new e(this.normal.x,this.normal.y,this.normal.z,this.d)},e.prototype.getClassName=function(){return"Plane"},e.prototype.getHashCode=function(){var e=this.normal.getHashCode();return e=397*e^(this.d||0)},e.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},e.prototype.transform=function(t){var r=l.Transpose(t),i=this.normal.x,n=this.normal.y,o=this.normal.z,s=this.d;return new e(i*r.m[0]+n*r.m[1]+o*r.m[2]+s*r.m[3],i*r.m[4]+n*r.m[5]+o*r.m[6]+s*r.m[7],i*r.m[8]+n*r.m[9]+o*r.m[10]+s*r.m[11],i*r.m[12]+n*r.m[13]+o*r.m[14]+s*r.m[15])},e.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},e.prototype.copyFromPoints=function(e,t,r){var i,n=t.x-e.x,o=t.y-e.y,s=t.z-e.z,a=r.x-e.x,l=r.y-e.y,u=r.z-e.z,h=o*u-s*l,c=s*a-n*u,f=n*l-o*a,d=Math.sqrt(h*h+c*c+f*f);return i=0!==d?1/d:0,this.normal.x=h*i,this.normal.y=c*i,this.normal.z=f*i,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},e.prototype.isFrontFacingTo=function(e,t){return n.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return n.Dot(e,this.normal)+this.d},e.FromArray=function(t){return new e(t[0],t[1],t[2],t[3])},e.FromPoints=function(t,r,i){var n=new e(0,0,0,0);return n.copyFromPoints(t,r,i),n},e.FromPositionAndNormal=function(t,r){var i=new e(0,0,0,0);return r.normalize(),i.normal=r,i.d=-(r.x*t.x+r.y*t.y+r.z*t.z),i},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,r){var i=-(t.x*e.x+t.y*e.y+t.z*e.z);return n.Dot(r,t)+i},e})();e.Plane=u;var h=(function(){function e(e,t,r,i){this.x=e,this.y=t,this.width=r,this.height=i}return e.prototype.toGlobal=function(t,r){if(t.getRenderWidth){var i=t;return this.toGlobal(i.getRenderWidth(),i.getRenderHeight())}var n=t;return new e(this.x*n,this.y*r,this.width*n,this.height*r)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e})();e.Viewport=h;var c=(function(){function e(){}return e.GetPlanes=function(t){for(var r=[],i=0;i<6;i++)r.push(new u(0,0,0,0));return e.GetPlanesToRef(t,r),r},e.GetNearPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[2],t.normal.y=e.m[7]+e.m[6],t.normal.z=e.m[11]+e.m[10],t.d=e.m[15]+e.m[14],t.normalize()},e.GetFarPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[2],t.normal.y=e.m[7]-e.m[6],t.normal.z=e.m[11]-e.m[10],t.d=e.m[15]-e.m[14],t.normalize()},e.GetLeftPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[0],t.normal.y=e.m[7]+e.m[4],t.normal.z=e.m[11]+e.m[8],t.d=e.m[15]+e.m[12],t.normalize()},e.GetRightPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[0],t.normal.y=e.m[7]-e.m[4],t.normal.z=e.m[11]-e.m[8],t.d=e.m[15]-e.m[12],t.normalize()},e.GetTopPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[1],t.normal.y=e.m[7]-e.m[5],t.normal.z=e.m[11]-e.m[9],t.d=e.m[15]-e.m[13],t.normalize()},e.GetBottomPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[1],t.normal.y=e.m[7]+e.m[5],t.normal.z=e.m[11]+e.m[9],t.d=e.m[15]+e.m[13],t.normalize()},e.GetPlanesToRef=function(t,r){e.GetNearPlaneToRef(t,r[0]),e.GetFarPlaneToRef(t,r[1]),e.GetLeftPlaneToRef(t,r[2]),e.GetRightPlaneToRef(t,r[3]),e.GetTopPlaneToRef(t,r[4]),e.GetBottomPlaneToRef(t,r[5])},e})();e.Frustum=c;!(function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD",e[e.BONE=2]="BONE"})(e.Space||(e.Space={}));var f=(function(){function e(){}return e.X=new n(1,0,0),e.Y=new n(0,1,0),e.Z=new n(0,0,1),e})();e.Axis=f;var d=(function(){function e(){}return e.interpolate=function(e,t,r,i,n){for(var o=1-3*i+3*t,s=3*i-6*t,a=3*t,l=e,u=0;u<5;u++){var h=l*l;l-=(o*(h*l)+s*h+a*l-e)*(1/(3*o*h+2*s*l+a)),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*r+3*(1-l)*Math.pow(l,2)*n+Math.pow(l,3)},e})();e.BezierCurve=d;var p;!(function(e){e[e.CW=0]="CW",e[e.CCW=1]="CCW"})(p=e.Orientation||(e.Orientation={}));var A=(function(){function e(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return e.prototype.degrees=function(){return 180*this._radians/Math.PI},e.prototype.radians=function(){return this._radians},e.BetweenTwoPoints=function(t,r){var i=r.subtract(t);return new e(Math.atan2(i.y,i.x))},e.FromRadians=function(t){return new e(t)},e.FromDegrees=function(t){return new e(t*Math.PI/180)},e})();e.Angle=A;var m=(function(){function e(e,t,r){this.startPoint=e,this.midPoint=t,this.endPoint=r;var n=Math.pow(t.x,2)+Math.pow(t.y,2),o=(Math.pow(e.x,2)+Math.pow(e.y,2)-n)/2,s=(n-Math.pow(r.x,2)-Math.pow(r.y,2))/2,a=(e.x-t.x)*(t.y-r.y)-(t.x-r.x)*(e.y-t.y);this.centerPoint=new i((o*(t.y-r.y)-s*(e.y-t.y))/a,((e.x-t.x)*s-(t.x-r.x)*o)/a),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=A.BetweenTwoPoints(this.centerPoint,this.startPoint);var l=this.startAngle.degrees(),u=A.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),h=A.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();u-l>180&&(u-=360),u-l<-180&&(u+=360),h-u>180&&(h-=360),h-u<-180&&(h+=360),this.orientation=u-l<0?p.CW:p.CCW,this.angle=A.FromDegrees(this.orientation===p.CW?l-h:h-l)}return e})();e.Arc2=m;var g=(function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new i(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var r=new i(e,t),n=this._points[this._points.length-1];return this._points.push(r),this._length+=r.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,r,n,o){if(void 0===o&&(o=36),this.closed)return this;var s=this._points[this._points.length-1],a=new i(e,t),l=new i(r,n),u=new m(s,a,l),h=u.angle.radians()/o;u.orientation===p.CW&&(h*=-1);for(var c=u.startAngle.radians()+h,f=0;f<o;f++){var d=Math.cos(c)*u.radius+u.centerPoint.x,A=Math.sin(c)*u.radius+u.centerPoint.y;this.addLineTo(d,A),c+=h}return this},e.prototype.close=function(){return this.closed=!0,this},e.prototype.length=function(){var e=this._length;if(!this.closed){var t=this._points[this._points.length-1];e+=this._points[0].subtract(t).length()}return e},e.prototype.getPoints=function(){return this._points},e.prototype.getPointAtLengthPosition=function(e){if(e<0||e>1)return i.Zero();for(var t=e*this.length(),r=0,n=0;n<this._points.length;n++){var o=(n+1)%this._points.length,s=this._points[n],a=this._points[o],l=a.subtract(s),u=l.length()+r;if(t>=r&&t<=u){var h=l.normalize(),c=t-r;return new i(s.x+h.x*c,s.y+h.y*c)}r=u}return i.Zero()},e.StartingAt=function(t,r){return new e(t,r)},e})();e.Path2=g;var _=(function(){function t(e,t,r){void 0===t&&(t=null),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array;for(var i=0;i<e.length;i++)this._curve[i]=e[i].clone();this._raw=r||!1,this._compute(t)}return t.prototype.getCurve=function(){return this._curve},t.prototype.getTangents=function(){return this._tangents},t.prototype.getNormals=function(){return this._normals},t.prototype.getBinormals=function(){return this._binormals},t.prototype.getDistances=function(){return this._distances},t.prototype.update=function(e,t){void 0===t&&(t=null);for(var r=0;r<e.length;r++)this._curve[r].x=e[r].x,this._curve[r].y=e[r].y,this._curve[r].z=e[r].z;return this._compute(t),this},t.prototype._compute=function(e){var t=this._curve.length;this._tangents[0]=this._getFirstNonNullVector(0),this._raw||this._tangents[0].normalize(),this._tangents[t-1]=this._curve[t-1].subtract(this._curve[t-2]),this._raw||this._tangents[t-1].normalize();var r=this._tangents[0],i=this._normalVector(this._curve[0],r,e);this._normals[0]=i,this._raw||this._normals[0].normalize(),this._binormals[0]=n.Cross(r,this._normals[0]),this._raw||this._binormals[0].normalize(),this._distances[0]=0;for(var o,s,a,l,u=1;u<t;u++)o=this._getLastNonNullVector(u),u<t-1&&(s=this._getFirstNonNullVector(u),this._tangents[u]=o.add(s),this._tangents[u].normalize()),this._distances[u]=this._distances[u-1]+o.length(),a=this._tangents[u],l=this._binormals[u-1],this._normals[u]=n.Cross(l,a),this._raw||this._normals[u].normalize(),this._binormals[u]=n.Cross(a,this._normals[u]),this._raw||this._binormals[u].normalize()},t.prototype._getFirstNonNullVector=function(e){for(var t=1,r=this._curve[e+t].subtract(this._curve[e]);0===r.length()&&e+t+1<this._curve.length;)t++,r=this._curve[e+t].subtract(this._curve[e]);return r},t.prototype._getLastNonNullVector=function(e){for(var t=1,r=this._curve[e].subtract(this._curve[e-t]);0===r.length()&&e>t+1;)t++,r=this._curve[e].subtract(this._curve[e-t]);return r},t.prototype._normalVector=function(t,r,i){var o,s=r.length();if(0===s&&(s=1),void 0===i||null===i){var a;a=e.Scalar.WithinEpsilon(Math.abs(r.y)/s,1,e.Epsilon)?e.Scalar.WithinEpsilon(Math.abs(r.x)/s,1,e.Epsilon)?e.Scalar.WithinEpsilon(Math.abs(r.z)/s,1,e.Epsilon)?n.Zero():new n(0,0,1):new n(1,0,0):new n(0,-1,0),o=n.Cross(r,a)}else o=n.Cross(r,i),n.CrossToRef(o,r,o);return o.normalize(),o},t})();e.Path3D=_;var v=(function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,r,i,o){o=o>2?o:3;for(var s=new Array,a=function(e,t,r,i){return(1-e)*(1-e)*t+2*e*(1-e)*r+e*e*i},l=0;l<=o;l++)s.push(new n(a(l/o,t.x,r.x,i.x),a(l/o,t.y,r.y,i.y),a(l/o,t.z,r.z,i.z)));return new e(s)},e.CreateCubicBezier=function(t,r,i,o,s){s=s>3?s:4;for(var a=new Array,l=function(e,t,r,i,n){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*r+3*e*e*(1-e)*i+e*e*e*n},u=0;u<=s;u++)a.push(new n(l(u/s,t.x,r.x,i.x,o.x),l(u/s,t.y,r.y,i.y,o.y),l(u/s,t.z,r.z,i.z,o.z)));return new e(a)},e.CreateHermiteSpline=function(t,r,i,o,s){for(var a=new Array,l=1/s,u=0;u<=s;u++)a.push(n.Hermite(t,r,i,o,u*l));return new e(a)},e.CreateCatmullRomSpline=function(t,r,i){var o=new Array,s=1/r,a=0;if(i){for(var l=t.length,u=0;u<l;u++){a=0;for(var h=0;h<r;h++)o.push(n.CatmullRom(t[u%l],t[(u+1)%l],t[(u+2)%l],t[(u+3)%l],a)),a+=s}o.push(o[0])}else{var c=new Array;c.push(t[0].clone()),Array.prototype.push.apply(c,t),c.push(t[t.length-1].clone());for(var u=0;u<c.length-3;u++){a=0;for(var h=0;h<r;h++)o.push(n.CatmullRom(c[u],c[u+1],c[u+2],c[u+3],a)),a+=s}u--,o.push(n.CatmullRom(c[u],c[u+1],c[u+2],c[u+3],a))}return new e(o)},e.prototype.getPoints=function(){return this._points},e.prototype.length=function(){return this._length},e.prototype.continue=function(t){for(var r=this._points[this._points.length-1],i=this._points.slice(),n=t.getPoints(),o=1;o<n.length;o++)i.push(n[o].subtract(n[0]).add(r));return new e(i)},e.prototype._computeLength=function(e){for(var t=0,r=1;r<e.length;r++)t+=e[r].subtract(e[r-1]).length();return t},e})();e.Curve3=v;var y=(function(){function e(e,t){void 0===e&&(e=n.Zero()),void 0===t&&(t=n.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e})();e.PositionNormalVertex=y;var b=(function(){function e(e,t,r){void 0===e&&(e=n.Zero()),void 0===t&&(t=n.Up()),void 0===r&&(r=i.Zero()),this.position=e,this.normal=t,this.uv=r}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e})();e.PositionNormalTextureVertex=b;var E=(function(){function e(){}return e.Color3=[t.Black(),t.Black(),t.Black()],e.Vector2=[i.Zero(),i.Zero(),i.Zero()],e.Vector3=[n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero()],e.Vector4=[o.Zero(),o.Zero(),o.Zero()],e.Quaternion=[a.Zero(),a.Zero()],e.Matrix=[l.Zero(),l.Zero(),l.Zero(),l.Zero(),l.Zero(),l.Zero(),l.Zero(),l.Zero()],e})();e.Tmp=E;var T=(function(){function e(){}return e.Vector3=[n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero(),n.Zero()],e.Matrix=[l.Zero(),l.Zero()],e.Quaternion=[a.Zero(),a.Zero(),a.Zero()],e})()})(n||(n={}));var n;!(function(e){var t=(function(){function e(){}return e.WithinEpsilon=function(e,t,r){void 0===r&&(r=1.401298e-45);var i=e-t;return-r<=i&&i<=r},e.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},e.Sign=function(e){return e=+e,0===e||isNaN(e)?e:e>0?1:-1},e.Clamp=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=1),Math.min(r,Math.max(t,e))},e.Log2=function(e){return Math.log(e)*Math.LOG2E},e.Repeat=function(e,t){return e-Math.floor(e/t)*t},e.Normalize=function(e,t,r){return(e-t)/(r-t)},e.Denormalize=function(e,t,r){return e*(r-t)+t},e.DeltaAngle=function(t,r){var i=e.Repeat(r-t,360);return i>180&&(i-=360),i},e.PingPong=function(t,r){var i=e.Repeat(t,2*r);return r-Math.abs(i-r)},e.SmoothStep=function(t,r,i){var n=e.Clamp(i);return n=-2*n*n*n+3*n*n,r*n+t*(1-n)},e.MoveTowards=function(t,r,i){return Math.abs(r-t)<=i?r:t+e.Sign(r-t)*i},e.MoveTowardsAngle=function(t,r,i){var n=e.DeltaAngle(t,r),o=0;return-i<n&&n<i?o=r:(r=t+n,o=e.MoveTowards(t,r,i)),o},e.Lerp=function(e,t,r){return e+(t-e)*r},e.LerpAngle=function(t,r,i){var n=e.Repeat(r-t,360);return n>180&&(n-=360),t+n*e.Clamp(i)},e.InverseLerp=function(t,r,i){return t!=r?e.Clamp((i-t)/(r-t)):0},e.Hermite=function(e,t,r,i,n){var o=n*n,s=n*o;return e*(2*s-3*o+1)+r*(-2*s+3*o)+t*(s-2*o+n)+i*(s-o)},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,r){return(e-t)/(r-t)},e.PercentToRange=function(e,t,r){return(r-t)*e+t},e.NormalizeRadians=function(t){return t-=e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.TwoPi=2*Math.PI,e})();e.Scalar=t})(n||(n={}));var n;!(function(e){function t(e){var t=e.getClassName();return _[t]||(_[t]={}),_[t]}function r(e){var t=e.getClassName();if(v[t])return v[t];v[t]={};for(var r=v[t],i=e,n=t;n;){var o=_[n];for(var s in o)r[s]=o[s];var a=void 0,l=!1;do{if(a=Object.getPrototypeOf(i),!a.getClassName){l=!0;break}if(a.getClassName()!==n)break;i=a}while(a);if(l)break;n=a.getClassName(),i=a}return r}function i(e,r){return function(i,n){var o=t(i);o[n]||(o[n]={type:e,sourceName:r})}}function n(e,t){return void 0===t&&(t=null),function(r,i){var n=t||"_"+i;Object.defineProperty(r,i,{get:function(){return this[n]},set:function(t){this[n]!==t&&(this[n]=t,r[e].apply(this))},enumerable:!0,configurable:!0})}}function o(e,t){return void 0===t&&(t=null),n(e,t)}function s(e){return i(0,e)}function a(e){return i(1,e)}function l(e){return i(2,e)}function u(e){return i(3,e)}function h(e){return i(4,e)}function c(e){return i(5,e)}function f(e){return i(6,e)}function d(e){return i(7,e)}function p(e){return i(8,e)}function A(e){return i(9,e)}function m(e){return i(10,e)}function g(e){return i(11,e)}var _={},v={},y=function(t,i,n){var o=t();e.Tags&&e.Tags.AddTagsTo(o,i.tags);var s=r(o);for(var a in s){var l=s[a],u=i[a],h=l.type;if(void 0!==u&&null!==u)switch(h){case 0:case 6:case 11:o[a]=u;break;case 1:o[a]=n||u.isRenderTarget?u:u.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:o[a]=n?u:u.clone()}}return o};e.expandToProperty=o,e.serialize=s,e.serializeAsTexture=a,e.serializeAsColor3=l,e.serializeAsFresnelParameters=u,e.serializeAsVector2=h,e.serializeAsVector3=c,e.serializeAsMeshReference=f,e.serializeAsColorCurves=d,e.serializeAsColor4=p,e.serializeAsImageProcessingConfiguration=A,e.serializeAsQuaternion=m,e.serializeAsCameraReference=g;var b=(function(){function t(){}return t.Serialize=function(t,i){i||(i={}),e.Tags&&(i.tags=e.Tags.GetTags(t));var n=r(t);for(var o in n){var s=n[o],a=s.sourceName||o,l=s.type,u=t[o];if(void 0!==u&&null!==u)switch(l){case 0:i[a]=u;break;case 1:i[a]=u.serialize();break;case 2:i[a]=u.asArray();break;case 3:i[a]=u.serialize();break;case 4:case 5:i[a]=u.asArray();break;case 6:i[a]=u.id;break;case 7:i[a]=u.serialize();break;case 8:i[a]=u.asArray();break;case 9:i[a]=u.serialize();break;case 10:i[a]=u.asArray();break;case 11:i[a]=u.id}}return i},t.Parse=function(t,i,n,o){void 0===o&&(o=null);var s=t();o||(o=""),e.Tags&&e.Tags.AddTagsTo(s,i.tags);var a=r(s);for(var l in a){var u=a[l],h=i[u.sourceName||l],c=u.type;if(void 0!==h&&null!==h){var f=s;switch(c){case 0:f[l]=h;break;case 1:n&&(f[l]=e.Texture.Parse(h,n,o));break;case 2:f[l]=e.Color3.FromArray(h);break;case 3:f[l]=e.FresnelParameters.Parse(h);break;case 4:f[l]=e.Vector2.FromArray(h);break;case 5:f[l]=e.Vector3.FromArray(h);break;case 6:n&&(f[l]=n.getLastMeshByID(h));break;case 7:f[l]=e.ColorCurves.Parse(h);break;case 8:f[l]=e.Color4.FromArray(h);break;case 9:f[l]=e.ImageProcessingConfiguration.Parse(h);break;case 10:f[l]=e.Quaternion.FromArray(h);break;case 11:n&&(f[l]=n.getCameraByID(h))}}}return s},t.Clone=function(e,t){return y(e,t,!1)},t.Instanciate=function(e,t){return y(e,t,!0)},t})();e.SerializationHelper=b})(n||(n={}));var n;!(function(e){var t=(function(){function e(){var e=this;this.promise=new Promise(function(t,r){e._resolve=t,e._reject=r})}return Object.defineProperty(e.prototype,"resolve",{get:function(){return this._resolve},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reject",{get:function(){return this._reject},enumerable:!0,configurable:!0}),e})();e.Deferred=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(e,t,r,i){void 0===t&&(t=!1),this.initalize(e,t,r,i)}return e.prototype.initalize=function(e,t,r,i){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=r,this.currentTarget=i,this},e})();e.EventState=t;var r=(function(){function e(e,t,r){void 0===r&&(r=null),this.callback=e,this.mask=t,this.scope=r,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}return e})();e.Observer=r;var i=(function(){function e(){}return e.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e<this._observers.length;e++)this._observables[e].remove(this._observers[e]);this._observers=null,this._observables=null},e.Watch=function(t,r,i,n){void 0===i&&(i=-1),void 0===n&&(n=null);var o=new e;o._observers=new Array,o._observables=t;for(var s=0,a=t;s<a.length;s++){var l=a[s],u=l.add(r,i,!1,n);u&&o._observers.push(u)}return o},e})();e.MultiObserver=i;var n=(function(){function i(e){this._observers=new Array,this._eventState=new t(0),e&&(this._onObserverAdded=e)}return i.prototype.add=function(e,t,i,n,o){if(void 0===t&&(t=-1),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===o&&(o=!1),!e)return null;var s=new r(e,t,n);return s.unregisterOnNextCall=o,i?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s},i.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},i.prototype.remove=function(e){if(!e)return!1;var t=this._observers.indexOf(e);return-1!==t&&(this._observers.splice(t,1),!0)},i.prototype.removeCallback=function(e,t){for(var r=0;r<this._observers.length;r++)if(this._observers[r].callback===e&&(!t||t===this._observers[r].scope))return this._observers.splice(r,1),!0;return!1},i.prototype._deferUnregister=function(t){var r=this;t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,e.Tools.SetImmediate((function(){r.remove(t)}))},i.prototype.notifyObservers=function(e,t,r,i){if(void 0===t&&(t=-1),!this._observers.length)return!0;var n=this._eventState;n.mask=t,n.target=r,n.currentTarget=i,n.skipNextObservers=!1,n.lastReturnValue=e;for(var o=0,s=this._observers;o<s.length;o++){var a=s[o];if(!a._willBeUnregistered&&(a.mask&t&&(a.scope?n.lastReturnValue=a.callback.apply(a.scope,[e,n]):n.lastReturnValue=a.callback(e,n),a.unregisterOnNextCall&&this._deferUnregister(a)),n.skipNextObservers))return!1}return!0},i.prototype.notifyObserversWithPromise=function(e,t,r,i){var n=this;void 0===t&&(t=-1);var o=Promise.resolve(e);if(!this._observers.length)return o;var s=this._eventState;return s.mask=t,s.target=r,s.currentTarget=i,s.skipNextObservers=!1,this._observers.forEach((function(r){s.skipNextObservers||r._willBeUnregistered||r.mask&t&&(o=r.scope?o.then((function(t){return s.lastReturnValue=t,r.callback.apply(r.scope,[e,s])})):o.then((function(t){return s.lastReturnValue=t,r.callback(e,s)})),r.unregisterOnNextCall&&n._deferUnregister(r))})),o.then((function(){return e}))},i.prototype.notifyObserver=function(e,t,r){void 0===r&&(r=-1);var i=this._eventState;i.mask=r,i.skipNextObservers=!1,e.callback(t,i)},i.prototype.hasObservers=function(){return this._observers.length>0},i.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},i.prototype.clone=function(){var e=new i;return e._observers=this._observers.slice(0),e},i.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,r=this._observers;t<r.length;t++){var i=r[t];if(i.mask&e||i.mask===e)return!0}return!1},i})();e.Observable=n})(n||(n={}));var n;!(function(e){var t=(function(){function e(t){this.length=0,this.data=new Array(t),this._id=e._GlobalId++}return e.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},e.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e(this.data[t])},e.prototype.sort=function(e){this.data.sort(e)},e.prototype.reset=function(){this.length=0},e.prototype.dispose=function(){this.reset(),this.data&&(this.data.length=0,this.data=[])},e.prototype.concat=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++)this.data[this.length++]=(e.data||e)[t]}},e.prototype.indexOf=function(e){var t=this.data.indexOf(e);return t>=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.data.indexOf(e)},e._GlobalId=0,e})();e.SmartArray=t;var r=(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return s(t,e),t.prototype.push=function(t){e.prototype.push.call(this,t),t.__smartArrayFlags||(t.__smartArrayFlags={}),t.__smartArrayFlags[this._id]=this._duplicateId},t.prototype.pushNoDuplicate=function(e){return(!e.__smartArrayFlags||e.__smartArrayFlags[this._id]!==this._duplicateId)&&(this.push(e),!0)},t.prototype.reset=function(){e.prototype.reset.call(this),this._duplicateId++},t.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++){var r=(e.data||e)[t];this.pushNoDuplicate(r)}}},t})(t);e.SmartArrayNoDuplicate=r})(n||(n={}));var n;!(function(e){function t(e,t){return function(r){r.__bjsclassName__=e,r.__bjsmoduleName__=null!=t?t:null}}var r=(function(e){function t(r,i){var n=e.call(this,r)||this;return n.request=i,n.name="LoadFileError",t._setPrototypeOf(n,t.prototype),n}return s(t,e),t._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t})(Error);e.LoadFileError=r;var i=(function(){function e(){}return e.ExponentialBackoff=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=500),function(r,i,n){return 0!==i.status||n>=e||-1!==r.indexOf("file:")?-1:Math.pow(2,n)*t}},e})();e.RetryStrategy=i;var n,o=function(t,r){return t?t instanceof e.Mesh?null:t instanceof e.SubMesh?t.clone(r):t.clone?t.clone():null:null},a=(function(){function t(){}return t.Mix=function(e,t,r){return e*(1-r)+t*r},t.Instantiate=function(e){if(t.RegisteredExternalClasses&&t.RegisteredExternalClasses[e])return t.RegisteredExternalClasses[e];for(var r=e.split("."),i=window||this,n=0,o=r.length;n<o;n++)i=i[r[n]];return"function"!=typeof i?null:i},t.Slice=function(e,t,r){return e.slice?e.slice(t,r):Array.prototype.slice.call(e,t,r)},t.SetImmediate=function(e){window.setImmediate?window.setImmediate(e):setTimeout(e,1)},t.IsExponentOfTwo=function(e){var t=1;do{t*=2}while(t<e);return t===e},t.FloatRound=function(e){return Math.fround?Math.fround(e):t._tmpFloatArray[0]=e},t.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},t.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},t.NearestPOT=function(e){var r=t.CeilingPOT(e),i=t.FloorPOT(e);return r-e>e-i?i:r},t.GetExponentOfTwo=function(r,i,n){void 0===n&&(n=e.Engine.SCALEMODE_NEAREST);var o;switch(n){case e.Engine.SCALEMODE_FLOOR:o=t.FloorPOT(r);break;case e.Engine.SCALEMODE_NEAREST:o=t.NearestPOT(r);break;case e.Engine.SCALEMODE_CEILING:default:o=t.CeilingPOT(r)}return Math.min(o,i)},t.GetFilename=function(e){var t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)},t.GetFolderPath=function(e,t){void 0===t&&(t=!1);var r=e.lastIndexOf("/");return r<0?t?e:"":e.substring(0,r+1)},t.GetDOMTextContent=function(e){for(var t="",r=e.firstChild;r;)3===r.nodeType&&(t+=r.textContent),r=r.nextSibling;return t},t.ToDegrees=function(e){return 180*e/Math.PI},t.ToRadians=function(e){return e*Math.PI/180},t.EncodeArrayBufferTobase64=function(e){for(var t,r,i,n,o,s,a,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u="",h=0,c=new Uint8Array(e);h<c.length;)t=c[h++],r=h<c.length?c[h++]:Number.NaN,i=h<c.length?c[h++]:Number.NaN,n=t>>2,o=(3&t)<<4|r>>4,s=(15&r)<<2|i>>6,a=63&i,isNaN(r)?s=a=64:isNaN(i)&&(a=64),u+=l.charAt(n)+l.charAt(o)+l.charAt(s)+l.charAt(a);return"data:image/png;base64,"+u},t.ExtractMinAndMaxIndexed=function(t,r,i,n,o){void 0===o&&(o=null);for(var s=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new e.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),l=i;l<i+n;l++){var u=new e.Vector3(t[3*r[l]],t[3*r[l]+1],t[3*r[l]+2]);s=e.Vector3.Minimize(u,s),a=e.Vector3.Maximize(u,a)}return o&&(s.x-=s.x*o.x+o.y,s.y-=s.y*o.x+o.y,s.z-=s.z*o.x+o.y,a.x+=a.x*o.x+o.y,a.y+=a.y*o.x+o.y,a.z+=a.z*o.x+o.y),{minimum:s,maximum:a}},t.ExtractMinAndMax=function(t,r,i,n,o){void 0===n&&(n=null);var s=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new e.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);o||(o=3);for(var l=r;l<r+i;l++){var u=new e.Vector3(t[l*o],t[l*o+1],t[l*o+2]);s=e.Vector3.Minimize(u,s),a=e.Vector3.Maximize(u,a)}return n&&(s.x-=s.x*n.x+n.y,s.y-=s.y*n.x+n.y,s.z-=s.z*n.x+n.y,a.x+=a.x*n.x+n.y,a.y+=a.y*n.x+n.y,a.z+=a.z*n.x+n.y),{minimum:s,maximum:a}},t.Vector2ArrayFeeder=function(t){return function(r){var i=void 0!==t.BYTES_PER_ELEMENT;if(r>=(i?t.length/2:t.length))return null;if(i){var n=t;return new e.Vector2(n[2*r+0],n[2*r+1])}return t[r]}},t.ExtractMinAndMaxVector2=function(t,r){void 0===r&&(r=null);for(var i=new e.Vector2(Number.MAX_VALUE,Number.MAX_VALUE),n=new e.Vector2(-Number.MAX_VALUE,-Number.MAX_VALUE),o=0,s=t(o++);s;)i=e.Vector2.Minimize(s,i),n=e.Vector2.Maximize(s,n),s=t(o++);return r&&(i.x-=i.x*r.x+r.y,i.y-=i.y*r.x+r.y,n.x+=n.x*r.x+r.y,n.y+=n.y*r.x+r.y),{minimum:i,maximum:n}},t.MakeArray=function(e,t){
- return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},t.GetPointerPrefix=function(){var e="pointer";return!t.IsWindowObjectExist()||window.PointerEvent||navigator.pointerEnabled||(e="mouse"),e},t.QueueNewFrame=function(e,r){return t.IsWindowObjectExist()?(r||(r=window),r.requestAnimationFrame?r.requestAnimationFrame(e):r.msRequestAnimationFrame?r.msRequestAnimationFrame(e):r.webkitRequestAnimationFrame?r.webkitRequestAnimationFrame(e):r.mozRequestAnimationFrame?r.mozRequestAnimationFrame(e):r.oRequestAnimationFrame?r.oRequestAnimationFrame(e):window.setTimeout(e,16)):setTimeout(e,16)},t.RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},t.ExitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msCancelFullScreen&&document.msCancelFullScreen()},t.SetCorsBehavior=function(e,r){if((!e||0!==e.indexOf("data:"))&&t.CorsBehavior)if("string"==typeof t.CorsBehavior||t.CorsBehavior instanceof String)r.crossOrigin=t.CorsBehavior;else{var i=t.CorsBehavior(e);i&&(r.crossOrigin=i)}},t.CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},t.LoadImage=function(r,i,n,o){var s,a=!1;r instanceof ArrayBuffer?(s=URL.createObjectURL(new Blob([r])),a=!0):r instanceof Blob?(s=URL.createObjectURL(r),a=!0):(s=t.CleanUrl(r),s=t.PreprocessUrl(r));var l=new Image;t.SetCorsBehavior(s,l);var u=function(){a&&l.src&&URL.revokeObjectURL(l.src),l.removeEventListener("load",u),l.removeEventListener("error",h),i(l)},h=function(e){a&&l.src&&URL.revokeObjectURL(l.src),l.removeEventListener("load",u),l.removeEventListener("error",h),t.Error("Error while trying to load image: "+r),n&&n("Error while trying to load image: "+r,e)};l.addEventListener("load",u),l.addEventListener("error",h);var c=function(){l.src=s},f=function(){o&&o.loadImageFromDB(s,l)};if("data:"!==s.substr(0,5)&&o&&o.enableTexturesOffline&&e.Database.IsUASupportingBlobStorage)o.openAsync(f,c);else{if(-1!==s.indexOf("file:")){var d=decodeURIComponent(s.substring(5).toLowerCase());if(e.FilesInput.FilesToLoad[d]){try{var p;try{p=URL.createObjectURL(e.FilesInput.FilesToLoad[d],{oneTimeOnly:!0})}catch(t){p=URL.createObjectURL(e.FilesInput.FilesToLoad[d])}l.src=p,a=!0}catch(e){l.src=""}return l}}c()}return l},t.LoadFile=function(i,n,o,s,a,l){if(i=t.CleanUrl(i),i=t.PreprocessUrl(i),-1!==i.indexOf("file:")){var u=decodeURIComponent(i.substring(5).toLowerCase());if(e.FilesInput.FilesToLoad[u])return t.ReadFile(e.FilesInput.FilesToLoad[u],n,o,a)}var h=t.BaseUrl+i,c=!1,f={onCompleteObservable:new e.Observable,abort:function(){return c=!0}},d=function(){var e=new XMLHttpRequest,i=null;f.abort=function(){c=!0,e.readyState!==(XMLHttpRequest.DONE||4)&&e.abort(),null!==i&&(clearTimeout(i),i=null)};var s=function(u){e.open("GET",h,!0),a&&(e.responseType="arraybuffer"),o&&e.addEventListener("progress",o);var d=function(){e.removeEventListener("loadend",d),f.onCompleteObservable.notifyObservers(f),f.onCompleteObservable.clear()};e.addEventListener("loadend",d);var p=function(){if(!c&&e.readyState===(XMLHttpRequest.DONE||4)){if(e.removeEventListener("readystatechange",p),e.status>=200&&e.status<300||!t.IsWindowObjectExist()&&0===e.status)return void n(a?e.response:e.responseText,e.responseURL);var o=t.DefaultRetryStrategy;if(o){var f=o(h,e,u);if(-1!==f)return e.removeEventListener("loadend",d),e=new XMLHttpRequest,void(i=setTimeout((function(){return s(u+1)}),f))}var A=new r("Error status: "+e.status+" "+e.statusText+" - Unable to load "+h,e);if(!l)throw A;l(e,A)}};e.addEventListener("readystatechange",p),e.send()};s(0)};if(s&&s.enableSceneOffline){var p=function(){c||d()},A=function(){c||s&&s.loadFileFromDB(i,(function(e){c||n(e),f.onCompleteObservable.notifyObservers(f)}),o?function(e){c||o(e)}:void 0,p,a)};s.openAsync(A,p)}else d();return f},t.LoadScript=function(e,t,r){var i=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.src=e,n.onload=function(){t&&t()},n.onerror=function(t){r&&r("Unable to load script '"+e+"'",t)},i.appendChild(n)},t.ReadFileAsDataURL=function(t,r,i){var n=new FileReader,o={onCompleteObservable:new e.Observable,abort:function(){return n.abort()}};return n.onloadend=function(e){o.onCompleteObservable.notifyObservers(o)},n.onload=function(e){r(e.target.result)},n.onprogress=i,n.readAsDataURL(t),o},t.ReadFile=function(r,i,n,o){var s=new FileReader,a={onCompleteObservable:new e.Observable,abort:function(){return s.abort()}};return s.onloadend=function(e){return a.onCompleteObservable.notifyObservers(a)},s.onerror=function(e){t.Log("Error while reading file: "+r.name),i(JSON.stringify({autoClear:!0,clearColor:[1,0,0],ambientColor:[0,0,0],gravity:[0,-9.807,0],meshes:[],cameras:[],lights:[]}))},s.onload=function(e){i(e.target.result)},n&&(s.onprogress=n),o?s.readAsArrayBuffer(r):s.readAsText(r),a},t.FileAsURL=function(e){var t=new Blob([e]);return(window.URL||window.webkitURL).createObjectURL(t)},t.Format=function(e,t){return void 0===t&&(t=2),e.toFixed(t)},t.CheckExtends=function(e,t,r){e.x<t.x&&(t.x=e.x),e.y<t.y&&(t.y=e.y),e.z<t.z&&(t.z=e.z),e.x>r.x&&(r.x=e.x),e.y>r.y&&(r.y=e.y),e.z>r.z&&(r.z=e.z)},t.DeepCopy=function(e,t,r,i){for(var n in e)if(("_"!==n[0]||i&&-1!==i.indexOf(n))&&(!r||-1===r.indexOf(n))){var s=e[n],a=typeof s;if("function"!==a)try{if("object"===a)if(s instanceof Array){if(t[n]=[],s.length>0)if("object"==typeof s[0])for(var l=0;l<s.length;l++){var u=o(s[l],t);-1===t[n].indexOf(u)&&t[n].push(u)}else t[n]=s.slice(0)}else t[n]=o(s,t);else t[n]=s}catch(e){}}},t.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},t.RegisterTopRootEvents=function(e){for(var t=0;t<e.length;t++){var r=e[t];window.addEventListener(r.name,r.handler,!1);try{window.parent&&window.parent.addEventListener(r.name,r.handler,!1)}catch(e){}}},t.UnregisterTopRootEvents=function(e){for(var t=0;t<e.length;t++){var r=e[t];window.removeEventListener(r.name,r.handler);try{window.parent&&window.parent.removeEventListener(r.name,r.handler)}catch(e){}}},t.DumpFramebuffer=function(e,r,i,o,s,a){void 0===s&&(s="image/png");for(var l=4*e,u=r/2,h=i.readPixels(0,0,e,r),c=0;c<u;c++)for(var f=0;f<l;f++){var d=f+c*l,p=r-c-1,A=f+p*l,m=h[d];h[d]=h[A],h[A]=m}n||(n=document.createElement("canvas")),n.width=e,n.height=r;var g=n.getContext("2d");if(g){var _=g.createImageData(e,r);_.data.set(h),g.putImageData(_,0,0),t.EncodeScreenshotCanvasData(o,s,a)}},t.EncodeScreenshotCanvasData=function(e,r,i){void 0===r&&(r="image/png");var o=n.toDataURL(r);e?e(o):(n.toBlob||(n.toBlob=function(e,t,r){var i=this;setTimeout((function(){for(var n=atob(i.toDataURL(t,r).split(",")[1]),o=n.length,s=new Uint8Array(o),a=0;a<o;a++)s[a]=n.charCodeAt(a);e(new Blob([s],{type:t||"image/png"}))}))}),n.toBlob((function(e){if("download"in document.createElement("a")){if(!i){var r=new Date,n=(r.getFullYear()+"-"+(r.getMonth()+1)).slice(2)+"-"+r.getDate()+"_"+r.getHours()+"-"+("0"+r.getMinutes()).slice(-2);i="screenshot_"+n+".png"}t.Download(e,i)}else{var o=URL.createObjectURL(e),s=window.open("");if(!s)return;var a=s.document.createElement("img");a.onload=function(){URL.revokeObjectURL(o)},a.src=o,s.document.body.appendChild(a)}})))},t.Download=function(e,t){var r=window.URL.createObjectURL(e),i=document.createElement("a");document.body.appendChild(i),i.style.display="none",i.href=r,i.download=t,i.addEventListener("click",(function(){i.parentElement&&i.parentElement.removeChild(i)})),i.click(),window.URL.revokeObjectURL(r)},t.CreateScreenshot=function(e,r,i,o,s){void 0===s&&(s="image/png");var a,l;if(i.precision)a=Math.round(e.getRenderWidth()*i.precision),l=Math.round(a/e.getAspectRatio(r));else if(i.width&&i.height)a=i.width,l=i.height;else if(i.width&&!i.height)a=i.width,l=Math.round(a/e.getAspectRatio(r));else if(i.height&&!i.width)l=i.height,a=Math.round(l*e.getAspectRatio(r));else{if(isNaN(i))return void t.Error("Invalid 'size' parameter !");l=i,a=i}n||(n=document.createElement("canvas")),n.width=a,n.height=l;var u=n.getContext("2d"),h=e.getRenderWidth()/e.getRenderHeight(),c=a,f=c/h;f>l&&(f=l,c=f*h);var d=Math.max(0,a-c)/2,p=Math.max(0,l-f)/2,A=e.getRenderingCanvas();u&&A&&u.drawImage(A,d,p,c,f),t.EncodeScreenshotCanvasData(o,s)},t.CreateScreenshotUsingRenderTarget=function(r,i,n,o,s,a,l,u){void 0===s&&(s="image/png"),void 0===a&&(a=1),void 0===l&&(l=!1);var h,c;if(n.precision)h=Math.round(r.getRenderWidth()*n.precision),c=Math.round(h/r.getAspectRatio(i)),n={width:h,height:c};else if(n.width&&n.height)h=n.width,c=n.height;else if(n.width&&!n.height)h=n.width,c=Math.round(h/r.getAspectRatio(i)),n={width:h,height:c};else if(n.height&&!n.width)c=n.height,h=Math.round(c*r.getAspectRatio(i)),n={width:h,height:c};else{if(isNaN(n))return void t.Error("Invalid 'size' parameter !");c=n,h=n}var f=i.getScene(),d=null;f.activeCamera!==i&&(d=f.activeCamera,f.activeCamera=i);var p=new e.RenderTargetTexture("screenShot",n,f,!1,!1,e.Engine.TEXTURETYPE_UNSIGNED_INT,!1,e.Texture.NEAREST_SAMPLINGMODE);p.renderList=null,p.samples=a,l&&p.addPostProcess(new e.FxaaPostProcess("antialiasing",1,f.activeCamera)),p.onAfterRenderObservable.add((function(){t.DumpFramebuffer(h,c,r,o,s,u)})),f.incrementRenderId(),f.resetCachedMaterial(),p.render(!0),p.dispose(),d&&(f.activeCamera=d),i.getProjectionMatrix(!0)},t.ValidateXHRData=function(t,r){void 0===r&&(r=7);try{if(1&r){if(t.responseText&&t.responseText.length>0)return!0;if(1===r)return!1}if(2&r){var i=e.TGATools.GetTGAHeader(t.response);if(i.width&&i.height&&i.width>0&&i.height>0)return!0;if(2===r)return!1}if(4&r){var n=new Uint8Array(t.response,0,3);return 68===n[0]&&68===n[1]&&83===n[2]}}catch(e){}return!1},t.RandomId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.IsBase64=function(e){return!(e.length<5)&&"data:"===e.substr(0,5)},t.DecodeBase64=function(e){for(var t=atob(e.split(",")[1]),r=t.length,i=new Uint8Array(new ArrayBuffer(r)),n=0;n<r;n++)i[n]=t.charCodeAt(n);return i.buffer},Object.defineProperty(t,"NoneLogLevel",{get:function(){return t._NoneLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MessageLogLevel",{get:function(){return t._MessageLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WarningLogLevel",{get:function(){return t._WarningLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ErrorLogLevel",{get:function(){return t._ErrorLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"AllLogLevel",{get:function(){return t._MessageLogLevel|t._WarningLogLevel|t._ErrorLogLevel},enumerable:!0,configurable:!0}),t._AddLogEntry=function(e){t._LogCache=e+t._LogCache,t.OnNewCacheEntry&&t.OnNewCacheEntry(e)},t._FormatMessage=function(e){var t=function(e){return e<10?"0"+e:""+e},r=new Date;return"["+t(r.getHours())+":"+t(r.getMinutes())+":"+t(r.getSeconds())+"]: "+e},t._LogDisabled=function(e){},t._LogEnabled=function(e){var r=t._FormatMessage(e);console.log("BJS - "+r);var i="<div style='color:white'>"+r+"</div><br>";t._AddLogEntry(i)},t._WarnDisabled=function(e){},t._WarnEnabled=function(e){var r=t._FormatMessage(e);console.warn("BJS - "+r);var i="<div style='color:orange'>"+r+"</div><br>";t._AddLogEntry(i)},t._ErrorDisabled=function(e){},t._ErrorEnabled=function(e){t.errorsCount++;var r=t._FormatMessage(e);console.error("BJS - "+r);var i="<div style='color:red'>"+r+"</div><br>";t._AddLogEntry(i)},Object.defineProperty(t,"LogCache",{get:function(){return t._LogCache},enumerable:!0,configurable:!0}),t.ClearLogCache=function(){t._LogCache="",t.errorsCount=0},Object.defineProperty(t,"LogLevels",{set:function(e){(e&t.MessageLogLevel)===t.MessageLogLevel?t.Log=t._LogEnabled:t.Log=t._LogDisabled,(e&t.WarningLogLevel)===t.WarningLogLevel?t.Warn=t._WarnEnabled:t.Warn=t._WarnDisabled,(e&t.ErrorLogLevel)===t.ErrorLogLevel?t.Error=t._ErrorEnabled:t.Error=t._ErrorDisabled},enumerable:!0,configurable:!0}),t.IsWindowObjectExist=function(){return"undefined"!=typeof window},Object.defineProperty(t,"PerformanceNoneLogLevel",{get:function(){return t._PerformanceNoneLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"PerformanceUserMarkLogLevel",{get:function(){return t._PerformanceUserMarkLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"PerformanceConsoleLogLevel",{get:function(){return t._PerformanceConsoleLogLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t,"PerformanceLogLevel",{set:function(e){return(e&t.PerformanceUserMarkLogLevel)===t.PerformanceUserMarkLogLevel?(t.StartPerformanceCounter=t._StartUserMark,void(t.EndPerformanceCounter=t._EndUserMark)):(e&t.PerformanceConsoleLogLevel)===t.PerformanceConsoleLogLevel?(t.StartPerformanceCounter=t._StartPerformanceConsole,void(t.EndPerformanceCounter=t._EndPerformanceConsole)):(t.StartPerformanceCounter=t._StartPerformanceCounterDisabled,void(t.EndPerformanceCounter=t._EndPerformanceCounterDisabled))},enumerable:!0,configurable:!0}),t._StartPerformanceCounterDisabled=function(e,t){},t._EndPerformanceCounterDisabled=function(e,t){},t._StartUserMark=function(e,r){if(void 0===r&&(r=!0),!t._performance){if(!t.IsWindowObjectExist())return;t._performance=window.performance}r&&t._performance.mark&&t._performance.mark(e+"-Begin")},t._EndUserMark=function(e,r){void 0===r&&(r=!0),r&&t._performance.mark&&(t._performance.mark(e+"-End"),t._performance.measure(e,e+"-Begin",e+"-End"))},t._StartPerformanceConsole=function(e,r){void 0===r&&(r=!0),r&&(t._StartUserMark(e,r),console.time&&console.time(e))},t._EndPerformanceConsole=function(e,r){void 0===r&&(r=!0),r&&(t._EndUserMark(e,r),console.time&&console.timeEnd(e))},Object.defineProperty(t,"Now",{get:function(){return t.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!0,configurable:!0}),t.GetClassName=function(e,t){void 0===t&&(t=!1);var r=null;if(!t&&e.getClassName)r=e.getClassName();else{if(e instanceof Object){r=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__}r||(r=typeof e)}return r},t.First=function(e,t){for(var r=0,i=e;r<i.length;r++){var n=i[r];if(t(n))return n}return null},t.getFullClassName=function(e,t){void 0===t&&(t=!1);var r=null,i=null;if(!t&&e.getClassName)r=e.getClassName();else{if(e instanceof Object){var n=t?e:Object.getPrototypeOf(e);r=n.constructor.__bjsclassName__,i=n.constructor.__bjsmoduleName__}r||(r=typeof e)}return r?(null!=i?i+".":"")+r:null},t.arrayOrStringFeeder=function(e){return function(r){if(r>=e.length)return null;var i=e.charCodeAt?e.charCodeAt(r):e[r];return i&&i.getHashCode&&(i=i.getHashCode()),"string"==typeof i?t.hashCodeFromStream(t.arrayOrStringFeeder(i)):i}},t.hashCodeFromStream=function(e){for(var t=0,r=0,i=e(r++);null!=i;)t=(t<<5)-t+i,t|=0,i=e(r++);return t},t.DelayAsync=function(e){return new Promise(function(t){setTimeout((function(){t()}),e)})},t.BaseUrl="",t.DefaultRetryStrategy=i.ExponentialBackoff(),t.CorsBehavior="anonymous",t.UseFallbackTexture=!0,t.RegisteredExternalClasses={},t.fallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z",t._tmpFloatArray=new Float32Array(1),t.PreprocessUrl=function(e){return e},t._NoneLogLevel=0,t._MessageLogLevel=1,t._WarningLogLevel=2,t._ErrorLogLevel=4,t._LogCache="",t.errorsCount=0,t.Log=t._LogEnabled,t.Warn=t._WarnEnabled,t.Error=t._ErrorEnabled,t._PerformanceNoneLogLevel=0,t._PerformanceUserMarkLogLevel=1,t._PerformanceConsoleLogLevel=2,t.StartPerformanceCounter=t._StartPerformanceCounterDisabled,t.EndPerformanceCounter=t._EndPerformanceCounterDisabled,t})();e.Tools=a;var l=(function(){function e(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"average",{get:function(){return this._average},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this._current},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!0,configurable:!0}),e.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},e.prototype.addCount=function(t,r){e.Enabled&&(this._current+=t,r&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=a.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var r=a.Now;this._current=r-this._startMonitoringTime,t&&this._fetchResult()}},e.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=a.Now;e-this._lastSecTime>1e3&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},e.Enabled=!0,e})();e.PerfCounter=l,e.className=t;var u=(function(){function e(e,t,r,i){void 0===i&&(i=0),this.iterations=e,this._fn=t,this._successCallback=r,this.index=i-1,this._done=!1}return e.prototype.executeNext=function(){this._done||(this.index+1<this.iterations?(++this.index,this._fn(this)):this.breakLoop())},e.prototype.breakLoop=function(){this._done=!0,this._successCallback()},e.Run=function(t,r,i,n){void 0===n&&(n=0);var o=new e(t,r,i,n);return o.executeNext(),o},e.SyncAsyncForLoop=function(t,r,i,n,o,s){void 0===s&&(s=0),e.Run(Math.ceil(t/r),(function(e){o&&o()?e.breakLoop():setTimeout((function(){for(var n=0;n<r;++n){var s=e.index*r+n;if(s>=t)break;if(i(s),o&&o()){e.breakLoop();break}}e.executeNext()}),s)}),n)},e})();e.AsyncLoop=u})(n||(n={}));var n;!(function(e){var t;!(function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"})(t||(t={}));var r=(function(){function e(){this.count=0,this.target=0,this.results=[]}return e})(),i=(function(){function i(e){var r=this;if(this._state=t.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e((function(e){r._resolve(e)}),(function(e){r._reject(e)}))}catch(e){this._reject(e)}}return Object.defineProperty(i.prototype,"_result",{get:function(){return this._resultValue},set:function(e){this._resultValue=e,this._parent&&void 0===this._parent._result&&(this._parent._result=e)},enumerable:!0,configurable:!0}),i.prototype.catch=function(e){return this.then(void 0,e)},i.prototype.then=function(r,n){var o=this,s=new i;return s._onFulfilled=r,s._onRejected=n,this._children.push(s),s._parent=this,this._state!==t.Pending&&e.Tools.SetImmediate((function(){if(o._state===t.Fulfilled||o._rejectWasConsumed){var e=s._resolve(o._result);if(void 0!==e&&null!==e)if(void 0!==e._state){var r=e;s._children.push(r),r._parent=s,s=r}else s._result=e}else s._reject(o._reason)})),s},i.prototype._moveChildren=function(e){var r=this;if((l=this._children).push.apply(l,e.splice(0,e.length)),this._children.forEach((function(e){e._parent=r})),this._state===t.Fulfilled)for(var i=0,n=this._children;i<n.length;i++){var o=n[i];o._resolve(this._result)}else if(this._state===t.Rejected)for(var s=0,a=this._children;s<a.length;s++){var o=a[s];o._reject(this._reason)}var l},i.prototype._resolve=function(e){try{this._state=t.Fulfilled;var r=null;if(this._onFulfilled&&(r=this._onFulfilled(e)),void 0!==r&&null!==r)if(void 0!==r._state){var i=r;i._parent=this,i._moveChildren(this._children),e=i._result}else e=r;this._result=e;for(var n=0,o=this._children;n<o.length;n++){o[n]._resolve(e)}this._children.length=0,delete this._onFulfilled,delete this._onRejected}catch(e){this._reject(e,!0)}},i.prototype._reject=function(e,r){if(void 0===r&&(r=!1),this._state=t.Rejected,this._reason=e,this._onRejected&&!r)try{this._onRejected(e),this._rejectWasConsumed=!0}catch(t){e=t}for(var i=0,n=this._children;i<n.length;i++){var o=n[i];this._rejectWasConsumed?o._resolve(null):o._reject(e)}this._children.length=0,delete this._onFulfilled,delete this._onRejected},i.resolve=function(e){var t=new i;return t._resolve(e),t},i._RegisterForFulfillment=function(e,r,i){e.then((function(e){return r.results[i]=e,r.count++,r.count===r.target&&r.rootPromise._resolve(r.results),null}),(function(e){r.rootPromise._state!==t.Rejected&&r.rootPromise._reject(e)}))},i.all=function(e){var t=new i,n=new r;if(n.target=e.length,n.rootPromise=t,e.length)for(var o=0;o<e.length;o++)i._RegisterForFulfillment(e[o],n,o);else t._resolve([]);return t},i.race=function(e){var t=new i;if(e.length)for(var r=0,n=e;r<n.length;r++){var o=n[r];o.then((function(e){return t&&(t._resolve(e),t=null),null}),(function(e){t&&(t._reject(e),t=null)}))}return t},i})(),n=(function(){function e(){}return e.Apply=function(e){if(void 0===e&&(e=!1),e||"undefined"==typeof Promise){window.Promise=i}},e})();e.PromisePolyfill=n})(n||(n={}));var n;!(function(e){var t=(function(){function e(e){this._pendingActions=new Array,this._workerInfos=e.map((function(e){return{worker:e,active:!1}}))}return e.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e<t.length;e++){t[e].worker.terminate()}delete this._workerInfos,delete this._pendingActions},e.prototype.push=function(e){for(var t=0,r=this._workerInfos;t<r.length;t++){var i=r[t];if(!i.active)return void this._execute(i,e)}this._pendingActions.push(e)},e.prototype._execute=function(e,t){var r=this;e.active=!0,t(e.worker,(function(){e.active=!1;var t=r._pendingActions.shift();t&&r._execute(e,t)}))},e})();e.WorkerPool=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!0,configurable:!0}),e.prototype.setAlphaBlendConstants=function(e,t,r,i){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===r&&this._blendConstants[3]===i||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=r,this._blendConstants[3]=i,this._isBlendConstantsDirty=!0)},e.prototype.setAlphaBlendFunctionParameters=function(e,t,r,i){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===r&&this._blendFunctionParameters[3]===i||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=r,this._blendFunctionParameters[3]=i,this._isBlendFunctionParametersDirty=!0)},e.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},e.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._isBlendEquationParametersDirty[0],this._isBlendEquationParametersDirty[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},e})();e._AlphaState=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,0)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},e})();e._DepthCullingState=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){this._isStencilTestDirty=!1,
- this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.reset()}return Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilFunc",{get:function(){return this._stencilFunc},set:function(e){this._stencilFunc!==e&&(this._stencilFunc=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilFuncRef",{get:function(){return this._stencilFuncRef},set:function(e){this._stencilFuncRef!==e&&(this._stencilFuncRef=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilFuncMask",{get:function(){return this._stencilFuncMask},set:function(e){this._stencilFuncMask!==e&&(this._stencilFuncMask=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpStencilFail",{get:function(){return this._stencilOpStencilFail},set:function(e){this._stencilOpStencilFail!==e&&(this._stencilOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpDepthFail",{get:function(){return this._stencilOpDepthFail},set:function(e){this._stencilOpDepthFail!==e&&(this._stencilOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpStencilDepthPass",{get:function(){return this._stencilOpStencilDepthPass},set:function(e){this._stencilOpStencilDepthPass!==e&&(this._stencilOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilMask",{get:function(){return this._stencilMask},set:function(e){this._stencilMask!==e&&(this._stencilMask=e,this._isStencilMaskDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stencilTest",{get:function(){return this._stencilTest},set:function(e){this._stencilTest!==e&&(this._stencilTest=e,this._isStencilTestDirty=!0)},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=e.Engine.ALWAYS,this._stencilFuncRef=1,this._stencilFuncMask=255,this._stencilOpStencilFail=e.Engine.KEEP,this._stencilOpDepthFail=e.Engine.KEEP,this._stencilOpStencilDepthPass=e.Engine.REPLACE,this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},t.prototype.apply=function(e){this.isDirty&&(this._isStencilTestDirty&&(this.stencilTest?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.stencilMask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.stencilFunc,this.stencilFuncRef,this.stencilFuncMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.stencilOpStencilFail,this.stencilOpDepthFail,this.stencilOpStencilDepthPass),this._isStencilOpDirty=!1))},t})();e._StencilState=t})(n||(n={}));var n,a=this&&this.__assign||Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e};!(function(e){var t=function(e,t,i,n,o){return r(e,o+(n?n+"\n":"")+t,i)},r=function(e,t,r){var i=e.createShader("vertex"===r?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(e.shaderSource(i,t),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){var n=e.getShaderInfoLog(i);if(n)throw new Error(n)}if(!i)throw new Error("Something went wrong while compile the shader.");return i},i=function(t,r,i){var n=i.NEAREST,o=i.NEAREST;switch(t){case e.Texture.BILINEAR_SAMPLINGMODE:n=i.LINEAR,o=r?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case e.Texture.TRILINEAR_SAMPLINGMODE:n=i.LINEAR,o=r?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case e.Texture.NEAREST_SAMPLINGMODE:n=i.NEAREST,o=r?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case e.Texture.NEAREST_NEAREST_MIPNEAREST:n=i.NEAREST,o=r?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case e.Texture.NEAREST_LINEAR_MIPNEAREST:n=i.NEAREST,o=r?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case e.Texture.NEAREST_LINEAR_MIPLINEAR:n=i.NEAREST,o=r?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case e.Texture.NEAREST_LINEAR:n=i.NEAREST,o=i.LINEAR;break;case e.Texture.NEAREST_NEAREST:n=i.NEAREST,o=i.NEAREST;break;case e.Texture.LINEAR_NEAREST_MIPNEAREST:n=i.LINEAR,o=r?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case e.Texture.LINEAR_NEAREST_MIPLINEAR:n=i.LINEAR,o=r?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case e.Texture.LINEAR_LINEAR:n=i.LINEAR,o=i.LINEAR;break;case e.Texture.LINEAR_NEAREST:n=i.LINEAR,o=i.NEAREST}return{min:o,mag:n}},n=function(t,r,i,n,o,s){void 0===s&&(s=null);var a,l=function(){i[r]=a,i._internalCount++,n&&n._removePendingData(a),6===i._internalCount&&o(i)},u=function(e,t){n&&n._removePendingData(a),s&&s(e,t)};a=e.Tools.LoadImage(t,l,u,n?n.database:null),n&&n._addPendingData(a)},o=function(e,t,r,i,o){void 0===o&&(o=null);var s=[];s._internalCount=0;for(var a=0;a<6;a++)n(i[a],a,s,t,r,o)},s=(function(){function e(){}return e})(),l=(function(){function e(){}return e})();e.InstancingAttributeInfo=l;var u=(function(){function e(){}return e})();e.RenderTargetCreationOptions=u;var h=(function(){function e(){}return e})();e.DepthTextureCreationOptions=h;var c=(function(){function e(){}return e})();e.EngineCapabilities=c;var f=(function(){function n(t,r,i,o){void 0===o&&(o=!1);var a=this;this.forcePOTTextures=!1,this.isFullscreen=!1,this.isPointerLock=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.scenes=new Array,this.postProcesses=new Array,this.onResizeObservable=new e.Observable,this.onCanvasBlurObservable=new e.Observable,this.onCanvasFocusObservable=new e.Observable,this.onCanvasPointerOutObservable=new e.Observable,this.onBeforeTextureInitObservable=new e.Observable,this._vrDisplay=void 0,this._vrSupported=!1,this._vrExclusivePointerMode=!1,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this.onBeginFrameObservable=new e.Observable,this.onEndFrameObservable=new e.Observable,this.onBeforeShaderCompilationObservable=new e.Observable,this.onAfterShaderCompilationObservable=new e.Observable,this._windowIsBackground=!1,this._webGLVersion=1,this._badOS=!1,this._badDesktopOS=!1,this.disableTextureBindingOptimization=!1,this.onVRDisplayChangedObservable=new e.Observable,this.onVRRequestPresentComplete=new e.Observable,this.onVRRequestPresentStart=new e.Observable,this._colorWrite=!0,this._drawCalls=new e.PerfCounter,this._textureCollisions=new e.PerfCounter,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this.onContextLostObservable=new e.Observable,this.onContextRestoredObservable=new e.Observable,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this._performanceMonitor=new e.PerformanceMonitor,this._fps=60,this._deltaTime=0,this.disablePerformanceMonitorInBackground=!1,this._depthCullingState=new e._DepthCullingState,this._stencilState=new e._StencilState,this._alphaState=new e._AlphaState,this._alphaMode=n.ALPHA_DISABLE,this._internalTexturesCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._firstBoundInternalTextureTracker=new e.DummyInternalTextureTracker,this._lastBoundInternalTextureTracker=new e.DummyInternalTextureTracker,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._activeRequests=new Array,this._texturesSupported=new Array,this.premultipliedAlpha=!0,this._onVRFullScreenTriggered=function(){if(a._vrDisplay&&a._vrDisplay.isPresenting){a._oldSize=new e.Size(a.getRenderWidth(),a.getRenderHeight()),a._oldHardwareScaleFactor=a.getHardwareScalingLevel();var t=a._vrDisplay.getEyeParameters("left");a.setHardwareScalingLevel(1),a.setSize(2*t.renderWidth,t.renderHeight)}else a.setHardwareScalingLevel(a._oldHardwareScaleFactor),a.setSize(a._oldSize.width,a._oldSize.height)},this._boundUniforms={},e.PromisePolyfill.Apply();var l=null;if(n.Instances.push(this),t){if(i=i||{},t.getContext){if(l=t,this._renderingCanvas=l,null!=r&&(i.antialias=r),void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.audioEngine&&(i.audioEngine=!0),void 0===i.stencil&&(i.stencil=!0),!1===i.premultipliedAlpha&&(this.premultipliedAlpha=!1),this._deterministicLockstep=i.deterministicLockstep,this._lockstepMaxSteps=i.lockstepMaxSteps,this._doNotHandleContextLost=!!i.doNotHandleContextLost,navigator&&navigator.userAgent)for(var u=navigator.userAgent,h=0,c=n.ExceptionList;h<c.length;h++){var f=c[h],d=f.key,p=f.targets;if(u.indexOf(d)>-1){if(f.capture&&f.captureConstraint){var A=f.capture,m=f.captureConstraint,g=new RegExp(A),_=g.exec(u);if(_&&_.length>0){var v=parseInt(_[_.length-1]);if(v>=m)continue}}for(var y=0,b=p;y<b.length;y++){var E=b[y];switch(E){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"textureBindingOptimization":this.disableTextureBindingOptimization=!0}}}}if(!i.disableWebGL2Support)try{this._gl=l.getContext("webgl2",i)||l.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2)}catch(e){}if(!this._gl){if(!l)throw new Error("The provided canvas is null or undefined.");try{this._gl=l.getContext("webgl",i)||l.getContext("experimental-webgl",i)}catch(e){throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported");this._onCanvasFocus=function(){a.onCanvasFocusObservable.notifyObservers(a)},this._onCanvasBlur=function(){a.onCanvasBlurObservable.notifyObservers(a)},l.addEventListener("focus",this._onCanvasFocus),l.addEventListener("blur",this._onCanvasBlur),this._onBlur=function(){a.disablePerformanceMonitorInBackground&&a._performanceMonitor.disable(),a._windowIsBackground=!0},this._onFocus=function(){a.disablePerformanceMonitorInBackground&&a._performanceMonitor.enable(),a._windowIsBackground=!1},this._onCanvasPointerOut=function(e){a.onCanvasPointerOutObservable.notifyObservers(e)},window.addEventListener("blur",this._onBlur),window.addEventListener("focus",this._onFocus),l.addEventListener("pointerout",this._onCanvasPointerOut),this._doNotHandleContextLost||(this._onContextLost=function(t){t.preventDefault(),a._contextWasLost=!0,e.Tools.Warn("WebGL context lost."),a.onContextLostObservable.notifyObservers(a)},this._onContextRestored=function(t){setTimeout((function(){a._initGLContext(),a._rebuildEffects(),a._rebuildInternalTextures(),a._rebuildBuffers(),a.wipeCaches(!0),e.Tools.Warn("WebGL context successfully restored."),a.onContextRestoredObservable.notifyObservers(a),a._contextWasLost=!1}),0)},l.addEventListener("webglcontextlost",this._onContextLost,!1),l.addEventListener("webglcontextrestored",this._onContextRestored,!1))}else this._gl=t,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample&&(this._webGLVersion=2),i.stencil=this._gl.getContextAttributes().stencil;var T=i.limitDeviceRatio||window.devicePixelRatio||1;this._hardwareScalingLevel=o?1/Math.min(T,window.devicePixelRatio||1):1,this.resize(),this._isStencilEnable=!!i.stencil,this._initGLContext(),l&&(this._onFullscreenChange=function(){void 0!==document.fullscreen?a.isFullscreen=document.fullscreen:void 0!==document.mozFullScreen?a.isFullscreen=document.mozFullScreen:void 0!==document.webkitIsFullScreen?a.isFullscreen=document.webkitIsFullScreen:void 0!==document.msIsFullScreen&&(a.isFullscreen=document.msIsFullScreen),a.isFullscreen&&a._pointerLockRequested&&l&&(l.requestPointerLock=l.requestPointerLock||l.msRequestPointerLock||l.mozRequestPointerLock||l.webkitRequestPointerLock,l.requestPointerLock&&l.requestPointerLock())},document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",this._onFullscreenChange,!1),this._onPointerLockChange=function(){a.isPointerLock=document.mozPointerLockElement===l||document.webkitPointerLockElement===l||document.msPointerLockElement===l||document.pointerLockElement===l},document.addEventListener("pointerlockchange",this._onPointerLockChange,!1),document.addEventListener("mspointerlockchange",this._onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",this._onPointerLockChange,!1),this._onVRDisplayPointerRestricted=function(){l&&l.requestPointerLock()},this._onVRDisplayPointerUnrestricted=function(){document.exitPointerLock()},window.addEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted,!1),window.addEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted,!1)),i.audioEngine&&e.AudioEngine&&!n.audioEngine&&(n.audioEngine=new e.AudioEngine);for(var x=0;x<this._caps.maxVertexAttribs;x++)this._currentBufferPointers[x]=new s;this._linkTrackers(this._firstBoundInternalTextureTracker,this._lastBoundInternalTextureTracker),i.autoEnableWebVR&&this.initWebVR(),this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),console.log("Babylon.js engine (v"+n.Version+") launched"),this.enableOfflineSupport=void 0!==e.Database}}return Object.defineProperty(n,"LastCreatedEngine",{get:function(){return 0===n.Instances.length?null:n.Instances[n.Instances.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LastCreatedScene",{get:function(){var e=n.LastCreatedEngine;return e?0===e.scenes.length?null:e.scenes[e.scenes.length-1]:null},enumerable:!0,configurable:!0}),n.MarkAllMaterialsAsDirty=function(e,t){for(var r=0;r<n.Instances.length;r++)for(var i=n.Instances[r],o=0;o<i.scenes.length;o++)i.scenes[o].markAllMaterialsAsDirty(e,t)},Object.defineProperty(n,"NEVER",{get:function(){return n._NEVER},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALWAYS",{get:function(){return n._ALWAYS},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LESS",{get:function(){return n._LESS},enumerable:!0,configurable:!0}),Object.defineProperty(n,"EQUAL",{get:function(){return n._EQUAL},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LEQUAL",{get:function(){return n._LEQUAL},enumerable:!0,configurable:!0}),Object.defineProperty(n,"GREATER",{get:function(){return n._GREATER},enumerable:!0,configurable:!0}),Object.defineProperty(n,"GEQUAL",{get:function(){return n._GEQUAL},enumerable:!0,configurable:!0}),Object.defineProperty(n,"NOTEQUAL",{get:function(){return n._NOTEQUAL},enumerable:!0,configurable:!0}),Object.defineProperty(n,"KEEP",{get:function(){return n._KEEP},enumerable:!0,configurable:!0}),Object.defineProperty(n,"REPLACE",{get:function(){return n._REPLACE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"INCR",{get:function(){return n._INCR},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DECR",{get:function(){return n._DECR},enumerable:!0,configurable:!0}),Object.defineProperty(n,"INVERT",{get:function(){return n._INVERT},enumerable:!0,configurable:!0}),Object.defineProperty(n,"INCR_WRAP",{get:function(){return n._INCR_WRAP},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DECR_WRAP",{get:function(){return n._DECR_WRAP},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_DISABLE",{get:function(){return n._ALPHA_DISABLE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_ONEONE",{get:function(){return n._ALPHA_ONEONE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_ADD",{get:function(){return n._ALPHA_ADD},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_COMBINE",{get:function(){return n._ALPHA_COMBINE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_SUBTRACT",{get:function(){return n._ALPHA_SUBTRACT},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_MULTIPLY",{get:function(){return n._ALPHA_MULTIPLY},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_MAXIMIZED",{get:function(){return n._ALPHA_MAXIMIZED},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_PREMULTIPLIED",{get:function(){return n._ALPHA_PREMULTIPLIED},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_PREMULTIPLIED_PORTERDUFF",{get:function(){return n._ALPHA_PREMULTIPLIED_PORTERDUFF},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_INTERPOLATE",{get:function(){return n._ALPHA_INTERPOLATE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ALPHA_SCREENMODE",{get:function(){return n._ALPHA_SCREENMODE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DELAYLOADSTATE_NONE",{get:function(){return n._DELAYLOADSTATE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DELAYLOADSTATE_LOADED",{get:function(){return n._DELAYLOADSTATE_LOADED},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DELAYLOADSTATE_LOADING",{get:function(){return n._DELAYLOADSTATE_LOADING},enumerable:!0,configurable:!0}),Object.defineProperty(n,"DELAYLOADSTATE_NOTLOADED",{get:function(){return n._DELAYLOADSTATE_NOTLOADED},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_ALPHA",{get:function(){return n._TEXTUREFORMAT_ALPHA},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_LUMINANCE",{get:function(){return n._TEXTUREFORMAT_LUMINANCE},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_R",{get:function(){return n._TEXTUREFORMAT_R},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_RG",{get:function(){return n._TEXTUREFORMAT_RG},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_LUMINANCE_ALPHA",{get:function(){return n._TEXTUREFORMAT_LUMINANCE_ALPHA},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_RGB",{get:function(){return n._TEXTUREFORMAT_RGB},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTUREFORMAT_RGBA",{get:function(){return n._TEXTUREFORMAT_RGBA},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTURETYPE_UNSIGNED_INT",{get:function(){return n._TEXTURETYPE_UNSIGNED_INT},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTURETYPE_FLOAT",{get:function(){return n._TEXTURETYPE_FLOAT},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TEXTURETYPE_HALF_FLOAT",{get:function(){return n._TEXTURETYPE_HALF_FLOAT},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SCALEMODE_FLOOR",{get:function(){return n._SCALEMODE_FLOOR},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SCALEMODE_NEAREST",{get:function(){return n._SCALEMODE_NEAREST},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SCALEMODE_CEILING",{get:function(){return n._SCALEMODE_CEILING},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Version",{get:function(){return"3.3.0-alpha.6"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isInVRExclusivePointerMode",{get:function(){return this._vrExclusivePointerMode},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"supportsUniformBuffers",{get:function(){return this.webGLVersion>1&&!this.disableUniformBuffers},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"texturesSupported",{get:function(){return this._texturesSupported},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,n.TEXTUREFORMAT_RGBA,!1,!1,e.Texture.NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,n.TEXTUREFORMAT_RGBA,!1,!1,e.Texture.NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var t=new Uint8Array(4),r=[t,t,t,t,t,t];this._emptyCubeTexture=this.createRawCubeTexture(r,1,n.TEXTUREFORMAT_RGBA,n.TEXTURETYPE_UNSIGNED_INT,!1,!1,e.Texture.NEAREST_SAMPLINGMODE)}return this._emptyCubeTexture},enumerable:!0,configurable:!0}),n.prototype._rebuildInternalTextures=function(){for(var e=this._internalTexturesCache.slice(),t=0,r=e;t<r.length;t++){r[t]._rebuild()}},n.prototype._rebuildEffects=function(){for(var t in this._compiledEffects){this._compiledEffects[t]._prepareEffect()}e.Effect.ResetCache()},n.prototype._rebuildBuffers=function(){for(var e=0,t=this.scenes;e<t.length;e++){var r=t[e];r.resetCachedMaterial(),r._rebuildGeometries(),r._rebuildTextures()}for(var i=0,n=this._uniformBuffers;i<n.length;i++){n[i]._rebuild()}},n.prototype._initGLContext=function(){this._caps=new c,this._caps.maxTexturesImageUnits=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxCombinedTexturesImageUnits=this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureImageUnits=this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._caps.maxCubemapTextureSize=this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxRenderTextureSize=this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),this._caps.maxVertexAttribs=this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),this._caps.maxVaryingVectors=this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),this._caps.maxFragmentUniformVectors=this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxVertexUniformVectors=this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),this._glVersion=this._gl.getParameter(this._gl.VERSION);var e=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor="Unknown vendor"),this._glRenderer||(this._glRenderer="Unknown renderer"),this._gl.HALF_FLOAT_OES=36193,34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.standardDerivatives=this._webGLVersion>1||null!==this._gl.getExtension("OES_standard_derivatives"),this._caps.astc=this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),this._caps.s3tc=this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),this._caps.pvrtc=this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this._caps.etc1=this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),this._caps.etc2=this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),this._caps.textureAnisotropicFilterExtension=this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.uintIndices=this._webGLVersion>1||null!==this._gl.getExtension("OES_element_index_uint"),this._caps.fragmentDepthSupported=this._webGLVersion>1||null!==this._gl.getExtension("EXT_frag_depth"),this._caps.highPrecisionShaderSupported=!0,this._caps.timerQuery=this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)>0),this._caps.colorBufferFloat=this._webGLVersion>1&&this._gl.getExtension("EXT_color_buffer_float"),this._caps.textureFloat=!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_float")),this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloat=!!(this._webGLVersion>1||this._gl.getExtension("OES_texture_half_float")),this._caps.textureHalfFloatLinearFiltering=!!(this._webGLVersion>1||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),this._webGLVersion>1&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._caps.textureLOD=!!(this._webGLVersion>1||this._gl.getExtension("EXT_shader_texture_lod")),this._webGLVersion>1)this._caps.drawBuffersExtension=!0;else{var t=this._gl.getExtension("WEBGL_draw_buffers");if(null!==t){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=t.drawBuffersWEBGL.bind(t),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var r=0;r<16;r++)this._gl["COLOR_ATTACHMENT"+r+"_WEBGL"]=t["COLOR_ATTACHMENT"+r+"_WEBGL"]}else this._caps.drawBuffersExtension=!1}if(this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var i=this._gl.getExtension("WEBGL_depth_texture");null!=i&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=i.UNSIGNED_INT_24_8_WEBGL)}if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var n=this._gl.getExtension("OES_vertex_array_object");null!=n?(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=n.createVertexArrayOES.bind(n),this._gl.bindVertexArray=n.bindVertexArrayOES.bind(n),this._gl.deleteVertexArray=n.deleteVertexArrayOES.bind(n)):this._caps.vertexArrayObject=!1}if(this._webGLVersion>1)this._caps.instancedArrays=!0;else{var o=this._gl.getExtension("ANGLE_instanced_arrays");null!=o?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=o.drawArraysInstancedANGLE.bind(o),this._gl.drawElementsInstanced=o.drawElementsInstancedANGLE.bind(o),this._gl.vertexAttribDivisor=o.vertexAttribDivisorANGLE.bind(o)):this._caps.instancedArrays=!1}if(this._caps.astc&&this.texturesSupported.push("-astc.ktx"),this._caps.s3tc&&this.texturesSupported.push("-dxt.ktx"),this._caps.pvrtc&&this.texturesSupported.push("-pvrtc.ktx"),this._caps.etc2&&this.texturesSupported.push("-etc2.ktx"),this._caps.etc1&&this.texturesSupported.push("-etc1.ktx"),this._gl.getShaderPrecisionFormat){var s=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&(this._caps.highPrecisionShaderSupported=0!==s.precision)}this.setDepthBuffer(!0),this.setDepthFunctionToLessOrEqual(),this.setDepthWrite(!0),this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var a=0;a<this._maxSimultaneousTextures;a++)this._nextFreeTextureSlots.push(a)},Object.defineProperty(n.prototype,"webGLVersion",{get:function(){return this._webGLVersion},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isStencilEnable",{get:function(){return this._isStencilEnable},enumerable:!0,configurable:!0}),n.prototype._prepareWorkingCanvas=function(){if(!this._workingCanvas){this._workingCanvas=document.createElement("canvas");var e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}},n.prototype.resetTextureCache=function(){for(var e in this._boundTexturesCache)if(this._boundTexturesCache.hasOwnProperty(e)){var t=this._boundTexturesCache[e];t&&this._removeDesignatedSlot(t),this._boundTexturesCache[e]=null}if(!this.disableTextureBindingOptimization){this._nextFreeTextureSlots=[];for(var r=0;r<this._maxSimultaneousTextures;r++)this._nextFreeTextureSlots.push(r)}this._currentTextureChannel=-1},n.prototype.isDeterministicLockStep=function(){return this._deterministicLockstep},n.prototype.getLockstepMaxSteps=function(){return this._lockstepMaxSteps},n.prototype.getGlInfo=function(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}},n.prototype.getAspectRatio=function(e,t){void 0===t&&(t=!1);var r=e.viewport;return this.getRenderWidth(t)*r.width/(this.getRenderHeight(t)*r.height)},n.prototype.getScreenAspectRatio=function(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)},n.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._gl.drawingBufferWidth},n.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._gl.drawingBufferHeight},n.prototype.getRenderingCanvas=function(){return this._renderingCanvas},n.prototype.getRenderingCanvasClientRect=function(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null},n.prototype.setHardwareScalingLevel=function(e){this._hardwareScalingLevel=e,this.resize()},n.prototype.getHardwareScalingLevel=function(){return this._hardwareScalingLevel},n.prototype.getLoadedTexturesCache=function(){return this._internalTexturesCache},n.prototype.getCaps=function(){return this._caps},Object.defineProperty(n.prototype,"drawCalls",{get:function(){return e.Tools.Warn("drawCalls is deprecated. Please use SceneInstrumentation class"),0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"drawCallsPerfCounter",{get:function(){return e.Tools.Warn("drawCallsPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),n.prototype.getDepthFunction=function(){return this._depthCullingState.depthFunc},n.prototype.setDepthFunction=function(e){this._depthCullingState.depthFunc=e},n.prototype.setDepthFunctionToGreater=function(){this._depthCullingState.depthFunc=this._gl.GREATER},n.prototype.setDepthFunctionToGreaterOrEqual=function(){this._depthCullingState.depthFunc=this._gl.GEQUAL},n.prototype.setDepthFunctionToLess=function(){this._depthCullingState.depthFunc=this._gl.LESS},n.prototype.setDepthFunctionToLessOrEqual=function(){this._depthCullingState.depthFunc=this._gl.LEQUAL},n.prototype.getStencilBuffer=function(){return this._stencilState.stencilTest},n.prototype.setStencilBuffer=function(e){this._stencilState.stencilTest=e},n.prototype.getStencilMask=function(){return this._stencilState.stencilMask},n.prototype.setStencilMask=function(e){this._stencilState.stencilMask=e},n.prototype.getStencilFunction=function(){
- return this._stencilState.stencilFunc},n.prototype.getStencilFunctionReference=function(){return this._stencilState.stencilFuncRef},n.prototype.getStencilFunctionMask=function(){return this._stencilState.stencilFuncMask},n.prototype.setStencilFunction=function(e){this._stencilState.stencilFunc=e},n.prototype.setStencilFunctionReference=function(e){this._stencilState.stencilFuncRef=e},n.prototype.setStencilFunctionMask=function(e){this._stencilState.stencilFuncMask=e},n.prototype.getStencilOperationFail=function(){return this._stencilState.stencilOpStencilFail},n.prototype.getStencilOperationDepthFail=function(){return this._stencilState.stencilOpDepthFail},n.prototype.getStencilOperationPass=function(){return this._stencilState.stencilOpStencilDepthPass},n.prototype.setStencilOperationFail=function(e){this._stencilState.stencilOpStencilFail=e},n.prototype.setStencilOperationDepthFail=function(e){this._stencilState.stencilOpDepthFail=e},n.prototype.setStencilOperationPass=function(e){this._stencilState.stencilOpStencilDepthPass=e},n.prototype.setDitheringState=function(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)},n.prototype.setRasterizerState=function(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)},n.prototype.stopRenderLoop=function(e){if(!e)return void(this._activeRenderLoops=[]);var t=this._activeRenderLoops.indexOf(e);t>=0&&this._activeRenderLoops.splice(t,1)},n.prototype._renderLoop=function(){if(!this._contextWasLost){var t=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(t=!1),t){this.beginFrame();for(var r=0;r<this._activeRenderLoops.length;r++){(0,this._activeRenderLoops[r])()}this.endFrame()}}if(this._activeRenderLoops.length>0){var i=null;this._vrDisplay&&this._vrDisplay.isPresenting&&(i=this._vrDisplay),this._frameHandler=e.Tools.QueueNewFrame(this._bindedRenderFunction,i)}else this._renderingQueueLaunched=!1},n.prototype.runRenderLoop=function(t){-1===this._activeRenderLoops.indexOf(t)&&(this._activeRenderLoops.push(t),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._bindedRenderFunction=this._renderLoop.bind(this),this._frameHandler=e.Tools.QueueNewFrame(this._bindedRenderFunction)))},n.prototype.switchFullscreen=function(t){this.isFullscreen?e.Tools.ExitFullscreen():(this._pointerLockRequested=t,this._renderingCanvas&&e.Tools.RequestFullscreen(this._renderingCanvas))},n.prototype.clear=function(e,t,r,i){void 0===i&&(i=!1),this.applyStates();var n=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),n|=this._gl.COLOR_BUFFER_BIT),r&&(this._gl.clearDepth(1),n|=this._gl.DEPTH_BUFFER_BIT),i&&(this._gl.clearStencil(0),n|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(n)},n.prototype.scissorClear=function(e,t,r,i,n){var o=this._gl,s=o.getParameter(o.SCISSOR_TEST),a=o.getParameter(o.SCISSOR_BOX);o.enable(o.SCISSOR_TEST),o.scissor(e,t,r,i),this.clear(n,!0,!0,!0),o.scissor(a[0],a[1],a[2],a[3]),!0===s?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)},n.prototype.setViewport=function(e,t,r){var i=t||this.getRenderWidth(),n=r||this.getRenderHeight(),o=e.x||0,s=e.y||0;this._cachedViewport=e,this._gl.viewport(o*i,s*n,i*e.width,n*e.height)},n.prototype.setDirectViewport=function(e,t,r,i){var n=this._cachedViewport;return this._cachedViewport=null,this._gl.viewport(e,t,r,i),n},n.prototype.beginFrame=function(){this.onBeginFrameObservable.notifyObservers(this),this._measureFps()},n.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.submitFrame(),this.onEndFrameObservable.notifyObservers(this)},n.prototype.resize=function(){if(!this._vrDisplay||!this._vrDisplay.isPresenting){var e=this._renderingCanvas?this._renderingCanvas.clientWidth:window.innerWidth,t=this._renderingCanvas?this._renderingCanvas.clientHeight:window.innerHeight;this.setSize(e/this._hardwareScalingLevel,t/this._hardwareScalingLevel)}},n.prototype.setSize=function(e,t){if(this._renderingCanvas&&(this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)){this._renderingCanvas.width=e,this._renderingCanvas.height=t;for(var r=0;r<this.scenes.length;r++)for(var i=this.scenes[r],n=0;n<i.cameras.length;n++){var o=i.cameras[n];o._currentRenderId=0}this.onResizeObservable.hasObservers&&this.onResizeObservable.notifyObservers(this)}},n.prototype.isVRDevicePresent=function(){return!!this._vrDisplay},n.prototype.getVRDevice=function(){return this._vrDisplay},n.prototype.initWebVR=function(){return this.initWebVRAsync(),this.onVRDisplayChangedObservable},n.prototype.initWebVRAsync=function(){var t=this,r=function(){var e={vrDisplay:t._vrDisplay,vrSupported:t._vrSupported};t.onVRDisplayChangedObservable.notifyObservers(e),t._webVRInitPromise=new Promise(function(t){t(e)})};return this._onVrDisplayConnect||(this._onVrDisplayConnect=function(e){t._vrDisplay=e.display,r()},this._onVrDisplayDisconnect=function(){t._vrDisplay.cancelAnimationFrame(t._frameHandler),t._vrDisplay=void 0,t._frameHandler=e.Tools.QueueNewFrame(t._bindedRenderFunction),r()},this._onVrDisplayPresentChange=function(){t._vrExclusivePointerMode=t._vrDisplay&&t._vrDisplay.isPresenting},window.addEventListener("vrdisplayconnect",this._onVrDisplayConnect),window.addEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),window.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange)),this._webVRInitPromise=this._webVRInitPromise||this._getVRDisplaysAsync(),this._webVRInitPromise.then(r),this._webVRInitPromise},n.prototype.enableVR=function(){var e=this;if(this._vrDisplay&&!this._vrDisplay.isPresenting){var t=function(){e.onVRRequestPresentComplete.notifyObservers(!0),e._onVRFullScreenTriggered()},r=function(){e.onVRRequestPresentComplete.notifyObservers(!1)};this.onVRRequestPresentStart.notifyObservers(this),this._vrDisplay.requestPresent([{source:this.getRenderingCanvas()}]).then(t).catch(r)}},n.prototype.disableVR=function(){this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered)},n.prototype._getVRDisplaysAsync=function(){var e=this;return new Promise(function(t,r){navigator.getVRDisplays?navigator.getVRDisplays().then((function(r){e._vrSupported=!0,e._vrDisplay=r[0],t({vrDisplay:e._vrDisplay,vrSupported:e._vrSupported})})):(e._vrDisplay=void 0,e._vrSupported=!1,t({vrDisplay:e._vrDisplay,vrSupported:e._vrSupported}))})},n.prototype.bindFramebuffer=function(e,t,r,i,n,o,s){void 0===s&&(s=0),this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this.bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);var a=this._gl;e.isCube&&(void 0===t&&(t=0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,e._webGLTexture,s),o&&(o._generateStencilBuffer?a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,o._webGLTexture,s):a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,o._webGLTexture,s))),this._cachedViewport&&!n?this.setViewport(this._cachedViewport,r,i):(r||(r=e.width,s&&(r/=Math.pow(2,s))),i||(i=e.height,s&&(i/=Math.pow(2,s))),a.viewport(0,0,r,i)),this.wipeCaches()},n.prototype.bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},n.prototype.unBindFramebuffer=function(e,t,r){void 0===t&&(t=!1),this._currentRenderTarget=null;var i=this._gl;e._MSAAFramebuffer&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,e._MSAAFramebuffer),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,e._framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST)),!e.generateMipMaps||t||e.isCube||(this._bindTextureDirectly(i.TEXTURE_2D,e,!0),i.generateMipmap(i.TEXTURE_2D),this._bindTextureDirectly(i.TEXTURE_2D,null)),r&&(e._MSAAFramebuffer&&this.bindUnboundFramebuffer(e._framebuffer),r()),this.bindUnboundFramebuffer(null)},n.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,r){void 0===t&&(t=!1),this._currentRenderTarget=null;var i=this._gl;if(e[0]._MSAAFramebuffer){i.bindFramebuffer(i.READ_FRAMEBUFFER,e[0]._MSAAFramebuffer),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,e[0]._framebuffer);var n=e[0]._attachments;n||(n=new Array(e.length),e[0]._attachments=n);for(var o=0;o<e.length;o++){for(var s=e[o],a=0;a<n.length;a++)n[a]=i.NONE;n[o]=i[this.webGLVersion>1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"],i.readBuffer(n[o]),i.drawBuffers(n),i.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,i.COLOR_BUFFER_BIT,i.NEAREST)}for(var o=0;o<n.length;o++)n[o]=i[this.webGLVersion>1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"];i.drawBuffers(n)}for(var o=0;o<e.length;o++){var s=e[o];!s.generateMipMaps||t||s.isCube||(this._bindTextureDirectly(i.TEXTURE_2D,s),i.generateMipmap(i.TEXTURE_2D),this._bindTextureDirectly(i.TEXTURE_2D,null))}r&&(e[0]._MSAAFramebuffer&&this.bindUnboundFramebuffer(e[0]._framebuffer),r()),this.bindUnboundFramebuffer(null)},n.prototype.generateMipMapsForCubemap=function(e){if(e.generateMipMaps){var t=this._gl;this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,e,!0),t.generateMipmap(t.TEXTURE_CUBE_MAP),this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,null)}},n.prototype.flushFramebuffer=function(){this._gl.flush()},n.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this.bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},n.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");return this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},n.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");return this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},n.prototype.updateUniformBuffer=function(e,t,r,i){this.bindUniformBuffer(e),void 0===r&&(r=0),void 0===i?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,r,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,r,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(r,r+i)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(r,r+i)),this.bindUniformBuffer(null)},n.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},n.prototype.createVertexBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create vertex buffer");return this.bindArrayBuffer(t),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._resetVertexBufferBinding(),t.references=1,t},n.prototype.createDynamicVertexBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic vertex buffer");return this.bindArrayBuffer(t),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),this._resetVertexBufferBinding(),t.references=1,t},n.prototype.updateDynamicIndexBuffer=function(e,t,r){void 0===r&&(r=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e);var i;i=t instanceof Uint16Array||t instanceof Uint32Array?t:e.is32Bits?new Uint32Array(t):new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},n.prototype.updateDynamicVertexBuffer=function(e,t,r,i){this.bindArrayBuffer(e),void 0===r&&(r=0),void 0===i?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,r,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,r,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(r,r+i)):(t=t instanceof ArrayBuffer?new Uint8Array(t,r,i):new Uint8Array(t.buffer,t.byteOffset+r,i),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()},n.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},n.prototype.createIndexBuffer=function(e,t){var r=this._gl.createBuffer();if(!r)throw new Error("Unable to create index buffer");this.bindIndexBuffer(r);var i,n=!1;if(e instanceof Uint16Array)i=e;else if(this._caps.uintIndices)if(e instanceof Uint32Array)i=e,n=!0;else{for(var o=0;o<e.length;o++)if(e[o]>65535){n=!0;break}i=n?new Uint32Array(e):new Uint16Array(e)}else i=new Uint16Array(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),r.references=1,r.is32Bits=n,r},n.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},n.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e)},n.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e)},n.prototype.bindUniformBlock=function(e,t,r){var i=this._gl.getUniformBlockIndex(e,t);this._gl.uniformBlockBinding(e,i,r)},n.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},n.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e),this._currentBoundBuffer[t]=e)},n.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},n.prototype._vertexAttribPointer=function(e,t,r,i,n,o,s){var a=this._currentBufferPointers[t],l=!1;a.active?(a.buffer!==e&&(a.buffer=e,l=!0),a.size!==r&&(a.size=r,l=!0),a.type!==i&&(a.type=i,l=!0),a.normalized!==n&&(a.normalized=n,l=!0),a.stride!==o&&(a.stride=o,l=!0),a.offset!==s&&(a.offset=s,l=!0)):(l=!0,a.active=!0,a.index=t,a.size=r,a.type=i,a.normalized=n,a.stride=o,a.offset=s,a.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,r,i,n,o,s))},n.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},n.prototype._bindVertexBuffersAttributes=function(e,t){var r=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var i=0;i<r.length;i++){var n=t.getAttributeLocation(i);if(n>=0){var o=e[r[i]];if(!o)continue;this._gl.enableVertexAttribArray(n),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[n]=!0);var s=o.getBuffer();s&&(this._vertexAttribPointer(s,n,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(n,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(n),this._currentInstanceBuffers.push(s))))}}},n.prototype.recordVertexArrayObject=function(e,t,r){var i=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(i),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,r),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),i},n.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},n.prototype.bindBuffersDirectly=function(e,t,r,i,n){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==n){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=n;var o=n.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var s=0,a=0;a<o;a++)if(a<r.length){var l=n.getAttributeLocation(a);l>=0&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,r[a],this._gl.FLOAT,!1,i,s)),s+=4*r[a]}}this._bindIndexBufferWithCache(t)},n.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},n.prototype.bindBuffers=function(e,t,r){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===r||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r,this._bindVertexBuffersAttributes(e,r)),this._bindIndexBufferWithCache(t)},n.prototype.unbindInstanceAttributes=function(){for(var e,t=0,r=this._currentInstanceLocations.length;t<r;t++){var i=this._currentInstanceBuffers[t];e!=i&&i.references&&(e=i,this.bindArrayBuffer(i));var n=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(n,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0},n.prototype.releaseVertexArrayObject=function(e){this._gl.deleteVertexArray(e)},n.prototype._releaseBuffer=function(e){return 0===--e.references&&(this._gl.deleteBuffer(e),!0)},n.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");return t.capacity=e,this.bindArrayBuffer(t),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),t},n.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},n.prototype.updateAndBindInstancesBuffer=function(e,t,r){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==r[0].index){for(var i=0,n=0;n<r.length;n++){var o=r[n];i+=4*o.attributeSize}for(var n=0;n<r.length;n++){var o=r[n];this._vertexAttribArraysEnabled[o.index]||(this._gl.enableVertexAttribArray(o.index),this._vertexAttribArraysEnabled[o.index]=!0),this._vertexAttribPointer(e,o.index,o.attributeSize,o.attribyteType||this._gl.FLOAT,o.normalized||!1,i,o.offset),this._gl.vertexAttribDivisor(o.index,1),this._currentInstanceLocations.push(o.index),this._currentInstanceBuffers.push(e)}}else for(var s=0;s<4;s++){var a=r[s];this._vertexAttribArraysEnabled[a]||(this._gl.enableVertexAttribArray(a),this._vertexAttribArraysEnabled[a]=!0),this._vertexAttribPointer(e,a,4,this._gl.FLOAT,!1,64,16*s),this._gl.vertexAttribDivisor(a,1),this._currentInstanceLocations.push(a),this._currentInstanceBuffers.push(e)}},n.prototype.applyStates=function(){this._depthCullingState.apply(this._gl),this._stencilState.apply(this._gl),this._alphaState.apply(this._gl)},n.prototype.draw=function(t,r,i,n){this.drawElementsType(t?e.Material.TriangleFillMode:e.Material.WireFrameFillMode,r,i,n)},n.prototype.drawPointClouds=function(t,r,i){this.drawArraysType(e.Material.PointFillMode,t,r,i)},n.prototype.drawUnIndexed=function(t,r,i,n){this.drawArraysType(t?e.Material.TriangleFillMode:e.Material.WireFrameFillMode,r,i,n)},n.prototype.drawElementsType=function(e,t,r,i){this.applyStates(),this._drawCalls.addCount(1,!1);var n=this._drawMode(e),o=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,s=this._uintIndicesCurrentlySet?4:2;i?this._gl.drawElementsInstanced(n,r,o,t*s,i):this._gl.drawElements(n,r,o,t*s)},n.prototype.drawArraysType=function(e,t,r,i){this.applyStates(),this._drawCalls.addCount(1,!1);var n=this._drawMode(e);i?this._gl.drawArraysInstanced(n,t,r,i):this._gl.drawArrays(n,t,r)},n.prototype._drawMode=function(t){switch(t){case e.Material.TriangleFillMode:return this._gl.TRIANGLES;case e.Material.PointFillMode:return this._gl.POINTS;case e.Material.WireFrameFillMode:return this._gl.LINES;case e.Material.PointListDrawMode:return this._gl.POINTS;case e.Material.LineListDrawMode:return this._gl.LINES;case e.Material.LineLoopDrawMode:return this._gl.LINE_LOOP;case e.Material.LineStripDrawMode:return this._gl.LINE_STRIP;case e.Material.TriangleStripDrawMode:return this._gl.TRIANGLE_STRIP;case e.Material.TriangleFanDrawMode:return this._gl.TRIANGLE_FAN;default:return this._gl.TRIANGLES}},n.prototype._releaseEffect=function(e){this._compiledEffects[e._key]&&(delete this._compiledEffects[e._key],this._deleteProgram(e.getProgram()))},n.prototype._deleteProgram=function(e){e&&(e.__SPECTOR_rebuildProgram=null,e.transformFeedback&&(this.deleteTransformFeedback(e.transformFeedback),e.transformFeedback=null),this._gl.deleteProgram(e))},n.prototype.createEffect=function(t,r,i,n,o,s,a,l,u){var h=t.vertexElement||t.vertex||t,c=t.fragmentElement||t.fragment||t,f=h+"+"+c+"@"+(o||r.defines);if(this._compiledEffects[f]){var d=this._compiledEffects[f];return a&&d.isReady()&&a(d),d}var p=new e.Effect(t,r,i,n,this,o,s,a,l,u);return p._key=f,this._compiledEffects[f]=p,p},n.prototype.createEffectForParticles=function(e,t,r,i,n,o,s){return void 0===t&&(t=[]),void 0===r&&(r=[]),void 0===i&&(i=""),this.createEffect({vertex:"particles",fragmentElement:e},["position","color","options"],["view","projection"].concat(t),["diffuseSampler"].concat(r),i,n,o,s)},n.prototype.createRawShaderProgram=function(e,t,i,n){void 0===n&&(n=null),i=i||this._gl;var o=r(i,e,"vertex"),s=r(i,t,"fragment");return this._createShaderProgram(o,s,i,n)},n.prototype.createShaderProgram=function(e,r,i,n,o){void 0===o&&(o=null),n=n||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this);var s=this._webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"",a=t(n,e,"vertex",i,s),l=t(n,r,"fragment",i,s),u=this._createShaderProgram(a,l,n,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),u},n.prototype._createShaderProgram=function(e,t,r,i){void 0===i&&(i=null);var n=r.createProgram();if(!n)throw new Error("Unable to create program");if(r.attachShader(n,e),r.attachShader(n,t),this.webGLVersion>1&&i){var o=this.createTransformFeedback();this.bindTransformFeedback(o),this.setTranformFeedbackVaryings(n,i),n.transformFeedback=o}if(r.linkProgram(n),this.webGLVersion>1&&i&&this.bindTransformFeedback(null),!r.getProgramParameter(n,r.LINK_STATUS)){r.validateProgram(n);var s=r.getProgramInfoLog(n);if(s)throw new Error(s)}return r.deleteShader(e),r.deleteShader(t),n},n.prototype.getUniforms=function(e,t){for(var r=new Array,i=0;i<t.length;i++)r.push(this._gl.getUniformLocation(e,t[i]));return r},n.prototype.getAttributes=function(e,t){for(var r=[],i=0;i<t.length;i++)try{r.push(this._gl.getAttribLocation(e,t[i]))}catch(e){r.push(-1)}return r},n.prototype.enableEffect=function(e){e&&(this.bindSamplers(e),this._currentEffect=e,e.onBind&&e.onBind(e),e.onBindObservable.notifyObservers(e))},n.prototype.setIntArray=function(e,t){e&&this._gl.uniform1iv(e,t)},n.prototype.setIntArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2iv(e,t)},n.prototype.setIntArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3iv(e,t)},n.prototype.setIntArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4iv(e,t)},n.prototype.setFloatArray=function(e,t){e&&this._gl.uniform1fv(e,t)},n.prototype.setFloatArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2fv(e,t)},n.prototype.setFloatArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3fv(e,t)},n.prototype.setFloatArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4fv(e,t)},n.prototype.setArray=function(e,t){e&&this._gl.uniform1fv(e,t)},n.prototype.setArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2fv(e,t)},n.prototype.setArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3fv(e,t)},n.prototype.setArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4fv(e,t)},n.prototype.setMatrices=function(e,t){e&&this._gl.uniformMatrix4fv(e,!1,t)},n.prototype.setMatrix=function(e,t){e&&this._gl.uniformMatrix4fv(e,!1,t.toArray())},n.prototype.setMatrix3x3=function(e,t){e&&this._gl.uniformMatrix3fv(e,!1,t)},n.prototype.setMatrix2x2=function(e,t){e&&this._gl.uniformMatrix2fv(e,!1,t)},n.prototype.setInt=function(e,t){e&&this._gl.uniform1i(e,t)},n.prototype.setFloat=function(e,t){e&&this._gl.uniform1f(e,t)},n.prototype.setFloat2=function(e,t,r){e&&this._gl.uniform2f(e,t,r)},n.prototype.setFloat3=function(e,t,r,i){e&&this._gl.uniform3f(e,t,r,i)},n.prototype.setBool=function(e,t){e&&this._gl.uniform1i(e,t)},n.prototype.setFloat4=function(e,t,r,i,n){e&&this._gl.uniform4f(e,t,r,i,n)},n.prototype.setColor3=function(e,t){e&&this._gl.uniform3f(e,t.r,t.g,t.b)},n.prototype.setColor4=function(e,t,r){e&&this._gl.uniform4f(e,t.r,t.g,t.b,r)},n.prototype.setDirectColor4=function(e,t){e&&this._gl.uniform4f(e,t.r,t.g,t.b,t.a)},n.prototype.setState=function(e,t,r,i){void 0===t&&(t=0),void 0===i&&(i=!1),(this._depthCullingState.cull!==e||r)&&(this._depthCullingState.cull=e);var n=this.cullBackFaces?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==n||r)&&(this._depthCullingState.cullFace=n),this.setZOffset(t);var o=i?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==o||r)&&(this._depthCullingState.frontFace=o)},n.prototype.setZOffset=function(e){this._depthCullingState.zOffset=e},n.prototype.getZOffset=function(){return this._depthCullingState.zOffset},n.prototype.setDepthBuffer=function(e){this._depthCullingState.depthTest=e},n.prototype.getDepthWrite=function(){return this._depthCullingState.depthMask},n.prototype.setDepthWrite=function(e){this._depthCullingState.depthMask=e},n.prototype.setColorWrite=function(e){this._gl.colorMask(e,e,e,e),this._colorWrite=e},n.prototype.getColorWrite=function(){return this._colorWrite},n.prototype.setAlphaConstants=function(e,t,r,i){this._alphaState.setAlphaBlendConstants(e,t,r,i)},n.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case n.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case n.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case n.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case n.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case n.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||this.setDepthWrite(e===n.ALPHA_DISABLE),this._alphaMode=e}},n.prototype.getAlphaMode=function(){return this._alphaMode},n.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames&&!e||(this._currentEffect=null,e&&(this.resetTextureCache(),this._currentProgram=null,this._stencilState.reset(),this._depthCullingState.reset(),this.setDepthFunctionToLessOrEqual(),this._alphaState.reset()),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this._unbindVertexArrayObject(),this.bindIndexBuffer(null))},n.prototype.setTextureFormatToUse=function(e){for(var t=0,r=this.texturesSupported.length;t<r;t++)for(var i=0,n=e.length;i<n;i++)if(this._texturesSupported[t]===e[i].toLowerCase())return this._textureFormatInUse=this._texturesSupported[t];return this._textureFormatInUse=null,null},n.prototype._createTexture=function(){var e=this._gl.createTexture();if(!e)throw new Error("Unable to create texture");return e},n.prototype.createTexture=function(t,r,i,n,o,s,a,l,u,h){var c=this;void 0===o&&(o=e.Texture.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===u&&(u=null),void 0===h&&(h=null);var f=String(t),d="data:"===f.substr(0,5),p="blob:"===f.substr(0,5),A=d&&-1!==f.indexOf("base64"),m=u||new e.InternalTexture(this,e.InternalTexture.DATASOURCE_URL),g=f.lastIndexOf("."),_=g>0?f.substring(g).toLowerCase():"",v=this.getCaps().s3tc&&0===_.indexOf(".dds"),y=0===_.indexOf(".tga"),b=!1;!this._textureFormatInUse||A||u||(f=f.substring(0,g)+this._textureFormatInUse,b=!0),n&&n._addPendingData(m),m.url=f,m.generateMipMaps=!r,m.samplingMode=o,m.invertY=i,this._doNotHandleContextLost||(m._buffer=l);var E=null;s&&!u&&(E=m.onLoadedObservable.add(s)),u||this._internalTexturesCache.push(m);var T=function(s,u){n&&n._removePendingData(m),E&&m.onLoadedObservable.remove(E),b?c.createTexture(t,r,i,n,o,null,a,l,m):e.Tools.UseFallbackTexture&&c.createTexture(e.Tools.fallbackTexture,r,i,n,o,null,a,l,m),a&&a(s||"Unknown error",u)},x=null;if(b||y||v)b?x=function(t){var s=new e.KhronosTextureContainer(t,1);c._prepareWebGLTexture(m,n,s.pixelWidth,s.pixelHeight,i,!1,!0,(function(){return s.uploadLevels(c._gl,!r),!1}),o)}:y?x=function(t){var s=new Uint8Array(t),a=e.TGATools.GetTGAHeader(s);c._prepareWebGLTexture(m,n,a.width,a.height,i,r,!1,(function(){return e.TGATools.UploadContent(c._gl,s),!1}),o)}:v&&(x=function(t){var s=e.DDSTools.GetDDSInfo(t),a=(s.isRGB||s.isLuminance||s.mipmapCount>1)&&!r&&s.width>>s.mipmapCount-1==1;c._prepareWebGLTexture(m,n,s.width,s.height,i,!a,s.isFourCC,(function(){return e.DDSTools.UploadDDSLevels(c,c._gl,t,s,a,1),!1}),o)}),l?x&&x(l):this._loadFile(f,(function(e){x&&x(e)}),void 0,n?n.database:void 0,!0,(function(e,t){T("Unable to load "+(e&&e.responseURL,t))}));else{var M=function(t){p&&!c._doNotHandleContextLost&&(m._buffer=t),c._prepareWebGLTexture(m,n,t.width,t.height,i,r,!1,(function(r,i,o){var s=c._gl,a=t.width===r&&t.height===i,l=h?c._getInternalFormat(h):".jpg"===_?s.RGB:s.RGBA;if(a)return s.texImage2D(s.TEXTURE_2D,0,l,l,s.UNSIGNED_BYTE,t),!1;var u=new e.InternalTexture(c,e.InternalTexture.DATASOURCE_TEMP);return c._bindTextureDirectly(s.TEXTURE_2D,u,!0),s.texImage2D(s.TEXTURE_2D,0,l,l,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),c._rescaleTexture(u,m,n,l,(function(){c._releaseTexture(u),c._bindTextureDirectly(s.TEXTURE_2D,m,!0),o()})),!0}),o)};!d||A?l instanceof HTMLImageElement?M(l):e.Tools.LoadImage(f,M,T,n?n.database:null):"string"==typeof l||l instanceof ArrayBuffer||l instanceof Blob?e.Tools.LoadImage(l,M,T,n?n.database:null):M(l)}return m},n.prototype._rescaleTexture=function(t,r,i,o,s){var a=this,l=this.createRenderTargetTexture({width:r.width,height:r.height},{generateMipMaps:!1,type:n.TEXTURETYPE_UNSIGNED_INT,samplingMode:e.Texture.BILINEAR_SAMPLINGMODE,
- generateDepthBuffer:!1,generateStencilBuffer:!1});this._rescalePostProcess||(this._rescalePostProcess=new e.PassPostProcess("rescale",1,null,e.Texture.BILINEAR_SAMPLINGMODE,this,!1,n.TEXTURETYPE_UNSIGNED_INT)),this._rescalePostProcess.getEffect().executeWhenCompiled((function(){a._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)};var e=i;e||(e=a.scenes[a.scenes.length-1]),e.postProcessManager.directRender([a._rescalePostProcess],l,!0),a._bindTextureDirectly(a._gl.TEXTURE_2D,r,!0),a._gl.copyTexImage2D(a._gl.TEXTURE_2D,0,o,0,0,r.width,r.height,0),a.unBindFramebuffer(l),a._releaseTexture(l),s&&s()}))},n.prototype.updateRawTexture=function(e,t,r,i,o,s){if(void 0===o&&(o=null),void 0===s&&(s=n.TEXTURETYPE_UNSIGNED_INT),e){var a=this._getRGBABufferInternalSizedFormat(s,r),l=this._getInternalFormat(r),u=this._getWebGLTextureType(s);this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,void 0===i?1:i?1:0),this._doNotHandleContextLost||(e._bufferView=t,e.format=r,e.type=s,e.invertY=i,e._compression=o),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),o&&t?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[o],e.width,e.height,0,t):this._gl.texImage2D(this._gl.TEXTURE_2D,0,a,e.width,e.height,0,l,u,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}},n.prototype.createRawTexture=function(t,r,o,s,a,l,u,h,c){void 0===h&&(h=null),void 0===c&&(c=n.TEXTURETYPE_UNSIGNED_INT);var f=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_RAW);f.baseWidth=r,f.baseHeight=o,f.width=r,f.height=o,f.format=s,f.generateMipMaps=a,f.samplingMode=u,f.invertY=l,f._compression=h,f.type=c,this._doNotHandleContextLost||(f._bufferView=t),this.updateRawTexture(f,t,s,l,h,c),this._bindTextureDirectly(this._gl.TEXTURE_2D,f,!0);var d=i(u,a,this._gl);return this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,d.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,d.min),a&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(f),f},n.prototype.createDynamicTexture=function(t,r,i,n){var o=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_DYNAMIC);return o.baseWidth=t,o.baseHeight=r,i&&(t=this.needPOTTextures?e.Tools.GetExponentOfTwo(t,this._caps.maxTextureSize):t,r=this.needPOTTextures?e.Tools.GetExponentOfTwo(r,this._caps.maxTextureSize):r),o.width=t,o.height=r,o.isReady=!1,o.generateMipMaps=i,o.samplingMode=n,this.updateTextureSamplingMode(n,o),this._internalTexturesCache.push(o),o},n.prototype.updateTextureSamplingMode=function(e,t){var r=i(e,t.generateMipMaps,this._gl);t.isCube?(this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MIN_FILTER,r.min),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):t.is3D?(this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,r.min),this._bindTextureDirectly(this._gl.TEXTURE_3D,null)):(this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,r.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,r.min),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t.samplingMode=e},n.prototype.updateDynamicTexture=function(e,t,r,i,n){if(void 0===i&&(i=!1),e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,r?1:0),i&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var o=n?this._getInternalFormat(n):this._gl.RGBA;this._gl.texImage2D(this._gl.TEXTURE_2D,0,o,o,this._gl.UNSIGNED_BYTE,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),i&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}},n.prototype.updateVideoTexture=function(e,t,r){if(e&&!e._isDisabled){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,r?0:1);try{if(void 0===this._videoTextureSupported&&(this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t);else{if(!e._workingCanvas){e._workingCanvas=document.createElement("canvas");var i=e._workingCanvas.getContext("2d");if(!i)throw new Error("Unable to get 2d context");e._workingContext=i,e._workingCanvas.width=e.width,e._workingCanvas.height=e.height}e._workingContext.drawImage(t,0,0,t.videoWidth,t.videoHeight,0,0,e.width,e.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e._workingCanvas)}e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},n.prototype.updateTextureComparisonFunction=function(t,r){if(1===this.webGLVersion)return void e.Tools.Error("WebGL 1 does not support texture comparison.");var i=this._gl;t.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,t,!0),0===r?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,n.LEQUAL),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,r),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),0===r?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,n.LEQUAL),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,r),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t._comparisonFunction=r},n.prototype._setupDepthStencilTexture=function(t,r,o,s,a){var l=r.width||r,u=r.height||r;t.baseWidth=l,t.baseHeight=u,t.width=l,t.height=u,t.isReady=!0,t.samples=1,t.generateMipMaps=!1,t._generateDepthBuffer=!0,t._generateStencilBuffer=o,t.samplingMode=s?e.Texture.BILINEAR_SAMPLINGMODE:e.Texture.NEAREST_SAMPLINGMODE,t.type=n.TEXTURETYPE_UNSIGNED_INT,t._comparisonFunction=a;var h=this._gl,c=t.isCube?h.TEXTURE_CUBE_MAP:h.TEXTURE_2D,f=i(t.samplingMode,!1,h);h.texParameteri(c,h.TEXTURE_MAG_FILTER,f.mag),h.texParameteri(c,h.TEXTURE_MIN_FILTER,f.min),h.texParameteri(c,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(c,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),0===a?(h.texParameteri(c,h.TEXTURE_COMPARE_FUNC,n.LEQUAL),h.texParameteri(c,h.TEXTURE_COMPARE_MODE,h.NONE)):(h.texParameteri(c,h.TEXTURE_COMPARE_FUNC,a),h.texParameteri(c,h.TEXTURE_COMPARE_MODE,h.COMPARE_REF_TO_TEXTURE))},n.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var r=e.width||e;return this._createDepthStencilCubeTexture(r,t)}return this._createDepthStencilTexture(e,t)},n.prototype._createDepthStencilTexture=function(t,r){var i=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_DEPTHTEXTURE);if(!this._caps.depthTextureExtension)return e.Tools.Error("Depth texture is not supported by your browser or hardware."),i;var n=a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},r),o=this._gl;return this._bindTextureDirectly(o.TEXTURE_2D,i,!0),this._setupDepthStencilTexture(i,t,n.generateStencil,n.bilinearFiltering,n.comparisonFunction),this.webGLVersion>1?n.generateStencil?o.texImage2D(o.TEXTURE_2D,0,o.DEPTH24_STENCIL8,i.width,i.height,0,o.DEPTH_STENCIL,o.UNSIGNED_INT_24_8,null):o.texImage2D(o.TEXTURE_2D,0,o.DEPTH_COMPONENT24,i.width,i.height,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null):n.generateStencil?o.texImage2D(o.TEXTURE_2D,0,o.DEPTH_STENCIL,i.width,i.height,0,o.DEPTH_STENCIL,o.UNSIGNED_INT_24_8,null):o.texImage2D(o.TEXTURE_2D,0,o.DEPTH_COMPONENT,i.width,i.height,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null),this._bindTextureDirectly(o.TEXTURE_2D,null),i},n.prototype._createDepthStencilCubeTexture=function(t,r){var i=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_UNKNOWN);if(i.isCube=!0,1===this.webGLVersion)return e.Tools.Error("Depth cube texture is not supported by WebGL 1."),i;var n=a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},r),o=this._gl;this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,i,!0),this._setupDepthStencilTexture(i,t,n.generateStencil,n.bilinearFiltering,n.comparisonFunction);for(var s=0;s<6;s++)n.generateStencil?o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,o.DEPTH24_STENCIL8,t,t,0,o.DEPTH_STENCIL,o.UNSIGNED_INT_24_8,null):o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,o.DEPTH_COMPONENT24,t,t,0,o.DEPTH_COMPONENT,o.UNSIGNED_INT,null);return this._bindTextureDirectly(o.TEXTURE_CUBE_MAP,null),i},n.prototype.setFrameBufferDepthStencilTexture=function(e){var t=e.getInternalTexture();if(t&&t._framebuffer&&e.depthStencilTexture){var r=this._gl,i=e.depthStencilTexture;this.bindUnboundFramebuffer(t._framebuffer),i.isCube?i._generateStencilBuffer?r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_CUBE_MAP_POSITIVE_X,i._webGLTexture,0):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_CUBE_MAP_POSITIVE_X,i._webGLTexture,0):i._generateStencilBuffer?r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,i._webGLTexture,0):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,i._webGLTexture,0),this.bindUnboundFramebuffer(null)}},n.prototype.createRenderTargetTexture=function(t,r){var o=new u;void 0!==r&&"object"==typeof r?(o.generateMipMaps=r.generateMipMaps,o.generateDepthBuffer=void 0===r.generateDepthBuffer||r.generateDepthBuffer,o.generateStencilBuffer=o.generateDepthBuffer&&r.generateStencilBuffer,o.type=void 0===r.type?n.TEXTURETYPE_UNSIGNED_INT:r.type,o.samplingMode=void 0===r.samplingMode?e.Texture.TRILINEAR_SAMPLINGMODE:r.samplingMode,o.format=void 0===r.format?n.TEXTUREFORMAT_RGBA:r.format):(o.generateMipMaps=r,o.generateDepthBuffer=!0,o.generateStencilBuffer=!1,o.type=n.TEXTURETYPE_UNSIGNED_INT,o.samplingMode=e.Texture.TRILINEAR_SAMPLINGMODE,o.format=n.TEXTUREFORMAT_RGBA),o.type!==n.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering?o.type!==n.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering||(o.samplingMode=e.Texture.NEAREST_SAMPLINGMODE):o.samplingMode=e.Texture.NEAREST_SAMPLINGMODE;var s=this._gl,a=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(s.TEXTURE_2D,a,!0);var l=t.width||t,h=t.height||t,c=i(o.samplingMode,!!o.generateMipMaps,s);o.type!==n.TEXTURETYPE_FLOAT||this._caps.textureFloat||(o.type=n.TEXTURETYPE_UNSIGNED_INT,e.Tools.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,c.mag),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,c.min),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texImage2D(s.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(o.type,o.format),l,h,0,this._getInternalFormat(o.format),this._getWebGLTextureType(o.type),null);var f=this._currentFramebuffer,d=s.createFramebuffer();return this.bindUnboundFramebuffer(d),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,a._webGLTexture,0),a._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!o.generateStencilBuffer,o.generateDepthBuffer,l,h),o.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(s.TEXTURE_2D,null),s.bindRenderbuffer(s.RENDERBUFFER,null),this.bindUnboundFramebuffer(f),a._framebuffer=d,a.baseWidth=l,a.baseHeight=h,a.width=l,a.height=h,a.isReady=!0,a.samples=1,a.generateMipMaps=!!o.generateMipMaps,a.samplingMode=o.samplingMode,a.type=o.type,a._generateDepthBuffer=o.generateDepthBuffer,a._generateStencilBuffer=!!o.generateStencilBuffer,this._internalTexturesCache.push(a),a},n.prototype.createMultipleRenderTarget=function(t,r){var o=!1,s=!0,a=!1,l=!1,u=1,h=n.TEXTURETYPE_UNSIGNED_INT,c=e.Texture.TRILINEAR_SAMPLINGMODE,f=new Array,d=new Array;void 0!==r&&(o=void 0!==r.generateMipMaps&&r.generateMipMaps,s=void 0===r.generateDepthBuffer||r.generateDepthBuffer,a=void 0!==r.generateStencilBuffer&&r.generateStencilBuffer,l=void 0!==r.generateDepthTexture&&r.generateDepthTexture,u=r.textureCount||1,r.types&&(f=r.types),r.samplingModes&&(d=r.samplingModes));var p=this._gl,A=p.createFramebuffer();this.bindUnboundFramebuffer(A);for(var m=t.width||t,g=t.height||t,_=[],v=[],y=this._setupFramebufferDepthAttachments(a,s,m,g),b=0;b<u;b++){var E=d[b]||c,T=f[b]||h;T!==n.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering?T!==n.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering||(E=e.Texture.NEAREST_SAMPLINGMODE):E=e.Texture.NEAREST_SAMPLINGMODE;var x=i(E,o,p);T!==n.TEXTURETYPE_FLOAT||this._caps.textureFloat||(T=n.TEXTURETYPE_UNSIGNED_INT,e.Tools.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var M=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_MULTIRENDERTARGET),C=p[this.webGLVersion>1?"COLOR_ATTACHMENT"+b:"COLOR_ATTACHMENT"+b+"_WEBGL"];_.push(M),v.push(C),p.activeTexture(p["TEXTURE"+b]),p.bindTexture(p.TEXTURE_2D,M._webGLTexture),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,x.mag),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,x.min),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texImage2D(p.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(T),m,g,0,p.RGBA,this._getWebGLTextureType(T),null),p.framebufferTexture2D(p.DRAW_FRAMEBUFFER,C,p.TEXTURE_2D,M._webGLTexture,0),o&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(p.TEXTURE_2D,null),M._framebuffer=A,M._depthStencilBuffer=y,M.baseWidth=m,M.baseHeight=g,M.width=m,M.height=g,M.isReady=!0,M.samples=1,M.generateMipMaps=o,M.samplingMode=E,M.type=T,M._generateDepthBuffer=s,M._generateStencilBuffer=a,M._attachments=v,this._internalTexturesCache.push(M)}if(l&&this._caps.depthTextureExtension){var P=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_MULTIRENDERTARGET);p.activeTexture(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,P._webGLTexture),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texImage2D(p.TEXTURE_2D,0,this.webGLVersion<2?p.DEPTH_COMPONENT:p.DEPTH_COMPONENT16,m,g,0,p.DEPTH_COMPONENT,p.UNSIGNED_SHORT,null),p.framebufferTexture2D(p.FRAMEBUFFER,p.DEPTH_ATTACHMENT,p.TEXTURE_2D,P._webGLTexture,0),P._framebuffer=A,P.baseWidth=m,P.baseHeight=g,P.width=m,P.height=g,P.isReady=!0,P.samples=1,P.generateMipMaps=o,P.samplingMode=p.NEAREST,P._generateDepthBuffer=s,P._generateStencilBuffer=a,_.push(P),this._internalTexturesCache.push(P)}return p.drawBuffers(v),p.bindRenderbuffer(p.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),this.resetTextureCache(),_},n.prototype._setupFramebufferDepthAttachments=function(e,t,r,i,n){void 0===n&&(n=1);var o=null,s=this._gl;return e?(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),n>1?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,r,i):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,r,i),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,o)):t&&(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),n>1?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH_COMPONENT16,r,i):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,r,i),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,o)),o},n.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var r=this._gl;if(t=Math.min(t,r.getParameter(r.MAX_SAMPLES)),e._depthStencilBuffer&&(r.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(r.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(r.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),t>1){var i=r.createFramebuffer();if(!i)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=i,this.bindUnboundFramebuffer(e._MSAAFramebuffer);var n=r.createRenderbuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");r.bindRenderbuffer(r.RENDERBUFFER,n),r.renderbufferStorageMultisample(r.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,n),e._MSAARenderBuffer=n}else this.bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),r.bindRenderbuffer(r.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),t},n.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||0==e.length)return 1;if(e[0].samples===t)return t;var r=this._gl;t=Math.min(t,r.getParameter(r.MAX_SAMPLES)),e[0]._depthStencilBuffer&&(r.deleteRenderbuffer(e[0]._depthStencilBuffer),e[0]._depthStencilBuffer=null),e[0]._MSAAFramebuffer&&(r.deleteFramebuffer(e[0]._MSAAFramebuffer),e[0]._MSAAFramebuffer=null);for(var i=0;i<e.length;i++)e[i]._MSAARenderBuffer&&(r.deleteRenderbuffer(e[i]._MSAARenderBuffer),e[i]._MSAARenderBuffer=null);if(t>1){var n=r.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");this.bindUnboundFramebuffer(n);for(var o=this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer,e[0]._generateDepthBuffer,e[0].width,e[0].height,t),s=[],i=0;i<e.length;i++){var a=e[i],l=r[this.webGLVersion>1?"COLOR_ATTACHMENT"+i:"COLOR_ATTACHMENT"+i+"_WEBGL"],u=r.createRenderbuffer();if(!u)throw new Error("Unable to create multi sampled framebuffer");r.bindRenderbuffer(r.RENDERBUFFER,u),r.renderbufferStorageMultisample(r.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(a.type),a.width,a.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,l,r.RENDERBUFFER,u),a._MSAAFramebuffer=n,a._MSAARenderBuffer=u,a.samples=t,a._depthStencilBuffer=o,r.bindRenderbuffer(r.RENDERBUFFER,null),s.push(l)}r.drawBuffers(s)}else this.bindUnboundFramebuffer(e[0]._framebuffer);return this.bindUnboundFramebuffer(null),t},n.prototype._uploadDataToTexture=function(e,t,r,i,n,o,s,a){this._gl.texImage2D(e,t,r,i,n,0,o,s,a)},n.prototype._uploadCompressedDataToTexture=function(e,t,r,i,n,o){this._gl.compressedTexImage2D(e,t,r,i,n,0,o)},n.prototype._uploadImageToTexture=function(e,t,r,i){var n=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s),l=e.isCube?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,e.invertY?1:0);var u=n.TEXTURE_2D;if(e.isCube)var u=n.TEXTURE_CUBE_MAP_POSITIVE_X+t;n.texImage2D(u,r,a,s,o,i),this._bindTextureDirectly(l,null,!0)},n.prototype.createRenderTargetCubeTexture=function(t,r){var o=a({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:n.TEXTURETYPE_UNSIGNED_INT,samplingMode:e.Texture.TRILINEAR_SAMPLINGMODE,format:n.TEXTUREFORMAT_RGBA},r);o.generateStencilBuffer=o.generateDepthBuffer&&o.generateStencilBuffer,o.type!==n.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering?o.type!==n.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering||(o.samplingMode=e.Texture.NEAREST_SAMPLINGMODE):o.samplingMode=e.Texture.NEAREST_SAMPLINGMODE;var s=this._gl,l=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,l,!0);var u=i(o.samplingMode,o.generateMipMaps,s);o.type!==n.TEXTURETYPE_FLOAT||this._caps.textureFloat||(o.type=n.TEXTURETYPE_UNSIGNED_INT,e.Tools.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MAG_FILTER,u.mag),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_MIN_FILTER,u.min),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_CUBE_MAP,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);for(var h=0;h<6;h++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,this._getRGBABufferInternalSizedFormat(o.type,o.format),t,t,0,this._getInternalFormat(o.format),this._getWebGLTextureType(o.type),null);var c=s.createFramebuffer();return this.bindUnboundFramebuffer(c),l._depthStencilBuffer=this._setupFramebufferDepthAttachments(o.generateStencilBuffer,o.generateDepthBuffer,t,t),o.generateMipMaps&&s.generateMipmap(s.TEXTURE_CUBE_MAP),this._bindTextureDirectly(s.TEXTURE_CUBE_MAP,null),s.bindRenderbuffer(s.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),l._framebuffer=c,l.width=t,l.height=t,l.isReady=!0,l.isCube=!0,l.samples=1,l.generateMipMaps=o.generateMipMaps,l.samplingMode=o.samplingMode,l.type=o.type,l._generateDepthBuffer=o.generateDepthBuffer,l._generateStencilBuffer=o.generateStencilBuffer,this._internalTexturesCache.push(l),l},n.prototype.createPrefilteredCubeTexture=function(t,r,i,n,o,s,a,l,u){var h=this;void 0===o&&(o=null),void 0===s&&(s=null),void 0===l&&(l=null),void 0===u&&(u=!0);var c=function(t){if(!t)return void(o&&o(null));var s=t.texture;if(u?t.info.sphericalPolynomial&&(s._sphericalPolynomial=t.info.sphericalPolynomial):s._sphericalPolynomial=new e.SphericalPolynomial,s._dataSource=e.InternalTexture.DATASOURCE_CUBEPREFILTERED,h._caps.textureLOD)return void(o&&o(s));var a=h._gl,l=t.width;if(l){for(var c=[],f=0;f<3;f++){var d=f/2,p=1-d,A=n,m=e.Scalar.Log2(l)*i+n,g=A+(m-A)*p,_=Math.round(Math.min(Math.max(g,0),m)),v=new e.InternalTexture(h,e.InternalTexture.DATASOURCE_TEMP);if(v.isCube=!0,h._bindTextureDirectly(a.TEXTURE_CUBE_MAP,v,!0),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_CUBE_MAP,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),t.isDDS){var y=t.info,b=t.data;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,y.isCompressed?1:0),e.DDSTools.UploadDDSLevels(h,h._gl,b,y,!0,6,_)}else e.Tools.Warn("DDS is the only prefiltered cube map supported so far.");h._bindTextureDirectly(a.TEXTURE_CUBE_MAP,null);var E=new e.BaseTexture(r);E.isCube=!0,E._texture=v,v.isReady=!0,c.push(E)}s._lodTextureHigh=c[2],s._lodTextureMid=c[1],s._lodTextureLow=c[0],o&&o(s)}};return this.createCubeTexture(t,r,null,!1,c,s,a,l,u,i,n)},n.prototype.createCubeTexture=function(t,r,i,n,s,a,l,u,h,c,f){var d=this;void 0===s&&(s=null),void 0===a&&(a=null),void 0===u&&(u=null),void 0===h&&(h=!1),void 0===c&&(c=0),void 0===f&&(f=0);var p=this._gl,A=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_CUBE);A.isCube=!0,A.url=t,A.generateMipMaps=!n,A._lodGenerationScale=c,A._lodGenerationOffset=f,this._doNotHandleContextLost||(A._extension=u,A._files=i);var m=!1,g=!1,_=!1,v=t.lastIndexOf("."),y=u||(v>-1?t.substring(v).toLowerCase():"");this._textureFormatInUse?(y=this._textureFormatInUse,t=(v>-1?t.substring(0,v):t)+this._textureFormatInUse,m=!0):(g=".dds"===y,_=".env"===y);var b=function(e,t){a&&e&&a(e.status+" "+e.statusText,t)};if(m)this._loadFile(t,(function(t){var r=new e.KhronosTextureContainer(t,6),i=r.numberOfMipmapLevels>1&&!n;d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,A,!0),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,1),r.uploadLevels(d._gl,!n),d.setCubeMapTextureParams(p,i),A.width=r.pixelWidth,A.height=r.pixelHeight,A.isReady=!0}),void 0,void 0,!0,b);else if(_)this._loadFile(t,(function(t){t=t;var r=e.EnvironmentTextureTools.GetEnvInfo(t);r?(A.width=r.width,A.height=r.width,e.EnvironmentTextureTools.UploadPolynomials(A,t,r),e.EnvironmentTextureTools.UploadLevelsAsync(A,t,r).then((function(){A.isReady=!0,s&&s()}))):a&&a("Can not parse the environment file",null)}),void 0,void 0,!0,b);else if(g)i&&6===i.length?this._cascadeLoadFiles(r,(function(t){for(var r,i=!1,o=0,a=0;a<t.length;a++){var l=t[a];r=e.DDSTools.GetDDSInfo(l),i=(r.isRGB||r.isLuminance||r.mipmapCount>1)&&!n,d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,A,!0),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,r.isCompressed?1:0),e.DDSTools.UploadDDSLevels(d,d._gl,l,r,i,6,-1,a),n||r.isFourCC||1!==r.mipmapCount||p.generateMipmap(p.TEXTURE_CUBE_MAP),A.width=r.width,A.height=r.height,A.type=r.textureType,o=r.width}d.setCubeMapTextureParams(p,i),A.isReady=!0,s&&s({isDDS:!0,width:o,info:r,imgs:t,texture:A})}),i,a):this._loadFile(t,(function(t){var r=e.DDSTools.GetDDSInfo(t);h&&(r.sphericalPolynomial=new e.SphericalPolynomial);var i=(r.isRGB||r.isLuminance||r.mipmapCount>1)&&!n;d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,A,!0),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,r.isCompressed?1:0),e.DDSTools.UploadDDSLevels(d,d._gl,t,r,i,6),n||r.isFourCC||1!==r.mipmapCount||p.generateMipmap(p.TEXTURE_CUBE_MAP),d.setCubeMapTextureParams(p,i),A.width=r.width,A.height=r.height,A.isReady=!0,A.type=r.textureType,s&&s({isDDS:!0,width:r.width,info:r,data:t,texture:A})}),void 0,void 0,!0,b);else{if(!i)throw new Error("Cannot load cubemap because files were not defined");o(0,r,(function(t){var r=d.needPOTTextures?e.Tools.GetExponentOfTwo(t[0].width,d._caps.maxCubemapTextureSize):t[0].width,i=r;if(d._prepareWorkingCanvas(),d._workingCanvas&&d._workingContext){d._workingCanvas.width=r,d._workingCanvas.height=i;var o=[p.TEXTURE_CUBE_MAP_POSITIVE_X,p.TEXTURE_CUBE_MAP_POSITIVE_Y,p.TEXTURE_CUBE_MAP_POSITIVE_Z,p.TEXTURE_CUBE_MAP_NEGATIVE_X,p.TEXTURE_CUBE_MAP_NEGATIVE_Y,p.TEXTURE_CUBE_MAP_NEGATIVE_Z];d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,A,!0),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,0);for(var a=l?d._getInternalFormat(l):d._gl.RGBA,u=0;u<o.length;u++)d._workingContext.drawImage(t[u],0,0,t[u].width,t[u].height,0,0,r,i),p.texImage2D(o[u],0,a,a,p.UNSIGNED_BYTE,d._workingCanvas);n||p.generateMipmap(p.TEXTURE_CUBE_MAP),d.setCubeMapTextureParams(p,!n),A.width=r,A.height=i,A.isReady=!0,l&&(A.format=l),A.onLoadedObservable.notifyObservers(A),A.onLoadedObservable.clear(),s&&s()}}),i,a)}return this._internalTexturesCache.push(A),A},n.prototype.setCubeMapTextureParams=function(e,t){e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,t?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),this._bindTextureDirectly(e.TEXTURE_CUBE_MAP,null)},n.prototype.updateRawCubeTexture=function(t,r,i,n,o,s,a){void 0===s&&(s=null),void 0===a&&(a=0),t._bufferViewArray=r,t.format=i,t.type=n,t.invertY=o,t._compression=s;var l=this._gl,u=this._getWebGLTextureType(n),h=this._getInternalFormat(i),c=this._getRGBABufferInternalSizedFormat(n),f=!1;h===l.RGB&&(h=l.RGBA,f=!0),this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,t,!0),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,void 0===o?1:o?1:0),t.width%4!=0&&l.pixelStorei(l.UNPACK_ALIGNMENT,1);for(var d=0;d<6;d++){var p=r[d];s?l.compressedTexImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,this.getCaps().s3tc[s],t.width,t.height,0,p):(f&&(p=this._convertRGBtoRGBATextureData(p,t.width,t.height,n)),l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+d,a,c,t.width,t.height,0,h,u,p))}(!this.needPOTTextures||e.Tools.IsExponentOfTwo(t.width)&&e.Tools.IsExponentOfTwo(t.height))&&t.generateMipMaps&&0===a&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),t.isReady=!0},n.prototype.createRawCubeTexture=function(t,r,n,o,s,a,l,u){void 0===u&&(u=null);var h=this._gl,c=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_CUBERAW);c.isCube=!0,c.generateMipMaps=s,c.format=n,c.type=o,this._doNotHandleContextLost||(c._bufferViewArray=t);var f=this._getWebGLTextureType(o),d=this._getInternalFormat(n);d===h.RGB&&(d=h.RGBA);var p=r,A=p;if(c.width=p,c.height=A,!this.needPOTTextures||e.Tools.IsExponentOfTwo(c.width)&&e.Tools.IsExponentOfTwo(c.height)||(s=!1),t&&this.updateRawCubeTexture(c,t,n,o,a,u),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,c,!0),t&&s&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),f!==h.FLOAT||this._caps.textureFloatLinearFiltering)if(f!==this._gl.HALF_FLOAT_OES||this._caps.textureHalfFloatLinearFiltering){var m=i(l,s,h);h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,m.mag),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,m.min)}else h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,h.NEAREST);else h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_MIN_FILTER,h.NEAREST);return h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_CUBE_MAP,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),this._bindTextureDirectly(h.TEXTURE_CUBE_MAP,null),c},n.prototype.createRawCubeTextureFromUrl=function(t,r,i,n,o,s,a,l,u,h,c,f){var d=this;void 0===u&&(u=null),void 0===h&&(h=null),void 0===c&&(c=e.Texture.TRILINEAR_SAMPLINGMODE),void 0===f&&(f=!1);var p=this._gl,A=this.createRawCubeTexture(null,i,n,o,!s,f,c);r._addPendingData(A),A.url=t,this._internalTexturesCache.push(A);var m=function(e,t){r._removePendingData(A),h&&e&&h(e.status+" "+e.statusText,t)},g=function(e){var t=A.width,i=a(e);if(i){if(l){var h=d._getWebGLTextureType(o),c=d._getInternalFormat(n),m=d._getRGBABufferInternalSizedFormat(o),g=!1;c===p.RGB&&(c=p.RGBA,g=!0),d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,A,!0),p.pixelStorei(p.UNPACK_FLIP_Y_WEBGL,0);for(var _=l(i),v=0;v<_.length;v++)for(var y=t>>v,b=0;b<6;b++){var E=_[v][b];g&&(E=d._convertRGBtoRGBATextureData(E,y,y,o)),p.texImage2D(b,v,m,y,y,0,c,h,E)}d._bindTextureDirectly(p.TEXTURE_CUBE_MAP,null)}else A.generateMipMaps=!s,d.updateRawCubeTexture(A,i,n,o,f);A.isReady=!0,r._removePendingData(A),u&&u()}};return this._loadFile(t,(function(e){g(e)}),void 0,r.database,!0,m),A},n.prototype.updateRawTexture3D=function(e,t,r,i,o,s){void 0===o&&(o=null),void 0===s&&(s=n.TEXTURETYPE_UNSIGNED_INT);var a=this._getWebGLTextureType(s),l=this._getInternalFormat(r),u=this._getRGBABufferInternalSizedFormat(s,r);this._bindTextureDirectly(this._gl.TEXTURE_3D,e,!0),this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,void 0===i?1:i?1:0),this._doNotHandleContextLost||(e._bufferView=t,e.format=r,e.invertY=i,e._compression=o),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),o&&t?this._gl.compressedTexImage3D(this._gl.TEXTURE_3D,0,this.getCaps().s3tc[o],e.width,e.height,e.depth,0,t):this._gl.texImage3D(this._gl.TEXTURE_3D,0,u,e.width,e.height,e.depth,0,l,a,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),e.isReady=!0},n.prototype.createRawTexture3D=function(t,r,o,s,a,l,u,h,c,f){void 0===c&&(c=null),void 0===f&&(f=n.TEXTURETYPE_UNSIGNED_INT);var d=new e.InternalTexture(this,e.InternalTexture.DATASOURCE_RAW3D);d.baseWidth=r,d.baseHeight=o,d.baseDepth=s,d.width=r,d.height=o,d.depth=s,d.format=a,d.type=f,d.generateMipMaps=l,d.samplingMode=h,d.is3D=!0,this._doNotHandleContextLost||(d._bufferView=t),this.updateRawTexture3D(d,t,a,u,c,f),this._bindTextureDirectly(this._gl.TEXTURE_3D,d,!0);var p=i(h,l,this._gl);return this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,p.mag),this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,p.min),l&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),
- this._internalTexturesCache.push(d),d},n.prototype._prepareWebGLTextureContinuation=function(e,t,r,n,o){var s=this._gl;if(s){var a=i(o,!r,s);s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,a.mag),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,a.min),r||n||s.generateMipmap(s.TEXTURE_2D),this._bindTextureDirectly(s.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},n.prototype._prepareWebGLTexture=function(t,r,i,n,o,s,a,l,u){var h=this;void 0===u&&(u=e.Texture.TRILINEAR_SAMPLINGMODE);var c=this.needPOTTextures?e.Tools.GetExponentOfTwo(i,this.getCaps().maxTextureSize):i,f=this.needPOTTextures?e.Tools.GetExponentOfTwo(n,this.getCaps().maxTextureSize):n,d=this._gl;if(d){if(!t._webGLTexture)return void(r&&r._removePendingData(t));this._bindTextureDirectly(d.TEXTURE_2D,t,!0),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,void 0===o?1:o?1:0),t.baseWidth=i,t.baseHeight=n,t.width=c,t.height=f,t.isReady=!0,l(c,f,(function(){h._prepareWebGLTextureContinuation(t,r,s,a,u)}))||this._prepareWebGLTextureContinuation(t,r,s,a,u)}},n.prototype._convertRGBtoRGBATextureData=function(e,t,r,i){var o;o=i===n.TEXTURETYPE_FLOAT?new Float32Array(t*r*4):new Uint32Array(t*r*4);for(var s=0;s<t;s++)for(var a=0;a<r;a++){var l=3*(a*t+s),u=4*(a*t+s);o[u+0]=e[l+0],o[u+1]=e[l+1],o[u+2]=e[l+2],o[u+3]=1}return o},n.prototype._releaseFramebufferObjects=function(e){var t=this._gl;e._framebuffer&&(t.deleteFramebuffer(e._framebuffer),e._framebuffer=null),e._depthStencilBuffer&&(t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(t.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(t.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null)},n.prototype._releaseTexture=function(e){var t=this._gl;this._releaseFramebufferObjects(e),t.deleteTexture(e._webGLTexture),this.unbindAllTextures();var r=this._internalTexturesCache.indexOf(e);-1!==r&&this._internalTexturesCache.splice(r,1),e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureLow&&e._lodTextureLow.dispose(),this.scenes.forEach((function(t){t.postProcesses.forEach((function(t){t._outputTexture==e&&(t._outputTexture=null)})),t.cameras.forEach((function(t){t._postProcesses.forEach((function(t){t&&t._outputTexture==e&&(t._outputTexture=null)}))}))}))},n.prototype.setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},n.prototype.bindSamplers=function(e){this.setProgram(e.getProgram());for(var t=e.getSamplers(),r=0;r<t.length;r++){var i=e.getUniform(t[r]);i&&(this._boundUniforms[r]=i)}this._currentEffect=null},n.prototype._moveBoundTextureOnTop=function(e){this.disableTextureBindingOptimization||this._lastBoundInternalTextureTracker.previous===e||(this._linkTrackers(e.previous,e.next),this._linkTrackers(this._lastBoundInternalTextureTracker.previous,e),this._linkTrackers(e,this._lastBoundInternalTextureTracker))},n.prototype._getCorrectTextureChannel=function(e,t){if(!t)return-1;if(t._initialSlot=e,this.disableTextureBindingOptimization)e!==t._designatedSlot&&this._textureCollisions.addCount(1,!1);else if(e!==t._designatedSlot)return t._designatedSlot>-1?t._designatedSlot:this._nextFreeTextureSlots.length?this._nextFreeTextureSlots[0]:(this._textureCollisions.addCount(1,!1),this._removeDesignatedSlot(this._firstBoundInternalTextureTracker.next));return e},n.prototype._linkTrackers=function(e,t){e.next=t,t.previous=e},n.prototype._removeDesignatedSlot=function(e){var t=e._designatedSlot;return-1===t?-1:(e._designatedSlot=-1,this.disableTextureBindingOptimization?-1:(this._linkTrackers(e.previous,e.next),this._boundTexturesCache[t]=null,this._nextFreeTextureSlots.push(t),t))},n.prototype._activateCurrentTexture=function(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)},n.prototype._bindTextureDirectly=function(e,t,r,i){void 0===r&&(r=!1),void 0===i&&(i=!1),r&&t&&t._designatedSlot>-1&&(this._activeChannel=t._designatedSlot);var n=this._boundTexturesCache[this._activeChannel],o=t&&t._initialSlot>-1;if(n!==t||i){if(n&&this._removeDesignatedSlot(n),this._activateCurrentTexture(),this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t){if(!this.disableTextureBindingOptimization){var s=this._nextFreeTextureSlots.indexOf(this._activeChannel);s>-1&&this._nextFreeTextureSlots.splice(s,1),this._linkTrackers(this._lastBoundInternalTextureTracker.previous,t),this._linkTrackers(t,this._lastBoundInternalTextureTracker)}t._designatedSlot=this._activeChannel}}else r&&this._activateCurrentTexture();o&&!r&&this._bindSamplerUniformToChannel(t._initialSlot,this._activeChannel)},n.prototype._bindTexture=function(e,t){e<0||(t&&(e=this._getCorrectTextureChannel(e,t)),this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,t))},n.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},n.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},n.prototype.unbindAllTextures=function(){for(var e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)},n.prototype.setTexture=function(e,t,r){e<0||(t&&(this._boundUniforms[e]=t),this._setTexture(e,r))},n.prototype.setDepthStencilTexture=function(e,t,r){e<0||(t&&(this._boundUniforms[e]=t),r&&r.depthStencilTexture?this._setTexture(e,r,!1,!0):this._setTexture(e,null))},n.prototype._bindSamplerUniformToChannel=function(e,t){var r=this._boundUniforms[e];r._currentState!==t&&(this._gl.uniform1i(r,t),r._currentState=t)},n.prototype._getTextureWrapMode=function(t){switch(t){case e.Texture.WRAP_ADDRESSMODE:return this._gl.REPEAT;case e.Texture.CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case e.Texture.MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},n.prototype._setTexture=function(t,r,i,o){if(void 0===i&&(i=!1),void 0===o&&(o=!1),!r)return null!=this._boundTexturesCache[t]&&(this._activeChannel=t,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),this.webGLVersion>1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)),!1;if(r.video)this._activeChannel=t,r.update();else if(r.delayLoadState===n.DELAYLOADSTATE_NOTLOADED)return r.delayLoad(),!1;var s;s=o?r.depthStencilTexture:r.isReady()?r.getInternalTexture():r.isCube?this.emptyCubeTexture:r.is3D?this.emptyTexture3D:this.emptyTexture,i||(t=this._getCorrectTextureChannel(t,s));var a=!0;if(this._boundTexturesCache[t]===s&&(this._moveBoundTextureOnTop(s),i||this._bindSamplerUniformToChannel(s._initialSlot,t),a=!1),this._activeChannel=t,s&&s.is3D)a&&this._bindTextureDirectly(this._gl.TEXTURE_3D,s,i),s&&s._cachedWrapU!==r.wrapU&&(s._cachedWrapU=r.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(r.wrapU),s)),s&&s._cachedWrapV!==r.wrapV&&(s._cachedWrapV=r.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(r.wrapV),s)),s&&s._cachedWrapR!==r.wrapR&&(s._cachedWrapR=r.wrapR,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(r.wrapR),s)),this._setAnisotropicLevel(this._gl.TEXTURE_3D,r);else if(s&&s.isCube){if(a&&this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,s,i),s._cachedCoordinatesMode!==r.coordinatesMode){s._cachedCoordinatesMode=r.coordinatesMode;var l=r.coordinatesMode!==e.Texture.CUBIC_MODE&&r.coordinatesMode!==e.Texture.SKYBOX_MODE?this._gl.REPEAT:this._gl.CLAMP_TO_EDGE;this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_S,l,s),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_T,l)}this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP,r)}else a&&this._bindTextureDirectly(this._gl.TEXTURE_2D,s,i),s&&s._cachedWrapU!==r.wrapU&&(s._cachedWrapU=r.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(r.wrapU),s)),s&&s._cachedWrapV!==r.wrapV&&(s._cachedWrapV=r.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(r.wrapV),s)),this._setAnisotropicLevel(this._gl.TEXTURE_2D,r);return!0},n.prototype.setTextureArray=function(e,t,r){if(!(e<0)&&t){this._textureUnits&&this._textureUnits.length===r.length||(this._textureUnits=new Int32Array(r.length));for(var i=0;i<r.length;i++)this._textureUnits[i]=this._getCorrectTextureChannel(e+i,r[i].getInternalTexture());this._gl.uniform1iv(t,this._textureUnits);for(var n=0;n<r.length;n++)this._setTexture(this._textureUnits[n],r[n],!0)}},n.prototype._setAnisotropicLevel=function(t,r){var i=r.getInternalTexture();if(i){var n=this._caps.textureAnisotropicFilterExtension,o=r.anisotropicFilteringLevel;i.samplingMode!==e.Texture.LINEAR_LINEAR_MIPNEAREST&&i.samplingMode!==e.Texture.LINEAR_LINEAR_MIPLINEAR&&i.samplingMode!==e.Texture.LINEAR_LINEAR&&(o=1),n&&i._cachedAnisotropicFilteringLevel!==o&&(this._setTextureParameterFloat(t,n.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o,this._caps.maxAnisotropy),i),i._cachedAnisotropicFilteringLevel=o)}},n.prototype._setTextureParameterFloat=function(e,t,r,i){this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameterf(e,t,r)},n.prototype._setTextureParameterInteger=function(e,t,r,i){i&&this._bindTextureDirectly(e,i,!0,!0),this._gl.texParameteri(e,t,r)},n.prototype.readPixels=function(e,t,r,i){var n=new Uint8Array(i*r*4);return this._gl.readPixels(e,t,r,i,this._gl.RGBA,this._gl.UNSIGNED_BYTE,n),n},n.prototype.addExternalData=function(t,r){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.add(t,r)},n.prototype.getExternalData=function(t){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.get(t)},n.prototype.getOrAddExternalDataWithFactory=function(t,r){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.getOrAddWithFactory(t,r)},n.prototype.removeExternalData=function(t){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.remove(t)},n.prototype.unbindAllAttributes=function(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(var e=0;e<this._caps.maxVertexAttribs;e++)this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1}else for(var e=0,t=this._vertexAttribArraysEnabled.length;e<t;e++)e>=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||(this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1)},n.prototype.releaseEffects=function(){for(var e in this._compiledEffects)this._deleteProgram(this._compiledEffects[e]._program);this._compiledEffects={}},n.prototype.dispose=function(){for(this.hideLoadingUI(),this.stopRenderLoop();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();n.audioEngine&&n.audioEngine.dispose(),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.disableVR(),e.Tools.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),window.removeEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted),window.removeEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut),this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored))),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange),this._onVrDisplayConnect&&(window.removeEventListener("vrdisplayconnect",this._onVrDisplayConnect),this._onVrDisplayDisconnect&&window.removeEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),this._onVrDisplayPresentChange&&window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._onVrDisplayConnect=null,this._onVrDisplayDisconnect=null));var t=n.Instances.indexOf(this);t>=0&&n.Instances.splice(t,1),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers=[],this._renderingCanvas=null,this._currentProgram=null,this._bindedRenderFunction=null,this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear(),e.Effect.ResetCache();for(var r=0,i=this._activeRequests;r<i.length;r++){i[r].abort()}},n.prototype.displayLoadingUI=function(){if(e.Tools.IsWindowObjectExist()){var t=this.loadingScreen;t&&t.displayLoadingUI()}},n.prototype.hideLoadingUI=function(){if(e.Tools.IsWindowObjectExist()){var t=this.loadingScreen;t&&t.hideLoadingUI()}},Object.defineProperty(n.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&e.DefaultLoadingScreen&&this._renderingCanvas&&(this._loadingScreen=new e.DefaultLoadingScreen(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!0,configurable:!0}),n.prototype.attachContextLostEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)},n.prototype.attachContextRestoredEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)},n.prototype.getVertexShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null},n.prototype.getFragmentShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null},n.prototype.getError=function(){return this._gl.getError()},n.prototype.getFps=function(){return this._fps},n.prototype.getDeltaTime=function(){return this._deltaTime},n.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},n.prototype._readTexturePixels=function(e,t,r,i,n){void 0===i&&(i=-1),void 0===n&&(n=0);var o=this._gl;if(!this._dummyFramebuffer){var s=o.createFramebuffer();if(!s)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=s}o.bindFramebuffer(o.FRAMEBUFFER,this._dummyFramebuffer),i>-1?o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+i,e._webGLTexture,n):o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,e._webGLTexture,n);var a,l=void 0!==e.type?this._getWebGLTextureType(e.type):o.UNSIGNED_BYTE;switch(l){case o.UNSIGNED_BYTE:a=new Uint8Array(4*t*r),l=o.UNSIGNED_BYTE;break;default:a=new Float32Array(4*t*r),l=o.FLOAT}return o.readPixels(0,0,t,r,o.RGBA,l,a),o.bindFramebuffer(o.FRAMEBUFFER,this._currentFramebuffer),a},n.prototype._canRenderToFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(n.TEXTURETYPE_FLOAT)},n.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(n.TEXTURETYPE_HALF_FLOAT)},n.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var r=!0,i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if(r=r&&o===t.FRAMEBUFFER_COMPLETE,r=r&&t.getError()===t.NO_ERROR,r&&(t.clear(t.COLOR_BUFFER_BIT),r=r&&t.getError()===t.NO_ERROR),r){t.bindFramebuffer(t.FRAMEBUFFER,null);var s=t.RGBA,a=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,s,a,l),r=r&&t.getError()===t.NO_ERROR}for(t.deleteTexture(i),t.deleteFramebuffer(n),t.bindFramebuffer(t.FRAMEBUFFER,null);!r&&t.getError()!==t.NO_ERROR;);return r},n.prototype._getWebGLTextureType=function(e){return e===n.TEXTURETYPE_FLOAT?this._gl.FLOAT:e===n.TEXTURETYPE_HALF_FLOAT?this._gl.HALF_FLOAT_OES:this._gl.UNSIGNED_BYTE},n.prototype._getInternalFormat=function(e){var t=this._gl.RGBA;switch(e){case n.TEXTUREFORMAT_ALPHA:t=this._gl.ALPHA;break;case n.TEXTUREFORMAT_LUMINANCE:t=this._gl.LUMINANCE;break;case n.TEXTUREFORMAT_LUMINANCE_ALPHA:t=this._gl.LUMINANCE_ALPHA;break;case n.TEXTUREFORMAT_RGB:t=this._gl.RGB;break;case n.TEXTUREFORMAT_RGBA:t=this._gl.RGBA;break;case n.TEXTUREFORMAT_R:t=this._gl.RED;break;case n.TEXTUREFORMAT_RG:t=this._gl.RG}return t},n.prototype._getRGBABufferInternalSizedFormat=function(e,t){if(1===this._webGLVersion){if(void 0!==t)switch(t){case n.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case n.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA}return this._gl.RGBA}if(e===n.TEXTURETYPE_FLOAT){if(void 0!==t)switch(t){case n.TEXTUREFORMAT_R:return this._gl.R32F;case n.TEXTUREFORMAT_RG:return this._gl.RG32F;case n.TEXTUREFORMAT_RGB:return this._gl.RGB32F}return this._gl.RGBA32F}if(e===n.TEXTURETYPE_HALF_FLOAT){if(t)switch(t){case n.TEXTUREFORMAT_R:return this._gl.R16F;case n.TEXTUREFORMAT_RG:return this._gl.RG16F;case n.TEXTUREFORMAT_RGB:return this._gl.RGB16F}return this._gl.RGBA16F}if(void 0!==t)switch(t){case n.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case n.TEXTUREFORMAT_RGB:return this._gl.RGB;case n.TEXTUREFORMAT_R:return this._gl.R8;case n.TEXTUREFORMAT_RG:return this._gl.RG8;case n.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA}return this._gl.RGBA},n.prototype._getRGBAMultiSampleBufferFormat=function(e){return e===n.TEXTURETYPE_FLOAT?this._gl.RGBA32F:e===n.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},n.prototype.createQuery=function(){return this._gl.createQuery()},n.prototype.deleteQuery=function(e){return this._gl.deleteQuery(e),this},n.prototype.isQueryResultAvailable=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT_AVAILABLE)},n.prototype.getQueryResult=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT)},n.prototype.beginOcclusionQuery=function(e,t){var r=this.getGlAlgorithmType(e);return this._gl.beginQuery(r,t),this},n.prototype.endOcclusionQuery=function(e){var t=this.getGlAlgorithmType(e);return this._gl.endQuery(t),this},n.prototype._createTimeQuery=function(){var e=this._caps.timerQuery;return e.createQueryEXT?e.createQueryEXT():this.createQuery()},n.prototype._deleteTimeQuery=function(e){var t=this._caps.timerQuery;if(t.deleteQueryEXT)return void t.deleteQueryEXT(e);this.deleteQuery(e)},n.prototype._getTimeQueryResult=function(e){var t=this._caps.timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT):this.getQueryResult(e)},n.prototype._getTimeQueryAvailability=function(e){var t=this._caps.timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT):this.isQueryResultAvailable(e)},n.prototype.startTimeQuery=function(){var t=this._caps.timerQuery;if(!t)return null;var r=new e._TimeToken;if(this._gl.getParameter(t.GPU_DISJOINT_EXT),this._caps.canUseTimestampForTimerQuery)r._startTimeQuery=this._createTimeQuery(),t.queryCounterEXT(r._startTimeQuery,t.TIMESTAMP_EXT);else{if(this._currentNonTimestampToken)return this._currentNonTimestampToken;r._timeElapsedQuery=this._createTimeQuery(),t.beginQueryEXT?t.beginQueryEXT(t.TIME_ELAPSED_EXT,r._timeElapsedQuery):this._gl.beginQuery(t.TIME_ELAPSED_EXT,r._timeElapsedQuery),this._currentNonTimestampToken=r}return r},n.prototype.endTimeQuery=function(e){var t=this._caps.timerQuery;if(!t||!e)return-1;if(this._caps.canUseTimestampForTimerQuery){if(!e._startTimeQuery)return-1;e._endTimeQuery||(e._endTimeQuery=this._createTimeQuery(),t.queryCounterEXT(e._endTimeQuery,t.TIMESTAMP_EXT))}else if(!e._timeElapsedQueryEnded){if(!e._timeElapsedQuery)return-1;t.endQueryEXT?t.endQueryEXT(t.TIME_ELAPSED_EXT):this._gl.endQuery(t.TIME_ELAPSED_EXT),e._timeElapsedQueryEnded=!0}var r=this._gl.getParameter(t.GPU_DISJOINT_EXT),i=!1;if(e._endTimeQuery?i=this._getTimeQueryAvailability(e._endTimeQuery):e._timeElapsedQuery&&(i=this._getTimeQueryAvailability(e._timeElapsedQuery)),i&&!r){var n=0;if(this._caps.canUseTimestampForTimerQuery){if(!e._startTimeQuery||!e._endTimeQuery)return-1;var o=this._getTimeQueryResult(e._startTimeQuery);n=this._getTimeQueryResult(e._endTimeQuery)-o,this._deleteTimeQuery(e._startTimeQuery),this._deleteTimeQuery(e._endTimeQuery),e._startTimeQuery=null,e._endTimeQuery=null}else{if(!e._timeElapsedQuery)return-1;n=this._getTimeQueryResult(e._timeElapsedQuery),this._deleteTimeQuery(e._timeElapsedQuery),e._timeElapsedQuery=null,e._timeElapsedQueryEnded=!1,this._currentNonTimestampToken=null}return n}return-1},n.prototype.getGlAlgorithmType=function(t){return t===e.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},n.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},n.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},n.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},n.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},n.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},n.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},n.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e)},n.prototype._loadFile=function(t,r,i,n,o,s){var a=this,l=e.Tools.LoadFile(t,r,i,n,o,s);return this._activeRequests.push(l),l.onCompleteObservable.add((function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)})),l},n.prototype._loadFileAsync=function(e,t,r){var i=this;return new Promise(function(n,o){i._loadFile(e,(function(e){n(e)}),void 0,t,r,(function(e,t){o(t)}))})},n.prototype._partialLoadFile=function(e,t,r,i,n,o){void 0===o&&(o=null);var s=function(e){r[t]=e,6===++r._internalCount&&n(r)},a=function(e,t){o&&e&&o(e.status+" "+e.statusText,t)};this._loadFile(e,s,void 0,void 0,!0,a)},n.prototype._cascadeLoadFiles=function(e,t,r,i){void 0===i&&(i=null);var n=[];n._internalCount=0;for(var o=0;o<6;o++)this._partialLoadFile(r[o],o,n,e,t,i)},n.isSupported=function(){try{var e=document.createElement("canvas");return null!=(e.getContext("webgl")||e.getContext("experimental-webgl"))&&!!window.WebGLRenderingContext}catch(e){return!1}},n.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Macintosh",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]},{key:"iPhone",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]},{key:"iPad",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]}],n.Instances=new Array,n._ALPHA_DISABLE=0,n._ALPHA_ADD=1,n._ALPHA_COMBINE=2,n._ALPHA_SUBTRACT=3,n._ALPHA_MULTIPLY=4,n._ALPHA_MAXIMIZED=5,n._ALPHA_ONEONE=6,n._ALPHA_PREMULTIPLIED=7,n._ALPHA_PREMULTIPLIED_PORTERDUFF=8,n._ALPHA_INTERPOLATE=9,n._ALPHA_SCREENMODE=10,n._DELAYLOADSTATE_NONE=0,n._DELAYLOADSTATE_LOADED=1,n._DELAYLOADSTATE_LOADING=2,n._DELAYLOADSTATE_NOTLOADED=4,n._TEXTUREFORMAT_ALPHA=0,n._TEXTUREFORMAT_LUMINANCE=1,n._TEXTUREFORMAT_LUMINANCE_ALPHA=2,n._TEXTUREFORMAT_RGB=4,n._TEXTUREFORMAT_RGBA=5,n._TEXTUREFORMAT_R=6,n._TEXTUREFORMAT_RG=7,n._TEXTURETYPE_UNSIGNED_INT=0,n._TEXTURETYPE_FLOAT=1,n._TEXTURETYPE_HALF_FLOAT=2,n._NEVER=512,n._ALWAYS=519,n._LESS=513,n._EQUAL=514,n._LEQUAL=515,n._GREATER=516,n._GEQUAL=518,n._NOTEQUAL=517,n._KEEP=7680,n._REPLACE=7681,n._INCR=7682,n._DECR=7683,n._INVERT=5386,n._INCR_WRAP=34055,n._DECR_WRAP=34056,n._SCALEMODE_FLOOR=1,n._SCALEMODE_NEAREST=2,n._SCALEMODE_CEILING=3,n.CollisionsEpsilon=.001,n.CodeRepository="src/",n.ShadersRepository="src/Shaders/",n})();e.Engine=f})(n||(n={}));var n;!(function(e){var t=(function(){function t(t,r){void 0===r&&(r=null),this.state="",this.metadata=null,this.doNotSerialize=!1,this._isDisposed=!1,this.animations=new Array,this._ranges={},this._isEnabled=!0,this._isReady=!0,this._currentRenderId=-1,this._parentRenderId=-1,this._childRenderId=-1,this._animationPropertiesOverride=null,this.onDisposeObservable=new e.Observable,this._behaviors=new Array,this.name=t,this.id=t,this._scene=r||e.Engine.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache()}return t.prototype.isDisposed=function(){return this._isDisposed},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parentNode},set:function(e){if(this._parentNode!==e){if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){var t=this._parentNode._children.indexOf(this);-1!==t&&this._parentNode._children.splice(t,1)}this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this))}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"Node"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype.getEngine=function(){return this._scene.getEngine()},t.prototype.addBehavior=function(e){var t=this;return-1!==this._behaviors.indexOf(e)?this:(e.init(),this._scene.isLoading?this._scene.onDataLoadedObservable.addOnce((function(){e.attach(t)})):e.attach(this),this._behaviors.push(e),this)},t.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t?this:(this._behaviors[t].detach(),this._behaviors.splice(t,1),this)},Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!0,configurable:!0}),t.prototype.getBehaviorByName=function(e){for(var t=0,r=this._behaviors;t<r.length;t++){var i=r[t];if(i.name===e)return i}return null},t.prototype.getWorldMatrix=function(){return e.Matrix.Identity()},t.prototype._getWorldMatrixDeterminant=function(){return 1},t.prototype._initCache=function(){this._cache={},this._cache.parent=void 0},t.prototype.updateCache=function(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())},t.prototype._updateCache=function(e){},t.prototype._isSynchronized=function(){return!0},t.prototype._markSyncedWithParent=function(){this.parent&&(this._parentRenderId=this.parent._childRenderId)},t.prototype.isSynchronizedWithParent=function(){return!this.parent||this._parentRenderId===this.parent._childRenderId&&this.parent.isSynchronized()},t.prototype.isSynchronized=function(e){var t=this.hasNewParent();return t=t||!this.isSynchronizedWithParent(),t=t||!this._isSynchronized(),e&&this.updateCache(!0),!t},t.prototype.hasNewParent=function(e){return this._cache.parent!==this.parent&&(e&&(this._cache.parent=this.parent),!0)},t.prototype.isReady=function(e){return void 0===e&&(e=!1),this._isReady},t.prototype.isEnabled=function(e){return void 0===e&&(e=!0),!1===e?this._isEnabled:!1!==this._isEnabled&&(void 0===this.parent||null===this.parent||this.parent.isEnabled(e))},t.prototype.setEnabled=function(e){this._isEnabled=e},t.prototype.isDescendantOf=function(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))},t.prototype._getDescendants=function(e,t,r){if(void 0===t&&(t=!1),this._children)for(var i=0;i<this._children.length;i++){var n=this._children[i];r&&!r(n)||e.push(n),t||n._getDescendants(e,!1,r)}},t.prototype.getDescendants=function(e,t){var r=new Array;return this._getDescendants(r,e,t),r},t.prototype.getChildMeshes=function(t,r){var i=[];return this._getDescendants(i,t,(function(t){return(!r||r(t))&&t instanceof e.AbstractMesh})),i},t.prototype.getChildTransformNodes=function(t,r){var i=[];return this._getDescendants(i,t,(function(t){return(!r||r(t))&&t instanceof e.TransformNode})),i},t.prototype.getChildren=function(e){return this.getDescendants(!0,e)},t.prototype._setReady=function(e){if(e!==this._isReady){if(!e)return void(this._isReady=!1);this.onReady&&this.onReady(this),this._isReady=!0}},t.prototype.getAnimationByName=function(e){for(var t=0;t<this.animations.length;t++){var r=this.animations[t];if(r.name===e)return r}return null},t.prototype.createAnimationRange=function(t,r,i){if(!this._ranges[t]){this._ranges[t]=new e.AnimationRange(t,r,i);for(var n=0,o=this.animations.length;n<o;n++)this.animations[n]&&this.animations[n].createRange(t,r,i)}},t.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var r=0,i=this.animations.length;r<i;r++)this.animations[r]&&this.animations[r].deleteRange(e,t);this._ranges[e]=null},t.prototype.getAnimationRange=function(e){return this._ranges[e]},t.prototype.beginAnimation=function(e,t,r,i){var n=this.getAnimationRange(e);return n?this._scene.beginAnimation(this,n.from,n.to,t,r,i):null},t.prototype.serializeAnimationRanges=function(){var e=[];for(var t in this._ranges){var r=this._ranges[t];if(r){var i={};i.name=t,i.from=r.from,i.to=r.to,e.push(i)}}return e},t.prototype.computeWorldMatrix=function(t){return e.Matrix.Identity()},t.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),e)for(var r=this.getChildTransformNodes(!0),i=0,n=r;i<n.length;i++){var o=n[i];o.parent=null,o.computeWorldMatrix(!0)
- }else for(var s=this.getDescendants(!0),a=0,l=s;a<l.length;a++){var u=l[a];u.dispose(e,t)}this.parent=null,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear();for(var h=0,c=this._behaviors;h<c.length;h++){c[h].detach()}this._behaviors=[],this._isDisposed=!0},t.ParseAnimationRanges=function(e,t,r){if(t.ranges)for(var i=0;i<t.ranges.length;i++){var n=t.ranges[i];e.createAnimationRange(n.name,n.from,n.to)}},o([e.serialize()],t.prototype,"name",void 0),o([e.serialize()],t.prototype,"id",void 0),o([e.serialize()],t.prototype,"uniqueId",void 0),o([e.serialize()],t.prototype,"state",void 0),o([e.serialize()],t.prototype,"metadata",void 0),t})();e.Node=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(t,r){this._tempRadiusVector=e.Vector3.Zero(),this.reConstruct(t,r)}return t.prototype.reConstruct=function(t,r){this.minimum=t.clone(),this.maximum=r.clone();var i=e.Vector3.Distance(t,r);this.center=e.Vector3.Lerp(t,r,.5),this.radius=.5*i,this.centerWorld=e.Vector3.Zero(),this._update(e.Matrix.Identity())},t.prototype._update=function(t){e.Vector3.TransformCoordinatesToRef(this.center,t,this.centerWorld),e.Vector3.TransformNormalFromFloatsToRef(1,1,1,t,this._tempRadiusVector),this.radiusWorld=Math.max(Math.abs(this._tempRadiusVector.x),Math.abs(this._tempRadiusVector.y),Math.abs(this._tempRadiusVector.z))*this.radius},t.prototype.isInFrustum=function(e){for(var t=0;t<6;t++)if(e[t].dotCoordinate(this.centerWorld)<=-this.radiusWorld)return!1;return!0},t.prototype.intersectsPoint=function(t){var r=this.centerWorld.x-t.x,i=this.centerWorld.y-t.y,n=this.centerWorld.z-t.z,o=Math.sqrt(r*r+i*i+n*n);return!(Math.abs(this.radiusWorld-o)<e.Epsilon)},t.Intersects=function(e,t){var r=e.centerWorld.x-t.centerWorld.x,i=e.centerWorld.y-t.centerWorld.y,n=e.centerWorld.z-t.centerWorld.z,o=Math.sqrt(r*r+i*i+n*n);return!(e.radiusWorld+t.radiusWorld<o)},t})();e.BoundingSphere=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(e,t){this.vectorsWorld=new Array,this.reConstruct(e,t)}return t.prototype.reConstruct=function(t,r){this.minimum=t.clone(),this.maximum=r.clone(),this.vectors=new Array,this.vectors.push(this.minimum.clone()),this.vectors.push(this.maximum.clone()),this.vectors.push(this.minimum.clone()),this.vectors[2].x=this.maximum.x,this.vectors.push(this.minimum.clone()),this.vectors[3].y=this.maximum.y,this.vectors.push(this.minimum.clone()),this.vectors[4].z=this.maximum.z,this.vectors.push(this.maximum.clone()),this.vectors[5].z=this.minimum.z,this.vectors.push(this.maximum.clone()),this.vectors[6].x=this.minimum.x,this.vectors.push(this.maximum.clone()),this.vectors[7].y=this.minimum.y,this.center=this.maximum.add(this.minimum).scale(.5),this.extendSize=this.maximum.subtract(this.minimum).scale(.5),this.directions=[e.Vector3.Zero(),e.Vector3.Zero(),e.Vector3.Zero()];for(var i=0;i<this.vectors.length;i++)this.vectorsWorld[i]=e.Vector3.Zero();this.minimumWorld=e.Vector3.Zero(),this.maximumWorld=e.Vector3.Zero(),this.centerWorld=e.Vector3.Zero(),this.extendSizeWorld=e.Vector3.Zero(),this._update(this._worldMatrix||e.Matrix.Identity())},t.prototype.getWorldMatrix=function(){return this._worldMatrix},t.prototype.setWorldMatrix=function(e){return this._worldMatrix.copyFrom(e),this},t.prototype._update=function(t){e.Vector3.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,this.minimumWorld),e.Vector3.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,this.maximumWorld);for(var r=0;r<this.vectors.length;r++){var i=this.vectorsWorld[r];e.Vector3.TransformCoordinatesToRef(this.vectors[r],t,i),i.x<this.minimumWorld.x&&(this.minimumWorld.x=i.x),i.y<this.minimumWorld.y&&(this.minimumWorld.y=i.y),i.z<this.minimumWorld.z&&(this.minimumWorld.z=i.z),i.x>this.maximumWorld.x&&(this.maximumWorld.x=i.x),i.y>this.maximumWorld.y&&(this.maximumWorld.y=i.y),i.z>this.maximumWorld.z&&(this.maximumWorld.z=i.z)}this.maximumWorld.subtractToRef(this.minimumWorld,this.extendSizeWorld),this.extendSizeWorld.scaleInPlace(.5),this.maximumWorld.addToRef(this.minimumWorld,this.centerWorld),this.centerWorld.scaleInPlace(.5),e.Vector3.FromFloatArrayToRef(t.m,0,this.directions[0]),e.Vector3.FromFloatArrayToRef(t.m,4,this.directions[1]),e.Vector3.FromFloatArrayToRef(t.m,8,this.directions[2]),this._worldMatrix=t},t.prototype.isInFrustum=function(e){return t.IsInFrustum(this.vectorsWorld,e)},t.prototype.isCompletelyInFrustum=function(e){return t.IsCompletelyInFrustum(this.vectorsWorld,e)},t.prototype.intersectsPoint=function(t){var r=-e.Epsilon;return!(this.maximumWorld.x-t.x<r||r>t.x-this.minimumWorld.x)&&(!(this.maximumWorld.y-t.y<r||r>t.y-this.minimumWorld.y)&&!(this.maximumWorld.z-t.z<r||r>t.z-this.minimumWorld.z))},t.prototype.intersectsSphere=function(e){return t.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)},t.prototype.intersectsMinMax=function(e,t){return!(this.maximumWorld.x<e.x||this.minimumWorld.x>t.x)&&(!(this.maximumWorld.y<e.y||this.minimumWorld.y>t.y)&&!(this.maximumWorld.z<e.z||this.minimumWorld.z>t.z))},t.Intersects=function(e,t){return!(e.maximumWorld.x<t.minimumWorld.x||e.minimumWorld.x>t.maximumWorld.x)&&(!(e.maximumWorld.y<t.minimumWorld.y||e.minimumWorld.y>t.maximumWorld.y)&&!(e.maximumWorld.z<t.minimumWorld.z||e.minimumWorld.z>t.maximumWorld.z))},t.IntersectsSphere=function(t,r,i,n){var o=e.Vector3.Clamp(i,t,r);return e.Vector3.DistanceSquared(i,o)<=n*n},t.IsCompletelyInFrustum=function(e,t){for(var r=0;r<6;r++)for(var i=0;i<8;i++)if(t[r].dotCoordinate(e[i])<0)return!1;return!0},t.IsInFrustum=function(e,t){for(var r=0;r<6;r++){for(var i=8,n=0;n<8&&t[r].dotCoordinate(e[n])<0;n++)--i;if(0===i)return!1}return!0},t})();e.BoundingBox=t})(n||(n={}));var n;!(function(e){var t=function(t,r){var i=e.Vector3.Dot(r.centerWorld,t),n=Math.abs(e.Vector3.Dot(r.directions[0],t))*r.extendSize.x,o=Math.abs(e.Vector3.Dot(r.directions[1],t))*r.extendSize.y,s=Math.abs(e.Vector3.Dot(r.directions[2],t))*r.extendSize.z,a=n+o+s;return{min:i-a,max:i+a}},r=function(e,t,r,i){return!(e>i||r>t)},i=function(e,i,n){var o=t(e,i),s=t(e,n);return r(o.min,o.max,s.min,s.max)},n=(function(){function t(t,r){this.minimum=t,this.maximum=r,this._isLocked=!1,this.boundingBox=new e.BoundingBox(t,r),this.boundingSphere=new e.BoundingSphere(t,r)}return Object.defineProperty(t.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!0,configurable:!0}),t.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},t.prototype.centerOn=function(t,r){return this.minimum=t.subtract(r),this.maximum=t.add(r),this.boundingBox=new e.BoundingBox(this.minimum,this.maximum),this.boundingSphere=new e.BoundingSphere(this.minimum,this.maximum),this},t.prototype.isInFrustum=function(e){return!!this.boundingSphere.isInFrustum(e)&&this.boundingBox.isInFrustum(e)},Object.defineProperty(t.prototype,"diagonalLength",{get:function(){var e=this.boundingBox;return e.maximumWorld.subtract(e.minimumWorld).length()},enumerable:!0,configurable:!0}),t.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},t.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},t.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},t.prototype.intersects=function(t,r){if(!this.boundingSphere.centerWorld||!t.boundingSphere.centerWorld)return!1;if(!e.BoundingSphere.Intersects(this.boundingSphere,t.boundingSphere))return!1;if(!e.BoundingBox.Intersects(this.boundingBox,t.boundingBox))return!1;if(!r)return!0;var n=this.boundingBox,o=t.boundingBox;return!!i(n.directions[0],n,o)&&(!!i(n.directions[1],n,o)&&(!!i(n.directions[2],n,o)&&(!!i(o.directions[0],n,o)&&(!!i(o.directions[1],n,o)&&(!!i(o.directions[2],n,o)&&(!!i(e.Vector3.Cross(n.directions[0],o.directions[0]),n,o)&&(!!i(e.Vector3.Cross(n.directions[0],o.directions[1]),n,o)&&(!!i(e.Vector3.Cross(n.directions[0],o.directions[2]),n,o)&&(!!i(e.Vector3.Cross(n.directions[1],o.directions[0]),n,o)&&(!!i(e.Vector3.Cross(n.directions[1],o.directions[1]),n,o)&&(!!i(e.Vector3.Cross(n.directions[1],o.directions[2]),n,o)&&(!!i(e.Vector3.Cross(n.directions[2],o.directions[0]),n,o)&&(!!i(e.Vector3.Cross(n.directions[2],o.directions[1]),n,o)&&!!i(e.Vector3.Cross(n.directions[2],o.directions[2]),n,o))))))))))))))},t})();e.BoundingInfo=n})(n||(n={}));var n;!(function(e){var t=(function(t){function r(i,n,o){void 0===n&&(n=null),void 0===o&&(o=!0);var s=t.call(this,i,n)||this;return s._forward=new e.Vector3(0,0,1),s._forwardInverted=new e.Vector3(0,0,-1),s._up=new e.Vector3(0,1,0),s._right=new e.Vector3(1,0,0),s._rightInverted=new e.Vector3(-1,0,0),s._rotation=e.Vector3.Zero(),s._scaling=e.Vector3.One(),s._isDirty=!1,s.billboardMode=r.BILLBOARDMODE_NONE,s.scalingDeterminant=1,s.infiniteDistance=!1,s.ignoreNonUniformScaling=!1,s.position=e.Vector3.Zero(),s._localWorld=e.Matrix.Zero(),s._worldMatrix=e.Matrix.Zero(),s._worldMatrixDeterminant=0,s._absolutePosition=e.Vector3.Zero(),s._pivotMatrix=e.Matrix.Identity(),s._postMultiplyPivotMatrix=!1,s._isWorldMatrixFrozen=!1,s.onAfterWorldMatrixUpdateObservable=new e.Observable,s._nonUniformScaling=!1,o&&s.getScene().addTransformNode(s),s}return s(r,t),r.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){this._rotationQuaternion=e,e&&this.rotation.length()&&this.rotation.copyFromFloats(0,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"forward",{get:function(){return e.Vector3.Normalize(e.Vector3.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"up",{get:function(){return e.Vector3.Normalize(e.Vector3.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return e.Vector3.Normalize(e.Vector3.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),r.prototype.getWorldMatrix=function(){return this._currentRenderId!==this.getScene().getRenderId()&&this.computeWorldMatrix(),this._worldMatrix},r.prototype._getWorldMatrixDeterminant=function(){return this._worldMatrixDeterminant},Object.defineProperty(r.prototype,"worldMatrixFromCache",{get:function(){return this._worldMatrix},enumerable:!0,configurable:!0}),r.prototype.updatePoseMatrix=function(e){return this._poseMatrix.copyFrom(e),this},r.prototype.getPoseMatrix=function(){return this._poseMatrix},r.prototype._isSynchronized=function(){return!this._isDirty&&(this.billboardMode===this._cache.billboardMode&&this.billboardMode===r.BILLBOARDMODE_NONE&&(!this._cache.pivotMatrixUpdated&&(!this.infiniteDistance&&(!!this._cache.position.equals(this.position)&&(!(this.rotationQuaternion&&!this._cache.rotationQuaternion.equals(this.rotationQuaternion))&&(!!this._cache.rotation.equals(this.rotation)&&!!this._cache.scaling.equals(this.scaling)))))))},r.prototype._initCache=function(){t.prototype._initCache.call(this),this._cache.localMatrixUpdated=!1,this._cache.position=e.Vector3.Zero(),this._cache.scaling=e.Vector3.Zero(),this._cache.rotation=e.Vector3.Zero(),this._cache.rotationQuaternion=new e.Quaternion(0,0,0,0),this._cache.billboardMode=-1},r.prototype.markAsDirty=function(e){return"rotation"===e&&(this.rotationQuaternion=null),this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(r.prototype,"absolutePosition",{get:function(){return this._absolutePosition},enumerable:!0,configurable:!0}),r.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},r.prototype.setPivotMatrix=function(t,r){return void 0===r&&(r=!0),this._pivotMatrix=t.clone(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=r,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=e.Matrix.Invert(this._pivotMatrix)),this},r.prototype.getPivotMatrix=function(){return this._pivotMatrix},r.prototype.freezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this._isWorldMatrixFrozen=!0,this},r.prototype.unfreezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this},Object.defineProperty(r.prototype,"isWorldMatrixFrozen",{get:function(){return this._isWorldMatrixFrozen},enumerable:!0,configurable:!0}),r.prototype.getAbsolutePosition=function(){return this.computeWorldMatrix(),this._absolutePosition},r.prototype.setAbsolutePosition=function(t){if(!t)return this;var r,i,n;if(void 0===t.x){if(arguments.length<3)return this;r=arguments[0],i=arguments[1],n=arguments[2]}else r=t.x,i=t.y,n=t.z;if(this.parent){var o=this.parent.getWorldMatrix().clone();o.invert();var s=new e.Vector3(r,i,n);this.position=e.Vector3.TransformCoordinates(s,o)}else this.position.x=r,this.position.y=i,this.position.z=n;return this},r.prototype.setPositionWithLocalVector=function(t){return this.computeWorldMatrix(),this.position=e.Vector3.TransformNormal(t,this._localWorld),this},r.prototype.getPositionExpressedInLocalSpace=function(){this.computeWorldMatrix();var t=this._localWorld.clone();return t.invert(),e.Vector3.TransformNormal(this.position,t)},r.prototype.locallyTranslate=function(t){return this.computeWorldMatrix(!0),this.position=e.Vector3.TransformCoordinates(t,this._localWorld),this},r.prototype.lookAt=function(t,i,n,o,s){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=e.Space.LOCAL);var a=r._lookAtVectorCache,l=s===e.Space.LOCAL?this.position:this.getAbsolutePosition();t.subtractToRef(l,a);var u=-Math.atan2(a.z,a.x)-Math.PI/2,h=Math.sqrt(a.x*a.x+a.z*a.z),c=Math.atan2(a.y,h);return this.rotationQuaternion?e.Quaternion.RotationYawPitchRollToRef(u+i,c+n,o,this.rotationQuaternion):(this.rotation.x=c+n,this.rotation.y=u+i,this.rotation.z=o),this},r.prototype.getDirection=function(t){var r=e.Vector3.Zero();return this.getDirectionToRef(t,r),r},r.prototype.getDirectionToRef=function(t,r){return e.Vector3.TransformNormalToRef(t,this.getWorldMatrix(),r),this},r.prototype.setPivotPoint=function(t,r){void 0===r&&(r=e.Space.LOCAL),0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);var i=this.getWorldMatrix();if(r==e.Space.WORLD){var n=e.Tmp.Matrix[0];i.invertToRef(n),t=e.Vector3.TransformCoordinates(t,n)}return this.setPivotMatrix(e.Matrix.Translation(-t.x,-t.y,-t.z),!0)},r.prototype.getPivotPoint=function(){var t=e.Vector3.Zero();return this.getPivotPointToRef(t),t},r.prototype.getPivotPointToRef=function(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this},r.prototype.getAbsolutePivotPoint=function(){var t=e.Vector3.Zero();return this.getAbsolutePivotPointToRef(t),t},r.prototype.getAbsolutePivotPointToRef=function(t){return t.x=this._pivotMatrix.m[12],t.y=this._pivotMatrix.m[13],t.z=this._pivotMatrix.m[14],this.getPivotPointToRef(t),e.Vector3.TransformCoordinatesToRef(t,this.getWorldMatrix(),t),this},r.prototype.setParent=function(t){if(null===t){var r=e.Tmp.Quaternion[0],i=e.Tmp.Vector3[0],n=e.Tmp.Vector3[1];this.parent&&this.parent.computeWorldMatrix&&this.parent.computeWorldMatrix(!0),this.computeWorldMatrix(!0),this.getWorldMatrix().decompose(n,r,i),this.rotationQuaternion?this.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(this.rotation),this.scaling.x=n.x,this.scaling.y=n.y,this.scaling.z=n.z,this.position.x=i.x,this.position.y=i.y,this.position.z=i.z}else{var r=e.Tmp.Quaternion[0],i=e.Tmp.Vector3[0],n=e.Tmp.Vector3[1],o=e.Tmp.Matrix[0],s=e.Tmp.Matrix[1];this.computeWorldMatrix(!0),t.computeWorldMatrix(!0),t.getWorldMatrix().invertToRef(s),this.getWorldMatrix().multiplyToRef(s,o),o.decompose(n,r,i),this.rotationQuaternion?this.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(this.rotation),this.position.x=i.x,this.position.y=i.y,this.position.z=i.z,this.scaling.x=n.x,this.scaling.y=n.y,this.scaling.z=n.z}return this.parent=t,this},Object.defineProperty(r.prototype,"nonUniformScaling",{get:function(){return this._nonUniformScaling},enumerable:!0,configurable:!0}),r.prototype._updateNonUniformScalingState=function(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)},r.prototype.attachToBone=function(e,t){return this._transformToBoneReferal=t,this.parent=e,e.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this},r.prototype.detachFromBone=function(){return this.parent?(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,this.parent=null,this):this},r.prototype.rotate=function(t,i,n){t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=e.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation=e.Vector3.Zero());var o;if(n&&n!==e.Space.LOCAL){if(this.parent){var s=this.parent.getWorldMatrix().clone();s.invert(),t=e.Vector3.TransformNormal(t,s)}o=e.Quaternion.RotationAxisToRef(t,i,r._rotationAxisCache),o.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}else o=e.Quaternion.RotationAxisToRef(t,i,r._rotationAxisCache),this.rotationQuaternion.multiplyToRef(o,this.rotationQuaternion);return this},r.prototype.rotateAround=function(t,r,i){return r.normalize(),this.rotationQuaternion||(this.rotationQuaternion=e.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.copyFromFloats(0,0,0)),t.subtractToRef(this.position,e.Tmp.Vector3[0]),e.Matrix.TranslationToRef(e.Tmp.Vector3[0].x,e.Tmp.Vector3[0].y,e.Tmp.Vector3[0].z,e.Tmp.Matrix[0]),e.Tmp.Matrix[0].invertToRef(e.Tmp.Matrix[2]),e.Matrix.RotationAxisToRef(r,i,e.Tmp.Matrix[1]),e.Tmp.Matrix[2].multiplyToRef(e.Tmp.Matrix[1],e.Tmp.Matrix[2]),e.Tmp.Matrix[2].multiplyToRef(e.Tmp.Matrix[0],e.Tmp.Matrix[2]),e.Tmp.Matrix[2].decompose(e.Tmp.Vector3[0],e.Tmp.Quaternion[0],e.Tmp.Vector3[1]),this.position.addInPlace(e.Tmp.Vector3[1]),e.Tmp.Quaternion[0].multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this},r.prototype.translate=function(t,r,i){var n=t.scale(r);if(i&&i!==e.Space.LOCAL)this.setAbsolutePosition(this.getAbsolutePosition().add(n));else{var o=this.getPositionExpressedInLocalSpace().add(n);this.setPositionWithLocalVector(o)}return this},r.prototype.addRotation=function(t,r,i){var n;this.rotationQuaternion?n=this.rotationQuaternion:(n=e.Tmp.Quaternion[1],e.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,n));var o=e.Tmp.Quaternion[0];return e.Quaternion.RotationYawPitchRollToRef(r,t,i,o),n.multiplyInPlace(o),this.rotationQuaternion||n.toEulerAnglesToRef(this.rotation),this},r.prototype.computeWorldMatrix=function(t){if(this._isWorldMatrixFrozen)return this._worldMatrix;if(!t&&this.isSynchronized(!0))return this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix;if(this._cache.position.copyFrom(this.position),this._cache.scaling.copyFrom(this.scaling),this._cache.pivotMatrixUpdated=!1,this._cache.billboardMode=this.billboardMode,this._currentRenderId=this.getScene().getRenderId(),this._childRenderId=this.getScene().getRenderId(),this._isDirty=!1,e.Matrix.ScalingToRef(this.scaling.x*this.scalingDeterminant,this.scaling.y*this.scalingDeterminant,this.scaling.z*this.scalingDeterminant,e.Tmp.Matrix[1]),this.rotationQuaternion){this.rotation.length()&&(this.rotationQuaternion.multiplyInPlace(e.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)),this.rotation.copyFromFloats(0,0,0))}this.rotationQuaternion?(this.rotationQuaternion.toRotationMatrix(e.Tmp.Matrix[0]),this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)):(e.Matrix.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,e.Tmp.Matrix[0]),this._cache.rotation.copyFrom(this.rotation));var i=this.getScene().activeCamera;if(this.infiniteDistance&&!this.parent&&i){var n=i.getWorldMatrix(),o=new e.Vector3(n.m[12],n.m[13],n.m[14]);e.Matrix.TranslationToRef(this.position.x+o.x,this.position.y+o.y,this.position.z+o.z,e.Tmp.Matrix[2])}else e.Matrix.TranslationToRef(this.position.x,this.position.y,this.position.z,e.Tmp.Matrix[2]);if(this._pivotMatrix.multiplyToRef(e.Tmp.Matrix[1],e.Tmp.Matrix[4]),e.Tmp.Matrix[4].multiplyToRef(e.Tmp.Matrix[0],e.Tmp.Matrix[5]),this.billboardMode!==r.BILLBOARDMODE_NONE&&i){if((this.billboardMode&r.BILLBOARDMODE_ALL)!==r.BILLBOARDMODE_ALL){var s=e.Tmp.Vector3[3];this.parent&&this.parent.getWorldMatrix?this._transformToBoneReferal?(this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),e.Tmp.Matrix[6]),e.Vector3.TransformCoordinatesToRef(this.position,e.Tmp.Matrix[6],s)):e.Vector3.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),s):s.copyFrom(this.position),s.subtractInPlace(i.globalPosition);var a=e.Tmp.Vector3[4].copyFromFloats(0,0,0);(this.billboardMode&r.BILLBOARDMODE_X)===r.BILLBOARDMODE_X&&(a.x=Math.atan2(-s.y,s.z)),(this.billboardMode&r.BILLBOARDMODE_Y)===r.BILLBOARDMODE_Y&&(a.y=Math.atan2(s.x,s.z)),(this.billboardMode&r.BILLBOARDMODE_Z)===r.BILLBOARDMODE_Z&&(a.z=Math.atan2(s.y,s.x)),e.Matrix.RotationYawPitchRollToRef(a.y,a.x,a.z,e.Tmp.Matrix[0])}else e.Tmp.Matrix[1].copyFrom(i.getViewMatrix()),e.Tmp.Matrix[1].setTranslationFromFloats(0,0,0),e.Tmp.Matrix[1].invertToRef(e.Tmp.Matrix[0]);e.Tmp.Matrix[1].copyFrom(e.Tmp.Matrix[5]),e.Tmp.Matrix[1].multiplyToRef(e.Tmp.Matrix[0],e.Tmp.Matrix[5])}return e.Tmp.Matrix[5].multiplyToRef(e.Tmp.Matrix[2],this._localWorld),this.parent&&this.parent.getWorldMatrix?(this.billboardMode!==r.BILLBOARDMODE_NONE?(this._transformToBoneReferal?(this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),e.Tmp.Matrix[6]),e.Tmp.Matrix[5].copyFrom(e.Tmp.Matrix[6])):e.Tmp.Matrix[5].copyFrom(this.parent.getWorldMatrix()),this._localWorld.getTranslationToRef(e.Tmp.Vector3[5]),e.Vector3.TransformCoordinatesToRef(e.Tmp.Vector3[5],e.Tmp.Matrix[5],e.Tmp.Vector3[5]),this._worldMatrix.copyFrom(this._localWorld),this._worldMatrix.setTranslation(e.Tmp.Vector3[5])):this._transformToBoneReferal?(this._localWorld.multiplyToRef(this.parent.getWorldMatrix(),e.Tmp.Matrix[6]),e.Tmp.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)):this._localWorld.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()):this._worldMatrix.copyFrom(this._localWorld),this._postMultiplyPivotMatrix&&this._worldMatrix.multiplyToRef(this._pivotMatrixInverse,this._worldMatrix),this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this.scaling.isNonUniform?this._updateNonUniformScalingState(!0):this.parent&&this.parent._nonUniformScaling?this._updateNonUniformScalingState(this.parent._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=e.Matrix.Invert(this._worldMatrix)),this._worldMatrixDeterminant=this._worldMatrix.determinant(),this._worldMatrix},r.prototype._afterComputeWorldMatrix=function(){},r.prototype.registerAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.add(e),this},r.prototype.unregisterAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.removeCallback(e),this},r.prototype.clone=function(t,i,n){var o=this,s=e.SerializationHelper.Clone((function(){return new r(t,o.getScene())}),this);if(s.name=t,s.id=t,i&&(s.parent=i),!n)for(var a=this.getDescendants(!0),l=0;l<a.length;l++){var u=a[l];u.clone&&u.clone(t+"."+u.name,s)}return s},r.prototype.serialize=function(t){var r=e.SerializationHelper.Serialize(this,t);return r.type=this.getClassName(),this.parent&&(r.parentId=this.parent.id),e.Tags&&e.Tags.HasTags(this)&&(r.tags=e.Tags.GetTags(this)),r.localMatrix=this.getPivotMatrix().asArray(),r.isEnabled=this.isEnabled(),this.parent&&(r.parentId=this.parent.id),r},r.Parse=function(t,i,n){var o=e.SerializationHelper.Parse((function(){return new r(t.name,i)}),t,i,n);return e.Tags&&e.Tags.AddTagsTo(o,t.tags),t.localMatrix?o.setPreTransformMatrix(e.Matrix.FromArray(t.localMatrix)):t.pivotMatrix&&o.setPivotMatrix(e.Matrix.FromArray(t.pivotMatrix)),o.setEnabled(t.isEnabled),t.parentId&&(o._waitingParentId=t.parentId),o},r.prototype.dispose=function(e,r){void 0===r&&(r=!1),this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this.onAfterWorldMatrixUpdateObservable.clear(),t.prototype.dispose.call(this,e,r)},r.BILLBOARDMODE_NONE=0,r.BILLBOARDMODE_X=1,r.BILLBOARDMODE_Y=2,r.BILLBOARDMODE_Z=4,r.BILLBOARDMODE_ALL=7,r._lookAtVectorCache=new e.Vector3(0,0,0),r._rotationAxisCache=new e.Quaternion,o([e.serializeAsVector3()],r.prototype,"_rotation",void 0),o([e.serializeAsQuaternion()],r.prototype,"_rotationQuaternion",void 0),o([e.serializeAsVector3()],r.prototype,"_scaling",void 0),o([e.serialize()],r.prototype,"billboardMode",void 0),o([e.serialize()],r.prototype,"scalingDeterminant",void 0),o([e.serialize()],r.prototype,"infiniteDistance",void 0),o([e.serialize()],r.prototype,"ignoreNonUniformScaling",void 0),o([e.serializeAsVector3()],r.prototype,"position",void 0),r})(e.Node);e.TransformNode=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(i,n){void 0===n&&(n=null);var o=t.call(this,i,n,!1)||this;return o._facetNb=0,o._partitioningSubdivisions=10,o._partitioningBBoxRatio=1.01,o._facetDataEnabled=!1,o._facetParameters={},o._bbSize=e.Vector3.Zero(),o._subDiv={max:1,X:1,Y:1,Z:1},o._facetDepthSort=!1,o._facetDepthSortEnabled=!1,o.onCollideObservable=new e.Observable,o.onCollisionPositionChangeObservable=new e.Observable,o.onMaterialChangedObservable=new e.Observable,o.definedFacingForward=!0,o.occlusionQueryAlgorithmType=r.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE,o.occlusionType=r.OCCLUSION_TYPE_NONE,o.occlusionRetryCount=-1,o._occlusionInternalRetryCounter=0,o._isOccluded=!1,o._isOcclusionQueryInProgress=!1,o._visibility=1,o.alphaIndex=Number.MAX_VALUE,o.isVisible=!0,o.isPickable=!0,o.showBoundingBox=!1,o.showSubMeshesBoundingBox=!1,o.isBlocker=!1,o.enablePointerMoveEvents=!1,o.renderingGroupId=0,o._receiveShadows=!1,o.renderOutline=!1,o.outlineColor=e.Color3.Red(),o.outlineWidth=.02,o.renderOverlay=!1,o.overlayColor=e.Color3.Red(),o.overlayAlpha=.5,o._hasVertexAlpha=!1,o._useVertexColors=!0,o._computeBonesUsingShaders=!0,o._numBoneInfluencers=4,o._applyFog=!0,o.useOctreeForRenderingSelection=!0,o.useOctreeForPicking=!0,o.useOctreeForCollisions=!0,o._layerMask=268435455,o.alwaysSelectAsActiveMesh=!1,o.actionManager=null,o.physicsImpostor=null,o._checkCollisions=!1,o._collisionMask=-1,o._collisionGroup=-1,o.ellipsoid=new e.Vector3(.5,1,.5),o.ellipsoidOffset=new e.Vector3(0,0,0),o._oldPositionForCollisions=new e.Vector3(0,0,0),o._diffPositionForCollisions=new e.Vector3(0,0,0),o.edgesWidth=1,o.edgesColor=new e.Color4(1,0,0,1),o._collisionsTransformMatrix=e.Matrix.Zero(),o._collisionsScalingMatrix=e.Matrix.Zero(),o._renderId=0,o._intersectionsInProgress=new Array,o._unIndexed=!1,o._lightSources=new Array,o._onCollisionPositionChange=function(t,r,i){void 0===i&&(i=null),o.getScene().workerCollisions&&r.multiplyInPlace(o._collider._radius),r.subtractToRef(o._oldPositionForCollisions,o._diffPositionForCollisions),o._diffPositionForCollisions.length()>e.Engine.CollisionsEpsilon&&o.position.addInPlace(o._diffPositionForCollisions),i&&o.onCollideObservable.notifyObservers(i),o.onCollisionPositionChangeObservable.notifyObservers(o.position)},o.getScene().addMesh(o),o._resyncLightSources(),o}return s(r,t),Object.defineProperty(r,"BILLBOARDMODE_NONE",{get:function(){return e.TransformNode.BILLBOARDMODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(r,"BILLBOARDMODE_X",{get:function(){return e.TransformNode.BILLBOARDMODE_X},enumerable:!0,configurable:!0}),Object.defineProperty(r,"BILLBOARDMODE_Y",{get:function(){return e.TransformNode.BILLBOARDMODE_Y},enumerable:!0,configurable:!0}),Object.defineProperty(r,"BILLBOARDMODE_Z",{get:function(){return e.TransformNode.BILLBOARDMODE_Z},enumerable:!0,configurable:!0}),Object.defineProperty(r,"BILLBOARDMODE_ALL",{get:function(){return e.TransformNode.BILLBOARDMODE_ALL},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"facetNb",{get:function(){return this._facetNb},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"partitioningSubdivisions",{get:function(){return this._partitioningSubdivisions},set:function(e){this._partitioningSubdivisions=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"partitioningBBoxRatio",{get:function(){return this._partitioningBBoxRatio},set:function(e){this._partitioningBBoxRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"mustDepthSortFacets",{get:function(){return this._facetDepthSort},set:function(e){this._facetDepthSort=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"facetDepthSortFrom",{get:function(){return this._facetDepthSortFrom},set:function(e){this._facetDepthSortFrom=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isFacetDataEnabled",{get:function(){return this._facetDataEnabled},enumerable:!0,configurable:!0}),r.prototype._updateNonUniformScalingState=function(e){return!!t.prototype._updateNonUniformScalingState.call(this,e)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(r.prototype,"onCollide",{set:function(e){this._onCollideObserver&&this.onCollideObservable.remove(this._onCollideObserver),this._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"onCollisionPositionChange",{set:function(e){this._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._onCollisionPositionChangeObserver),this._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isOccluded",{get:function(){return this._isOccluded},set:function(e){this._isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isOcclusionQueryInProgress",{get:function(){return this._isOcclusionQueryInProgress},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"visibility",{get:function(){return this._visibility},set:function(e){this._visibility!==e&&(this._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,this.onMaterialChangedObservable.hasObservers&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"receiveShadows",{get:function(){return this._receiveShadows},set:function(e){this._receiveShadows!==e&&(this._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"hasVertexAlpha",{get:function(){return this._hasVertexAlpha},set:function(e){this._hasVertexAlpha!==e&&(this._hasVertexAlpha=e,
- this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"useVertexColors",{get:function(){return this._useVertexColors},set:function(e){this._useVertexColors!==e&&(this._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"computeBonesUsingShaders",{get:function(){return this._computeBonesUsingShaders},set:function(e){this._computeBonesUsingShaders!==e&&(this._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"numBoneInfluencers",{get:function(){return this._numBoneInfluencers},set:function(e){this._numBoneInfluencers!==e&&(this._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"applyFog",{get:function(){return this._applyFog},set:function(e){this._applyFog!==e&&(this._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"layerMask",{get:function(){return this._layerMask},set:function(e){e!==this._layerMask&&(this._layerMask=e,this._resyncLightSources())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"collisionGroup",{get:function(){return this._collisionGroup},set:function(e){this._collisionGroup=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_positions",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skeleton",{get:function(){return this._skeleton},set:function(e){this._skeleton&&this._skeleton.needInitialSkinMatrix&&this._skeleton._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._skeleton=e,this._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!0,configurable:!0}),r.prototype.getClassName=function(){return"AbstractMesh"},r.prototype.toString=function(t){var r="Name: "+this.name+", isInstance: "+(this instanceof e.InstancedMesh?"YES":"NO");return r+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0),this._skeleton&&(r+=", skeleton: "+this._skeleton.name),t&&(r+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],r+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingFreezeWorldMatrix?"YES":"NO")),r},r.prototype._rebuild=function(){if(this._occlusionQuery&&(this._occlusionQuery=null),this._edgesRenderer&&this._edgesRenderer._rebuild(),this.subMeshes)for(var e=0,t=this.subMeshes;e<t.length;e++){var r=t[e];r._rebuild()}},r.prototype._resyncLightSources=function(){this._lightSources.length=0;for(var e=0,t=this.getScene().lights;e<t.length;e++){var r=t[e];r.isEnabled()&&(r.canAffectMesh(this)&&this._lightSources.push(r))}this._markSubMeshesAsLightDirty()},r.prototype._resyncLighSource=function(e){var t=e.isEnabled()&&e.canAffectMesh(this),r=this._lightSources.indexOf(e);if(-1===r){if(!t)return;this._lightSources.push(e)}else{if(t)return;this._lightSources.splice(r,1)}this._markSubMeshesAsLightDirty()},r.prototype._unBindEffect=function(){for(var e=0,t=this.subMeshes;e<t.length;e++){t[e].setEffect(null)}},r.prototype._removeLightSource=function(e){var t=this._lightSources.indexOf(e);-1!==t&&(this._lightSources.splice(t,1),this._markSubMeshesAsLightDirty())},r.prototype._markSubMeshesAsDirty=function(e){if(this.subMeshes)for(var t=0,r=this.subMeshes;t<r.length;t++){var i=r[t];i._materialDefines&&e(i._materialDefines)}},r.prototype._markSubMeshesAsLightDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsLightDirty()}))},r.prototype._markSubMeshesAsAttributesDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsAttributesDirty()}))},r.prototype._markSubMeshesAsMiscDirty=function(){if(this.subMeshes)for(var t=0,r=this.subMeshes;t<r.length;t++){var i=r[t],n=i.getMaterial();n&&n.markAsDirty(e.Material.MiscDirtyFlag)}},Object.defineProperty(r.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this.physicsImpostor&&this.physicsImpostor.forceUpdate()},enumerable:!0,configurable:!0}),r.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},r.prototype.enableEdgesRendering=function(t,r){return void 0===t&&(t=.95),void 0===r&&(r=!1),this.disableEdgesRendering(),this._edgesRenderer=new e.EdgesRenderer(this,t,r),this},Object.defineProperty(r.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isBlocked",{get:function(){return!1},enumerable:!0,configurable:!0}),r.prototype.getLOD=function(e){return this},r.prototype.getTotalVertices=function(){return 0},r.prototype.getIndices=function(){return null},r.prototype.getVerticesData=function(e){return null},r.prototype.setVerticesData=function(e,t,r,i){return this},r.prototype.updateVerticesData=function(e,t,r,i){return this},r.prototype.setIndices=function(e,t){return this},r.prototype.isVerticesDataPresent=function(e){return!1},r.prototype.getBoundingInfo=function(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfo||this._updateBoundingInfo(),this._boundingInfo)},r.prototype.normalizeToUnitCube=function(e){void 0===e&&(e=!0);var t=this.getHierarchyBoundingVectors(e),r=t.max.subtract(t.min),i=Math.max(r.x,r.y,r.z);if(0===i)return this;var n=1/i;return this.scaling.scaleInPlace(n),this},r.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},Object.defineProperty(r.prototype,"useBones",{get:function(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(e.VertexBuffer.MatricesIndicesKind)&&this.isVerticesDataPresent(e.VertexBuffer.MatricesWeightsKind)},enumerable:!0,configurable:!0}),r.prototype._preActivate=function(){},r.prototype._preActivateForIntermediateRendering=function(e){},r.prototype._activate=function(e){this._renderId=e},r.prototype.getWorldMatrix=function(){return this._masterMesh?this._masterMesh.getWorldMatrix():t.prototype.getWorldMatrix.call(this)},r.prototype._getWorldMatrixDeterminant=function(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():t.prototype._getWorldMatrixDeterminant.call(this)},r.prototype.movePOV=function(e,t,r){return this.position.addInPlace(this.calcMovePOV(e,t,r)),this},r.prototype.calcMovePOV=function(t,r,i){var n=new e.Matrix;(this.rotationQuaternion?this.rotationQuaternion:e.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(n);var o=e.Vector3.Zero(),s=this.definedFacingForward?-1:1;return e.Vector3.TransformCoordinatesFromFloatsToRef(t*s,r,i*s,n,o),o},r.prototype.rotatePOV=function(e,t,r){return this.rotation.addInPlace(this.calcRotatePOV(e,t,r)),this},r.prototype.calcRotatePOV=function(t,r,i){var n=this.definedFacingForward?1:-1;return new e.Vector3(t*n,r,i*n)},r.prototype.getHierarchyBoundingVectors=function(t,r){void 0===t&&(t=!0),void 0===r&&(r=null),this.getScene().incrementRenderId(),this.computeWorldMatrix(!0);var i,n,o=this.getBoundingInfo();if(this.subMeshes?(i=o.boundingBox.minimumWorld,n=o.boundingBox.maximumWorld):(i=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=new e.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)),t)for(var s=this.getDescendants(!1),a=0,l=s;a<l.length;a++){var u=l[a],h=u;if(h.computeWorldMatrix(!0),(!r||r(h))&&h.getBoundingInfo&&0!==h.getTotalVertices()){var c=h.getBoundingInfo(),f=c.boundingBox,d=f.minimumWorld,p=f.maximumWorld;e.Tools.CheckExtends(d,i,n),e.Tools.CheckExtends(p,i,n)}}return{min:i,max:n}},r.prototype._updateBoundingInfo=function(){return this._boundingInfo=this._boundingInfo||new e.BoundingInfo(this.absolutePosition,this.absolutePosition),this._boundingInfo.update(this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this},r.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=0;t<this.subMeshes.length;t++){var r=this.subMeshes[t];r.IsGlobal||r.updateBoundingInfo(e)}return this},r.prototype._afterComputeWorldMatrix=function(){this._updateBoundingInfo()},r.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e)},r.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},r.prototype.intersectsMesh=function(e,t,r){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(r)for(var i=0,n=this.getChildMeshes();i<n.length;i++){var o=n[i];if(o.intersectsMesh(e,t,!0))return!0}return!1},r.prototype.intersectsPoint=function(e){return!!this._boundingInfo&&this._boundingInfo.intersectsPoint(e)},r.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},r.prototype.getPositionInCameraSpace=function(t){return void 0===t&&(t=null),t||(t=this.getScene().activeCamera),e.Vector3.TransformCoordinates(this.absolutePosition,t.getViewMatrix())},r.prototype.getDistanceToCamera=function(e){return void 0===e&&(e=null),e||(e=this.getScene().activeCamera),this.absolutePosition.subtract(e.position).length()},r.prototype.applyImpulse=function(e,t){return this.physicsImpostor?(this.physicsImpostor.applyImpulse(e,t),this):this},r.prototype.setPhysicsLinkWith=function(t,r,i,n){return this.physicsImpostor&&t.physicsImpostor?(this.physicsImpostor.createJoint(t.physicsImpostor,e.PhysicsJoint.HingeJoint,{mainPivot:r,connectedPivot:i,nativeParams:n}),this):this},Object.defineProperty(r.prototype,"checkCollisions",{get:function(){return this._checkCollisions},set:function(e){this._checkCollisions=e,this.getScene().workerCollisions&&this.getScene().collisionCoordinator.onMeshUpdated(this)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"collider",{get:function(){return this._collider},enumerable:!0,configurable:!0}),r.prototype.moveWithCollisions=function(t){return this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._oldPositionForCollisions),this._collider||(this._collider=new e.Collider),this._collider._radius=this.ellipsoid,this.getScene().collisionCoordinator.getNewPosition(this._oldPositionForCollisions,t,this._collider,3,this,this._onCollisionPositionChange,this.uniqueId),this},r.prototype.createOrUpdateSubmeshesOctree=function(t,r){void 0===t&&(t=64),void 0===r&&(r=2),this._submeshesOctree||(this._submeshesOctree=new e.Octree(e.Octree.CreationFuncForSubMeshes,t,r)),this.computeWorldMatrix(!0);var i=this.getBoundingInfo(),n=i.boundingBox;return this._submeshesOctree.update(n.minimumWorld,n.maximumWorld,this.subMeshes),this._submeshesOctree},r.prototype._collideForSubMesh=function(t,r,i){if(this._generatePointsArray(),!this._positions)return this;if(!t._lastColliderWorldVertices||!t._lastColliderTransformMatrix.equals(r)){t._lastColliderTransformMatrix=r.clone(),t._lastColliderWorldVertices=[],t._trianglePlanes=[];for(var n=t.verticesStart,o=t.verticesStart+t.verticesCount,s=n;s<o;s++)t._lastColliderWorldVertices.push(e.Vector3.TransformCoordinates(this._positions[s],r))}return i._collide(t._trianglePlanes,t._lastColliderWorldVertices,this.getIndices(),t.indexStart,t.indexStart+t.indexCount,t.verticesStart,!!t.getMaterial()),i.collisionFound&&(i.collidedMesh=this),this},r.prototype._processCollisionsForSubMeshes=function(e,t){var r,i;if(this._submeshesOctree&&this.useOctreeForCollisions){var n=e._velocityWorldLength+Math.max(e._radius.x,e._radius.y,e._radius.z),o=this._submeshesOctree.intersects(e._basePointWorld,n);i=o.length,r=o.data}else r=this.subMeshes,i=r.length;for(var s=0;s<i;s++){var a=r[s];i>1&&!a._checkCollision(e)||this._collideForSubMesh(a,t,e)}return this},r.prototype._checkCollision=function(t){return this._boundingInfo&&this._boundingInfo._checkCollision(t)?(e.Matrix.ScalingToRef(1/t._radius.x,1/t._radius.y,1/t._radius.z,this._collisionsScalingMatrix),this.worldMatrixFromCache.multiplyToRef(this._collisionsScalingMatrix,this._collisionsTransformMatrix),this._processCollisionsForSubMeshes(t,this._collisionsTransformMatrix),this):this},r.prototype._generatePointsArray=function(){return!1},r.prototype.intersects=function(t,r){var i=new e.PickingInfo;if(!(this.subMeshes&&this._boundingInfo&&t.intersectsSphere(this._boundingInfo.boundingSphere)&&t.intersectsBox(this._boundingInfo.boundingBox)))return i;if(!this._generatePointsArray())return i;var n,o,s=null;if(this._submeshesOctree&&this.useOctreeForPicking){var a=e.Ray.Transform(t,this.getWorldMatrix()),l=this._submeshesOctree.intersectsRay(a);o=l.length,n=l.data}else n=this.subMeshes,o=n.length;for(var u=0;u<o;u++){var h=n[u];if(!(o>1)||h.canIntersects(t)){var c=h.intersects(t,this._positions,this.getIndices(),r);if(c&&(r||!s||c.distance<s.distance)&&(s=c,s.subMeshId=u,r))break}}if(s){var f=this.getWorldMatrix(),d=e.Vector3.TransformCoordinates(t.origin,f),p=t.direction.clone();p=p.scale(s.distance);var A=e.Vector3.TransformNormal(p,f),m=d.add(A);return i.hit=!0,i.distance=e.Vector3.Distance(d,m),i.pickedPoint=m,i.pickedMesh=this,i.bu=s.bu||0,i.bv=s.bv||0,i.faceId=s.faceId,i.subMeshId=s.subMeshId,i}return i},r.prototype.clone=function(e,t,r){return null},r.prototype.releaseSubMeshes=function(){if(this.subMeshes)for(;this.subMeshes.length;)this.subMeshes[0].dispose();else this.subMeshes=new Array;return this},r.prototype.dispose=function(e,r){var i=this;void 0===r&&(r=!1);var n;for(this.getScene().freeActiveMeshes(),this.getScene().freeRenderingGroups(),void 0!==this.actionManager&&null!==this.actionManager&&(this.actionManager.dispose(),this.actionManager=null),this._skeleton=null,this.physicsImpostor&&this.physicsImpostor.dispose(),n=0;n<this._intersectionsInProgress.length;n++){var o=this._intersectionsInProgress[n],s=o._intersectionsInProgress.indexOf(this);o._intersectionsInProgress.splice(s,1)}this._intersectionsInProgress=[],this.getScene().lights.forEach((function(e){var t=e.includedOnlyMeshes.indexOf(i);-1!==t&&e.includedOnlyMeshes.splice(t,1),-1!==(t=e.excludedMeshes.indexOf(i))&&e.excludedMeshes.splice(t,1);var r=e.getShadowGenerator();if(r){var n=r.getShadowMap();n&&n.renderList&&-1!==(t=n.renderList.indexOf(i))&&n.renderList.splice(t,1)}})),this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),"InstancedMesh"!==this.getClassName()&&this.releaseSubMeshes();var a=this.getScene().selectionOctree;if(void 0!==a&&null!==a){var n=a.dynamicContent.indexOf(this);-1!==n&&a.dynamicContent.splice(n,1)}var l=this.getScene().getEngine();if(this._occlusionQuery&&(this._isOcclusionQueryInProgress=!1,l.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),l.wipeCaches(),this.getScene().removeMesh(this),r&&this.material&&this.material.dispose(!1,!0),!e)for(n=0;n<this.getScene().particleSystems.length;n++)this.getScene().particleSystems[n].emitter===this&&(this.getScene().particleSystems[n].dispose(),n--);this._facetDataEnabled&&this.disableFacetData(),this.onAfterWorldMatrixUpdateObservable.clear(),this.onCollideObservable.clear(),this.onCollisionPositionChangeObservable.clear(),t.prototype.dispose.call(this,e,r)},r.prototype.addChild=function(e){return e.setParent(this),this},r.prototype.removeChild=function(e){return e.setParent(null),this},r.prototype._initFacetData=function(){this._facetNormals||(this._facetNormals=new Array),this._facetPositions||(this._facetPositions=new Array),this._facetPartitioning||(this._facetPartitioning=new Array),this._facetNb=this.getIndices().length/3|0,this._partitioningSubdivisions=this._partitioningSubdivisions?this._partitioningSubdivisions:10,this._partitioningBBoxRatio=this._partitioningBBoxRatio?this._partitioningBBoxRatio:1.01;for(var t=0;t<this._facetNb;t++)this._facetNormals[t]=e.Vector3.Zero(),this._facetPositions[t]=e.Vector3.Zero();return this._facetDataEnabled=!0,this},r.prototype.updateFacetData=function(){this._facetDataEnabled||this._initFacetData();var t=this.getVerticesData(e.VertexBuffer.PositionKind),r=this.getIndices(),i=this.getVerticesData(e.VertexBuffer.NormalKind),n=this.getBoundingInfo();if(this._facetDepthSort&&!this._facetDepthSortEnabled){if(this._facetDepthSortEnabled=!0,r instanceof Uint16Array)this._depthSortedIndices=new Uint16Array(r);else if(r instanceof Uint32Array)this._depthSortedIndices=new Uint32Array(r);else{for(var o=!1,s=0;s<r.length;s++)if(r[s]>65535){o=!0;break}this._depthSortedIndices=o?new Uint32Array(r):new Uint16Array(r)}if(this._facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!this._facetDepthSortFrom){var a=this.getScene().activeCamera;this._facetDepthSortFrom=a?a.position:e.Vector3.Zero()}this._depthSortedFacets=[];for(var l=0;l<this._facetNb;l++){var u={ind:3*l,sqDistance:0};this._depthSortedFacets.push(u)}this._invertedMatrix=e.Matrix.Identity(),this._facetDepthSortOrigin=e.Vector3.Zero()}this._bbSize.x=n.maximum.x-n.minimum.x>e.Epsilon?n.maximum.x-n.minimum.x:e.Epsilon,this._bbSize.y=n.maximum.y-n.minimum.y>e.Epsilon?n.maximum.y-n.minimum.y:e.Epsilon,this._bbSize.z=n.maximum.z-n.minimum.z>e.Epsilon?n.maximum.z-n.minimum.z:e.Epsilon;var h=this._bbSize.x>this._bbSize.y?this._bbSize.x:this._bbSize.y;if(h=h>this._bbSize.z?h:this._bbSize.z,this._subDiv.max=this._partitioningSubdivisions,this._subDiv.X=Math.floor(this._subDiv.max*this._bbSize.x/h),this._subDiv.Y=Math.floor(this._subDiv.max*this._bbSize.y/h),this._subDiv.Z=Math.floor(this._subDiv.max*this._bbSize.z/h),this._subDiv.X=this._subDiv.X<1?1:this._subDiv.X,this._subDiv.Y=this._subDiv.Y<1?1:this._subDiv.Y,this._subDiv.Z=this._subDiv.Z<1?1:this._subDiv.Z,this._facetParameters.facetNormals=this.getFacetLocalNormals(),this._facetParameters.facetPositions=this.getFacetLocalPositions(),this._facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),this._facetParameters.bInfo=n,this._facetParameters.bbSize=this._bbSize,this._facetParameters.subDiv=this._subDiv,this._facetParameters.ratio=this.partitioningBBoxRatio,this._facetParameters.depthSort=this._facetDepthSort,this._facetDepthSort&&this._facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(this._invertedMatrix),e.Vector3.TransformCoordinatesToRef(this._facetDepthSortFrom,this._invertedMatrix,this._facetDepthSortOrigin),this._facetParameters.distanceTo=this._facetDepthSortOrigin),this._facetParameters.depthSortedFacets=this._depthSortedFacets,e.VertexData.ComputeNormals(t,r,i,this._facetParameters),this._facetDepthSort&&this._facetDepthSortEnabled){this._depthSortedFacets.sort(this._facetDepthSortFunction);for(var c=this._depthSortedIndices.length/3|0,l=0;l<c;l++){var f=this._depthSortedFacets[l].ind;this._depthSortedIndices[3*l]=r[f],this._depthSortedIndices[3*l+1]=r[f+1],this._depthSortedIndices[3*l+2]=r[f+2]}this.updateIndices(this._depthSortedIndices)}return this},r.prototype.getFacetLocalNormals=function(){return this._facetNormals||this.updateFacetData(),this._facetNormals},r.prototype.getFacetLocalPositions=function(){return this._facetPositions||this.updateFacetData(),this._facetPositions},r.prototype.getFacetLocalPartitioning=function(){return this._facetPartitioning||this.updateFacetData(),this._facetPartitioning},r.prototype.getFacetPosition=function(t){var r=e.Vector3.Zero();return this.getFacetPositionToRef(t,r),r},r.prototype.getFacetPositionToRef=function(t,r){var i=this.getFacetLocalPositions()[t],n=this.getWorldMatrix();return e.Vector3.TransformCoordinatesToRef(i,n,r),this},r.prototype.getFacetNormal=function(t){var r=e.Vector3.Zero();return this.getFacetNormalToRef(t,r),r},r.prototype.getFacetNormalToRef=function(t,r){var i=this.getFacetLocalNormals()[t];return e.Vector3.TransformNormalToRef(i,this.getWorldMatrix(),r),this},r.prototype.getFacetsAtLocalCoordinates=function(e,t,r){var i=this.getBoundingInfo(),n=Math.floor((e-i.minimum.x*this._partitioningBBoxRatio)*this._subDiv.X*this._partitioningBBoxRatio/this._bbSize.x),o=Math.floor((t-i.minimum.y*this._partitioningBBoxRatio)*this._subDiv.Y*this._partitioningBBoxRatio/this._bbSize.y),s=Math.floor((r-i.minimum.z*this._partitioningBBoxRatio)*this._subDiv.Z*this._partitioningBBoxRatio/this._bbSize.z);return n<0||n>this._subDiv.max||o<0||o>this._subDiv.max||s<0||s>this._subDiv.max?null:this._facetPartitioning[n+this._subDiv.max*o+this._subDiv.max*this._subDiv.max*s]},r.prototype.getClosestFacetAtCoordinates=function(t,r,i,n,o,s){void 0===o&&(o=!1),void 0===s&&(s=!0);var a=this.getWorldMatrix(),l=e.Tmp.Matrix[5];a.invertToRef(l);var u=e.Tmp.Vector3[8];e.Vector3.TransformCoordinatesFromFloatsToRef(t,r,i,l,u);var h=this.getClosestFacetAtLocalCoordinates(u.x,u.y,u.z,n,o,s);return n&&e.Vector3.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,a,n),h},r.prototype.getClosestFacetAtLocalCoordinates=function(e,t,r,i,n,o){void 0===n&&(n=!1),void 0===o&&(o=!0);var s=null,a=0,l=0,u=0,h=0,c=0,f=0,d=0,p=0,A=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,r);if(!g)return null;for(var _,v,y,b=Number.MAX_VALUE,E=b,T=0;T<g.length;T++)_=g[T],v=m[_],y=A[_],h=(e-y.x)*v.x+(t-y.y)*v.y+(r-y.z)*v.z,(!n||n&&o&&h>=0||n&&!o&&h<=0)&&(h=v.x*y.x+v.y*y.y+v.z*y.z,c=-(v.x*e+v.y*t+v.z*r-h)/(v.x*v.x+v.y*v.y+v.z*v.z),f=e+v.x*c,d=t+v.y*c,p=r+v.z*c,a=f-e,l=d-t,u=p-r,(E=a*a+l*l+u*u)<b&&(b=E,s=_,i&&(i.x=f,i.y=d,i.z=p)));return s},r.prototype.getFacetDataParameters=function(){return this._facetParameters},r.prototype.disableFacetData=function(){return this._facetDataEnabled&&(this._facetDataEnabled=!1,this._facetPositions=new Array,this._facetNormals=new Array,this._facetPartitioning=new Array,this._facetParameters=null,this._depthSortedIndices=new Uint32Array(0)),this},r.prototype.updateIndices=function(e){return this},r.prototype.createNormals=function(t){var r,i=this.getVerticesData(e.VertexBuffer.PositionKind),n=this.getIndices();return r=this.isVerticesDataPresent(e.VertexBuffer.NormalKind)?this.getVerticesData(e.VertexBuffer.NormalKind):[],e.VertexData.ComputeNormals(i,n,r,{useRightHandedSystem:this.getScene().useRightHandedSystem}),this.setVerticesData(e.VertexBuffer.NormalKind,r,t),this},r.prototype.alignWithNormal=function(t,r){r||(r=e.Axis.Y);var i=e.Tmp.Vector3[0],n=e.Tmp.Vector3[1];return e.Vector3.CrossToRef(r,t,n),e.Vector3.CrossToRef(t,n,i),this.rotationQuaternion?e.Quaternion.RotationQuaternionFromAxisToRef(i,t,n,this.rotationQuaternion):e.Vector3.RotationFromAxisToRef(i,t,n,this.rotation),this},r.prototype._checkOcclusionQuery=function(){var e=this.getEngine();if(e.webGLVersion<2||this.occlusionType===r.OCCLUSION_TYPE_NONE)return void(this._isOccluded=!1);if(this.isOcclusionQueryInProgress&&this._occlusionQuery){if(e.isQueryResultAvailable(this._occlusionQuery)){var t=e.getQueryResult(this._occlusionQuery);this._isOcclusionQueryInProgress=!1,this._occlusionInternalRetryCounter=0,this._isOccluded=1!==t}else{if(this._occlusionInternalRetryCounter++,!(-1!==this.occlusionRetryCount&&this._occlusionInternalRetryCounter>this.occlusionRetryCount))return;this._isOcclusionQueryInProgress=!1,this._occlusionInternalRetryCounter=0,this._isOccluded=this.occlusionType!==r.OCCLUSION_TYPE_OPTIMISTIC&&this._isOccluded}}var i=this.getScene(),n=i.getBoundingBoxRenderer();this._occlusionQuery||(this._occlusionQuery=e.createQuery()),e.beginOcclusionQuery(this.occlusionQueryAlgorithmType,this._occlusionQuery),n.renderOcclusionBoundingBox(this),e.endOcclusionQuery(this.occlusionQueryAlgorithmType),this._isOcclusionQueryInProgress=!0},r.OCCLUSION_TYPE_NONE=0,r.OCCLUSION_TYPE_OPTIMISTIC=1,r.OCCLUSION_TYPE_STRICT=2,r.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,r.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,r})(e.TransformNode);e.AbstractMesh=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(i,n){var o=t.call(this,i,n)||this;return o.diffuse=new e.Color3(1,1,1),o.specular=new e.Color3(1,1,1),o.intensity=1,o.range=Number.MAX_VALUE,o._photometricScale=1,o._intensityMode=r.INTENSITYMODE_AUTOMATIC,o._radius=1e-5,o.renderPriority=0,o._shadowEnabled=!0,o._excludeWithLayerMask=0,o._includeOnlyWithLayerMask=0,o._lightmapMode=0,o._excludedMeshesIds=new Array,o._includedOnlyMeshesIds=new Array,o.getScene().addLight(o),o._uniformBuffer=new e.UniformBuffer(o.getScene().getEngine()),o._buildUniformLayout(),o.includedOnlyMeshes=new Array,o.excludedMeshes=new Array,o._resyncMeshes(),o}return s(r,t),Object.defineProperty(r,"LIGHTMAP_DEFAULT",{get:function(){return r._LIGHTMAP_DEFAULT},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTMAP_SPECULAR",{get:function(){return r._LIGHTMAP_SPECULAR},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTMAP_SHADOWSONLY",{get:function(){return r._LIGHTMAP_SHADOWSONLY},enumerable:!0,configurable:!0}),Object.defineProperty(r,"INTENSITYMODE_AUTOMATIC",{get:function(){return r._INTENSITYMODE_AUTOMATIC},enumerable:!0,configurable:!0}),Object.defineProperty(r,"INTENSITYMODE_LUMINOUSPOWER",{get:function(){return r._INTENSITYMODE_LUMINOUSPOWER},enumerable:!0,configurable:!0}),Object.defineProperty(r,"INTENSITYMODE_LUMINOUSINTENSITY",{get:function(){return r._INTENSITYMODE_LUMINOUSINTENSITY},enumerable:!0,configurable:!0}),Object.defineProperty(r,"INTENSITYMODE_ILLUMINANCE",{get:function(){return r._INTENSITYMODE_ILLUMINANCE},enumerable:!0,configurable:!0}),Object.defineProperty(r,"INTENSITYMODE_LUMINANCE",{get:function(){return r._INTENSITYMODE_LUMINANCE},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTTYPEID_POINTLIGHT",{get:function(){return r._LIGHTTYPEID_POINTLIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTTYPEID_DIRECTIONALLIGHT",{get:function(){return r._LIGHTTYPEID_DIRECTIONALLIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTTYPEID_SPOTLIGHT",{get:function(){return r._LIGHTTYPEID_SPOTLIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(r,"LIGHTTYPEID_HEMISPHERICLIGHT",{get:function(){return r._LIGHTTYPEID_HEMISPHERICLIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),r.prototype.getClassName=function(){return"Light"},r.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var r=0;r<this.animations.length;r++)t+=", animation[0]: "+this.animations[r].toString(e);return t},r.prototype.setEnabled=function(e){t.prototype.setEnabled.call(this,e),this._resyncMeshes()},r.prototype.getShadowGenerator=function(){return this._shadowGenerator},r.prototype.getAbsolutePosition=function(){return e.Vector3.Zero()},r.prototype.canAffectMesh=function(e){return!e||!(this.includedOnlyMeshes&&this.includedOnlyMeshes.length>0&&-1===this.includedOnlyMeshes.indexOf(e))&&(!(this.excludedMeshes&&this.excludedMeshes.length>0&&-1!==this.excludedMeshes.indexOf(e))&&((0===this.includeOnlyWithLayerMask||0!=(this.includeOnlyWithLayerMask&e.layerMask))&&!(0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask)))},r.prototype.getWorldMatrix=function(){this._currentRenderId=this.getScene().getRenderId(),this._childRenderId=this._currentRenderId;var t=this._getWorldMatrix();return this.parent&&this.parent.getWorldMatrix?(this._parentedWorldMatrix||(this._parentedWorldMatrix=e.Matrix.Identity()),t.multiplyToRef(this.parent.getWorldMatrix(),this._parentedWorldMatrix),this._markSyncedWithParent(),this._parentedWorldMatrix):t},r.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},r.prototype.dispose=function(e,r){void 0===r&&(r=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var i=0,n=this.getScene().meshes;i<n.length;i++){n[i]._removeLightSource(this)}this._uniformBuffer.dispose(),this.getScene().removeLight(this),t.prototype.dispose.call(this,e,r)},r.prototype.getTypeID=function(){return 0},r.prototype.getScaledIntensity=function(){return this._photometricScale*this.intensity},r.prototype.clone=function(t){var i=r.GetConstructorFromName(this.getTypeID(),t,this.getScene());return i?e.SerializationHelper.Clone(i,this):null},r.prototype.serialize=function(){var t=e.SerializationHelper.Serialize(this);return t.type=this.getTypeID(),this.parent&&(t.parentId=this.parent.id),this.excludedMeshes.length>0&&(t.excludedMeshesIds=[],this.excludedMeshes.forEach((function(e){t.excludedMeshesIds.push(e.id)}))),this.includedOnlyMeshes.length>0&&(t.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(e){t.includedOnlyMeshesIds.push(e.id)}))),e.Animation.AppendSerializedAnimations(this,t),t.ranges=this.serializeAnimationRanges(),t},r.GetConstructorFromName=function(t,r,i){switch(t){case 0:return function(){return new e.PointLight(r,e.Vector3.Zero(),i)};case 1:return function(){return new e.DirectionalLight(r,e.Vector3.Zero(),i)};case 2:return function(){return new e.SpotLight(r,e.Vector3.Zero(),e.Vector3.Zero(),0,0,i)};case 3:return function(){return new e.HemisphericLight(r,e.Vector3.Zero(),i)}}return null},r.Parse=function(t,i){var n=r.GetConstructorFromName(t.type,t.name,i);if(!n)return null;var o=e.SerializationHelper.Parse(n,t,i);if(t.excludedMeshesIds&&(o._excludedMeshesIds=t.excludedMeshesIds),t.includedOnlyMeshesIds&&(o._includedOnlyMeshesIds=t.includedOnlyMeshesIds),t.parentId&&(o._waitingParentId=t.parentId),t.animations){for(var s=0;s<t.animations.length;s++){var a=t.animations[s];o.animations.push(e.Animation.Parse(a))}e.Node.ParseAnimationRanges(o,t,i)}return t.autoAnimate&&i.beginAnimation(o,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1),o},r.prototype._hookArrayForExcluded=function(e){var t=this,r=e.push;e.push=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];for(var o=r.apply(e,i),s=0,a=i;s<a.length;s++){a[s]._resyncLighSource(t)}return o};var i=e.splice;e.splice=function(r,n){for(var o=i.apply(e,[r,n]),s=0,a=o;s<a.length;s++){a[s]._resyncLighSource(t)}return o};for(var n=0,o=e;n<o.length;n++){o[n]._resyncLighSource(this)}},
- r.prototype._hookArrayForIncludedOnly=function(e){var t=this,r=e.push;e.push=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=r.apply(e,i);return t._resyncMeshes(),o};var i=e.splice;e.splice=function(r,n){var o=i.apply(e,[r,n]);return t._resyncMeshes(),o},this._resyncMeshes()},r.prototype._resyncMeshes=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){t[e]._resyncLighSource(this)}},r.prototype._markMeshesAsLightDirty=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var r=t[e];-1!==r._lightSources.indexOf(this)&&r._markSubMeshesAsLightDirty()}},r.prototype._computePhotometricScale=function(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()},r.prototype._getPhotometricScale=function(){var e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===r.INTENSITYMODE_AUTOMATIC&&(i=t===r.LIGHTTYPEID_DIRECTIONALLIGHT?r.INTENSITYMODE_ILLUMINANCE:r.INTENSITYMODE_LUMINOUSINTENSITY),t){case r.LIGHTTYPEID_POINTLIGHT:case r.LIGHTTYPEID_SPOTLIGHT:switch(i){case r.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case r.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case r.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case r.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case r.INTENSITYMODE_ILLUMINANCE:e=1;break;case r.INTENSITYMODE_LUMINANCE:var n=this.radius;n=Math.max(n,.001);e=2*Math.PI*(1-Math.cos(n))}break;case r.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e},r.prototype._reorderLightsInScene=function(){var e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()},r._LIGHTMAP_DEFAULT=0,r._LIGHTMAP_SPECULAR=1,r._LIGHTMAP_SHADOWSONLY=2,r._INTENSITYMODE_AUTOMATIC=0,r._INTENSITYMODE_LUMINOUSPOWER=1,r._INTENSITYMODE_LUMINOUSINTENSITY=2,r._INTENSITYMODE_ILLUMINANCE=3,r._INTENSITYMODE_LUMINANCE=4,r._LIGHTTYPEID_POINTLIGHT=0,r._LIGHTTYPEID_DIRECTIONALLIGHT=1,r._LIGHTTYPEID_SPOTLIGHT=2,r._LIGHTTYPEID_HEMISPHERICLIGHT=3,o([e.serializeAsColor3()],r.prototype,"diffuse",void 0),o([e.serializeAsColor3()],r.prototype,"specular",void 0),o([e.serialize()],r.prototype,"intensity",void 0),o([e.serialize()],r.prototype,"range",void 0),o([e.serialize()],r.prototype,"intensityMode",null),o([e.serialize()],r.prototype,"radius",null),o([e.serialize()],r.prototype,"_renderPriority",void 0),o([e.expandToProperty("_reorderLightsInScene")],r.prototype,"renderPriority",void 0),o([e.serialize("shadowEnabled")],r.prototype,"_shadowEnabled",void 0),o([e.serialize("excludeWithLayerMask")],r.prototype,"_excludeWithLayerMask",void 0),o([e.serialize("includeOnlyWithLayerMask")],r.prototype,"_includeOnlyWithLayerMask",void 0),o([e.serialize("lightmapMode")],r.prototype,"_lightmapMode",void 0),r})(e.Node);e.Light=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(i,n,o,s){void 0===s&&(s=!0);var a=t.call(this,i,o)||this;return a.upVector=e.Vector3.Up(),a.orthoLeft=null,a.orthoRight=null,a.orthoBottom=null,a.orthoTop=null,a.fov=.8,a.minZ=1,a.maxZ=1e4,a.inertia=.9,a.mode=r.PERSPECTIVE_CAMERA,a.isIntermediate=!1,a.viewport=new e.Viewport(0,0,1,1),a.layerMask=268435455,a.fovMode=r.FOVMODE_VERTICAL_FIXED,a.cameraRigMode=r.RIG_MODE_NONE,a._rigCameras=new Array,a._webvrViewMatrix=e.Matrix.Identity(),a._skipRendering=!1,a.customRenderTargets=new Array,a.onViewMatrixChangedObservable=new e.Observable,a.onProjectionMatrixChangedObservable=new e.Observable,a.onAfterCheckInputsObservable=new e.Observable,a.onRestoreStateObservable=new e.Observable,a._computedViewMatrix=e.Matrix.Identity(),a._projectionMatrix=new e.Matrix,a._doNotComputeProjectionMatrix=!1,a._worldMatrix=e.Matrix.Identity(),a._postProcesses=new Array,a._transformMatrix=e.Matrix.Zero(),a._activeMeshes=new e.SmartArray(256),a._globalPosition=e.Vector3.Zero(),a._refreshFrustumPlanes=!0,a.getScene().addCamera(a),s&&!a.getScene().activeCamera&&(a.getScene().activeCamera=a),a.position=n,a}return s(r,t),Object.defineProperty(r,"PERSPECTIVE_CAMERA",{get:function(){return r._PERSPECTIVE_CAMERA},enumerable:!0,configurable:!0}),Object.defineProperty(r,"ORTHOGRAPHIC_CAMERA",{get:function(){return r._ORTHOGRAPHIC_CAMERA},enumerable:!0,configurable:!0}),Object.defineProperty(r,"FOVMODE_VERTICAL_FIXED",{get:function(){return r._FOVMODE_VERTICAL_FIXED},enumerable:!0,configurable:!0}),Object.defineProperty(r,"FOVMODE_HORIZONTAL_FIXED",{get:function(){return r._FOVMODE_HORIZONTAL_FIXED},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_NONE",{get:function(){return r._RIG_MODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_STEREOSCOPIC_ANAGLYPH",{get:function(){return r._RIG_MODE_STEREOSCOPIC_ANAGLYPH},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL",{get:function(){return r._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED",{get:function(){return r._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_STEREOSCOPIC_OVERUNDER",{get:function(){return r._RIG_MODE_STEREOSCOPIC_OVERUNDER},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_VR",{get:function(){return r._RIG_MODE_VR},enumerable:!0,configurable:!0}),Object.defineProperty(r,"RIG_MODE_WEBVR",{get:function(){return r._RIG_MODE_WEBVR},enumerable:!0,configurable:!0}),r.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},r.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},r.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},r.prototype.getClassName=function(){return"Camera"},r.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var r=0;r<this.animations.length;r++)t+=", animation[0]: "+this.animations[r].toString(e);return t},Object.defineProperty(r.prototype,"globalPosition",{get:function(){return this._globalPosition},enumerable:!0,configurable:!0}),r.prototype.getActiveMeshes=function(){return this._activeMeshes},r.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},r.prototype.isReady=function(e){if(void 0===e&&(e=!1),e)for(var r=0,i=this._postProcesses;r<i.length;r++){var n=i[r];if(n&&!n.isReady())return!1}return t.prototype.isReady.call(this,e)},r.prototype._initCache=function(){t.prototype._initCache.call(this),this._cache.position=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.upVector=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.mode=void 0,this._cache.minZ=void 0,this._cache.maxZ=void 0,this._cache.fov=void 0,this._cache.fovMode=void 0,this._cache.aspectRatio=void 0,this._cache.orthoLeft=void 0,this._cache.orthoRight=void 0,this._cache.orthoBottom=void 0,this._cache.orthoTop=void 0,this._cache.renderWidth=void 0,this._cache.renderHeight=void 0},r.prototype._updateCache=function(e){e||t.prototype._updateCache.call(this),this._cache.position.copyFrom(this.position),this._cache.upVector.copyFrom(this.upVector)},r.prototype._isSynchronized=function(){return this._isSynchronizedViewMatrix()&&this._isSynchronizedProjectionMatrix()},r.prototype._isSynchronizedViewMatrix=function(){return!!t.prototype._isSynchronized.call(this)&&(this._cache.position.equals(this.position)&&this._cache.upVector.equals(this.upVector)&&this.isSynchronizedWithParent())},r.prototype._isSynchronizedProjectionMatrix=function(){var e=this._cache.mode===this.mode&&this._cache.minZ===this.minZ&&this._cache.maxZ===this.maxZ;if(!e)return!1;var t=this.getEngine();return e=this.mode===r.PERSPECTIVE_CAMERA?this._cache.fov===this.fov&&this._cache.fovMode===this.fovMode&&this._cache.aspectRatio===t.getAspectRatio(this):this._cache.orthoLeft===this.orthoLeft&&this._cache.orthoRight===this.orthoRight&&this._cache.orthoBottom===this.orthoBottom&&this._cache.orthoTop===this.orthoTop&&this._cache.renderWidth===t.getRenderWidth()&&this._cache.renderHeight===t.getRenderHeight()},r.prototype.attachControl=function(e,t){},r.prototype.detachControl=function(e){},r.prototype.update=function(){this._checkInputs(),this.cameraRigMode!==r.RIG_MODE_NONE&&this._updateRigCameras()},r.prototype._checkInputs=function(){this.onAfterCheckInputsObservable.notifyObservers(this)},Object.defineProperty(r.prototype,"rigCameras",{get:function(){return this._rigCameras},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rigPostProcess",{get:function(){return this._rigPostProcess},enumerable:!0,configurable:!0}),r.prototype._getFirstPostProcess=function(){for(var e=0;e<this._postProcesses.length;e++)if(null!==this._postProcesses[e])return this._postProcesses[e];return null},r.prototype._cascadePostProcessesToRigCams=function(){var t=this._getFirstPostProcess();t&&t.markTextureDirty();for(var r=0,i=this._rigCameras.length;r<i;r++){var n=this._rigCameras[r],o=n._rigPostProcess;if(o){o instanceof e.PassPostProcess&&(n.isIntermediate=0===this._postProcesses.length),n._postProcesses=this._postProcesses.slice(0).concat(o),o.markTextureDirty()}else n._postProcesses=this._postProcesses.slice(0)}},r.prototype.attachPostProcess=function(t,r){return void 0===r&&(r=null),!t.isReusable()&&this._postProcesses.indexOf(t)>-1?(e.Tools.Error("You're trying to reuse a post process not defined as reusable."),0):(null==r||r<0?this._postProcesses.push(t):null===this._postProcesses[r]?this._postProcesses[r]=t:this._postProcesses.splice(r,0,t),this._cascadePostProcessesToRigCams(),this._postProcesses.indexOf(t))},r.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._cascadePostProcessesToRigCams()},r.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()?this._worldMatrix:(this.getViewMatrix(),this._worldMatrix)},r.prototype._getViewMatrix=function(){return e.Matrix.Identity()},r.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()?this._computedViewMatrix:(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childRenderId=this._currentRenderId,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix),this._computedViewMatrix)},r.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},r.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},r.prototype.getProjectionMatrix=function(t){if(this._doNotComputeProjectionMatrix||!t&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var i=this.getEngine(),n=this.getScene();if(this.mode===r.PERSPECTIVE_CAMERA)this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=i.getAspectRatio(this),this.minZ<=0&&(this.minZ=.1),n.useRightHandedSystem?e.Matrix.PerspectiveFovRHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===r.FOVMODE_VERTICAL_FIXED):e.Matrix.PerspectiveFovLHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===r.FOVMODE_VERTICAL_FIXED);else{var o=i.getRenderWidth()/2,s=i.getRenderHeight()/2;n.useRightHandedSystem?e.Matrix.OrthoOffCenterRHToRef(this.orthoLeft||-o,this.orthoRight||o,this.orthoBottom||-s,this.orthoTop||s,this.minZ,this.maxZ,this._projectionMatrix):e.Matrix.OrthoOffCenterLHToRef(this.orthoLeft||-o,this.orthoRight||o,this.orthoBottom||-s,this.orthoTop||s,this.minZ,this.maxZ,this._projectionMatrix),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=i.getRenderWidth(),this._cache.renderHeight=i.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},r.prototype.getTranformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},r.prototype.updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTranformationMatrix(),this._frustumPlanes?e.Frustum.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=e.Frustum.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},r.prototype.isInFrustum=function(e){return this.updateFrustumPlanes(),e.isInFrustum(this._frustumPlanes)},r.prototype.isCompletelyInFrustum=function(e){return this.updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},r.prototype.getForwardRay=function(t,r,i){void 0===t&&(t=100),r||(r=this.getWorldMatrix()),i||(i=this.position);var n=new e.Vector3(0,0,1),o=e.Vector3.TransformNormal(n,r),s=e.Vector3.Normalize(o);return new e.Ray(i,s,t)},r.prototype.dispose=function(e,i){for(void 0===i&&(i=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==r.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var o=this._postProcesses.length;--o>=0;){var s=this._postProcesses[o];s&&s.dispose(this)}for(var o=this.customRenderTargets.length;--o>=0;)this.customRenderTargets[o].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),t.prototype.dispose.call(this,e,i)},Object.defineProperty(r.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!0,configurable:!0}),r.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},r.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},r.prototype.setCameraRigMode=function(t,i){if(this.cameraRigMode!==t){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=t,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=e.Tools.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==r.RIG_MODE_NONE){var o=this.createRigCamera(this.name+"_L",0),s=this.createRigCamera(this.name+"_R",1);o&&s&&(this._rigCameras.push(o),this._rigCameras.push(s))}switch(this.cameraRigMode){case r.RIG_MODE_STEREOSCOPIC_ANAGLYPH:this._rigCameras[0]._rigPostProcess=new e.PassPostProcess(this.name+"_passthru",1,this._rigCameras[0]),this._rigCameras[1]._rigPostProcess=new e.AnaglyphPostProcess(this.name+"_anaglyph",1,this._rigCameras);break;case r.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case r.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case r.RIG_MODE_STEREOSCOPIC_OVERUNDER:var a=this.cameraRigMode===r.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||this.cameraRigMode===r.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;this._rigCameras[0]._rigPostProcess=new e.PassPostProcess(this.name+"_passthru",1,this._rigCameras[0]),this._rigCameras[1]._rigPostProcess=new e.StereoscopicInterlacePostProcess(this.name+"_stereoInterlace",this._rigCameras,a);break;case r.RIG_MODE_VR:var l=i.vrCameraMetrics||e.VRCameraMetrics.GetDefault();this._rigCameras[0]._cameraRigParams.vrMetrics=l,this._rigCameras[0].viewport=new e.Viewport(0,0,.5,1),this._rigCameras[0]._cameraRigParams.vrWorkMatrix=new e.Matrix,this._rigCameras[0]._cameraRigParams.vrHMatrix=l.leftHMatrix,this._rigCameras[0]._cameraRigParams.vrPreViewMatrix=l.leftPreViewMatrix,this._rigCameras[0].getProjectionMatrix=this._rigCameras[0]._getVRProjectionMatrix,this._rigCameras[1]._cameraRigParams.vrMetrics=l,this._rigCameras[1].viewport=new e.Viewport(.5,0,.5,1),this._rigCameras[1]._cameraRigParams.vrWorkMatrix=new e.Matrix,this._rigCameras[1]._cameraRigParams.vrHMatrix=l.rightHMatrix,this._rigCameras[1]._cameraRigParams.vrPreViewMatrix=l.rightPreViewMatrix,this._rigCameras[1].getProjectionMatrix=this._rigCameras[1]._getVRProjectionMatrix,l.compensateDistortion&&(this._rigCameras[0]._rigPostProcess=new e.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Left",this._rigCameras[0],!1,l),this._rigCameras[1]._rigPostProcess=new e.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Right",this._rigCameras[1],!0,l));break;case r.RIG_MODE_WEBVR:if(i.vrDisplay){var u=i.vrDisplay.getEyeParameters("left"),h=i.vrDisplay.getEyeParameters("right");this._rigCameras[0].viewport=new e.Viewport(0,0,.5,1),this._rigCameras[0].setCameraRigParameter("left",!0),this._rigCameras[0].setCameraRigParameter("specs",i.specs),this._rigCameras[0].setCameraRigParameter("eyeParameters",u),this._rigCameras[0].setCameraRigParameter("frameData",i.frameData),this._rigCameras[0].setCameraRigParameter("parentCamera",i.parentCamera),this._rigCameras[0]._cameraRigParams.vrWorkMatrix=new e.Matrix,this._rigCameras[0].getProjectionMatrix=this._getWebVRProjectionMatrix,this._rigCameras[0].parent=this,this._rigCameras[0]._getViewMatrix=this._getWebVRViewMatrix,this._rigCameras[1].viewport=new e.Viewport(.5,0,.5,1),this._rigCameras[1].setCameraRigParameter("eyeParameters",h),this._rigCameras[1].setCameraRigParameter("specs",i.specs),this._rigCameras[1].setCameraRigParameter("frameData",i.frameData),this._rigCameras[1].setCameraRigParameter("parentCamera",i.parentCamera),this._rigCameras[1]._cameraRigParams.vrWorkMatrix=new e.Matrix,this._rigCameras[1].getProjectionMatrix=this._getWebVRProjectionMatrix,this._rigCameras[1].parent=this,this._rigCameras[1]._getViewMatrix=this._getWebVRViewMatrix,r.UseAlternateWebVRRendering&&(this._rigCameras[1]._skipRendering=!0,this._rigCameras[0]._alternateCamera=this._rigCameras[1])}}this._cascadePostProcessesToRigCams(),this.update()}},r.prototype._getVRProjectionMatrix=function(){return e.Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},r.prototype._updateCameraRotationMatrix=function(){},r.prototype._updateWebVRCameraRotationMatrix=function(){},r.prototype._getWebVRProjectionMatrix=function(){return e.Matrix.Identity()},r.prototype._getWebVRViewMatrix=function(){return e.Matrix.Identity()},r.prototype.setCameraRigParameter=function(t,r){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[t]=r,"interaxialDistance"===t&&(this._cameraRigParams.stereoHalfAngle=e.Tools.ToRadians(r/.0637))},r.prototype.createRigCamera=function(e,t){return null},r.prototype._updateRigCameras=function(){for(var e=0;e<this._rigCameras.length;e++)this._rigCameras[e].minZ=this.minZ,this._rigCameras[e].maxZ=this.maxZ,this._rigCameras[e].fov=this.fov;this.cameraRigMode===r.RIG_MODE_STEREOSCOPIC_ANAGLYPH&&(this._rigCameras[0].viewport=this._rigCameras[1].viewport=this.viewport)},r.prototype._setupInputs=function(){},r.prototype.serialize=function(){var t=e.SerializationHelper.Serialize(this);return t.type=this.getClassName(),this.parent&&(t.parentId=this.parent.id),this.inputs&&this.inputs.serialize(t),e.Animation.AppendSerializedAnimations(this,t),t.ranges=this.serializeAnimationRanges(),t},r.prototype.clone=function(t){return e.SerializationHelper.Clone(r.GetConstructorFromName(this.getClassName(),t,this.getScene(),this.interaxialDistance,this.isStereoscopicSideBySide),this)},r.prototype.getDirection=function(t){var r=e.Vector3.Zero();return this.getDirectionToRef(t,r),r},r.prototype.getDirectionToRef=function(t,r){e.Vector3.TransformNormalToRef(t,this.getWorldMatrix(),r)},r.GetConstructorFromName=function(t,r,i,n,o){switch(void 0===n&&(n=0),void 0===o&&(o=!0),t){case"ArcRotateCamera":return function(){return new e.ArcRotateCamera(r,0,0,1,e.Vector3.Zero(),i)};case"DeviceOrientationCamera":return function(){return new e.DeviceOrientationCamera(r,e.Vector3.Zero(),i)};case"FollowCamera":return function(){return new e.FollowCamera(r,e.Vector3.Zero(),i)};case"ArcFollowCamera":return function(){return new e.ArcFollowCamera(r,0,0,1,null,i)};case"GamepadCamera":return function(){return new e.GamepadCamera(r,e.Vector3.Zero(),i)};case"TouchCamera":return function(){return new e.TouchCamera(r,e.Vector3.Zero(),i)};case"VirtualJoysticksCamera":return function(){return new e.VirtualJoysticksCamera(r,e.Vector3.Zero(),i)};case"WebVRFreeCamera":case"WebVRGamepadCamera":return function(){return new e.WebVRFreeCamera(r,e.Vector3.Zero(),i)};case"VRDeviceOrientationFreeCamera":return function(){return new e.VRDeviceOrientationFreeCamera(r,e.Vector3.Zero(),i)};case"VRDeviceOrientationGamepadCamera":return function(){return new e.VRDeviceOrientationGamepadCamera(r,e.Vector3.Zero(),i)};case"AnaglyphArcRotateCamera":return function(){return new e.AnaglyphArcRotateCamera(r,0,0,1,e.Vector3.Zero(),n,i)};case"AnaglyphFreeCamera":return function(){return new e.AnaglyphFreeCamera(r,e.Vector3.Zero(),n,i)};case"AnaglyphGamepadCamera":return function(){return new e.AnaglyphGamepadCamera(r,e.Vector3.Zero(),n,i)};case"AnaglyphUniversalCamera":return function(){return new e.AnaglyphUniversalCamera(r,e.Vector3.Zero(),n,i)};case"StereoscopicArcRotateCamera":return function(){return new e.StereoscopicArcRotateCamera(r,0,0,1,e.Vector3.Zero(),n,o,i)};case"StereoscopicFreeCamera":return function(){return new e.StereoscopicFreeCamera(r,e.Vector3.Zero(),n,o,i)};case"StereoscopicGamepadCamera":return function(){return new e.StereoscopicGamepadCamera(r,e.Vector3.Zero(),n,o,i)};case"StereoscopicUniversalCamera":return function(){return new e.StereoscopicUniversalCamera(r,e.Vector3.Zero(),n,o,i)};case"FreeCamera":default:return function(){return new e.UniversalCamera(r,e.Vector3.Zero(),i)}}},r.prototype.computeWorldMatrix=function(){return this.getWorldMatrix()},r.Parse=function(t,i){var n=t.type,o=r.GetConstructorFromName(n,t.name,i,t.interaxial_distance,t.isStereoscopicSideBySide),s=e.SerializationHelper.Parse(o,t,i);if(t.parentId&&(s._waitingParentId=t.parentId),s.inputs&&(s.inputs.parse(t),s._setupInputs()),s.setPosition&&(s.position.copyFromFloats(0,0,0),s.setPosition(e.Vector3.FromArray(t.position))),t.target&&s.setTarget&&s.setTarget(e.Vector3.FromArray(t.target)),t.cameraRigMode){var a=t.interaxial_distance?{interaxialDistance:t.interaxial_distance}:{};s.setCameraRigMode(t.cameraRigMode,a)}if(t.animations){for(var l=0;l<t.animations.length;l++){var u=t.animations[l];s.animations.push(e.Animation.Parse(u))}e.Node.ParseAnimationRanges(s,t,i)}return t.autoAnimate&&i.beginAnimation(s,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1),s},r._PERSPECTIVE_CAMERA=0,r._ORTHOGRAPHIC_CAMERA=1,r._FOVMODE_VERTICAL_FIXED=0,r._FOVMODE_HORIZONTAL_FIXED=1,r._RIG_MODE_NONE=0,r._RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,r._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,r._RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,r._RIG_MODE_STEREOSCOPIC_OVERUNDER=13,r._RIG_MODE_VR=20,r._RIG_MODE_WEBVR=21,r.ForceAttachControlToAlwaysPreventDefault=!1,r.UseAlternateWebVRRendering=!1,o([e.serializeAsVector3()],r.prototype,"position",void 0),o([e.serializeAsVector3()],r.prototype,"upVector",void 0),o([e.serialize()],r.prototype,"orthoLeft",void 0),o([e.serialize()],r.prototype,"orthoRight",void 0),o([e.serialize()],r.prototype,"orthoBottom",void 0),o([e.serialize()],r.prototype,"orthoTop",void 0),o([e.serialize()],r.prototype,"fov",void 0),o([e.serialize()],r.prototype,"minZ",void 0),o([e.serialize()],r.prototype,"maxZ",void 0),o([e.serialize()],r.prototype,"inertia",void 0),o([e.serialize()],r.prototype,"mode",void 0),o([e.serialize()],r.prototype,"layerMask",void 0),o([e.serialize()],r.prototype,"fovMode",void 0),o([e.serialize()],r.prototype,"cameraRigMode",void 0),o([e.serialize()],r.prototype,"interaxialDistance",void 0),o([e.serialize()],r.prototype,"isStereoscopicSideBySide",void 0),r})(e.Node);e.Camera=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(e){this._renderingGroups=new Array,this._autoClearDepthStencil={},this._customOpaqueSortCompareFn={},this._customAlphaTestSortCompareFn={},this._customTransparentSortCompareFn={},this._renderinGroupInfo=null,this._scene=e;for(var r=t.MIN_RENDERINGGROUPS;r<t.MAX_RENDERINGGROUPS;r++)this._autoClearDepthStencil[r]={autoClear:!0,depth:!0,stencil:!0}}return t.prototype._clearDepthStencilBuffer=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this._depthStencilBufferAlreadyCleaned||(this._scene.getEngine().clear(null,!1,e,t),this._depthStencilBufferAlreadyCleaned=!0)},t.prototype.render=function(r,i,n,o){var s=this._scene.onRenderingGroupObservable.hasObservers()?this._scene.onRenderingGroupObservable:null,a=null;if(s&&(this._renderinGroupInfo||(this._renderinGroupInfo=new e.RenderingGroupInfo),a=this._renderinGroupInfo,a.scene=this._scene,a.camera=this._scene.activeCamera),o)for(var l=0;l<this._scene.spriteManagers.length;l++){var u=this._scene.spriteManagers[l];this.dispatchSprites(u)}for(var l=t.MIN_RENDERINGGROUPS;l<t.MAX_RENDERINGGROUPS;l++){this._depthStencilBufferAlreadyCleaned=l===t.MIN_RENDERINGGROUPS;var h=this._renderingGroups[l];if(h||s){var c=0;if(s&&a&&(c=Math.pow(2,l),a.renderStage=e.RenderingGroupInfo.STAGE_PRECLEAR,a.renderingGroupId=l,s.notifyObservers(a,c)),t.AUTOCLEAR){var f=this._autoClearDepthStencil[l];f&&f.autoClear&&this._clearDepthStencilBuffer(f.depth,f.stencil)}s&&a&&(a.renderStage=e.RenderingGroupInfo.STAGE_PREOPAQUE,s.notifyObservers(a,c),a.renderStage=e.RenderingGroupInfo.STAGE_PRETRANSPARENT,s.notifyObservers(a,c)),h&&h.render(r,o,n,i),s&&a&&(a.renderStage=e.RenderingGroupInfo.STAGE_POSTTRANSPARENT,s.notifyObservers(a,c))}}},t.prototype.reset=function(){for(var e=t.MIN_RENDERINGGROUPS;e<t.MAX_RENDERINGGROUPS;e++){var r=this._renderingGroups[e];r&&r.prepare()}},t.prototype.dispose=function(){this.freeRenderingGroups(),this._renderingGroups.length=0},t.prototype.freeRenderingGroups=function(){for(var e=t.MIN_RENDERINGGROUPS;e<t.MAX_RENDERINGGROUPS;e++){var r=this._renderingGroups[e];r&&r.dispose()}},t.prototype._prepareRenderingGroup=function(t){void 0===this._renderingGroups[t]&&(this._renderingGroups[t]=new e.RenderingGroup(t,this._scene,this._customOpaqueSortCompareFn[t],this._customAlphaTestSortCompareFn[t],this._customTransparentSortCompareFn[t]))},t.prototype.dispatchSprites=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchSprites(e)},t.prototype.dispatchParticles=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchParticles(e)},t.prototype.dispatch=function(e,t,r){void 0===t&&(t=e.getMesh());var i=t.renderingGroupId||0;this._prepareRenderingGroup(i),this._renderingGroups[i].dispatch(e,t,r)},t.prototype.setRenderingOrder=function(e,t,r,i){if(void 0===t&&(t=null),void 0===r&&(r=null),void 0===i&&(i=null),this._customOpaqueSortCompareFn[e]=t,this._customAlphaTestSortCompareFn[e]=r,this._customTransparentSortCompareFn[e]=i,this._renderingGroups[e]){var n=this._renderingGroups[e];n.opaqueSortCompareFn=this._customOpaqueSortCompareFn[e],n.alphaTestSortCompareFn=this._customAlphaTestSortCompareFn[e],n.transparentSortCompareFn=this._customTransparentSortCompareFn[e]}},t.prototype.setRenderingAutoClearDepthStencil=function(e,t,r,i){void 0===r&&(r=!0),void 0===i&&(i=!0),this._autoClearDepthStencil[e]={autoClear:t,depth:r,stencil:i}},t.MAX_RENDERINGGROUPS=4,t.MIN_RENDERINGGROUPS=0,t.AUTOCLEAR=!0,t})();e.RenderingManager=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(t,r,i,n,o){void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=null),this.index=t,this._opaqueSubMeshes=new e.SmartArray(256),this._transparentSubMeshes=new e.SmartArray(256),this._alphaTestSubMeshes=new e.SmartArray(256),this._depthOnlySubMeshes=new e.SmartArray(256),this._particleSystems=new e.SmartArray(256),this._spriteManagers=new e.SmartArray(256),this._edgesRenderers=new e.SmartArray(16),this._scene=r,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=n,this.transparentSortCompareFn=o}return Object.defineProperty(t.prototype,"opaqueSortCompareFn",{set:function(e){this._opaqueSortCompareFn=e,this._renderOpaque=e?this.renderOpaqueSorted:t.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alphaTestSortCompareFn",{set:function(e){this._alphaTestSortCompareFn=e,this._renderAlphaTest=e?this.renderAlphaTestSorted:t.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"transparentSortCompareFn",{set:function(e){this._transparentSortCompareFn=e||t.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!0,configurable:!0}),t.prototype.render=function(t,r,i,n){if(t)return void t(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);var o=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(o.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),o.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var s=o.getStencilBuffer();o.setStencilBuffer(!1),r&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(this._renderTransparent(this._transparentSubMeshes),o.setAlphaMode(e.Engine.ALPHA_DISABLE)),o.setStencilBuffer(!1);for(var a=0;a<this._edgesRenderers.length;a++)this._edgesRenderers.data[a].render();o.setStencilBuffer(s)},t.prototype.renderOpaqueSorted=function(e){return t.renderSorted(e,this._opaqueSortCompareFn,this._scene.activeCamera,!1)},t.prototype.renderAlphaTestSorted=function(e){return t.renderSorted(e,this._alphaTestSortCompareFn,this._scene.activeCamera,!1)},t.prototype.renderTransparentSorted=function(e){return t.renderSorted(e,this._transparentSortCompareFn,this._scene.activeCamera,!0)},t.renderSorted=function(t,r,i,n){for(var o,s=0,a=i?i.globalPosition:e.Vector3.Zero();s<t.length;s++)o=t.data[s],o._alphaIndex=o.getMesh().alphaIndex,o._distanceToCamera=o.getBoundingInfo().boundingSphere.centerWorld.subtract(a).length();var l=t.data.slice(0,t.length);for(r&&l.sort(r),s=0;s<l.length;s++){if(o=l[s],n){var u=o.getMaterial();if(u&&u.needDepthPrePass){var h=u.getScene().getEngine();h.setColorWrite(!1),h.setAlphaMode(e.Engine.ALPHA_DISABLE),o.render(!1),h.setColorWrite(!0)}}o.render(n)}},t.renderUnsorted=function(e){for(var t=0;t<e.length;t++){e.data[t].render(!1)}},t.defaultTransparentSortCompare=function(e,r){return e._alphaIndex>r._alphaIndex?1:e._alphaIndex<r._alphaIndex?-1:t.backToFrontSortCompare(e,r)},t.backToFrontSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0},t.frontToBackSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?-1:e._distanceToCamera>t._distanceToCamera?1:0},t.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),
- this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},t.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},t.prototype.dispatch=function(e,t,r){void 0===t&&(t=e.getMesh()),void 0===r&&(r=e.getMaterial()),null!==r&&void 0!==r&&(r.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):r.needAlphaTesting()?(r.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(r.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),null!==t._edgesRenderer&&void 0!==t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.push(t._edgesRenderer))},t.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},t.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},t.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var r=0;r<this._particleSystems.length;r++){var i=this._particleSystems.data[r];if(0!==(t&&t.layerMask&i.layerMask)){var n=i.emitter;n.position&&e&&-1===e.indexOf(n)||this._scene._activeParticles.addCount(i.render(),!1)}}this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene)}},t.prototype._renderSprites=function(){if(this._scene.spritesEnabled&&0!==this._spriteManagers.length){var e=this._scene.activeCamera;this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);for(var t=0;t<this._spriteManagers.length;t++){var r=this._spriteManagers.data[t];0!==(e&&e.layerMask&r.layerMask)&&r.render()}this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene)}},t})();e.RenderingGroup=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!0,configurable:!0}),e})(),r=(function(){function e(){}return e.STAGE_PRECLEAR=1,e.STAGE_PREOPAQUE=2,e.STAGE_PRETRANSPARENT=3,e.STAGE_POSTTRANSPARENT=4,e})();e.RenderingGroupInfo=r;var i=(function(){function r(t){this.autoClear=!0,this.autoClearDepthAndStencil=!0,this.clearColor=new e.Color4(.2,.2,.3,1),this.ambientColor=new e.Color3(0,0,0),this._forceWireframe=!1,this._forcePointsCloud=!1,this.forceShowBoundingBoxes=!1,this.animationsEnabled=!0,this._animationPropertiesOverride=null,this.useConstantAnimationDeltaTime=!1,this.constantlyUpdateMeshUnderPointer=!1,this.hoverCursor="pointer",this.defaultCursor="",this.preventDefaultOnPointerDown=!0,this.metadata=null,this.disableOfflineSupportExceptionRules=new Array,this.onDisposeObservable=new e.Observable,this._onDisposeObserver=null,this.onBeforeRenderObservable=new e.Observable,this._onBeforeRenderObserver=null,this.onAfterRenderObservable=new e.Observable,this._onAfterRenderObserver=null,this.onBeforeAnimationsObservable=new e.Observable,this.onAfterAnimationsObservable=new e.Observable,this.onBeforeDrawPhaseObservable=new e.Observable,this.onAfterDrawPhaseObservable=new e.Observable,this.onBeforePhysicsObservable=new e.Observable,this.onAfterPhysicsObservable=new e.Observable,this.onReadyObservable=new e.Observable,this.onBeforeCameraRenderObservable=new e.Observable,this._onBeforeCameraRenderObserver=null,this.onAfterCameraRenderObservable=new e.Observable,this._onAfterCameraRenderObserver=null,this.onBeforeActiveMeshesEvaluationObservable=new e.Observable,this.onAfterActiveMeshesEvaluationObservable=new e.Observable,this.onBeforeParticlesRenderingObservable=new e.Observable,this.onAfterParticlesRenderingObservable=new e.Observable,this.onBeforeSpritesRenderingObservable=new e.Observable,this.onAfterSpritesRenderingObservable=new e.Observable,this.onDataLoadedObservable=new e.Observable,this.onNewCameraAddedObservable=new e.Observable,this.onCameraRemovedObservable=new e.Observable,this.onNewLightAddedObservable=new e.Observable,this.onLightRemovedObservable=new e.Observable,this.onNewGeometryAddedObservable=new e.Observable,this.onGeometryRemovedObservable=new e.Observable,this.onNewTransformNodeAddedObservable=new e.Observable,this.onTransformNodeRemovedObservable=new e.Observable,this.onNewMeshAddedObservable=new e.Observable,this.onMeshRemovedObservable=new e.Observable,this.onBeforeRenderTargetsRenderObservable=new e.Observable,this.onAfterRenderTargetsRenderObservable=new e.Observable,this.onBeforeStepObservable=new e.Observable,this.onAfterStepObservable=new e.Observable,this.onRenderingGroupObservable=new e.Observable,this.animations=[],this._registeredForLateAnimationBindings=new e.SmartArrayNoDuplicate(256),this.onPrePointerObservable=new e.Observable,this.onPointerObservable=new e.Observable,this._meshPickProceed=!1,this._currentPickResult=null,this._previousPickResult=null,this._totalPointersPressed=0,this._doubleClickOccured=!1,this.cameraToUseForPointers=null,this._startingPointerPosition=new e.Vector2(0,0),this._previousStartingPointerPosition=new e.Vector2(0,0),this._startingPointerTime=0,this._previousStartingPointerTime=0,this._pointerCaptures={},this._timeAccumulator=0,this._currentStepId=0,this._currentInternalStep=0,this.onPreKeyboardObservable=new e.Observable,this.onKeyboardObservable=new e.Observable,this._useRightHandedSystem=!1,this._fogEnabled=!0,this._fogMode=r.FOGMODE_NONE,this.fogColor=new e.Color3(.2,.2,.3),this.fogDensity=.1,this.fogStart=0,this.fogEnd=1e3,this._shadowsEnabled=!0,this._lightsEnabled=!0,this.lights=new Array,this.cameras=new Array,this.activeCameras=new Array,this.transformNodes=new Array,this.meshes=new Array,this.animationGroups=new Array,this._geometries=new Array,this.materials=new Array,this.multiMaterials=new Array,this._texturesEnabled=!0,this.textures=new Array,this.particlesEnabled=!0,this.particleSystems=new Array,this.spritesEnabled=!0,this.spriteManagers=new Array,this.layers=new Array,this.effectLayers=new Array,this._skeletonsEnabled=!0,this.skeletons=new Array,this.morphTargetManagers=new Array,this.lensFlaresEnabled=!0,this.lensFlareSystems=new Array,this.collisionsEnabled=!0,this.gravity=new e.Vector3(0,-9.807,0),this.postProcessesEnabled=!0,this.postProcesses=new Array,this.renderTargetsEnabled=!0,this.dumpNextRenderTargets=!1,this.customRenderTargets=new Array,this.importedMeshesFiles=new Array,this.probesEnabled=!0,this.reflectionProbes=new Array,this._actionManagers=new Array,this._meshesForIntersections=new e.SmartArrayNoDuplicate(256),this.proceduralTexturesEnabled=!0,this.proceduralTextures=new Array,this.soundTracks=new Array,this._audioEnabled=!0,this._headphone=!1,this._totalVertices=new e.PerfCounter,this._activeIndices=new e.PerfCounter,this._activeParticles=new e.PerfCounter,this._activeBones=new e.PerfCounter,this._animationTime=0,this.animationTimeScale=1,this._renderId=0,this._executeWhenReadyTimeoutId=-1,this._intermediateRendering=!1,this._viewUpdateFlag=-1,this._projectionUpdateFlag=-1,this._alternateViewUpdateFlag=-1,this._alternateProjectionUpdateFlag=-1,this._toBeDisposed=new e.SmartArray(256),this._activeRequests=new Array,this._pendingData=new Array,this._isDisposed=!1,this.dispatchAllSubMeshesOfActiveMeshes=!1,this._activeMeshes=new e.SmartArray(256),this._processedMaterials=new e.SmartArray(256),this._renderTargets=new e.SmartArrayNoDuplicate(256),this._activeParticleSystems=new e.SmartArray(256),this._activeSkeletons=new e.SmartArrayNoDuplicate(32),this._softwareSkinnedMeshes=new e.SmartArrayNoDuplicate(32),this._activeAnimatables=new Array,this._transformMatrix=e.Matrix.Zero(),this._useAlternateCameraConfiguration=!1,this._alternateRendering=!1,this.requireLightSorting=!1,this._depthRenderer={},this._activeMeshesFrozen=!1,this._tempPickingRay=e.Ray?e.Ray.Zero():null,this._engine=t||e.Engine.LastCreatedEngine,this._engine.scenes.push(this),this._uid=null,this._renderingManager=new e.RenderingManager(this),this.postProcessManager=new e.PostProcessManager(this),e.OutlineRenderer&&(this._outlineRenderer=new e.OutlineRenderer(this)),e.Tools.IsWindowObjectExist()&&this.attachControl(),e.SimplificationQueue&&(this.simplificationQueue=new e.SimplificationQueue),this.workerCollisions=!1,this._createUbo(),this._imageProcessingConfiguration=new e.ImageProcessingConfiguration}return Object.defineProperty(r,"FOGMODE_NONE",{get:function(){return r._FOGMODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(r,"FOGMODE_EXP",{get:function(){return r._FOGMODE_EXP},enumerable:!0,configurable:!0}),Object.defineProperty(r,"FOGMODE_EXP2",{get:function(){return r._FOGMODE_EXP2},enumerable:!0,configurable:!0}),Object.defineProperty(r,"FOGMODE_LINEAR",{get:function(){return r._FOGMODE_LINEAR},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(t){this._environmentTexture!==t&&(this._environmentTexture=t,this.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"forceWireframe",{get:function(){return this._forceWireframe},set:function(t){this._forceWireframe!==t&&(this._forceWireframe=t,this.markAllMaterialsAsDirty(e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"forcePointsCloud",{get:function(){return this._forcePointsCloud},set:function(t){this._forcePointsCloud!==t&&(this._forcePointsCloud=t,this.markAllMaterialsAsDirty(e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"beforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"afterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"beforeCameraRender",{set:function(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"afterCameraRender",{set:function(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"gamepadManager",{get:function(){return this._gamepadManager||(this._gamepadManager=new e.GamepadManager(this)),this._gamepadManager},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"unTranslatedPointer",{get:function(){return new e.Vector2(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"useRightHandedSystem",{get:function(){return this._useRightHandedSystem},set:function(t){this._useRightHandedSystem!==t&&(this._useRightHandedSystem=t,this.markAllMaterialsAsDirty(e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),r.prototype.setStepId=function(e){this._currentStepId=e},r.prototype.getStepId=function(){return this._currentStepId},r.prototype.getInternalStep=function(){return this._currentInternalStep},Object.defineProperty(r.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(t){this._fogEnabled!==t&&(this._fogEnabled=t,this.markAllMaterialsAsDirty(e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"fogMode",{get:function(){return this._fogMode},set:function(t){this._fogMode!==t&&(this._fogMode=t,this.markAllMaterialsAsDirty(e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"shadowsEnabled",{get:function(){return this._shadowsEnabled},set:function(t){this._shadowsEnabled!==t&&(this._shadowsEnabled=t,this.markAllMaterialsAsDirty(e.Material.LightDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"lightsEnabled",{get:function(){return this._lightsEnabled},set:function(t){this._lightsEnabled!==t&&(this._lightsEnabled=t,this.markAllMaterialsAsDirty(e.Material.LightDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"defaultMaterial",{get:function(){return this._defaultMaterial||(this._defaultMaterial=new e.StandardMaterial("default material",this)),this._defaultMaterial},set:function(e){this._defaultMaterial=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"texturesEnabled",{get:function(){return this._texturesEnabled},set:function(t){this._texturesEnabled!==t&&(this._texturesEnabled=t,this.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skeletonsEnabled",{get:function(){return this._skeletonsEnabled},set:function(t){this._skeletonsEnabled!==t&&(this._skeletonsEnabled=t,this.markAllMaterialsAsDirty(e.Material.AttributesDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"postProcessRenderPipelineManager",{get:function(){return this._postProcessRenderPipelineManager||(this._postProcessRenderPipelineManager=new e.PostProcessRenderPipelineManager),this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"mainSoundTrack",{get:function(){return this._mainSoundTrack||(this._mainSoundTrack=new e.SoundTrack(this,{mainTrack:!0})),this._mainSoundTrack},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_isAlternateRenderingEnabled",{get:function(){return this._alternateRendering},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"frustumPlanes",{get:function(){return this._frustumPlanes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"geometryBufferRenderer",{get:function(){return this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"debugLayer",{get:function(){return this._debugLayer||(this._debugLayer=new e.DebugLayer(this)),this._debugLayer},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"workerCollisions",{get:function(){return this._workerCollisions},set:function(t){e.CollisionCoordinatorLegacy&&(t=t&&!!Worker&&!!e.CollisionWorker,this._workerCollisions=t,this.collisionCoordinator&&this.collisionCoordinator.destroy(),this.collisionCoordinator=t?new e.CollisionCoordinatorWorker:new e.CollisionCoordinatorLegacy,this.collisionCoordinator.init(this))},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"selectionOctree",{get:function(){return this._selectionOctree},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointerX",{get:function(){return this._pointerX},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"pointerY",{get:function(){return this._pointerY},enumerable:!0,configurable:!0}),r.prototype.getCachedMaterial=function(){return this._cachedMaterial},r.prototype.getCachedEffect=function(){return this._cachedEffect},r.prototype.getCachedVisibility=function(){return this._cachedVisibility},r.prototype.isCachedMaterialInvalid=function(e,t,r){return void 0===r&&(r=1),this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==r},r.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new e.BoundingBoxRenderer(this)),this._boundingBoxRenderer},r.prototype.getOutlineRenderer=function(){return this._outlineRenderer},r.prototype.getEngine=function(){return this._engine},r.prototype.getTotalVertices=function(){return this._totalVertices.current},Object.defineProperty(r.prototype,"totalVerticesPerfCounter",{get:function(){return this._totalVertices},enumerable:!0,configurable:!0}),r.prototype.getActiveIndices=function(){return this._activeIndices.current},Object.defineProperty(r.prototype,"totalActiveIndicesPerfCounter",{get:function(){return this._activeIndices},enumerable:!0,configurable:!0}),r.prototype.getActiveParticles=function(){return this._activeParticles.current},Object.defineProperty(r.prototype,"activeParticlesPerfCounter",{get:function(){return this._activeParticles},enumerable:!0,configurable:!0}),r.prototype.getActiveBones=function(){return this._activeBones.current},Object.defineProperty(r.prototype,"activeBonesPerfCounter",{get:function(){return this._activeBones},enumerable:!0,configurable:!0}),r.prototype.getInterFramePerfCounter=function(){return e.Tools.Warn("getInterFramePerfCounter is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"interFramePerfCounter",{get:function(){return e.Tools.Warn("interFramePerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getLastFrameDuration=function(){return e.Tools.Warn("getLastFrameDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"lastFramePerfCounter",{get:function(){return e.Tools.Warn("lastFramePerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getEvaluateActiveMeshesDuration=function(){return e.Tools.Warn("getEvaluateActiveMeshesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"evaluateActiveMeshesDurationPerfCounter",{get:function(){return e.Tools.Warn("evaluateActiveMeshesDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getActiveMeshes=function(){return this._activeMeshes},r.prototype.getRenderTargetsDuration=function(){return e.Tools.Warn("getRenderTargetsDuration is deprecated. Please use SceneInstrumentation class"),0},r.prototype.getRenderDuration=function(){return e.Tools.Warn("getRenderDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"renderDurationPerfCounter",{get:function(){return e.Tools.Warn("renderDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getParticlesDuration=function(){return e.Tools.Warn("getParticlesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"particlesDurationPerfCounter",{get:function(){return e.Tools.Warn("particlesDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getSpritesDuration=function(){return e.Tools.Warn("getSpritesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(r.prototype,"spriteDuractionPerfCounter",{get:function(){return e.Tools.Warn("spriteDuractionPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),r.prototype.getAnimationRatio=function(){return this._animationRatio},r.prototype.getRenderId=function(){return this._renderId},r.prototype.incrementRenderId=function(){this._renderId++},r.prototype._updatePointerPosition=function(e){var t=this._engine.getRenderingCanvasClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},r.prototype._createUbo=function(){this._sceneUbo=new e.UniformBuffer(this._engine,void 0,!0),this._sceneUbo.addUniform("viewProjection",16),this._sceneUbo.addUniform("view",16)},r.prototype._createAlternateUbo=function(){this._alternateSceneUbo=new e.UniformBuffer(this._engine,void 0,!0),this._alternateSceneUbo.addUniform("viewProjection",16),this._alternateSceneUbo.addUniform("view",16)},r.prototype._pickSpriteButKeepRay=function(e,t,r,i,n,o){var s=this.pickSprite(t,r,i,n,o);return s&&(s.ray=e?e.ray:null),s},r.prototype._setRayOnPointerInfo=function(t){t.pickInfo&&(t.pickInfo.ray||(t.pickInfo.ray=this.createPickingRay(t.event.offsetX,t.event.offsetY,e.Matrix.Identity(),this.activeCamera)))},r.prototype.simulatePointerMove=function(t,r){var i=new PointerEvent("pointermove",r);return this._checkPrePointerObservable(t,i,e.PointerEventTypes.POINTERMOVE)?this:this._processPointerMove(t,i)},r.prototype._processPointerMove=function(t,r){var i=this._engine.getRenderingCanvas();if(!i)return this;if(t&&t.hit&&t.pickedMesh?(this.setPointerOverSprite(null),this.setPointerOverMesh(t.pickedMesh),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers?this._pointerOverMesh.actionManager.hoverCursor?i.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:i.style.cursor=this.hoverCursor:i.style.cursor=this.defaultCursor):(this.setPointerOverMesh(null),t=this._pickSpriteButKeepRay(t,this._unTranslatedPointerX,this._unTranslatedPointerY,this._spritePredicate,!1,this.cameraToUseForPointers||void 0),t&&t.hit&&t.pickedSprite?(this.setPointerOverSprite(t.pickedSprite),this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.hoverCursor?i.style.cursor=this._pointerOverSprite.actionManager.hoverCursor:i.style.cursor=this.hoverCursor):(this.setPointerOverSprite(null),i.style.cursor=this.defaultCursor)),t){var n="mousewheel"===r.type||"DOMMouseScroll"===r.type?e.PointerEventTypes.POINTERWHEEL:e.PointerEventTypes.POINTERMOVE;if(this.onPointerMove&&this.onPointerMove(r,t,n),this.onPointerObservable.hasObservers()){var o=new e.PointerInfo(n,r,t);this._setRayOnPointerInfo(o),this.onPointerObservable.notifyObservers(o,n)}}return this},r.prototype._checkPrePointerObservable=function(t,r,i){var n=new e.PointerInfoPre(i,r,this._unTranslatedPointerX,this._unTranslatedPointerY);return t&&(n.ray=t.ray),this.onPrePointerObservable.notifyObservers(n,i),!!n.skipOnPointerObservable},r.prototype.simulatePointerDown=function(t,r){var i=new PointerEvent("pointerdown",r);return this._checkPrePointerObservable(t,i,e.PointerEventTypes.POINTERDOWN)?this:this._processPointerDown(t,i)},r.prototype._processPointerDown=function(t,i){var n=this;if(t&&t.hit&&t.pickedMesh){this._pickedDownMesh=t.pickedMesh;var o=t.pickedMesh.actionManager;if(o){if(o.hasPickTriggers)switch(o.processTrigger(e.ActionManager.OnPickDownTrigger,e.ActionEvent.CreateNew(t.pickedMesh,i)),i.button){case 0:o.processTrigger(e.ActionManager.OnLeftPickTrigger,e.ActionEvent.CreateNew(t.pickedMesh,i));break;case 1:o.processTrigger(e.ActionManager.OnCenterPickTrigger,e.ActionEvent.CreateNew(t.pickedMesh,i));break;case 2:o.processTrigger(e.ActionManager.OnRightPickTrigger,e.ActionEvent.CreateNew(t.pickedMesh,i))}o.hasSpecificTrigger(e.ActionManager.OnLongPressTrigger)&&window.setTimeout((function(){var t=n.pick(n._unTranslatedPointerX,n._unTranslatedPointerY,(function(t){return t.isPickable&&t.isVisible&&t.isReady()&&t.actionManager&&t.actionManager.hasSpecificTrigger(e.ActionManager.OnLongPressTrigger)&&t==n._pickedDownMesh}),!1,n.cameraToUseForPointers);t&&t.hit&&t.pickedMesh&&o&&0!==n._totalPointersPressed&&Date.now()-n._startingPointerTime>r.LongPressDelay&&Math.abs(n._startingPointerPosition.x-n._pointerX)<r.DragMovementThreshold&&Math.abs(n._startingPointerPosition.y-n._pointerY)<r.DragMovementThreshold&&(n._startingPointerTime=0,o.processTrigger(e.ActionManager.OnLongPressTrigger,e.ActionEvent.CreateNew(t.pickedMesh,i)))}),r.LongPressDelay)}}if(t){var s=e.PointerEventTypes.POINTERDOWN;if(this.onPointerDown&&this.onPointerDown(i,t,s),this.onPointerObservable.hasObservers()){var a=new e.PointerInfo(s,i,t);this._setRayOnPointerInfo(a),this.onPointerObservable.notifyObservers(a,s)}}return this},r.prototype.simulatePointerUp=function(r,i){var n=new PointerEvent("pointerup",i),o=new t;return o.singleClick=!0,o.ignore=!0,this._checkPrePointerObservable(r,n,e.PointerEventTypes.POINTERUP)?this:this._processPointerUp(r,n,o)},r.prototype._processPointerUp=function(t,r,i){if(t&&t&&t.pickedMesh){if(this._pickedUpMesh=t.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(this.onPointerPick&&this.onPointerPick(r,t),i.singleClick&&!i.ignore&&this.onPointerObservable.hasObservers())){var n=e.PointerEventTypes.POINTERPICK,o=new e.PointerInfo(n,r,t);this._setRayOnPointerInfo(o),this.onPointerObservable.notifyObservers(o,n)}t.pickedMesh.actionManager&&(i.ignore&&t.pickedMesh.actionManager.processTrigger(e.ActionManager.OnPickUpTrigger,e.ActionEvent.CreateNew(t.pickedMesh,r)),i.hasSwiped||i.ignore||!i.singleClick||t.pickedMesh.actionManager.processTrigger(e.ActionManager.OnPickTrigger,e.ActionEvent.CreateNew(t.pickedMesh,r)),i.doubleClick&&!i.ignore&&t.pickedMesh.actionManager.hasSpecificTrigger(e.ActionManager.OnDoublePickTrigger)&&t.pickedMesh.actionManager.processTrigger(e.ActionManager.OnDoublePickTrigger,e.ActionEvent.CreateNew(t.pickedMesh,r)))}this._pickedDownMesh&&this._pickedDownMesh.actionManager&&this._pickedDownMesh.actionManager.hasSpecificTrigger(e.ActionManager.OnPickOutTrigger)&&this._pickedDownMesh!==this._pickedUpMesh&&this._pickedDownMesh.actionManager.processTrigger(e.ActionManager.OnPickOutTrigger,e.ActionEvent.CreateNew(this._pickedDownMesh,r));var s=e.PointerEventTypes.POINTERUP;if(this.onPointerObservable.hasObservers())if(i.ignore){var o=new e.PointerInfo(s,r,t);this._setRayOnPointerInfo(o),this.onPointerObservable.notifyObservers(o,s)}else if(!i.hasSwiped){if(i.singleClick&&this.onPointerObservable.hasSpecificMask(e.PointerEventTypes.POINTERTAP)){var a=e.PointerEventTypes.POINTERTAP,o=new e.PointerInfo(a,r,t);this._setRayOnPointerInfo(o),this.onPointerObservable.notifyObservers(o,a)}if(i.doubleClick&&this.onPointerObservable.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP)){var l=e.PointerEventTypes.POINTERDOUBLETAP,o=new e.PointerInfo(l,r,t);this._setRayOnPointerInfo(o),this.onPointerObservable.notifyObservers(o,l)}}return this.onPointerUp&&this.onPointerUp(r,t,s),this},r.prototype.isPointerCaptured=function(e){return void 0===e&&(e=0),this._pointerCaptures[e]},r.prototype.attachControl=function(i,n,o){var s=this;void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===o&&(o=!0),this._initActionManager=function(e,t){if(!s._meshPickProceed){var r=s.pick(s._unTranslatedPointerX,s._unTranslatedPointerY,s.pointerDownPredicate,!1,s.cameraToUseForPointers);s._currentPickResult=r,r&&(e=r.hit&&r.pickedMesh?r.pickedMesh.actionManager:null),s._meshPickProceed=!0}return e},this._delayedSimpleClick=function(e,t,i){(Date.now()-s._previousStartingPointerTime>r.DoubleClickDelay&&!s._doubleClickOccured||e!==s._previousButtonPressed)&&(s._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,i(t,s._currentPickResult))},this._initClickEvent=function(i,n,o,a){var l=new t;s._currentPickResult=null;var u=null,h=i.hasSpecificMask(e.PointerEventTypes.POINTERPICK)||n.hasSpecificMask(e.PointerEventTypes.POINTERPICK)||i.hasSpecificMask(e.PointerEventTypes.POINTERTAP)||n.hasSpecificMask(e.PointerEventTypes.POINTERTAP)||i.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP)||n.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP);if(!h&&e.ActionManager&&e.ActionManager.HasPickTriggers&&(u=s._initActionManager(u,l))&&(h=u.hasPickTriggers),h){var c=o.button;if(l.hasSwiped=Math.abs(s._startingPointerPosition.x-s._pointerX)>r.DragMovementThreshold||Math.abs(s._startingPointerPosition.y-s._pointerY)>r.DragMovementThreshold,!l.hasSwiped){var f=!r.ExclusiveDoubleClickMode;f||(f=!i.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP)&&!n.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP))&&!e.ActionManager.HasSpecificTrigger(e.ActionManager.OnDoublePickTrigger)&&(u=s._initActionManager(u,l))&&(f=!u.hasSpecificTrigger(e.ActionManager.OnDoublePickTrigger)),f?(Date.now()-s._previousStartingPointerTime>r.DoubleClickDelay||c!==s._previousButtonPressed)&&(l.singleClick=!0,a(l,s._currentPickResult)):(s._previousDelayedSimpleClickTimeout=s._delayedSimpleClickTimeout,s._delayedSimpleClickTimeout=window.setTimeout(s._delayedSimpleClick.bind(s,c,l,a),r.DoubleClickDelay));var d=i.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP)||n.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP);!d&&e.ActionManager.HasSpecificTrigger(e.ActionManager.OnDoublePickTrigger)&&(u=s._initActionManager(u,l))&&(d=u.hasSpecificTrigger(e.ActionManager.OnDoublePickTrigger)),d&&(c===s._previousButtonPressed&&Date.now()-s._previousStartingPointerTime<r.DoubleClickDelay&&!s._doubleClickOccured?!l.hasSwiped&&Math.abs(s._previousStartingPointerPosition.x-s._startingPointerPosition.x)<r.DragMovementThreshold&&Math.abs(s._previousStartingPointerPosition.y-s._startingPointerPosition.y)<r.DragMovementThreshold?(s._previousStartingPointerTime=0,s._doubleClickOccured=!0,l.doubleClick=!0,l.ignore=!1,r.ExclusiveDoubleClickMode&&s._previousDelayedSimpleClickTimeout&&clearTimeout(s._previousDelayedSimpleClickTimeout),s._previousDelayedSimpleClickTimeout=s._delayedSimpleClickTimeout,a(l,s._currentPickResult)):(s._doubleClickOccured=!1,s._previousStartingPointerTime=s._startingPointerTime,s._previousStartingPointerPosition.x=s._startingPointerPosition.x,s._previousStartingPointerPosition.y=s._startingPointerPosition.y,s._previousButtonPressed=c,r.ExclusiveDoubleClickMode?(s._previousDelayedSimpleClickTimeout&&clearTimeout(s._previousDelayedSimpleClickTimeout),s._previousDelayedSimpleClickTimeout=s._delayedSimpleClickTimeout,a(l,s._previousPickResult)):a(l,s._currentPickResult)):(s._doubleClickOccured=!1,s._previousStartingPointerTime=s._startingPointerTime,s._previousStartingPointerPosition.x=s._startingPointerPosition.x,s._previousStartingPointerPosition.y=s._startingPointerPosition.y,s._previousButtonPressed=c))}}l.ignore=!0,a(l,s._currentPickResult)},this._spritePredicate=function(e){return e.isPickable&&e.actionManager&&e.actionManager.hasPointerTriggers},this._onPointerMove=function(t){if(s._updatePointerPosition(t),!s._checkPrePointerObservable(null,t,"mousewheel"===t.type||"DOMMouseScroll"===t.type?e.PointerEventTypes.POINTERWHEEL:e.PointerEventTypes.POINTERMOVE)&&(s.cameraToUseForPointers||s.activeCamera)){s.pointerMovePredicate||(s.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||s.constantlyUpdateMeshUnderPointer||null!==e.actionManager&&void 0!==e.actionManager)})
- ;var r=s.pick(s._unTranslatedPointerX,s._unTranslatedPointerY,s.pointerMovePredicate,!1,s.cameraToUseForPointers);s._processPointerMove(r,t)}},this._onPointerDown=function(t){if(s._totalPointersPressed++,s._pickedDownMesh=null,s._meshPickProceed=!1,s._updatePointerPosition(t),s.preventDefaultOnPointerDown&&u&&(t.preventDefault(),u.focus()),!s._checkPrePointerObservable(null,t,e.PointerEventTypes.POINTERDOWN)&&(s.cameraToUseForPointers||s.activeCamera)){s._pointerCaptures[t.pointerId]=!0,s._startingPointerPosition.x=s._pointerX,s._startingPointerPosition.y=s._pointerY,s._startingPointerTime=Date.now(),s.pointerDownPredicate||(s.pointerDownPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()}),s._pickedDownMesh=null;var r=s.pick(s._unTranslatedPointerX,s._unTranslatedPointerY,s.pointerDownPredicate,!1,s.cameraToUseForPointers);if(s._processPointerDown(r,t),s._pickedDownSprite=null,s.spriteManagers.length>0&&(r=s.pickSprite(s._unTranslatedPointerX,s._unTranslatedPointerY,s._spritePredicate,!1,s.cameraToUseForPointers||void 0))&&r.hit&&r.pickedSprite&&r.pickedSprite.actionManager){switch(s._pickedDownSprite=r.pickedSprite,t.button){case 0:r.pickedSprite.actionManager.processTrigger(e.ActionManager.OnLeftPickTrigger,e.ActionEvent.CreateNewFromSprite(r.pickedSprite,s,t));break;case 1:r.pickedSprite.actionManager.processTrigger(e.ActionManager.OnCenterPickTrigger,e.ActionEvent.CreateNewFromSprite(r.pickedSprite,s,t));break;case 2:r.pickedSprite.actionManager.processTrigger(e.ActionManager.OnRightPickTrigger,e.ActionEvent.CreateNewFromSprite(r.pickedSprite,s,t))}r.pickedSprite.actionManager&&r.pickedSprite.actionManager.processTrigger(e.ActionManager.OnPickDownTrigger,e.ActionEvent.CreateNewFromSprite(r.pickedSprite,s,t))}}},this._onPointerUp=function(t){0!==s._totalPointersPressed&&(s._totalPointersPressed--,s._pickedUpMesh=null,s._meshPickProceed=!1,s._updatePointerPosition(t),s._initClickEvent(s.onPrePointerObservable,s.onPointerObservable,t,(function(i,n){if(s.onPrePointerObservable.hasObservers())if(i.ignore){if(s._checkPrePointerObservable(null,t,e.PointerEventTypes.POINTERUP))return}else if(!i.hasSwiped){if(i.singleClick&&s.onPrePointerObservable.hasSpecificMask(e.PointerEventTypes.POINTERTAP)&&s._checkPrePointerObservable(null,t,e.PointerEventTypes.POINTERTAP))return;if(i.doubleClick&&s.onPrePointerObservable.hasSpecificMask(e.PointerEventTypes.POINTERDOUBLETAP)&&s._checkPrePointerObservable(null,t,e.PointerEventTypes.POINTERDOUBLETAP))return}if(s.cameraToUseForPointers||s.activeCamera){if(s._pointerCaptures[t.pointerId]=!1,s.pointerUpPredicate||(s.pointerUpPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()}),!s._meshPickProceed&&(e.ActionManager&&e.ActionManager.HasTriggers||s.onPointerObservable.hasObservers())&&s._initActionManager(null,i),n||(n=s._currentPickResult),s._processPointerUp(n,t,i),!i.ignore&&s.spriteManagers.length>0){var o=s.pickSprite(s._unTranslatedPointerX,s._unTranslatedPointerY,s._spritePredicate,!1,s.cameraToUseForPointers||void 0);o&&(o.hit&&o.pickedSprite&&o.pickedSprite.actionManager&&(o.pickedSprite.actionManager.processTrigger(e.ActionManager.OnPickUpTrigger,e.ActionEvent.CreateNewFromSprite(o.pickedSprite,s,t)),o.pickedSprite.actionManager&&Math.abs(s._startingPointerPosition.x-s._pointerX)<r.DragMovementThreshold&&Math.abs(s._startingPointerPosition.y-s._pointerY)<r.DragMovementThreshold&&o.pickedSprite.actionManager.processTrigger(e.ActionManager.OnPickTrigger,e.ActionEvent.CreateNewFromSprite(o.pickedSprite,s,t))),s._pickedDownSprite&&s._pickedDownSprite.actionManager&&s._pickedDownSprite!==o.pickedSprite&&s._pickedDownSprite.actionManager.processTrigger(e.ActionManager.OnPickOutTrigger,e.ActionEvent.CreateNewFromSprite(s._pickedDownSprite,s,t)))}s._previousPickResult=s._currentPickResult}})))},this._onKeyDown=function(t){var r=e.KeyboardEventTypes.KEYDOWN;if(s.onPreKeyboardObservable.hasObservers()){var i=new e.KeyboardInfoPre(r,t);if(s.onPreKeyboardObservable.notifyObservers(i,r),i.skipOnPointerObservable)return}if(s.onKeyboardObservable.hasObservers()){var i=new e.KeyboardInfo(r,t);s.onKeyboardObservable.notifyObservers(i,r)}s.actionManager&&s.actionManager.processTrigger(e.ActionManager.OnKeyDownTrigger,e.ActionEvent.CreateNewFromScene(s,t))},this._onKeyUp=function(t){var r=e.KeyboardEventTypes.KEYUP;if(s.onPreKeyboardObservable.hasObservers()){var i=new e.KeyboardInfoPre(r,t);if(s.onPreKeyboardObservable.notifyObservers(i,r),i.skipOnPointerObservable)return}if(s.onKeyboardObservable.hasObservers()){var i=new e.KeyboardInfo(r,t);s.onKeyboardObservable.notifyObservers(i,r)}s.actionManager&&s.actionManager.processTrigger(e.ActionManager.OnKeyUpTrigger,e.ActionEvent.CreateNewFromScene(s,t))};var a=this.getEngine();this._onCanvasFocusObserver=a.onCanvasFocusObservable.add((function(){u&&(u.addEventListener("keydown",s._onKeyDown,!1),u.addEventListener("keyup",s._onKeyUp,!1))})),this._onCanvasBlurObserver=a.onCanvasBlurObservable.add((function(){u&&(u.removeEventListener("keydown",s._onKeyDown),u.removeEventListener("keyup",s._onKeyUp))}));var l=e.Tools.GetPointerPrefix(),u=this._engine.getRenderingCanvas();u&&(o&&(u.addEventListener(l+"move",this._onPointerMove,!1),u.addEventListener("mousewheel",this._onPointerMove,!1),u.addEventListener("DOMMouseScroll",this._onPointerMove,!1)),n&&u.addEventListener(l+"down",this._onPointerDown,!1),i&&window.addEventListener(l+"up",this._onPointerUp,!1),u.tabIndex=1)},r.prototype.detachControl=function(){var t=this.getEngine(),r=e.Tools.GetPointerPrefix(),i=t.getRenderingCanvas();i&&(i.removeEventListener(r+"move",this._onPointerMove),i.removeEventListener(r+"down",this._onPointerDown),window.removeEventListener(r+"up",this._onPointerUp),this._onCanvasBlurObserver&&t.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onCanvasFocusObserver&&t.onCanvasFocusObservable.remove(this._onCanvasFocusObserver),i.removeEventListener("mousewheel",this._onPointerMove),i.removeEventListener("DOMMouseScroll",this._onPointerMove),i.removeEventListener("keydown",this._onKeyDown),i.removeEventListener("keyup",this._onKeyUp),this.onKeyboardObservable.clear(),this.onPreKeyboardObservable.clear(),this.onPointerObservable.clear(),this.onPrePointerObservable.clear())},r.prototype.isReady=function(){if(this._isDisposed)return!1;if(this._pendingData.length>0)return!1;var t,r=this.getEngine();for(t=0;t<this._geometries.length;t++){if(this._geometries[t].delayLoadState===e.Engine.DELAYLOADSTATE_LOADING)return!1}for(t=0;t<this.meshes.length;t++){var i=this.meshes[t];if(i.isEnabled()&&(i.subMeshes&&0!==i.subMeshes.length)){if(!i.isReady(!0))return!1;for(var n="InstancedMesh"===i.getClassName()||r.getCaps().instancedArrays&&i.instances.length>0,o=0,s=this.effectLayers;o<s.length;o++){var a=s[o];if(a.hasMesh(i))for(var l=0,u=i.subMeshes;l<u.length;l++){var h=u[l];if(!a.isReady(h,n))return!1}}}}if(this.activeCameras&&this.activeCameras.length>0)for(var c=0,f=this.activeCameras;c<f.length;c++){var d=f[c];if(!d.isReady(!0))return!1}else if(this.activeCamera&&!this.activeCamera.isReady(!0))return!1;for(var p=0,A=this.particleSystems;p<A.length;p++){if(!A[p].isReady())return!1}return!0},r.prototype.resetCachedMaterial=function(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null},r.prototype.registerBeforeRender=function(e){this.onBeforeRenderObservable.add(e)},r.prototype.unregisterBeforeRender=function(e){this.onBeforeRenderObservable.removeCallback(e)},r.prototype.registerAfterRender=function(e){this.onAfterRenderObservable.add(e)},r.prototype.unregisterAfterRender=function(e){this.onAfterRenderObservable.removeCallback(e)},r.prototype._executeOnceBeforeRender=function(e){var t=this,r=function(){e(),setTimeout((function(){t.unregisterBeforeRender(r)}))};this.registerBeforeRender(r)},r.prototype.executeOnceBeforeRender=function(e,t){var r=this;void 0!==t?setTimeout((function(){r._executeOnceBeforeRender(e)}),t):this._executeOnceBeforeRender(e)},r.prototype._addPendingData=function(e){this._pendingData.push(e)},r.prototype._removePendingData=function(e){var t=this.isLoading,r=this._pendingData.indexOf(e);-1!==r&&this._pendingData.splice(r,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)},r.prototype.getWaitingItemsCount=function(){return this._pendingData.length},Object.defineProperty(r.prototype,"isLoading",{get:function(){return this._pendingData.length>0},enumerable:!0,configurable:!0}),r.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout((function(){t._checkIsReady()}),150))},r.prototype.whenReadyAsync=function(){var e=this;return new Promise(function(t){e.executeWhenReady((function(){t()}))})},r.prototype._checkIsReady=function(){var e=this;if(this.isReady())return this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1);this._executeWhenReadyTimeoutId=setTimeout((function(){e._checkIsReady()}),150)},r.prototype.beginWeightedAnimation=function(e,t,r,i,n,o,s,a){void 0===i&&(i=1),void 0===o&&(o=1);var l=this.beginAnimation(e,t,r,n,o,s,a,!1);return l.weight=i,l},r.prototype.beginAnimation=function(t,r,i,n,o,s,a,l){if(void 0===o&&(o=1),void 0===l&&(l=!0),r>i&&o>0&&(o*=-1),l&&this.stopAnimation(t),a||(a=new e.Animatable(this,t,r,i,n,o,s)),t.animations&&a.appendAnimations(t,t.animations),t.getAnimatables)for(var u=t.getAnimatables(),h=0;h<u.length;h++)this.beginAnimation(u[h],r,i,n,o,s,a,l);return a.reset(),a},r.prototype.beginDirectAnimation=function(t,r,i,n,o,s,a){return void 0===s&&(s=1),new e.Animatable(this,t,i,n,o,s,a,r)},r.prototype.beginDirectHierarchyAnimation=function(e,t,r,i,n,o,s,a){var l=e.getDescendants(t),u=[];u.push(this.beginDirectAnimation(e,r,i,n,o,s,a));for(var h=0,c=l;h<c.length;h++){var f=c[h];u.push(this.beginDirectAnimation(f,r,i,n,o,s,a))}return u},r.prototype.getAnimatableByTarget=function(e){for(var t=0;t<this._activeAnimatables.length;t++)if(this._activeAnimatables[t].target===e)return this._activeAnimatables[t];return null},r.prototype.getAllAnimatablesByTarget=function(e){for(var t=[],r=0;r<this._activeAnimatables.length;r++)this._activeAnimatables[r].target===e&&t.push(this._activeAnimatables[r]);return t},Object.defineProperty(r.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!0,configurable:!0}),r.prototype.stopAnimation=function(e,t){for(var r=this.getAllAnimatablesByTarget(e),i=0,n=r;i<n.length;i++){n[i].stop(t)}},r.prototype.stopAllAnimations=function(){if(this._activeAnimatables){for(var e=0;e<this._activeAnimatables.length;e++)this._activeAnimatables[e].stop();this._activeAnimatables=[]}for(var t=0,r=this.animationGroups;t<r.length;t++){r[t].stop()}},r.prototype._animate=function(){if(this.animationsEnabled&&0!==this._activeAnimatables.length){var t=e.Tools.Now;if(!this._animationTimeLast){if(this._pendingData.length>0)return;this._animationTimeLast=t}var r=this.useConstantAnimationDeltaTime?16:(t-this._animationTimeLast)*this.animationTimeScale;this._animationTime+=r,this._animationTimeLast=t;for(var i=0;i<this._activeAnimatables.length;i++)this._activeAnimatables[i]._animate(this._animationTime);this._processLateAnimationBindings()}},r.prototype._registerTargetForLateAnimationBinding=function(e,t){var r=e.target;this._registeredForLateAnimationBindings.pushNoDuplicate(r),r._lateAnimationHolders||(r._lateAnimationHolders={}),r._lateAnimationHolders[e.targetPath]||(r._lateAnimationHolders[e.targetPath]={totalWeight:0,animations:[],originalValue:t}),r._lateAnimationHolders[e.targetPath].animations.push(e),r._lateAnimationHolders[e.targetPath].totalWeight+=e.weight},r.prototype._processLateAnimationBindingsForMatrices=function(t){var r=1,i=e.Tmp.Vector3[0],n=e.Tmp.Vector3[1],o=e.Tmp.Quaternion[0],s=0,a=t.animations[0],l=t.originalValue,u=1;if(t.totalWeight<1)l.decompose(n,o,i),u=1-t.totalWeight;else if(s=1,r=t.totalWeight,a.currentValue.decompose(n,o,i),1==(u=a.weight/r))return a.currentValue;n.scaleInPlace(u),i.scaleInPlace(u),o.scaleInPlace(u);for(var h=s;h<t.animations.length;h++){var c=t.animations[h],u=c.weight/r,f=e.Tmp.Vector3[2],d=e.Tmp.Vector3[3],p=e.Tmp.Quaternion[1];c.currentValue.decompose(d,p,f),d.scaleAndAddToRef(u,n),p.scaleAndAddToRef(u,o),f.scaleAndAddToRef(u,i)}return e.Matrix.ComposeToRef(n,o,i,a._workValue),a._workValue},r.prototype._processLateAnimationBindingsForQuaternions=function(t){var r=t.animations[0],i=t.originalValue;if(1===t.animations.length)return e.Quaternion.Slerp(i,r.currentValue,Math.min(1,t.totalWeight));var n,o,s=1;if(t.totalWeight<1){var a=1-t.totalWeight;n=[],o=[],n.push(i),o.push(a)}else{if(2===t.animations.length)return e.Quaternion.Slerp(t.animations[0].currentValue,t.animations[1].currentValue,t.animations[1].weight/t.totalWeight);n=[],o=[],s=t.totalWeight}for(var l=0;l<t.animations.length;l++){var u=t.animations[l];n.push(u.currentValue),o.push(u.weight/s)}for(var h=0,c=null,f=0;f<n.length;)c?(h+=o[f],e.Quaternion.SlerpToRef(c,n[f],o[f]/h,c),f++):(c=e.Quaternion.Slerp(n[f],n[f+1],o[f+1]/(o[f]+o[f+1])),h=o[f]+o[f+1],f+=2);return c},r.prototype._processLateAnimationBindings=function(){if(this._registeredForLateAnimationBindings.length){for(var t=0;t<this._registeredForLateAnimationBindings.length;t++){var r=this._registeredForLateAnimationBindings.data[t];for(var i in r._lateAnimationHolders){var n=r._lateAnimationHolders[i],o=n.animations[0],s=n.originalValue,a=e.Animation.AllowMatrixDecomposeForInterpolation&&s.m,l=void 0;if(a)l=this._processLateAnimationBindingsForMatrices(n);else{if(void 0!==s.w)l=this._processLateAnimationBindingsForQuaternions(n);else{var u=0,h=1;if(n.totalWeight<1)l=s.scale?s.scale(1-n.totalWeight):s*(1-n.totalWeight);else{h=n.totalWeight;var c=o.weight/h;l=1!==c?o.currentValue.scale?o.currentValue.scale(c):o.currentValue*c:o.currentValue,u=1}for(var f=u;f<n.animations.length;f++){var d=n.animations[f],p=d.weight/h;d.currentValue.scaleAndAddToRef?d.currentValue.scaleAndAddToRef(p,l):l+=d.currentValue*p}}}r[i]=l}r._lateAnimationHolders={}}this._registeredForLateAnimationBindings.reset()}},r.prototype._switchToAlternateCameraConfiguration=function(e){this._useAlternateCameraConfiguration=e},r.prototype.getViewMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateViewMatrix:this._viewMatrix},r.prototype.getProjectionMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateProjectionMatrix:this._projectionMatrix},r.prototype.getTransformMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateTransformMatrix:this._transformMatrix},r.prototype.setTransformMatrix=function(t,r){if(this._viewUpdateFlag!==t.updateFlag||this._projectionUpdateFlag!==r.updateFlag){if(this._viewUpdateFlag=t.updateFlag,this._projectionUpdateFlag=r.updateFlag,this._viewMatrix=t,this._projectionMatrix=r,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?e.Frustum.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=e.Frustum.GetPlanes(this._transformMatrix),this.activeCamera&&this.activeCamera._alternateCamera){var i=this.activeCamera._alternateCamera;i.getViewMatrix().multiplyToRef(i.getProjectionMatrix(),e.Tmp.Matrix[0]),e.Frustum.GetRightPlaneToRef(e.Tmp.Matrix[0],this._frustumPlanes[3])}this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update())}},r.prototype._setAlternateTransformMatrix=function(t,r){this._alternateViewUpdateFlag===t.updateFlag&&this._alternateProjectionUpdateFlag===r.updateFlag||(this._alternateViewUpdateFlag=t.updateFlag,this._alternateProjectionUpdateFlag=r.updateFlag,this._alternateViewMatrix=t,this._alternateProjectionMatrix=r,this._alternateTransformMatrix||(this._alternateTransformMatrix=e.Matrix.Zero()),this._alternateViewMatrix.multiplyToRef(this._alternateProjectionMatrix,this._alternateTransformMatrix),this._alternateSceneUbo||this._createAlternateUbo(),this._alternateSceneUbo.useUbo&&(this._alternateSceneUbo.updateMatrix("viewProjection",this._alternateTransformMatrix),this._alternateSceneUbo.updateMatrix("view",this._alternateViewMatrix),this._alternateSceneUbo.update()))},r.prototype.getSceneUniformBuffer=function(){return this._useAlternateCameraConfiguration?this._alternateSceneUbo:this._sceneUbo},r.prototype.getUniqueId=function(){var e=r._uniqueIdCounter;return r._uniqueIdCounter++,e},r.prototype.addMesh=function(e,t){var r=this;void 0===t&&(t=!1),this.meshes.push(e),this.collisionCoordinator&&this.collisionCoordinator.onMeshAdded(e),e._resyncLightSources(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){r.addMesh(e)}))},r.prototype.removeMesh=function(e,t){var r=this;void 0===t&&(t=!1);var i=this.meshes.indexOf(e);return-1!==i&&this.meshes.splice(i,1),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){r.removeMesh(e)})),i},r.prototype.addTransformNode=function(e){this.transformNodes.push(e),this.onNewTransformNodeAddedObservable.notifyObservers(e)},r.prototype.removeTransformNode=function(e){var t=this.transformNodes.indexOf(e);return-1!==t&&this.transformNodes.splice(t,1),this.onTransformNodeRemovedObservable.notifyObservers(e),t},r.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&this.skeletons.splice(t,1),t},r.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},r.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var r=0,i=this.meshes;r<i.length;r++){i[r]._removeLightSource(e)}this.lights.splice(t,1),this.sortLightsByPriority()}return this.onLightRemovedObservable.notifyObservers(e),t},r.prototype.removeCamera=function(e){var t=this.cameras.indexOf(e);-1!==t&&this.cameras.splice(t,1);var r=this.activeCameras.indexOf(e);return-1!==r&&this.activeCameras.splice(r,1),this.activeCamera===e&&(this.cameras.length>0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},r.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},r.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},r.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},r.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),t},r.prototype.removeMaterial=function(e){var t=this.materials.indexOf(e);return-1!==t&&this.materials.splice(t,1),t},r.prototype.removeLensFlareSystem=function(e){var t=this.lensFlareSystems.indexOf(e);return-1!==t&&this.lensFlareSystems.splice(t,1),t},r.prototype.removeActionManager=function(e){var t=this._actionManagers.indexOf(e);return-1!==t&&this._actionManagers.splice(t,1),t},r.prototype.removeEffectLayer=function(e){var t=this.effectLayers.indexOf(e);return-1!==t&&this.effectLayers.splice(t,1),t},r.prototype.removeTexture=function(e){var t=this.textures.indexOf(e);return-1!==t&&this.textures.splice(t,1),t},r.prototype.addLight=function(e){this.lights.push(e),this.sortLightsByPriority();for(var t=0,r=this.meshes;t<r.length;t++){var i=r[t];-1===i._lightSources.indexOf(e)&&(i._lightSources.push(e),i._resyncLightSources())}this.onNewLightAddedObservable.notifyObservers(e)},r.prototype.sortLightsByPriority=function(){this.requireLightSorting&&this.lights.sort(e.Light.CompareLightsPriority)},r.prototype.addCamera=function(e){this.cameras.push(e),this.onNewCameraAddedObservable.notifyObservers(e)},r.prototype.addSkeleton=function(e){this.skeletons.push(e)},r.prototype.addParticleSystem=function(e){this.particleSystems.push(e)},r.prototype.addAnimation=function(e){this.animations.push(e)},r.prototype.addAnimationGroup=function(e){this.animationGroups.push(e)},r.prototype.addMultiMaterial=function(e){this.multiMaterials.push(e)},r.prototype.addMaterial=function(e){this.materials.push(e)},r.prototype.addMorphTargetManager=function(e){this.morphTargetManagers.push(e)},r.prototype.addGeometry=function(e){this._geometries.push(e)},r.prototype.addLensFlareSystem=function(e){this.lensFlareSystems.push(e)},r.prototype.addEffectLayer=function(e){this.effectLayers.push(e)},r.prototype.addActionManager=function(e){this._actionManagers.push(e)},r.prototype.addTexture=function(e){this.textures.push(e)},r.prototype.switchActiveCamera=function(e,t){void 0===t&&(t=!0);var r=this._engine.getRenderingCanvas();r&&(this.activeCamera&&this.activeCamera.detachControl(r),this.activeCamera=e,t&&e.attachControl(r))},r.prototype.setActiveCameraByID=function(e){var t=this.getCameraByID(e);return t?(this.activeCamera=t,t):null},r.prototype.setActiveCameraByName=function(e){var t=this.getCameraByName(e);return t?(this.activeCamera=t,t):null},r.prototype.getAnimationGroupByName=function(e){for(var t=0;t<this.animationGroups.length;t++)if(this.animationGroups[t].name===e)return this.animationGroups[t];return null},r.prototype.getMaterialByID=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].id===e)return this.materials[t];return null},r.prototype.getMaterialByName=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].name===e)return this.materials[t];return null},r.prototype.getLensFlareSystemByName=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].name===e)return this.lensFlareSystems[t];return null},r.prototype.getLensFlareSystemByID=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].id===e)return this.lensFlareSystems[t];return null},r.prototype.getCameraByID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].id===e)return this.cameras[t];return null},r.prototype.getCameraByUniqueID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].uniqueId===e)return this.cameras[t];return null},r.prototype.getCameraByName=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].name===e)return this.cameras[t];return null},r.prototype.getBoneByID=function(e){for(var t=0;t<this.skeletons.length;t++)for(var r=this.skeletons[t],i=0;i<r.bones.length;i++)if(r.bones[i].id===e)return r.bones[i];return null},r.prototype.getBoneByName=function(e){for(var t=0;t<this.skeletons.length;t++)for(var r=this.skeletons[t],i=0;i<r.bones.length;i++)if(r.bones[i].name===e)return r.bones[i];return null},r.prototype.getLightByName=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].name===e)return this.lights[t];return null},r.prototype.getLightByID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].id===e)return this.lights[t];return null},r.prototype.getLightByUniqueID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].uniqueId===e)return this.lights[t];return null},r.prototype.getParticleSystemByID=function(e){for(var t=0;t<this.particleSystems.length;t++)if(this.particleSystems[t].id===e)return this.particleSystems[t];return null},r.prototype.getGeometryByID=function(e){for(var t=0;t<this._geometries.length;t++)if(this._geometries[t].id===e)return this._geometries[t];return null},r.prototype.pushGeometry=function(e,t){return!(!t&&this.getGeometryByID(e.id))&&(this._geometries.push(e),this.collisionCoordinator&&this.collisionCoordinator.onGeometryAdded(e),this.onNewGeometryAddedObservable.notifyObservers(e),!0)},r.prototype.removeGeometry=function(e){var t=this._geometries.indexOf(e);return t>-1&&(this._geometries.splice(t,1),this.collisionCoordinator&&this.collisionCoordinator.onGeometryDeleted(e),this.onGeometryRemovedObservable.notifyObservers(e),!0)},r.prototype.getGeometries=function(){return this._geometries},r.prototype.getMeshByID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].id===e)return this.meshes[t];return null},r.prototype.getMeshesByID=function(e){return this.meshes.filter((function(t){return t.id===e}))},r.prototype.getTransformNodeByID=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null},r.prototype.getTransformNodesByID=function(e){return this.transformNodes.filter((function(t){return t.id===e}))},r.prototype.getMeshByUniqueID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].uniqueId===e)return this.meshes[t];return null},r.prototype.getLastMeshByID=function(e){for(var t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},r.prototype.getLastEntryByID=function(e){var t;for(t=this.meshes.length-1;t>=0;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;t>=0;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;t>=0;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;t>=0;t--)if(this.lights[t].id===e)return this.lights[t];return null},r.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var r=this.getLightByID(e);if(r)return r;var i=this.getCameraByID(e);return i||this.getBoneByID(e)},r.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var r=this.getLightByName(e);if(r)return r;var i=this.getCameraByName(e);return i||this.getBoneByName(e)},r.prototype.getMeshByName=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].name===e)return this.meshes[t];return null},r.prototype.getTransformNodeByName=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].name===e)return this.transformNodes[t];return null},r.prototype.getSoundByName=function(t){var r;if(e.AudioEngine){for(r=0;r<this.mainSoundTrack.soundCollection.length;r++)if(this.mainSoundTrack.soundCollection[r].name===t)return this.mainSoundTrack.soundCollection[r];for(var i=0;i<this.soundTracks.length;i++)for(r=0;r<this.soundTracks[i].soundCollection.length;r++)if(this.soundTracks[i].soundCollection[r].name===t)return this.soundTracks[i].soundCollection[r]}return null},r.prototype.getLastSkeletonByID=function(e){for(var t=this.skeletons.length-1;t>=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},r.prototype.getSkeletonById=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].id===e)return this.skeletons[t];return null},r.prototype.getSkeletonByName=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].name===e)return this.skeletons[t];return null},r.prototype.getMorphTargetManagerById=function(e){for(var t=0;t<this.morphTargetManagers.length;t++)if(this.morphTargetManagers[t].uniqueId===e)return this.morphTargetManagers[t];return null},r.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},r.prototype.getHighlightLayerByName=function(t){for(var r=0;r<this.effectLayers.length;r++)if(this.effectLayers[r].name===t&&this.effectLayers[r].getEffectName()===e.HighlightLayer.EffectName)return this.effectLayers[r];return null},r.prototype.getGlowLayerByName=function(t){for(var r=0;r<this.effectLayers.length;r++)if(this.effectLayers[r].name===t&&this.effectLayers[r].getEffectName()===e.GlowLayer.EffectName)return this.effectLayers[r];return null},Object.defineProperty(r.prototype,"uid",{get:function(){return this._uid||(this._uid=e.Tools.RandomId()),this._uid},enumerable:!0,configurable:!0}),r.prototype.addExternalData=function(t,r){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.add(t,r)},r.prototype.getExternalData=function(e){return this._externalData?this._externalData.get(e):null},r.prototype.getOrAddExternalDataWithFactory=function(t,r){return this._externalData||(this._externalData=new e.StringDictionary),this._externalData.getOrAddWithFactory(t,r)},r.prototype.removeExternalData=function(e){return this._externalData.remove(e)},r.prototype._evaluateSubMesh=function(e,t){if(this.dispatchAllSubMeshesOfActiveMeshes||t.alwaysSelectAsActiveMesh||1===t.subMeshes.length||e.isInFrustum(this._frustumPlanes)){if(t.showSubMeshesBoundingBox){var r=e.getBoundingInfo();null!==r&&void 0!==r&&this.getBoundingBoxRenderer().renderList.push(r.boundingBox)}var i=e.getMaterial();null!==i&&void 0!==i&&(void 0!==i.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(i)&&(this._processedMaterials.push(i),this._renderTargets.concatWithNoDuplicate(i.getRenderTargetTextures())),this._activeIndices.addCount(e.indexCount,!1),this._renderingManager.dispatch(e,t,i))}},r.prototype.freeProcessedMaterials=function(){this._processedMaterials.dispose()},r.prototype.freeActiveMeshes=function(){if(this._activeMeshes.dispose(),this.activeCamera&&this.activeCamera._activeMeshes&&this.activeCamera._activeMeshes.dispose(),this.activeCameras)for(var e=0;e<this.activeCameras.length;e++){var t=this.activeCameras[e];t&&t._activeMeshes&&t._activeMeshes.dispose()}},r.prototype.freeRenderingGroups=function(){if(this._renderingManager&&this._renderingManager.freeRenderingGroups(),this.textures)for(var e=0;e<this.textures.length;e++){var t=this.textures[e];t&&t.renderList&&t.freeRenderingGroups()}},r.prototype._isInIntermediateRendering=function(){return this._intermediateRendering},r.prototype.setActiveMeshCandidateProvider=function(e){this._activeMeshCandidateProvider=e},r.prototype.getActiveMeshCandidateProvider=function(){return this._activeMeshCandidateProvider},r.prototype.freezeActiveMeshes=function(){return this.activeCamera?(this._frustumPlanes||this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix()),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0,this):this},r.prototype.unfreezeActiveMeshes=function(){return this._activeMeshesFrozen=!1,this},r.prototype._evaluateActiveMeshes=function(){if((!this._activeMeshesFrozen||!this._activeMeshes.length)&&this.activeCamera){this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this),this.activeCamera._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset(),this._boundingBoxRenderer&&this._boundingBoxRenderer.reset();var t,r,i=!0;if(void 0!==this._activeMeshCandidateProvider)t=this._activeMeshCandidateProvider.getMeshes(this),i=!1===this._activeMeshCandidateProvider.checksIsEnabled,r=void 0!==t?t.length:0;else if(void 0!==this._selectionOctree){var n=this._selectionOctree.select(this._frustumPlanes);t=n.data,r=n.length}else r=this.meshes.length,t=this.meshes;for(var o,s,a=0;a<r;a++)o=t[a],o.isBlocked||(this._totalVertices.addCount(o.getTotalVertices(),!1),!o.isReady()||i&&!o.isEnabled()||(o.computeWorldMatrix(),o.actionManager&&o.actionManager.hasSpecificTriggers([e.ActionManager.OnIntersectionEnterTrigger,e.ActionManager.OnIntersectionExitTrigger])&&this._meshesForIntersections.pushNoDuplicate(o),void 0!==(s=o.getLOD(this.activeCamera))&&null!==s&&(o._preActivate(),(o.alwaysSelectAsActiveMesh||o.isVisible&&o.visibility>0&&0!=(o.layerMask&this.activeCamera.layerMask)&&o.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(o),this.activeCamera._activeMeshes.push(o),o._activate(this._renderId),s!==o&&s._activate(this._renderId),this._activeMesh(o,s)))));if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var l=0;l<this.particleSystems.length;l++){var u=this.particleSystems[l];if(u.isStarted()&&u.emitter){var h=u.emitter;h.position&&!h.isEnabled()||(this._activeParticleSystems.push(u),u.animate(),
- this._renderingManager.dispatchParticles(u))}}this.onAfterParticlesRenderingObservable.notifyObservers(this)}}},r.prototype._activeMesh=function(e,t){if(this.skeletonsEnabled&&null!==t.skeleton&&void 0!==t.skeleton&&(this._activeSkeletons.pushNoDuplicate(t.skeleton)&&t.skeleton.prepare(),t.computeBonesUsingShaders||this._softwareSkinnedMeshes.pushNoDuplicate(t)),e.showBoundingBox||this.forceShowBoundingBoxes){var r=e.getBoundingInfo();this.getBoundingBoxRenderer().renderList.push(r.boundingBox)}if(void 0!==t&&null!==t&&void 0!==t.subMeshes&&null!==t.subMeshes&&t.subMeshes.length>0){var i,n;if(t.useOctreeForRenderingSelection&&void 0!==t._submeshesOctree&&null!==t._submeshesOctree){var o=t._submeshesOctree.select(this._frustumPlanes);i=o.length,n=o.data}else n=t.subMeshes,i=n.length;for(var s,a=0;a<i;a++)s=n[a],this._evaluateSubMesh(s,t)}},r.prototype.updateTransformMatrix=function(e){this.activeCamera&&this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(e))},r.prototype.updateAlternateTransformMatrix=function(e){this._setAlternateTransformMatrix(e.getViewMatrix(),e.getProjectionMatrix())},r.prototype._renderForCamera=function(t,r){if(!t||!t._skipRendering){var i=this._engine;if(this.activeCamera=t,!this.activeCamera)throw new Error("Active camera not set");e.Tools.StartPerformanceCounter("Rendering camera "+this.activeCamera.name),i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.updateTransformMatrix(),t._alternateCamera&&(this.updateAlternateTransformMatrix(t._alternateCamera),this._alternateRendering=!0),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var n=0;n<this._softwareSkinnedMeshes.length;n++){var o=this._softwareSkinnedMeshes.data[n];o.applySkeleton(o.skeleton)}this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);var s=!1;if(t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets),r&&r.customRenderTargets&&r.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(r.customRenderTargets),this.renderTargetsEnabled&&this._renderTargets.length>0){this._intermediateRendering=!0,e.Tools.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var a=0;a<this._renderTargets.length;a++){var l=this._renderTargets.data[a];if(l._shouldRender()){this._renderId++;var u=l.activeCamera&&l.activeCamera!==this.activeCamera;l.render(u,this.dumpNextRenderTargets)}}e.Tools.EndPerformanceCounter("Render targets",this._renderTargets.length>0),this._intermediateRendering=!1,this._renderId++,s=!0}var h=this._engine.getStencilBuffer(),c=!1,f=!1;if(this.renderTargetsEnabled&&this.effectLayers&&this.effectLayers.length>0){this._intermediateRendering=!0;for(var d=0;d<this.effectLayers.length;d++){var p=this.effectLayers[d];if(p.shouldRender()&&(!p.camera||p.camera.cameraRigMode===e.Camera.RIG_MODE_NONE&&t===p.camera||p.camera.cameraRigMode!==e.Camera.RIG_MODE_NONE&&p.camera._rigCameras.indexOf(t)>-1)){c=!0,f=f||p.needStencil();var l=p._mainTexture;l._shouldRender()&&(this._renderId++,l.render(!1,!1),s=!0)}}this._intermediateRendering=!1,this._renderId++}s&&i.restoreDefaultFramebuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.postProcessManager._prepareFrame();var A,m;if(this.layers.length){for(i.setDepthBuffer(!1),A=0;A<this.layers.length;A++)m=this.layers[A],m.isBackground&&0!=(m.layerMask&this.activeCamera.layerMask)&&m.render();i.setDepthBuffer(!0)}if(f&&this._engine.setStencilBuffer(!0),this.onBeforeDrawPhaseObservable.notifyObservers(this),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this),f&&this._engine.setStencilBuffer(h),this._boundingBoxRenderer&&this._boundingBoxRenderer.render(),this.lensFlaresEnabled){e.Tools.StartPerformanceCounter("Lens flares",this.lensFlareSystems.length>0);for(var g=0;g<this.lensFlareSystems.length;g++){var _=this.lensFlareSystems[g];0!=(t.layerMask&_.layerMask)&&_.render()}e.Tools.EndPerformanceCounter("Lens flares",this.lensFlareSystems.length>0)}if(c){i.setDepthBuffer(!1);for(var d=0;d<this.effectLayers.length;d++)this.effectLayers[d].shouldRender()&&this.effectLayers[d].render();i.setDepthBuffer(!0)}if(this.layers.length){for(i.setDepthBuffer(!1),A=0;A<this.layers.length;A++)m=this.layers[A],m.isBackground||0==(m.layerMask&this.activeCamera.layerMask)||m.render();i.setDepthBuffer(!0)}this.postProcessManager._finalizeFrame(t.isIntermediate),this._renderTargets.reset(),this._alternateRendering=!1,this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera),e.Tools.EndPerformanceCounter("Rendering camera "+this.activeCamera.name)}},r.prototype._processSubCameras=function(t){if(t.cameraRigMode===e.Camera.RIG_MODE_NONE)return void this._renderForCamera(t);for(var r=0;r<t._rigCameras.length;r++)this._renderForCamera(t._rigCameras[r],t);this.activeCamera=t,this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix())},r.prototype._checkIntersections=function(){for(var t=0;t<this._meshesForIntersections.length;t++){var r=this._meshesForIntersections.data[t];if(r.actionManager)for(var i=0;i<r.actionManager.actions.length;i++){var n=r.actionManager.actions[i];if(n.trigger===e.ActionManager.OnIntersectionEnterTrigger||n.trigger===e.ActionManager.OnIntersectionExitTrigger){var o=n.getTriggerParameter(),s=o instanceof e.AbstractMesh?o:o.mesh,a=s.intersectsMesh(r,o.usePreciseIntersection),l=r._intersectionsInProgress.indexOf(s);a&&-1===l?n.trigger===e.ActionManager.OnIntersectionEnterTrigger?(n._executeCurrent(e.ActionEvent.CreateNew(r,void 0,s)),r._intersectionsInProgress.push(s)):n.trigger===e.ActionManager.OnIntersectionExitTrigger&&r._intersectionsInProgress.push(s):!a&&l>-1&&(n.trigger===e.ActionManager.OnIntersectionExitTrigger&&n._executeCurrent(e.ActionEvent.CreateNew(r,void 0,s)),r.actionManager.hasSpecificTrigger(e.ActionManager.OnIntersectionExitTrigger,(function(t){var r=t instanceof e.AbstractMesh?t:t.mesh;return s===r}))&&n.trigger!==e.ActionManager.OnIntersectionExitTrigger||r._intersectionsInProgress.splice(l,1))}}}},r.prototype.render=function(t){if(void 0===t&&(t=!0),!this.isDisposed){if(this._activeParticles.fetchNewFrame(),this._totalVertices.fetchNewFrame(),this._activeIndices.fetchNewFrame(),this._activeBones.fetchNewFrame(),this._meshesForIntersections.reset(),this.resetCachedMaterial(),this.onBeforeAnimationsObservable.notifyObservers(this),this.actionManager&&this.actionManager.processTrigger(e.ActionManager.OnEveryFrameTrigger),this.simplificationQueue&&!this.simplificationQueue.running&&this.simplificationQueue.executeNext(),this._engine.isDeterministicLockStep()){var i=Math.max(r.MinDeltaTime,Math.min(this._engine.getDeltaTime(),r.MaxDeltaTime))+this._timeAccumulator,n=1e3/60;this._physicsEngine&&(n=1e3*this._physicsEngine.getTimeStep());var o=0,s=this._engine.getLockstepMaxSteps(),a=Math.floor(i/60);a=Math.min(a,s);do{this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=.06*n,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._physicsEngine&&(this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(n/1e3),this.onAfterPhysicsObservable.notifyObservers(this)),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,o++,i-=n}while(i>0&&o<a);this._timeAccumulator=i<0?0:i}else{var i=this.useConstantAnimationDeltaTime?16:Math.max(r.MinDeltaTime,Math.min(this._engine.getDeltaTime(),r.MaxDeltaTime));this._animationRatio=.06*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._physicsEngine&&(this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(i/1e3),this.onAfterPhysicsObservable.notifyObservers(this))}if(this._gamepadManager&&this._gamepadManager._isMonitoring&&this._gamepadManager._checkGamepadsStatus(),t)if(this.activeCameras.length>0)for(var l=0;l<this.activeCameras.length;l++){var u=this.activeCameras[l];if(u.update(),u.cameraRigMode!==e.Camera.RIG_MODE_NONE)for(var h=0;h<u._rigCameras.length;h++)u._rigCameras[h].update()}else if(this.activeCamera&&(this.activeCamera.update(),this.activeCamera.cameraRigMode!==e.Camera.RIG_MODE_NONE))for(var h=0;h<this.activeCamera._rigCameras.length;h++)this.activeCamera._rigCameras[h].update();this.onBeforeRenderObservable.notifyObservers(this),this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);var c=this.getEngine(),f=this.activeCamera;if(this.renderTargetsEnabled){e.Tools.StartPerformanceCounter("Custom render targets",this.customRenderTargets.length>0),this._intermediateRendering=!0;for(var d=0;d<this.customRenderTargets.length;d++){var p=this.customRenderTargets[d];if(p._shouldRender()){if(this._renderId++,this.activeCamera=p.activeCamera||this.activeCamera,!this.activeCamera)throw new Error("Active camera not set");c.setViewport(this.activeCamera.viewport),this.updateTransformMatrix(),p.render(f!==this.activeCamera,this.dumpNextRenderTargets)}}e.Tools.EndPerformanceCounter("Custom render targets",this.customRenderTargets.length>0),this._intermediateRendering=!1,this._renderId++}if(this.customRenderTargets.length>0&&c.restoreDefaultFramebuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.activeCamera=f,this.proceduralTexturesEnabled){e.Tools.StartPerformanceCounter("Procedural textures",this.proceduralTextures.length>0);for(var A=0;A<this.proceduralTextures.length;A++){var m=this.proceduralTextures[A];m._shouldRender()&&m.render()}e.Tools.EndPerformanceCounter("Procedural textures",this.proceduralTextures.length>0)}if((this.autoClearDepthAndStencil||this.autoClear)&&this._engine.clear(this.clearColor,this.autoClear||this.forceWireframe||this.forcePointsCloud,this.autoClearDepthAndStencil,this.autoClearDepthAndStencil),this.shadowsEnabled)for(var g=0;g<this.lights.length;g++){var _=this.lights[g],v=_.getShadowGenerator();if(_.isEnabled()&&_.shadowEnabled&&v){var y=v.getShadowMap();-1!==this.textures.indexOf(y)&&this._renderTargets.push(y)}}for(var b in this._depthRenderer)this._renderTargets.push(this._depthRenderer[b].getDepthMap());if(this._geometryBufferRenderer&&this._renderTargets.push(this._geometryBufferRenderer.getGBuffer()),this._postProcessRenderPipelineManager&&this._postProcessRenderPipelineManager.update(),this.activeCameras.length>0)for(var l=0;l<this.activeCameras.length;l++)l>0&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[l]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections(),e.AudioEngine&&this._updateAudioParameters(),this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this);for(var h=0;h<this._toBeDisposed.length;h++){var E=this._toBeDisposed.data[h];E&&E.dispose(),this._toBeDisposed[h]=null}this._toBeDisposed.reset(),this.dumpNextRenderTargets&&(this.dumpNextRenderTargets=!1),this._activeBones.addCount(0,!0),this._activeIndices.addCount(0,!0),this._activeParticles.addCount(0,!0)}},r.prototype._updateAudioParameters=function(){if(this.audioEnabled&&this._mainSoundTrack&&(0!==this._mainSoundTrack.soundCollection.length||1!==this.soundTracks.length)){var t,r=e.Engine.audioEngine;if((t=this.activeCameras.length>0?this.activeCameras[0]:this.activeCamera)&&r.canUseWebAudio&&r.audioContext){r.audioContext.listener.setPosition(t.position.x,t.position.y,t.position.z),t.rigCameras&&t.rigCameras.length>0&&(t=t.rigCameras[0]);var i=e.Matrix.Invert(t.getViewMatrix()),n=e.Vector3.TransformNormal(new e.Vector3(0,0,-1),i);n.normalize(),isNaN(n.x)||isNaN(n.y)||isNaN(n.z)||r.audioContext.listener.setOrientation(n.x,n.y,n.z,0,1,0);var o;for(o=0;o<this.mainSoundTrack.soundCollection.length;o++){var s=this.mainSoundTrack.soundCollection[o];s.useCustomAttenuation&&s.updateDistanceFromListener()}for(o=0;o<this.soundTracks.length;o++)for(var a=0;a<this.soundTracks[o].soundCollection.length;a++)s=this.soundTracks[o].soundCollection[a],s.useCustomAttenuation&&s.updateDistanceFromListener()}}},Object.defineProperty(r.prototype,"audioEnabled",{get:function(){return this._audioEnabled},set:function(t){this._audioEnabled=t,e.AudioEngine&&(this._audioEnabled?this._enableAudio():this._disableAudio())},enumerable:!0,configurable:!0}),r.prototype._disableAudio=function(){var e;for(e=0;e<this.mainSoundTrack.soundCollection.length;e++)this.mainSoundTrack.soundCollection[e].pause();for(e=0;e<this.soundTracks.length;e++)for(var t=0;t<this.soundTracks[e].soundCollection.length;t++)this.soundTracks[e].soundCollection[t].pause()},r.prototype._enableAudio=function(){var e;for(e=0;e<this.mainSoundTrack.soundCollection.length;e++)this.mainSoundTrack.soundCollection[e].isPaused&&this.mainSoundTrack.soundCollection[e].play();for(e=0;e<this.soundTracks.length;e++)for(var t=0;t<this.soundTracks[e].soundCollection.length;t++)this.soundTracks[e].soundCollection[t].isPaused&&this.soundTracks[e].soundCollection[t].play()},Object.defineProperty(r.prototype,"headphone",{get:function(){return this._headphone},set:function(t){this._headphone=t,e.AudioEngine&&(this._headphone?this._switchAudioModeForHeadphones():this._switchAudioModeForNormalSpeakers())},enumerable:!0,configurable:!0}),r.prototype._switchAudioModeForHeadphones=function(){this.mainSoundTrack.switchPanningModelToHRTF();for(var e=0;e<this.soundTracks.length;e++)this.soundTracks[e].switchPanningModelToHRTF()},r.prototype._switchAudioModeForNormalSpeakers=function(){this.mainSoundTrack.switchPanningModelToEqualPower();for(var e=0;e<this.soundTracks.length;e++)this.soundTracks[e].switchPanningModelToEqualPower()},r.prototype.enableDepthRenderer=function(t){if(!(t=t||this.activeCamera))throw"No camera available to enable depth renderer";if(!this._depthRenderer[t.id]){var r=0;if(this._engine.getCaps().textureHalfFloatRender)r=e.Engine.TEXTURETYPE_HALF_FLOAT;else{if(!this._engine.getCaps().textureFloatRender)throw"Depth renderer does not support int texture type";r=e.Engine.TEXTURETYPE_FLOAT}this._depthRenderer[t.id]=new e.DepthRenderer(this,r,t)}return this._depthRenderer[t.id]},r.prototype.disableDepthRenderer=function(e){(e=e||this.activeCamera)&&this._depthRenderer[e.id]&&(this._depthRenderer[e.id].dispose(),delete this._depthRenderer[e.id])},r.prototype.enableGeometryBufferRenderer=function(t){return void 0===t&&(t=1),this._geometryBufferRenderer?this._geometryBufferRenderer:(this._geometryBufferRenderer=new e.GeometryBufferRenderer(this,t),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null),this._geometryBufferRenderer)},r.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)},r.prototype.freezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].freeze()},r.prototype.unfreezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].unfreeze()},r.prototype.dispose=function(){this.beforeRender=null,this.afterRender=null,this.skeletons=[],this.morphTargetManagers=[],this.importedMeshesFiles=new Array,this.stopAllAnimations(),this.resetCachedMaterial();for(var t in this._depthRenderer)this._depthRenderer[t].dispose();this._gamepadManager&&(this._gamepadManager.dispose(),this._gamepadManager=null),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._boundingBoxRenderer&&this._boundingBoxRenderer.dispose(),this._meshesForIntersections.dispose(),this._toBeDisposed.dispose();for(var r=0,i=this._activeRequests;r<i.length;r++){i[r].abort()}this._debugLayer&&this._debugLayer.hide(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeSpritesRenderingObservable.clear(),this.onAfterSpritesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforePhysicsObservable.clear(),this.onAfterPhysicsObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.detachControl(),e.AudioEngine&&this.disposeSounds(),this.VRHelper&&this.VRHelper.dispose();var n=this._engine.getRenderingCanvas();if(n){var o;for(o=0;o<this.cameras.length;o++)this.cameras[o].detachControl(n)}for(;this.animationGroups.length;)this.animationGroups[0].dispose();for(;this.lights.length;)this.lights[0].dispose();for(;this.meshes.length;)this.meshes[0].dispose(!0);for(;this.transformNodes.length;)this.removeTransformNode(this.transformNodes[0]);for(;this.cameras.length;)this.cameras[0].dispose();for(this.defaultMaterial&&this.defaultMaterial.dispose();this.multiMaterials.length;)this.multiMaterials[0].dispose();for(;this.materials.length;)this.materials[0].dispose();for(;this.particleSystems.length;)this.particleSystems[0].dispose();for(;this.spriteManagers.length;)this.spriteManagers[0].dispose();for(;this.postProcesses.length;)this.postProcesses[0].dispose();for(;this.layers.length;)this.layers[0].dispose();for(;this.effectLayers.length;)this.effectLayers[0].dispose();for(;this.textures.length;)this.textures[0].dispose();this._sceneUbo.dispose(),this._alternateSceneUbo&&this._alternateSceneUbo.dispose(),this.postProcessManager.dispose(),this._postProcessRenderPipelineManager&&this._postProcessRenderPipelineManager.dispose(),this._physicsEngine&&this.disablePhysicsEngine(),o=this._engine.scenes.indexOf(this),o>-1&&this._engine.scenes.splice(o,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(r.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),r.prototype.disposeSounds=function(){if(this._mainSoundTrack){this.mainSoundTrack.dispose();for(var e=0;e<this.soundTracks.length;e++)this.soundTracks[e].dispose()}},r.prototype.clearCachedVertexData=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e],r=t.geometry;if(r){r._indices=[];for(var i in r._vertexBuffers)r._vertexBuffers.hasOwnProperty(i)&&(r._vertexBuffers[i]._buffer._data=null)}}},r.prototype.cleanCachedTextureBuffer=function(){for(var e=0,t=this.textures;e<t.length;e++){var r=t[e];r._buffer&&(r._buffer=null)}},r.prototype.getWorldExtends=function(t){var r=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),i=new e.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return t=t||function(){return!0},this.meshes.filter(t).forEach((function(t){if(t.computeWorldMatrix(!0),t.subMeshes&&0!==t.subMeshes.length&&!t.infiniteDistance){var n=t.getBoundingInfo(),o=n.boundingBox.minimumWorld,s=n.boundingBox.maximumWorld;e.Tools.CheckExtends(o,r,i),e.Tools.CheckExtends(s,r,i)}})),{min:r,max:i}},r.prototype.createOrUpdateSelectionOctree=function(t,r){void 0===t&&(t=64),void 0===r&&(r=2),this._selectionOctree||(this._selectionOctree=new e.Octree(e.Octree.CreationFuncForMeshes,t,r));var i=this.getWorldExtends();return this._selectionOctree.update(i.min,i.max,this.meshes),this._selectionOctree},r.prototype.createPickingRay=function(t,r,i,n,o){void 0===o&&(o=!1);var s=e.Ray.Zero();return this.createPickingRayToRef(t,r,i,s,n,o),s},r.prototype.createPickingRayToRef=function(t,r,i,n,o,s){void 0===s&&(s=!1);var a=this._engine;if(!o){if(!this.activeCamera)throw new Error("Active camera not set");o=this.activeCamera}var l=o.viewport,u=l.toGlobal(a.getRenderWidth(),a.getRenderHeight());return t=t/this._engine.getHardwareScalingLevel()-u.x,r=r/this._engine.getHardwareScalingLevel()-(this._engine.getRenderHeight()-u.y-u.height),n.update(t,r,u.width,u.height,i||e.Matrix.Identity(),s?e.Matrix.Identity():o.getViewMatrix(),o.getProjectionMatrix()),this},r.prototype.createPickingRayInCameraSpace=function(t,r,i){var n=e.Ray.Zero();return this.createPickingRayInCameraSpaceToRef(t,r,n,i),n},r.prototype.createPickingRayInCameraSpaceToRef=function(t,r,i,n){if(!e.PickingInfo)return this;var o=this._engine;if(!n){if(!this.activeCamera)throw new Error("Active camera not set");n=this.activeCamera}var s=n.viewport,a=s.toGlobal(o.getRenderWidth(),o.getRenderHeight()),l=e.Matrix.Identity();return t=t/this._engine.getHardwareScalingLevel()-a.x,r=r/this._engine.getHardwareScalingLevel()-(this._engine.getRenderHeight()-a.y-a.height),i.update(t,r,a.width,a.height,l,l,n.getProjectionMatrix()),this},r.prototype._internalPick=function(t,r,i){if(!e.PickingInfo)return null;for(var n=null,o=0;o<this.meshes.length;o++){var s=this.meshes[o];if(r){if(!r(s))continue}else if(!s.isEnabled()||!s.isVisible||!s.isPickable)continue;var a=s.getWorldMatrix(),l=t(a),u=s.intersects(l,i);if(u&&u.hit&&((i||null==n||!(u.distance>=n.distance))&&(n=u,i)))break}return n||new e.PickingInfo},r.prototype._internalMultiPick=function(t,r){if(!e.PickingInfo)return null;for(var i=new Array,n=0;n<this.meshes.length;n++){var o=this.meshes[n];if(r){if(!r(o))continue}else if(!o.isEnabled()||!o.isVisible||!o.isPickable)continue;var s=o.getWorldMatrix(),a=t(s),l=o.intersects(a,!1);l&&l.hit&&i.push(l)}return i},r.prototype._internalPickSprites=function(t,r,i,n){if(!e.PickingInfo)return null;var o=null;if(!n){if(!this.activeCamera)return null;n=this.activeCamera}if(this.spriteManagers.length>0)for(var s=0;s<this.spriteManagers.length;s++){var a=this.spriteManagers[s];if(a.isPickable){var l=a.intersects(t,n,r,i);if(l&&l.hit&&(i||null==o||!(l.distance>=o.distance))&&(o=l,i))break}}return o||new e.PickingInfo},r.prototype.pick=function(t,r,i,n,o){var s=this;if(!e.PickingInfo)return null;var a=this._internalPick((function(e){return s.createPickingRayToRef(t,r,e,s._tempPickingRay,o||null),s._tempPickingRay}),i,n);return a&&(a.ray=this.createPickingRay(t,r,e.Matrix.Identity(),o||null)),a},r.prototype.pickSprite=function(e,t,r,i,n){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempPickingRay,n),this._internalPickSprites(this._tempPickingRay,r,i,n)},r.prototype.pickWithRay=function(t,r,i){var n=this,o=this._internalPick((function(r){return n._pickWithRayInverseMatrix||(n._pickWithRayInverseMatrix=e.Matrix.Identity()),r.invertToRef(n._pickWithRayInverseMatrix),n._cachedRayForTransform||(n._cachedRayForTransform=e.Ray.Zero()),e.Ray.TransformToRef(t,n._pickWithRayInverseMatrix,n._cachedRayForTransform),n._cachedRayForTransform}),r,i);return o&&(o.ray=t),o},r.prototype.multiPick=function(e,t,r,i){var n=this;return this._internalMultiPick((function(r){return n.createPickingRay(e,t,r,i||null)}),r)},r.prototype.multiPickWithRay=function(t,r){var i=this;return this._internalMultiPick((function(r){return i._pickWithRayInverseMatrix||(i._pickWithRayInverseMatrix=e.Matrix.Identity()),r.invertToRef(i._pickWithRayInverseMatrix),i._cachedRayForTransform||(i._cachedRayForTransform=e.Ray.Zero()),e.Ray.TransformToRef(t,i._pickWithRayInverseMatrix,i._cachedRayForTransform),i._cachedRayForTransform}),r)},r.prototype.setPointerOverMesh=function(t){this._pointerOverMesh!==t&&(this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.processTrigger(e.ActionManager.OnPointerOutTrigger,e.ActionEvent.CreateNew(this._pointerOverMesh)),this._pointerOverMesh=t,this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.processTrigger(e.ActionManager.OnPointerOverTrigger,e.ActionEvent.CreateNew(this._pointerOverMesh)))},r.prototype.getPointerOverMesh=function(){return this._pointerOverMesh},r.prototype.setPointerOverSprite=function(t){this._pointerOverSprite!==t&&(this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(e.ActionManager.OnPointerOutTrigger,e.ActionEvent.CreateNewFromSprite(this._pointerOverSprite,this)),this._pointerOverSprite=t,this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(e.ActionManager.OnPointerOverTrigger,e.ActionEvent.CreateNewFromSprite(this._pointerOverSprite,this)))},r.prototype.getPointerOverSprite=function(){return this._pointerOverSprite},r.prototype.getPhysicsEngine=function(){return this._physicsEngine},r.prototype.enablePhysics=function(t,r){if(void 0===t&&(t=null),this._physicsEngine)return!0;try{return this._physicsEngine=new e.PhysicsEngine(t,r),!0}catch(t){return e.Tools.Error(t.message),!1}},r.prototype.disablePhysicsEngine=function(){this._physicsEngine&&(this._physicsEngine.dispose(),this._physicsEngine=null)},r.prototype.isPhysicsEnabled=function(){return void 0!==this._physicsEngine},r.prototype.deleteCompoundImpostor=function(e){var t=e.parts[0].mesh;t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)},r.prototype._rebuildGeometries=function(){for(var e=0,t=this._geometries;e<t.length;e++){t[e]._rebuild()}for(var r=0,i=this.meshes;r<i.length;r++){i[r]._rebuild()}this.postProcessManager&&this.postProcessManager._rebuild();for(var n=0,o=this.layers;n<o.length;n++){o[n]._rebuild()}for(var s=0,a=this.effectLayers;s<a.length;s++){a[s]._rebuild()}this._boundingBoxRenderer&&this._boundingBoxRenderer._rebuild();for(var l=0,u=this.particleSystems;l<u.length;l++){u[l].rebuild()}this._postProcessRenderPipelineManager&&this._postProcessRenderPipelineManager._rebuild()},r.prototype._rebuildTextures=function(){for(var t=0,r=this.textures;t<r.length;t++){r[t]._rebuild()}this.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag)},r.prototype.createDefaultLight=function(t){if(void 0===t&&(t=!1),t&&this.lights)for(var r=0;r<this.lights.length;r++)this.lights[r].dispose();0===this.lights.length&&new e.HemisphericLight("default light",e.Vector3.Up(),this)},r.prototype.createDefaultCamera=function(t,r,i){if(void 0===t&&(t=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),r&&this.activeCamera&&(this.activeCamera.dispose(),this.activeCamera=null),!this.activeCamera){var n,o=this.getWorldExtends(),s=o.max.subtract(o.min),a=o.min.add(s.scale(.5)),l=1.5*s.length();if(isFinite(l)||(l=1,a.copyFromFloats(0,0,0)),t){var u=new e.ArcRotateCamera("default camera",-Math.PI/2,Math.PI/2,l,a,this);u.lowerRadiusLimit=.01*l,u.wheelPrecision=100/l,n=u}else{var h=new e.FreeCamera("default camera",new e.Vector3(a.x,a.y,-l),this);h.setTarget(a),n=h}n.minZ=.01*l,n.maxZ=1e3*l,n.speed=.2*l,this.activeCamera=n;var c=this.getEngine().getRenderingCanvas();i&&c&&n.attachControl(c)}},r.prototype.createDefaultCameraOrLight=function(e,t,r){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===r&&(r=!1),this.createDefaultLight(t),this.createDefaultCamera(e,t,r)},r.prototype.createDefaultSkybox=function(t,r,i,n,o){if(void 0===r&&(r=!1),void 0===i&&(i=1e3),void 0===n&&(n=0),void 0===o&&(o=!0),!t)return e.Tools.Warn("Can not create default skybox without environment texture."),null;o&&t&&(this.environmentTexture=t);var s=e.Mesh.CreateBox("hdrSkyBox",i,this);if(r){var a=new e.PBRMaterial("skyBox",this);a.backFaceCulling=!1,a.reflectionTexture=t.clone(),a.reflectionTexture&&(a.reflectionTexture.coordinatesMode=e.Texture.SKYBOX_MODE),a.microSurface=1-n,a.disableLighting=!0,a.twoSidedLighting=!0,s.infiniteDistance=!0,s.material=a}else{var l=new e.StandardMaterial("skyBox",this);l.backFaceCulling=!1,l.reflectionTexture=t.clone(),l.reflectionTexture&&(l.reflectionTexture.coordinatesMode=e.Texture.SKYBOX_MODE),l.disableLighting=!0,s.infiniteDistance=!0,s.material=l}return s},r.prototype.createDefaultEnvironment=function(t){return e.EnvironmentHelper?new e.EnvironmentHelper(t,this):null},r.prototype.createDefaultVRExperience=function(t){return void 0===t&&(t={}),new e.VRExperienceHelper(this,t)},r.prototype._getByTags=function(t,r,i){if(void 0===r)return t;var n=[];i=i||function(e){};for(var o in t){var s=t[o];e.Tags&&e.Tags.MatchesQuery(s,r)&&(n.push(s),i(s))}return n},r.prototype.getMeshesByTags=function(e,t){return this._getByTags(this.meshes,e,t)},r.prototype.getCamerasByTags=function(e,t){return this._getByTags(this.cameras,e,t)},r.prototype.getLightsByTags=function(e,t){return this._getByTags(this.lights,e,t)},r.prototype.getMaterialByTags=function(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))},r.prototype.setRenderingOrder=function(e,t,r,i){void 0===t&&(t=null),void 0===r&&(r=null),void 0===i&&(i=null),this._renderingManager.setRenderingOrder(e,t,r,i)},r.prototype.setRenderingAutoClearDepthStencil=function(e,t,r,i){void 0===r&&(r=!0),void 0===i&&(i=!0),this._renderingManager.setRenderingAutoClearDepthStencil(e,t,r,i)},r.prototype.markAllMaterialsAsDirty=function(e,t){for(var r=0,i=this.materials;r<i.length;r++){var n=i[r];t&&!t(n)||n.markAsDirty(e)}},r.prototype._loadFile=function(t,r,i,n,o,s){var a=this,l=e.Tools.LoadFile(t,r,i,n?this.database:void 0,o,s);return this._activeRequests.push(l),l.onCompleteObservable.add((function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)})),l},r.prototype._loadFileAsync=function(e,t,r){var i=this;return new Promise(function(n,o){i._loadFile(e,(function(e){n(e)}),void 0,t,r,(function(e,t){o(t)}))})},r._FOGMODE_NONE=0,r._FOGMODE_EXP=1,r._FOGMODE_EXP2=2,r._FOGMODE_LINEAR=3,r._uniqueIdCounter=0,r.MinDeltaTime=1,r.MaxDeltaTime=1e3,r.DragMovementThreshold=10,r.LongPressDelay=500,r.DoubleClickDelay=300,r.ExclusiveDoubleClickMode=!1,r})();e.Scene=i})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=new Array,this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.lensFlareSystems=new Array,this.shadowGenerators=new Array,this.actionManagers=new Array,this.sounds=new Array,this.textures=new Array,this.effectLayers=new Array}return e})();e.KeepAssets=t;var r=(function(){function r(e){this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=new Array,this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.lensFlareSystems=new Array,this.shadowGenerators=new Array,this.actionManagers=new Array,this.sounds=new Array,this.textures=new Array,this.effectLayers=new Array,this.scene=e}return r.prototype.addAllToScene=function(){var e=this;this.cameras.forEach((function(t){e.scene.addCamera(t)})),this.lights.forEach((function(t){e.scene.addLight(t)})),this.meshes.forEach((function(t){e.scene.addMesh(t)})),this.skeletons.forEach((function(t){e.scene.addSkeleton(t)})),this.particleSystems.forEach((function(t){e.scene.addParticleSystem(t)})),this.animations.forEach((function(t){e.scene.addAnimation(t)})),this.animationGroups.forEach((function(t){e.scene.addAnimationGroup(t)})),this.multiMaterials.forEach((function(t){e.scene.addMultiMaterial(t)})),this.materials.forEach((function(t){e.scene.addMaterial(t)})),this.morphTargetManagers.forEach((function(t){e.scene.addMorphTargetManager(t)})),this.geometries.forEach((function(t){e.scene.addGeometry(t)})),this.transformNodes.forEach((function(t){e.scene.addTransformNode(t)})),this.lensFlareSystems.forEach((function(t){e.scene.addLensFlareSystem(t)})),
- this.actionManagers.forEach((function(t){e.scene.addActionManager(t)})),this.sounds.forEach((function(t){t.play(),t.autoplay=!0,e.scene.mainSoundTrack.AddSound(t)})),this.textures.forEach((function(t){e.scene.addTexture(t)})),this.effectLayers.forEach((function(t){e.scene.addEffectLayer(t)}))},r.prototype.removeAllFromScene=function(){var e=this;this.cameras.forEach((function(t){e.scene.removeCamera(t)})),this.lights.forEach((function(t){e.scene.removeLight(t)})),this.meshes.forEach((function(t){e.scene.removeMesh(t)})),this.skeletons.forEach((function(t){e.scene.removeSkeleton(t)})),this.particleSystems.forEach((function(t){e.scene.removeParticleSystem(t)})),this.animations.forEach((function(t){e.scene.removeAnimation(t)})),this.animationGroups.forEach((function(t){e.scene.removeAnimationGroup(t)})),this.multiMaterials.forEach((function(t){e.scene.removeMultiMaterial(t)})),this.materials.forEach((function(t){e.scene.removeMaterial(t)})),this.morphTargetManagers.forEach((function(t){e.scene.removeMorphTargetManager(t)})),this.geometries.forEach((function(t){e.scene.removeGeometry(t)})),this.transformNodes.forEach((function(t){e.scene.removeTransformNode(t)})),this.lensFlareSystems.forEach((function(t){e.scene.removeLensFlareSystem(t)})),this.actionManagers.forEach((function(t){e.scene.removeActionManager(t)})),this.sounds.forEach((function(t){t.stop(),t.autoplay=!1,e.scene.mainSoundTrack.RemoveSound(t)})),this.textures.forEach((function(t){e.scene.removeTexture(t)})),this.effectLayers.forEach((function(t){e.scene.removeEffectLayer(t)}))},r.prototype._moveAssets=function(e,t,r){for(var i=0,n=e;i<n.length;i++){for(var o=n[i],s=!0,a=0,l=r;a<l.length;a++){if(o===l[a]){s=!1;break}}s&&t.push(o)}},r.prototype.moveAllFromScene=function(e){void 0===e&&(e=new t),this._moveAssets(this.scene.cameras,this.cameras,e.cameras),this._moveAssets(this.scene.meshes,this.meshes,e.meshes),this._moveAssets(this.scene.getGeometries(),this.geometries,e.geometries),this._moveAssets(this.scene.materials,this.materials,e.materials),this._moveAssets(this.scene._actionManagers,this.actionManagers,e.actionManagers),this._moveAssets(this.scene.animations,this.animations,e.animations),this._moveAssets(this.scene.animationGroups,this.animationGroups,e.animationGroups),this._moveAssets(this.scene.lensFlareSystems,this.lensFlareSystems,e.lensFlareSystems),this._moveAssets(this.scene.lights,this.lights,e.lights),this._moveAssets(this.scene.morphTargetManagers,this.morphTargetManagers,e.morphTargetManagers),this._moveAssets(this.scene.multiMaterials,this.multiMaterials,e.multiMaterials),this._moveAssets(this.scene.skeletons,this.skeletons,e.skeletons),this._moveAssets(this.scene.particleSystems,this.particleSystems,e.particleSystems),this._moveAssets(this.scene.mainSoundTrack.soundCollection,this.sounds,e.sounds),this._moveAssets(this.scene.transformNodes,this.transformNodes,e.transformNodes),this._moveAssets(this.scene.textures,this.textures,e.textures),this._moveAssets(this.scene.effectLayers,this.effectLayers,e.effectLayers),this.removeAllFromScene()},r.prototype.createRootMesh=function(){var t=new e.Mesh("assetContainerRootMesh",this.scene);return this.meshes.forEach((function(e){e.parent||t.addChild(e)})),this.meshes.unshift(t),t},r})();e.AssetContainer=r})(n||(n={}));var n;!(function(e){var t=(function(){function t(t,r,i,n,o,s,a){void 0===n&&(n=0),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),t instanceof e.Mesh?this._engine=t.getScene().getEngine():this._engine=t,this._updatable=i,this._instanced=s,this._data=r,this.byteStride=a?n:n*Float32Array.BYTES_PER_ELEMENT,o||this.create()}return t.prototype.createVertexBuffer=function(t,r,i,n,o,s){void 0===s&&(s=!1);var a=s?r:r*Float32Array.BYTES_PER_ELEMENT,l=n?s?n:n*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new e.VertexBuffer(this._engine,this,t,this._updatable,!0,l,void 0===o?this._instanced:o,a,i,void 0,void 0,!0)},t.prototype.isUpdatable=function(){return this._updatable},t.prototype.getData=function(){return this._data},t.prototype.getBuffer=function(){return this._buffer},t.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},t.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},t.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},t.prototype.update=function(e){this.create(e)},t.prototype.updateDirectly=function(e,t,r,i){void 0===i&&(i=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,i?t:t*Float32Array.BYTES_PER_ELEMENT,r?r*this.byteStride:void 0),this._data=null)},t.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)},t})();e.Buffer=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(r,i,n,o,s,a,l,u,h,c,f,d){if(void 0===f&&(f=!1),void 0===d&&(d=!1),i instanceof e.Buffer?(this._buffer=i,this._ownsBuffer=!1):(this._buffer=new e.Buffer(r,i,o,a,s,l,d),this._ownsBuffer=!0),this._kind=n,void 0==c){var p=this.getData();this.type=t.FLOAT,p instanceof Int8Array?this.type=t.BYTE:p instanceof Uint8Array?this.type=t.UNSIGNED_BYTE:p instanceof Int16Array?this.type=t.SHORT:p instanceof Uint16Array?this.type=t.UNSIGNED_SHORT:p instanceof Int32Array?this.type=t.INT:p instanceof Uint32Array&&(this.type=t.UNSIGNED_INT)}else this.type=c;var A=t.GetTypeByteLength(this.type);d?(this._size=h||(a?a/A:t.DeduceStride(n)),this.byteStride=a||this._buffer.byteStride||this._size*A,this.byteOffset=u||0):(this._size=h||a||t.DeduceStride(n),this.byteStride=a?a*A:this._buffer.byteStride||this._size*A,this.byteOffset=(u||0)*A),this.normalized=f,this._instanced=void 0!==l&&l,this._instanceDivisor=l?1:0}return Object.defineProperty(t.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){this._instanceDivisor=e,this._instanced=0!=e},enumerable:!0,configurable:!0}),t.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},t.prototype.getKind=function(){return this._kind},t.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},t.prototype.getData=function(){return this._buffer.getData()},t.prototype.getBuffer=function(){return this._buffer.getBuffer()},t.prototype.getStrideSize=function(){return this.byteStride/t.GetTypeByteLength(this.type)},t.prototype.getOffset=function(){return this.byteOffset/t.GetTypeByteLength(this.type)},t.prototype.getSize=function(){return this._size},t.prototype.getIsInstanced=function(){return this._instanced},t.prototype.getInstanceDivisor=function(){return this._instanceDivisor},t.prototype.create=function(e){return this._buffer.create(e)},t.prototype.update=function(e){return this._buffer.update(e)},t.prototype.updateDirectly=function(e,t,r){void 0===r&&(r=!1),this._buffer.updateDirectly(e,t,void 0,r)},t.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},t.prototype.forEach=function(e,r){t.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,r)},Object.defineProperty(t,"PositionKind",{get:function(){return t._PositionKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"NormalKind",{get:function(){return t._NormalKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TangentKind",{get:function(){return t._TangentKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UVKind",{get:function(){return t._UVKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UV2Kind",{get:function(){return t._UV2Kind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UV3Kind",{get:function(){return t._UV3Kind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UV4Kind",{get:function(){return t._UV4Kind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UV5Kind",{get:function(){return t._UV5Kind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UV6Kind",{get:function(){return t._UV6Kind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ColorKind",{get:function(){return t._ColorKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MatricesIndicesKind",{get:function(){return t._MatricesIndicesKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MatricesWeightsKind",{get:function(){return t._MatricesWeightsKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MatricesIndicesExtraKind",{get:function(){return t._MatricesIndicesExtraKind},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MatricesWeightsExtraKind",{get:function(){return t._MatricesWeightsExtraKind},enumerable:!0,configurable:!0}),t.DeduceStride=function(e){switch(e){case t.UVKind:case t.UV2Kind:case t.UV3Kind:case t.UV4Kind:case t.UV5Kind:case t.UV6Kind:return 2;case t.NormalKind:case t.PositionKind:return 3;case t.ColorKind:case t.MatricesIndicesKind:case t.MatricesIndicesExtraKind:case t.MatricesWeightsKind:case t.MatricesWeightsExtraKind:case t.TangentKind:return 4;default:throw new Error("Invalid kind '"+e+"'")}},t.GetTypeByteLength=function(e){switch(e){case t.BYTE:case t.UNSIGNED_BYTE:return 1;case t.SHORT:case t.UNSIGNED_SHORT:return 2;case t.INT:case t.FLOAT:return 4;default:throw new Error("Invalid type '"+e+"'")}},t.ForEach=function(e,r,i,n,o,s,a,l){if(e instanceof Array)for(var u=r/4,h=i/4,c=0;c<s;c+=n){for(var f=0;f<n;f++)l(e[u+f],c+f);u+=h}else for(var d=e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),p=t.GetTypeByteLength(o),c=0;c<s;c+=n){for(var A=r,f=0;f<n;f++){var m=t._GetFloatValue(d,o,A,a);l(m,c+f),A+=p}r+=i}},t._GetFloatValue=function(e,r,i,n){switch(r){case t.BYTE:var o=e.getInt8(i);return n&&(o=Math.max(o/127,-1)),o;case t.UNSIGNED_BYTE:var o=e.getUint8(i);return n&&(o/=255),o;case t.SHORT:var o=e.getInt16(i,!0);return n&&(o=Math.max(o/16383,-1)),o;case t.UNSIGNED_SHORT:var o=e.getUint16(i,!0);return n&&(o/=65535),o;case t.FLOAT:return e.getFloat32(i,!0);default:throw new Error("Invalid component type "+r)}},t.BYTE=5120,t.UNSIGNED_BYTE=5121,t.SHORT=5122,t.UNSIGNED_SHORT=5123,t.INT=5124,t.UNSIGNED_INT=5125,t.FLOAT=5126,t._PositionKind="position",t._NormalKind="normal",t._TangentKind="tangent",t._UVKind="uv",t._UV2Kind="uv2",t._UV3Kind="uv3",t._UV4Kind="uv4",t._UV5Kind="uv5",t._UV6Kind="uv6",t._ColorKind="color",t._MatricesIndicesKind="matricesIndices",t._MatricesWeightsKind="matricesWeights",t._MatricesIndicesExtraKind="matricesIndicesExtra",t._MatricesWeightsExtraKind="matricesWeightsExtra",t})();e.VertexBuffer=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this.previous=null,this.next=null}return e})();e.DummyInternalTextureTracker=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(r,i){this.onLoadedObservable=new e.Observable,this.previous=null,this.next=null,this._initialSlot=-1,this._designatedSlot=-1,this._dataSource=t.DATASOURCE_UNKNOWN,this._comparisonFunction=0,this._isRGBD=!1,this._references=1,this._engine=r,this._dataSource=i,this._webGLTexture=r._createTexture()}return t.prototype.getEngine=function(){return this._engine},Object.defineProperty(t.prototype,"dataSource",{get:function(){return this._dataSource},enumerable:!0,configurable:!0}),t.prototype.incrementReferences=function(){this._references++},t.prototype.updateSize=function(e,t,r){void 0===r&&(r=1),this.width=e,this.height=t,this.depth=r,this.baseWidth=e,this.baseHeight=t,this.baseDepth=r,this._size=e*t*r},t.prototype._rebuild=function(){var r,i=this;switch(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedAnisotropicFilteringLevel=null,this._dataSource){case t.DATASOURCE_TEMP:return;case t.DATASOURCE_URL:return r=this._engine.createTexture(this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(){i.isReady=!0}),null,this._buffer,void 0,this.format),void r._swapAndDie(this);case t.DATASOURCE_RAW:return r=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),r._swapAndDie(this),void(this.isReady=!0);case t.DATASOURCE_RAW3D:return r=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),r._swapAndDie(this),void(this.isReady=!0);case t.DATASOURCE_DYNAMIC:return r=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode),void r._swapAndDie(this);case t.DATASOURCE_RENDERTARGET:var n=new e.RenderTargetCreationOptions;if(n.generateDepthBuffer=this._generateDepthBuffer,n.generateMipMaps=this.generateMipMaps,n.generateStencilBuffer=this._generateStencilBuffer,n.samplingMode=this.samplingMode,n.type=this.type,this.isCube)r=this._engine.createRenderTargetCubeTexture(this.width,n);else{var o={width:this.width,height:this.height};r=this._engine.createRenderTargetTexture(o,n)}return r._swapAndDie(this),void(this.isReady=!0);case t.DATASOURCE_DEPTHTEXTURE:var s={bilinearFiltering:this.samplingMode!==e.Texture.BILINEAR_SAMPLINGMODE,comparisonFunction:this._comparisonFunction,generateStencil:this._generateStencilBuffer,isCube:this.isCube};return r=this._engine.createDepthStencilTexture({width:this.width,height:this.height},s),r._swapAndDie(this),void(this.isReady=!0);case t.DATASOURCE_CUBE:return r=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){i.isReady=!0}),null,this.format,this._extension),void r._swapAndDie(this);case t.DATASOURCE_CUBERAW:return r=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),r._swapAndDie(this),void(this.isReady=!0);case t.DATASOURCE_CUBEPREFILTERED:return r=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(i),i.isReady=!0}),null,this.format,this._extension),void(r._sphericalPolynomial=this._sphericalPolynomial)}},t.prototype._swapAndDie=function(e){e._webGLTexture=this._webGLTexture,this._framebuffer&&(e._framebuffer=this._framebuffer),this._depthStencilBuffer&&(e._depthStencilBuffer=this._depthStencilBuffer),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow);var t=this._engine.getLoadedTexturesCache(),r=t.indexOf(this);-1!==r&&t.splice(r,1)},t.prototype.dispose=function(){this._webGLTexture&&0===--this._references&&(this._engine._releaseTexture(this),this._webGLTexture=null,this.previous=null,this.next=null)},t.DATASOURCE_UNKNOWN=0,t.DATASOURCE_URL=1,t.DATASOURCE_TEMP=2,t.DATASOURCE_RAW=3,t.DATASOURCE_DYNAMIC=4,t.DATASOURCE_RENDERTARGET=5,t.DATASOURCE_MULTIRENDERTARGET=6,t.DATASOURCE_CUBE=7,t.DATASOURCE_CUBERAW=8,t.DATASOURCE_CUBEPREFILTERED=9,t.DATASOURCE_RAW3D=10,t.DATASOURCE_DEPTHTEXTURE=11,t})();e.InternalTexture=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(r){this._hasAlpha=!1,this.getAlphaFromRGB=!1,this.level=1,this.coordinatesIndex=0,this._coordinatesMode=e.Texture.EXPLICIT_MODE,this.wrapU=e.Texture.WRAP_ADDRESSMODE,this.wrapV=e.Texture.WRAP_ADDRESSMODE,this.wrapR=e.Texture.WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this.isCube=!1,this.is3D=!1,this.gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this.animations=new Array,this.onDisposeObservable=new e.Observable,this.delayLoadState=e.Engine.DELAYLOADSTATE_NONE,this._scene=r||e.Engine.LastCreatedScene,this._scene&&this._scene.textures.push(this),this._uid=null}return Object.defineProperty(t.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(t){this._hasAlpha!==t&&(this._hasAlpha=t,this._scene&&this._scene.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag|e.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(t){this._coordinatesMode!==t&&(this._coordinatesMode=t,this._scene&&this._scene.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uid",{get:function(){return this._uid||(this._uid=e.Tools.RandomId()),this._uid},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype.getTextureMatrix=function(){return e.Matrix.IdentityReadOnly},t.prototype.getReflectionTextureMatrix=function(){return e.Matrix.IdentityReadOnly},t.prototype.getInternalTexture=function(){return this._texture},t.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},t.prototype.isReady=function(){return this.delayLoadState===e.Engine.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},t.prototype.getSize=function(){return this._texture&&this._texture.width?new e.Size(this._texture.width,this._texture.height):this._texture&&this._texture._size?new e.Size(this._texture._size,this._texture._size):e.Size.Zero()},t.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?new e.Size(this._texture._size,this._texture._size):new e.Size(this._texture.baseWidth,this._texture.baseHeight):e.Size.Zero()},t.prototype.scale=function(e){},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype._getFromCache=function(e,t,r){if(!this._scene)return null;for(var i=this._scene.getEngine().getLoadedTexturesCache(),n=0;n<i.length;n++){var o=i[n];if(o.url===e&&o.generateMipMaps===!t&&(!r||r===o.samplingMode))return o.incrementReferences(),o}return null},t.prototype._rebuild=function(){},t.prototype.delayLoad=function(){},t.prototype.clone=function(){return null},Object.defineProperty(t.prototype,"textureType",{get:function(){return this._texture&&void 0!==this._texture.type?this._texture.type:e.Engine.TEXTURETYPE_UNSIGNED_INT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureFormat",{get:function(){return this._texture&&void 0!==this._texture.format?this._texture.format:e.Engine.TEXTUREFORMAT_RGBA},enumerable:!0,configurable:!0}),t.prototype.readPixels=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=0),!this._texture)return null;var r=this.getSize(),i=r.width,n=r.height,o=this.getScene();if(!o)return null;var s=o.getEngine();return 0!=t&&(i/=Math.pow(2,t),n/=Math.pow(2,t),i=Math.round(i),n=Math.round(n)),this._texture.isCube?s._readTexturePixels(this._texture,i,n,e,t):s._readTexturePixels(this._texture,i,n,-1,t)},t.prototype.releaseInternalTexture=function(){this._texture&&(this._texture.dispose(),this._texture=null)},Object.defineProperty(t.prototype,"sphericalPolynomial",{get:function(){return this._texture&&e.CubeMapToSphericalPolynomialTools&&this.isReady()?(this._texture._sphericalPolynomial||(this._texture._sphericalPolynomial=e.CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this)),this._texture._sphericalPolynomial):null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureHigh",{get:function(){return this._texture?this._texture._lodTextureHigh:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureMid",{get:function(){return this._texture?this._texture._lodTextureMid:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureLow",{get:function(){return this._texture?this._texture._lodTextureLow:null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._scene){this._scene.stopAnimation(this),this._scene._removePendingData(this);var e=this._scene.textures.indexOf(this);e>=0&&this._scene.textures.splice(e,1),void 0!==this._texture&&(this.releaseInternalTexture(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear())}},t.prototype.serialize=function(){if(!this.name)return null;var t=e.SerializationHelper.Serialize(this);return e.Animation.AppendSerializedAnimations(this,t),t},t.WhenAllReady=function(e,t){var r=e.length;if(0===r)return void t();for(var i,n,o=0;o<e.length;o++)!(function(){if(i=e[o],i.isReady())0==--r&&t();else{n=i.onLoadObservable;var s=function(){n.removeCallback(s),0==--r&&t()};n.add(s)}})()},t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,o([e.serialize()],t.prototype,"name",void 0),o([e.serialize("hasAlpha")],t.prototype,"_hasAlpha",void 0),o([e.serialize()],t.prototype,"getAlphaFromRGB",void 0),o([e.serialize()],t.prototype,"level",void 0),o([e.serialize()],t.prototype,"coordinatesIndex",void 0),o([e.serialize("coordinatesMode")],t.prototype,"_coordinatesMode",void 0),o([e.serialize()],t.prototype,"wrapU",void 0),o([e.serialize()],t.prototype,"wrapV",void 0),o([e.serialize()],t.prototype,"wrapR",void 0),o([e.serialize()],t.prototype,"anisotropicFilteringLevel",void 0),o([e.serialize()],t.prototype,"isCube",void 0),o([e.serialize()],t.prototype,"is3D",void 0),o([e.serialize()],t.prototype,"gammaSpace",void 0),o([e.serialize()],t.prototype,"invertZ",void 0),o([e.serialize()],t.prototype,"lodLevelInAlpha",void 0),o([e.serialize()],t.prototype,"lodGenerationOffset",null),o([e.serialize()],t.prototype,"lodGenerationScale",null),o([e.serialize()],t.prototype,"isRenderTarget",void 0),t})();e.BaseTexture=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(i,n,o,s,a,l,u,h,c,f){void 0===o&&(o=!1),void 0===s&&(s=!0),void 0===a&&(a=r.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===u&&(u=null),void 0===h&&(h=null),void 0===c&&(c=!1);var d=t.call(this,n)||this;if(d.uOffset=0,d.vOffset=0,d.uScale=1,d.vScale=1,d.uAng=0,d.vAng=0,d.wAng=0,d.uRotationCenter=.5,d.vRotationCenter=.5,d.wRotationCenter=.5,d._isBlocking=!0,d.name=i||"",d.url=i,d._noMipmap=o,d._invertY=s,d._samplingMode=a,d._buffer=h,d._deleteBuffer=c,f&&(d._format=f),!(n=d.getScene()))return d;n.getEngine().onBeforeTextureInitObservable.notifyObservers(d);var p=function(){d._onLoadObservable&&d._onLoadObservable.hasObservers()&&d.onLoadObservable.notifyObservers(d),l&&l(),!d.isBlocking&&n&&n.resetCachedMaterial()};return d.url?(d._texture=d._getFromCache(d.url,o,a),d._texture?d._texture.isReady?e.Tools.SetImmediate((function(){return p()})):d._texture.onLoadedObservable.add(p):n.useDelayedTextureLoading?(d.delayLoadState=e.Engine.DELAYLOADSTATE_NOTLOADED,d._delayedOnLoad=p,d._delayedOnError=u):(d._texture=n.getEngine().createTexture(d.url,o,s,n,d._samplingMode,p,u,d._buffer,void 0,d._format),c&&delete d._buffer),d):(d._delayedOnLoad=p,d._delayedOnError=u,d)}return s(r,t),Object.defineProperty(r.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"samplingMode",{get:function(){return this._samplingMode},enumerable:!0,configurable:!0}),r.prototype.updateURL=function(t,r){if(void 0===r&&(r=null),this.url)throw new Error("URL is already set");this.url=t,this._buffer=r,this.delayLoadState=e.Engine.DELAYLOADSTATE_NOTLOADED,this.delayLoad()},r.prototype.delayLoad=function(){if(this.delayLoadState===e.Engine.DELAYLOADSTATE_NOTLOADED){var t=this.getScene();t&&(this.delayLoadState=e.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this._samplingMode),this._texture?this._delayedOnLoad&&(this._texture.isReady?e.Tools.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=t.getEngine().createTexture(this.url,this._noMipmap,this._invertY,t,this._samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)}},r.prototype.updateSamplingMode=function(e){if(this._texture){var t=this.getScene();t&&(this._samplingMode=e,t.getEngine().updateTextureSamplingMode(e,this._texture))}},r.prototype._prepareRowForTextureGeneration=function(t,r,i,n){t*=this.uScale,r*=this.vScale,t-=this.uRotationCenter*this.uScale,r-=this.vRotationCenter*this.vScale,i-=this.wRotationCenter,e.Vector3.TransformCoordinatesFromFloatsToRef(t,r,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this.uScale+this.uOffset,n.y+=this.vRotationCenter*this.vScale+this.vOffset,n.z+=this.wRotationCenter},r.prototype.getTextureMatrix=function(){var t=this;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedTextureMatrix||(this._cachedTextureMatrix=e.Matrix.Zero(),this._rowGenerationMatrix=new e.Matrix,this._t0=e.Vector3.Zero(),this._t1=e.Vector3.Zero(),this._t2=e.Vector3.Zero()),e.Matrix.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),e.Matrix.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix.m[0]=this._t1.x,this._cachedTextureMatrix.m[1]=this._t1.y,this._cachedTextureMatrix.m[2]=this._t1.z,this._cachedTextureMatrix.m[4]=this._t2.x,this._cachedTextureMatrix.m[5]=this._t2.y,this._cachedTextureMatrix.m[6]=this._t2.z,this._cachedTextureMatrix.m[8]=this._t0.x,this._cachedTextureMatrix.m[9]=this._t0.y,this._cachedTextureMatrix.m[10]=this._t0.z;var r=this.getScene();return r?(r.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix):this._cachedTextureMatrix},r.prototype.getReflectionTextureMatrix=function(){var t=this,i=this.getScene();if(!i)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==r.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=e.Matrix.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=e.Matrix.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case r.PLANAR_MODE:e.Matrix.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case r.PROJECTION_MODE:e.Matrix.IdentityToRef(this._projectionModeMatrix),this._projectionModeMatrix.m[0]=.5,this._projectionModeMatrix.m[5]=-.5,this._projectionModeMatrix.m[10]=0,this._projectionModeMatrix.m[12]=.5,this._projectionModeMatrix.m[13]=.5,this._projectionModeMatrix.m[14]=1,this._projectionModeMatrix.m[15]=1;var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:e.Matrix.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(e.Material.TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(t)})),this._cachedTextureMatrix},r.prototype.clone=function(){var t=this;return e.SerializationHelper.Clone((function(){return new r(t._texture?t._texture.url:null,t.getScene(),t._noMipmap,t._invertY,t._samplingMode)}),this)},Object.defineProperty(r.prototype,"onLoadObservable",{get:function(){return this._onLoadObservable||(this._onLoadObservable=new e.Observable),this._onLoadObservable},enumerable:!0,configurable:!0}),r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return"string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)&&(e.base64String=this._buffer,e.name=e.name.replace("data:","")),e.invertY=this._invertY,e.samplingMode=this.samplingMode,e},r.prototype.getClassName=function(){return"Texture"},r.prototype.dispose=function(){t.prototype.dispose.call(this),this.onLoadObservable&&(this.onLoadObservable.clear(),this._onLoadObservable=null),this._delayedOnLoad=null,this._delayedOnError=null},r.CreateFromBase64String=function(t,i,n,o,s,a,l,u,h){return void 0===a&&(a=r.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===u&&(u=null),void 0===h&&(h=e.Engine.TEXTUREFORMAT_RGBA),new r("data:"+i,n,o,s,a,l,u,t,!1,h)},r.Parse=function(t,i,n){if(t.customType){var o=e.Tools.Instantiate(t.customType),s=o.Parse(t,i,n);return t.samplingMode&&s.updateSamplingMode&&s._samplingMode&&s._samplingMode!==t.samplingMode&&s.updateSamplingMode(t.samplingMode),s}if(t.isCube)return e.CubeTexture.Parse(t,i,n);if(!t.name&&!t.isRenderTarget)return null;var a=e.SerializationHelper.Parse((function(){var o=!0;if(t.noMipmap&&(o=!1),t.mirrorPlane){var s=new e.MirrorTexture(t.name,t.renderTargetSize,i,o);return s._waitingRenderList=t.renderList,s.mirrorPlane=e.Plane.FromArray(t.mirrorPlane),s}if(t.isRenderTarget){var a=new e.RenderTargetTexture(t.name,t.renderTargetSize,i,o);return a._waitingRenderList=t.renderList,a}var l;if(t.base64String)l=r.CreateFromBase64String(t.base64String,t.name,i,!o);else{var u=n+t.name;r.UseSerializedUrlIfAny&&t.url&&(u=t.url),l=new r(u,i,!o,t.invertY)}return l}),t,i);if(t.samplingMode){var l=t.samplingMode;a._samplingMode!==l&&a.updateSamplingMode(l)}if(t.animations)for(var u=0;u<t.animations.length;u++){var h=t.animations[u];a.animations.push(e.Animation.Parse(h))}return a},r.LoadFromDataString=function(t,i,n,o,s,a,l,u,h,c){return void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!0),void 0===l&&(l=r.TRILINEAR_SAMPLINGMODE),void 0===u&&(u=null),void 0===h&&(h=null),void 0===c&&(c=e.Engine.TEXTUREFORMAT_RGBA),"data:"!==t.substr(0,5)&&(t="data:"+t),new r(t,n,s,a,l,u,h,i,o,c)},r.NEAREST_SAMPLINGMODE=1,r.NEAREST_NEAREST_MIPLINEAR=1,r.BILINEAR_SAMPLINGMODE=2,r.LINEAR_LINEAR_MIPNEAREST=2,r.TRILINEAR_SAMPLINGMODE=3,r.LINEAR_LINEAR_MIPLINEAR=3,
- r.NEAREST_NEAREST_MIPNEAREST=4,r.NEAREST_LINEAR_MIPNEAREST=5,r.NEAREST_LINEAR_MIPLINEAR=6,r.NEAREST_LINEAR=7,r.NEAREST_NEAREST=8,r.LINEAR_NEAREST_MIPNEAREST=9,r.LINEAR_NEAREST_MIPLINEAR=10,r.LINEAR_LINEAR=11,r.LINEAR_NEAREST=12,r.EXPLICIT_MODE=0,r.SPHERICAL_MODE=1,r.PLANAR_MODE=2,r.CUBIC_MODE=3,r.PROJECTION_MODE=4,r.SKYBOX_MODE=5,r.INVCUBIC_MODE=6,r.EQUIRECTANGULAR_MODE=7,r.FIXED_EQUIRECTANGULAR_MODE=8,r.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,r.CLAMP_ADDRESSMODE=0,r.WRAP_ADDRESSMODE=1,r.MIRROR_ADDRESSMODE=2,r.UseSerializedUrlIfAny=!1,o([e.serialize()],r.prototype,"url",void 0),o([e.serialize()],r.prototype,"uOffset",void 0),o([e.serialize()],r.prototype,"vOffset",void 0),o([e.serialize()],r.prototype,"uScale",void 0),o([e.serialize()],r.prototype,"vScale",void 0),o([e.serialize()],r.prototype,"uAng",void 0),o([e.serialize()],r.prototype,"vAng",void 0),o([e.serialize()],r.prototype,"wAng",void 0),o([e.serialize()],r.prototype,"uRotationCenter",void 0),o([e.serialize()],r.prototype,"vRotationCenter",void 0),o([e.serialize()],r.prototype,"wRotationCenter",void 0),o([e.serialize()],r.prototype,"isBlocking",null),r})(e.BaseTexture);e.Texture=t})(n||(n={}));var n;!(function(e){var t=(function(){function e(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array}return e})();e._InstancesBatch=t;var r=(function(r){function i(n,o,s,a,l,u){void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null),void 0===u&&(u=!0);var h=r.call(this,n,o)||this;if(h.onBeforeRenderObservable=new e.Observable,h.onAfterRenderObservable=new e.Observable,h.onBeforeDrawObservable=new e.Observable,h.delayLoadState=e.Engine.DELAYLOADSTATE_NONE,h.instances=new Array,h._LODLevels=new Array,h._visibleInstances={},h._renderIdForInstances=new Array,h._batchCache=new t,h._instancesBufferSize=2048,h._originalBuilderSideOrientation=i._DEFAULTSIDE,h.overrideMaterialSideOrientation=null,h._areNormalsFrozen=!1,h._source=null,o=h.getScene(),a){a._geometry&&a._geometry.applyToMesh(h),e.Tools.DeepCopy(a,h,["name","material","skeleton","instances","parent","uniqueId","source","metadata","hasLODLevels","geometry","isBlocked","areNormalsFrozen"],["_poseMatrix"]),h._source=a,a.metadata&&a.metadata.clone?h.metadata=a.metadata.clone():h.metadata=a.metadata,e.Tags&&e.Tags.HasTags(a)&&e.Tags.AddTagsTo(h,e.Tags.GetTags(a,!0)),h.parent=a.parent,h.setPivotMatrix(a.getPivotMatrix()),h.id=n+"."+a.id,h.material=a.material;var c;if(!l)for(var f=a.getDescendants(!0),d=0;d<f.length;d++){var p=f[d];p.clone&&p.clone(n+"."+p.name,h)}var A=h.getScene().getPhysicsEngine();if(u&&A){var m=A.getImpostorForPhysicsObject(a);m&&(h.physicsImpostor=m.clone(h))}for(c=0;c<o.particleSystems.length;c++){var g=o.particleSystems[c];g.emitter===a&&g.clone(g.name,h)}h.computeWorldMatrix(!0)}return null!==s&&(h.parent=s),h}return s(i,r),Object.defineProperty(i,"FRONTSIDE",{get:function(){return i._FRONTSIDE},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BACKSIDE",{get:function(){return i._BACKSIDE},enumerable:!0,configurable:!0}),Object.defineProperty(i,"DOUBLESIDE",{get:function(){return i._DOUBLESIDE},enumerable:!0,configurable:!0}),Object.defineProperty(i,"DEFAULTSIDE",{get:function(){return i._DEFAULTSIDE},enumerable:!0,configurable:!0}),Object.defineProperty(i,"NO_CAP",{get:function(){return i._NO_CAP},enumerable:!0,configurable:!0}),Object.defineProperty(i,"CAP_START",{get:function(){return i._CAP_START},enumerable:!0,configurable:!0}),Object.defineProperty(i,"CAP_END",{get:function(){return i._CAP_END},enumerable:!0,configurable:!0}),Object.defineProperty(i,"CAP_ALL",{get:function(){return i._CAP_ALL},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onBeforeDraw",{set:function(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"morphTargetManager",{get:function(){return this._morphTargetManager},set:function(e){this._morphTargetManager!==e&&(this._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),i.prototype.getClassName=function(){return"Mesh"},i.prototype.toString=function(t){var i=r.prototype.toString.call(this,t);if(i+=", n vertices: "+this.getTotalVertices(),i+=", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(var n=0;n<this.animations.length;n++)i+=", animation[0]: "+this.animations[n].toString(t);if(t)if(this._geometry){var o=this.getIndices(),s=this.getVerticesData(e.VertexBuffer.PositionKind);s&&o&&(i+=", flat shading: "+(s.length/3===o.length?"YES":"NO"))}else i+=", flat shading: UNKNOWN";return i},i.prototype._unBindEffect=function(){r.prototype._unBindEffect.call(this);for(var e=0,t=this.instances;e<t.length;e++){t[e]._unBindEffect()}},Object.defineProperty(i.prototype,"hasLODLevels",{get:function(){return this._LODLevels.length>0},enumerable:!0,configurable:!0}),i.prototype.getLODLevels=function(){return this._LODLevels},i.prototype._sortLODLevels=function(){this._LODLevels.sort((function(e,t){return e.distance<t.distance?1:e.distance>t.distance?-1:0}))},i.prototype.addLODLevel=function(t,r){if(r&&r._masterMesh)return e.Tools.Warn("You cannot use a mesh as LOD level twice"),this;var i=new e.MeshLODLevel(t,r);return this._LODLevels.push(i),r&&(r._masterMesh=this),this._sortLODLevels(),this},i.prototype.getLODLevelAtDistance=function(e){for(var t=0;t<this._LODLevels.length;t++){var r=this._LODLevels[t];if(r.distance===e)return r.mesh}return null},i.prototype.removeLODLevel=function(e){for(var t=0;t<this._LODLevels.length;t++)this._LODLevels[t].mesh===e&&(this._LODLevels.splice(t,1),e&&(e._masterMesh=null));return this._sortLODLevels(),this},i.prototype.getLOD=function(e,t){if(!this._LODLevels||0===this._LODLevels.length)return this;var r;if(t)r=t;else{r=this.getBoundingInfo().boundingSphere}var i=r.centerWorld.subtract(e.globalPosition).length();if(this._LODLevels[this._LODLevels.length-1].distance>i)return this.onLODLevelSelection&&this.onLODLevelSelection(i,this,this._LODLevels[this._LODLevels.length-1].mesh),this;for(var n=0;n<this._LODLevels.length;n++){var o=this._LODLevels[n];if(o.distance<i)return o.mesh&&(o.mesh._preActivate(),o.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)),this.onLODLevelSelection&&this.onLODLevelSelection(i,this,o.mesh),o.mesh}return this.onLODLevelSelection&&this.onLODLevelSelection(i,this,this),this},Object.defineProperty(i.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),i.prototype.getTotalVertices=function(){return null===this._geometry||void 0===this._geometry?0:this._geometry.getTotalVertices()},i.prototype.getVerticesData=function(e,t,r){return this._geometry?this._geometry.getVerticesData(e,t,r):null},i.prototype.getVertexBuffer=function(e){return this._geometry?this._geometry.getVertexBuffer(e):null},i.prototype.isVerticesDataPresent=function(e){return this._geometry?this._geometry.isVerticesDataPresent(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},i.prototype.isVertexBufferUpdatable=function(e){return this._geometry?this._geometry.isVertexBufferUpdatable(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},i.prototype.getVerticesDataKinds=function(){if(!this._geometry){var e=new Array;return this._delayInfo&&this._delayInfo.forEach((function(t,r,i){e.push(t)})),e}return this._geometry.getVerticesDataKinds()},i.prototype.getTotalIndices=function(){return this._geometry?this._geometry.getTotalIndices():0},i.prototype.getIndices=function(e){return this._geometry?this._geometry.getIndices(e):[]},Object.defineProperty(i.prototype,"isBlocked",{get:function(){return null!==this._masterMesh&&void 0!==this._masterMesh},enumerable:!0,configurable:!0}),i.prototype.isReady=function(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),this.delayLoadState===e.Engine.DELAYLOADSTATE_LOADING)return!1;if(!r.prototype.isReady.call(this,t))return!1;if(!this.subMeshes||0===this.subMeshes.length)return!0;if(!t)return!0;var n=this.getEngine(),o=this.getScene(),s=i||n.getCaps().instancedArrays&&this.instances.length>0;this.computeWorldMatrix();var a=this.material||o.defaultMaterial;if(a)if(a.storeEffectOnSubMeshes)for(var l=0,u=this.subMeshes;l<u.length;l++){var h=u[l],c=h.getMaterial();if(c)if(c.storeEffectOnSubMeshes){if(!c.isReadyForSubMesh(this,h,s))return!1}else if(!c.isReady(this,s))return!1}else if(!a.isReady(this,s))return!1;for(var f=0,d=this._lightSources;f<d.length;f++){var p=d[f],A=p.getShadowGenerator();if(A)for(var m=0,g=this.subMeshes;m<g.length;m++){var h=g[m];if(!A.isReady(h,s))return!1}}for(var _=0,v=this._LODLevels;_<v.length;_++){var y=v[_];if(y.mesh&&!y.mesh.isReady(s))return!1}return!0},Object.defineProperty(i.prototype,"areNormalsFrozen",{get:function(){return this._areNormalsFrozen},enumerable:!0,configurable:!0}),i.prototype.freezeNormals=function(){return this._areNormalsFrozen=!0,this},i.prototype.unfreezeNormals=function(){return this._areNormalsFrozen=!1,this},Object.defineProperty(i.prototype,"overridenInstanceCount",{set:function(e){this._overridenInstanceCount=e},enumerable:!0,configurable:!0}),i.prototype._preActivate=function(){var e=this.getScene().getRenderId();return this._preActivateId===e?this:(this._preActivateId=e,this._visibleInstances=null,this)},i.prototype._preActivateForIntermediateRendering=function(e){return this._visibleInstances&&(this._visibleInstances.intermediateDefaultRenderId=e),this},i.prototype._registerInstanceForRenderId=function(e,t){return this._visibleInstances||(this._visibleInstances={},this._visibleInstances.defaultRenderId=t,this._visibleInstances.selfDefaultRenderId=this._renderId),this._visibleInstances[t]||(this._visibleInstances[t]=new Array),this._visibleInstances[t].push(e),this},i.prototype.refreshBoundingInfo=function(){return this._refreshBoundingInfo(!1)},i.prototype._refreshBoundingInfo=function(t){if(this._boundingInfo&&this._boundingInfo.isLocked)return this;var r=this._getPositionData(t);if(r){var i=e.Tools.ExtractMinAndMax(r,0,this.getTotalVertices());this._boundingInfo=new e.BoundingInfo(i.minimum,i.maximum)}if(this.subMeshes)for(var n=0;n<this.subMeshes.length;n++)this.subMeshes[n].refreshBoundingInfo();return this._updateBoundingInfo(),this},i.prototype._getPositionData=function(t){var r=this.getVerticesData(e.VertexBuffer.PositionKind);if(r&&t&&this.skeleton){r=e.Tools.Slice(r);var i=this.getVerticesData(e.VertexBuffer.MatricesIndicesKind),n=this.getVerticesData(e.VertexBuffer.MatricesWeightsKind);if(n&&i)for(var o=this.numBoneInfluencers>4,s=o?this.getVerticesData(e.VertexBuffer.MatricesIndicesExtraKind):null,a=o?this.getVerticesData(e.VertexBuffer.MatricesWeightsExtraKind):null,l=this.skeleton.getTransformMatrices(this),u=e.Tmp.Vector3[0],h=e.Tmp.Matrix[0],c=e.Tmp.Matrix[1],f=0,d=0;d<r.length;d+=3,f+=4){h.reset();var p,A;for(p=0;p<4&&!((A=n[f+p])<=0);p++)e.Matrix.FromFloat32ArrayToRefScaled(l,Math.floor(16*i[f+p]),A,c),h.addToSelf(c);if(o)for(p=0;p<4&&!((A=a[f+p])<=0);p++)e.Matrix.FromFloat32ArrayToRefScaled(l,Math.floor(16*s[f+p]),A,c),h.addToSelf(c);e.Vector3.TransformCoordinatesFromFloatsToRef(r[d],r[d+1],r[d+2],h,u),u.toArray(r,d)}}return r},i.prototype._createGlobalSubMesh=function(t){var r=this.getTotalVertices();if(!r||!this.getIndices())return null;if(this.subMeshes&&this.subMeshes.length>0){var i=this.getIndices();if(!i)return null;var n=i.length,o=!1;if(t)o=!0;else for(var s=0,a=this.subMeshes;s<a.length;s++){var l=a[s];if(l.indexStart+l.indexCount>=n){o=!0;break}if(l.verticesStart+l.verticesCount>=r){o=!0;break}}if(!o)return this.subMeshes[0]}return this.releaseSubMeshes(),new e.SubMesh(0,0,r,0,this.getTotalIndices(),this)},i.prototype.subdivide=function(t){if(!(t<1)){for(var r=this.getTotalIndices(),i=r/t|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var o=0;o<t&&!(n>=r);o++)e.SubMesh.CreateFromIndices(0,n,Math.min(i,r-n),this),n+=i;this.synchronizeInstances()}},i.prototype.setVerticesData=function(t,r,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(t,r,i,n);else{var o=new e.VertexData;o.set(r,t);var s=this.getScene();new e.Geometry(e.Geometry.RandomId(),s,o,i,this)}return this},i.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var r=this.getVertexBuffer(e);r&&r.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},i.prototype.setVerticesBuffer=function(t){return this._geometry||(this._geometry=e.Geometry.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(t),this},i.prototype.updateVerticesData=function(e,t,r,i){return this._geometry?(i?(this.makeGeometryUnique(),this.updateVerticesData(e,t,r,!1)):this._geometry.updateVerticesData(e,t,r),this):this},i.prototype.updateMeshPositions=function(t,r){void 0===r&&(r=!0);var i=this.getVerticesData(e.VertexBuffer.PositionKind);if(!i)return this;if(t(i),this.updateVerticesData(e.VertexBuffer.PositionKind,i,!1,!1),r){var n=this.getIndices(),o=this.getVerticesData(e.VertexBuffer.NormalKind);if(!o)return this;e.VertexData.ComputeNormals(i,n,o),this.updateVerticesData(e.VertexBuffer.NormalKind,o,!1,!1)}return this},i.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;var t=this._geometry,r=this._geometry.copy(e.Geometry.RandomId());return t.releaseForMesh(this,!0),r.applyToMesh(this),this},i.prototype.setIndices=function(t,r,i){if(void 0===r&&(r=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(t,r,i);else{var n=new e.VertexData;n.indices=t;var o=this.getScene();new e.Geometry(e.Geometry.RandomId(),o,n,i,this)}return this},i.prototype.updateIndices=function(e,t){return this._geometry?(this._geometry.updateIndices(e,t),this):this},i.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},i.prototype._bind=function(t,r,i){if(!this._geometry)return this;var n,o=this.getScene().getEngine();if(this._unIndexed)n=null;else switch(i){case e.Material.PointFillMode:n=null;break;case e.Material.WireFrameFillMode:n=t.getLinesIndexBuffer(this.getIndices(),o);break;default:case e.Material.TriangleFillMode:n=this._unIndexed?null:this._geometry.getIndexBuffer()}return this._geometry._bind(r,n),this},i.prototype._draw=function(t,r,i,n){if(void 0===n&&(n=!1),!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this.onBeforeDrawObservable.notifyObservers(this);var o=this.getScene(),s=o.getEngine();if(this._unIndexed||r==e.Material.PointFillMode?s.drawArraysType(r,t.verticesStart,t.verticesCount,i):r==e.Material.WireFrameFillMode?s.drawElementsType(r,0,t.linesIndexCount,i):s.drawElementsType(r,t.indexStart,t.indexCount,i),o._isAlternateRenderingEnabled&&!n){var a=t.effect||this._effectiveMaterial.getEffect();if(!a||!o.activeCamera)return this;o._switchToAlternateCameraConfiguration(!0),this._effectiveMaterial.bindView(a),this._effectiveMaterial.bindViewProjection(a),s.setViewport(o.activeCamera._alternateCamera.viewport),this._draw(t,r,i,!0),s.setViewport(o.activeCamera.viewport),o._switchToAlternateCameraConfiguration(!1),this._effectiveMaterial.bindView(a),this._effectiveMaterial.bindViewProjection(a)}return this},i.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},i.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},i.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},i.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},i.prototype._getInstancesRenderList=function(e){var t=this.getScene();if(this._batchCache.mustReturn=!1,this._batchCache.renderSelf[e]=this.isEnabled()&&this.isVisible,this._batchCache.visibleInstances[e]=null,this._visibleInstances){var r=t.getRenderId(),i=t._isInIntermediateRendering()?this._visibleInstances.intermediateDefaultRenderId:this._visibleInstances.defaultRenderId;this._batchCache.visibleInstances[e]=this._visibleInstances[r];var n=this._renderId;!this._batchCache.visibleInstances[e]&&i&&(this._batchCache.visibleInstances[e]=this._visibleInstances[i],r=Math.max(i,r),n=Math.max(this._visibleInstances.selfDefaultRenderId,r));var o=this._batchCache.visibleInstances[e];if(o&&o.length){if(this._renderIdForInstances[e]===r)return this._batchCache.mustReturn=!0,this._batchCache;r!==n&&(this._batchCache.renderSelf[e]=!1)}this._renderIdForInstances[e]=r}return this._batchCache},i.prototype._renderWithInstances=function(t,r,i,n,o){var s=i.visibleInstances[t._id];if(!s)return this;for(var a=s.length+1,l=16*a*4,u=this._instancesBufferSize,h=this._instancesBuffer;this._instancesBufferSize<l;)this._instancesBufferSize*=2;this._instancesData&&u==this._instancesBufferSize||(this._instancesData=new Float32Array(this._instancesBufferSize/4));var c=0,f=0,d=this.getWorldMatrix();if(i.renderSelf[t._id]&&(d.copyToArray(this._instancesData,c),c+=16,f++),s)for(var p=0;p<s.length;p++){var A=s[p];A.getWorldMatrix().copyToArray(this._instancesData,c),c+=16,f++}return h&&u==this._instancesBufferSize?h.updateDirectly(this._instancesData,0,f):(h&&h.dispose(),h=new e.Buffer(o,this._instancesData,!0,16,!1,!0),this._instancesBuffer=h,this.setVerticesBuffer(h.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(h.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(h.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(h.createVertexBuffer("world3",12,4))),this._bind(t,n,r),this._draw(t,r,f),o.unbindInstanceAttributes(),this},i.prototype._processRendering=function(e,t,r,i,n,o,s){var a=this.getScene(),l=a.getEngine();if(n)this._renderWithInstances(e,r,i,t,l);else{i.renderSelf[e._id]&&(o&&o(!1,this.getWorldMatrix(),s),this._draw(e,r,this._overridenInstanceCount));var u=i.visibleInstances[e._id];if(u)for(var h=0;h<u.length;h++){var c=u[h],f=c.getWorldMatrix();o&&o(!0,f,s),this._draw(e,r)}}return this},i.prototype.render=function(t,r){if(this._checkOcclusionQuery(),this._isOccluded)return this;var i=this.getScene(),n=this._getInstancesRenderList(t._id);if(n.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this.onBeforeRenderObservable.notifyObservers(this);var o=i.getEngine(),s=o.getCaps().instancedArrays&&null!==n.visibleInstances[t._id]&&void 0!==n.visibleInstances[t._id],a=t.getMaterial();if(!a)return this;if(this._effectiveMaterial=a,this._effectiveMaterial.storeEffectOnSubMeshes){if(!this._effectiveMaterial.isReadyForSubMesh(this,t,s))return this}else if(!this._effectiveMaterial.isReady(this,s))return this;r&&o.setAlphaMode(this._effectiveMaterial.alphaMode);var l=o.getDepthWrite();this.renderOutline&&(o.setDepthWrite(!1),i.getOutlineRenderer().render(t,n),o.setDepthWrite(l));var u;if(!(u=this._effectiveMaterial.storeEffectOnSubMeshes?t.effect:this._effectiveMaterial.getEffect()))return this;var h=this.overrideMaterialSideOrientation;null==h&&(h=this._effectiveMaterial.sideOrientation,this._getWorldMatrixDeterminant()<0&&(h=h===e.Material.ClockWiseSideOrientation?e.Material.CounterClockWiseSideOrientation:e.Material.ClockWiseSideOrientation));var c=this._effectiveMaterial._preBind(u,h);this._effectiveMaterial.forceDepthWrite&&o.setDepthWrite(!0);var f=i.forcePointsCloud?e.Material.PointFillMode:i.forceWireframe?e.Material.WireFrameFillMode:this._effectiveMaterial.fillMode;s||this._bind(t,u,f);var d=this.getWorldMatrix();if(this._effectiveMaterial.storeEffectOnSubMeshes?this._effectiveMaterial.bindForSubMesh(d,this,t):this._effectiveMaterial.bind(d,this),!this._effectiveMaterial.backFaceCulling&&this._effectiveMaterial.separateCullingPass&&(o.setState(!0,this._effectiveMaterial.zOffset,!1,!c),this._processRendering(t,u,f,n,s,this._onBeforeDraw,this._effectiveMaterial),o.setState(!0,this._effectiveMaterial.zOffset,!1,c)),this._processRendering(t,u,f,n,s,this._onBeforeDraw,this._effectiveMaterial),this._effectiveMaterial.unbind(),this.renderOutline&&l&&(o.setDepthWrite(!0),o.setColorWrite(!1),i.getOutlineRenderer().render(t,n),o.setColorWrite(!0)),this.renderOverlay){var p=o.getAlphaMode();o.setAlphaMode(e.Engine.ALPHA_COMBINE),i.getOutlineRenderer().render(t,n,!0),o.setAlphaMode(p)}return this.onAfterRenderObservable.notifyObservers(this),this},i.prototype._onBeforeDraw=function(e,t,r){e&&r&&r.bindOnlyWorldMatrix(t)},i.prototype.getEmittedParticleSystems=function(){for(var e=new Array,t=0;t<this.getScene().particleSystems.length;t++){var r=this.getScene().particleSystems[t];r.emitter===this&&e.push(r)}return e},i.prototype.getHierarchyEmittedParticleSystems=function(){var e=new Array,t=this.getDescendants();t.push(this);for(var r=0;r<this.getScene().particleSystems.length;r++){var i=this.getScene().particleSystems[r],n=i.emitter;n.position&&-1!==t.indexOf(n)&&e.push(i)}return e},i.prototype.cleanMatrixWeights=function(){var t=0;if(this.skeleton){t=this.skeleton.bones.length;for(var r=this.getVerticesData(e.VertexBuffer.MatricesIndicesKind),i=this.getVerticesData(e.VertexBuffer.MatricesIndicesExtraKind),n=this.getVerticesData(e.VertexBuffer.MatricesWeightsKind),o=this.getVerticesData(e.VertexBuffer.MatricesWeightsExtraKind),s=this.numBoneInfluencers,a=n.length,l=0;l<a;l+=4){for(var u=0,h=-1,c=0;c<4;c++){var f=n[l+c];u+=f,f<.001&&h<0&&(h=c)}if(o)for(var c=0;c<4;c++){var f=o[l+c];u+=f,f<.001&&h<0&&(h=c+4)}if((h<0||h>s-1)&&(h=s-1),u>.001){for(var d=1/u,c=0;c<4;c++)n[l+c]*=d;if(o)for(var c=0;c<4;c++)o[l+c]*=d}else h>=4?(o[l+h-4]=1-u,i[l+h-4]=t):(n[l+h]=1-u,r[l+h]=t)}this.setVerticesData(e.VertexBuffer.MatricesIndicesKind,r),i&&this.setVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,i),this.setVerticesData(e.VertexBuffer.MatricesWeightsKind,n),o&&this.setVerticesData(e.VertexBuffer.MatricesWeightsExtraKind,o)}},i.prototype._checkDelayState=function(){var t=this.getScene();return this._geometry?this._geometry.load(t):this.delayLoadState===e.Engine.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=e.Engine.DELAYLOADSTATE_LOADING,this._queueLoad(t)),this},i.prototype._queueLoad=function(t){var r=this;t._addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return e.Tools.LoadFile(this.delayLoadingFile,(function(i){i instanceof ArrayBuffer?r._delayLoadingFunction(i,r):r._delayLoadingFunction(JSON.parse(i),r),r.instances.forEach((function(e){e._syncSubMeshes()})),r.delayLoadState=e.Engine.DELAYLOADSTATE_LOADED,t._removePendingData(r)}),(function(){}),t.database,i),this},i.prototype.isInFrustum=function(t){return this.delayLoadState!==e.Engine.DELAYLOADSTATE_LOADING&&(!!r.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0))},i.prototype.setMaterialByID=function(e){var t,r=this.getScene().materials;for(t=r.length-1;t>-1;t--)if(r[t].id===e)return this.material=r[t],this;var i=this.getScene().multiMaterials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;return this},i.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},i.prototype.bakeTransformIntoVertices=function(t){if(!this.isVerticesDataPresent(e.VertexBuffer.PositionKind))return this;var r=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(e.VertexBuffer.PositionKind),o=new Array;for(i=0;i<n.length;i+=3)e.Vector3.TransformCoordinates(e.Vector3.FromArray(n,i),t).toArray(o,i);if(this.setVerticesData(e.VertexBuffer.PositionKind,o,this.getVertexBuffer(e.VertexBuffer.PositionKind).isUpdatable()),!this.isVerticesDataPresent(e.VertexBuffer.NormalKind))return this;for(n=this.getVerticesData(e.VertexBuffer.NormalKind),o=[],i=0;i<n.length;i+=3)e.Vector3.TransformNormal(e.Vector3.FromArray(n,i),t).normalize().toArray(o,i);return this.setVerticesData(e.VertexBuffer.NormalKind,o,this.getVertexBuffer(e.VertexBuffer.NormalKind).isUpdatable()),t.m[0]*t.m[5]*t.m[10]<0&&this.flipFaces(),this.releaseSubMeshes(),this.subMeshes=r,this},i.prototype.bakeCurrentTransformIntoVertices=function(){return this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)),this.scaling.copyFromFloats(1,1,1),this.position.copyFromFloats(0,0,0),this.rotation.copyFromFloats(0,0,0),this.rotationQuaternion&&(this.rotationQuaternion=e.Quaternion.Identity()),this._worldMatrix=e.Matrix.Identity(),this},Object.defineProperty(i.prototype,"_positions",{get:function(){return this._geometry?this._geometry._positions:null},enumerable:!0,configurable:!0}),i.prototype._resetPointsArrayCache=function(){return this._geometry&&this._geometry._resetPointsArrayCache(),this},i.prototype._generatePointsArray=function(){return!!this._geometry&&this._geometry._generatePointsArray()},i.prototype.clone=function(e,t,r,n){return void 0===n&&(n=!0),new i(e,this.getScene(),t,this,r,n)},i.prototype.dispose=function(e,t){var i=this;void 0===t&&(t=!1),this.morphTargetManager=null,this._geometry&&this._geometry.releaseForMesh(this,!0);var n=this.getScene().meshes;for(n.forEach((function(e){var t=e;t._source&&t._source===i&&(t._source=null)})),this._source=null,this._instancesBuffer&&(this._instancesBuffer.dispose(),this._instancesBuffer=null);this.instances.length;)this.instances[0].dispose();for(var o=this.getScene().effectLayers,s=0;s<o.length;s++){var a=o[s];a&&a._disposeMesh(this)}r.prototype.dispose.call(this,e,t)},i.prototype.applyDisplacementMap=function(t,r,i,n,o,s){var a=this,l=this.getScene(),u=function(e){var t=document.createElement("canvas"),l=t.getContext("2d"),u=e.width,h=e.height;t.width=u,t.height=h,l.drawImage(e,0,0);var c=l.getImageData(0,0,u,h).data;a.applyDisplacementMapFromBuffer(c,u,h,r,i,o,s),n&&n(a)};return e.Tools.LoadImage(t,u,(function(){}),l.database),this},i.prototype.applyDisplacementMapFromBuffer=function(t,r,i,n,o,s,a){if(!this.isVerticesDataPresent(e.VertexBuffer.PositionKind)||!this.isVerticesDataPresent(e.VertexBuffer.NormalKind)||!this.isVerticesDataPresent(e.VertexBuffer.UVKind))return e.Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;var l=this.getVerticesData(e.VertexBuffer.PositionKind),u=this.getVerticesData(e.VertexBuffer.NormalKind),h=this.getVerticesData(e.VertexBuffer.UVKind),c=e.Vector3.Zero(),f=e.Vector3.Zero(),d=e.Vector2.Zero();s=s||e.Vector2.Zero(),a=a||new e.Vector2(1,1);for(var p=0;p<l.length;p+=3){e.Vector3.FromArrayToRef(l,p,c),e.Vector3.FromArrayToRef(u,p,f),e.Vector2.FromArrayToRef(h,p/3*2,d);var A=Math.abs(d.x*a.x+s.x)*r%r|0,m=Math.abs(d.y*a.y+s.y)*i%i|0,g=4*(A+m*r),_=t[g]/255,v=t[g+1]/255,y=t[g+2]/255,b=.3*_+.59*v+.11*y;f.normalize(),f.scaleInPlace(n+(o-n)*b),c=c.add(f),c.toArray(l,p)}return e.VertexData.ComputeNormals(l,this.getIndices(),u),this.updateVerticesData(e.VertexBuffer.PositionKind,l),this.updateVerticesData(e.VertexBuffer.NormalKind,u),this},i.prototype.convertToFlatShadedMesh=function(){var t,r,i=this.getVerticesDataKinds(),n={},o={},s={},a=!1;for(t=0;t<i.length;t++){r=i[t];var l=this.getVertexBuffer(r);r!==e.VertexBuffer.NormalKind?(n[r]=l,o[r]=n[r].getData(),s[r]=[]):(a=l.isUpdatable(),i.splice(t,1),t--)}var u,h=this.subMeshes.slice(0),c=this.getIndices(),f=this.getTotalIndices();for(u=0;u<f;u++){var d=c[u];for(t=0;t<i.length;t++){r=i[t];for(var p=n[r].getStrideSize(),A=0;A<p;A++)s[r].push(o[r][d*p+A])}}var m=[],g=s[e.VertexBuffer.PositionKind];for(u=0;u<f;u+=3){c[u]=u,c[u+1]=u+1,c[u+2]=u+2;for(var _=e.Vector3.FromArray(g,3*u),v=e.Vector3.FromArray(g,3*(u+1)),y=e.Vector3.FromArray(g,3*(u+2)),b=_.subtract(v),E=y.subtract(v),T=e.Vector3.Normalize(e.Vector3.Cross(b,E)),x=0;x<3;x++)m.push(T.x),m.push(T.y),m.push(T.z)}for(this.setIndices(c),this.setVerticesData(e.VertexBuffer.NormalKind,m,a),t=0;t<i.length;t++)r=i[t],this.setVerticesData(r,s[r],n[r].isUpdatable());this.releaseSubMeshes();for(var M=0;M<h.length;M++){var C=h[M];e.SubMesh.AddToMesh(C.materialIndex,C.indexStart,C.indexCount,C.indexStart,C.indexCount,this)}return this.synchronizeInstances(),this},i.prototype.convertToUnIndexedMesh=function(){var t,r,i=this.getVerticesDataKinds(),n={},o={},s={};for(t=0;t<i.length;t++){r=i[t];var a=this.getVertexBuffer(r);n[r]=a,o[r]=n[r].getData(),s[r]=[]}var l,u=this.subMeshes.slice(0),h=this.getIndices(),c=this.getTotalIndices();for(l=0;l<c;l++){var f=h[l];for(t=0;t<i.length;t++){r=i[t];for(var d=n[r].getStrideSize(),p=0;p<d;p++)s[r].push(o[r][f*d+p])}}for(l=0;l<c;l+=3)h[l]=l,h[l+1]=l+1,h[l+2]=l+2;for(this.setIndices(h),t=0;t<i.length;t++)r=i[t],this.setVerticesData(r,s[r],n[r].isUpdatable());this.releaseSubMeshes();for(var A=0;A<u.length;A++){var m=u[A];e.SubMesh.AddToMesh(m.materialIndex,m.indexStart,m.indexCount,m.indexStart,m.indexCount,this)}return this._unIndexed=!0,this.synchronizeInstances(),this},i.prototype.flipFaces=function(t){void 0===t&&(t=!1);var r,i=e.VertexData.ExtractFromMesh(this);if(t&&this.isVerticesDataPresent(e.VertexBuffer.NormalKind)&&i.normals)for(r=0;r<i.normals.length;r++)i.normals[r]*=-1;if(i.indices){var n;for(r=0;r<i.indices.length;r+=3)n=i.indices[r+1],i.indices[r+1]=i.indices[r+2],i.indices[r+2]=n}return i.applyToMesh(this),this},i.prototype.createInstance=function(t){return new e.InstancedMesh(t,this)},i.prototype.synchronizeInstances=function(){for(var e=0;e<this.instances.length;e++){this.instances[e]._syncSubMeshes()}return this},i.prototype.simplify=function(t,r,i,n){return void 0===r&&(r=!0),void 0===i&&(i=e.SimplificationType.QUADRATIC),this.getScene().simplificationQueue.addTask({settings:t,parallelProcessing:r,mesh:this,simplificationType:i,successCallback:n}),this},i.prototype.optimizeIndices=function(t){var r=this,i=this.getIndices(),n=this.getVerticesData(e.VertexBuffer.PositionKind);if(!n||!i)return this;for(var o=new Array,s=0;s<n.length;s+=3)o.push(e.Vector3.FromArray(n,s));var a=new Array;return e.AsyncLoop.SyncAsyncForLoop(o.length,40,(function(e){for(var t=o.length-1-e,r=o[t],i=0;i<t;++i){var n=o[i];if(r.equals(n)){a[t]=i;break}}}),(function(){for(var e=0;e<i.length;++e)i[e]=a[i[e]]||i[e];var n=r.subMeshes.slice(0);r.setIndices(i),r.subMeshes=n,t&&t(r)})),this},i.prototype.serialize=function(t){t.name=this.name,t.id=this.id,t.type=this.getClassName(),e.Tags&&e.Tags.HasTags(this)&&(t.tags=e.Tags.GetTags(this)),t.position=this.position.asArray(),this.rotationQuaternion?t.rotationQuaternion=this.rotationQuaternion.asArray():this.rotation&&(t.rotation=this.rotation.asArray()),t.scaling=this.scaling.asArray(),t.localMatrix=this.getPivotMatrix().asArray(),t.isEnabled=this.isEnabled(!1),t.isVisible=this.isVisible,t.infiniteDistance=this.infiniteDistance,t.pickable=this.isPickable,t.receiveShadows=this.receiveShadows,t.billboardMode=this.billboardMode,t.visibility=this.visibility,t.checkCollisions=this.checkCollisions,t.isBlocker=this.isBlocker,this.parent&&(t.parentId=this.parent.id),t.isUnIndexed=this.isUnIndexed;var r=this._geometry;if(r){var i=r.id;t.geometryId=i,t.subMeshes=[];for(var n=0;n<this.subMeshes.length;n++){var o=this.subMeshes[n];t.subMeshes.push({materialIndex:o.materialIndex,verticesStart:o.verticesStart,verticesCount:o.verticesCount,indexStart:o.indexStart,indexCount:o.indexCount})}}this.material?t.materialId=this.material.id:this.material=null,this.morphTargetManager&&(t.morphTargetManagerId=this.morphTargetManager.uniqueId),this.skeleton&&(t.skeletonId=this.skeleton.id);var s=this.getPhysicsImpostor();s&&(t.physicsMass=s.getParam("mass"),t.physicsFriction=s.getParam("friction"),t.physicsRestitution=s.getParam("mass"),t.physicsImpostor=s.type),this.metadata&&(t.metadata=this.metadata),t.instances=[];for(var a=0;a<this.instances.length;a++){var l=this.instances[a],u={name:l.name,
- id:l.id,position:l.position.asArray(),scaling:l.scaling.asArray()};l.rotationQuaternion?u.rotationQuaternion=l.rotationQuaternion.asArray():l.rotation&&(u.rotation=l.rotation.asArray()),t.instances.push(u),e.Animation.AppendSerializedAnimations(l,u),u.ranges=l.serializeAnimationRanges()}e.Animation.AppendSerializedAnimations(this,t),t.ranges=this.serializeAnimationRanges(),t.layerMask=this.layerMask,t.alphaIndex=this.alphaIndex,t.hasVertexAlpha=this.hasVertexAlpha,t.overlayAlpha=this.overlayAlpha,t.overlayColor=this.overlayColor.asArray(),t.renderOverlay=this.renderOverlay,t.applyFog=this.applyFog,this.actionManager&&(t.actions=this.actionManager.serialize(this.name))},i.prototype._syncGeometryWithMorphTargetManager=function(){if(this.geometry){this._markSubMeshesAsAttributesDirty();var t=this._morphTargetManager;if(t&&t.vertexCount){if(t.vertexCount!==this.getTotalVertices())return e.Tools.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."),void(this.morphTargetManager=null);for(var r=0;r<t.numInfluencers;r++){var i=t.getActiveTarget(r),n=i.getPositions();if(!n)return void e.Tools.Error("Invalid morph target. Target must have positions.");this.geometry.setVerticesData(e.VertexBuffer.PositionKind+r,n,!1,3);var o=i.getNormals();o&&this.geometry.setVerticesData(e.VertexBuffer.NormalKind+r,o,!1,3);var s=i.getTangents();s&&this.geometry.setVerticesData(e.VertexBuffer.TangentKind+r,s,!1,3)}}else for(var r=0;this.geometry.isVerticesDataPresent(e.VertexBuffer.PositionKind+r);)this.geometry.removeVerticesData(e.VertexBuffer.PositionKind+r),this.geometry.isVerticesDataPresent(e.VertexBuffer.NormalKind+r)&&this.geometry.removeVerticesData(e.VertexBuffer.NormalKind+r),this.geometry.isVerticesDataPresent(e.VertexBuffer.TangentKind+r)&&this.geometry.removeVerticesData(e.VertexBuffer.TangentKind+r),r++}},i.Parse=function(t,r,n){var o;if(o=t.type&&"GroundMesh"===t.type?e.GroundMesh.Parse(t,r):new i(t.name,r),o.id=t.id,e.Tags&&e.Tags.AddTagsTo(o,t.tags),o.position=e.Vector3.FromArray(t.position),void 0!==t.metadata&&(o.metadata=t.metadata),t.rotationQuaternion?o.rotationQuaternion=e.Quaternion.FromArray(t.rotationQuaternion):t.rotation&&(o.rotation=e.Vector3.FromArray(t.rotation)),o.scaling=e.Vector3.FromArray(t.scaling),t.localMatrix?o.setPreTransformMatrix(e.Matrix.FromArray(t.localMatrix)):t.pivotMatrix&&o.setPivotMatrix(e.Matrix.FromArray(t.pivotMatrix)),o.setEnabled(t.isEnabled),o.isVisible=t.isVisible,o.infiniteDistance=t.infiniteDistance,o.showBoundingBox=t.showBoundingBox,o.showSubMeshesBoundingBox=t.showSubMeshesBoundingBox,void 0!==t.applyFog&&(o.applyFog=t.applyFog),void 0!==t.pickable&&(o.isPickable=t.pickable),void 0!==t.alphaIndex&&(o.alphaIndex=t.alphaIndex),o.receiveShadows=t.receiveShadows,o.billboardMode=t.billboardMode,void 0!==t.visibility&&(o.visibility=t.visibility),o.checkCollisions=t.checkCollisions,void 0!==t.isBlocker&&(o.isBlocker=t.isBlocker),o._shouldGenerateFlatShading=t.useFlatShading,t.freezeWorldMatrix&&(o._waitingFreezeWorldMatrix=t.freezeWorldMatrix),t.parentId&&(o._waitingParentId=t.parentId),void 0!==t.actions&&(o._waitingActions=t.actions),void 0!==t.overlayAlpha&&(o.overlayAlpha=t.overlayAlpha),void 0!==t.overlayColor&&(o.overlayColor=e.Color3.FromArray(t.overlayColor)),void 0!==t.renderOverlay&&(o.renderOverlay=t.renderOverlay),o.isUnIndexed=!!t.isUnIndexed,o.hasVertexAlpha=t.hasVertexAlpha,t.delayLoadingFile?(o.delayLoadState=e.Engine.DELAYLOADSTATE_NOTLOADED,o.delayLoadingFile=n+t.delayLoadingFile,o._boundingInfo=new e.BoundingInfo(e.Vector3.FromArray(t.boundingBoxMinimum),e.Vector3.FromArray(t.boundingBoxMaximum)),t._binaryInfo&&(o._binaryInfo=t._binaryInfo),o._delayInfo=[],t.hasUVs&&o._delayInfo.push(e.VertexBuffer.UVKind),t.hasUVs2&&o._delayInfo.push(e.VertexBuffer.UV2Kind),t.hasUVs3&&o._delayInfo.push(e.VertexBuffer.UV3Kind),t.hasUVs4&&o._delayInfo.push(e.VertexBuffer.UV4Kind),t.hasUVs5&&o._delayInfo.push(e.VertexBuffer.UV5Kind),t.hasUVs6&&o._delayInfo.push(e.VertexBuffer.UV6Kind),t.hasColors&&o._delayInfo.push(e.VertexBuffer.ColorKind),t.hasMatricesIndices&&o._delayInfo.push(e.VertexBuffer.MatricesIndicesKind),t.hasMatricesWeights&&o._delayInfo.push(e.VertexBuffer.MatricesWeightsKind),o._delayLoadingFunction=e.Geometry._ImportGeometry,e.SceneLoader.ForceFullSceneLoadingForIncremental&&o._checkDelayState()):e.Geometry._ImportGeometry(t,o),t.materialId?o.setMaterialByID(t.materialId):o.material=null,t.morphTargetManagerId>-1&&(o.morphTargetManager=r.getMorphTargetManagerById(t.morphTargetManagerId)),t.skeletonId>-1&&(o.skeleton=r.getLastSkeletonByID(t.skeletonId),t.numBoneInfluencers&&(o.numBoneInfluencers=t.numBoneInfluencers)),t.animations){for(var s=0;s<t.animations.length;s++){var a=t.animations[s];o.animations.push(e.Animation.Parse(a))}e.Node.ParseAnimationRanges(o,t,r)}if(t.autoAnimate&&r.beginAnimation(o,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1),t.layerMask&&!isNaN(t.layerMask)?o.layerMask=Math.abs(parseInt(t.layerMask)):o.layerMask=268435455,t.physicsImpostor&&(o.physicsImpostor=new e.PhysicsImpostor(o,t.physicsImpostor,{mass:t.physicsMass,friction:t.physicsFriction,restitution:t.physicsRestitution},r)),t.instances)for(var l=0;l<t.instances.length;l++){var u=t.instances[l],h=o.createInstance(u.name);if(u.id&&(h.id=u.id),e.Tags&&e.Tags.AddTagsTo(h,u.tags),h.position=e.Vector3.FromArray(u.position),u.parentId&&(h._waitingParentId=u.parentId),u.rotationQuaternion?h.rotationQuaternion=e.Quaternion.FromArray(u.rotationQuaternion):u.rotation&&(h.rotation=e.Vector3.FromArray(u.rotation)),h.scaling=e.Vector3.FromArray(u.scaling),h.checkCollisions=o.checkCollisions,t.animations){for(s=0;s<t.animations.length;s++)a=t.animations[s],h.animations.push(e.Animation.Parse(a));e.Node.ParseAnimationRanges(h,t,r),t.autoAnimate&&r.beginAnimation(h,t.autoAnimateFrom,t.autoAnimateTo,t.autoAnimateLoop,t.autoAnimateSpeed||1)}}return o},i.CreateRibbon=function(t,r,i,n,o,s,a,l,u){return void 0===i&&(i=!1),void 0===a&&(a=!1),e.MeshBuilder.CreateRibbon(t,{pathArray:r,closeArray:i,closePath:n,offset:o,updatable:a,sideOrientation:l,instance:u},s)},i.CreateDisc=function(t,r,i,n,o,s){void 0===n&&(n=null);var a={radius:r,tessellation:i,sideOrientation:s,updatable:o};return e.MeshBuilder.CreateDisc(t,a,n)},i.CreateBox=function(t,r,i,n,o){void 0===i&&(i=null);var s={size:r,sideOrientation:o,updatable:n};return e.MeshBuilder.CreateBox(t,s,i)},i.CreateSphere=function(t,r,i,n,o,s){var a={segments:r,diameterX:i,diameterY:i,diameterZ:i,sideOrientation:s,updatable:o};return e.MeshBuilder.CreateSphere(t,a,n)},i.CreateCylinder=function(t,r,n,o,s,a,l,u,h){void 0!==l&&l instanceof e.Scene||(void 0!==l&&(h=u||i.DEFAULTSIDE,u=l),l=a,a=1);var c={height:r,diameterTop:n,diameterBottom:o,tessellation:s,subdivisions:a,sideOrientation:h,updatable:u};return e.MeshBuilder.CreateCylinder(t,c,l)},i.CreateTorus=function(t,r,i,n,o,s,a){var l={diameter:r,thickness:i,tessellation:n,sideOrientation:a,updatable:s};return e.MeshBuilder.CreateTorus(t,l,o)},i.CreateTorusKnot=function(t,r,i,n,o,s,a,l,u,h){var c={radius:r,tube:i,radialSegments:n,tubularSegments:o,p:s,q:a,sideOrientation:h,updatable:u};return e.MeshBuilder.CreateTorusKnot(t,c,l)},i.CreateLines=function(t,r,i,n,o){void 0===i&&(i=null),void 0===n&&(n=!1),void 0===o&&(o=null);var s={points:r,updatable:n,instance:o};return e.MeshBuilder.CreateLines(t,s,i)},i.CreateDashedLines=function(t,r,i,n,o,s,a,l){void 0===s&&(s=null);var u={points:r,dashSize:i,gapSize:n,dashNb:o,updatable:a,instance:l};return e.MeshBuilder.CreateDashedLines(t,u,s)},i.CreatePolygon=function(t,r,i,n,o,s){var a={shape:r,holes:n,updatable:o,sideOrientation:s};return e.MeshBuilder.CreatePolygon(t,a,i)},i.ExtrudePolygon=function(t,r,i,n,o,s,a){var l={shape:r,holes:o,depth:i,updatable:s,sideOrientation:a};return e.MeshBuilder.ExtrudePolygon(t,l,n)},i.ExtrudeShape=function(t,r,n,o,s,a,l,u,h,c){void 0===l&&(l=null);var f={shape:r,path:n,scale:o,rotation:s,cap:0===a?0:a||i.NO_CAP,sideOrientation:h,instance:c,updatable:u};return e.MeshBuilder.ExtrudeShape(t,f,l)},i.ExtrudeShapeCustom=function(t,r,n,o,s,a,l,u,h,c,f,d){var p={shape:r,path:n,scaleFunction:o,rotationFunction:s,ribbonCloseArray:a,ribbonClosePath:l,cap:0===u?0:u||i.NO_CAP,sideOrientation:f,instance:d,updatable:c};return e.MeshBuilder.ExtrudeShapeCustom(t,p,h)},i.CreateLathe=function(t,r,i,n,o,s,a){var l={shape:r,radius:i,tessellation:n,sideOrientation:a,updatable:s};return e.MeshBuilder.CreateLathe(t,l,o)},i.CreatePlane=function(t,r,i,n,o){var s={size:r,width:r,height:r,sideOrientation:o,updatable:n};return e.MeshBuilder.CreatePlane(t,s,i)},i.CreateGround=function(t,r,i,n,o,s){var a={width:r,height:i,subdivisions:n,updatable:s};return e.MeshBuilder.CreateGround(t,a,o)},i.CreateTiledGround=function(t,r,i,n,o,s,a,l,u){var h={xmin:r,zmin:i,xmax:n,zmax:o,subdivisions:s,precision:a,updatable:u};return e.MeshBuilder.CreateTiledGround(t,h,l)},i.CreateGroundFromHeightMap=function(t,r,i,n,o,s,a,l,u,h){var c={width:i,height:n,subdivisions:o,minHeight:s,maxHeight:a,updatable:u,onReady:h};return e.MeshBuilder.CreateGroundFromHeightMap(t,r,c,l)},i.CreateTube=function(t,r,i,n,o,s,a,l,u,h){var c={path:r,radius:i,tessellation:n,radiusFunction:o,arc:1,cap:s,updatable:l,sideOrientation:u,instance:h};return e.MeshBuilder.CreateTube(t,c,a)},i.CreatePolyhedron=function(t,r,i){return e.MeshBuilder.CreatePolyhedron(t,r,i)},i.CreateIcoSphere=function(t,r,i){return e.MeshBuilder.CreateIcoSphere(t,r,i)},i.CreateDecal=function(t,r,i,n,o,s){var a={position:i,normal:n,size:o,angle:s};return e.MeshBuilder.CreateDecal(t,r,a)},i.prototype.setPositionsForCPUSkinning=function(){if(!this._sourcePositions){var t=this.getVerticesData(e.VertexBuffer.PositionKind);if(!t)return this._sourcePositions;this._sourcePositions=new Float32Array(t),this.isVertexBufferUpdatable(e.VertexBuffer.PositionKind)||this.setVerticesData(e.VertexBuffer.PositionKind,t,!0)}return this._sourcePositions},i.prototype.setNormalsForCPUSkinning=function(){if(!this._sourceNormals){var t=this.getVerticesData(e.VertexBuffer.NormalKind);if(!t)return this._sourceNormals;this._sourceNormals=new Float32Array(t),this.isVertexBufferUpdatable(e.VertexBuffer.NormalKind)||this.setVerticesData(e.VertexBuffer.NormalKind,t,!0)}return this._sourceNormals},i.prototype.applySkeleton=function(t){if(!this.geometry)return this;if(this.geometry._softwareSkinningRenderId==this.getScene().getRenderId())return this;if(this.geometry._softwareSkinningRenderId=this.getScene().getRenderId(),!this.isVerticesDataPresent(e.VertexBuffer.PositionKind))return this;if(!this.isVerticesDataPresent(e.VertexBuffer.NormalKind))return this;if(!this.isVerticesDataPresent(e.VertexBuffer.MatricesIndicesKind))return this;if(!this.isVerticesDataPresent(e.VertexBuffer.MatricesWeightsKind))return this;if(!this._sourcePositions){var r=this.subMeshes.slice();this.setPositionsForCPUSkinning(),this.subMeshes=r}this._sourceNormals||this.setNormalsForCPUSkinning();var i=this.getVerticesData(e.VertexBuffer.PositionKind);if(!i)return this;i instanceof Float32Array||(i=new Float32Array(i));var n=this.getVerticesData(e.VertexBuffer.NormalKind);if(!n)return this;n instanceof Float32Array||(n=new Float32Array(n));var o=this.getVerticesData(e.VertexBuffer.MatricesIndicesKind),s=this.getVerticesData(e.VertexBuffer.MatricesWeightsKind);if(!s||!o)return this;for(var a,l=this.numBoneInfluencers>4,u=l?this.getVerticesData(e.VertexBuffer.MatricesIndicesExtraKind):null,h=l?this.getVerticesData(e.VertexBuffer.MatricesWeightsExtraKind):null,c=t.getTransformMatrices(this),f=e.Vector3.Zero(),d=new e.Matrix,p=new e.Matrix,A=0,m=0;m<i.length;m+=3,A+=4){var g;for(a=0;a<4&&(g=s[A+a])>0;a++)e.Matrix.FromFloat32ArrayToRefScaled(c,Math.floor(16*o[A+a]),g,p),d.addToSelf(p);if(l)for(a=0;a<4&&(g=h[A+a])>0;a++)e.Matrix.FromFloat32ArrayToRefScaled(c,Math.floor(16*u[A+a]),g,p),d.addToSelf(p);e.Vector3.TransformCoordinatesFromFloatsToRef(this._sourcePositions[m],this._sourcePositions[m+1],this._sourcePositions[m+2],d,f),f.toArray(i,m),e.Vector3.TransformNormalFromFloatsToRef(this._sourceNormals[m],this._sourceNormals[m+1],this._sourceNormals[m+2],d,f),f.toArray(n,m),d.reset()}return this.updateVerticesData(e.VertexBuffer.PositionKind,i),this.updateVerticesData(e.VertexBuffer.NormalKind,n),this},i.MinMax=function(t){var r=null,i=null;return t.forEach((function(e,t,n){var o=e.getBoundingInfo(),s=o.boundingBox;r&&i?(r.minimizeInPlace(s.minimumWorld),i.maximizeInPlace(s.maximumWorld)):(r=s.minimumWorld,i=s.maximumWorld)})),r&&i?{min:r,max:i}:{min:e.Vector3.Zero(),max:e.Vector3.Zero()}},i.Center=function(t){var r=t instanceof Array?i.MinMax(t):t;return e.Vector3.Center(r.min,r.max)},i.MergeMeshes=function(t,r,n,o,s){void 0===r&&(r=!0);var a;if(!n){var l=0;for(a=0;a<t.length;a++)if(t[a]&&(l+=t[a].getTotalVertices())>65536)return e.Tools.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}var u,h=null,c=new Array,f=null;for(a=0;a<t.length;a++)t[a]&&(t[a].computeWorldMatrix(!0),u=e.VertexData.ExtractFromMesh(t[a],!0,!0),u.transform(t[a].getWorldMatrix()),h?h.merge(u):(h=u,f=t[a]),s&&c.push(t[a].getTotalIndices()));if(f=f,o||(o=new i(f.name+"_merged",f.getScene())),h.applyToMesh(o),o.material=f.material,o.checkCollisions=f.checkCollisions,r)for(a=0;a<t.length;a++)t[a]&&t[a].dispose();if(s){o.releaseSubMeshes(),a=0;for(var d=0;a<c.length;)e.SubMesh.CreateFromIndices(0,d,c[a],o),d+=c[a],a++}return o},i._FRONTSIDE=0,i._BACKSIDE=1,i._DOUBLESIDE=2,i._DEFAULTSIDE=0,i._NO_CAP=0,i._CAP_START=1,i._CAP_END=2,i._CAP_ALL=3,i})(e.AbstractMesh);e.Mesh=r})(n||(n={}));var n;!(function(e){var t=(function(){function e(){}return Object.defineProperty(e.prototype,"effect",{get:function(){return this._materialEffect},enumerable:!0,configurable:!0}),e.prototype.setEffect=function(e,t){if(void 0===t&&(t=null),this._materialEffect===e)return void(e||(this._materialDefines=null));this._materialDefines=t,this._materialEffect=e},e})();e.BaseSubMesh=t;var r=(function(t){function r(e,r,i,n,o,s,a,l){void 0===l&&(l=!0);var u=t.call(this)||this;return u.materialIndex=e,u.verticesStart=r,u.verticesCount=i,u.indexStart=n,u.indexCount=o,u._renderId=0,u._mesh=s,u._renderingMesh=a||s,s.subMeshes.push(u),u._trianglePlanes=[],u._id=s.subMeshes.length-1,l&&(u.refreshBoundingInfo(),s.computeWorldMatrix(!0)),u}return s(r,t),r.AddToMesh=function(e,t,i,n,o,s,a,l){return void 0===l&&(l=!0),new r(e,t,i,n,o,s,a,l)},Object.defineProperty(r.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount==this._mesh.getTotalVertices()},enumerable:!0,configurable:!0}),r.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},r.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},r.prototype.getMesh=function(){return this._mesh},r.prototype.getRenderingMesh=function(){return this._renderingMesh},r.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null===e||void 0===e)return this._mesh.getScene().defaultMaterial;if(e.getSubMaterial){var t=e,r=t.getSubMaterial(this.materialIndex);return this._currentMaterial!==r&&(this._currentMaterial=r,this._materialDefines=null),r}return e},r.prototype.refreshBoundingInfo=function(){if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;var t=this._renderingMesh.getVerticesData(e.VertexBuffer.PositionKind);if(!t)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var r,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var n=this._renderingMesh.getBoundingInfo();r={minimum:n.minimum.clone(),maximum:n.maximum.clone()}}else r=e.Tools.ExtractMinAndMaxIndexed(t,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo=new e.BoundingInfo(r.minimum,r.maximum),this},r.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},r.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t.update(e),this},r.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e)},r.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},r.prototype.render=function(e){return this._renderingMesh.render(this,e),this},r.prototype.getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var r=[],i=this.indexStart;i<this.indexStart+this.indexCount;i+=3)r.push(e[i],e[i+1],e[i+1],e[i+2],e[i+2],e[i]);this._linesIndexBuffer=t.createIndexBuffer(r),this.linesIndexCount=r.length}return this._linesIndexBuffer},r.prototype.canIntersects=function(e){var t=this.getBoundingInfo();return!!t&&e.intersectsBox(t.boundingBox)},r.prototype.intersects=function(t,r,i,n){var o=null,s=this.getMaterial();if(!s)return null;switch(s.fillMode){case e.Material.PointListDrawMode:case e.Material.LineListDrawMode:case e.Material.LineLoopDrawMode:case e.Material.LineStripDrawMode:case e.Material.TriangleFanDrawMode:case e.Material.TriangleStripDrawMode:return null}if(e.LinesMesh&&this._mesh instanceof e.LinesMesh)for(var a=this._mesh,l=this.indexStart;l<this.indexStart+this.indexCount;l+=2){var u=r[i[l]],h=r[i[l+1]],c=t.intersectionSegment(u,h,a.intersectionThreshold);if(!(c<0)&&((n||!o||c<o.distance)&&(o=new e.IntersectionInfo(null,null,c),n)))break}else for(var l=this.indexStart;l<this.indexStart+this.indexCount;l+=3){var u=r[i[l]],h=r[i[l+1]],f=r[i[l+2]],d=t.intersectsTriangle(u,h,f);if(d){if(d.distance<0)continue;if((n||!o||d.distance<o.distance)&&(o=d,o.faceId=l/3,n))break}}return o},r.prototype._rebuild=function(){this._linesIndexBuffer&&(this._linesIndexBuffer=null)},r.prototype.clone=function(t,i){var n=new r(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,t,i,!1);if(!this.IsGlobal){var o=this.getBoundingInfo();if(!o)return n;n._boundingInfo=new e.BoundingInfo(o.minimum,o.maximum)}return n},r.prototype.dispose=function(){this._linesIndexBuffer&&(this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null);var e=this._mesh.subMeshes.indexOf(this);this._mesh.subMeshes.splice(e,1)},r.CreateFromIndices=function(e,t,i,n,o){var s=Number.MAX_VALUE,a=-Number.MAX_VALUE;o=o||n;for(var l=o.getIndices(),u=t;u<t+i;u++){var h=l[u];h<s&&(s=h),h>a&&(a=h)}return new r(e,s,a-s+1,t,i,n,o)},r})(t);e.SubMesh=r})(n||(n={}));var n,a=this&&this.__assign||Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e};!(function(e){var t=(function(){function e(){this._isDirty=!0,this._areLightsDirty=!0,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),e.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areMiscDirty=!1,this._areImageProcessingDirty=!1},e.prototype.markAsUnprocessed=function(){this._isDirty=!0},e.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsLightDirty=function(){this._areLightsDirty=!0,this._isDirty=!0},e.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},e.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},e.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},e.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},e.prototype.rebuild=function(){this._keys&&delete this._keys,this._keys=[];for(var e=0,t=Object.keys(this);e<t.length;e++){var r=t[e];"_"!==r[0]&&this._keys.push(r)}},e.prototype.isEqual=function(e){if(this._keys.length!==e._keys.length)return!1;for(var t=0;t<this._keys.length;t++){var r=this._keys[t];if(this[r]!==e[r])return!1}return!0},e.prototype.cloneTo=function(e){this._keys.length!==e._keys.length&&(e._keys=this._keys.slice(0));for(var t=0;t<this._keys.length;t++){var r=this._keys[t];e[r]=this[r]}},e.prototype.reset=function(){for(var e=0;e<this._keys.length;e++){var t=this._keys[e];switch(typeof this[t]){case"number":this[t]=0;break;case"string":this[t]="";break;default:this[t]=!1}}},e.prototype.toString=function(){for(var e="",t=0;t<this._keys.length;t++){var r=this._keys[t],i=this[r];switch(typeof i){case"number":case"string":e+="#define "+r+" "+i+"\n";break;default:i&&(e+="#define "+r+"\n")}}return e},e})();e.MaterialDefines=t;var r=(function(){function t(r,i,n){this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this.doNotSerialize=!1,this.storeEffectOnSubMeshes=!1,this.onDisposeObservable=new e.Observable,this.onBindObservable=new e.Observable,this.onUnBindObservable=new e.Observable,this._alphaMode=e.Engine.ALPHA_COMBINE,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.forceDepthWrite=!1,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this._wasPreviouslyReady=!1,this._fillMode=t.TriangleFillMode,this.name=r,this.id=r||e.Tools.RandomId(),this._scene=i||e.Engine.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.useRightHandedSystem?this.sideOrientation=t.ClockWiseSideOrientation:this.sideOrientation=t.CounterClockWiseSideOrientation,this._uniformBuffer=new e.UniformBuffer(this._scene.getEngine()),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,n||this._scene.materials.push(this)}return Object.defineProperty(t,"TriangleFillMode",{get:function(){return t._TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WireFrameFillMode",{get:function(){return t._WireFrameFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"PointFillMode",{get:function(){return t._PointFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"PointListDrawMode",{get:function(){return t._PointListDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LineListDrawMode",{get:function(){return t._LineListDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LineLoopDrawMode",{get:function(){return t._LineLoopDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LineStripDrawMode",{get:function(){return t._LineStripDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TriangleStripDrawMode",{get:function(){return t._TriangleStripDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TriangleFanDrawMode",{get:function(){return t._TriangleFanDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ClockWiseSideOrientation",{get:function(){return t._ClockWiseSideOrientation},enumerable:!0,configurable:!0}),Object.defineProperty(t,"CounterClockWiseSideOrientation",{get:function(){return t._CounterClockWiseSideOrientation},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TextureDirtyFlag",{get:function(){return t._TextureDirtyFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LightDirtyFlag",{get:function(){return t._LightDirtyFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t,"FresnelDirtyFlag",{get:function(){return t._FresnelDirtyFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t,"AttributesDirtyFlag",{get:function(){return t._AttributesDirtyFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MiscDirtyFlag",{get:function(){return t._MiscDirtyFlag},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alpha=e,this.markAsDirty(t.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(t.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(t.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(t.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wireframe",{get:function(){switch(this._fillMode){case t.WireFrameFillMode:case t.LineListDrawMode:case t.LineLoopDrawMode:case t.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(e){this.fillMode=e?t.WireFrameFillMode:t.TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case t.PointFillMode:case t.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(e){this.fillMode=e?t.PointFillMode:t.TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fillMode",{get:function(){return this._fillMode},set:function(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(t.MiscDirtyFlag))},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){return"Name: "+this.name},t.prototype.getClassName=function(){return"Material"},Object.defineProperty(t.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!0,configurable:!0}),t.prototype.freeze=function(){this.checkReadyOnlyOnce=!0},t.prototype.unfreeze=function(){this.checkReadyOnlyOnce=!1},t.prototype.isReady=function(e,t){return!0},t.prototype.isReadyForSubMesh=function(e,t,r){return!1},t.prototype.getEffect=function(){return this._effect},t.prototype.getScene=function(){return this._scene},t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1||e.hasVertexAlpha},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.markDirty=function(){this._wasPreviouslyReady=!1},t.prototype._preBind=function(e,r){void 0===r&&(r=null);var i=this._scene.getEngine(),n=null==r?this.sideOrientation:r,o=n===t.ClockWiseSideOrientation;return i.enableEffect(e||this._effect),i.setState(this.backFaceCulling,this.zOffset,!1,o),o},t.prototype.bind=function(e,t){},t.prototype.bindForSubMesh=function(e,t,r){},t.prototype.bindOnlyWorldMatrix=function(e){},t.prototype.bindSceneUniformBuffer=function(e,t){t.bindToEffect(e,"Scene")},t.prototype.bindView=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("view",this.getScene().getViewMatrix())},t.prototype.bindViewProjection=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("viewProjection",this.getScene().getTransformMatrix())},t.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},t.prototype._afterBind=function(e){if(this._scene._cachedMaterial=this,this._scene._cachedVisibility=e?e.visibility:1,e&&this.onBindObservable.notifyObservers(e),this.disableDepthWrite){var t=this._scene.getEngine();this._cachedDepthWriteState=t.getDepthWrite(),t.setDepthWrite(!1)}},t.prototype.unbind=function(){if(this.onUnBindObservable.notifyObservers(this),this.disableDepthWrite){this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState)}},t.prototype.getActiveTextures=function(){return[]},t.prototype.hasTexture=function(e){return!1},t.prototype.clone=function(e){return null},t.prototype.getBindedMeshes=function(){for(var e=new Array,t=0;t<this._scene.meshes.length;t++){var r=this._scene.meshes[t];r.material===this&&e.push(r)}return e},t.prototype.forceCompilation=function(t,r,i){var n=this,o=a({clipPlane:!1},i),s=new e.BaseSubMesh,l=this.getScene(),u=function(){if(n._scene&&n._scene.getEngine()){s._materialDefines&&(s._materialDefines._renderId=-1);var i=l.clipPlane;o.clipPlane&&(l.clipPlane=new e.Plane(0,0,0,1)),n.storeEffectOnSubMeshes?n.isReadyForSubMesh(t,s)?r&&r(n):setTimeout(u,16):n.isReady(t)?r&&r(n):setTimeout(u,16),o.clipPlane&&(l.clipPlane=i)}};u()},t.prototype.forceCompilationAsync=function(e,t){var r=this;return new Promise(function(i){r.forceCompilation(e,(function(){i()}),t)})},t.prototype.markAsDirty=function(e){e&t.TextureDirtyFlag&&this._markAllSubMeshesAsTexturesDirty(),e&t.LightDirtyFlag&&this._markAllSubMeshesAsLightsDirty(),e&t.FresnelDirtyFlag&&this._markAllSubMeshesAsFresnelDirty(),e&t.AttributesDirtyFlag&&this._markAllSubMeshesAsAttributesDirty(),e&t.MiscDirtyFlag&&this._markAllSubMeshesAsMiscDirty(),this.getScene().resetCachedMaterial()},t.prototype._markAllSubMeshesAsDirty=function(e){for(var t=0,r=this.getScene().meshes;t<r.length;t++){var i=r[t];if(i.subMeshes)for(var n=0,o=i.subMeshes;n<o.length;n++){var s=o[n];s.getMaterial()===this&&(s._materialDefines&&e(s._materialDefines))}}},t.prototype._markAllSubMeshesAsImageProcessingDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsImageProcessingDirty()}))},t.prototype._markAllSubMeshesAsTexturesDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsTexturesDirty()}))},t.prototype._markAllSubMeshesAsFresnelDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsFresnelDirty()}))},t.prototype._markAllSubMeshesAsFresnelAndMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){e.markAsFresnelDirty(),e.markAsMiscDirty()}))},t.prototype._markAllSubMeshesAsLightsDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsLightDirty()}))},t.prototype._markAllSubMeshesAsAttributesDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsAttributesDirty()}))},t.prototype._markAllSubMeshesAsMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsMiscDirty()}))},t.prototype._markAllSubMeshesAsTexturesAndMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){e.markAsTexturesDirty(),e.markAsMiscDirty()}))},t.prototype.dispose=function(e,t){this.getScene().stopAnimation(this),this.getScene().freeProcessedMaterials();var r=this._scene.materials.indexOf(this);for(r>=0&&this._scene.materials.splice(r,1),r=0;r<this._scene.meshes.length;r++){var i=this._scene.meshes[r];if(i.material===this&&(i.material=null,i.geometry)){var n=i.geometry;if(this.storeEffectOnSubMeshes)for(var o=0,s=i.subMeshes;o<s.length;o++){var a=s[o];n._releaseVertexArrayObject(a._materialEffect),e&&a._materialEffect&&this._scene.getEngine()._releaseEffect(a._materialEffect)}else n._releaseVertexArrayObject(this._effect)}}
- this._uniformBuffer.dispose(),e&&this._effect&&(this.storeEffectOnSubMeshes||this._scene.getEngine()._releaseEffect(this._effect),this._effect=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBindObservable.clear(),this.onUnBindObservable.clear()},t.prototype.serialize=function(){return e.SerializationHelper.Serialize(this)},t.ParseMultiMaterial=function(t,r){var i=new e.MultiMaterial(t.name,r);i.id=t.id,e.Tags&&e.Tags.AddTagsTo(i,t.tags);for(var n=0;n<t.materials.length;n++){var o=t.materials[n];o?i.subMaterials.push(r.getMaterialByID(o)):i.subMaterials.push(null)}return i},t.Parse=function(t,r,i){return t.customType&&"BABYLON.StandardMaterial"!==t.customType?"BABYLON.PBRMaterial"===t.customType&&t.overloadedAlbedo&&(t.customType="BABYLON.LegacyPBRMaterial",!e.LegacyPBRMaterial)?void e.Tools.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."):e.Tools.Instantiate(t.customType).Parse(t,r,i):e.StandardMaterial.Parse(t,r,i)},t._TriangleFillMode=0,t._WireFrameFillMode=1,t._PointFillMode=2,t._PointListDrawMode=3,t._LineListDrawMode=4,t._LineLoopDrawMode=5,t._LineStripDrawMode=6,t._TriangleStripDrawMode=7,t._TriangleFanDrawMode=8,t._ClockWiseSideOrientation=0,t._CounterClockWiseSideOrientation=1,t._TextureDirtyFlag=1,t._LightDirtyFlag=2,t._FresnelDirtyFlag=4,t._AttributesDirtyFlag=8,t._MiscDirtyFlag=16,o([e.serialize()],t.prototype,"id",void 0),o([e.serialize()],t.prototype,"uniqueId",void 0),o([e.serialize()],t.prototype,"name",void 0),o([e.serialize()],t.prototype,"checkReadyOnEveryCall",void 0),o([e.serialize()],t.prototype,"checkReadyOnlyOnce",void 0),o([e.serialize()],t.prototype,"state",void 0),o([e.serialize("alpha")],t.prototype,"_alpha",void 0),o([e.serialize("backFaceCulling")],t.prototype,"_backFaceCulling",void 0),o([e.serialize()],t.prototype,"sideOrientation",void 0),o([e.serialize("alphaMode")],t.prototype,"_alphaMode",void 0),o([e.serialize()],t.prototype,"_needDepthPrePass",void 0),o([e.serialize()],t.prototype,"disableDepthWrite",void 0),o([e.serialize()],t.prototype,"forceDepthWrite",void 0),o([e.serialize()],t.prototype,"separateCullingPass",void 0),o([e.serialize("fogEnabled")],t.prototype,"_fogEnabled",void 0),o([e.serialize()],t.prototype,"pointSize",void 0),o([e.serialize()],t.prototype,"zOffset",void 0),o([e.serialize()],t.prototype,"wireframe",null),o([e.serialize()],t.prototype,"pointsCloud",null),o([e.serialize()],t.prototype,"fillMode",null),t})();e.Material=r})(n||(n={}));var n;!(function(e){var t=(function(){function t(e,t,r){this._engine=e,this._noUBO=!e.supportsUniformBuffers,this._dynamic=r,this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformLocationPointer=0,this._needSync=!1,this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform)}return Object.defineProperty(t.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!0,configurable:!0}),t.prototype.isDynamic=function(){return void 0!==this._dynamic},t.prototype.getData=function(){return this._bufferData},t.prototype.getBuffer=function(){return this._buffer},t.prototype._fillAlignment=function(e){var t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){var r=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var i=this._uniformLocationPointer-r,n=0;n<i;n++)this._data.push(0)}},t.prototype.addUniform=function(e,t){if(!this._noUBO&&void 0===this._uniformLocations[e]){var r;if(t instanceof Array)r=t,t=r.length;else{t=t,r=[];for(var i=0;i<t;i++)r.push(0)}this._fillAlignment(t),this._uniformSizes[e]=t,this._uniformLocations[e]=this._uniformLocationPointer,this._uniformLocationPointer+=t;for(var i=0;i<t;i++)this._data.push(r[i]);this._needSync=!0}},t.prototype.addMatrix=function(e,t){this.addUniform(e,Array.prototype.slice.call(t.toArray()))},t.prototype.addFloat2=function(e,t,r){var i=[t,r];this.addUniform(e,i)},t.prototype.addFloat3=function(e,t,r,i){var n=[t,r,i];this.addUniform(e,n)},t.prototype.addColor3=function(e,t){var r=new Array;t.toArray(r),this.addUniform(e,r)},t.prototype.addColor4=function(e,t,r){var i=new Array;t.toArray(i),i.push(r),this.addUniform(e,i)},t.prototype.addVector3=function(e,t){var r=new Array;t.toArray(r),this.addUniform(e,r)},t.prototype.addMatrix3x3=function(e){this.addUniform(e,12)},t.prototype.addMatrix2x2=function(e){this.addUniform(e,8)},t.prototype.create=function(){this._noUBO||this._buffer||(this._fillAlignment(4),this._bufferData=new Float32Array(this._data),this._rebuild(),this._needSync=!0)},t.prototype._rebuild=function(){this._noUBO||(this._dynamic?this._buffer=this._engine.createDynamicUniformBuffer(this._bufferData):this._buffer=this._engine.createUniformBuffer(this._bufferData))},t.prototype.update=function(){if(!this._buffer)return void this.create();(this._dynamic||this._needSync)&&(this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._needSync=!1)},t.prototype.updateUniform=function(t,r,i){var n=this._uniformLocations[t];if(void 0===n){if(this._buffer)return void e.Tools.Error("Cannot add an uniform after UBO has been created.");this.addUniform(t,i),n=this._uniformLocations[t]}if(this._buffer||this.create(),this._dynamic)for(var o=0;o<i;o++)this._bufferData[n+o]=r[o];else{for(var s=!1,o=0;o<i;o++)this._bufferData[n+o]!==r[o]&&(s=!0,this._bufferData[n+o]=r[o]);this._needSync=this._needSync||s}},t.prototype._updateMatrix3x3ForUniform=function(e,r){for(var i=0;i<3;i++)t._tempBuffer[4*i]=r[3*i],t._tempBuffer[4*i+1]=r[3*i+1],t._tempBuffer[4*i+2]=r[3*i+2],t._tempBuffer[4*i+3]=0;this.updateUniform(e,t._tempBuffer,12)},t.prototype._updateMatrix3x3ForEffect=function(e,t){this._currentEffect.setMatrix3x3(e,t)},t.prototype._updateMatrix2x2ForEffect=function(e,t){this._currentEffect.setMatrix2x2(e,t)},t.prototype._updateMatrix2x2ForUniform=function(e,r){for(var i=0;i<2;i++)t._tempBuffer[4*i]=r[2*i],t._tempBuffer[4*i+1]=r[2*i+1],t._tempBuffer[4*i+2]=0,t._tempBuffer[4*i+3]=0;this.updateUniform(e,t._tempBuffer,8)},t.prototype._updateFloatForEffect=function(e,t){this._currentEffect.setFloat(e,t)},t.prototype._updateFloatForUniform=function(e,r){t._tempBuffer[0]=r,this.updateUniform(e,t._tempBuffer,1)},t.prototype._updateFloat2ForEffect=function(e,t,r,i){void 0===i&&(i=""),this._currentEffect.setFloat2(e+i,t,r)},t.prototype._updateFloat2ForUniform=function(e,r,i,n){void 0===n&&(n=""),t._tempBuffer[0]=r,t._tempBuffer[1]=i,this.updateUniform(e,t._tempBuffer,2)},t.prototype._updateFloat3ForEffect=function(e,t,r,i,n){void 0===n&&(n=""),this._currentEffect.setFloat3(e+n,t,r,i)},t.prototype._updateFloat3ForUniform=function(e,r,i,n,o){void 0===o&&(o=""),t._tempBuffer[0]=r,t._tempBuffer[1]=i,t._tempBuffer[2]=n,this.updateUniform(e,t._tempBuffer,3)},t.prototype._updateFloat4ForEffect=function(e,t,r,i,n,o){void 0===o&&(o=""),this._currentEffect.setFloat4(e+o,t,r,i,n)},t.prototype._updateFloat4ForUniform=function(e,r,i,n,o,s){void 0===s&&(s=""),t._tempBuffer[0]=r,t._tempBuffer[1]=i,t._tempBuffer[2]=n,t._tempBuffer[3]=o,this.updateUniform(e,t._tempBuffer,4)},t.prototype._updateMatrixForEffect=function(e,t){this._currentEffect.setMatrix(e,t)},t.prototype._updateMatrixForUniform=function(e,t){this.updateUniform(e,t.toArray(),16)},t.prototype._updateVector3ForEffect=function(e,t){this._currentEffect.setVector3(e,t)},t.prototype._updateVector3ForUniform=function(e,r){r.toArray(t._tempBuffer),this.updateUniform(e,t._tempBuffer,3)},t.prototype._updateVector4ForEffect=function(e,t){this._currentEffect.setVector4(e,t)},t.prototype._updateVector4ForUniform=function(e,r){r.toArray(t._tempBuffer),this.updateUniform(e,t._tempBuffer,4)},t.prototype._updateColor3ForEffect=function(e,t,r){void 0===r&&(r=""),this._currentEffect.setColor3(e+r,t)},t.prototype._updateColor3ForUniform=function(e,r,i){void 0===i&&(i=""),r.toArray(t._tempBuffer),this.updateUniform(e,t._tempBuffer,3)},t.prototype._updateColor4ForEffect=function(e,t,r,i){void 0===i&&(i=""),this._currentEffect.setColor4(e+i,t,r)},t.prototype._updateColor4ForUniform=function(e,r,i,n){void 0===n&&(n=""),r.toArray(t._tempBuffer),t._tempBuffer[3]=i,this.updateUniform(e,t._tempBuffer,4)},t.prototype.setTexture=function(e,t){this._currentEffect.setTexture(e,t)},t.prototype.updateUniformDirectly=function(e,t){this.updateUniform(e,t,t.length),this.update()},t.prototype.bindToEffect=function(e,t){this._currentEffect=e,!this._noUBO&&this._buffer&&e.bindUniformBuffer(this._buffer,t)},t.prototype.dispose=function(){if(!this._noUBO){var e=this._engine._uniformBuffers.indexOf(this);-1!==e&&this._engine._uniformBuffers.splice(e,1),this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)}},t._MAX_UNIFORM_SIZE=256,t._tempBuffer=new Float32Array(t._MAX_UNIFORM_SIZE),t})();e.UniformBuffer=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){}return t.prototype.set=function(t,r){switch(r){case e.VertexBuffer.PositionKind:this.positions=t;break;case e.VertexBuffer.NormalKind:this.normals=t;break;case e.VertexBuffer.TangentKind:this.tangents=t;break;case e.VertexBuffer.UVKind:this.uvs=t;break;case e.VertexBuffer.UV2Kind:this.uvs2=t;break;case e.VertexBuffer.UV3Kind:this.uvs3=t;break;case e.VertexBuffer.UV4Kind:this.uvs4=t;break;case e.VertexBuffer.UV5Kind:this.uvs5=t;break;case e.VertexBuffer.UV6Kind:this.uvs6=t;break;case e.VertexBuffer.ColorKind:this.colors=t;break;case e.VertexBuffer.MatricesIndicesKind:this.matricesIndices=t;break;case e.VertexBuffer.MatricesWeightsKind:this.matricesWeights=t;break;case e.VertexBuffer.MatricesIndicesExtraKind:this.matricesIndicesExtra=t;break;case e.VertexBuffer.MatricesWeightsExtraKind:this.matricesWeightsExtra=t}},t.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},t.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},t.prototype.updateMesh=function(e,t,r){return this._update(e),this},t.prototype.updateGeometry=function(e,t,r){return this._update(e),this},t.prototype._applyTo=function(t,r){return void 0===r&&(r=!1),this.positions&&t.setVerticesData(e.VertexBuffer.PositionKind,this.positions,r),this.normals&&t.setVerticesData(e.VertexBuffer.NormalKind,this.normals,r),this.tangents&&t.setVerticesData(e.VertexBuffer.TangentKind,this.tangents,r),this.uvs&&t.setVerticesData(e.VertexBuffer.UVKind,this.uvs,r),this.uvs2&&t.setVerticesData(e.VertexBuffer.UV2Kind,this.uvs2,r),this.uvs3&&t.setVerticesData(e.VertexBuffer.UV3Kind,this.uvs3,r),this.uvs4&&t.setVerticesData(e.VertexBuffer.UV4Kind,this.uvs4,r),this.uvs5&&t.setVerticesData(e.VertexBuffer.UV5Kind,this.uvs5,r),this.uvs6&&t.setVerticesData(e.VertexBuffer.UV6Kind,this.uvs6,r),this.colors&&t.setVerticesData(e.VertexBuffer.ColorKind,this.colors,r),this.matricesIndices&&t.setVerticesData(e.VertexBuffer.MatricesIndicesKind,this.matricesIndices,r),this.matricesWeights&&t.setVerticesData(e.VertexBuffer.MatricesWeightsKind,this.matricesWeights,r),this.matricesIndicesExtra&&t.setVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra,r),this.matricesWeightsExtra&&t.setVerticesData(e.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra,r),this.indices?t.setIndices(this.indices,null,r):t.setIndices([],null),this},t.prototype._update=function(t,r,i){return this.positions&&t.updateVerticesData(e.VertexBuffer.PositionKind,this.positions,r,i),this.normals&&t.updateVerticesData(e.VertexBuffer.NormalKind,this.normals,r,i),this.tangents&&t.updateVerticesData(e.VertexBuffer.TangentKind,this.tangents,r,i),this.uvs&&t.updateVerticesData(e.VertexBuffer.UVKind,this.uvs,r,i),this.uvs2&&t.updateVerticesData(e.VertexBuffer.UV2Kind,this.uvs2,r,i),this.uvs3&&t.updateVerticesData(e.VertexBuffer.UV3Kind,this.uvs3,r,i),this.uvs4&&t.updateVerticesData(e.VertexBuffer.UV4Kind,this.uvs4,r,i),this.uvs5&&t.updateVerticesData(e.VertexBuffer.UV5Kind,this.uvs5,r,i),this.uvs6&&t.updateVerticesData(e.VertexBuffer.UV6Kind,this.uvs6,r,i),this.colors&&t.updateVerticesData(e.VertexBuffer.ColorKind,this.colors,r,i),this.matricesIndices&&t.updateVerticesData(e.VertexBuffer.MatricesIndicesKind,this.matricesIndices,r,i),this.matricesWeights&&t.updateVerticesData(e.VertexBuffer.MatricesWeightsKind,this.matricesWeights,r,i),this.matricesIndicesExtra&&t.updateVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra,r,i),this.matricesWeightsExtra&&t.updateVerticesData(e.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra,r,i),this.indices&&t.setIndices(this.indices,null),this},t.prototype.transform=function(t){var r,i=e.Vector3.Zero();if(this.positions){var n=e.Vector3.Zero();for(r=0;r<this.positions.length;r+=3)e.Vector3.FromArrayToRef(this.positions,r,n),e.Vector3.TransformCoordinatesToRef(n,t,i),this.positions[r]=i.x,this.positions[r+1]=i.y,this.positions[r+2]=i.z}if(this.normals){var o=e.Vector3.Zero();for(r=0;r<this.normals.length;r+=3)e.Vector3.FromArrayToRef(this.normals,r,o),e.Vector3.TransformNormalToRef(o,t,i),this.normals[r]=i.x,this.normals[r+1]=i.y,this.normals[r+2]=i.z}if(this.tangents){var s=e.Vector4.Zero(),a=e.Vector4.Zero();for(r=0;r<this.tangents.length;r+=4)e.Vector4.FromArrayToRef(this.tangents,r,s),e.Vector4.TransformNormalToRef(s,t,a),this.tangents[r]=a.x,this.tangents[r+1]=a.y,this.tangents[r+2]=a.z,this.tangents[r+3]=a.w}return this},t.prototype.merge=function(e){if(this._validate(),e._validate(),!this.normals!=!e.normals||!this.tangents!=!e.tangents||!this.uvs!=!e.uvs||!this.uvs2!=!e.uvs2||!this.uvs3!=!e.uvs3||!this.uvs4!=!e.uvs4||!this.uvs5!=!e.uvs5||!this.uvs6!=!e.uvs6||!this.colors!=!e.colors||!this.matricesIndices!=!e.matricesIndices||!this.matricesWeights!=!e.matricesWeights||!this.matricesIndicesExtra!=!e.matricesIndicesExtra||!this.matricesWeightsExtra!=!e.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes");if(e.indices){this.indices||(this.indices=[]);for(var t=this.positions?this.positions.length/3:0,r=0;r<e.indices.length;r++)this.indices.push(e.indices[r]+t)}return this.positions=this._mergeElement(this.positions,e.positions),this.normals=this._mergeElement(this.normals,e.normals),this.tangents=this._mergeElement(this.tangents,e.tangents),this.uvs=this._mergeElement(this.uvs,e.uvs),this.uvs2=this._mergeElement(this.uvs2,e.uvs2),this.uvs3=this._mergeElement(this.uvs3,e.uvs3),this.uvs4=this._mergeElement(this.uvs4,e.uvs4),this.uvs5=this._mergeElement(this.uvs5,e.uvs5),this.uvs6=this._mergeElement(this.uvs6,e.uvs6),this.colors=this._mergeElement(this.colors,e.colors),this.matricesIndices=this._mergeElement(this.matricesIndices,e.matricesIndices),this.matricesWeights=this._mergeElement(this.matricesWeights,e.matricesWeights),this.matricesIndicesExtra=this._mergeElement(this.matricesIndicesExtra,e.matricesIndicesExtra),this.matricesWeightsExtra=this._mergeElement(this.matricesWeightsExtra,e.matricesWeightsExtra),this},t.prototype._mergeElement=function(e,t){if(!e)return t;if(!t)return e;var r=t.length+e.length,i=e instanceof Float32Array,n=t instanceof Float32Array;if(i){var o=new Float32Array(r);return o.set(e),o.set(t,e.length),o}if(n){for(var s=e.slice(0),a=0,r=t.length;a<r;a++)s.push(t[a]);return s}return e.concat(t)},t.prototype._validate=function(){if(!this.positions)throw new Error("Positions are required");var t=function(t,r){var i=e.VertexBuffer.DeduceStride(t);if(r.length%i!=0)throw new Error("The "+t+"s array count must be a multiple of "+i);return r.length/i},r=t(e.VertexBuffer.PositionKind,this.positions),i=function(e,i){var n=t(e,i);if(n!==r)throw new Error("The "+e+"s element count ("+n+") does not match the positions count ("+r+")")};this.normals&&i(e.VertexBuffer.NormalKind,this.normals),this.tangents&&i(e.VertexBuffer.TangentKind,this.tangents),this.uvs&&i(e.VertexBuffer.UVKind,this.uvs),this.uvs2&&i(e.VertexBuffer.UV2Kind,this.uvs2),this.uvs3&&i(e.VertexBuffer.UV3Kind,this.uvs3),this.uvs4&&i(e.VertexBuffer.UV4Kind,this.uvs4),this.uvs5&&i(e.VertexBuffer.UV5Kind,this.uvs5),this.uvs6&&i(e.VertexBuffer.UV6Kind,this.uvs6),this.colors&&i(e.VertexBuffer.ColorKind,this.colors),this.matricesIndices&&i(e.VertexBuffer.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&i(e.VertexBuffer.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&i(e.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&i(e.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra)},t.prototype.serialize=function(){var e=this.serialize();return this.positions&&(e.positions=this.positions),this.normals&&(e.normals=this.normals),this.tangents&&(e.tangents=this.tangents),this.uvs&&(e.uvs=this.uvs),this.uvs2&&(e.uvs2=this.uvs2),this.uvs3&&(e.uvs3=this.uvs3),this.uvs4&&(e.uvs4=this.uvs4),this.uvs5&&(e.uvs5=this.uvs5),this.uvs6&&(e.uvs6=this.uvs6),this.colors&&(e.colors=this.colors),this.matricesIndices&&(e.matricesIndices=this.matricesIndices,e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=this.matricesWeights),this.matricesIndicesExtra&&(e.matricesIndicesExtra=this.matricesIndicesExtra,e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=this.matricesWeightsExtra),e.indices=this.indices,e},t.ExtractFromMesh=function(e,r,i){return t._ExtractFrom(e,r,i)},t.ExtractFromGeometry=function(e,r,i){return t._ExtractFrom(e,r,i)},t._ExtractFrom=function(r,i,n){var o=new t;return r.isVerticesDataPresent(e.VertexBuffer.PositionKind)&&(o.positions=r.getVerticesData(e.VertexBuffer.PositionKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.NormalKind)&&(o.normals=r.getVerticesData(e.VertexBuffer.NormalKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.TangentKind)&&(o.tangents=r.getVerticesData(e.VertexBuffer.TangentKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UVKind)&&(o.uvs=r.getVerticesData(e.VertexBuffer.UVKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UV2Kind)&&(o.uvs2=r.getVerticesData(e.VertexBuffer.UV2Kind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UV3Kind)&&(o.uvs3=r.getVerticesData(e.VertexBuffer.UV3Kind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UV4Kind)&&(o.uvs4=r.getVerticesData(e.VertexBuffer.UV4Kind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UV5Kind)&&(o.uvs5=r.getVerticesData(e.VertexBuffer.UV5Kind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.UV6Kind)&&(o.uvs6=r.getVerticesData(e.VertexBuffer.UV6Kind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.ColorKind)&&(o.colors=r.getVerticesData(e.VertexBuffer.ColorKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.MatricesIndicesKind)&&(o.matricesIndices=r.getVerticesData(e.VertexBuffer.MatricesIndicesKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.MatricesWeightsKind)&&(o.matricesWeights=r.getVerticesData(e.VertexBuffer.MatricesWeightsKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.MatricesIndicesExtraKind)&&(o.matricesIndicesExtra=r.getVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,i,n)),r.isVerticesDataPresent(e.VertexBuffer.MatricesWeightsExtraKind)&&(o.matricesWeightsExtra=r.getVerticesData(e.VertexBuffer.MatricesWeightsExtraKind,i,n)),o.indices=r.getIndices(i),o},t.CreateRibbon=function(r){var i=r.pathArray,n=r.closeArray||!1,o=r.closePath||!1,s=r.invertUV||!1,a=Math.floor(i[0].length/2),l=r.offset||a;l=l>a?a:Math.floor(l);var u,h,c,f,d=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,p=r.uvs,A=r.colors,m=[],g=[],_=[],v=[],y=[],b=[],E=[],T=[],x=[],M=[];if(i.length<2){var C=[],P=[];for(c=0;c<i[0].length-l;c++)C.push(i[0][c]),P.push(i[0][c+l]);i=[C,P]}var S,R,O=0,D=o?1:0;u=i[0].length;var w,I;for(h=0;h<i.length;h++){for(E[h]=0,y[h]=[0],S=i[h],R=S.length,u=u<R?u:R,f=0;f<R;)m.push(S[f].x,S[f].y,S[f].z),f>0&&(w=S[f].subtract(S[f-1]).length(),I=w+E[h],y[h].push(I),E[h]=I),f++;o&&(f--,m.push(S[0].x,S[0].y,S[0].z),w=S[f].subtract(S[0]).length(),I=w+E[h],y[h].push(I),E[h]=I),x[h]=R+D,M[h]=O,O+=R+D}var L,B,F=null,N=null;for(c=0;c<u+D;c++){for(T[c]=0,b[c]=[0],h=0;h<i.length-1;h++)L=i[h],B=i[h+1],c===u?(F=L[0],N=B[0]):(F=L[c],N=B[c]),w=N.subtract(F).length(),I=w+T[c],b[c].push(I),T[c]=I;n&&N&&F&&(L=i[h],B=i[0],c===u&&(N=B[0]),w=N.subtract(F).length(),I=w+T[c],T[c]=I)}var U,V;if(p)for(h=0;h<p.length;h++)v.push(p[h].x,p[h].y);else for(h=0;h<i.length;h++)for(c=0;c<u+D;c++)U=0!=E[h]?y[h][c]/E[h]:0,V=0!=T[c]?b[c][h]/T[c]:0,s?v.push(V,U):v.push(U,V);h=0;for(var k=0,G=x[h]-1,z=x[h+1]-1,H=G<z?G:z,j=M[1]-M[0],W=n?x.length:x.length-1;k<=H&&h<W;)g.push(k,k+j,k+1),g.push(k+j+1,k+1,k+j),(k+=1)===H&&(h++,h===x.length-1?(j=M[0]-M[h],G=x[h]-1,z=x[0]-1):(j=M[h+1]-M[h],G=x[h]-1,z=x[h+1]-1),k=M[h],H=G<z?G+k:z+k);if(t.ComputeNormals(m,g,_),o){var X=0,K=0;for(h=0;h<i.length;h++)X=3*M[h],K=h+1<i.length?3*(M[h+1]-1):_.length-3,_[X]=.5*(_[X]+_[K]),_[X+1]=.5*(_[X+1]+_[K+1]),_[X+2]=.5*(_[X+2]+_[K+2]),_[K]=_[X],_[K+1]=_[X+1],_[K+2]=_[X+2]}t._ComputeSides(d,m,g,_,v,r.frontUVs,r.backUVs);var Q=null;if(A){Q=new Float32Array(4*A.length);for(var Y=0;Y<A.length;Y++)Q[4*Y]=A[Y].r,Q[4*Y+1]=A[Y].g,Q[4*Y+2]=A[Y].b,Q[4*Y+3]=A[Y].a}var Z=new t,J=new Float32Array(m),q=new Float32Array(_),$=new Float32Array(v);return Z.indices=g,Z.positions=J,Z.normals=q,Z.uvs=$,Q&&Z.set(Q,e.VertexBuffer.ColorKind),o&&(Z._idx=M),Z},t.CreateBox=function(r){for(var i=[new e.Vector3(0,0,1),new e.Vector3(0,0,-1),new e.Vector3(1,0,0),new e.Vector3(-1,0,0),new e.Vector3(0,1,0),new e.Vector3(0,-1,0)],n=[],o=[],s=[],a=[],l=r.width||r.size||1,u=r.height||r.size||1,h=r.depth||r.size||1,c=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,f=r.faceUV||new Array(6),d=r.faceColors,p=[],A=0;A<6;A++)void 0===f[A]&&(f[A]=new e.Vector4(0,0,1,1)),d&&void 0===d[A]&&(d[A]=new e.Color4(1,1,1,1));for(var m=new e.Vector3(l/2,u/2,h/2),g=0;g<i.length;g++){var _=i[g],v=new e.Vector3(_.y,_.z,_.x),y=e.Vector3.Cross(_,v),b=o.length/3;n.push(b),n.push(b+1),n.push(b+2),n.push(b),n.push(b+2),n.push(b+3);var E=_.subtract(v).subtract(y).multiply(m);o.push(E.x,E.y,E.z),s.push(_.x,_.y,_.z),a.push(f[g].z,f[g].w),d&&p.push(d[g].r,d[g].g,d[g].b,d[g].a),E=_.subtract(v).add(y).multiply(m),o.push(E.x,E.y,E.z),s.push(_.x,_.y,_.z),a.push(f[g].x,f[g].w),d&&p.push(d[g].r,d[g].g,d[g].b,d[g].a),E=_.add(v).add(y).multiply(m),o.push(E.x,E.y,E.z),s.push(_.x,_.y,_.z),a.push(f[g].x,f[g].y),d&&p.push(d[g].r,d[g].g,d[g].b,d[g].a),E=_.add(v).subtract(y).multiply(m),o.push(E.x,E.y,E.z),s.push(_.x,_.y,_.z),a.push(f[g].z,f[g].y),d&&p.push(d[g].r,d[g].g,d[g].b,d[g].a)}t._ComputeSides(c,o,n,s,a,r.frontUVs,r.backUVs);var T=new t;if(T.indices=n,T.positions=o,T.normals=s,T.uvs=a,d){var x=c===e.Mesh.DOUBLESIDE?p.concat(p):p;T.colors=x}return T},t.CreateSphere=function(r){for(var i=r.segments||32,n=r.diameterX||r.diameter||1,o=r.diameterY||r.diameter||1,s=r.diameterZ||r.diameter||1,a=r.arc&&(r.arc<=0||r.arc>1)?1:r.arc||1,l=r.slice&&r.slice<=0?1:r.slice||1,u=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,h=new e.Vector3(n/2,o/2,s/2),c=2+i,f=2*c,d=[],p=[],A=[],m=[],g=0;g<=c;g++){for(var _=g/c,v=_*Math.PI*l,y=0;y<=f;y++){var b=y/f,E=b*Math.PI*2*a,T=e.Matrix.RotationZ(-v),x=e.Matrix.RotationY(E),M=e.Vector3.TransformCoordinates(e.Vector3.Up(),T),C=e.Vector3.TransformCoordinates(M,x),P=C.multiply(h),S=C.divide(h).normalize();p.push(P.x,P.y,P.z),A.push(S.x,S.y,S.z),m.push(b,_)}if(g>0)for(var R=p.length/3,O=R-2*(f+1);O+f+2<R;O++)d.push(O),d.push(O+1),d.push(O+f+1),d.push(O+f+1),d.push(O+1),d.push(O+f+2)}t._ComputeSides(u,p,d,A,m,r.frontUVs,r.backUVs);var D=new t;return D.indices=d,D.positions=p,D.normals=A,D.uvs=m,D},t.CreateCylinder=function(r){var i,n=r.height||2,o=0===r.diameterTop?0:r.diameterTop||r.diameter||1,s=0===r.diameterBottom?0:r.diameterBottom||r.diameter||1,a=r.tessellation||24,l=r.subdivisions||1,u=!!r.hasRings,h=!!r.enclose,c=r.arc&&(r.arc<=0||r.arc>1)?1:r.arc||1,f=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,d=r.faceUV||new Array(3),p=r.faceColors,A=1!==c&&h?2:0,m=u?l:1,g=2+(1+A)*m;for(i=0;i<g;i++)p&&void 0===p[i]&&(p[i]=new e.Color4(1,1,1,1));for(i=0;i<g;i++)d&&void 0===d[i]&&(d[i]=new e.Vector4(0,0,1,1));var _,v,y,b,E,T,x=new Array,M=new Array,C=new Array,P=new Array,S=new Array,R=2*Math.PI*c/a,O=(s-o)/2/n,D=e.Vector3.Zero(),w=e.Vector3.Zero(),I=e.Vector3.Zero(),L=e.Vector3.Zero(),B=e.Vector3.Zero(),F=e.Axis.Y,N=1,U=1,V=0,k=0;for(b=0;b<=l;b++)for(v=b/l,y=(v*(o-s)+s)/2,N=u&&0!==b&&b!==l?2:1,T=0;T<N;T++){for(u&&(U+=T),h&&(U+=2*T),E=0;E<=a;E++)_=E*R,D.x=Math.cos(-_)*y,D.y=-n/2+v*n,D.z=Math.sin(-_)*y,0===o&&b===l?(w.x=C[C.length-3*(a+1)],w.y=C[C.length-3*(a+1)+1],w.z=C[C.length-3*(a+1)+2]):(w.x=D.x,w.z=D.z,w.y=Math.sqrt(w.x*w.x+w.z*w.z)*O,w.normalize()),0===E&&(I.copyFrom(D),L.copyFrom(w)),M.push(D.x,D.y,D.z),C.push(w.x,w.y,w.z),k=u?V!==U?d[U].y:d[U].w:d[U].y+(d[U].w-d[U].y)*v,P.push(d[U].x+(d[U].z-d[U].x)*E/a,k),p&&S.push(p[U].r,p[U].g,p[U].b,p[U].a);1!==c&&h&&(M.push(D.x,D.y,D.z),M.push(0,D.y,0),M.push(0,D.y,0),M.push(I.x,I.y,I.z),e.Vector3.CrossToRef(F,w,B),B.normalize(),C.push(B.x,B.y,B.z,B.x,B.y,B.z),e.Vector3.CrossToRef(L,F,B),B.normalize(),C.push(B.x,B.y,B.z,B.x,B.y,B.z),k=u?V!==U?d[U+1].y:d[U+1].w:d[U+1].y+(d[U+1].w-d[U+1].y)*v,P.push(d[U+1].x,k),P.push(d[U+1].z,k),k=u?V!==U?d[U+2].y:d[U+2].w:d[U+2].y+(d[U+2].w-d[U+2].y)*v,P.push(d[U+2].x,k),P.push(d[U+2].z,k),p&&(S.push(p[U+1].r,p[U+1].g,p[U+1].b,p[U+1].a),S.push(p[U+1].r,p[U+1].g,p[U+1].b,p[U+1].a),S.push(p[U+2].r,p[U+2].g,p[U+2].b,p[U+2].a),S.push(p[U+2].r,p[U+2].g,p[U+2].b,p[U+2].a))),V!==U&&(V=U)}var U,G=1!==c&&h?a+4:a;for(b=0,U=0;U<l;U++){var z=0,H=0,j=0,W=0;for(E=0;E<a;E++)z=b*(G+1)+E,H=(b+1)*(G+1)+E,j=b*(G+1)+(E+1),W=(b+1)*(G+1)+(E+1),x.push(z,H,j),x.push(W,j,H);1!==c&&h&&(x.push(z+2,H+2,j+2),x.push(W+2,j+2,H+2),x.push(z+4,H+4,j+4),x.push(W+4,j+4,H+4)),b=u?b+2:b+1}var X=function(t){var r=t?o/2:s/2;if(0!==r){var i,l,u,h=t?d[g-1]:d[0],f=null;p&&(f=t?p[g-1]:p[0]);var A=M.length/3,m=t?n/2:-n/2,_=new e.Vector3(0,m,0);M.push(_.x,_.y,_.z),C.push(0,t?1:-1,0),P.push(h.x+.5*(h.z-h.x),h.y+.5*(h.w-h.y)),f&&S.push(f.r,f.g,f.b,f.a);var v=new e.Vector2(.5,.5);for(u=0;u<=a;u++){i=2*Math.PI*u*c/a;var y=Math.cos(-i),b=Math.sin(-i);l=new e.Vector3(y*r,m,b*r);var E=new e.Vector2(y*v.x+.5,b*v.y+.5);M.push(l.x,l.y,l.z),C.push(0,t?1:-1,0),P.push(h.x+(h.z-h.x)*E.x,h.y+(h.w-h.y)*E.y),f&&S.push(f.r,f.g,f.b,f.a)}for(u=0;u<a;u++)t?(x.push(A),x.push(A+(u+2)),x.push(A+(u+1))):(x.push(A),x.push(A+(u+1)),x.push(A+(u+2)))}};X(!1),X(!0),t._ComputeSides(f,M,x,C,P,r.frontUVs,r.backUVs);var K=new t;return K.indices=x,K.positions=M,K.normals=C,K.uvs=P,p&&(K.colors=S),K},t.CreateTorus=function(r){for(var i=[],n=[],o=[],s=[],a=r.diameter||1,l=r.thickness||.5,u=r.tessellation||16,h=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,c=u+1,f=0;f<=u;f++)for(var d=f/u,p=f*Math.PI*2/u-Math.PI/2,A=e.Matrix.Translation(a/2,0,0).multiply(e.Matrix.RotationY(p)),m=0;m<=u;m++){var g=1-m/u,_=m*Math.PI*2/u+Math.PI,v=Math.cos(_),y=Math.sin(_),b=new e.Vector3(v,y,0),E=b.scale(l/2),T=new e.Vector2(d,g);E=e.Vector3.TransformCoordinates(E,A),b=e.Vector3.TransformNormal(b,A),n.push(E.x,E.y,E.z),o.push(b.x,b.y,b.z),s.push(T.x,T.y);var x=(f+1)%c,M=(m+1)%c;i.push(f*c+m),i.push(f*c+M),i.push(x*c+m),i.push(f*c+M),i.push(x*c+M),i.push(x*c+m)}t._ComputeSides(h,n,i,o,s,r.frontUVs,r.backUVs);var C=new t;return C.indices=i,C.positions=n,C.normals=o,C.uvs=s,C},t.CreateLineSystem=function(e){for(var r=[],i=[],n=e.lines,o=e.colors,s=[],a=0,l=0;l<n.length;l++)for(var u=n[l],h=0;h<u.length;h++){if(i.push(u[h].x,u[h].y,u[h].z),o){var c=o[l];s.push(c[h].r,c[h].g,c[h].b,c[h].a)}h>0&&(r.push(a-1),r.push(a)),a++}var f=new t;return f.indices=r,f.positions=i,o&&(f.colors=s),f},t.CreateDashedLines=function(r){var i=r.dashSize||3,n=r.gapSize||1,o=r.dashNb||200,s=r.points,a=new Array,l=new Array,u=e.Vector3.Zero(),h=0,c=0,f=0,d=0,p=0,A=0,m=0;for(m=0;m<s.length-1;m++)s[m+1].subtractToRef(s[m],u),h+=u.length();for(f=h/o,d=i*f/(i+n),m=0;m<s.length-1;m++){s[m+1].subtractToRef(s[m],u),c=Math.floor(u.length()/f),u.normalize();for(var g=0;g<c;g++)p=f*g,a.push(s[m].x+p*u.x,s[m].y+p*u.y,s[m].z+p*u.z),a.push(s[m].x+(p+d)*u.x,s[m].y+(p+d)*u.y,s[m].z+(p+d)*u.z),l.push(A,A+1),A+=2}var _=new t;return _.positions=a,_.indices=l,_},t.CreateGround=function(r){var i,n,o=[],s=[],a=[],l=[],u=r.width||1,h=r.height||1,c=r.subdivisionsX||r.subdivisions||1,f=r.subdivisionsY||r.subdivisions||1;for(i=0;i<=f;i++)for(n=0;n<=c;n++){var d=new e.Vector3(n*u/c-u/2,0,(f-i)*h/f-h/2),p=new e.Vector3(0,1,0);s.push(d.x,d.y,d.z),a.push(p.x,p.y,p.z),l.push(n/c,1-i/f)}for(i=0;i<f;i++)for(n=0;n<c;n++)o.push(n+1+(i+1)*(c+1)),o.push(n+1+i*(c+1)),o.push(n+i*(c+1)),o.push(n+(i+1)*(c+1)),o.push(n+1+(i+1)*(c+1)),o.push(n+i*(c+1));var A=new t;return A.indices=o,A.positions=s,A.normals=a,A.uvs=l,A},t.CreateTiledGround=function(r){var i,n,o,s,a=void 0!==r.xmin&&null!==r.xmin?r.xmin:-1,l=void 0!==r.zmin&&null!==r.zmin?r.zmin:-1,u=void 0!==r.xmax&&null!==r.xmax?r.xmax:1,h=void 0!==r.zmax&&null!==r.zmax?r.zmax:1,c=r.subdivisions||{w:1,h:1},f=r.precision||{w:1,h:1},d=new Array,p=new Array,A=new Array,m=new Array;c.h=c.h<1?1:c.h,c.w=c.w<1?1:c.w,f.w=f.w<1?1:f.w,f.h=f.h<1?1:f.h;var g={w:(u-a)/c.w,h:(h-l)/c.h};for(o=0;o<c.h;o++)for(s=0;s<c.w;s++)!(function(t,r,o,s){var a=p.length/3,l=f.w+1;for(i=0;i<f.h;i++)for(n=0;n<f.w;n++){var u=[a+n+i*l,a+(n+1)+i*l,a+(n+1)+(i+1)*l,a+n+(i+1)*l];d.push(u[1]),d.push(u[2]),d.push(u[3]),d.push(u[0]),d.push(u[1]),d.push(u[3])}var h=e.Vector3.Zero(),c=new e.Vector3(0,1,0);for(i=0;i<=f.h;i++)for(h.z=i*(s-r)/f.h+r,n=0;n<=f.w;n++)h.x=n*(o-t)/f.w+t,h.y=0,p.push(h.x,h.y,h.z),A.push(c.x,c.y,c.z),m.push(n/f.w,i/f.h)})(a+s*g.w,l+o*g.h,a+(s+1)*g.w,l+(o+1)*g.h);var _=new t;return _.indices=d,_.positions=p,_.normals=A,_.uvs=m,_},t.CreateGroundFromHeightMap=function(r){var i,n,o=[],s=[],a=[],l=[],u=r.colorFilter||new e.Color3(.3,.59,.11);for(i=0;i<=r.subdivisions;i++)for(n=0;n<=r.subdivisions;n++){var h=new e.Vector3(n*r.width/r.subdivisions-r.width/2,0,(r.subdivisions-i)*r.height/r.subdivisions-r.height/2),c=(h.x+r.width/2)/r.width*(r.bufferWidth-1)|0,f=(1-(h.z+r.height/2)/r.height)*(r.bufferHeight-1)|0,d=4*(c+f*r.bufferWidth),p=r.buffer[d]/255,A=r.buffer[d+1]/255,m=r.buffer[d+2]/255,g=p*u.r+A*u.g+m*u.b;h.y=r.minHeight+(r.maxHeight-r.minHeight)*g,s.push(h.x,h.y,h.z),a.push(0,0,0),l.push(n/r.subdivisions,1-i/r.subdivisions)}for(i=0;i<r.subdivisions;i++)for(n=0;n<r.subdivisions;n++)o.push(n+1+(i+1)*(r.subdivisions+1)),o.push(n+1+i*(r.subdivisions+1)),o.push(n+i*(r.subdivisions+1)),o.push(n+(i+1)*(r.subdivisions+1)),o.push(n+1+(i+1)*(r.subdivisions+1)),o.push(n+i*(r.subdivisions+1));t.ComputeNormals(s,o,a);var _=new t;return _.indices=o,_.positions=s,_.normals=a,_.uvs=l,_},t.CreatePlane=function(r){var i=[],n=[],o=[],s=[],a=r.width||r.size||1,l=r.height||r.size||1,u=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,h=a/2,c=l/2;n.push(-h,-c,0),o.push(0,0,-1),s.push(0,0),n.push(h,-c,0),o.push(0,0,-1),s.push(1,0),n.push(h,c,0),o.push(0,0,-1),s.push(1,1),n.push(-h,c,0),o.push(0,0,-1),s.push(0,1),i.push(0),
- i.push(1),i.push(2),i.push(0),i.push(2),i.push(3),t._ComputeSides(u,n,i,o,s,r.frontUVs,r.backUVs);var f=new t;return f.indices=i,f.positions=n,f.normals=o,f.uvs=s,f},t.CreateDisc=function(r){var i=new Array,n=new Array,o=new Array,s=new Array,a=r.radius||.5,l=r.tessellation||64,u=r.arc&&(r.arc<=0||r.arc>1)?1:r.arc||1,h=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE;i.push(0,0,0),s.push(.5,.5);for(var c=2*Math.PI*u,f=c/l,d=0;d<c;d+=f){var p=Math.cos(d),A=Math.sin(d),m=(p+1)/2,g=(1-A)/2;i.push(a*p,a*A,0),s.push(m,g)}1===u&&(i.push(i[3],i[4],i[5]),s.push(s[2],s[3]));for(var _=i.length/3,v=1;v<_-1;v++)n.push(v+1,0,v);t.ComputeNormals(i,n,o),t._ComputeSides(h,i,n,o,s,r.frontUVs,r.backUVs);var y=new t;return y.indices=n,y.positions=i,y.normals=o,y.uvs=s,y},t.CreatePolygon=function(r,i,n,o,s,a){for(var l=n||new Array(3),u=o,h=[],c=0;c<3;c++)void 0===l[c]&&(l[c]=new e.Vector4(0,0,1,1)),u&&void 0===u[c]&&(u[c]=new e.Color4(1,1,1,1));for(var f=r.getVerticesData(e.VertexBuffer.PositionKind),d=r.getVerticesData(e.VertexBuffer.NormalKind),p=r.getVerticesData(e.VertexBuffer.UVKind),A=r.getIndices(),m=0,g=0,_=0;_<d.length;_+=3)Math.abs(d[_+1])<.001&&(g=1),Math.abs(d[_+1]-1)<.001&&(g=0),Math.abs(d[_+1]+1)<.001&&(g=2),m=_/3,p[2*m]=(1-p[2*m])*l[g].x+p[2*m]*l[g].z,p[2*m+1]=(1-p[2*m+1])*l[g].y+p[2*m+1]*l[g].w,u&&h.push(u[g].r,u[g].g,u[g].b,u[g].a);t._ComputeSides(i,f,A,d,p,s,a);var v=new t;if(v.indices=A,v.positions=f,v.normals=d,v.uvs=p,u){var y=i===e.Mesh.DOUBLESIDE?h.concat(h):h;v.colors=y}return v},t.CreateIcoSphere=function(r){var i,n=r.sideOrientation||e.Mesh.DEFAULTSIDE,o=r.radius||1,s=void 0===r.flat||r.flat,a=r.subdivisions||4,l=r.radiusX||o,u=r.radiusY||o,h=r.radiusZ||o,c=(1+Math.sqrt(5))/2,f=[-1,c,-0,1,c,0,-1,-c,0,1,-c,0,0,-1,-c,0,1,-c,0,-1,c,0,1,c,c,0,1,c,0,-1,-c,0,1,-c,0,-1],d=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],p=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],A=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],m=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],g=new Array,_=new Array,v=new Array,y=new Array,b=0,E=new Array(3),T=new Array(3);for(i=0;i<3;i++)E[i]=e.Vector3.Zero(),T[i]=e.Vector2.Zero();for(var x=0;x<20;x++){for(i=0;i<3;i++){var M=d[3*x+i];E[i].copyFromFloats(f[3*p[M]],f[3*p[M]+1],f[3*p[M]+2]),E[i].normalize().scaleInPlace(o),T[i].copyFromFloats(A[2*M]*(138/1024)+60/1024+m[x]*(-40/1024),A[2*M+1]*(239/1024)+26/1024+m[x]*(20/1024))}for(var C=function(t,r,i,n){var o=e.Vector3.Lerp(E[0],E[2],r/a),c=e.Vector3.Lerp(E[1],E[2],r/a),f=a===r?E[2]:e.Vector3.Lerp(o,c,t/(a-r));f.normalize();var d;if(s){var p=e.Vector3.Lerp(E[0],E[2],n/a),A=e.Vector3.Lerp(E[1],E[2],n/a);d=e.Vector3.Lerp(p,A,i/(a-n))}else d=new e.Vector3(f.x,f.y,f.z);d.x/=l,d.y/=u,d.z/=h,d.normalize();var m=e.Vector2.Lerp(T[0],T[2],r/a),x=e.Vector2.Lerp(T[1],T[2],r/a),M=a===r?T[2]:e.Vector2.Lerp(m,x,t/(a-r));_.push(f.x*l,f.y*u,f.z*h),v.push(d.x,d.y,d.z),y.push(M.x,M.y),g.push(b),b++},P=0;P<a;P++)for(var S=0;S+P<a;S++)C(S,P,S+1/3,P+1/3),C(S+1,P,S+1/3,P+1/3),C(S,P+1,S+1/3,P+1/3),S+P+1<a&&(C(S+1,P,S+2/3,P+2/3),C(S+1,P+1,S+2/3,P+2/3),C(S,P+1,S+2/3,P+2/3))}t._ComputeSides(n,_,g,v,y,r.frontUVs,r.backUVs);var R=new t;return R.indices=g,R.positions=_,R.normals=v,R.uvs=y,R},t.CreatePolyhedron=function(r){var i=[];i[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},i[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},i[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},i[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},i[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},i[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},i[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},i[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},i[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},i[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},i[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},i[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},i[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},i[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},i[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var n,o,s,a,l,u,h=r.type&&(r.type<0||r.type>=i.length)?0:r.type||0,c=r.size,f=r.sizeX||c||1,d=r.sizeY||c||1,p=r.sizeZ||c||1,A=r.custom||i[h],m=A.face.length,g=r.faceUV||new Array(m),_=r.faceColors,v=void 0===r.flat||r.flat,y=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,b=new Array,E=new Array,T=new Array,x=new Array,M=new Array,C=0,P=0,S=new Array,R=0,O=0;if(v)for(O=0;O<m;O++)_&&void 0===_[O]&&(_[O]=new e.Color4(1,1,1,1)),g&&void 0===g[O]&&(g[O]=new e.Vector4(0,0,1,1));if(v)for(O=0;O<m;O++){var D=A.face[O].length;for(s=2*Math.PI/D,a=.5*Math.tan(s/2),l=.5,R=0;R<D;R++)b.push(A.vertex[A.face[O][R]][0]*f,A.vertex[A.face[O][R]][1]*d,A.vertex[A.face[O][R]][2]*p),S.push(C),C++,n=g[O].x+(g[O].z-g[O].x)*(.5+a),o=g[O].y+(g[O].w-g[O].y)*(l-.5),x.push(n,o),u=a*Math.cos(s)-l*Math.sin(s),l=a*Math.sin(s)+l*Math.cos(s),a=u,_&&M.push(_[O].r,_[O].g,_[O].b,_[O].a);for(R=0;R<D-2;R++)E.push(S[0+P],S[R+2+P],S[R+1+P]);P+=D}else{for(R=0;R<A.vertex.length;R++)b.push(A.vertex[R][0]*f,A.vertex[R][1]*d,A.vertex[R][2]*p),x.push(0,0);for(O=0;O<m;O++)for(R=0;R<A.face[O].length-2;R++)E.push(A.face[O][0],A.face[O][R+2],A.face[O][R+1])}t.ComputeNormals(b,E,T),t._ComputeSides(y,b,E,T,x,r.frontUVs,r.backUVs);var w=new t;return w.positions=b,w.indices=E,w.normals=T,w.uvs=x,_&&v&&(w.colors=M),w},t.CreateTorusKnot=function(r){var i,n,o=new Array,s=new Array,a=new Array,l=new Array,u=r.radius||2,h=r.tube||.5,c=r.radialSegments||32,f=r.tubularSegments||32,d=r.p||2,p=r.q||3,A=0===r.sideOrientation?0:r.sideOrientation||e.Mesh.DEFAULTSIDE,m=function(t){var r=Math.cos(t),i=Math.sin(t),n=p/d*t,o=Math.cos(n),s=u*(2+o)*.5*r,a=u*(2+o)*i*.5,l=u*Math.sin(n)*.5;return new e.Vector3(s,a,l)};for(i=0;i<=c;i++){var g=i%c,_=g/c*2*d*Math.PI,v=m(_),y=m(_+.01),b=y.subtract(v),E=y.add(v),T=e.Vector3.Cross(b,E);for(E=e.Vector3.Cross(T,b),T.normalize(),E.normalize(),n=0;n<f;n++){var x=n%f,M=x/f*2*Math.PI,C=-h*Math.cos(M),P=h*Math.sin(M);s.push(v.x+C*E.x+P*T.x),s.push(v.y+C*E.y+P*T.y),s.push(v.z+C*E.z+P*T.z),l.push(i/c),l.push(n/f)}}for(i=0;i<c;i++)for(n=0;n<f;n++){var S=(n+1)%f,R=i*f+n,O=(i+1)*f+n,D=(i+1)*f+S,w=i*f+S;o.push(w),o.push(O),o.push(R),o.push(w),o.push(D),o.push(O)}t.ComputeNormals(s,o,a),t._ComputeSides(A,s,o,a,l,r.frontUVs,r.backUVs);var I=new t;return I.indices=o,I.positions=s,I.normals=a,I.uvs=l,I},t.ComputeNormals=function(t,r,i,n){var o=0,s=0,a=0,l=0,u=0,h=0,c=0,f=0,d=0,p=0,A=0,m=0,g=0,_=0,v=0,y=0,b=0,E=0,T=0,x=0,M=!1,C=!1,P=!1,S=!1,R=1,O=0,D=null;if(n&&(M=!!n.facetNormals,C=!!n.facetPositions,P=!!n.facetPartitioning,R=!0===n.useRightHandedSystem?-1:1,O=n.ratio||0,S=!!n.depthSort,D=n.distanceTo,S)){void 0===D&&(D=e.Vector3.Zero());var w=n.depthSortedFacets}var I=0,L=0,B=0,F=0;if(P&&n&&n.bbSize){var N=0,U=0,V=0,k=0,G=0,z=0,H=0,j=0,W=0,X=0,K=0,Q=0,Y=0,Z=0,J=0,q=0,$=n.bbSize.x>n.bbSize.y?n.bbSize.x:n.bbSize.y;$=$>n.bbSize.z?$:n.bbSize.z,I=n.subDiv.X*O/n.bbSize.x,L=n.subDiv.Y*O/n.bbSize.y,B=n.subDiv.Z*O/n.bbSize.z,F=n.subDiv.max*n.subDiv.max,n.facetPartitioning.length=0}for(o=0;o<t.length;o++)i[o]=0;var ee=r.length/3|0;for(o=0;o<ee;o++){if(m=3*r[3*o],g=m+1,_=m+2,v=3*r[3*o+1],y=v+1,b=v+2,E=3*r[3*o+2],T=E+1,x=E+2,s=t[m]-t[v],a=t[g]-t[y],l=t[_]-t[b],u=t[E]-t[v],h=t[T]-t[y],c=t[x]-t[b],f=R*(a*c-l*h),d=R*(l*u-s*c),p=R*(s*h-a*u),A=Math.sqrt(f*f+d*d+p*p),A=0===A?1:A,f/=A,d/=A,p/=A,M&&n&&(n.facetNormals[o].x=f,n.facetNormals[o].y=d,n.facetNormals[o].z=p),C&&n&&(n.facetPositions[o].x=(t[m]+t[v]+t[E])/3,n.facetPositions[o].y=(t[g]+t[y]+t[T])/3,n.facetPositions[o].z=(t[_]+t[b]+t[x])/3),P&&n&&(N=Math.floor((n.facetPositions[o].x-n.bInfo.minimum.x*O)*I),U=Math.floor((n.facetPositions[o].y-n.bInfo.minimum.y*O)*L),V=Math.floor((n.facetPositions[o].z-n.bInfo.minimum.z*O)*B),k=Math.floor((t[m]-n.bInfo.minimum.x*O)*I),G=Math.floor((t[g]-n.bInfo.minimum.y*O)*L),z=Math.floor((t[_]-n.bInfo.minimum.z*O)*B),H=Math.floor((t[v]-n.bInfo.minimum.x*O)*I),j=Math.floor((t[y]-n.bInfo.minimum.y*O)*L),W=Math.floor((t[b]-n.bInfo.minimum.z*O)*B),X=Math.floor((t[E]-n.bInfo.minimum.x*O)*I),K=Math.floor((t[T]-n.bInfo.minimum.y*O)*L),Q=Math.floor((t[x]-n.bInfo.minimum.z*O)*B),Z=k+n.subDiv.max*G+F*z,J=H+n.subDiv.max*j+F*W,q=X+n.subDiv.max*K+F*Q,Y=N+n.subDiv.max*U+F*V,n.facetPartitioning[Y]=n.facetPartitioning[Y]?n.facetPartitioning[Y]:new Array,n.facetPartitioning[Z]=n.facetPartitioning[Z]?n.facetPartitioning[Z]:new Array,n.facetPartitioning[J]=n.facetPartitioning[J]?n.facetPartitioning[J]:new Array,n.facetPartitioning[q]=n.facetPartitioning[q]?n.facetPartitioning[q]:new Array,n.facetPartitioning[Z].push(o),J!=Z&&n.facetPartitioning[J].push(o),q!=J&&q!=Z&&n.facetPartitioning[q].push(o),Y!=Z&&Y!=J&&Y!=q&&n.facetPartitioning[Y].push(o)),S&&n&&n.facetPositions){var te=w[o];te.ind=3*o,te.sqDistance=e.Vector3.DistanceSquared(n.facetPositions[o],D)}i[m]+=f,i[g]+=d,i[_]+=p,i[v]+=f,i[y]+=d,i[b]+=p,i[E]+=f,i[T]+=d,i[x]+=p}for(o=0;o<i.length/3;o++)f=i[3*o],d=i[3*o+1],p=i[3*o+2],A=Math.sqrt(f*f+d*d+p*p),A=0===A?1:A,f/=A,d/=A,p/=A,i[3*o]=f,i[3*o+1]=d,i[3*o+2]=p},t._ComputeSides=function(t,r,i,n,o,s,a){var l,u,h=i.length,c=n.length;switch(t=t||e.Mesh.DEFAULTSIDE){case e.Mesh.FRONTSIDE:break;case e.Mesh.BACKSIDE:var f;for(l=0;l<h;l+=3)f=i[l],i[l]=i[l+2],i[l+2]=f;for(u=0;u<c;u++)n[u]=-n[u];break;case e.Mesh.DOUBLESIDE:for(var d=r.length,p=d/3,A=0;A<d;A++)r[d+A]=r[A];for(l=0;l<h;l+=3)i[l+h]=i[l+2]+p,i[l+1+h]=i[l+1]+p,i[l+2+h]=i[l]+p;for(u=0;u<c;u++)n[c+u]=-n[u];var m=o.length,g=0;for(g=0;g<m;g++)o[g+m]=o[g];for(s=s||new e.Vector4(0,0,1,1),a=a||new e.Vector4(0,0,1,1),g=0,l=0;l<m/2;l++)o[g]=s.x+(s.z-s.x)*o[g],o[g+1]=s.y+(s.w-s.y)*o[g+1],o[g+m]=a.x+(a.z-a.x)*o[g+m],o[g+m+1]=a.y+(a.w-a.y)*o[g+m+1],g+=2}},t.ImportVertexData=function(r,i){var n=new t,o=r.positions;o&&n.set(o,e.VertexBuffer.PositionKind);var s=r.normals;s&&n.set(s,e.VertexBuffer.NormalKind);var a=r.tangents;a&&n.set(a,e.VertexBuffer.TangentKind);var l=r.uvs;l&&n.set(l,e.VertexBuffer.UVKind);var u=r.uv2s;u&&n.set(u,e.VertexBuffer.UV2Kind);var h=r.uv3s;h&&n.set(h,e.VertexBuffer.UV3Kind);var c=r.uv4s;c&&n.set(c,e.VertexBuffer.UV4Kind);var f=r.uv5s;f&&n.set(f,e.VertexBuffer.UV5Kind);var d=r.uv6s;d&&n.set(d,e.VertexBuffer.UV6Kind);var p=r.colors;p&&n.set(e.Color4.CheckColors4(p,o.length/3),e.VertexBuffer.ColorKind);var A=r.matricesIndices;A&&n.set(A,e.VertexBuffer.MatricesIndicesKind);var m=r.matricesWeights;m&&n.set(m,e.VertexBuffer.MatricesWeightsKind);var g=r.indices;g&&(n.indices=g),i.setAllVerticesData(n,r.updatable)},t})();e.VertexData=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(t,r,i,n,o){void 0===n&&(n=!1),void 0===o&&(o=null),this.delayLoadState=e.Engine.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this.id=t,this._engine=r.getEngine(),this._meshes=[],this._scene=r,this._vertexBuffers={},this._indices=[],this._updatable=n,i?this.setAllVerticesData(i,n):(this._totalVertices=0,this._indices=[]),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),o&&("LinesMesh"===o.getClassName()&&(this.boundingBias=new e.Vector2(0,o.intersectionThreshold),this._updateExtend()),this.applyToMesh(o),o.computeWorldMatrix(!0))}return Object.defineProperty(t.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){this._boundingBias&&this._boundingBias.equals(e)||(this._boundingBias=e.clone(),this._updateBoundingInfo(!0,null))},enumerable:!0,configurable:!0}),t.CreateGeometryForMesh=function(e){var r=new t(t.RandomId(),e.getScene());return r.applyToMesh(e),r},Object.defineProperty(t.prototype,"extend",{get:function(){return this._extend},enumerable:!0,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype.getEngine=function(){return this._engine},t.prototype.isReady=function(){return this.delayLoadState===e.Engine.DELAYLOADSTATE_LOADED||this.delayLoadState===e.Engine.DELAYLOADSTATE_NONE},Object.defineProperty(t.prototype,"doNotSerialize",{get:function(){for(var e=0;e<this._meshes.length;e++)if(!this._meshes[e].doNotSerialize)return!1;return!0},enumerable:!0,configurable:!0}),t.prototype._rebuild=function(){this._vertexArrayObjects&&(this._vertexArrayObjects={}),0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices));for(var e in this._vertexBuffers){this._vertexBuffers[e]._rebuild()}},t.prototype.setAllVerticesData=function(e,t){e.applyToGeometry(this,t),this.notifyUpdate()},t.prototype.setVerticesData=function(t,r,i,n){void 0===i&&(i=!1);var o=new e.VertexBuffer(this._engine,r,t,i,0===this._meshes.length,n);this.setVerticesBuffer(o)},t.prototype.removeVerticesData=function(e){this._vertexBuffers[e]&&(this._vertexBuffers[e].dispose(),delete this._vertexBuffers[e])},t.prototype.setVerticesBuffer=function(t,r){void 0===r&&(r=null);var i=t.getKind();if(this._vertexBuffers[i]&&this._vertexBuffers[i].dispose(),this._vertexBuffers[i]=t,i===e.VertexBuffer.PositionKind){var n=t.getData();null!=r?this._totalVertices=r:null!=n&&(this._totalVertices=n.length/(t.byteStride/4)),this._updateExtend(n),this._resetPointsArrayCache();for(var o=this._meshes,s=o.length,a=0;a<s;a++){var l=o[a];l._boundingInfo=new e.BoundingInfo(this._extend.minimum,this._extend.maximum),l._createGlobalSubMesh(!1),l.computeWorldMatrix(!0)}}this.notifyUpdate(i),this._vertexArrayObjects&&(this._disposeVertexArrayObjects(),this._vertexArrayObjects={})},t.prototype.updateVerticesDataDirectly=function(e,t,r,i){void 0===i&&(i=!1);var n=this.getVertexBuffer(e);n&&(n.updateDirectly(t,r,i),this.notifyUpdate(e))},t.prototype.updateVerticesData=function(t,r,i){void 0===i&&(i=!1);var n=this.getVertexBuffer(t);n&&(n.update(r),t===e.VertexBuffer.PositionKind&&this._updateBoundingInfo(i,r),this.notifyUpdate(t))},t.prototype._updateBoundingInfo=function(t,r){t&&this._updateExtend(r);var i=this._meshes,n=i.length;this._resetPointsArrayCache();for(var o=0;o<n;o++){var s=i[o];if(t){s._boundingInfo=new e.BoundingInfo(this._extend.minimum,this._extend.maximum);for(var a=0;a<s.subMeshes.length;a++){s.subMeshes[a].refreshBoundingInfo()}}}},t.prototype._bind=function(e,t){if(e){void 0===t&&(t=this._indexBuffer);var r=this.getVertexBuffers();if(r){if(t!=this._indexBuffer||!this._vertexArrayObjects)return void this._engine.bindBuffers(r,t,e);this._vertexArrayObjects[e.key]||(this._vertexArrayObjects[e.key]=this._engine.recordVertexArrayObject(r,t,e)),this._engine.bindVertexArrayObject(this._vertexArrayObjects[e.key],t)}}},t.prototype.getTotalVertices=function(){return this.isReady()?this._totalVertices:0},t.prototype.getVerticesData=function(t,r,i){var n=this.getVertexBuffer(t);if(!n)return null;var o=n.getData();if(!o)return null;var s=n.getSize()*e.VertexBuffer.GetTypeByteLength(n.type),a=this._totalVertices*n.getSize();if(n.type!==e.VertexBuffer.FLOAT||n.byteStride!==s){var l=new Array(a);return n.forEach(a,(function(e,t){l[t]=e})),l}if(!(o instanceof Array||o instanceof Float32Array)||0!==n.byteOffset||o.length!==a){if(o instanceof Array){var u=n.byteOffset/4;return e.Tools.Slice(o,u,u+a)}return o instanceof ArrayBuffer?new Float32Array(o,n.byteOffset,a):new Float32Array(o.buffer,o.byteOffset+n.byteOffset,a)}return i||r&&1!==this._meshes.length?e.Tools.Slice(o):o},t.prototype.isVertexBufferUpdatable=function(e){var t=this._vertexBuffers[e];return!!t&&t.isUpdatable()},t.prototype.getVertexBuffer=function(e){return this.isReady()?this._vertexBuffers[e]:null},t.prototype.getVertexBuffers=function(){return this.isReady()?this._vertexBuffers:null},t.prototype.isVerticesDataPresent=function(e){return this._vertexBuffers?void 0!==this._vertexBuffers[e]:!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},t.prototype.getVerticesDataKinds=function(){var e,t=[];if(!this._vertexBuffers&&this._delayInfo)for(e in this._delayInfo)t.push(e);else for(e in this._vertexBuffers)t.push(e);return t},t.prototype.updateIndices=function(e,t){this._indexBuffer&&(this._indexBufferIsUpdatable?this._engine.updateDynamicIndexBuffer(this._indexBuffer,e,t):this.setIndices(e,null,!0))},t.prototype.setIndices=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r=!1),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._disposeVertexArrayObjects(),this._indices=e,this._indexBufferIsUpdatable=r,0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,r)),void 0!=t&&(this._totalVertices=t);for(var i=this._meshes,n=i.length,o=0;o<n;o++)i[o]._createGlobalSubMesh(!0);this.notifyUpdate()},t.prototype.getTotalIndices=function(){return this.isReady()?this._indices.length:0},t.prototype.getIndices=function(e){if(!this.isReady())return null;var t=this._indices;if(e&&1!==this._meshes.length){for(var r=t.length,i=[],n=0;n<r;n++)i.push(t[n]);return i}return t},t.prototype.getIndexBuffer=function(){return this.isReady()?this._indexBuffer:null},t.prototype._releaseVertexArrayObject=function(e){void 0===e&&(e=null),e&&this._vertexArrayObjects&&this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])},t.prototype.releaseForMesh=function(e,t){var r=this._meshes,i=r.indexOf(e);-1!==i&&(r.splice(i,1),e._geometry=null,0===r.length&&t&&this.dispose())},t.prototype.applyToMesh=function(e){if(e._geometry!==this){var t=e._geometry;t&&t.releaseForMesh(e);var r=this._meshes;e._geometry=this,this._scene.pushGeometry(this),r.push(e),this.isReady()?this._applyToMesh(e):e._boundingInfo=this._boundingInfo}},t.prototype._updateExtend=function(t){void 0===t&&(t=null),t||(t=this.getVerticesData(e.VertexBuffer.PositionKind)),this._extend=e.Tools.ExtractMinAndMax(t,0,this._totalVertices,this.boundingBias,3)},t.prototype._applyToMesh=function(t){var r=this._meshes.length;for(var i in this._vertexBuffers){1===r&&this._vertexBuffers[i].create();var n=this._vertexBuffers[i].getBuffer();n&&(n.references=r),i===e.VertexBuffer.PositionKind&&(this._extend||this._updateExtend(),t._boundingInfo=new e.BoundingInfo(this._extend.minimum,this._extend.maximum),t._createGlobalSubMesh(!1),t._updateBoundingInfo())}1===r&&this._indices&&this._indices.length>0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=r)},t.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,r=this._meshes;t<r.length;t++){r[t]._markSubMeshesAsAttributesDirty()}},t.prototype.load=function(t,r){if(this.delayLoadState!==e.Engine.DELAYLOADSTATE_LOADING){if(this.isReady())return void(r&&r());this.delayLoadState=e.Engine.DELAYLOADSTATE_LOADING,this._queueLoad(t,r)}},t.prototype._queueLoad=function(t,r){var i=this;this.delayLoadingFile&&(t._addPendingData(this),t._loadFile(this.delayLoadingFile,(function(n){if(i._delayLoadingFunction){i._delayLoadingFunction(JSON.parse(n),i),i.delayLoadState=e.Engine.DELAYLOADSTATE_LOADED,i._delayInfo=[],t._removePendingData(i);for(var o=i._meshes,s=o.length,a=0;a<s;a++)i._applyToMesh(o[a]);r&&r()}}),void 0,!0))},t.prototype.toLeftHanded=function(){var t=this.getIndices(!1);if(null!=t&&t.length>0){for(var r=0;r<t.length;r+=3){var i=t[r+0];t[r+0]=t[r+2],t[r+2]=i}this.setIndices(t)}var n=this.getVerticesData(e.VertexBuffer.PositionKind,!1);if(null!=n&&n.length>0){for(var r=0;r<n.length;r+=3)n[r+2]=-n[r+2];this.setVerticesData(e.VertexBuffer.PositionKind,n,!1)}var o=this.getVerticesData(e.VertexBuffer.NormalKind,!1);if(null!=o&&o.length>0){for(var r=0;r<o.length;r+=3)o[r+2]=-o[r+2];this.setVerticesData(e.VertexBuffer.NormalKind,o,!1)}},t.prototype._resetPointsArrayCache=function(){this._positions=null},t.prototype._generatePointsArray=function(){if(this._positions)return!0;var t=this.getVerticesData(e.VertexBuffer.PositionKind);if(!t||0===t.length)return!1;this._positions=[];for(var r=0;r<t.length;r+=3)this._positions.push(e.Vector3.FromArray(t,r));return!0},t.prototype.isDisposed=function(){return this._isDisposed},t.prototype._disposeVertexArrayObjects=function(){if(this._vertexArrayObjects){for(var e in this._vertexArrayObjects)this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e]);this._vertexArrayObjects={}}},t.prototype.dispose=function(){var t,r=this._meshes,i=r.length;for(t=0;t<i;t++)this.releaseForMesh(r[t]);this._meshes=[],this._disposeVertexArrayObjects();for(var n in this._vertexBuffers)this._vertexBuffers[n].dispose();this._vertexBuffers={},this._totalVertices=0,this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null,this._indices=[],this.delayLoadState=e.Engine.DELAYLOADSTATE_NONE,this.delayLoadingFile=null,this._delayLoadingFunction=null,this._delayInfo=[],this._boundingInfo=null,this._scene.removeGeometry(this),this._isDisposed=!0},t.prototype.copy=function(r){var i=new e.VertexData;i.indices=[];var n=this.getIndices();if(n)for(var o=0;o<n.length;o++)i.indices.push(n[o]);var s,a=!1,l=!1;for(s in this._vertexBuffers){var u=this.getVerticesData(s);if(u instanceof Float32Array?i.set(new Float32Array(u),s):i.set(u.slice(0),s),!l){var h=this.getVertexBuffer(s);h&&(a=h.isUpdatable(),l=!a)}}var c=new t(r,this._scene,i,a);c.delayLoadState=this.delayLoadState,c.delayLoadingFile=this.delayLoadingFile,c._delayLoadingFunction=this._delayLoadingFunction;for(s in this._delayInfo)c._delayInfo=c._delayInfo||[],c._delayInfo.push(s);return c._boundingInfo=new e.BoundingInfo(this._extend.minimum,this._extend.maximum),c},t.prototype.serialize=function(){var t={};return t.id=this.id,t.updatable=this._updatable,e.Tags&&e.Tags.HasTags(this)&&(t.tags=e.Tags.GetTags(this)),t},t.prototype.toNumberArray=function(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)},t.prototype.serializeVerticeData=function(){var t=this.serialize();return this.isVerticesDataPresent(e.VertexBuffer.PositionKind)&&(t.positions=this.toNumberArray(this.getVerticesData(e.VertexBuffer.PositionKind)),this.isVertexBufferUpdatable(e.VertexBuffer.PositionKind)&&(t.positions._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.NormalKind)&&(t.normals=this.toNumberArray(this.getVerticesData(e.VertexBuffer.NormalKind)),this.isVertexBufferUpdatable(e.VertexBuffer.NormalKind)&&(t.normals._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.TangentKind)&&(t.tangets=this.toNumberArray(this.getVerticesData(e.VertexBuffer.TangentKind)),this.isVertexBufferUpdatable(e.VertexBuffer.TangentKind)&&(t.tangets._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UVKind)&&(t.uvs=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UVKind)),this.isVertexBufferUpdatable(e.VertexBuffer.UVKind)&&(t.uvs._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UV2Kind)&&(t.uv2s=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UV2Kind)),this.isVertexBufferUpdatable(e.VertexBuffer.UV2Kind)&&(t.uv2s._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UV3Kind)&&(t.uv3s=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UV3Kind)),this.isVertexBufferUpdatable(e.VertexBuffer.UV3Kind)&&(t.uv3s._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UV4Kind)&&(t.uv4s=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UV4Kind)),this.isVertexBufferUpdatable(e.VertexBuffer.UV4Kind)&&(t.uv4s._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UV5Kind)&&(t.uv5s=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UV5Kind)),this.isVertexBufferUpdatable(e.VertexBuffer.UV5Kind)&&(t.uv5s._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.UV6Kind)&&(t.uv6s=this.toNumberArray(this.getVerticesData(e.VertexBuffer.UV6Kind)),this.isVertexBufferUpdatable(e.VertexBuffer.UV6Kind)&&(t.uv6s._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.ColorKind)&&(t.colors=this.toNumberArray(this.getVerticesData(e.VertexBuffer.ColorKind)),this.isVertexBufferUpdatable(e.VertexBuffer.ColorKind)&&(t.colors._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.MatricesIndicesKind)&&(t.matricesIndices=this.toNumberArray(this.getVerticesData(e.VertexBuffer.MatricesIndicesKind)),t.matricesIndices._isExpanded=!0,this.isVertexBufferUpdatable(e.VertexBuffer.MatricesIndicesKind)&&(t.matricesIndices._updatable=!0)),this.isVerticesDataPresent(e.VertexBuffer.MatricesWeightsKind)&&(t.matricesWeights=this.toNumberArray(this.getVerticesData(e.VertexBuffer.MatricesWeightsKind)),this.isVertexBufferUpdatable(e.VertexBuffer.MatricesWeightsKind)&&(t.matricesWeights._updatable=!0)),t.indices=this.toNumberArray(this.getIndices()),t},t.ExtractFromMesh=function(e,t){var r=e._geometry;return r?r.copy(t):null},t.RandomId=function(){return e.Tools.RandomId()},t._ImportGeometry=function(r,i){var n=i.getScene(),o=r.geometryId;if(o){var s=n.getGeometryByID(o);s&&s.applyToMesh(i)}else if(r instanceof ArrayBuffer){var a=i._binaryInfo;if(a.positionsAttrDesc&&a.positionsAttrDesc.count>0){var l=new Float32Array(r,a.positionsAttrDesc.offset,a.positionsAttrDesc.count);i.setVerticesData(e.VertexBuffer.PositionKind,l,!1)}if(a.normalsAttrDesc&&a.normalsAttrDesc.count>0){var u=new Float32Array(r,a.normalsAttrDesc.offset,a.normalsAttrDesc.count);i.setVerticesData(e.VertexBuffer.NormalKind,u,!1)}if(a.tangetsAttrDesc&&a.tangetsAttrDesc.count>0){var h=new Float32Array(r,a.tangetsAttrDesc.offset,a.tangetsAttrDesc.count);i.setVerticesData(e.VertexBuffer.TangentKind,h,!1)}if(a.uvsAttrDesc&&a.uvsAttrDesc.count>0){var c=new Float32Array(r,a.uvsAttrDesc.offset,a.uvsAttrDesc.count);i.setVerticesData(e.VertexBuffer.UVKind,c,!1)}if(a.uvs2AttrDesc&&a.uvs2AttrDesc.count>0){var f=new Float32Array(r,a.uvs2AttrDesc.offset,a.uvs2AttrDesc.count);i.setVerticesData(e.VertexBuffer.UV2Kind,f,!1)}if(a.uvs3AttrDesc&&a.uvs3AttrDesc.count>0){var d=new Float32Array(r,a.uvs3AttrDesc.offset,a.uvs3AttrDesc.count);i.setVerticesData(e.VertexBuffer.UV3Kind,d,!1)}if(a.uvs4AttrDesc&&a.uvs4AttrDesc.count>0){var p=new Float32Array(r,a.uvs4AttrDesc.offset,a.uvs4AttrDesc.count);i.setVerticesData(e.VertexBuffer.UV4Kind,p,!1)}if(a.uvs5AttrDesc&&a.uvs5AttrDesc.count>0){var A=new Float32Array(r,a.uvs5AttrDesc.offset,a.uvs5AttrDesc.count);i.setVerticesData(e.VertexBuffer.UV5Kind,A,!1)}if(a.uvs6AttrDesc&&a.uvs6AttrDesc.count>0){var m=new Float32Array(r,a.uvs6AttrDesc.offset,a.uvs6AttrDesc.count);i.setVerticesData(e.VertexBuffer.UV6Kind,m,!1)}if(a.colorsAttrDesc&&a.colorsAttrDesc.count>0){var g=new Float32Array(r,a.colorsAttrDesc.offset,a.colorsAttrDesc.count)
- ;i.setVerticesData(e.VertexBuffer.ColorKind,g,!1,a.colorsAttrDesc.stride)}if(a.matricesIndicesAttrDesc&&a.matricesIndicesAttrDesc.count>0){var _=new Int32Array(r,a.matricesIndicesAttrDesc.offset,a.matricesIndicesAttrDesc.count);i.setVerticesData(e.VertexBuffer.MatricesIndicesKind,_,!1)}if(a.matricesWeightsAttrDesc&&a.matricesWeightsAttrDesc.count>0){var v=new Float32Array(r,a.matricesWeightsAttrDesc.offset,a.matricesWeightsAttrDesc.count);i.setVerticesData(e.VertexBuffer.MatricesWeightsKind,v,!1)}if(a.indicesAttrDesc&&a.indicesAttrDesc.count>0){var y=new Int32Array(r,a.indicesAttrDesc.offset,a.indicesAttrDesc.count);i.setIndices(y,null)}if(a.subMeshesAttrDesc&&a.subMeshesAttrDesc.count>0){var b=new Int32Array(r,a.subMeshesAttrDesc.offset,5*a.subMeshesAttrDesc.count);i.subMeshes=[];for(var E=0;E<a.subMeshesAttrDesc.count;E++){var T=b[5*E+0],x=b[5*E+1],M=b[5*E+2],C=b[5*E+3],P=b[5*E+4];e.SubMesh.AddToMesh(T,x,M,C,P,i)}}}else if(r.positions&&r.normals&&r.indices){if(i.setVerticesData(e.VertexBuffer.PositionKind,r.positions,r.positions._updatable),i.setVerticesData(e.VertexBuffer.NormalKind,r.normals,r.normals._updatable),r.tangents&&i.setVerticesData(e.VertexBuffer.TangentKind,r.tangents,r.tangents._updatable),r.uvs&&i.setVerticesData(e.VertexBuffer.UVKind,r.uvs,r.uvs._updatable),r.uvs2&&i.setVerticesData(e.VertexBuffer.UV2Kind,r.uvs2,r.uvs2._updatable),r.uvs3&&i.setVerticesData(e.VertexBuffer.UV3Kind,r.uvs3,r.uvs3._updatable),r.uvs4&&i.setVerticesData(e.VertexBuffer.UV4Kind,r.uvs4,r.uvs4._updatable),r.uvs5&&i.setVerticesData(e.VertexBuffer.UV5Kind,r.uvs5,r.uvs5._updatable),r.uvs6&&i.setVerticesData(e.VertexBuffer.UV6Kind,r.uvs6,r.uvs6._updatable),r.colors&&i.setVerticesData(e.VertexBuffer.ColorKind,e.Color4.CheckColors4(r.colors,r.positions.length/3),r.colors._updatable),r.matricesIndices)if(r.matricesIndices._isExpanded)delete r.matricesIndices._isExpanded,i.setVerticesData(e.VertexBuffer.MatricesIndicesKind,r.matricesIndices,r.matricesIndices._updatable);else{for(var S=[],E=0;E<r.matricesIndices.length;E++){var R=r.matricesIndices[E];S.push(255&R),S.push((65280&R)>>8),S.push((16711680&R)>>16),S.push(R>>24)}i.setVerticesData(e.VertexBuffer.MatricesIndicesKind,S,r.matricesIndices._updatable)}if(r.matricesIndicesExtra)if(r.matricesIndicesExtra._isExpanded)delete r.matricesIndices._isExpanded,i.setVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,r.matricesIndicesExtra,r.matricesIndicesExtra._updatable);else{for(var S=[],E=0;E<r.matricesIndicesExtra.length;E++){var R=r.matricesIndicesExtra[E];S.push(255&R),S.push((65280&R)>>8),S.push((16711680&R)>>16),S.push(R>>24)}i.setVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,S,r.matricesIndicesExtra._updatable)}r.matricesWeights&&(t._CleanMatricesWeights(r,i),i.setVerticesData(e.VertexBuffer.MatricesWeightsKind,r.matricesWeights,r.matricesWeights._updatable)),r.matricesWeightsExtra&&i.setVerticesData(e.VertexBuffer.MatricesWeightsExtraKind,r.matricesWeightsExtra,r.matricesWeights._updatable),i.setIndices(r.indices,null)}if(r.subMeshes){i.subMeshes=[];for(var O=0;O<r.subMeshes.length;O++){var D=r.subMeshes[O];e.SubMesh.AddToMesh(D.materialIndex,D.verticesStart,D.verticesCount,D.indexStart,D.indexCount,i)}}i._shouldGenerateFlatShading&&(i.convertToFlatShadedMesh(),delete i._shouldGenerateFlatShading),i.computeWorldMatrix(!0);var w=n.selectionOctree;void 0!==w&&null!==w&&w.addMesh(i)},t._CleanMatricesWeights=function(t,r){if(e.SceneLoader.CleanBoneMatrixWeights){var i=0;if(t.skeletonId>-1){var n=r.getScene().getLastSkeletonByID(t.skeletonId);if(n){i=n.bones.length;for(var o=r.getVerticesData(e.VertexBuffer.MatricesIndicesKind),s=r.getVerticesData(e.VertexBuffer.MatricesIndicesExtraKind),a=t.matricesWeights,l=t.matricesWeightsExtra,u=t.numBoneInfluencer,h=a.length,c=0;c<h;c+=4){for(var f=0,d=-1,p=0;p<4;p++){var A=a[c+p];f+=A,A<.001&&d<0&&(d=p)}if(l)for(var p=0;p<4;p++){var A=l[c+p];f+=A,A<.001&&d<0&&(d=p+4)}if((d<0||d>u-1)&&(d=u-1),f>.001){for(var m=1/f,p=0;p<4;p++)a[c+p]*=m;if(l)for(var p=0;p<4;p++)l[c+p]*=m}else d>=4?(l[c+d-4]=1-f,s[c+d-4]=i):(a[c+d]=1-f,o[c+d]=i)}r.setVerticesData(e.VertexBuffer.MatricesIndicesKind,o),t.matricesWeightsExtra&&r.setVerticesData(e.VertexBuffer.MatricesIndicesExtraKind,s)}}}},t.Parse=function(r,i,n){if(i.getGeometryByID(r.id))return null;var o=new t(r.id,i,void 0,r.updatable);return e.Tags&&e.Tags.AddTagsTo(o,r.tags),r.delayLoadingFile?(o.delayLoadState=e.Engine.DELAYLOADSTATE_NOTLOADED,o.delayLoadingFile=n+r.delayLoadingFile,o._boundingInfo=new e.BoundingInfo(e.Vector3.FromArray(r.boundingBoxMinimum),e.Vector3.FromArray(r.boundingBoxMaximum)),o._delayInfo=[],r.hasUVs&&o._delayInfo.push(e.VertexBuffer.UVKind),r.hasUVs2&&o._delayInfo.push(e.VertexBuffer.UV2Kind),r.hasUVs3&&o._delayInfo.push(e.VertexBuffer.UV3Kind),r.hasUVs4&&o._delayInfo.push(e.VertexBuffer.UV4Kind),r.hasUVs5&&o._delayInfo.push(e.VertexBuffer.UV5Kind),r.hasUVs6&&o._delayInfo.push(e.VertexBuffer.UV6Kind),r.hasColors&&o._delayInfo.push(e.VertexBuffer.ColorKind),r.hasMatricesIndices&&o._delayInfo.push(e.VertexBuffer.MatricesIndicesKind),r.hasMatricesWeights&&o._delayInfo.push(e.VertexBuffer.MatricesWeightsKind),o._delayLoadingFunction=e.VertexData.ImportVertexData):e.VertexData.ImportVertexData(r,o),i.pushGeometry(o,!0),o},t})();e.Geometry=t;var r=(function(e){function t(t,r,i,n){void 0===i&&(i=!1),void 0===n&&(n=null);var o=e.call(this,t,r,void 0,!1,n)||this;return o._canBeRegenerated=i,o._beingRegenerated=!0,o.regenerate(),o._beingRegenerated=!1,o}return s(t,e),t.prototype.canBeRegenerated=function(){return this._canBeRegenerated},t.prototype.regenerate=function(){this._canBeRegenerated&&(this._beingRegenerated=!0,this.setAllVerticesData(this._regenerateVertexData(),!1),this._beingRegenerated=!1)},t.prototype.asNewGeometry=function(t){return e.prototype.copy.call(this,t)},t.prototype.setAllVerticesData=function(t,r){this._beingRegenerated&&e.prototype.setAllVerticesData.call(this,t,!1)},t.prototype.setVerticesData=function(t,r,i){this._beingRegenerated&&e.prototype.setVerticesData.call(this,t,r,!1)},t.prototype._regenerateVertexData=function(){throw new Error("Abstract method")},t.prototype.copy=function(e){throw new Error("Must be overriden in sub-classes.")},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.canBeRegenerated=this.canBeRegenerated(),t},t})(t);e._PrimitiveGeometry=r;var i=(function(t){function r(r,i,n,o,s,a,l,u,h){void 0===h&&(h=e.Mesh.DEFAULTSIDE);var c=t.call(this,r,i,l,u)||this;return c.pathArray=n,c.closeArray=o,c.closePath=s,c.offset=a,c.side=h,c}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateRibbon({pathArray:this.pathArray,closeArray:this.closeArray,closePath:this.closePath,offset:this.offset,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.pathArray,this.closeArray,this.closePath,this.offset,this.canBeRegenerated(),void 0,this.side)},r})(r);e.RibbonGeometry=i;var n=(function(t){function r(r,i,n,o,s,a){void 0===s&&(s=null),void 0===a&&(a=e.Mesh.DEFAULTSIDE);var l=t.call(this,r,i,o,s)||this;return l.size=n,l.side=a,l}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateBox({size:this.size,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.size,this.canBeRegenerated(),void 0,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.size=this.size,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.size,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.BoxGeometry=n;var o=(function(t){function r(r,i,n,o,s,a,l){void 0===a&&(a=null),void 0===l&&(l=e.Mesh.DEFAULTSIDE);var u=t.call(this,r,i,s,a)||this;return u.segments=n,u.diameter=o,u.side=l,u}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateSphere({segments:this.segments,diameter:this.diameter,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.segments,this.diameter,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.segments=this.segments,e.diameter=this.diameter,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.segments,t.diameter,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.SphereGeometry=o;var a=(function(t){function r(r,i,n,o,s,a,l){void 0===a&&(a=null),void 0===l&&(l=e.Mesh.DEFAULTSIDE);var u=t.call(this,r,i,s,a)||this;return u.radius=n,u.tessellation=o,u.side=l,u}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateDisc({radius:this.radius,tessellation:this.tessellation,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.radius,this.tessellation,this.canBeRegenerated(),null,this.side)},r})(r);e.DiscGeometry=a;var l=(function(t){function r(r,i,n,o,s,a,l,u,h,c){void 0===l&&(l=1),void 0===h&&(h=null),void 0===c&&(c=e.Mesh.DEFAULTSIDE);var f=t.call(this,r,i,u,h)||this;return f.height=n,f.diameterTop=o,f.diameterBottom=s,f.tessellation=a,f.subdivisions=l,f.side=c,f}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateCylinder({height:this.height,diameterTop:this.diameterTop,diameterBottom:this.diameterBottom,tessellation:this.tessellation,subdivisions:this.subdivisions,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.height,this.diameterTop,this.diameterBottom,this.tessellation,this.subdivisions,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.height=this.height,e.diameterTop=this.diameterTop,e.diameterBottom=this.diameterBottom,e.tessellation=this.tessellation,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.height,t.diameterTop,t.diameterBottom,t.tessellation,t.subdivisions,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.CylinderGeometry=l;var u=(function(t){function r(r,i,n,o,s,a,l,u){void 0===l&&(l=null),void 0===u&&(u=e.Mesh.DEFAULTSIDE);var h=t.call(this,r,i,a,l)||this;return h.diameter=n,h.thickness=o,h.tessellation=s,h.side=u,h}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateTorus({diameter:this.diameter,thickness:this.thickness,tessellation:this.tessellation,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.diameter,this.thickness,this.tessellation,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.diameter=this.diameter,e.thickness=this.thickness,e.tessellation=this.tessellation,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.diameter,t.thickness,t.tessellation,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.TorusGeometry=u;var h=(function(t){function r(e,r,i,n,o,s,a){void 0===a&&(a=null);var l=t.call(this,e,r,s,a)||this;return l.width=i,l.height=n,l.subdivisions=o,l}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateGround({width:this.width,height:this.height,subdivisions:this.subdivisions})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.width,this.height,this.subdivisions,this.canBeRegenerated(),null)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.width=this.width,e.height=this.height,e.subdivisions=this.subdivisions,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.width,t.height,t.subdivisions,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.GroundGeometry=h;var c=(function(t){function r(e,r,i,n,o,s,a,l,u,h){void 0===h&&(h=null);var c=t.call(this,e,r,u,h)||this;return c.xmin=i,c.zmin=n,c.xmax=o,c.zmax=s,c.subdivisions=a,c.precision=l,c}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateTiledGround({xmin:this.xmin,zmin:this.zmin,xmax:this.xmax,zmax:this.zmax,subdivisions:this.subdivisions,precision:this.precision})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.xmin,this.zmin,this.xmax,this.zmax,this.subdivisions,this.precision,this.canBeRegenerated(),null)},r})(r);e.TiledGroundGeometry=c;var f=(function(t){function r(r,i,n,o,s,a){void 0===s&&(s=null),void 0===a&&(a=e.Mesh.DEFAULTSIDE);var l=t.call(this,r,i,o,s)||this;return l.size=n,l.side=a,l}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreatePlane({size:this.size,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.size,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.size=this.size,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.size,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.PlaneGeometry=f;var d=(function(t){function r(r,i,n,o,s,a,l,u,h,c,f){void 0===c&&(c=null),void 0===f&&(f=e.Mesh.DEFAULTSIDE);var d=t.call(this,r,i,h,c)||this;return d.radius=n,d.tube=o,d.radialSegments=s,d.tubularSegments=a,d.p=l,d.q=u,d.side=f,d}return s(r,t),r.prototype._regenerateVertexData=function(){return e.VertexData.CreateTorusKnot({radius:this.radius,tube:this.tube,radialSegments:this.radialSegments,tubularSegments:this.tubularSegments,p:this.p,q:this.q,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.radius,this.tube,this.radialSegments,this.tubularSegments,this.p,this.q,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=t.prototype.serialize.call(this);return e.radius=this.radius,e.tube=this.tube,e.radialSegments=this.radialSegments,e.tubularSegments=this.tubularSegments,e.p=this.p,e.q=this.q,e},r.Parse=function(t,i){if(i.getGeometryByID(t.id))return null;var n=new r(t.id,i,t.radius,t.tube,t.radialSegments,t.tubularSegments,t.p,t.q,t.canBeRegenerated,null);return e.Tags&&e.Tags.AddTagsTo(n,t.tags),i.pushGeometry(n,!0),n},r})(r);e.TorusKnotGeometry=d})(n||(n={}));var n;!(function(e){var t=(function(){function t(e){this._vertexBuffers={},this._scene=e}return t.prototype._prepareBuffers=function(){if(!this._vertexBuffers[e.VertexBuffer.PositionKind]){var t=[];t.push(1,1),t.push(-1,1),t.push(-1,-1),t.push(1,-1),this._vertexBuffers[e.VertexBuffer.PositionKind]=new e.VertexBuffer(this._scene.getEngine(),t,e.VertexBuffer.PositionKind,!1,!1,2),this._buildIndexBuffer()}},t.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},t.prototype._rebuild=function(){var t=this._vertexBuffers[e.VertexBuffer.PositionKind];t&&(t._rebuild(),this._buildIndexBuffer())},t.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var r=this._scene.activeCamera;if(!r)return!1;var t=t||r._postProcesses.filter((function(e){return null!=e}));return!(!t||0===t.length||!this._scene.postProcessesEnabled)&&(t[0].activate(r,e,null!==t&&void 0!==t),!0)},t.prototype.directRender=function(t,r,i,n,o){void 0===r&&(r=null),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===o&&(o=0);for(var s=this._scene.getEngine(),a=0;a<t.length;a++){a<t.length-1?t[a+1].activate(this._scene.activeCamera,r):r?s.bindFramebuffer(r,n,void 0,void 0,i,void 0,o):s.restoreDefaultFramebuffer();var l=t[a],u=l.apply();u&&(l.onBeforeRenderObservable.notifyObservers(u),this._prepareBuffers(),s.bindBuffers(this._vertexBuffers,this._indexBuffer,u),s.drawElementsType(e.Material.TriangleFillMode,0,6),l.onAfterRenderObservable.notifyObservers(u))}s.setDepthBuffer(!0),s.setDepthWrite(!0)},t.prototype._finalizeFrame=function(t,r,i,n,o){void 0===o&&(o=!1);var s=this._scene.activeCamera;if(s&&(n=n||s._postProcesses.filter((function(e){return null!=e})),0!==n.length&&this._scene.postProcessesEnabled)){for(var a=this._scene.getEngine(),l=0,u=n.length;l<u;l++){var h=n[l];if(l<u-1?h._outputTexture=n[l+1].activate(s,r):r?(a.bindFramebuffer(r,i,void 0,void 0,o),h._outputTexture=r):(a.restoreDefaultFramebuffer(),h._outputTexture=null),t)break;var c=h.apply();c&&(h.onBeforeRenderObservable.notifyObservers(c),this._prepareBuffers(),a.bindBuffers(this._vertexBuffers,this._indexBuffer,c),a.drawElementsType(e.Material.TriangleFillMode,0,6),h.onAfterRenderObservable.notifyObservers(c))}a.setDepthBuffer(!0),a.setDepthWrite(!0),a.setAlphaMode(e.Engine.ALPHA_DISABLE)}},t.prototype.dispose=function(){var t=this._vertexBuffers[e.VertexBuffer.PositionKind];t&&(t.dispose(),this._vertexBuffers[e.VertexBuffer.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null)},t})();e.PostProcessManager=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new r(e)}return t.prototype.sampleFrame=function(t){if(void 0===t&&(t=e.Tools.Now),this._enabled){if(null!=this._lastFrameTimeMs){var r=t-this._lastFrameTimeMs;this._rollingFrameTime.add(r)}this._lastFrameTimeMs=t}},Object.defineProperty(t.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!0,configurable:!0}),t.prototype.enable=function(){this._enabled=!0},t.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),t.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},t})();e.PerformanceMonitor=t;var r=(function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var r=this._samples[this._pos];t=r-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(r-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e})();e.RollingAverage=r})(n||(n={}));var n;!(function(e){var t=(function(){function t(){this.colorCurves=new e.ColorCurves,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._contrast=1,this.vignetteStretch=0,this.vignetteCentreX=0,this.vignetteCentreY=0,this.vignetteWeight=1.5,this.vignetteColor=new e.Color4(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=t.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new e.Observable}return Object.defineProperty(t.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),t.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},t.prototype.getClassName=function(){return"ImageProcessingConfiguration"},t.PrepareUniforms=function(t,r){r.EXPOSURE&&t.push("exposureLinear"),r.CONTRAST&&t.push("contrast"),r.COLORGRADING&&t.push("colorTransformSettings"),r.VIGNETTE&&(t.push("vInverseScreenSize"),t.push("vignetteSettings1"),t.push("vignetteSettings2")),r.COLORCURVES&&e.ColorCurves.PrepareUniforms(t)},t.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},t.prototype.prepareDefines=function(e,r){if(void 0===r&&(r=!1),r!==this.applyByPostProcess||!this._isEnabled)return e.VIGNETTE=!1,e.TONEMAPPING=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.IMAGEPROCESSING=!1,void(e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===t._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,e.TONEMAPPING=this.toneMappingEnabled,e.CONTRAST=1!==this.contrast,e.EXPOSURE=1!==this.exposure,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.IMAGEPROCESSING=e.VIGNETTE||e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING},t.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},t.prototype.bind=function(t,r){if(void 0===r&&(r=1),this._colorCurvesEnabled&&this.colorCurves&&e.ColorCurves.Bind(this.colorCurves,t),this._vignetteEnabled){var i=1/t.getEngine().getRenderWidth(),n=1/t.getEngine().getRenderHeight();t.setFloat2("vInverseScreenSize",i,n);var o=Math.tan(.5*this.vignetteCameraFov),s=o*r,a=Math.sqrt(s*o);s=e.Tools.Mix(s,a,this.vignetteStretch),o=e.Tools.Mix(o,a,this.vignetteStretch),t.setFloat4("vignetteSettings1",s,o,-s*this.vignetteCentreX,-o*this.vignetteCentreY);var l=-2*this.vignetteWeight;t.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,l)}if(t.setFloat("exposureLinear",this.exposure),t.setFloat("contrast",this.contrast),this.colorGradingTexture){t.setTexture("txColorTransform",this.colorGradingTexture);var u=this.colorGradingTexture.getSize().height;t.setFloat4("colorTransformSettings",(u-1)/u,.5/u,u,this.colorGradingTexture.level)}},t.prototype.clone=function(){return e.SerializationHelper.Clone((function(){return new t}),this)},t.prototype.serialize=function(){return e.SerializationHelper.Serialize(this)},t.Parse=function(r){return e.SerializationHelper.Parse((function(){return new t}),r,null,null)},Object.defineProperty(t,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!0,configurable:!0}),Object.defineProperty(t,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!0,configurable:!0}),t._VIGNETTEMODE_MULTIPLY=0,t._VIGNETTEMODE_OPAQUE=1,o([e.serializeAsColorCurves()],t.prototype,"colorCurves",void 0),o([e.serialize()],t.prototype,"_colorCurvesEnabled",void 0),o([e.serializeAsTexture()],t.prototype,"colorGradingTexture",void 0),o([e.serialize()],t.prototype,"_colorGradingEnabled",void 0),o([e.serialize()],t.prototype,"_colorGradingWithGreenDepth",void 0),o([e.serialize()],t.prototype,"_colorGradingBGR",void 0),o([e.serialize()],t.prototype,"_exposure",void 0),o([e.serialize()],t.prototype,"_toneMappingEnabled",void 0),o([e.serialize()],t.prototype,"_contrast",void 0),o([e.serialize()],t.prototype,"vignetteStretch",void 0),o([e.serialize()],t.prototype,"vignetteCentreX",void 0),o([e.serialize()],t.prototype,"vignetteCentreY",void 0),o([e.serialize()],t.prototype,"vignetteWeight",void 0),o([e.serializeAsColor4()],t.prototype,"vignetteColor",void 0),o([e.serialize()],t.prototype,"vignetteCameraFov",void 0),o([e.serialize()],t.prototype,"_vignetteBlendMode",void 0),o([e.serialize()],t.prototype,"_vignetteEnabled",void 0),o([e.serialize()],t.prototype,"_applyByPostProcess",void 0),o([e.serialize()],t.prototype,"_isEnabled",void 0),t})();e.ImageProcessingConfiguration=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i){var n=t.call(this,i)||this;return r?(n._engine=i.getEngine(),n._textureMatrix=e.Matrix.Identity(),n.name=r,n.url=r,n.hasAlpha=!1,n.isCube=!1,n.is3D=n._engine.webGLVersion>1,n.wrapU=e.Texture.CLAMP_ADDRESSMODE,n.wrapV=e.Texture.CLAMP_ADDRESSMODE,n.wrapR=e.Texture.CLAMP_ADDRESSMODE,n.anisotropicFilteringLevel=1,n._texture=n._getFromCache(r,!0),n._texture||(i.useDelayedTextureLoading?n.delayLoadState=e.Engine.DELAYLOADSTATE_NOTLOADED:n.loadTexture()),n):n}return s(r,t),r.prototype.getTextureMatrix=function(){return this._textureMatrix},r.prototype.load3dlTexture=function(){var t,i=this._engine;t=1===i.webGLVersion?i.createRawTexture(null,1,1,e.Engine.TEXTUREFORMAT_RGBA,!1,!1,e.Texture.BILINEAR_SAMPLINGMODE):i.createRawTexture3D(null,1,1,1,e.Engine.TEXTUREFORMAT_RGBA,!1,!1,e.Texture.BILINEAR_SAMPLINGMODE),this._texture=t;var n=function(n){if("string"==typeof n){for(var o,s=null,a=null,l=n.split("\n"),u=0,h=0,c=0,f=0,d=0,p=0;p<l.length;p++)if(o=l[p],r._noneEmptyLineRegex.test(o)&&0!==o.indexOf("#")){var A=o.split(" ");if(0!==u){if(0!=u){var m=Math.max(parseInt(A[0]),0),g=Math.max(parseInt(A[1]),0),_=Math.max(parseInt(A[2]),0);d=Math.max(m,d),d=Math.max(g,d),d=Math.max(_,d);var v=4*(h+f*u+c*u*u);a&&(a[v+0]=m,a[v+1]=g,a[v+2]=_),f++,f%u==0&&(c++,f=0,c%u==0&&(h++,c=0))}}else u=A.length,s=new Uint8Array(u*u*u*4),a=new Float32Array(u*u*u*4)}if(a&&s)for(var p=0;p<a.length;p++)if(p>0&&(p+1)%4==0)s[p]=255;else{var y=a[p];s[p]=y/d*255}t.is3D?(t.updateSize(u,u,u),i.updateRawTexture3D(t,s,e.Engine.TEXTUREFORMAT_RGBA,!1)):(t.updateSize(u*u,u),i.updateRawTexture(t,s,e.Engine.TEXTUREFORMAT_RGBA,!1))}},o=this.getScene();return o?o._loadFile(this.url,n):this._engine._loadFile(this.url,n),this._texture},r.prototype.loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this.load3dlTexture()},r.prototype.clone=function(){var e=new r(this.url,this.getScene());return e.level=this.level,e},r.prototype.delayLoad=function(){this.delayLoadState===e.Engine.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=e.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this.loadTexture())},r.Parse=function(e,t,i){var n=null;return e.name&&!e.isRenderTarget&&(n=new r(e.name,t),n.name=e.name,n.level=e.level),n},r.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},r._noneEmptyLineRegex=/\S+/,r})(e.BaseTexture);e.ColorGradingTexture=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){this._dirty=!0,this._tempColor=new e.Color4(0,0,0,0),this._globalCurve=new e.Color4(0,0,0,0),this._highlightsCurve=new e.Color4(0,0,0,0),this._midtonesCurve=new e.Color4(0,0,0,0),this._shadowsCurve=new e.Color4(0,0,0,0),this._positiveCurve=new e.Color4(0,0,0,0),this._negativeCurve=new e.Color4(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}return Object.defineProperty(t.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},
- enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"ColorCurves"},t.Bind=function(e,t,r,i,n){void 0===r&&(r="vCameraColorCurvePositive"),void 0===i&&(i="vCameraColorCurveNeutral"),void 0===n&&(n="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e.getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e.getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e.getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e.getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(r,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(i,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(n,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},t.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},t.prototype.getColorGradingDataToRef=function(e,r,i,n,o){null!=e&&(e=t.clamp(e,0,360),r=t.clamp(r,-100,100),i=t.clamp(i,-100,100),n=t.clamp(n,-100,100),r=t.applyColorGradingSliderNonlinear(r),r*=.5,n=t.applyColorGradingSliderNonlinear(n),r<0&&(r*=-1,e=(e+180)%360),t.fromHSBToRef(e,r,50+.25*n,o),o.scaleToRef(2,o),o.a=1+.01*i)},t.applyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100},t.fromHSBToRef=function(e,r,i,n){var o=t.clamp(e,0,360),s=t.clamp(r/100,0,1),a=t.clamp(i/100,0,1);if(0===s)n.r=a,n.g=a,n.b=a;else{o/=60;var l=Math.floor(o),u=o-l,h=a*(1-s),c=a*(1-s*u),f=a*(1-s*(1-u));switch(l){case 0:n.r=a,n.g=f,n.b=h;break;case 1:n.r=c,n.g=a,n.b=h;break;case 2:n.r=h,n.g=a,n.b=f;break;case 3:n.r=h,n.g=c,n.b=a;break;case 4:n.r=f,n.g=h,n.b=a;break;default:n.r=a,n.g=h,n.b=c}}n.a=1},t.clamp=function(e,t,r){return Math.min(Math.max(e,t),r)},t.prototype.clone=function(){return e.SerializationHelper.Clone((function(){return new t}),this)},t.prototype.serialize=function(){return e.SerializationHelper.Serialize(this)},t.Parse=function(r){return e.SerializationHelper.Parse((function(){return new t}),r,null,null)},o([e.serialize()],t.prototype,"_globalHue",void 0),o([e.serialize()],t.prototype,"_globalDensity",void 0),o([e.serialize()],t.prototype,"_globalSaturation",void 0),o([e.serialize()],t.prototype,"_globalExposure",void 0),o([e.serialize()],t.prototype,"_highlightsHue",void 0),o([e.serialize()],t.prototype,"_highlightsDensity",void 0),o([e.serialize()],t.prototype,"_highlightsSaturation",void 0),o([e.serialize()],t.prototype,"_highlightsExposure",void 0),o([e.serialize()],t.prototype,"_midtonesHue",void 0),o([e.serialize()],t.prototype,"_midtonesDensity",void 0),o([e.serialize()],t.prototype,"_midtonesSaturation",void 0),o([e.serialize()],t.prototype,"_midtonesExposure",void 0),t})();e.ColorCurves=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){}return t.BindEyePosition=function(e,t){if(t._forcedViewPosition)return void e.setVector3("vEyePosition",t._forcedViewPosition);e.setVector3("vEyePosition",t._mirroredCameraPosition?t._mirroredCameraPosition:t.activeCamera.globalPosition)},t.PrepareDefinesForMergedUV=function(e,t,r){t._needUVs=!0,t[r]=!0,e.getTextureMatrix().isIdentity(!0)?(t[r+"DIRECTUV"]=e.coordinatesIndex+1,0===e.coordinatesIndex?t.MAINUV1=!0:t.MAINUV2=!0):t[r+"DIRECTUV"]=0},t.BindTextureMatrix=function(e,t,r){var i=e.getTextureMatrix();i.isIdentity(!0)||t.updateMatrix(r+"Matrix",i)},t.PrepareDefinesForMisc=function(t,r,i,n,o,s,a){a._areMiscDirty&&(a.LOGARITHMICDEPTH=i,a.POINTSIZE=n,a.FOG=r.fogEnabled&&t.applyFog&&r.fogMode!==e.Scene.FOGMODE_NONE&&o,a.NONUNIFORMSCALING=t.nonUniformScaling,a.ALPHATEST=s)},t.PrepareDefinesForFrameBoundValues=function(e,t,r,i,n){void 0===n&&(n=null);var o=!1;null==n&&(n=void 0!==e.clipPlane&&null!==e.clipPlane),r.CLIPPLANE!==n&&(r.CLIPPLANE=n,o=!0),r.DEPTHPREPASS!==!t.getColorWrite()&&(r.DEPTHPREPASS=!r.DEPTHPREPASS,o=!0),r.INSTANCES!==i&&(r.INSTANCES=i,o=!0),o&&r.markAsUnprocessed()},t.PrepareDefinesForAttributes=function(t,r,i,n,o,s){if(void 0===o&&(o=!1),void 0===s&&(s=!0),!r._areAttributesDirty&&r._needNormals===r._normals&&r._needUVs===r._uvs)return!1;if(r._normals=r._needNormals,r._uvs=r._needUVs,r.NORMAL=r._needNormals&&t.isVerticesDataPresent(e.VertexBuffer.NormalKind),r._needNormals&&t.isVerticesDataPresent(e.VertexBuffer.TangentKind)&&(r.TANGENT=!0),r._needUVs?(r.UV1=t.isVerticesDataPresent(e.VertexBuffer.UVKind),r.UV2=t.isVerticesDataPresent(e.VertexBuffer.UV2Kind)):(r.UV1=!1,r.UV2=!1),i){var a=t.useVertexColors&&t.isVerticesDataPresent(e.VertexBuffer.ColorKind);r.VERTEXCOLOR=a,r.VERTEXALPHA=t.hasVertexAlpha&&a&&s}if(n&&(t.useBones&&t.computeBonesUsingShaders&&t.skeleton?(r.NUM_BONE_INFLUENCERS=t.numBoneInfluencers,r.BonesPerMesh=t.skeleton.bones.length+1):(r.NUM_BONE_INFLUENCERS=0,r.BonesPerMesh=0)),o){var l=t.morphTargetManager;l?(r.MORPHTARGETS_TANGENT=l.supportsTangents&&r.TANGENT,r.MORPHTARGETS_NORMAL=l.supportsNormals&&r.NORMAL,r.MORPHTARGETS=l.numInfluencers>0,r.NUM_MORPH_INFLUENCERS=l.numInfluencers):(r.MORPHTARGETS_TANGENT=!1,r.MORPHTARGETS_NORMAL=!1,r.MORPHTARGETS=!1,r.NUM_MORPH_INFLUENCERS=0)}return!0},t.PrepareDefinesForLights=function(t,r,i,n,o,s){if(void 0===o&&(o=4),void 0===s&&(s=!1),!i._areLightsDirty)return i._needNormals;var a=0,l=!1,u=!1,h=!1,c=!1,f=!1;if(t.lightsEnabled&&!s)for(var d=0,p=r._lightSources;d<p.length;d++){var A=p[d];l=!0,void 0===i["LIGHT"+a]&&(u=!0),i["LIGHT"+a]=!0,i["SPOTLIGHT"+a]=!1,i["HEMILIGHT"+a]=!1,i["POINTLIGHT"+a]=!1,i["DIRLIGHT"+a]=!1;var m;if(A.getTypeID()===e.Light.LIGHTTYPEID_SPOTLIGHT){m="SPOTLIGHT"+a;var g=A;i["PROJECTEDLIGHTTEXTURE"+a]=!!g.projectionTexture}else m=A.getTypeID()===e.Light.LIGHTTYPEID_HEMISPHERICLIGHT?"HEMILIGHT"+a:A.getTypeID()===e.Light.LIGHTTYPEID_POINTLIGHT?"POINTLIGHT"+a:"DIRLIGHT"+a;if(i[m]=!0,n&&!A.specular.equalsFloats(0,0,0)&&(f=!0),i["SHADOW"+a]=!1,i["SHADOWPCF"+a]=!1,i["SHADOWPCSS"+a]=!1,i["SHADOWPOISSON"+a]=!1,i["SHADOWESM"+a]=!1,i["SHADOWCUBE"+a]=!1,i["SHADOWLOWQUALITY"+a]=!1,i["SHADOWMEDIUMQUALITY"+a]=!1,r&&r.receiveShadows&&t.shadowsEnabled&&A.shadowEnabled){var _=A.getShadowGenerator();_&&(c=!0,_.prepareDefines(i,a))}if(A.lightmapMode!=e.Light.LIGHTMAP_DEFAULT?(h=!0,i["LIGHTMAPEXCLUDED"+a]=!0,i["LIGHTMAPNOSPECULAR"+a]=A.lightmapMode==e.Light.LIGHTMAP_SHADOWSONLY):(i["LIGHTMAPEXCLUDED"+a]=!1,i["LIGHTMAPNOSPECULAR"+a]=!1),++a===o)break}i.SPECULARTERM=f,i.SHADOWS=c;for(var v=a;v<o;v++)void 0!==i["LIGHT"+v]&&(i["LIGHT"+v]=!1,i["HEMILIGHT"+a]=!1,i["POINTLIGHT"+a]=!1,i["DIRLIGHT"+a]=!1,i["SPOTLIGHT"+a]=!1,i["SHADOW"+a]=!1);var y=t.getEngine().getCaps();return void 0===i.SHADOWFLOAT&&(u=!0),i.SHADOWFLOAT=c&&(y.textureFloatRender&&y.textureFloatLinearFiltering||y.textureHalfFloatRender&&y.textureHalfFloatLinearFiltering),i.LIGHTMAPEXCLUDED=h,u&&i.rebuild(),l},t.PrepareUniformsAndSamplersList=function(e,t,r,i){void 0===i&&(i=4);var n,o=null;if(e.uniformsNames){var s=e;n=s.uniformsNames,o=s.uniformBuffersNames,t=s.samplers,r=s.defines,i=s.maxSimultaneousLights}else n=e,t||(t=[]);for(var a=0;a<i&&r["LIGHT"+a];a++)n.push("vLightData"+a,"vLightDiffuse"+a,"vLightSpecular"+a,"vLightDirection"+a,"vLightGround"+a,"lightMatrix"+a,"shadowsInfo"+a,"depthValues"+a),o&&o.push("Light"+a),t.push("shadowSampler"+a),t.push("depthSampler"+a),r["PROJECTEDLIGHTTEXTURE"+a]&&(t.push("projectionLightSampler"+a),n.push("textureProjectionMatrix"+a));r.NUM_MORPH_INFLUENCERS&&n.push("morphTargetInfluences")},t.HandleFallbacksForShadows=function(e,t,r,i){void 0===r&&(r=4),void 0===i&&(i=0);for(var n=0,o=0;o<r&&e["LIGHT"+o];o++)o>0&&(n=i+o,t.addFallback(n,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(i,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(i,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(i,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(i,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(i,"SHADOWESM"+o));return n++},t.PrepareAttributesForMorphTargets=function(t,r,i){var n=i.NUM_MORPH_INFLUENCERS;if(n>0&&e.Engine.LastCreatedEngine)for(var o=e.Engine.LastCreatedEngine.getCaps().maxVertexAttribs,s=r.morphTargetManager,a=s&&s.supportsNormals&&i.NORMAL,l=s&&s.supportsTangents&&i.TANGENT,u=0;u<n;u++)t.push(e.VertexBuffer.PositionKind+u),a&&t.push(e.VertexBuffer.NormalKind+u),l&&t.push(e.VertexBuffer.TangentKind+u),t.length>o&&e.Tools.Error("Cannot add more vertex attributes for mesh "+r.name)},t.PrepareAttributesForBones=function(t,r,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,r),t.push(e.VertexBuffer.MatricesIndicesKind),t.push(e.VertexBuffer.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(t.push(e.VertexBuffer.MatricesIndicesExtraKind),t.push(e.VertexBuffer.MatricesWeightsExtraKind)))},t.PrepareAttributesForInstances=function(e,t){t.INSTANCES&&(e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"))},t.BindLightShadow=function(e,t,r,i,n){if(e.shadowEnabled&&r.receiveShadows){var o=e.getShadowGenerator();o&&o.bindShadowLight(i,n)}},t.BindLightProperties=function(e,t,r){e.transferToEffect(t,r+"")},t.BindLights=function(r,i,n,o,s,a){void 0===s&&(s=4),void 0===a&&(a=!1);for(var l=Math.min(i._lightSources.length,s),u=0;u<l;u++){var h=i._lightSources[u],c=u.toString(),f=h.getScaledIntensity();h._uniformBuffer.bindToEffect(n,"Light"+u),t.BindLightProperties(h,n,u),h.diffuse.scaleToRef(f,e.Tmp.Color3[0]),h._uniformBuffer.updateColor4("vLightDiffuse",e.Tmp.Color3[0],a?h.radius:h.range,c),o.SPECULARTERM&&(h.specular.scaleToRef(f,e.Tmp.Color3[1]),h._uniformBuffer.updateColor3("vLightSpecular",e.Tmp.Color3[1],c)),r.shadowsEnabled&&this.BindLightShadow(h,r,i,c,n),h._uniformBuffer.update()}},t.BindFogParameters=function(t,r,i){t.fogEnabled&&r.applyFog&&t.fogMode!==e.Scene.FOGMODE_NONE&&(i.setFloat4("vFogInfos",t.fogMode,t.fogStart,t.fogEnd,t.fogDensity),i.setColor3("vFogColor",t.fogColor))},t.BindBonesParameters=function(e,t){if(t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)){var r=e.skeleton.getTransformMatrices(e);r&&t.setMatrices("mBones",r)}},t.BindMorphTargetParameters=function(e,t){var r=e.morphTargetManager;e&&r&&t.setFloatArray("morphTargetInfluences",r.influences)},t.BindLogDepth=function(e,t,r){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(r.activeCamera.maxZ+1)/Math.LN2))},t.BindClipPlane=function(e,t){if(t.clipPlane){var r=t.clipPlane;e.setFloat4("vClipPlane",r.normal.x,r.normal.y,r.normal.z,r.d)}},t})();e.MaterialHelper=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i){var n=t.call(this,r,i)||this;return n._normalMatrix=new e.Matrix,n.storeEffectOnSubMeshes=!0,n}return s(r,t),r.prototype.getEffect=function(){return this._activeEffect},r.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},r.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},r.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},r.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},r.prototype._afterBind=function(e,r){void 0===r&&(r=null),t.prototype._afterBind.call(this,e),this.getScene()._cachedEffect=r},r.prototype._mustRebind=function(e,t,r){return void 0===r&&(r=1),e.isCachedMaterialInvalid(this,t,r)},r})(e.Material);e.PushMaterial=t})(n||(n={}));var n;!(function(e){var t=(function(e){function t(){var t=e.call(this)||this;return t.MAINUV1=!1,t.MAINUV2=!1,t.DIFFUSE=!1,t.DIFFUSEDIRECTUV=0,t.AMBIENT=!1,t.AMBIENTDIRECTUV=0,t.OPACITY=!1,t.OPACITYDIRECTUV=0,t.OPACITYRGB=!1,t.REFLECTION=!1,t.EMISSIVE=!1,t.EMISSIVEDIRECTUV=0,t.SPECULAR=!1,t.SPECULARDIRECTUV=0,t.BUMP=!1,t.BUMPDIRECTUV=0,t.PARALLAX=!1,t.PARALLAXOCCLUSION=!1,t.SPECULAROVERALPHA=!1,t.CLIPPLANE=!1,t.ALPHATEST=!1,t.DEPTHPREPASS=!1,t.ALPHAFROMDIFFUSE=!1,t.POINTSIZE=!1,t.FOG=!1,t.SPECULARTERM=!1,t.DIFFUSEFRESNEL=!1,t.OPACITYFRESNEL=!1,t.REFLECTIONFRESNEL=!1,t.REFRACTIONFRESNEL=!1,t.EMISSIVEFRESNEL=!1,t.FRESNEL=!1,t.NORMAL=!1,t.UV1=!1,t.UV2=!1,t.VERTEXCOLOR=!1,t.VERTEXALPHA=!1,t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0,t.INSTANCES=!1,t.GLOSSINESS=!1,t.ROUGHNESS=!1,t.EMISSIVEASILLUMINATION=!1,t.LINKEMISSIVEWITHDIFFUSE=!1,t.REFLECTIONFRESNELFROMSPECULAR=!1,t.LIGHTMAP=!1,t.LIGHTMAPDIRECTUV=0,t.OBJECTSPACE_NORMALMAP=!1,t.USELIGHTMAPASSHADOWMAP=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.LOGARITHMICDEPTH=!1,t.REFRACTION=!1,t.REFRACTIONMAP_3D=!1,t.REFLECTIONOVERALPHA=!1,t.TWOSIDEDLIGHTING=!1,t.SHADOWFLOAT=!1,t.MORPHTARGETS=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS_TANGENT=!1,t.NUM_MORPH_INFLUENCERS=0,t.NONUNIFORMSCALING=!1,t.PREMULTIPLYALPHA=!1,t.IMAGEPROCESSING=!1,t.VIGNETTE=!1,t.VIGNETTEBLENDMODEMULTIPLY=!1,t.VIGNETTEBLENDMODEOPAQUE=!1,t.TONEMAPPING=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.IS_REFLECTION_LINEAR=!1,t.IS_REFRACTION_LINEAR=!1,t.EXPOSURE=!1,t.rebuild(),t}return s(t,e),t.prototype.setReflectionMode=function(e){for(var t=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"],r=0,i=t;r<i.length;r++){var n=i[r];this[n]=n===e}},t})(e.MaterialDefines);e.StandardMaterialDefines=t;var r=(function(r){function i(t,n){var o=r.call(this,t,n)||this;return o.ambientColor=new e.Color3(0,0,0),o.diffuseColor=new e.Color3(1,1,1),o.specularColor=new e.Color3(1,1,1),o.emissiveColor=new e.Color3(0,0,0),o.specularPower=64,o._useAlphaFromDiffuseTexture=!1,o._useEmissiveAsIllumination=!1,o._linkEmissiveWithDiffuse=!1,o._useSpecularOverAlpha=!1,o._useReflectionOverAlpha=!1,o._disableLighting=!1,o._useObjectSpaceNormalMap=!1,o._useParallax=!1,o._useParallaxOcclusion=!1,o.parallaxScaleBias=.05,o._roughness=0,o.indexOfRefraction=.98,o.invertRefractionY=!0,o.alphaCutOff=.4,o._useLightmapAsShadowmap=!1,o._useReflectionFresnelFromSpecular=!1,o._useGlossinessFromSpecularMapAlpha=!1,o._maxSimultaneousLights=4,o._invertNormalMapX=!1,o._invertNormalMapY=!1,o._twoSidedLighting=!1,o._renderTargets=new e.SmartArray(16),o._worldViewProjectionMatrix=e.Matrix.Zero(),o._globalAmbientColor=new e.Color3(0,0,0),o._attachImageProcessingConfiguration(null),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),i.ReflectionTextureEnabled&&o._reflectionTexture&&o._reflectionTexture.isRenderTarget&&o._renderTargets.push(o._reflectionTexture),i.RefractionTextureEnabled&&o._refractionTexture&&o._refractionTexture.isRenderTarget&&o._renderTargets.push(o._refractionTexture),o._renderTargets},o}return s(i,r),Object.defineProperty(i.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),i.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(e){t._markAllSubMeshesAsImageProcessingDirty()})))},Object.defineProperty(i.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),i.prototype.getClassName=function(){return"StandardMaterial"},Object.defineProperty(i.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),i.prototype.needAlphaBlending=function(){return this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled},i.prototype.needAlphaTesting=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha},i.prototype._shouldUseAlphaFromDiffuseTexture=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture},i.prototype.getAlphaTestTexture=function(){return this._diffuseTexture},i.prototype.isReadyForSubMesh=function(r,n,o){if(void 0===o&&(o=!1),n.effect&&this.isFrozen&&this._wasPreviouslyReady&&n.effect)return!0;n._materialDefines||(n._materialDefines=new t);var s=this.getScene(),a=n._materialDefines;if(!this.checkReadyOnEveryCall&&n.effect&&a._renderId===s.getRenderId())return!0;var l=s.getEngine();if(a._needNormals=e.MaterialHelper.PrepareDefinesForLights(s,r,a,!0,this._maxSimultaneousLights,this._disableLighting),a._areTexturesDirty){if(a._needUVs=!1,a.MAINUV1=!1,a.MAINUV2=!1,s.texturesEnabled){if(this._diffuseTexture&&i.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture,a,"DIFFUSE")}else a.DIFFUSE=!1;if(this._ambientTexture&&i.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture,a,"AMBIENT")}else a.AMBIENT=!1;if(this._opacityTexture&&i.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture,a,"OPACITY"),a.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else a.OPACITY=!1;if(this._reflectionTexture&&i.ReflectionTextureEnabled){if(!this._reflectionTexture.isReadyOrNotBlocking())return!1;switch(a._needNormals=!0,a.REFLECTION=!0,a.ROUGHNESS=this._roughness>0,a.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,a.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===e.Texture.INVCUBIC_MODE,a.REFLECTIONMAP_3D=this._reflectionTexture.isCube,this._reflectionTexture.coordinatesMode){case e.Texture.EXPLICIT_MODE:a.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case e.Texture.PLANAR_MODE:a.setReflectionMode("REFLECTIONMAP_PLANAR");break;case e.Texture.PROJECTION_MODE:a.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case e.Texture.SKYBOX_MODE:a.setReflectionMode("REFLECTIONMAP_SKYBOX");break;case e.Texture.SPHERICAL_MODE:a.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case e.Texture.EQUIRECTANGULAR_MODE:a.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case e.Texture.FIXED_EQUIRECTANGULAR_MODE:a.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case e.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:a.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case e.Texture.CUBIC_MODE:case e.Texture.INVCUBIC_MODE:default:a.setReflectionMode("REFLECTIONMAP_CUBIC")}a.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else a.REFLECTION=!1;if(this._emissiveTexture&&i.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture,a,"EMISSIVE")}else a.EMISSIVE=!1;if(this._lightmapTexture&&i.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture,a,"LIGHTMAP"),a.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap}else a.LIGHTMAP=!1;if(this._specularTexture&&i.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._specularTexture,a,"SPECULAR"),a.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else a.SPECULAR=!1;if(s.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&i.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;e.MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture,a,"BUMP"),a.PARALLAX=this._useParallax,a.PARALLAXOCCLUSION=this._useParallaxOcclusion,a.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else a.BUMP=!1;if(this._refractionTexture&&i.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;a._needUVs=!0,a.REFRACTION=!0,a.REFRACTIONMAP_3D=this._refractionTexture.isCube}else a.REFRACTION=!1;a.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else a.DIFFUSE=!1,a.AMBIENT=!1,a.OPACITY=!1,a.REFLECTION=!1,a.EMISSIVE=!1,a.LIGHTMAP=!1,a.BUMP=!1,a.REFRACTION=!1;a.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),a.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,a.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,a.SPECULAROVERALPHA=this._useSpecularOverAlpha,a.PREMULTIPLYALPHA=this.alphaMode===e.Engine.ALPHA_PREMULTIPLIED||this.alphaMode===e.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF}if(a._areImageProcessingDirty){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(a),a.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,a.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(a._areFresnelDirty&&(i.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(a.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,a.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,a.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,a.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,a.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,a.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,a._needNormals=!0,a.FRESNEL=!0):a.FRESNEL=!1),e.MaterialHelper.PrepareDefinesForMisc(r,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(r),a),e.MaterialHelper.PrepareDefinesForAttributes(r,a,!0,!0,!0),e.MaterialHelper.PrepareDefinesForFrameBoundValues(s,l,a,o),a.isDirty){a.markAsProcessed(),s.resetCachedMaterial();var u=new e.EffectFallbacks;a.REFLECTION&&u.addFallback(0,"REFLECTION"),a.SPECULAR&&u.addFallback(0,"SPECULAR"),a.BUMP&&u.addFallback(0,"BUMP"),a.PARALLAX&&u.addFallback(1,"PARALLAX"),a.PARALLAXOCCLUSION&&u.addFallback(0,"PARALLAXOCCLUSION"),a.SPECULAROVERALPHA&&u.addFallback(0,"SPECULAROVERALPHA"),a.FOG&&u.addFallback(1,"FOG"),a.POINTSIZE&&u.addFallback(0,"POINTSIZE"),a.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),e.MaterialHelper.HandleFallbacksForShadows(a,u,this._maxSimultaneousLights),a.SPECULARTERM&&u.addFallback(0,"SPECULARTERM"),a.DIFFUSEFRESNEL&&u.addFallback(1,"DIFFUSEFRESNEL"),a.OPACITYFRESNEL&&u.addFallback(2,"OPACITYFRESNEL"),a.REFLECTIONFRESNEL&&u.addFallback(3,"REFLECTIONFRESNEL"),a.EMISSIVEFRESNEL&&u.addFallback(4,"EMISSIVEFRESNEL"),a.FRESNEL&&u.addFallback(4,"FRESNEL");var h=[e.VertexBuffer.PositionKind];a.NORMAL&&h.push(e.VertexBuffer.NormalKind),a.UV1&&h.push(e.VertexBuffer.UVKind),a.UV2&&h.push(e.VertexBuffer.UV2Kind),a.VERTEXCOLOR&&h.push(e.VertexBuffer.ColorKind),e.MaterialHelper.PrepareAttributesForBones(h,r,a,u),e.MaterialHelper.PrepareAttributesForInstances(h,a),e.MaterialHelper.PrepareAttributesForMorphTargets(h,r,a);var c="default",f=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff"],d=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler"],p=["Material","Scene"];e.ImageProcessingConfiguration.PrepareUniforms(f,a),e.ImageProcessingConfiguration.PrepareSamplers(d,a),e.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:p,samplers:d,defines:a,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(c=this.customShaderNameResolve(c,f,p,d,a));var A=a.toString();n.setEffect(s.getEngine().createEffect(c,{attributes:h,uniformsNames:f,uniformBuffersNames:p,samplers:d,defines:A,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:a.NUM_MORPH_INFLUENCERS}},l),a),this.buildUniformLayout()}return!(!n.effect||!n.effect.isReady())&&(a._renderId=s.getRenderId(),this._wasPreviouslyReady=!0,!0)},i.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("diffuseLeftColor",4),this._uniformBuffer.addUniform("diffuseRightColor",4),this._uniformBuffer.addUniform("opacityParts",4),this._uniformBuffer.addUniform("reflectionLeftColor",4),this._uniformBuffer.addUniform("reflectionRightColor",4),this._uniformBuffer.addUniform("refractionLeftColor",4),this._uniformBuffer.addUniform("refractionRightColor",4),this._uniformBuffer.addUniform("emissiveLeftColor",4),this._uniformBuffer.addUniform("emissiveRightColor",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vAmbientInfos",2),this._uniformBuffer.addUniform("vOpacityInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("vReflectionPosition",3),this._uniformBuffer.addUniform("vReflectionSize",3),this._uniformBuffer.addUniform("vEmissiveInfos",2),this._uniformBuffer.addUniform("vLightmapInfos",2),this._uniformBuffer.addUniform("vSpecularInfos",2),this._uniformBuffer.addUniform("vBumpInfos",3),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("ambientMatrix",16),this._uniformBuffer.addUniform("opacityMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("emissiveMatrix",16),this._uniformBuffer.addUniform("lightmapMatrix",16),this._uniformBuffer.addUniform("specularMatrix",16),this._uniformBuffer.addUniform("bumpMatrix",16),this._uniformBuffer.addUniform("vTangentSpaceParams",2),this._uniformBuffer.addUniform("refractionMatrix",16),this._uniformBuffer.addUniform("vRefractionInfos",4),this._uniformBuffer.addUniform("vSpecularColor",4),this._uniformBuffer.addUniform("vEmissiveColor",3),this._uniformBuffer.addUniform("vDiffuseColor",4),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.create()},i.prototype.unbind=function(){if(this._activeEffect){var e=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),e=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),e=!0),e&&this._markAllSubMeshesAsTexturesDirty()}r.prototype.unbind.call(this)},i.prototype.bindForSubMesh=function(t,r,n){var o=this.getScene(),s=n._materialDefines;if(s){var a=n.effect;if(a){this._activeEffect=a,this.bindOnlyWorldMatrix(t),s.OBJECTSPACE_NORMALMAP&&(t.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var l=this._mustRebind(o,a,r.visibility);if(e.MaterialHelper.BindBonesParameters(r,a),l){if(this._uniformBuffer.bindToEffect(a,"Material"),this.bindViewProjection(a),!this._uniformBuffer.useUbo||!this.isFrozen||!this._uniformBuffer.isSync){if(i.FresnelEnabled&&s.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),
- this._uniformBuffer.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&this._uniformBuffer.updateColor4("opacityParts",new e.Color3(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),this._uniformBuffer.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),this._uniformBuffer.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),this._uniformBuffer.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),o.texturesEnabled){if(this._diffuseTexture&&i.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),e.MaterialHelper.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse"),this._diffuseTexture.hasAlpha&&a.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&i.AmbientTextureEnabled&&(this._uniformBuffer.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),e.MaterialHelper.BindTextureMatrix(this._ambientTexture,this._uniformBuffer,"ambient")),this._opacityTexture&&i.OpacityTextureEnabled&&(this._uniformBuffer.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),e.MaterialHelper.BindTextureMatrix(this._opacityTexture,this._uniformBuffer,"opacity")),this._reflectionTexture&&i.ReflectionTextureEnabled&&(this._uniformBuffer.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),this._uniformBuffer.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var u=this._reflectionTexture;this._uniformBuffer.updateVector3("vReflectionPosition",u.boundingBoxPosition),this._uniformBuffer.updateVector3("vReflectionSize",u.boundingBoxSize)}if(this._emissiveTexture&&i.EmissiveTextureEnabled&&(this._uniformBuffer.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),e.MaterialHelper.BindTextureMatrix(this._emissiveTexture,this._uniformBuffer,"emissive")),this._lightmapTexture&&i.LightmapTextureEnabled&&(this._uniformBuffer.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),e.MaterialHelper.BindTextureMatrix(this._lightmapTexture,this._uniformBuffer,"lightmap")),this._specularTexture&&i.SpecularTextureEnabled&&(this._uniformBuffer.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),e.MaterialHelper.BindTextureMatrix(this._specularTexture,this._uniformBuffer,"specular")),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&i.BumpTextureEnabled&&(this._uniformBuffer.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),e.MaterialHelper.BindTextureMatrix(this._bumpTexture,this._uniformBuffer,"bump"),o._mirroredCameraPosition?this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&i.RefractionTextureEnabled){var h=1;this._refractionTexture.isCube||(this._uniformBuffer.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(h=this._refractionTexture.depth)),this._uniformBuffer.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,h,this.invertRefractionY?-1:1)}}this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),s.SPECULARTERM&&this._uniformBuffer.updateColor4("vSpecularColor",this.specularColor,this.specularPower),this._uniformBuffer.updateColor3("vEmissiveColor",this.emissiveColor),this._uniformBuffer.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha*r.visibility)}if(o.texturesEnabled&&(this._diffuseTexture&&i.DiffuseTextureEnabled&&a.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&i.AmbientTextureEnabled&&a.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&i.OpacityTextureEnabled&&a.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&i.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?a.setTexture("reflectionCubeSampler",this._reflectionTexture):a.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&i.EmissiveTextureEnabled&&a.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&i.LightmapTextureEnabled&&a.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&i.SpecularTextureEnabled&&a.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&o.getEngine().getCaps().standardDerivatives&&i.BumpTextureEnabled&&a.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&i.RefractionTextureEnabled)){var h=1;this._refractionTexture.isCube?a.setTexture("refractionCubeSampler",this._refractionTexture):a.setTexture("refraction2DSampler",this._refractionTexture)}e.MaterialHelper.BindClipPlane(a,o),o.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),e.MaterialHelper.BindEyePosition(a,o),a.setColor3("vAmbientColor",this._globalAmbientColor)}!l&&this.isFrozen||(o.lightsEnabled&&!this._disableLighting&&e.MaterialHelper.BindLights(o,r,a,s,this._maxSimultaneousLights),(o.fogEnabled&&r.applyFog&&o.fogMode!==e.Scene.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(a),e.MaterialHelper.BindFogParameters(o,r,a),s.NUM_MORPH_INFLUENCERS&&e.MaterialHelper.BindMorphTargetParameters(r,a),e.MaterialHelper.BindLogDepth(s,a,o),this._imageProcessingConfiguration.applyByPostProcess||this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(r,this._activeEffect)}}},i.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&this._ambientTexture.animations.length>0&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&this._opacityTexture.animations.length>0&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&this._reflectionTexture.animations.length>0&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&this._emissiveTexture.animations.length>0&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&this._specularTexture.animations.length>0&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&this._lightmapTexture.animations.length>0&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture),e},i.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e},i.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||(this._diffuseTexture===e||(this._ambientTexture===e||(this._opacityTexture===e||(this._reflectionTexture===e||(this._emissiveTexture===e||(this._specularTexture===e||(this._bumpTexture===e||(this._lightmapTexture===e||this._refractionTexture===e))))))))},i.prototype.dispose=function(e,t){t&&(this._diffuseTexture&&this._diffuseTexture.dispose(),this._ambientTexture&&this._ambientTexture.dispose(),this._opacityTexture&&this._opacityTexture.dispose(),this._reflectionTexture&&this._reflectionTexture.dispose(),this._emissiveTexture&&this._emissiveTexture.dispose(),this._specularTexture&&this._specularTexture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._lightmapTexture&&this._lightmapTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),r.prototype.dispose.call(this,e,t)},i.prototype.clone=function(t){var r=this,n=e.SerializationHelper.Clone((function(){return new i(t,r.getScene())}),this);return n.name=t,n.id=t,n},i.prototype.serialize=function(){return e.SerializationHelper.Serialize(this)},i.Parse=function(t,r,n){return e.SerializationHelper.Parse((function(){return new i(t.name,r)}),t,r,n)},Object.defineProperty(i,"DiffuseTextureEnabled",{get:function(){return i._DiffuseTextureEnabled},set:function(t){i._DiffuseTextureEnabled!==t&&(i._DiffuseTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"AmbientTextureEnabled",{get:function(){return i._AmbientTextureEnabled},set:function(t){i._AmbientTextureEnabled!==t&&(i._AmbientTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"OpacityTextureEnabled",{get:function(){return i._OpacityTextureEnabled},set:function(t){i._OpacityTextureEnabled!==t&&(i._OpacityTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"ReflectionTextureEnabled",{get:function(){return i._ReflectionTextureEnabled},set:function(t){i._ReflectionTextureEnabled!==t&&(i._ReflectionTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"EmissiveTextureEnabled",{get:function(){return i._EmissiveTextureEnabled},set:function(t){i._EmissiveTextureEnabled!==t&&(i._EmissiveTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"SpecularTextureEnabled",{get:function(){return i._SpecularTextureEnabled},set:function(t){i._SpecularTextureEnabled!==t&&(i._SpecularTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BumpTextureEnabled",{get:function(){return i._BumpTextureEnabled},set:function(t){i._BumpTextureEnabled!==t&&(i._BumpTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"LightmapTextureEnabled",{get:function(){return i._LightmapTextureEnabled},set:function(t){i._LightmapTextureEnabled!==t&&(i._LightmapTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"RefractionTextureEnabled",{get:function(){return i._RefractionTextureEnabled},set:function(t){i._RefractionTextureEnabled!==t&&(i._RefractionTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"ColorGradingTextureEnabled",{get:function(){return i._ColorGradingTextureEnabled},set:function(t){i._ColorGradingTextureEnabled!==t&&(i._ColorGradingTextureEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(i,"FresnelEnabled",{get:function(){return i._FresnelEnabled},set:function(t){i._FresnelEnabled!==t&&(i._FresnelEnabled=t,e.Engine.MarkAllMaterialsAsDirty(e.Material.FresnelDirtyFlag))},enumerable:!0,configurable:!0}),i._DiffuseTextureEnabled=!0,i._AmbientTextureEnabled=!0,i._OpacityTextureEnabled=!0,i._ReflectionTextureEnabled=!0,i._EmissiveTextureEnabled=!0,i._SpecularTextureEnabled=!0,i._BumpTextureEnabled=!0,i._LightmapTextureEnabled=!0,i._RefractionTextureEnabled=!0,i._ColorGradingTextureEnabled=!0,i._FresnelEnabled=!0,o([e.serializeAsTexture("diffuseTexture")],i.prototype,"_diffuseTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],i.prototype,"diffuseTexture",void 0),o([e.serializeAsTexture("ambientTexture")],i.prototype,"_ambientTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"ambientTexture",void 0),o([e.serializeAsTexture("opacityTexture")],i.prototype,"_opacityTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],i.prototype,"opacityTexture",void 0),o([e.serializeAsTexture("reflectionTexture")],i.prototype,"_reflectionTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"reflectionTexture",void 0),o([e.serializeAsTexture("emissiveTexture")],i.prototype,"_emissiveTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"emissiveTexture",void 0),o([e.serializeAsTexture("specularTexture")],i.prototype,"_specularTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"specularTexture",void 0),o([e.serializeAsTexture("bumpTexture")],i.prototype,"_bumpTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"bumpTexture",void 0),o([e.serializeAsTexture("lightmapTexture")],i.prototype,"_lightmapTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"lightmapTexture",void 0),o([e.serializeAsTexture("refractionTexture")],i.prototype,"_refractionTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"refractionTexture",void 0),o([e.serializeAsColor3("ambient")],i.prototype,"ambientColor",void 0),o([e.serializeAsColor3("diffuse")],i.prototype,"diffuseColor",void 0),o([e.serializeAsColor3("specular")],i.prototype,"specularColor",void 0),o([e.serializeAsColor3("emissive")],i.prototype,"emissiveColor",void 0),o([e.serialize()],i.prototype,"specularPower",void 0),o([e.serialize("useAlphaFromDiffuseTexture")],i.prototype,"_useAlphaFromDiffuseTexture",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useAlphaFromDiffuseTexture",void 0),o([e.serialize("useEmissiveAsIllumination")],i.prototype,"_useEmissiveAsIllumination",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useEmissiveAsIllumination",void 0),o([e.serialize("linkEmissiveWithDiffuse")],i.prototype,"_linkEmissiveWithDiffuse",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"linkEmissiveWithDiffuse",void 0),o([e.serialize("useSpecularOverAlpha")],i.prototype,"_useSpecularOverAlpha",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useSpecularOverAlpha",void 0),o([e.serialize("useReflectionOverAlpha")],i.prototype,"_useReflectionOverAlpha",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useReflectionOverAlpha",void 0),o([e.serialize("disableLighting")],i.prototype,"_disableLighting",void 0),o([e.expandToProperty("_markAllSubMeshesAsLightsDirty")],i.prototype,"disableLighting",void 0),o([e.serialize("useObjectSpaceNormalMap")],i.prototype,"_useObjectSpaceNormalMap",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useObjectSpaceNormalMap",void 0),o([e.serialize("useParallax")],i.prototype,"_useParallax",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useParallax",void 0),o([e.serialize("useParallaxOcclusion")],i.prototype,"_useParallaxOcclusion",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useParallaxOcclusion",void 0),o([e.serialize()],i.prototype,"parallaxScaleBias",void 0),o([e.serialize("roughness")],i.prototype,"_roughness",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"roughness",void 0),o([e.serialize()],i.prototype,"indexOfRefraction",void 0),o([e.serialize()],i.prototype,"invertRefractionY",void 0),o([e.serialize()],i.prototype,"alphaCutOff",void 0),o([e.serialize("useLightmapAsShadowmap")],i.prototype,"_useLightmapAsShadowmap",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useLightmapAsShadowmap",void 0),o([e.serializeAsFresnelParameters("diffuseFresnelParameters")],i.prototype,"_diffuseFresnelParameters",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelDirty")],i.prototype,"diffuseFresnelParameters",void 0),o([e.serializeAsFresnelParameters("opacityFresnelParameters")],i.prototype,"_opacityFresnelParameters",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelAndMiscDirty")],i.prototype,"opacityFresnelParameters",void 0),o([e.serializeAsFresnelParameters("reflectionFresnelParameters")],i.prototype,"_reflectionFresnelParameters",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelDirty")],i.prototype,"reflectionFresnelParameters",void 0),o([e.serializeAsFresnelParameters("refractionFresnelParameters")],i.prototype,"_refractionFresnelParameters",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelDirty")],i.prototype,"refractionFresnelParameters",void 0),o([e.serializeAsFresnelParameters("emissiveFresnelParameters")],i.prototype,"_emissiveFresnelParameters",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelDirty")],i.prototype,"emissiveFresnelParameters",void 0),o([e.serialize("useReflectionFresnelFromSpecular")],i.prototype,"_useReflectionFresnelFromSpecular",void 0),o([e.expandToProperty("_markAllSubMeshesAsFresnelDirty")],i.prototype,"useReflectionFresnelFromSpecular",void 0),o([e.serialize("useGlossinessFromSpecularMapAlpha")],i.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"useGlossinessFromSpecularMapAlpha",void 0),o([e.serialize("maxSimultaneousLights")],i.prototype,"_maxSimultaneousLights",void 0),o([e.expandToProperty("_markAllSubMeshesAsLightsDirty")],i.prototype,"maxSimultaneousLights",void 0),o([e.serialize("invertNormalMapX")],i.prototype,"_invertNormalMapX",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"invertNormalMapX",void 0),o([e.serialize("invertNormalMapY")],i.prototype,"_invertNormalMapY",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"invertNormalMapY",void 0),o([e.serialize("twoSidedLighting")],i.prototype,"_twoSidedLighting",void 0),o([e.expandToProperty("_markAllSubMeshesAsTexturesDirty")],i.prototype,"twoSidedLighting",void 0),o([e.serialize()],i.prototype,"useLogarithmicDepth",null),i})(e.PushMaterial);e.StandardMaterial=r})(n||(n={}));var n;!(function(e){e.CameraInputTypes={};var t=(function(){function t(e){this.attached={},this.camera=e,this.checkInputs=function(){}}return t.prototype.add=function(t){var r=t.getSimpleName();if(this.attached[r])return void e.Tools.Warn("camera input of type "+r+" already exists on camera");this.attached[r]=t,t.camera=this.camera,t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t))),this.attachedElement&&t.attachControl(this.attachedElement)},t.prototype.remove=function(e){for(var t in this.attached){var r=this.attached[t];r===e&&(r.detachControl(this.attachedElement),r.camera=null,delete this.attached[t],this.rebuildInputCheck())}},t.prototype.removeByType=function(e){for(var t in this.attached){var r=this.attached[t];r.getClassName()===e&&(r.detachControl(this.attachedElement),r.camera=null,delete this.attached[t],this.rebuildInputCheck())}},t.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},t.prototype.attachInput=function(e){this.attachedElement&&e.attachControl(this.attachedElement,this.noPreventDefault)},t.prototype.attachElement=function(t,r){if(void 0===r&&(r=!1),!this.attachedElement){r=!e.Camera.ForceAttachControlToAlwaysPreventDefault&&r,this.attachedElement=t,this.noPreventDefault=r;for(var i in this.attached)this.attached[i].attachControl(t,r)}},t.prototype.detachElement=function(e,t){if(void 0===t&&(t=!1),this.attachedElement===e){for(var r in this.attached)this.attached[r].detachControl(e),t&&(this.attached[r].camera=null);this.attachedElement=null}},t.prototype.rebuildInputCheck=function(){this.checkInputs=function(){};for(var e in this.attached){var t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}},t.prototype.clear=function(){this.attachedElement&&this.detachElement(this.attachedElement,!0),this.attached={},this.attachedElement=null,this.checkInputs=function(){}},t.prototype.serialize=function(t){var r={};for(var i in this.attached){var n=this.attached[i],o=e.SerializationHelper.Serialize(n);r[n.getClassName()]=o}t.inputsmgr=r},t.prototype.parse=function(t){var r=t.inputsmgr;if(r){this.clear();for(var i in r){var n=e.CameraInputTypes[i];if(n){var o=r[i],s=e.SerializationHelper.Parse((function(){return new n}),o,null);this.add(s)}}}else for(var i in this.attached){var n=e.CameraInputTypes[this.attached[i].getClassName()];if(n){var s=e.SerializationHelper.Parse((function(){return new n}),t,null);this.remove(this.attached[i]),this.add(s)}}},t})();e.CameraInputsManager=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i,n,o){void 0===o&&(o=!0);var s=t.call(this,r,i,n,o)||this;return s.cameraDirection=new e.Vector3(0,0,0),s.cameraRotation=new e.Vector2(0,0),s.rotation=new e.Vector3(0,0,0),s.speed=2,s.noRotationConstraint=!1,s.lockedTarget=null,s._currentTarget=e.Vector3.Zero(),s._viewMatrix=e.Matrix.Zero(),s._camMatrix=e.Matrix.Zero(),s._cameraTransformMatrix=e.Matrix.Zero(),s._cameraRotationMatrix=e.Matrix.Zero(),s._referencePoint=new e.Vector3(0,0,1),s._currentUpVector=new e.Vector3(0,1,0),s._transformedReferencePoint=e.Vector3.Zero(),s._globalCurrentTarget=e.Vector3.Zero(),s._globalCurrentUpVector=e.Vector3.Zero(),s}return s(r,t),r.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},r.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},r.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),t.prototype.storeState.call(this)},r.prototype._restoreStateValues=function(){return!!t.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},r.prototype._initCache=function(){t.prototype._initCache.call(this),this._cache.lockedTarget=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new e.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new e.Quaternion(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},r.prototype._updateCache=function(e){e||t.prototype._updateCache.call(this);var r=this._getLockedTargetPosition();r?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(r):this._cache.lockedTarget=r.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},r.prototype._isSynchronizedViewMatrix=function(){if(!t.prototype._isSynchronizedViewMatrix.call(this))return!1;var e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},r.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},r.prototype.setTarget=function(t){this.upVector.normalize(),e.Matrix.LookAtLHToRef(this.position,t,this.upVector,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var r=t.subtract(this.position);r.x>=0?this.rotation.y=-Math.atan(r.z/r.x)+Math.PI/2:this.rotation.y=-Math.atan(r.z/r.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&e.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},r.prototype.getTarget=function(){return this._currentTarget},r.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},r.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(e.Tmp.Matrix[0]),e.Vector3.TransformNormalToRef(this.cameraDirection,e.Tmp.Matrix[0],e.Tmp.Vector3[0]),void this.position.addInPlace(e.Tmp.Vector3[0]);this.position.addInPlace(this.cameraDirection)},r.prototype._checkInputs=function(){var r=this._decideIfNeedsToMove(),i=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(r&&this._updatePosition(),i){if(this.rotation.x+=this.cameraRotation.x,this.rotation.y+=this.cameraRotation.y,this.rotationQuaternion){this.rotation.lengthSquared()&&e.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)}if(!this.noRotationConstraint){var n=Math.PI/2*.95;this.rotation.x>n&&(this.rotation.x=n),this.rotation.x<-n&&(this.rotation.x=-n)}}r&&(Math.abs(this.cameraDirection.x)<this.speed*e.Epsilon&&(this.cameraDirection.x=0),Math.abs(this.cameraDirection.y)<this.speed*e.Epsilon&&(this.cameraDirection.y=0),Math.abs(this.cameraDirection.z)<this.speed*e.Epsilon&&(this.cameraDirection.z=0),this.cameraDirection.scaleInPlace(this.inertia)),i&&(Math.abs(this.cameraRotation.x)<this.speed*e.Epsilon&&(this.cameraRotation.x=0),Math.abs(this.cameraRotation.y)<this.speed*e.Epsilon&&(this.cameraRotation.y=0),this.cameraRotation.scaleInPlace(this.inertia)),t.prototype._checkInputs.call(this)},r.prototype._updateCameraRotationMatrix=function(){this.rotationQuaternion?this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix):e.Matrix.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this._cameraRotationMatrix),e.Vector3.TransformNormalToRef(this.upVector,this._cameraRotationMatrix,this._currentUpVector)},r.prototype._getViewMatrix=function(){return this.lockedTarget&&this.setTarget(this._getLockedTargetPosition()),this._updateCameraRotationMatrix(),e.Vector3.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),this._computeViewMatrix(this.position,this._currentTarget,this._currentUpVector),this._viewMatrix},r.prototype._computeViewMatrix=function(t,r,i){if(this.parent){var n=this.parent.getWorldMatrix();e.Vector3.TransformCoordinatesToRef(this.position,n,this._globalPosition),e.Vector3.TransformCoordinatesToRef(r,n,this._globalCurrentTarget),e.Vector3.TransformNormalToRef(i,n,this._globalCurrentUpVector),this._markSyncedWithParent()}else this._globalPosition.copyFrom(this.position),this._globalCurrentTarget.copyFrom(r),this._globalCurrentUpVector.copyFrom(i);this.getScene().useRightHandedSystem?e.Matrix.LookAtRHToRef(this._globalPosition,this._globalCurrentTarget,this._globalCurrentUpVector,this._viewMatrix):e.Matrix.LookAtLHToRef(this._globalPosition,this._globalCurrentTarget,this._globalCurrentUpVector,this._viewMatrix)},r.prototype.createRigCamera=function(t,i){if(this.cameraRigMode!==e.Camera.RIG_MODE_NONE){var n=new r(t,this.position.clone(),this.getScene());return this.cameraRigMode!==e.Camera.RIG_MODE_VR&&this.cameraRigMode!==e.Camera.RIG_MODE_WEBVR||(this.rotationQuaternion||(this.rotationQuaternion=new e.Quaternion),n._cameraRigParams={},n.rotationQuaternion=new e.Quaternion),n}return null},r.prototype._updateRigCameras=function(){var r=this._rigCameras[0],i=this._rigCameras[1];switch(this.cameraRigMode){case e.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case e.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case e.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case e.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:var n=this.cameraRigMode===e.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?1:-1,o=this.cameraRigMode===e.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?-1:1;this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle*n,r.position),this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle*o,i.position),r.setTarget(this.getTarget()),i.setTarget(this.getTarget());break;case e.Camera.RIG_MODE_VR:r.rotationQuaternion?(r.rotationQuaternion.copyFrom(this.rotationQuaternion),i.rotationQuaternion.copyFrom(this.rotationQuaternion)):(r.rotation.copyFrom(this.rotation),i.rotation.copyFrom(this.rotation)),r.position.copyFrom(this.position),i.position.copyFrom(this.position)}t.prototype._updateRigCameras.call(this)},r.prototype._getRigCamPosition=function(t,r){this._rigCamTransformMatrix||(this._rigCamTransformMatrix=new e.Matrix);var i=this.getTarget();e.Matrix.Translation(-i.x,-i.y,-i.z).multiplyToRef(e.Matrix.RotationY(t),this._rigCamTransformMatrix),this._rigCamTransformMatrix=this._rigCamTransformMatrix.multiply(e.Matrix.Translation(i.x,i.y,i.z)),e.Vector3.TransformCoordinatesToRef(this.position,this._rigCamTransformMatrix,r)},r.prototype.getClassName=function(){return"TargetCamera"},o([e.serializeAsVector3()],r.prototype,"rotation",void 0),o([e.serialize()],r.prototype,"speed",void 0),o([e.serializeAsMeshReference("lockedTargetId")],r.prototype,"lockedTarget",void 0),r})(e.Camera);e.TargetCamera=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(e){void 0===e&&(e=!0),this.touchEnabled=e,this.buttons=[0,1,2],this.angularSensibility=2e3,this.previousPosition=null}return t.prototype.attachControl=function(t,r){var i=this,n=this.camera.getEngine();this._pointerInput||(this._pointerInput=function(o,s){var a=o.event;if(!n.isInVRExclusivePointerMode&&(i.touchEnabled||"touch"!==a.pointerType)&&(o.type===e.PointerEventTypes.POINTERMOVE||-1!==i.buttons.indexOf(a.button))){var l=a.srcElement||a.target;if(o.type===e.PointerEventTypes.POINTERDOWN&&l){try{l.setPointerCapture(a.pointerId)}catch(e){}i.previousPosition={x:a.clientX,y:a.clientY},r||(a.preventDefault(),t.focus())
- }else if(o.type===e.PointerEventTypes.POINTERUP&&l){try{l.releasePointerCapture(a.pointerId)}catch(e){}i.previousPosition=null,r||a.preventDefault()}else if(o.type===e.PointerEventTypes.POINTERMOVE){if(!i.previousPosition||n.isPointerLock)return;var u=a.clientX-i.previousPosition.x;i.camera.getScene().useRightHandedSystem&&(u*=-1),i.camera.parent&&i.camera.parent._getWorldMatrixDeterminant()<0&&(u*=-1),i.camera.cameraRotation.y+=u/i.angularSensibility;var h=a.clientY-i.previousPosition.y;i.camera.cameraRotation.x+=h/i.angularSensibility,i.previousPosition={x:a.clientX,y:a.clientY},r||a.preventDefault()}}}),this._onMouseMove=function(e){if(n.isPointerLock&&!n.isInVRExclusivePointerMode){var t=e.movementX||e.mozMovementX||e.webkitMovementX||e.msMovementX||0;i.camera.getScene().useRightHandedSystem&&(t*=-1),i.camera.parent&&i.camera.parent._getWorldMatrixDeterminant()<0&&(t*=-1),i.camera.cameraRotation.y+=t/i.angularSensibility;var o=e.movementY||e.mozMovementY||e.webkitMovementY||e.msMovementY||0;i.camera.cameraRotation.x+=o/i.angularSensibility,i.previousPosition=null,r||e.preventDefault()}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,e.PointerEventTypes.POINTERDOWN|e.PointerEventTypes.POINTERUP|e.PointerEventTypes.POINTERMOVE),t.addEventListener("mousemove",this._onMouseMove,!1)},t.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._onMouseMove&&e.removeEventListener("mousemove",this._onMouseMove),this._observer=null,this._onMouseMove=null,this.previousPosition=null)},t.prototype.getClassName=function(){return"FreeCameraMouseInput"},t.prototype.getSimpleName=function(){return"mouse"},o([e.serialize()],t.prototype,"buttons",void 0),o([e.serialize()],t.prototype,"angularSensibility",void 0),t})();e.FreeCameraMouseInput=t,e.CameraInputTypes.FreeCameraMouseInput=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){this._keys=new Array,this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39]}return t.prototype.attachControl=function(t,r){var i=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){i._keys=[]})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(t){var n=t.event;if(t.type===e.KeyboardEventTypes.KEYDOWN){if(-1!==i.keysUp.indexOf(n.keyCode)||-1!==i.keysDown.indexOf(n.keyCode)||-1!==i.keysLeft.indexOf(n.keyCode)||-1!==i.keysRight.indexOf(n.keyCode)){var o=i._keys.indexOf(n.keyCode);-1===o&&i._keys.push(n.keyCode),r||n.preventDefault()}}else if(-1!==i.keysUp.indexOf(n.keyCode)||-1!==i.keysDown.indexOf(n.keyCode)||-1!==i.keysLeft.indexOf(n.keyCode)||-1!==i.keysRight.indexOf(n.keyCode)){var o=i._keys.indexOf(n.keyCode);o>=0&&i._keys.splice(o,1),r||n.preventDefault()}})))},t.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},t.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var t=this.camera,r=0;r<this._keys.length;r++){var i=this._keys[r],n=t._computeLocalCameraSpeed();-1!==this.keysLeft.indexOf(i)?t._localDirection.copyFromFloats(-n,0,0):-1!==this.keysUp.indexOf(i)?t._localDirection.copyFromFloats(0,0,n):-1!==this.keysRight.indexOf(i)?t._localDirection.copyFromFloats(n,0,0):-1!==this.keysDown.indexOf(i)&&t._localDirection.copyFromFloats(0,0,-n),t.getScene().useRightHandedSystem&&(t._localDirection.z*=-1),t.getViewMatrix().invertToRef(t._cameraTransformMatrix),e.Vector3.TransformNormalToRef(t._localDirection,t._cameraTransformMatrix,t._transformedDirection),t.cameraDirection.addInPlace(t._transformedDirection)}},t.prototype.getClassName=function(){return"FreeCameraKeyboardMoveInput"},t.prototype._onLostFocus=function(e){this._keys=[]},t.prototype.getSimpleName=function(){return"keyboard"},o([e.serialize()],t.prototype,"keysUp",void 0),o([e.serialize()],t.prototype,"keysDown",void 0),o([e.serialize()],t.prototype,"keysLeft",void 0),o([e.serialize()],t.prototype,"keysRight",void 0),t})();e.FreeCameraKeyboardMoveInput=t,e.CameraInputTypes.FreeCameraKeyboardMoveInput=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(e){return t.call(this,e)||this}return s(r,t),r.prototype.addKeyboard=function(){return this.add(new e.FreeCameraKeyboardMoveInput),this},r.prototype.addMouse=function(t){return void 0===t&&(t=!0),this.add(new e.FreeCameraMouseInput(t)),this},r.prototype.addGamepad=function(){return this.add(new e.FreeCameraGamepadInput),this},r.prototype.addDeviceOrientation=function(){return this.add(new e.FreeCameraDeviceOrientationInput),this},r.prototype.addTouch=function(){return this.add(new e.FreeCameraTouchInput),this},r.prototype.addVirtualJoystick=function(){return this.add(new e.FreeCameraVirtualJoystickInput),this},r})(e.CameraInputsManager);e.FreeCameraInputsManager=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i,n,o){void 0===o&&(o=!0);var s=t.call(this,r,i,n,o)||this;return s.ellipsoid=new e.Vector3(.5,1,.5),s.ellipsoidOffset=new e.Vector3(0,0,0),s.checkCollisions=!1,s.applyGravity=!1,s._needMoveForGravity=!1,s._oldPosition=e.Vector3.Zero(),s._diffPosition=e.Vector3.Zero(),s._newPosition=e.Vector3.Zero(),s._collisionMask=-1,s._onCollisionPositionChange=function(t,r,i){void 0===i&&(i=null),s.getScene().workerCollisions&&r.multiplyInPlace(s._collider._radius);!(function(t){s._newPosition.copyFrom(t),s._newPosition.subtractToRef(s._oldPosition,s._diffPosition),s._diffPosition.length()>e.Engine.CollisionsEpsilon&&(s.position.addInPlace(s._diffPosition),s.onCollide&&i&&s.onCollide(i))})(r)},s.inputs=new e.FreeCameraInputsManager(s),s.inputs.addKeyboard().addMouse(),s}return s(r,t),Object.defineProperty(r.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!0,configurable:!0}),r.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},r.prototype.detachControl=function(t){this.inputs.detachElement(t),this.cameraDirection=new e.Vector3(0,0,0),this.cameraRotation=new e.Vector2(0,0)},Object.defineProperty(r.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),r.prototype._collideWithWorld=function(t){var r;r=this.parent?e.Vector3.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position,r.subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset),this._collider||(this._collider=new e.Collider),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=t;this.applyGravity&&(i=t.add(this.getScene().gravity)),this.getScene().collisionCoordinator.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},r.prototype._checkInputs=function(){this._localDirection||(this._localDirection=e.Vector3.Zero(),this._transformedDirection=e.Vector3.Zero()),this.inputs.checkInputs(),t.prototype._checkInputs.call(this)},r.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},r.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):t.prototype._updatePosition.call(this)},r.prototype.dispose=function(){this.inputs.clear(),t.prototype.dispose.call(this)},r.prototype.getClassName=function(){return"FreeCamera"},o([e.serializeAsVector3()],r.prototype,"ellipsoid",void 0),o([e.serializeAsVector3()],r.prototype,"ellipsoidOffset",void 0),o([e.serialize()],r.prototype,"checkCollisions",void 0),o([e.serialize()],r.prototype,"applyGravity",void 0),r})(e.TargetCamera);e.FreeCamera=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i,n){var o=t.call(this,r,n)||this;return o.groundColor=new e.Color3(0,0,0),o.direction=i||e.Vector3.Up(),o}return s(r,t),r.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},r.prototype.getClassName=function(){return"HemisphericLight"},r.prototype.setDirectionToTarget=function(t){return this.direction=e.Vector3.Normalize(t.subtract(e.Vector3.Zero())),this.direction},r.prototype.getShadowGenerator=function(){return null},r.prototype.transferToEffect=function(t,r){var i=e.Vector3.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,r),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),r),this},r.prototype._getWorldMatrix=function(){return this._worldMatrix||(this._worldMatrix=e.Matrix.Identity()),this._worldMatrix},r.prototype.getTypeID=function(){return e.Light.LIGHTTYPEID_HEMISPHERICLIGHT},o([e.serializeAsColor3()],r.prototype,"groundColor",void 0),o([e.serializeAsVector3()],r.prototype,"direction",void 0),r})(e.Light);e.HemisphericLight=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i,n,o){var s=t.call(this,r,i)||this;return s._textures={},s._textureArrays={},s._floats={},s._ints={},s._floatsArrays={},s._colors3={},s._colors3Arrays={},s._colors4={},s._vectors2={},s._vectors3={},s._vectors4={},s._matrices={},s._matrices3x3={},s._matrices2x2={},s._vectors2Arrays={},s._vectors3Arrays={},s._cachedWorldViewMatrix=new e.Matrix,s._shaderPath=n,o.needAlphaBlending=o.needAlphaBlending||!1,o.needAlphaTesting=o.needAlphaTesting||!1,o.attributes=o.attributes||["position","normal","uv"],o.uniforms=o.uniforms||["worldViewProjection"],o.uniformBuffers=o.uniformBuffers||[],o.samplers=o.samplers||[],o.defines=o.defines||[],s._options=o,s}return s(r,t),r.prototype.getClassName=function(){return"ShaderMaterial"},r.prototype.needAlphaBlending=function(){return this._options.needAlphaBlending},r.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},r.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},r.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},r.prototype.setTextureArray=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this},r.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},r.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},r.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},r.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},r.prototype.setColor3Array=function(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},r.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},r.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},r.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},r.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},r.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},r.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},r.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},r.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},r.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},r.prototype._checkCache=function(e,t,r){return!t||(this._effect&&this._effect.defines.indexOf("#define INSTANCES"),!1)},r.prototype.isReady=function(t,r){var i=this.getScene(),n=i.getEngine();if(!this.checkReadyOnEveryCall&&this._renderId===i.getRenderId()&&this._checkCache(i,t,r))return!0;var o=[],s=[],a=new e.EffectFallbacks;r&&o.push("#define INSTANCES");for(var l=0;l<this._options.defines.length;l++)o.push(this._options.defines[l]);for(var l=0;l<this._options.attributes.length;l++)s.push(this._options.attributes[l]);t&&t.isVerticesDataPresent(e.VertexBuffer.ColorKind)&&(s.push(e.VertexBuffer.ColorKind),o.push("#define VERTEXCOLOR")),t&&t.useBones&&t.computeBonesUsingShaders&&t.skeleton?(s.push(e.VertexBuffer.MatricesIndicesKind),s.push(e.VertexBuffer.MatricesWeightsKind),t.numBoneInfluencers>4&&(s.push(e.VertexBuffer.MatricesIndicesExtraKind),s.push(e.VertexBuffer.MatricesWeightsExtraKind)),o.push("#define NUM_BONE_INFLUENCERS "+t.numBoneInfluencers),o.push("#define BonesPerMesh "+(t.skeleton.bones.length+1)),a.addCPUSkinningFallback(0,t),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones")):o.push("#define NUM_BONE_INFLUENCERS 0");for(var u in this._textures)if(!this._textures[u].isReady())return!1;t&&this._shouldTurnAlphaTestOn(t)&&o.push("#define ALPHATEST");var h=this._effect,c=o.join("\n");return this._effect=n.createEffect(this._shaderPath,{attributes:s,uniformsNames:this._options.uniforms,uniformBuffersNames:this._options.uniformBuffers,samplers:this._options.samplers,defines:c,fallbacks:a,onCompiled:this.onCompiled,onError:this.onError},n),!!this._effect.isReady()&&(h!==this._effect&&i.resetCachedMaterial(),this._renderId=i.getRenderId(),!0)},r.prototype.bindOnlyWorldMatrix=function(e){var t=this.getScene();this._effect&&(-1!==this._options.uniforms.indexOf("world")&&this._effect.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(t.getViewMatrix(),this._cachedWorldViewMatrix),this._effect.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&this._effect.setMatrix("worldViewProjection",e.multiply(t.getTransformMatrix())))},r.prototype.bind=function(t,r){if(this.bindOnlyWorldMatrix(t),this._effect&&this.getScene().getCachedMaterial()!==this){-1!==this._options.uniforms.indexOf("view")&&this._effect.setMatrix("view",this.getScene().getViewMatrix()),-1!==this._options.uniforms.indexOf("projection")&&this._effect.setMatrix("projection",this.getScene().getProjectionMatrix()),-1!==this._options.uniforms.indexOf("viewProjection")&&this._effect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),e.MaterialHelper.BindBonesParameters(r,this._effect);var i;for(i in this._textures)this._effect.setTexture(i,this._textures[i]);for(i in this._textureArrays)this._effect.setTextureArray(i,this._textureArrays[i]);for(i in this._ints)this._effect.setInt(i,this._ints[i]);for(i in this._floats)this._effect.setFloat(i,this._floats[i]);for(i in this._floatsArrays)this._effect.setArray(i,this._floatsArrays[i]);for(i in this._colors3)this._effect.setColor3(i,this._colors3[i]);for(i in this._colors3Arrays)this._effect.setArray3(i,this._colors3Arrays[i]);for(i in this._colors4){var n=this._colors4[i];this._effect.setFloat4(i,n.r,n.g,n.b,n.a)}for(i in this._vectors2)this._effect.setVector2(i,this._vectors2[i]);for(i in this._vectors3)this._effect.setVector3(i,this._vectors3[i]);for(i in this._vectors4)this._effect.setVector4(i,this._vectors4[i]);for(i in this._matrices)this._effect.setMatrix(i,this._matrices[i]);for(i in this._matrices3x3)this._effect.setMatrix3x3(i,this._matrices3x3[i]);for(i in this._matrices2x2)this._effect.setMatrix2x2(i,this._matrices2x2[i]);for(i in this._vectors2Arrays)this._effect.setArray2(i,this._vectors2Arrays[i]);for(i in this._vectors3Arrays)this._effect.setArray3(i,this._vectors3Arrays[i])}this._afterBind(r)},r.prototype.getActiveTextures=function(){var e=t.prototype.getActiveTextures.call(this);for(var r in this._textures)e.push(this._textures[r]);for(var r in this._textureArrays)for(var i=this._textureArrays[r],n=0;n<i.length;n++)e.push(i[n]);return e},r.prototype.hasTexture=function(e){if(t.prototype.hasTexture.call(this,e))return!0;for(var r in this._textures)if(this._textures[r]===e)return!0;for(var r in this._textureArrays)for(var i=this._textureArrays[r],n=0;n<i.length;n++)if(i[n]===e)return!0;return!1},r.prototype.clone=function(e){return new r(e,this.getScene(),this._shaderPath,this._options)},r.prototype.dispose=function(e,r){if(r){var i;for(i in this._textures)this._textures[i].dispose();for(i in this._textureArrays)for(var n=this._textureArrays[i],o=0;o<n.length;o++)n[o].dispose()}this._textures={},t.prototype.dispose.call(this,e,r)},r.prototype.serialize=function(){var t=e.SerializationHelper.Serialize(this);t.customType="BABYLON.ShaderMaterial",t.options=this._options,t.shaderPath=this._shaderPath;var r;t.textures={};for(r in this._textures)t.textures[r]=this._textures[r].serialize();t.textureArrays={};for(r in this._textureArrays){t.textureArrays[r]=[];for(var i=this._textureArrays[r],n=0;n<i.length;n++)t.textureArrays[r].push(i[n].serialize())}t.floats={};for(r in this._floats)t.floats[r]=this._floats[r];t.FloatArrays={};for(r in this._floatsArrays)t.FloatArrays[r]=this._floatsArrays[r];t.colors3={};for(r in this._colors3)t.colors3[r]=this._colors3[r].asArray();t.colors3Arrays={};for(r in this._colors3Arrays)t.colors3Arrays[r]=this._colors3Arrays[r];t.colors4={};for(r in this._colors4)t.colors4[r]=this._colors4[r].asArray();t.vectors2={};for(r in this._vectors2)t.vectors2[r]=this._vectors2[r].asArray();t.vectors3={};for(r in this._vectors3)t.vectors3[r]=this._vectors3[r].asArray();t.vectors4={};for(r in this._vectors4)t.vectors4[r]=this._vectors4[r].asArray();t.matrices={};for(r in this._matrices)t.matrices[r]=this._matrices[r].asArray();t.matrices3x3={};for(r in this._matrices3x3)t.matrices3x3[r]=this._matrices3x3[r];t.matrices2x2={};for(r in this._matrices2x2)t.matrices2x2[r]=this._matrices2x2[r];t.vectors2Arrays={};for(r in this._vectors2Arrays)t.vectors2Arrays[r]=this._vectors2Arrays[r];t.vectors3Arrays={};for(r in this._vectors3Arrays)t.vectors3Arrays[r]=this._vectors3Arrays[r];return t},r.Parse=function(t,i,n){var o,s=e.SerializationHelper.Parse((function(){return new r(t.name,i,t.shaderPath,t.options)}),t,i,n);for(o in t.textures)s.setTexture(o,e.Texture.Parse(t.textures[o],i,n));for(o in t.textureArrays){for(var a=t.textureArrays[o],l=new Array,u=0;u<a.length;u++)l.push(e.Texture.Parse(a[u],i,n));s.setTextureArray(o,l)}for(o in t.floats)s.setFloat(o,t.floats[o]);for(o in t.floatsArrays)s.setFloats(o,t.floatsArrays[o]);for(o in t.colors3)s.setColor3(o,e.Color3.FromArray(t.colors3[o]));for(o in t.colors3Arrays){var h=t.colors3Arrays[o].reduce((function(e,t,r){return r%3==0?e.push([t]):e[e.length-1].push(t),e}),[]).map((function(t){return e.Color3.FromArray(t)}));s.setColor3Array(o,h)}for(o in t.colors4)s.setColor4(o,e.Color4.FromArray(t.colors4[o]));for(o in t.vectors2)s.setVector2(o,e.Vector2.FromArray(t.vectors2[o]));for(o in t.vectors3)s.setVector3(o,e.Vector3.FromArray(t.vectors3[o]));for(o in t.vectors4)s.setVector4(o,e.Vector4.FromArray(t.vectors4[o]));for(o in t.matrices)s.setMatrix(o,e.Matrix.FromArray(t.matrices[o]));for(o in t.matrices3x3)s.setMatrix3x3(o,t.matrices3x3[o]);for(o in t.matrices2x2)s.setMatrix2x2(o,t.matrices2x2[o]);for(o in t.vectors2Arrays)s.setArray2(o,t.vectors2Arrays[o]);for(o in t.vectors3Arrays)s.setArray3(o,t.vectors3Arrays[o]);return s},r})(e.Material);e.ShaderMaterial=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(e,r){var i=t.call(this,e,r)||this;return i.generateOctree=!1,i}return s(r,t),r.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(r.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!0,configurable:!0}),r.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e),this.createOrUpdateSubmeshesOctree(t)},r.prototype.getHeightAtCoordinates=function(t,r){var i=this.getWorldMatrix(),n=e.Tmp.Matrix[5];i.invertToRef(n);var o=e.Tmp.Vector3[8];if(e.Vector3.TransformCoordinatesFromFloatsToRef(t,0,r,n,o),t=o.x,r=o.z,t<this._minX||t>this._maxX||r<this._minZ||r>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var s=this._getFacetAt(t,r),a=-(s.x*t+s.z*r+s.w)/s.y;return e.Vector3.TransformCoordinatesFromFloatsToRef(0,a,0,i,o),o.y},r.prototype.getNormalAtCoordinates=function(t,r){var i=new e.Vector3(0,1,0);return this.getNormalAtCoordinatesToRef(t,r,i),i},r.prototype.getNormalAtCoordinatesToRef=function(t,r,i){var n=this.getWorldMatrix(),o=e.Tmp.Matrix[5];n.invertToRef(o);var s=e.Tmp.Vector3[8];if(e.Vector3.TransformCoordinatesFromFloatsToRef(t,0,r,o,s),t=s.x,r=s.z,t<this._minX||t>this._maxX||r<this._minZ||r>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var a=this._getFacetAt(t,r);return e.Vector3.TransformNormalFromFloatsToRef(a.x,a.y,a.z,n,i),this},r.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},r.prototype._getFacetAt=function(e,t){var r=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),i=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),n=this._heightQuads[i*this._subdivisionsX+r];return t<n.slope.x*e+n.slope.y?n.facet1:n.facet2},r.prototype._initHeightQuads=function(){var t=this._subdivisionsX,r=this._subdivisionsY;this._heightQuads=new Array;for(var i=0;i<r;i++)for(var n=0;n<t;n++){var o={slope:e.Vector2.Zero(),facet1:new e.Vector4(0,0,0,0),facet2:new e.Vector4(0,0,0,0)};this._heightQuads[i*t+n]=o}return this},r.prototype._computeHeightQuads=function(){var t=this.getVerticesData(e.VertexBuffer.PositionKind);if(!t)return this;for(var r=e.Tmp.Vector3[3],i=e.Tmp.Vector3[2],n=e.Tmp.Vector3[1],o=e.Tmp.Vector3[0],s=e.Tmp.Vector3[4],a=e.Tmp.Vector3[5],l=e.Tmp.Vector3[6],u=e.Tmp.Vector3[7],h=e.Tmp.Vector3[8],c=0,f=0,d=0,p=0,A=0,m=0,g=0,_=this._subdivisionsX,v=this._subdivisionsY,y=0;y<v;y++)for(var b=0;b<_;b++){c=3*b,f=y*(_+1)*3,d=(y+1)*(_+1)*3,r.x=t[f+c],r.y=t[f+c+1],r.z=t[f+c+2],i.x=t[f+c+3],i.y=t[f+c+4],i.z=t[f+c+5],n.x=t[d+c],n.y=t[d+c+1],n.z=t[d+c+2],o.x=t[d+c+3],o.y=t[d+c+4],o.z=t[d+c+5],p=(o.z-r.z)/(o.x-r.x),A=r.z-p*r.x,i.subtractToRef(r,s),n.subtractToRef(r,a),o.subtractToRef(r,l),e.Vector3.CrossToRef(l,a,u),e.Vector3.CrossToRef(s,l,h),u.normalize(),h.normalize(),m=-(u.x*r.x+u.y*r.y+u.z*r.z),g=-(h.x*i.x+h.y*i.y+h.z*i.z);var E=this._heightQuads[y*_+b];E.slope.copyFromFloats(p,A),E.facet1.copyFromFloats(u.x,u.y,u.z,m),E.facet2.copyFromFloats(h.x,h.y,h.z,g)}return this},r.prototype.serialize=function(e){t.prototype.serialize.call(this,e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height},r.Parse=function(e,t){var i=new r(e.name,t);return i._subdivisionsX=e.subdivisionsX||1,i._subdivisionsY=e.subdivisionsY||1,i._minX=e.minX,i._maxX=e.maxX,i._minZ=e.minZ,i._maxZ=e.maxZ,i._width=e.width,i._height=e.height,i},r})(e.Mesh);e.GroundMesh=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(e,r){var i=t.call(this,e,r.getScene())||this;return r.instances.push(i),i._sourceMesh=r,i.position.copyFrom(r.position),i.rotation.copyFrom(r.rotation),i.scaling.copyFrom(r.scaling),r.rotationQuaternion&&(i.rotationQuaternion=r.rotationQuaternion.clone()),i.infiniteDistance=r.infiniteDistance,i.setPivotMatrix(r.getPivotMatrix()),i.refreshBoundingInfo(),i._syncSubMeshes(),i}return s(r,t),r.prototype.getClassName=function(){return"InstancedMesh"},Object.defineProperty(r.prototype,"receiveShadows",{get:function(){return this._sourceMesh.receiveShadows},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this._sourceMesh.material},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"visibility",{get:function(){return this._sourceMesh.visibility},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skeleton",{get:function(){return this._sourceMesh.skeleton},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"renderingGroupId",{get:function(){return this._sourceMesh.renderingGroupId},set:function(t){this._sourceMesh&&t!==this._sourceMesh.renderingGroupId&&e.Tools.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")},enumerable:!0,configurable:!0}),r.prototype.getTotalVertices=function(){return this._sourceMesh.getTotalVertices()},Object.defineProperty(r.prototype,"sourceMesh",{get:function(){return this._sourceMesh},enumerable:!0,configurable:!0}),r.prototype.isReady=function(e){return void 0===e&&(e=!1),this._sourceMesh.isReady(e,!0)},r.prototype.getVerticesData=function(e,t){return this._sourceMesh.getVerticesData(e,t)},r.prototype.setVerticesData=function(e,t,r,i){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,r,i),this.sourceMesh},r.prototype.updateVerticesData=function(e,t,r,i){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,r,i),this.sourceMesh},r.prototype.setIndices=function(e,t){return void 0===t&&(t=null),this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh},r.prototype.isVerticesDataPresent=function(e){return this._sourceMesh.isVerticesDataPresent(e)},r.prototype.getIndices=function(){return this._sourceMesh.getIndices()},Object.defineProperty(r.prototype,"_positions",{get:function(){return this._sourceMesh._positions},enumerable:!0,configurable:!0}),r.prototype.refreshBoundingInfo=function(){var t=this._sourceMesh.getBoundingInfo();return this._boundingInfo=new e.BoundingInfo(t.minimum.clone(),t.maximum.clone()),this._updateBoundingInfo(),this},r.prototype._preActivate=function(){return this._currentLOD&&this._currentLOD._preActivate(),this},r.prototype._activate=function(e){return this._currentLOD&&this._currentLOD._registerInstanceForRenderId(this,e),this},r.prototype.getLOD=function(e){if(!e)return this;var t=this.getBoundingInfo();return this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere),this._currentLOD===this.sourceMesh?this:this._currentLOD},r.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this},r.prototype._generatePointsArray=function(){return this._sourceMesh._generatePointsArray()},r.prototype.clone=function(t,r,i){var n=this._sourceMesh.createInstance(t);if(e.Tools.DeepCopy(this,n,["name","subMeshes","uniqueId"],[]),this.refreshBoundingInfo(),r&&(n.parent=r),!i)for(var o=0;o<this.getScene().meshes.length;o++){var s=this.getScene().meshes[o];s.parent===this&&s.clone(s.name,n)}return n.computeWorldMatrix(!0),n},r.prototype.dispose=function(e,r){void 0===r&&(r=!1);var i=this._sourceMesh.instances.indexOf(this);this._sourceMesh.instances.splice(i,1),t.prototype.dispose.call(this,e,r)},r})(e.AbstractMesh);e.InstancedMesh=t})(n||(n={}));var n;!(function(e){var t=(function(t){function r(r,i,n,o,s,a,l){void 0===i&&(i=null),void 0===n&&(n=null);var u=t.call(this,r,i,n,o,s)||this;u.useVertexColor=a,u.useVertexAlpha=l,u.color=new e.Color3(1,1,1),u.alpha=1,o&&(u.color=o.color.clone(),u.alpha=o.alpha,u.useVertexColor=o.useVertexColor,u.useVertexAlpha=o.useVertexAlpha),u._intersectionThreshold=.1;var h=[],c={attributes:[e.VertexBuffer.PositionKind],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:h};return!1===l&&(c.needAlphaBlending=!1),a?(c.defines.push("#define VERTEXCOLOR"),c.attributes.push(e.VertexBuffer.ColorKind)):c.uniforms.push("color"),u._colorShader=new e.ShaderMaterial("colorShader",u.getScene(),"color",c),u}return s(r,t),Object.defineProperty(r.prototype,"intersectionThreshold",{get:function(){return this._intersectionThreshold},set:function(t){this._intersectionThreshold!==t&&(this._intersectionThreshold=t,this.geometry&&(this.geometry.boundingBias=new e.Vector2(0,t)))},enumerable:!0,configurable:!0}),r.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(r.prototype,"material",{get:function(){return this._colorShader},set:function(e){},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"checkCollisions",{get:function(){return!1},enumerable:!0,configurable:!0}),r.prototype.createInstance=function(e){throw new Error("LinesMeshes do not support createInstance.")},r.prototype._bind=function(e,t,r){return this._geometry?(this._geometry._bind(this._colorShader.getEffect()),this.useVertexColor||this._colorShader.setColor4("color",this.color.toColor4(this.alpha)),this):this},r.prototype._draw=function(t,r,i){return this._geometry&&this._geometry.getVertexBuffers()&&(this._unIndexed||this._geometry.getIndexBuffer())?(this.getScene().getEngine().drawElementsType(e.Material.LineListDrawMode,t.indexStart,t.indexCount),this):this},r.prototype.dispose=function(e){this._colorShader.dispose(),t.prototype.dispose.call(this,e)},r.prototype.clone=function(e,t,i){return new r(e,this.getScene(),t,this,i)},r})(e.Mesh);e.LinesMesh=t})(n||(n={}));var n;!(function(e){var t=(function(){function t(){}return t.updateSideOrientation=function(t){return t==e.Mesh.DOUBLESIDE?e.Mesh.DOUBLESIDE:void 0===t||null===t?e.Mesh.FRONTSIDE:t},t.CreateBox=function(r,i,n){void 0===n&&(n=null);var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateBox(i).applyToMesh(o,i.updatable),o},t.CreateSphere=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateSphere(i).applyToMesh(o,i.updatable),o},t.CreateDisc=function(r,i,n){void 0===n&&(n=null);var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateDisc(i).applyToMesh(o,i.updatable),o},t.CreateIcoSphere=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),
- o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateIcoSphere(i).applyToMesh(o,i.updatable),o},t.CreateRibbon=function(r,i,n){void 0===n&&(n=null);var o=i.pathArray,s=i.closeArray,a=i.closePath,l=t.updateSideOrientation(i.sideOrientation),u=i.instance,h=i.updatable;if(u){e.Vector3.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,e.Tmp.Vector3[0]),e.Vector3.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,e.Tmp.Vector3[1]);var c=u.getVerticesData(e.VertexBuffer.PositionKind);if(function(t){for(var r=o[0].length,i=0,n=u._originalBuilderSideOrientation===e.Mesh.DOUBLESIDE?2:1,s=1;s<=n;s++)for(var a=0;a<o.length;a++){var l=o[a],h=l.length;r=r<h?r:h;for(var c=0;c<r;)t[i]=l[c].x,t[i+1]=l[c].y,t[i+2]=l[c].z,l[c].x<e.Tmp.Vector3[0].x&&(e.Tmp.Vector3[0].x=l[c].x),l[c].x>e.Tmp.Vector3[1].x&&(e.Tmp.Vector3[1].x=l[c].x),l[c].y<e.Tmp.Vector3[0].y&&(e.Tmp.Vector3[0].y=l[c].y),l[c].y>e.Tmp.Vector3[1].y&&(e.Tmp.Vector3[1].y=l[c].y),l[c].z<e.Tmp.Vector3[0].z&&(e.Tmp.Vector3[0].z=l[c].z),l[c].z>e.Tmp.Vector3[1].z&&(e.Tmp.Vector3[1].z=l[c].z),c++,i+=3;u._closePath&&(t[i]=l[0].x,t[i+1]=l[0].y,t[i+2]=l[0].z,i+=3)}}(c),u._boundingInfo=new e.BoundingInfo(e.Tmp.Vector3[0],e.Tmp.Vector3[1]),u._boundingInfo.update(u._worldMatrix),u.updateVerticesData(e.VertexBuffer.PositionKind,c,!1,!1),i.colors){for(var f=u.getVerticesData(e.VertexBuffer.ColorKind),d=0;d<i.colors.length;d++)f[4*d]=i.colors[d].r,f[4*d+1]=i.colors[d].g,f[4*d+2]=i.colors[d].b,f[4*d+3]=i.colors[d].a;u.updateVerticesData(e.VertexBuffer.ColorKind,f,!1,!1)}if(i.uvs){for(var p=u.getVerticesData(e.VertexBuffer.UVKind),A=0;A<i.uvs.length;A++)p[2*A]=i.uvs[A].x,p[2*A+1]=i.uvs[A].y;u.updateVerticesData(e.VertexBuffer.UVKind,p,!1,!1)}if(!u.areNormalsFrozen||u.isFacetDataEnabled){var m=u.getIndices(),g=u.getVerticesData(e.VertexBuffer.NormalKind),_=u.isFacetDataEnabled?u.getFacetDataParameters():null;if(e.VertexData.ComputeNormals(c,m,g,_),u._closePath)for(var v=0,y=0,b=0;b<o.length;b++)v=3*u._idx[b],y=b+1<o.length?3*(u._idx[b+1]-1):g.length-3,g[v]=.5*(g[v]+g[y]),g[v+1]=.5*(g[v+1]+g[y+1]),g[v+2]=.5*(g[v+2]+g[y+2]),g[y]=g[v],g[y+1]=g[v+1],g[y+2]=g[v+2];u.areNormalsFrozen||u.updateVerticesData(e.VertexBuffer.NormalKind,g,!1,!1)}return u}var E=new e.Mesh(r,n);E._originalBuilderSideOrientation=l;var T=e.VertexData.CreateRibbon(i);return a&&(E._idx=T._idx),E._closePath=a,E._closeArray=s,T.applyToMesh(E,h),E},t.CreateCylinder=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateCylinder(i).applyToMesh(o,i.updatable),o},t.CreateTorus=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateTorus(i).applyToMesh(o,i.updatable),o},t.CreateTorusKnot=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreateTorusKnot(i).applyToMesh(o,i.updatable),o},t.CreateLineSystem=function(t,r,i){var n=r.instance,o=r.lines,s=r.colors;if(n){var a,l,u=n.getVerticesData(e.VertexBuffer.PositionKind);s&&(a=n.getVerticesData(e.VertexBuffer.ColorKind));for(var h=0,c=0,f=0;f<o.length;f++)for(var d=o[f],p=0;p<d.length;p++)u[h]=d[p].x,u[h+1]=d[p].y,u[h+2]=d[p].z,s&&a&&(l=s[f],a[c]=l[p].r,a[c+1]=l[p].g,a[c+2]=l[p].b,a[c+3]=l[p].a,c+=4),h+=3;return n.updateVerticesData(e.VertexBuffer.PositionKind,u,!1,!1),s&&a&&n.updateVerticesData(e.VertexBuffer.ColorKind,a,!1,!1),n}var A=!!s,m=new e.LinesMesh(t,i,null,void 0,void 0,A,r.useVertexAlpha);return e.VertexData.CreateLineSystem(r).applyToMesh(m,r.updatable),m},t.CreateLines=function(e,r,i){void 0===i&&(i=null);var n=r.colors?[r.colors]:null;return t.CreateLineSystem(e,{lines:[r.points],updatable:r.updatable,instance:r.instance,colors:n,useVertexAlpha:r.useVertexAlpha},i)},t.CreateDashedLines=function(t,r,i){void 0===i&&(i=null);var n=r.points,o=r.instance,s=r.gapSize||1,a=r.dashSize||3;if(o){var l=function(t){var r=e.Vector3.Zero(),i=t.length/6,s=0,a=0,l=0,u=0,h=0,c=0,f=0,d=0;for(f=0;f<n.length-1;f++)n[f+1].subtractToRef(n[f],r),s+=r.length();for(l=s/i,u=o.dashSize*l/(o.dashSize+o.gapSize),f=0;f<n.length-1;f++)for(n[f+1].subtractToRef(n[f],r),a=Math.floor(r.length()/l),r.normalize(),d=0;d<a&&c<t.length;)h=l*d,t[c]=n[f].x+h*r.x,t[c+1]=n[f].y+h*r.y,t[c+2]=n[f].z+h*r.z,t[c+3]=n[f].x+(h+u)*r.x,t[c+4]=n[f].y+(h+u)*r.y,t[c+5]=n[f].z+(h+u)*r.z,c+=6,d++;for(;c<t.length;)t[c]=n[f].x,t[c+1]=n[f].y,t[c+2]=n[f].z,c+=3};return o.updateMeshPositions(l,!1),o}var u=new e.LinesMesh(t,i);return e.VertexData.CreateDashedLines(r).applyToMesh(u,r.updatable),u.dashSize=a,u.gapSize=s,u},t.ExtrudeShape=function(r,i,n){void 0===n&&(n=null);var o=i.path,s=i.shape,a=i.scale||1,l=i.rotation||0,u=0===i.cap?0:i.cap||e.Mesh.NO_CAP,h=i.updatable,c=t.updateSideOrientation(i.sideOrientation),f=i.instance||null,d=i.invertUV||!1;return t._ExtrudeShapeGeneric(r,s,o,a,l,null,null,!1,!1,u,!1,n,!!h,c,f,d,i.frontUVs||null,i.backUVs||null)},t.ExtrudeShapeCustom=function(r,i,n){var o=i.path,s=i.shape,a=i.scaleFunction||function(){return 1},l=i.rotationFunction||function(){return 0},u=i.ribbonCloseArray||!1,h=i.ribbonClosePath||!1,c=0===i.cap?0:i.cap||e.Mesh.NO_CAP,f=i.updatable,d=t.updateSideOrientation(i.sideOrientation),p=i.instance,A=i.invertUV||!1;return t._ExtrudeShapeGeneric(r,s,o,null,null,a,l,u,h,c,!0,n,!!f,d,p||null,A,i.frontUVs||null,i.backUVs||null)},t.CreateLathe=function(r,i,n){var o,s=i.arc?i.arc<=0||i.arc>1?1:i.arc:1,a=void 0===i.closed||i.closed,l=i.shape,u=i.radius||1,h=i.tessellation||64,c=i.updatable,f=t.updateSideOrientation(i.sideOrientation),d=i.cap||e.Mesh.NO_CAP,p=2*Math.PI,A=new Array,m=i.invertUV||!1,g=0,_=0,v=p/h*s,y=new Array;for(g=0;g<=h;g++){var y=[];for(d!=e.Mesh.CAP_START&&d!=e.Mesh.CAP_ALL||(y.push(new e.Vector3(0,l[0].y,0)),y.push(new e.Vector3(Math.cos(g*v)*l[0].x*u,l[0].y,Math.sin(g*v)*l[0].x*u))),_=0;_<l.length;_++)o=new e.Vector3(Math.cos(g*v)*l[_].x*u,l[_].y,Math.sin(g*v)*l[_].x*u),y.push(o);d!=e.Mesh.CAP_END&&d!=e.Mesh.CAP_ALL||(y.push(new e.Vector3(Math.cos(g*v)*l[l.length-1].x*u,l[l.length-1].y,Math.sin(g*v)*l[l.length-1].x*u)),y.push(new e.Vector3(0,l[l.length-1].y,0))),A.push(y)}return t.CreateRibbon(r,{pathArray:A,closeArray:a,sideOrientation:f,updatable:c,invertUV:m,frontUVs:i.frontUVs,backUVs:i.backUVs},n)},t.CreatePlane=function(r,i,n){var o=new e.Mesh(r,n);if(i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreatePlane(i).applyToMesh(o,i.updatable),i.sourcePlane){o.translate(i.sourcePlane.normal,i.sourcePlane.d);var s=Math.acos(e.Vector3.Dot(i.sourcePlane.normal,e.Axis.Z)),a=e.Vector3.Cross(e.Axis.Z,i.sourcePlane.normal);o.rotate(a,s)}return o},t.CreateGround=function(t,r,i){var n=new e.GroundMesh(t,i);return n._setReady(!1),n._subdivisionsX=r.subdivisionsX||r.subdivisions||1,n._subdivisionsY=r.subdivisionsY||r.subdivisions||1,n._width=r.width||1,n._height=r.height||1,n._maxX=n._width/2,n._maxZ=n._height/2,n._minX=-n._maxX,n._minZ=-n._maxZ,e.VertexData.CreateGround(r).applyToMesh(n,r.updatable),n._setReady(!0),n},t.CreateTiledGround=function(t,r,i){var n=new e.Mesh(t,i);return e.VertexData.CreateTiledGround(r).applyToMesh(n,r.updatable),n},t.CreateGroundFromHeightMap=function(t,r,i,n){var o=i.width||10,s=i.height||10,a=i.subdivisions||1,l=i.minHeight||0,u=i.maxHeight||1,h=i.colorFilter||new e.Color3(.3,.59,.11),c=i.updatable,f=i.onReady,d=new e.GroundMesh(t,n);d._subdivisionsX=a,d._subdivisionsY=a,d._width=o,d._height=s,d._maxX=d._width/2,d._maxZ=d._height/2,d._minX=-d._maxX,d._minZ=-d._maxZ,d._setReady(!1);var p=function(t){var r=document.createElement("canvas"),i=r.getContext("2d");if(!i)throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");if(!n.isDisposed){var p=t.width,A=t.height;r.width=p,r.height=A,i.drawImage(t,0,0);var m=i.getImageData(0,0,p,A).data;e.VertexData.CreateGroundFromHeightMap({width:o,height:s,subdivisions:a,minHeight:l,maxHeight:u,colorFilter:h,buffer:m,bufferWidth:p,bufferHeight:A}).applyToMesh(d,c),f&&f(d),d._setReady(!0)}};return e.Tools.LoadImage(r,p,(function(){}),n.database),d},t.CreatePolygon=function(r,i,n){i.sideOrientation=t.updateSideOrientation(i.sideOrientation);for(var o=i.shape,s=i.holes||[],a=i.depth||0,l=[],u=[],h=0;h<o.length;h++)l[h]=new e.Vector2(o[h].x,o[h].z);l[0].equalsWithEpsilon(l[l.length-1],1e-8)&&l.pop();for(var c=new e.PolygonMeshBuilder(r,l,n),f=0;f<s.length;f++){u=[];for(var d=0;d<s[f].length;d++)u.push(new e.Vector2(s[f][d].x,s[f][d].z));c.addHole(u)}var p=c.build(i.updatable,a);return p._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreatePolygon(p,i.sideOrientation,i.faceUV,i.faceColors,i.frontUVs,i.backUVs).applyToMesh(p,i.updatable),p},t.ExtrudePolygon=function(e,r,i){return t.CreatePolygon(e,r,i)},t.CreateTube=function(r,i,n){var o=i.path,s=i.instance,a=1;s&&(a=s.radius),void 0!==i.radius&&(a=i.radius);var l=i.tessellation||64,u=i.radiusFunction||null,h=i.cap||e.Mesh.NO_CAP,c=i.invertUV||!1,f=i.updatable,d=t.updateSideOrientation(i.sideOrientation);i.arc=i.arc&&(i.arc<=0||i.arc>1)?1:i.arc||1;var p,A,m=function(t,r,i,n,o,s,a,l){for(var u,h,c,f,d=r.getTangents(),p=r.getNormals(),A=r.getDistances(),m=2*Math.PI,g=m/o*l,_=function(){return n},v=s||_,y=e.Tmp.Matrix[0],b=a===e.Mesh._NO_CAP||a===e.Mesh.CAP_END?0:2,E=0;E<t.length;E++){h=v(E,A[E]),u=Array(),c=p[E];for(var T=0;T<o;T++)e.Matrix.RotationAxisToRef(d[E],g*T,y),f=u[T]?u[T]:e.Vector3.Zero(),e.Vector3.TransformCoordinatesToRef(c,y,f),f.scaleInPlace(h).addInPlace(t[E]),u[T]=f;i[b]=u,b++}var x=function(e,r){for(var i=Array(),n=0;n<e;n++)i.push(t[r]);return i};switch(a){case e.Mesh.NO_CAP:break;case e.Mesh.CAP_START:i[0]=x(o,0),i[1]=i[2].slice(0);break;case e.Mesh.CAP_END:i[b]=i[b-1].slice(0),i[b+1]=x(o,t.length-1);break;case e.Mesh.CAP_ALL:i[0]=x(o,0),i[1]=i[2].slice(0),i[b]=i[b-1].slice(0),i[b+1]=x(o,t.length-1)}return i};if(s){var g=i.arc||s.arc;return p=s.path3D.update(o),A=m(o,p,s.pathArray,a,s.tessellation,u,s.cap,g),s=t.CreateRibbon("",{pathArray:A,instance:s}),s.path3D=p,s.pathArray=A,s.arc=g,s.radius=a,s}p=new e.Path3D(o);var _=new Array;h=h<0||h>3?0:h,A=m(o,p,_,a,l,u,h,i.arc);var v=t.CreateRibbon(r,{pathArray:A,closePath:!0,closeArray:!1,updatable:f,sideOrientation:d,invertUV:c,frontUVs:i.frontUVs,backUVs:i.backUVs},n);return v.pathArray=A,v.path3D=p,v.tessellation=l,v.cap=h,v.arc=i.arc,v.radius=a,v},t.CreatePolyhedron=function(r,i,n){var o=new e.Mesh(r,n);return i.sideOrientation=t.updateSideOrientation(i.sideOrientation),o._originalBuilderSideOrientation=i.sideOrientation,e.VertexData.CreatePolyhedron(i).applyToMesh(o,i.updatable),o},t.CreateDecal=function(t,r,i){var n=r.getIndices(),o=r.getVerticesData(e.VertexBuffer.PositionKind),s=r.getVerticesData(e.VertexBuffer.NormalKind),a=i.position||e.Vector3.Zero(),l=i.normal||e.Vector3.Up(),u=i.size||e.Vector3.One(),h=i.angle||0;if(!l){var c=new e.Vector3(0,0,1),f=r.getScene().activeCamera,d=e.Vector3.TransformCoordinates(c,f.getWorldMatrix());l=f.globalPosition.subtract(d)}var p=-Math.atan2(l.z,l.x)-Math.PI/2,A=Math.sqrt(l.x*l.x+l.z*l.z),m=Math.atan2(l.y,A),g=e.Matrix.RotationYawPitchRoll(p,m,h).multiply(e.Matrix.Translation(a.x,a.y,a.z)),_=e.Matrix.Invert(g),v=r.getWorldMatrix(),y=v.multiply(_),b=new e.VertexData;b.indices=[],b.positions=[],b.normals=[],b.uvs=[];for(var E=0,T=function(t){var r=new e.PositionNormalVertex;if(!n||!o||!s)return r;var i=n[t];return r.position=new e.Vector3(o[3*i],o[3*i+1],o[3*i+2]),r.position=e.Vector3.TransformCoordinates(r.position,y),r.normal=new e.Vector3(s[3*i],s[3*i+1],s[3*i+2]),r.normal=e.Vector3.TransformNormal(r.normal,y),r},x=function(t,r){if(0===t.length)return t;for(var i=.5*Math.abs(e.Vector3.Dot(u,r)),n=function(t,n){var o=e.Vector3.GetClipFactor(t.position,n.position,r,i);return new e.PositionNormalVertex(e.Vector3.Lerp(t.position,n.position,o),e.Vector3.Lerp(t.normal,n.normal,o))},o=new Array,s=0;s<t.length;s+=3){var a,l,h,c=null,f=null,d=null,p=null,A=e.Vector3.Dot(t[s].position,r)-i,m=e.Vector3.Dot(t[s+1].position,r)-i,g=e.Vector3.Dot(t[s+2].position,r)-i;switch(a=A>0,l=m>0,h=g>0,(a?1:0)+(l?1:0)+(h?1:0)){case 0:o.push(t[s]),o.push(t[s+1]),o.push(t[s+2]);break;case 1:if(a&&(c=t[s+1],f=t[s+2],d=n(t[s],c),p=n(t[s],f)),l){c=t[s],f=t[s+2],d=n(t[s+1],c),p=n(t[s+1],f),o.push(d),o.push(f.clone()),o.push(c.clone()),o.push(f.clone()),o.push(d.clone()),o.push(p);break}h&&(c=t[s],f=t[s+1],d=n(t[s+2],c),p=n(t[s+2],f)),c&&f&&d&&p&&(o.push(c.clone()),o.push(f.clone()),o.push(d),o.push(p),o.push(d.clone()),o.push(f.clone()));break;case 2:a||(c=t[s].clone(),f=n(c,t[s+1]),d=n(c,t[s+2]),o.push(c),o.push(f),o.push(d)),l||(c=t[s+1].clone(),f=n(c,t[s+2]),d=n(c,t[s]),o.push(c),o.push(f),o.push(d)),h||(c=t[s+2].clone(),f=n(c,t[s]),d=n(c,t[s+1]),o.push(c),o.push(f),o.push(d))}}return o},M=0;M<n.length;M+=3){var C=new Array;if(C.push(T(M)),C.push(T(M+1)),C.push(T(M+2)),C=x(C,new e.Vector3(1,0,0)),C=x(C,new e.Vector3(-1,0,0)),C=x(C,new e.Vector3(0,1,0)),C=x(C,new e.Vector3(0,-1,0)),C=x(C,new e.Vector3(0,0,1)),C=x(C,new e.Vector3(0,0,-1)),0!==C.length)for(var P=0;P<C.length;P++){var S=C[P];b.indices.push(E),S.position.toArray(b.positions,3*E),S.normal.toArray(b.normals,3*E),b.uvs.push(.5+S.position.x/u.x),b.uvs.push(.5+S.position.y/u.y),E++}}var R=new e.Mesh(t,r.getScene());return b.applyToMesh(R),R.position=a.clone(),R.rotation=new e.Vector3(m,p,h),R},t._ExtrudeShapeGeneric=function(r,i,n,o,s,a,l,u,h,c,f,d,p,A,m,g,_,v){var y,b,E=function(t,r,i,n,o,s,a,l,u,h){for(var c=i.getTangents(),f=i.getNormals(),d=i.getBinormals(),p=i.getDistances(),A=0,m=function(){return null!==o?o:1},g=function(){return null!==s?s:0},_=h&&l?l:g,v=h&&a?a:m,y=u===e.Mesh.NO_CAP||u===e.Mesh.CAP_END?0:2,b=e.Tmp.Matrix[0],E=0;E<r.length;E++){for(var T=new Array,x=_(E,p[E]),M=v(E,p[E]),C=0;C<t.length;C++){e.Matrix.RotationAxisToRef(c[E],A,b);var P=c[E].scale(t[C].z).add(f[E].scale(t[C].x)).add(d[E].scale(t[C].y)),S=T[C]?T[C]:e.Vector3.Zero();e.Vector3.TransformCoordinatesToRef(P,b,S),S.scaleInPlace(M).addInPlace(r[E]),T[C]=S}n[y]=T,A+=x,y++}var R=function(t){var r,i=Array(),n=e.Vector3.Zero();for(r=0;r<t.length;r++)n.addInPlace(t[r]);for(n.scaleInPlace(1/t.length),r=0;r<t.length;r++)i.push(n);return i};switch(u){case e.Mesh.NO_CAP:break;case e.Mesh.CAP_START:n[0]=R(n[2]),n[1]=n[2];break;case e.Mesh.CAP_END:n[y]=n[y-1],n[y+1]=R(n[y-1]);break;case e.Mesh.CAP_ALL:n[0]=R(n[2]),n[1]=n[2],n[y]=n[y-1],n[y+1]=R(n[y-1])}return n};if(m)return y=m.path3D.update(n),b=E(i,n,m.path3D,m.pathArray,o,s,a,l,m.cap,f),m=e.Mesh.CreateRibbon("",b,!1,!1,0,d||void 0,!1,0,m);y=new e.Path3D(n);var T=new Array;c=c<0||c>3?0:c,b=E(i,n,y,T,o,s,a,l,c,f);var x=t.CreateRibbon(r,{pathArray:b,closeArray:u,closePath:h,updatable:p,sideOrientation:A,invertUV:g,frontUVs:_||void 0,backUVs:v||void 0},d);return x.pathArray=b,x.path3D=y,x.cap=c,x},t})();e.MeshBuilder=t})(n||(n={})),n.Effect.ShadersStore={defaultVertexShader:"#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL \nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif \n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n",defaultPixelShader:"#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY \n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include<fresnelFunction>\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb;\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor=toGammaSpace(refractionColor);\n#endif\nrefractionColor*=vRefractionInfos.x;\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb;\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor=toGammaSpace(reflectionColor);\n#endif\nreflectionColor*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n",colorVertexShader:"\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\nuniform mat4 viewProjection;\nuniform mat4 world;\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\nmat4 finalWorld=world;\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}",colorPixelShader:"#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\nvoid main(void) {\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}"},n.Effect.IncludesShadersStore={depthPrePass:"#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif",bonesDeclaration:"#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#endif",instancesDeclaration:"#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif",pointCloudVertexDeclaration:"#ifdef POINTSIZE\nuniform float pointSize;\n#endif",bumpVertexDeclaration:"#if defined(BUMP) || defined(PARALLAX)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n",clipPlaneVertexDeclaration:"#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif",fogVertexDeclaration:"#ifdef FOG\nvarying vec3 vFogDistance;\n#endif",morphTargetsVertexGlobalDeclaration:"#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif",morphTargetsVertexDeclaration:"#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#endif",logDepthDeclaration:"#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif",morphTargetsVertex:"#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#endif",
- instancesVertex:"#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif",bonesVertex:"#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif \nfinalWorld=finalWorld*influence;\n#endif",bumpVertex:"#if defined(BUMP) || defined(PARALLAX)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif",clipPlaneVertex:"#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif",fogVertex:"#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif",shadowsVertex:"#ifdef SHADOWS\n#if defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\nvDepthMetric{X}=((vPositionFromLight{X}.z+light{X}.depthValues.x)/(light{X}.depthValues.y));\n#endif\n#endif",pointCloudVertex:"#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif",logDepthVertex:"#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif",helperFunctions:"const float PI=3.1415926535897932384626433832795;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\nvec3 applyEaseInOut(vec3 x){\nreturn x*x*(3.0-2.0*x);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=max(0.0000001,max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D); \n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}",lightFragmentDeclaration:"#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#else\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\n#endif\n#ifdef HEMILIGHT{X}\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif",lightsFragmentFunctions:"\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}",lightUboDeclaration:"#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec3 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\n#endif\n#ifdef HEMILIGHT{X}\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X}; \n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif",defaultVertexDeclaration:"\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n",defaultFragmentDeclaration:"uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_SKYBOX\n#else\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif",defaultUboDeclaration:"layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor; \nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix; \nvec4 vTangentSpaceParams;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nvec4 vDiffuseColor;\nfloat pointSize; \n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};",shadowsFragmentFunctions:"#ifdef SHADOWS\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\nfloat computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness); \nreturn esm;\n}\nfloat computeShadowWithCloseESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn esm;\n}\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nif (shadowPixelDepth>shadow)\n{\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\n}\nreturn 1.;\n}\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<shadowPixelDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<shadowPixelDepth) visibility-=0.25;\n#endif\nreturn computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n#ifdef WEBGL2\n\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=texture(depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy)).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\n\nfloat AAOffset=shadowMapSizeInverse*10.;\n\n\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)+AAOffset);\nfloat filterRadius=penumbraRatio*lightSizeUV*shadowMapSizeInverse;\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount; i++) {\nvec3 offset=poissonSamplers[i];\n\noffset=vec3(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);\nshadow+=texture2D(shadowSampler,uvDepth+offset*filterRadius);\n}\nshadow/=float(pcfTapCount);\n\nshadow=mix(shadow,1.,depthMetric-avgBlockerDepth);\n\nshadow=mix(darkness,1.,shadow);\n\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithPCSS16(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);\n}\nfloat computeShadowWithPCSS32(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);\n}\nfloat computeShadowWithPCSS64(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);\n}\n#endif\n#endif\n",fresnelFunction:"#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif",reflectionFunction:"#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\n\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\n\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\n\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\n\nvec3 intersectPositionWS=vertexPos+origVec*distance;\n\nreturn intersectPositionWS-cubePos;\n}\n#endif\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvec3 direction=vDirectionW;\nfloat t=clamp(direction.y*-0.5+0.5,0.,1.0);\nfloat s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nreturn vec3(1.0-s,t,0);\n#else\nreturn vec3(s,t,0);\n#endif\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nvec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition.xyz);\nvec3 r=reflect(cameraToVertex,worldNormal);\nfloat t=clamp(r.y*-0.5+0.5,0.,1.0);\nfloat s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nvec3 viewDir=worldPos.xyz-vEyePosition.xyz;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n#endif\n#ifdef REFLECTIONMAP_CUBIC\nvec3 viewDir=normalize(worldPos.xyz-vEyePosition.xyz);\n\nvec3 coords=reflect(viewDir,worldNormal);\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,vReflectionSize,vReflectionPosition);\n#endif\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn vec3(reflectionMatrix*(view*worldPos));\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}",
- imageProcessingDeclaration:"#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif",imageProcessingFunctions:"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=clamp(sliceUV,0.,1.);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=clamp(sliceUV,0.,1.);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=clamp(result.rgb,0.0,1.0);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=applyEaseInOut(result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}",bumpFragmentFunctions:"#ifdef BUMP\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=vTangentSpaceParams.x;\nbitangent*=vTangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nvec3 map=texture2D(bumpSampler,uv).xyz;\nmap=map*2.0-1.0;\n#ifdef NORMALXYSCALE\nmap=normalize(map*vec3(vBumpInfos.y,vBumpInfos.y,1.0));\n#endif\nreturn normalize(cotangentFrame*map);\n}\n#ifdef PARALLAX\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n#endif",clipPlaneFragmentDeclaration:"#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif",fogFragmentDeclaration:"#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif",clipPlaneFragment:"#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif",bumpFragment:"vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#else \nfloat normalScale=vBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW); \n#else\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#endif\n#endif",lightFragment:"#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || (defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}))\n\n#else\n#ifdef PBR\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,glossiness);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCLOSEESM{X}\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor;\n#endif\n#endif\n#else\ndiffuseBase+=info.diffuse*shadow;\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#endif\n#endif\n#endif",logDepthFragment:"#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif",fogFragment:"#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif"};var l=void 0!==t?t:"undefined"!=typeof window?window:this;return l.BABYLON=n,void 0!==i&&(l.Earcut={earcut:i}),n}))}).call(t,r(17))}),(function(e,t,r){"use strict";function i(e){return 0===e.indexOf("http")||0===e.indexOf("/")||0===e.indexOf("./")||0===e.indexOf("../")}function n(e){return e.replace(/(\-\w)/g,(function(e){return e[1].toUpperCase()}))}function o(e){return e?e.replace(/([A-Z])/g,(function(e){return"-"+e[0].toLowerCase()})):null}function s(e,t){t&&Object.keys(t).forEach((function(r){r in e&&"function"!=typeof e[r]&&("object"==typeof e[r]?s(e[r],t[r]):void 0!==t[r]&&(e[r]=t[r]))}))}Object.defineProperty(t,"__esModule",{value:!0});var a=r(21),l=a.default;t.deepmerge=l,t.isUrl=i,t.kebabToCamel=n,t.camelToKebab=o,t.extendClassWithConfig=s}),(function(e,t,r){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),i(r(31)),i(r(33)),i(r(39))}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),o=(function(){function e(){}return e.prototype.map=function(e){for(var t={},r=0;r<e.attributes.length;++r)!(function(r){var i=e.attributes.item(r);if(!i)return"continue";var o=i.nodeName.split(".");o.reduce((function(e,t,r){var s=n.kebabToCamel(t);if(r===o.length-1){var a=i.nodeValue;if("true"===a)a=!0;else if("false"===a)a=!1;else{var l=!isNaN(parseFloat(a))&&isFinite(a);if(l){var u=parseFloat(a);isNaN(u)||(a=u)}}e[s]=a}else e[s]=e[s]||{};return e[s]}),t)})(r);return t},e})(),s=(function(){function e(){}return e.prototype.map=function(e){return JSON.parse(e)},e})(),a=(function(){function e(){}return e.prototype.map=function(e){var t=new o,r=t.map(e),i=function(e,r){var o=e.children;if(o.length)for(var s=0;s<o.length;++s){var a=o.item(s),l=t.map(a),u=n.kebabToCamel(a.nodeName.toLowerCase());if(a.attributes.getNamedItem("array")&&"true"===a.attributes.getNamedItem("array").nodeValue)r[u]=[];else if(e.attributes.getNamedItem("array")&&"true"===e.attributes.getNamedItem("array").nodeValue)r.push(l);else if(r[u]){e.setAttribute("array","true");var h=r[u];r=[h,l]}else r[u]=l;i(a,r[u]||l)}return r};return i(e,r),r},e})(),l=(function(){function e(){this._mappers={html:new o,json:new s,dom:new a}}return e.prototype.getMapper=function(e){return this._mappers[e]||i.Tools.Error("No mapper defined for "+e),this._mappers[e]},e.prototype.registerMapper=function(e,t){this._mappers[e]=t},e.prototype.dispose=function(){this._mappers={}},e.DefaultMapper="json",e})();t.MapperManager=l,t.mapperManager=new l}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){this.disableInit=!1,this.disableWebGL2Support=!1}return Object.defineProperty(e.prototype,"version",{get:function(){return i.Engine.Version},enumerable:!0,configurable:!0}),e})();t.ViewerGlobals=n,t.viewerGlobals=new n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,n=r(0),o=r(23),s=r(1);!(function(e){e[e.INIT=0]="INIT",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e[e.ENTRY=3]="ENTRY",e[e.ENTRYDONE=4]="ENTRYDONE",e[e.COMPLETE=5]="COMPLETE",e[e.CANCELED=6]="CANCELED",e[e.ERROR=7]="ERROR"})(i=t.ModelState||(t.ModelState={}));var a=(function(){function e(e,t,r){var o=this;this._observablesManager=e,this._configurationContainer=r,this._meshes=[],this.particleSystems=[],this.skeletons=[],this._loaderDone=!1,this._animatables=[],this._frameRate=60,this._shadowsRenderedAfterLoad=!1,this.onLoadedObservable=new n.Observable,this.onLoadErrorObservable=new n.Observable,this.onLoadProgressObservable=new n.Observable,this.onCompleteObservable=new n.Observable,this.onAfterConfigure=new n.Observable,this.state=i.INIT,this.rootMesh=new n.AbstractMesh("modelRootMesh"),this._pivotMesh=new n.AbstractMesh("pivotMesh"),this._pivotMesh.parent=this.rootMesh,this._pivotMesh.rotation.y+=Math.PI,this._scaleTransition=new n.Animation("scaleAnimation","scaling",this._frameRate,n.Animation.ANIMATIONTYPE_VECTOR3,n.Animation.ANIMATIONLOOPMODE_CONSTANT),this._animations=[],this._modelConfiguration=s.deepmerge(this._configurationContainer&&this._configurationContainer.configuration.model||{},t),this._observablesManager&&this._observablesManager.onModelAddedObservable.notifyObservers(this),this._modelConfiguration.entryAnimation&&this.rootMesh.setEnabled(!1),this.onLoadedObservable.add((function(){o.updateConfiguration(o._modelConfiguration),o._observablesManager&&o._observablesManager.onModelLoadedObservable.notifyObservers(o),o._initAnimations()})),this.onCompleteObservable.add((function(){o.state=i.COMPLETE}))}return Object.defineProperty(e.prototype,"shadowsRenderedAfterLoad",{get:function(){return this._shadowsRenderedAfterLoad},set:function(e){if(!e)throw new Error("can only be enabled");this._shadowsRenderedAfterLoad=e},enumerable:!0,configurable:!0}),e.prototype.getViewerId=function(){return this._configurationContainer&&this._configurationContainer.viewerId},Object.defineProperty(e.prototype,"enabled",{get:function(){return this.rootMesh.isEnabled()},set:function(e){this.rootMesh.setEnabled(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loaderDone",{set:function(e){this._loaderDone=e,this._checkCompleteState()},enumerable:!0,configurable:!0}),e.prototype._checkCompleteState=function(){this._loaderDone&&this.state===i.ENTRYDONE&&this._modelComplete()},e.prototype.addMesh=function(e,t){if(e.parent||(e.parent=this._pivotMesh),e.receiveShadows=!!this.configuration.receiveShadows,this._meshes.push(e),t)return this.onLoadedObservable.notifyObserversWithPromise(this)},Object.defineProperty(e.prototype,"meshes",{get:function(){return this._meshes},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configuration",{get:function(){return this._modelConfiguration},set:function(e){this._modelConfiguration=e,this._configureModel()},enumerable:!0,configurable:!0}),e.prototype.updateConfiguration=function(e){this._modelConfiguration=s.deepmerge(this._modelConfiguration,e),this._configureModel()},e.prototype._initAnimations=function(){var e=this;this.skeletons.length&&this.skeletons.forEach((function(t,r){var i=new n.AnimationGroup("animation-"+r);t.getAnimatables().forEach((function(e){e.animations[0]&&i.addTargetedAnimation(e.animations[0],e)})),e.addAnimationGroup(i)}));var t=function(){};if(this._modelConfiguration.animation&&(this._modelConfiguration.animation.playOnce&&this._animations.forEach((function(e){e.playMode=0})),this._modelConfiguration.animation.autoStart&&this._animations.length)){var r=!0===this._modelConfiguration.animation.autoStart?this._animations[0].name:this._modelConfiguration.animation.autoStart;t=function(){e.playAnimation(r)}}this._enterScene(t)},e.prototype._enterScene=function(e){var t=this,r=this.rootMesh.getScene(),n=r.animationPropertiesOverride.enableBlending,o=function(){t.state=i.ENTRYDONE,r.animationPropertiesOverride.enableBlending=n,t._checkCompleteState(),e&&e()};if(!this._entryAnimation)return void o();this.rootMesh.setEnabled(!0),r.animationPropertiesOverride.enableBlending=!1,this._applyAnimation(this._entryAnimation,!0,o)},e.prototype._exitScene=function(e){if(!this._exitAnimation)return void e();this._applyAnimation(this._exitAnimation,!1,e)},e.prototype._modelComplete=function(){var e=this;this._pivotMesh.getChildMeshes(!1).filter((function(e){return e.material})).forEach((function(t){e._applyModelMaterialConfiguration(t.material)})),this.state=i.COMPLETE,this.onCompleteObservable.notifyObservers(this)},e.prototype.addAnimationGroup=function(e){this._animations.push(new o.GroupModelAnimation(e))},e.prototype.getAnimations=function(){return this._animations},e.prototype.getAnimationNames=function(){return this._animations.map((function(e){return e.name}))},e.prototype._getAnimationByName=function(e){var t=this._animations.filter((function(t){return t.name===e}));return 1===t.length?t[0]:null},e.prototype.playAnimation=function(e){var t=this.setCurrentAnimationByName(e);return t&&t.start(),t},e.prototype.setCurrentAnimationByName=function(e){var t=this._getAnimationByName(e);if(t)return this.currentAnimation&&3!==this.currentAnimation.state&&this.currentAnimation.stop(),this.currentAnimation=t,t;throw new Error("animation not found - "+e)},e.prototype._configureModel=function(){var e=this,t=[this.rootMesh],r=function(e,r,i){t.forEach((function(t){i?t[e][i]=r:t[e]=r}))},i=function(e,t){void 0!==t.x&&r(e,t.x,"x"),void 0!==t.y&&r(e,t.y,"y"),void 0!==t.z&&r(e,t.z,"z"),void 0!==t.w&&r(e,t.w,"w")};if(this._modelConfiguration.normalize){var o=!1,s=!1,a=void 0;!0===this._modelConfiguration.normalize?(o=!0,s=!0):(o=!!this._modelConfiguration.normalize.center,s=!!this._modelConfiguration.normalize.unitSize,a=this._modelConfiguration.normalize.parentIndex);var l=[];void 0!==a?l.push(this._meshes[a]):l=1===this._pivotMesh.getChildMeshes(!0).length?[this._pivotMesh]:t,s&&l.forEach((function(e){e.normalizeToUnitCube(!0),e.computeWorldMatrix(!0)})),o&&l.forEach((function(e){var t=e.getHierarchyBoundingVectors(!0),r=t.max.subtract(t.min),i=r.scale(.5),n=t.min.add(i);e.position=n.scale(-1),e.position.y+=i.y,e.computeWorldMatrix(!0)}))}if(this._modelConfiguration.position&&i("position",this._modelConfiguration.position),this._modelConfiguration.rotation&&(this._modelConfiguration.rotation.w?(t.forEach((function(e){e.rotationQuaternion||(e.rotationQuaternion=new n.Quaternion)})),i("rotationQuaternion",this._modelConfiguration.rotation)):i("rotation",this._modelConfiguration.rotation)),this._modelConfiguration.rotationOffsetAxis){var u=new n.Vector3(0,0,0).copyFrom(this._modelConfiguration.rotationOffsetAxis);t.forEach((function(t){e._modelConfiguration.rotationOffsetAngle&&t.rotate(u,e._modelConfiguration.rotationOffsetAngle)}))}this._modelConfiguration.scaling&&i("scaling",this._modelConfiguration.scaling),this._modelConfiguration.castShadow&&this._meshes.forEach((function(e){n.Tags.AddTagsTo(e,"castShadow")})),this._pivotMesh.getChildMeshes(!1).filter((function(e){return e.material})).forEach((function(t){e._applyModelMaterialConfiguration(t.material)})),this._modelConfiguration.entryAnimation&&(this._entryAnimation=this._modelAnimationConfigurationToObject(this._modelConfiguration.entryAnimation)),this._modelConfiguration.exitAnimation&&(this._exitAnimation=this._modelAnimationConfigurationToObject(this._modelConfiguration.exitAnimation)),this.onAfterConfigure.notifyObservers(this)},e.prototype._modelAnimationConfigurationToObject=function(e){var t={time:.5};return e.scaling&&(t.scaling=n.Vector3.Zero()),void 0!==e.easingFunction&&(t.easingFunction=e.easingFunction),void 0!==e.easingMode&&(t.easingMode=e.easingMode),s.extendClassWithConfig(t,e),t},e.prototype._applyModelMaterialConfiguration=function(e){if(this._modelConfiguration.material)if(s.extendClassWithConfig(e,this._modelConfiguration.material),e instanceof n.PBRMaterial)void 0!==this._modelConfiguration.material.directIntensity&&(e.directIntensity=this._modelConfiguration.material.directIntensity),void 0!==this._modelConfiguration.material.emissiveIntensity&&(e.emissiveIntensity=this._modelConfiguration.material.emissiveIntensity),void 0!==this._modelConfiguration.material.environmentIntensity&&(e.environmentIntensity=this._modelConfiguration.material.environmentIntensity),void 0!==this._modelConfiguration.material.directEnabled&&(e.disableLighting=!this._modelConfiguration.material.directEnabled),this._configurationContainer&&this._configurationContainer.reflectionColor&&(e.reflectionColor=this._configurationContainer.reflectionColor);else if(e instanceof n.MultiMaterial)for(var t=0;t<e.subMaterials.length;t++){var r=e.subMaterials[t];r&&this._applyModelMaterialConfiguration(r)}},e.prototype._applyAnimation=function(e,t,r){var i=[];if(e.scaling){var o=t?e.scaling:new n.Vector3(1,1,1),s=t?new n.Vector3(1,1,1):e.scaling;o.equals(s)||(this.rootMesh.scaling=o,this._setLinearKeys(this._scaleTransition,this.rootMesh.scaling,s,e.time),i.push(this._scaleTransition))}this.transitionTo(i,e.time,this._createEasingFunction(e.easingFunction),e.easingMode,(function(){r&&r()}))},e.prototype.transitionTo=function(e,t,r,i,n){if(void 0===i&&(i=BABYLON.EasingFunction.EASINGMODE_EASEINOUT),r)for(var o=0,s=e;o<s.length;o++){var a=s[o];r.setEasingMode(i),a.setEasingFunction(r)}if(this.stopAllAnimations(),this.rootMesh.animations=e,this.rootMesh.getScene().beginAnimation){var l=this.rootMesh.getScene().beginAnimation(this.rootMesh,0,this._frameRate*t,!1,1,(function(){n&&n()}));this._animatables.push(l)}},e.prototype._setLinearKeys=function(e,t,r,i){e.setKeys([{frame:0,value:t},{frame:this._frameRate*i,value:r}])},e.prototype._createEasingFunction=function(e){var t;switch(e){case 1:t=new n.CircleEase;break;case 2:t=new n.BackEase(.3);break;case 3:t=new n.BounceEase;break;case 4:t=new n.CubicEase;break;case 5:t=new n.ElasticEase;break;case 6:t=new n.ExponentialEase;break;case 7:t=new n.PowerEase;break;case 8:t=new n.QuadraticEase;break;case 9:t=new n.QuarticEase;break;case 10:t=new n.QuinticEase;break;case 11:t=new n.SineEase;break;default:n.Tools.Log("No ease function found")}return t},e.prototype.stopAllAnimations=function(){for(this.rootMesh&&(this.rootMesh.animations=[]),this.currentAnimation&&this.currentAnimation.stop();this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.prototype.remove=function(){this.stopAllAnimations(),this.rootMesh.isVisible=!1,this._observablesManager&&this._observablesManager.onModelRemovedObservable.notifyObservers(this)},e.prototype.dispose=function(){this.remove(),this.onAfterConfigure.clear(),this.onLoadedObservable.clear(),this.onLoadErrorObservable.clear(),this.onLoadProgressObservable.clear(),this.loader&&"gltf"===this.loader.name&&this.loader.dispose(),this.particleSystems.forEach((function(e){return e.dispose()})),this.particleSystems.length=0,this.skeletons.forEach((function(e){return e.dispose()})),this.skeletons.length=0,this._animations.forEach((function(e){return e.dispose()})),this._animations.length=0,this.rootMesh.dispose(!1,!0)},e})();t.ViewerModel=a}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){this.onEventBroadcastedObservable=new i.Observable,this._event=this._eventEnabled}return Object.defineProperty(e.prototype,"broadcast",{get:function(){return this._event},enumerable:!0,configurable:!0}),e.prototype.flushWebGLErrors=function(e,t){if(e)for(var r=!0;r;){var i=e._gl;if(i&&i.getError){var n=i.getError();n===i.NO_ERROR?r=!1:this.broadcast("WebGL Error",t,{error:n})}else r=!1}},Object.defineProperty(e.prototype,"enable",{set:function(e){this._event=e?this._eventEnabled:this._eventDisabled},enumerable:!0,configurable:!0}),e.prototype._eventDisabled=function(){},e.prototype._eventEnabled=function(e,t,r){var i={viewerId:t,event:e,session:this.session,date:new Date,now:window.performance?window.performance.now():Date.now(),detail:null};if("object"==typeof r)for(var n in r)r.hasOwnProperty(n)&&(i[n]=r[n]);else r&&(i.detail=r);this.onEventBroadcastedObservable.notifyObservers(i)},Object.defineProperty(e.prototype,"session",{get:function(){return this._currentSessionId||(this._currentSessionId="SESSION_"+Date.now()+Math.floor(65536*Math.random())),this._currentSessionId},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.onEventBroadcastedObservable.clear(),delete this.onEventBroadcastedObservable},e})();t.TelemetryManager=n,t.telemetryManager=new n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){this._viewers={},this.onViewerAddedObservable=new i.Observable,this.onViewerRemovedObservable=new i.Observable}return e.prototype.addViewer=function(e){this._viewers[e.getBaseId()]=e,this._onViewerAdded(e)},e.prototype.removeViewer=function(e){var t=e.getBaseId();delete this._viewers[t],this.onViewerRemovedObservable.notifyObservers(t)},e.prototype.getViewerById=function(e){return this._viewers[e]},e.prototype.getViewerByHTMLElement=function(e){for(var t in this._viewers)if(this._viewers[t].containerElement===e)return this.getViewerById(t)},e.prototype.getViewerPromiseById=function(e){var t=this;return new Promise(function(r,i){var n=t.getViewerById(e);if(n)return r(n);var o=function(i){i.getBaseId()===e&&(r(i),t.onViewerAddedObservable.removeCallback(o))};t.onViewerAddedObservable.add(o)})},e.prototype._onViewerAdded=function(e){this.onViewerAdded&&this.onViewerAdded(e),this.onViewerAddedObservable.notifyObservers(e)},e.prototype.dispose=function(){delete this._onViewerAdded;for(var e in this._viewers)this._viewers[e].dispose();this.onViewerAddedObservable.clear(),this.onViewerRemovedObservable.clear()},e})();t.ViewerManager=n,t.viewerManager=new n}),(function(e,t,r){"use strict";var i=this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}})();Object.defineProperty(t,"__esModule",{value:!0});var n=r(9),o=r(0),s=(function(e){function t(t,r){void 0===r&&(r={extends:"default"});var i=e.call(this,t,r)||this;return i.containerElement=t,i._handlePointerDown=function(e){if(0===e.event.button){var t=e.event.target;if(t){var r=t.parentElement.classList;switch(t.id){case"speed-button":case"types-button":r.contains("open")?r.remove("open"):r.add("open");break;case"play-pause-button":i._togglePlayPause();break;case"label-option-button":var n=t.dataset.value;n&&i._updateAnimationType(n);break;case"speed-option-button":if(!i._currentAnimation)return;var o=t.dataset.value;o&&i._updateAnimationSpeed(o);break;case"progress-wrapper":i._resumePlay=!i._isAnimationPaused,i._resumePlay&&i._togglePlayPause(!0);break;case"fullscreen-button":i.toggleFullscreen();break;default:return}}}},i._togglePlayPause=function(e){if(i._currentAnimation&&(i._isAnimationPaused?i._currentAnimation.restart():i._currentAnimation.pause(),i._isAnimationPaused=!i._isAnimationPaused,!e)){var t=i.templateManager.getTemplate("navBar");t&&t.updateParams({paused:i._isAnimationPaused})}},i._updateProgressBar=function(){var e=i.templateManager.getTemplate("navBar");if(e){var t=e.parent.querySelector("input#progress-wrapper");if(t&&i._currentAnimation){var r=i._currentAnimation.currentFrame/i._currentAnimation.frames*100,n=t.valueAsNumber;Math.abs(n-r)>.5&&(t.value=""+r),1===i._currentAnimation.state?i.sceneManager.camera.autoRotationBehavior&&!i._oldIdleRotationValue&&(i._oldIdleRotationValue=i.sceneManager.camera.autoRotationBehavior.idleRotationSpeed,
- i.sceneManager.camera.autoRotationBehavior.idleRotationSpeed=0):i.sceneManager.camera.autoRotationBehavior&&i._oldIdleRotationValue&&(i.sceneManager.camera.autoRotationBehavior.idleRotationSpeed=i._oldIdleRotationValue,i._oldIdleRotationValue=0)}}},i._updateAnimationSpeed=function(e,t){var r=i.templateManager.getTemplate("navBar");r&&e&&i._currentAnimation&&(i._currentAnimation.speedRatio=parseFloat(e),i._isAnimationPaused||i._currentAnimation.restart(),t?t.selectedSpeed=e+"x":r.updateParams({selectedSpeed:e+"x"}))},i._updateAnimationType=function(e,t){var r=i.templateManager.getTemplate("navBar");r&&(e&&(i._currentAnimation=i.sceneManager.models[0].setCurrentAnimationByName(e)),t?(t.selectedAnimation=i._animationList.indexOf(e)+1,t.selectedAnimationName=e):r.updateParams({selectedAnimation:i._animationList.indexOf(e)+1,selectedAnimationName:e}),i._updateAnimationSpeed("1.0",t))},i.toggleFullscreen=function(){var e=i.templateManager.getTemplate("viewer"),t=e&&e.parent;if(t){if(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement){(document.exitFullscreen||document.webkitExitFullscreen||document.msExitFullscreen||document.mozCancelFullScreen).call(document)}else{(t.requestFullscreen||t.webkitRequestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen).call(t)}}},i._onModelLoaded=function(e){i._configureTemplate(e);var t=20;i.configuration.lab&&void 0!==i.configuration.lab.hideLoadingDelay&&(t=i.configuration.lab.hideLoadingDelay),setTimeout((function(){i.sceneManager.scene.executeWhenReady((function(){i.hideLoadingScreen()}))}),t)},i.onModelLoadedObservable.add(i._onModelLoaded),i.onModelRemovedObservable.add((function(){i._configureTemplate()})),i.onEngineInitObservable.add((function(){i.sceneManager.onLightsConfiguredObservable.add((function(e){i._configureLights(e.newConfiguration,e.model)}))})),i}return i(t,e),t.prototype._onTemplatesLoaded=function(){var t=this;this.showLoadingScreen(),this._initNavbar();var r=document.getElementById("close-button");if(r&&r.addEventListener("pointerdown",(function(){t.hideOverlayScreen()})),this.configuration.templates&&this.configuration.templates.viewer&&this.configuration.templates.viewer.params&&this.configuration.templates.viewer.params.enableDragAndDrop){new o.FilesInput(this.engine,this.sceneManager.scene,function(){},function(){},function(){},function(){},function(){},function(e){t.loadModel(e)},function(){}).monitorElementForDragNDrop(this.templateManager.getCanvas())}return e.prototype._onTemplatesLoaded.call(this)},t.prototype._dropped=function(e){},t.prototype._initNavbar=function(){var e=this;this.templateManager.getTemplate("navBar")&&(this.onFrameRenderedObservable.add(this._updateProgressBar),this.templateManager.eventManager.registerCallback("navBar",this._handlePointerDown,"pointerdown"),this.templateManager.eventManager.registerCallback("navBar",(function(){}),"pointerdown","#help-button"),this.templateManager.eventManager.registerCallback("navBar",(function(t){var r=t.event,i=r.target;if(e._currentAnimation){var n=+i.value/100*e._currentAnimation.frames;isNaN(n)||e._currentAnimation.goToFrame(n)}}),"input"),this.templateManager.eventManager.registerCallback("navBar",(function(t){e._resumePlay&&e._togglePlayPause(!0),e._resumePlay=!1}),"pointerup","#progress-wrapper"))},t.prototype._prepareContainerElement=function(){this.containerElement.style.position="relative",this.containerElement.style.height="100%",this.containerElement.style.display="flex"},t.prototype._configureTemplate=function(e){var t=this.templateManager.getTemplate("navBar");if(t){var r=t.configuration.params||{};if(e){var i=e.getAnimationNames();if(r.animations=i,i.length){this._isAnimationPaused=e.configuration.animation&&!e.configuration.animation.autoStart||!e.configuration.animation,this._animationList=i,r.paused=this._isAnimationPaused;var n=0;e.configuration.animation&&"string"==typeof e.configuration.animation.autoStart&&-1===(n=i.indexOf(e.configuration.animation.autoStart))&&(n=0),this._updateAnimationType(i[n],r)}else r.animations=null;e.configuration.thumbnail&&(r.logoImage=e.configuration.thumbnail)}else r.animations=null;t.updateParams(r,!1)}},t.prototype.loadModel=function(t){var r=this;return t||(t=this.configuration.model),this.showLoadingScreen(),e.prototype.loadModel.call(this,t,!0).catch((function(e){return console.log(e),r.hideLoadingScreen(),r.showOverlayScreen("error"),Promise.reject(e)}))},t.prototype.showOverlayScreen=function(e){var t=this,r=this.templateManager.getTemplate("overlay");return r?r.show((function(r){var i=t.containerElement.getBoundingClientRect();r.parent.style.display="flex",r.parent.style.width=i.width+"px",r.parent.style.height=i.height+"px",r.parent.style.opacity="1";var n=t.templateManager.getTemplate(e);return n?n.show((function(e){return e.parent.style.display="flex",Promise.resolve(e)})):Promise.reject(e+" template not found")})):Promise.resolve("Overlay template not found")},t.prototype.hideOverlayScreen=function(){var e=this.templateManager.getTemplate("overlay");return e?e.hide((function(e){e.parent.style.opacity="0";var t=function(){e.parent.removeEventListener("transitionend",t),e.parent.style.display="none"};e.parent.addEventListener("transitionend",t);var r=e.parent.querySelectorAll(".overlay");if(r)for(var i=0;i<r.length;++i){var n=r.item(i);n.style.display="none"}return Promise.resolve(e)})):Promise.resolve("Overlay template not found")},t.prototype.show=function(e){var t=this.templateManager.getTemplate("main");return t?t.show(e):Promise.reject("Main template not found")},t.prototype.hide=function(e){var t=this.templateManager.getTemplate("main");return t?t.hide(e):Promise.reject("Main template not found")},t.prototype.showLoadingScreen=function(){var e=this,t=this.templateManager.getTemplate("loadingScreen");return t?t.show((function(t){var r=e.containerElement.getBoundingClientRect();t.parent.style.display="flex",t.parent.style.width=r.width+"px",t.parent.style.height=r.height+"px",t.parent.style.opacity="1";var i="black";return e.configuration.templates&&e.configuration.templates.loadingScreen&&(i=e.configuration.templates.loadingScreen.params&&e.configuration.templates.loadingScreen.params.backgroundColor||i),t.parent.style.backgroundColor=i,Promise.resolve(t)})):Promise.resolve("Loading Screen template not found")},t.prototype.hideLoadingScreen=function(){var e=this.templateManager.getTemplate("loadingScreen");return e?e.hide((function(e){e.parent.style.opacity="0";var t=function(){e.parent.removeEventListener("transitionend",t),e.parent.style.display="none"};return e.parent.addEventListener("transitionend",t),Promise.resolve(e)})):Promise.resolve("Loading Screen template not found")},t.prototype.dispose=function(){this.templateManager.dispose(),e.prototype.dispose.call(this)},t.prototype._onConfigurationLoaded=function(t){var r=this;e.prototype._onConfigurationLoaded.call(this,t);var i=this.configuration.templates||{};this.templateManager.initTemplate(i),this.templateManager.onAllLoaded.add((function(){var e=r.templateManager.getCanvas();e&&(r._canvas=e),r._onTemplateLoaded()}))},t.prototype._configureLights=function(e,t){var r=this;if(void 0===e&&(e={}),this.configuration.lab&&this.configuration.lab.flashlight){var i,n=(o.Vector3.Zero(),.5),s=Math.PI/2;"object"==typeof this.configuration.lab.flashlight&&(s=this.configuration.lab.flashlight.exponent||s,n=this.configuration.lab.flashlight.angle||n);var a=new o.SpotLight("flashlight",o.Vector3.Zero(),o.Vector3.Zero(),s,n,this.sceneManager.scene);"object"==typeof this.configuration.lab.flashlight&&(a.intensity=this.configuration.lab.flashlight.intensity||a.intensity,this.configuration.lab.flashlight.diffuse&&(a.diffuse.r=this.configuration.lab.flashlight.diffuse.r,a.diffuse.g=this.configuration.lab.flashlight.diffuse.g,a.diffuse.b=this.configuration.lab.flashlight.diffuse.b),this.configuration.lab.flashlight.specular&&(a.specular.r=this.configuration.lab.flashlight.specular.r,a.specular.g=this.configuration.lab.flashlight.specular.g,a.specular.b=this.configuration.lab.flashlight.specular.b)),this.sceneManager.scene.constantlyUpdateMeshUnderPointer=!0,this.sceneManager.scene.onPointerObservable.add((function(e,t){i=4===e.type&&e.pickInfo?e.pickInfo.pickedPoint:void 0}));var l=function(){r.sceneManager.camera&&a&&(a.position.copyFrom(r.sceneManager.camera.position),i&&i.subtractToRef(a.position,a.direction))};this.sceneManager.scene.registerBeforeRender(l),this._registeredOnBeforeRenderFunctions.push(l)}},t})(n.AbstractViewer);t.DefaultViewer=s}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(7),n=r(22),o=r(28),s=r(0),a=r(13),l=r(4),u=r(6),h=r(1),c=r(59),f=r(60),d=r(61),p=(function(){function e(e,t){void 0===t&&(t={});var r=this;this.containerElement=e,this.runRenderLoop=!0,this._isDisposed=!1,this._resize=function(){r.isCanvasInDOM()&&(r.canvas.clientWidth<=0||r.canvas.clientHeight<=0||r.configuration.engine&&r.configuration.engine.disableResize||r.engine.resize())},this._render=function(e){void 0===e&&(e=!1),(e||r.sceneManager.scene&&r.sceneManager.scene.activeCamera)&&(r.runRenderLoop||e?(r.engine.performanceMonitor.enable(),r.sceneManager.scene.render(),r.onFrameRenderedObservable.notifyObservers(r)):(r.engine.performanceMonitor.disable(),r.sceneManager.scene.activeCamera&&r.sceneManager.scene.activeCamera.update()))},e.id?this.baseId=e.id:this.baseId=e.id="bjs"+Math.random().toString(32).substr(2,8),this._registeredOnBeforeRenderFunctions=[],this._configurationContainer=new f.ConfigurationContainer,i.viewerManager.addViewer(this),this.observablesManager=new c.ObservablesManager,this.modelLoader=new a.ModelLoader(this.observablesManager,this._configurationContainer),s.RenderingManager.AUTOCLEAR=!1,this._configurationLoader=new o.ConfigurationLoader,this._configurationLoader.loadConfiguration(t,(function(e){r._onConfigurationLoaded(e)})),this.onSceneInitObservable.add((function(){r.updateConfiguration()})),this.onInitDoneObservable.add((function(){r._isInit=!0,r.engine.runRenderLoop(r._render)})),this._prepareContainerElement()}return Object.defineProperty(e.prototype,"onSceneInitObservable",{get:function(){return this.observablesManager.onSceneInitObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onEngineInitObservable",{get:function(){return this.observablesManager.onEngineInitObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onModelAddedObservable",{get:function(){return this.observablesManager.onModelAddedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onModelLoadedObservable",{get:function(){return this.observablesManager.onModelLoadedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onModelLoadProgressObservable",{get:function(){return this.observablesManager.onModelLoadProgressObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onModelLoadErrorObservable",{get:function(){return this.observablesManager.onModelLoadErrorObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onModelRemovedObservable",{get:function(){return this.observablesManager.onModelRemovedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onLoaderInitObservable",{get:function(){return this.observablesManager.onLoaderInitObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onInitDoneObservable",{get:function(){return this.observablesManager.onViewerInitDoneObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onFrameRenderedObservable",{get:function(){return this.observablesManager.onFrameRenderedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canvas",{get:function(){return this._canvas},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configurationContainer",{get:function(){return this._configurationContainer},enumerable:!0,configurable:!0}),e.prototype.getBaseId=function(){return this.baseId},e.prototype.isCanvasInDOM=function(){return!!this._canvas&&!!this._canvas.parentElement},Object.defineProperty(e.prototype,"renderInBackground",{get:function(){return this.engine&&this.engine.renderEvenInBackground},set:function(e){this.engine&&(this.engine.renderEvenInBackground=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"configuration",{get:function(){return this._configurationContainer.configuration},enumerable:!0,configurable:!0}),e.prototype.forceResize=function(){this._resize()},e.prototype._onConfigurationLoaded=function(e){var t=this;this._configurationContainer.configuration=h.deepmerge(this.configuration||{},e),this.configuration.observers&&this._configureObservers(this.configuration.observers),this.configuration.loaderPlugins&&Object.keys(this.configuration.loaderPlugins).forEach((function(e){t.configuration.loaderPlugins&&t.configuration.loaderPlugins[e]&&t.modelLoader.addPlugin(e)})),this.templateManager=new d.TemplateManager(this.containerElement)},e.prototype.forceRender=function(){this._render(!0)},e.prototype.takeScreenshot=function(e,t,r){var i=this;return void 0===t&&(t=0),void 0===r&&(r=0),t=t||this.canvas.clientWidth,r=r||this.canvas.clientHeight,new Promise(function(n,o){try{BABYLON.Tools.CreateScreenshot(i.engine,i.sceneManager.camera,{width:t,height:r},(function(t){e&&e(t),n(t)}))}catch(e){o(e)}})},e.prototype.updateConfiguration=function(e){var t=this;void 0===e&&(e=this.configuration),this._configurationContainer.configuration=h.deepmerge(this.configuration||{},e),this.sceneManager.updateConfiguration(e),e.observers&&this._configureObservers(e.observers),e.loaderPlugins&&Object.keys(e.loaderPlugins).forEach((function(r){e.loaderPlugins&&e.loaderPlugins[r]&&t.modelLoader.addPlugin(r)}))},e.prototype._configureObservers=function(e){e.onEngineInit?this.onEngineInitObservable.add(window[e.onEngineInit]):""===e.onEngineInit&&this.configuration.observers&&this.configuration.observers.onEngineInit&&this.onEngineInitObservable.removeCallback(window[this.configuration.observers.onEngineInit]),e.onSceneInit?this.onSceneInitObservable.add(window[e.onSceneInit]):""===e.onSceneInit&&this.configuration.observers&&this.configuration.observers.onSceneInit&&this.onSceneInitObservable.removeCallback(window[this.configuration.observers.onSceneInit]),e.onModelLoaded?this.onModelLoadedObservable.add(window[e.onModelLoaded]):""===e.onModelLoaded&&this.configuration.observers&&this.configuration.observers.onModelLoaded&&this.onModelLoadedObservable.removeCallback(window[this.configuration.observers.onModelLoaded])},e.prototype.dispose=function(){this._isDisposed||(window.removeEventListener("resize",this._resize),this.sceneManager&&(this.sceneManager.scene&&this.sceneManager.scene.activeCamera&&this.sceneManager.scene.activeCamera.detachControl(this.canvas),this.sceneManager.dispose()),this._fpsTimeoutInterval&&clearInterval(this._fpsTimeoutInterval),this.observablesManager.dispose(),this.modelLoader.dispose(),this.engine&&this.engine.dispose(),i.viewerManager.removeViewer(this),this._isDisposed=!0)},e.prototype._onTemplatesLoaded=function(){return Promise.resolve(this)},e.prototype._onTemplateLoaded=function(){var e=this;return this._isDisposed?Promise.reject("viewer was disposed"):this._onTemplatesLoaded().then((function(){var t="string"==typeof e.configuration.model||e.configuration.model&&e.configuration.model.url;return e._initEngine().then((function(t){return e.onEngineInitObservable.notifyObserversWithPromise(t)})).then((function(){return e._initTelemetryEvents(),t?e.loadModel(e.configuration.model).catch((function(e){})).then((function(){return e.sceneManager.scene})):e.sceneManager.scene||e.sceneManager.initScene(e.configuration.scene)})).then((function(){return e.onInitDoneObservable.notifyObserversWithPromise(e)})).catch((function(t){return s.Tools.Warn(t.toString()),e}))}))},e.prototype._initEngine=function(){if(this._injectCustomShaders(),!this.canvas)return Promise.reject("Canvas element not found!");var e=this.configuration.engine||{};if(l.viewerGlobals.disableWebGL2Support&&(e.engineOptions=e.engineOptions||{},e.engineOptions.disableWebGL2Support=!0),this.engine=new s.Engine(this.canvas,!!e.antialiasing,e.engineOptions),s.Database.IDBStorageEnabled=!1,e.disableResize||window.addEventListener("resize",this._resize),this.configuration.engine&&this.configuration.engine.adaptiveQuality){var t=Math.max(.5,1/(window.devicePixelRatio||2));this.engine.setHardwareScalingLevel(t)}return this.sceneManager=new n.SceneManager(this.engine,this._configurationContainer,this.observablesManager),Promise.resolve(this.engine)},e.prototype.initModel=function(e,t){var r=this;void 0===t&&(t=!0);var i;if(i="string"==typeof e?{url:e}:e instanceof File?{file:e,root:"file:"}:e,!i.url&&!i.file)throw new Error("no model provided");if(t&&this.sceneManager.clearScene(!0,!1),this.configuration.model&&"object"==typeof this.configuration.model){var n=h.deepmerge({},this.configuration.model);i=h.deepmerge(n,i),e instanceof File&&(i.file=e)}else this.configuration.model=i;this._isLoading=!0;var o=this.modelLoader.load(i);return this.lastUsedLoader=o.loader,o.onLoadErrorObservable.add((function(e){r.onModelLoadErrorObservable.notifyObserversWithPromise(e)})),o.onLoadProgressObservable.add((function(e){r.onModelLoadProgressObservable.notifyObserversWithPromise(e)})),this.onLoaderInitObservable.notifyObserversWithPromise(this.lastUsedLoader),o.onLoadedObservable.add((function(){r._isLoading=!1})),o},e.prototype.loadModel=function(e,t){var r=this;return void 0===t&&(t=!0),this._isLoading?Promise.reject("another model is curently being loaded."):Promise.resolve(this.sceneManager.scene).then((function(e){return e||r.sceneManager.initScene(r.configuration.scene,r.configuration.optimizer)})).then((function(){var i=r.initModel(e,t);return new Promise(function(e,t){i.onLoadedObservable.add((function(){e(i)})),i.onLoadErrorObservable.add((function(e){t(e)}))})}))},e.prototype._initTelemetryEvents=function(){var e=this;u.telemetryManager.broadcast("Engine Capabilities",this.baseId,this.engine.getCaps()),u.telemetryManager.broadcast("Platform Details",this.baseId,{userAgent:navigator.userAgent,platform:navigator.platform}),u.telemetryManager.flushWebGLErrors(this.engine,this.baseId);var t=function(){u.telemetryManager.broadcast("Current FPS",e.baseId,{fps:e.engine.getFps()})};t(),this._fpsTimeoutInterval=window.setInterval(t,6e4)},e.prototype._injectCustomShaders=function(){var e=this.configuration.customShaders;e&&(e.shaders&&Object.keys(e.shaders).forEach((function(t){s.Effect.ShadersStore[t]=e.shaders[t]})),e.includes&&Object.keys(e.includes).forEach((function(t){s.Effect.IncludesShadersStore[t]=e.includes[t]})))},e})();t.AbstractViewer=p}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),(function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])})(r(11))}),(function(e,t,r){"use strict";function i(e,t){var r=e.split(".");if(0!==r.length&&t){if(1!==r.length){var n=r.shift();return i(r.join("."),t[n])}return void 0!==t[e]?t[e]:void 0}}Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigurationKey=i}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(e,t,r){void 0===r&&(r=[]),this.internalFormat=e,this.type=t,this.source=r}return Object.defineProperty(e.prototype,"Width",{get:function(){return this.source&&this.source[0]&&this.source[0][0]?this.source[0][0].width:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Height",{get:function(){return this.source&&this.source[0]&&this.source[0][0]?this.source[0][0].height:0},enumerable:!0,configurable:!0}),e})();t.TextureCube=n;var o=(function(){function e(){}return e.GetBabylonCubeTexture=function(t,r,o,s,a){if(void 0===s&&(s=!1),void 0===a&&(a=!1),!r)throw new Error("no texture cube provided");var l;l=s?a?e._EnvironmentSingleMipSampling:e._EnvironmentSampling:{magFilter:9728,minFilter:9728,wrapS:33071,wrapT:33071};var u=e.BabylonTextureKeyPrefix+l.magFilter+""+l.minFilter+l.wrapS+l.wrapT,h=r[u];if(!h){h=new i.CubeTexture("",t),s&&(h.lodGenerationOffset=e.EnvironmentLODOffset,h.lodGenerationScale=e.EnvironmentLODScale),h.gammaSpace=!1;var c=new i.InternalTexture(t.getEngine(),i.InternalTexture.DATASOURCE_CUBERAW),f=c._webGLTexture;c.isCube=!0,c.generateMipMaps=!1,h._texture=c,e.ApplySamplingParameters(h,l);for(var d=o?0:r.source.length-1,p=0,A=function(){return p===6*(d+1)},m=function(l,u,h){if(f){0===l&&0===u&&(c.width=h.width,c.height=h.height);var d=t.getEngine()._gl;if(d.bindTexture(d.TEXTURE_CUBE_MAP,f),d.pixelStorei(d.UNPACK_FLIP_Y_WEBGL,0),h instanceof HTMLElement||h instanceof ImageData)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,u,r.internalFormat,r.internalFormat,r.type,h);else{var m=h;d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,u,r.internalFormat,m.width,m.height,0,m.format,r.type,m.data)}if(p++,A()){if(o){var g=h.width,_=h.height;0===(0!==g&&g&g-1)&&0===(0!==_&&_&_-1)&&d.generateMipmap(d.TEXTURE_CUBE_MAP)}if(s&&!t.getEngine().getCaps().textureLOD&&!a)for(var v=0;v<3;v++){var y=e.BabylonTextureKeyPrefix+"lod"+v,b=r[y];if(null==b&&r.Width){var E=v/2,T=1-E,x=T*T+5e-4,M=x*r.Width,C=e.EnvironmentLODScale*i.Scalar.Log2(M)+e.EnvironmentLODOffset,P=r.source.length-1,S=Math.min(Math.max(Math.round(C),0),P);b=e.GetBabylonCubeTexture(t,new n(6408,5121,[r.source[S]]),!1,!0,!0),0===v?c._lodTextureLow=b:1===v?c._lodTextureMid=b:c._lodTextureHigh=b,r[y]=b}}c.isReady=!0}d.bindTexture(d.TEXTURE_CUBE_MAP,null),t.getEngine().resetTextureCache()}},g=0;g<=d;g++)!(function(e){for(var t=r.source[e],i=0;i<t.length;i++)!(function(r){var i=t[r];i instanceof HTMLImageElement&&!i.complete?i.addEventListener("load",(function(){m(r,e,i)}),!1):m(r,e,i)})(i)})(g);t.getEngine().resetTextureCache(),h.isReady=function(){return A()},r[u]=h}return h},e.ApplySamplingParameters=function(e,t){var r=e.getScene();if(r){var n=r.getEngine()._gl,o=e.isCube?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,s=e._texture;if(s){var a=s._webGLTexture;switch(n.bindTexture(o,a),null!=t.magFilter&&n.texParameteri(o,n.TEXTURE_MAG_FILTER,t.magFilter),null!=t.minFilter&&n.texParameteri(o,n.TEXTURE_MIN_FILTER,t.minFilter),null!=t.wrapS&&n.texParameteri(o,n.TEXTURE_WRAP_S,t.wrapS),null!=t.wrapT&&n.texParameteri(o,n.TEXTURE_WRAP_T,t.wrapT),t.wrapS){case 10497:e.wrapU=i.Texture.WRAP_ADDRESSMODE;break;case 33071:e.wrapU=i.Texture.CLAMP_ADDRESSMODE;break;case 33648:e.wrapU=i.Texture.MIRROR_ADDRESSMODE;break;default:e.wrapU=i.Texture.CLAMP_ADDRESSMODE}switch(t.wrapT){case 10497:e.wrapV=i.Texture.WRAP_ADDRESSMODE;break;case 33071:e.wrapV=i.Texture.CLAMP_ADDRESSMODE;break;case 33648:e.wrapV=i.Texture.MIRROR_ADDRESSMODE;break;default:e.wrapV=i.Texture.CLAMP_ADDRESSMODE}if(null!=t.maxAnisotropy&&t.maxAnisotropy>1){var l=n.getExtension("EXT_texture_filter_anisotropic");if(l){var u=n.getParameter(l.MAX_TEXTURE_MAX_ANISOTROPY_EXT),h=Math.min(t.maxAnisotropy,u);n.texParameterf(o,l.TEXTURE_MAX_ANISOTROPY_EXT,h),e.anisotropicFilteringLevel=h}}n.bindTexture(o,null),r.getEngine().resetTextureCache()}}},e.BabylonTextureKeyPrefix="__babylonTexture_",e.MaxAnisotropy=4,e._EnvironmentSampling={magFilter:9729,minFilter:9987,wrapS:33071,wrapT:33071,maxAnisotropy:1},e._EnvironmentSingleMipSampling={magFilter:9729,minFilter:9729,wrapS:33071,wrapT:33071,maxAnisotropy:1},e.EnvironmentLODScale=.8,e.EnvironmentLODOffset=1,e})();t.TextureUtils=o}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(14),o=r(5),s=r(54),a=(function(){function e(e,t){this._observablesManager=e,this._configurationContainer=t,this._disposed=!1,this._loaders=[],this._loadId=0,this._plugins=[]}return e.prototype.addPlugin=function(e){var t={};if("string"==typeof e){var r=s.getLoaderPluginByName(e);r&&(t=r)}else t=e;t&&-1===this._plugins.indexOf(t)&&this._plugins.push(t)},e.prototype.load=function(e){var t=this,r=new o.ViewerModel(this._observablesManager,e);if(r.loadId=this._loadId++,!e.url)return r.state=o.ModelState.ERROR,i.Tools.Error("No URL provided"),r;var s,a;e.file?(s="file:",a=e.file):(a=i.Tools.GetFilename(e.url)||e.url,s=e.root||i.Tools.GetFolderPath(e.url));var l=e.loader,u=r.rootMesh.getScene();if(r.loader=i.SceneLoader.ImportMesh(void 0,s,a,u,(function(e,n,o,s){e.forEach((function(e){i.Tags.AddTagsTo(e,"viewerMesh"),r.addMesh(e)})),r.particleSystems=n,r.skeletons=o;for(var a=0,l=s;a<l.length;a++){var h=l[a];r.addAnimationGroup(h)}t._checkAndRun("onLoaded",r),u.executeWhenReady((function(){r.onLoadedObservable.notifyObservers(r)}))}),(function(e){t._checkAndRun("onProgress",e),r.onLoadProgressObservable.notifyObserversWithPromise(e)}),(function(e,n,s){r.state=o.ModelState.ERROR,i.Tools.Error("Load Error: There was an error loading the model. "+n),t._checkAndRun("onError",n,s),r.onLoadErrorObservable.notifyObserversWithPromise({message:n,exception:s})}),l),"gltf"===r.loader.name){var h=r.loader;h.animationStartMode=n.GLTFLoaderAnimationStartMode.NONE,h.compileMaterials=!0,e.file||(h.rewriteRootURL=function(t,r){return e.root||i.Tools.GetFolderPath(r||e.url||"")}),this._configurationContainer&&this._configurationContainer.configuration&&this._configurationContainer.configuration.ground&&"object"==typeof this._configurationContainer.configuration.ground&&this._configurationContainer.configuration.ground.mirror&&(h.useClipPlane=!0),Object.keys(h).filter((function(e){return 0===e.indexOf("on")&&-1!==e.indexOf("Observable")})).forEach((function(e){h[e].add((function(r){t._checkAndRun(e.replace("Observable",""),r)}))})),h.onParsedObservable.add((function(e){e&&e.json&&e.json.asset&&(r.loadInfo=e.json.asset)})),h.onCompleteObservable.add((function(){r.loaderDone=!0}))}else r.loaderDone=!0;return this._checkAndRun("onInit",r.loader,r),this._loaders.push(r.loader),r},e.prototype.cancelLoad=function(e){var t=e.loader||this._loaders[e.loadId];if(t&&"gltf"===t.name){t.dispose(),e.state=o.ModelState.CANCELED}else i.Tools.Warn("This type of loader cannot cancel the request")},e.prototype.dispose=function(){this._loaders.forEach((function(e){"gltf"===e.name&&e.dispose()})),this._loaders.length=0,this._disposed=!0},e.prototype._checkAndRun=function(e){for(var t=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this._disposed||this._plugins.filter((function(t){return t[e]})).forEach((function(i){try{i[e].apply(t,r)}catch(e){}}))},e})();t.ModelLoader=a}),(function(e,t,r){!(function(t,i){var n=t.BABYLON||this.BABYLON;n=n||r(0),e.exports=i(n)})(this,(function(e){e=e||this.BABYLON;var e,t=(this&&this.__decorate,this&&this.__extends||(function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}})());!(function(e){var t=(function(){function t(){this.solidPattern=/solid (\S*)([\S\s]*)endsolid[ ]*(\S*)/g,this.facetsPattern=/facet([\s\S]*?)endfacet/g,this.normalPattern=/normal[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g,this.vertexPattern=/vertex[\s]+([\-+]?[0-9]+\.?[0-9]*([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+[\s]+([\-+]?[0-9]*\.?[0-9]+([eE][\-+]?[0-9]+)?)+/g,this.name="stl",this.extensions={".stl":{isBinary:!0}}}return t.prototype.importMesh=function(t,r,i,n,o,s,a){var l;if(this.isBinary(i)){var u=new e.Mesh("stlmesh",r);return this.parseBinary(u,i),o&&o.push(u),!0}for(var h=new Uint8Array(i),c="",f=0;f<i.byteLength;f++)c+=String.fromCharCode(h[f]);for(i=c;l=this.solidPattern.exec(i);){var d=l[1];if(d!=l[3])return e.Tools.Error("Error in STL, solid name != endsolid name"),!1;if(t&&d)if(t instanceof Array){if(!t.indexOf(d))continue}else if(d!==t)continue;d=d||"stlmesh";var u=new e.Mesh(d,r);this.parseASCII(u,l[2]),o&&o.push(u)}return!0},t.prototype.load=function(e,t,r){var i=this.importMesh(null,e,t,r,null,null,null);return i&&e.createDefaultCameraOrLight(),i},t.prototype.loadAssetContainer=function(t,r,i,n){var o=new e.AssetContainer(t);return this.importMesh(null,t,r,i,o.meshes,null,null),o.removeAllFromScene(),o},t.prototype.isBinary=function(e){var t,r;if(r=new DataView(e),t=50,84+r.getUint32(80,!0)*t===r.byteLength)return!0;for(var i=r.byteLength,n=0;n<i;n++)if(r.getUint8(n)>127)return!0;return!1},t.prototype.parseBinary=function(t,r){for(var i=new DataView(r),n=i.getUint32(80,!0),o=0,s=new Float32Array(3*n*3),a=new Float32Array(3*n*3),l=new Uint32Array(3*n),u=0,h=0;h<n;h++){for(var c=84+50*h,f=i.getFloat32(c,!0),d=i.getFloat32(c+4,!0),p=i.getFloat32(c+8,!0),A=1;A<=3;A++){var m=c+12*A;s[o]=i.getFloat32(m,!0),s[o+2]=i.getFloat32(m+4,!0),s[o+1]=i.getFloat32(m+8,!0),a[o]=f,a[o+2]=d,a[o+1]=p,o+=3}l[u]=u++,l[u]=u++,l[u]=u++}t.setVerticesData(e.VertexBuffer.PositionKind,s),t.setVerticesData(e.VertexBuffer.NormalKind,a),t.setIndices(l),t.computeWorldMatrix(!0)},t.prototype.parseASCII=function(t,r){for(var i,n=[],o=[],s=[],a=0;i=this.facetsPattern.exec(r);){var l=i[1],u=this.normalPattern.exec(l);if(this.normalPattern.lastIndex=0,u){for(var h,c=[Number(u[1]),Number(u[5]),Number(u[3])];h=this.vertexPattern.exec(l);)n.push(Number(h[1]),Number(h[5]),Number(h[3])),o.push(c[0],c[1],c[2]);s.push(a++,a++,a++),this.vertexPattern.lastIndex=0}}this.facetsPattern.lastIndex=0,t.setVerticesData(e.VertexBuffer.PositionKind,n),t.setVerticesData(e.VertexBuffer.NormalKind,o),t.setIndices(s),t.computeWorldMatrix(!0)},t})();e.STLFileLoader=t,e.SceneLoader&&e.SceneLoader.RegisterPlugin(new t)})(e||(e={}));var e;!(function(e){var t=(function(){function t(){this.materials=[]}return t.prototype.parseMTL=function(r,i,n){if(!(i instanceof ArrayBuffer)){for(var o,s=i.split("\n"),a=/\s+/,l=null,u=0;u<s.length;u++){var h=s[u].trim();if(0!==h.length&&"#"!==h.charAt(0)){var c=h.indexOf(" "),f=c>=0?h.substring(0,c):h;f=f.toLowerCase();var d=c>=0?h.substring(c+1).trim():"";"newmtl"===f?(l&&this.materials.push(l),l=new e.StandardMaterial(d,r)):"kd"===f&&l?(o=d.split(a,3).map(parseFloat),l.diffuseColor=e.Color3.FromArray(o)):"ka"===f&&l?(o=d.split(a,3).map(parseFloat),l.ambientColor=e.Color3.FromArray(o)):"ks"===f&&l?(o=d.split(a,3).map(parseFloat),l.specularColor=e.Color3.FromArray(o)):"ke"===f&&l?(o=d.split(a,3).map(parseFloat),l.emissiveColor=e.Color3.FromArray(o)):"ns"===f&&l?l.specularPower=parseFloat(d):"d"===f&&l?l.alpha=parseFloat(d):"map_ka"===f&&l?l.ambientTexture=t._getTexture(n,d,r):"map_kd"===f&&l?l.diffuseTexture=t._getTexture(n,d,r):"map_ks"===f&&l?l.specularTexture=t._getTexture(n,d,r):"map_ns"===f||("map_bump"===f&&l?l.bumpTexture=t._getTexture(n,d,r):"map_d"===f&&l&&(l.opacityTexture=t._getTexture(n,d,r)))}}l&&this.materials.push(l)}},t._getTexture=function(t,r,i){if(!r)return null;var n=t;if("file:"===t){var o=r.lastIndexOf("\\");-1===o&&(o=r.lastIndexOf("/")),n+=o>-1?r.substr(o+1):r}else n+=r;return new e.Texture(n,i)},t})();e.MTLFileLoader=t;var r=(function(){function r(){this.name="obj",this.extensions=".obj",this.obj=/^o/,this.group=/^g/,this.mtllib=/^mtllib /,this.usemtl=/^usemtl /,this.smooth=/^s /,this.vertexPattern=/v( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.normalPattern=/vn( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.uvPattern=/vt( +[\d|\.|\+|\-|e|E]+)( +[\d|\.|\+|\-|e|E]+)/,this.facePattern1=/f\s+(([\d]{1,}[\s]?){3,})+/,this.facePattern2=/f\s+((([\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,this.facePattern3=/f\s+((([\d]{1,}\/[\d]{1,}\/[\d]{1,}[\s]?){3,})+)/,this.facePattern4=/f\s+((([\d]{1,}\/\/[\d]{1,}[\s]?){3,})+)/}return r.prototype._loadMTL=function(t,r,i){var n=e.Tools.BaseUrl+r+t;e.Tools.LoadFile(n,i,void 0,void 0,!1,(function(){console.warn("Error - Unable to load "+n)}))},r.prototype.importMesh=function(e,t,r,i,n,o,s){var a=this._parseSolid(e,t,r,i);return n&&a.forEach((function(e){n.push(e)})),!0},r.prototype.load=function(e,t,r){
- return this.importMesh(null,e,t,r,null,null,null)},r.prototype.loadAssetContainer=function(t,r,i,n){var o=new e.AssetContainer(t);return this.importMesh(null,t,r,i,o.meshes,null,null),o.removeAllFromScene(),o},r.prototype._parseSolid=function(i,n,o,s){for(var a,l=[],u=[],h=[],c=[],f=[],d=[],p=[],A=[],m=[],g=0,_=!1,v=[],y=[],b=[],E=[],T="",x="",M=new t,C=1,P=!0,S=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[]});var r=e[t[0]].normals.indexOf(t[1]);return-1===r?-1:e[t[0]].idx[r]},R=function(e,t){e[t[0]]||(e[t[0]]={normals:[],idx:[],uv:[]});var r=e[t[0]].normals.indexOf(t[1]);return 1!=r&&t[2]==e[t[0]].uv[r]?e[t[0]].idx[r]:-1},O=function(e,t,i,n,o,s){var a;a=r.OPTIMIZE_WITH_UV?R(m,[e,i,t]):S(m,[e,i]),-1==a?(f.push(d.length),d.push(n),p.push(o),A.push(s),m[e].normals.push(i),m[e].idx.push(g++),r.OPTIMIZE_WITH_UV&&m[e].uv.push(t)):f.push(a)},D=function(){for(var e=0;e<d.length;e++)v.push(d[e].x,d[e].y,d[e].z),y.push(A[e].x,A[e].y,A[e].z),b.push(p[e].x,p[e].y);d=[],A=[],p=[],m=[],g=0},w=function(e,t){t+1<e.length&&(E.push(e[0],e[t],e[t+1]),t+=1,w(e,t))},I=function(){c.length>0&&(a=c[c.length-1],D(),f.reverse(),a.indices=f.slice(),a.positions=v.slice(),a.normals=y.slice(),a.uvs=b.slice(),f=[],v=[],y=[],b=[])},L=o.split("\n"),B=0;B<L.length;B++){var F,N=L[B].trim();if(0!==N.length&&"#"!==N.charAt(0))if(null!==(F=this.vertexPattern.exec(N)))l.push(new e.Vector3(parseFloat(F[1]),parseFloat(F[2]),parseFloat(F[3])));else if(null!==(F=this.normalPattern.exec(N)))u.push(new e.Vector3(parseFloat(F[1]),parseFloat(F[2]),parseFloat(F[3])));else if(null!==(F=this.uvPattern.exec(N)))h.push(new e.Vector2(parseFloat(F[1]),parseFloat(F[2])));else if(null!==(F=this.facePattern3.exec(N)))!(function(e,t){w(e,t);for(var r=0;r<E.length;r++){var i=E[r].split("/"),n=parseInt(i[0])-1,o=parseInt(i[1])-1,s=parseInt(i[2])-1;O(n,o,s,l[n],h[o],u[s])}E=[]})(F[1].trim().split(" "),1);else if(null!==(F=this.facePattern4.exec(N)))!(function(t,r){w(t,r);for(var i=0;i<E.length;i++){var n=E[i].split("//"),o=parseInt(n[0])-1,s=parseInt(n[1])-1;O(o,1,s,l[o],e.Vector2.Zero(),u[s])}E=[]})(F[1].trim().split(" "),1);else if(null!==(F=this.facePattern2.exec(N)))!(function(t,r){w(t,r);for(var i=0;i<E.length;i++){var n=E[i].split("/"),o=parseInt(n[0])-1,s=parseInt(n[1])-1;O(o,s,0,l[o],h[s],e.Vector3.Up())}E=[]})(F[1].trim().split(" "),1);else if(null!==(F=this.facePattern1.exec(N)))!(function(t,r){w(t,r);for(var i=0;i<E.length;i++){var n=parseInt(E[i])-1;O(n,0,0,l[n],e.Vector2.Zero(),e.Vector3.Up())}E=[]})(F[1].trim().split(" "),1);else if(this.group.test(N)||this.obj.test(N)){var U={name:N.substring(2).trim(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,materialName:""};I(),c.push(U),_=!0,P=!0,C=1}else if(this.usemtl.test(N)){if(T=N.substring(7).trim(),!P){I();var U={name:"_mm"+C.toString(),indices:void 0,positions:void 0,normals:void 0,uvs:void 0,materialName:T};C++,c.push(U)}_&&P&&(c[c.length-1].materialName=T,P=!1)}else this.mtllib.test(N)?x=N.substring(7).trim():this.smooth.test(N)||console.log("Unhandled expression at line : "+N)}_&&(a=c[c.length-1],f.reverse(),D(),a.indices=f,a.positions=v,a.normals=y,a.uvs=b),_||(f.reverse(),D(),c.push({name:e.Geometry.RandomId(),indices:f,positions:v,normals:y,uvs:b,materialName:T}));for(var V=[],k=new Array,G=0;G<c.length;G++){if(i&&c[G].name)if(i instanceof Array){if(-1==i.indexOf(c[G].name))continue}else if(c[G].name!==i)continue;a=c[G];var z=new e.Mesh(c[G].name,n);k.push(c[G].materialName);var H=new e.VertexData;H.positions=a.positions,H.normals=a.normals,H.uvs=a.uvs,H.indices=a.indices,H.applyToMesh(z),r.INVERT_Y&&(z.scaling.y*=-1),V.push(z)}return""!==x&&this._loadMTL(x,s,(function(e){M.parseMTL(n,e,s);for(var t=0;t<M.materials.length;t++){for(var r,i=0,o=[];(r=k.indexOf(M.materials[t].name,i))>-1;)o.push(r),i=r+1;if(-1==r&&0==o.length)M.materials[t].dispose();else for(var a=0;a<o.length;a++)V[o[a]].material=M.materials[t]}})),V},r.OPTIMIZE_WITH_UV=!1,r.INVERT_Y=!1,r})();e.OBJFileLoader=r,e.SceneLoader&&e.SceneLoader.RegisterPlugin(new r)})(e||(e={}));var e;!(function(e){var t;!(function(e){e[e.AUTO=0]="AUTO",e[e.FORCE_RIGHT_HANDED=1]="FORCE_RIGHT_HANDED"})(t=e.GLTFLoaderCoordinateSystemMode||(e.GLTFLoaderCoordinateSystemMode={}));var r;!(function(e){e[e.NONE=0]="NONE",e[e.FIRST=1]="FIRST",e[e.ALL=2]="ALL"})(r=e.GLTFLoaderAnimationStartMode||(e.GLTFLoaderAnimationStartMode={}));!(function(e){e[e.LOADING=0]="LOADING",e[e.READY=1]="READY",e[e.COMPLETE=2]="COMPLETE"})(e.GLTFLoaderState||(e.GLTFLoaderState={}));var i=(function(){function i(){this.onParsedObservable=new e.Observable,this.coordinateSystemMode=t.AUTO,this.animationStartMode=r.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this._normalizeAnimationGroupsToBeginAtZero=!0,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable=new e.Observable,this.onTextureLoadedObservable=new e.Observable,this.onMaterialLoadedObservable=new e.Observable,this.onCameraLoadedObservable=new e.Observable,this.onCompleteObservable=new e.Observable,this.onDisposeObservable=new e.Observable,this.onExtensionLoadedObservable=new e.Observable,this._loader=null,this.name="gltf",this.extensions={".gltf":{isBinary:!1},".glb":{isBinary:!0}}}return Object.defineProperty(i.prototype,"onParsed",{set:function(e){this._onParsedObserver&&this.onParsedObservable.remove(this._onParsedObserver),this._onParsedObserver=this.onParsedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onMeshLoaded",{set:function(e){this._onMeshLoadedObserver&&this.onMeshLoadedObservable.remove(this._onMeshLoadedObserver),this._onMeshLoadedObserver=this.onMeshLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onTextureLoaded",{set:function(e){this._onTextureLoadedObserver&&this.onTextureLoadedObservable.remove(this._onTextureLoadedObserver),this._onTextureLoadedObserver=this.onTextureLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onMaterialLoaded",{set:function(e){this._onMaterialLoadedObserver&&this.onMaterialLoadedObservable.remove(this._onMaterialLoadedObserver),this._onMaterialLoadedObserver=this.onMaterialLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onCameraLoaded",{set:function(e){this._onCameraLoadedObserver&&this.onCameraLoadedObservable.remove(this._onCameraLoadedObserver),this._onCameraLoadedObserver=this.onCameraLoadedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onComplete",{set:function(e){this._onCompleteObserver&&this.onCompleteObservable.remove(this._onCompleteObserver),this._onCompleteObserver=this.onCompleteObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onExtensionLoaded",{set:function(e){this._onExtensionLoadedObserver&&this.onExtensionLoadedObservable.remove(this._onExtensionLoadedObserver),this._onExtensionLoadedObserver=this.onExtensionLoadedObservable.add(e)},enumerable:!0,configurable:!0}),i.prototype.whenCompleteAsync=function(){var e=this;return new Promise(function(t){e.onCompleteObservable.addOnce((function(){t()}))})},Object.defineProperty(i.prototype,"loaderState",{get:function(){return this._loader?this._loader.state:null},enumerable:!0,configurable:!0}),i.prototype.dispose=function(){this._loader&&(this._loader.dispose(),this._loader=null),this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear(),this.onCompleteObservable.clear(),this.onExtensionLoadedObservable.clear(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},i.prototype.importMeshAsync=function(e,t,r,i,n){var o=this;return Promise.resolve().then((function(){var s=o._parse(r);return o._loader=o._getLoader(s),o._loader.importMeshAsync(e,t,s,i,n)}))},i.prototype.loadAsync=function(e,t,r,i){var n=this;return Promise.resolve().then((function(){var o=n._parse(t);return n._loader=n._getLoader(o),n._loader.loadAsync(e,o,r,i)}))},i.prototype.loadAssetContainerAsync=function(t,r,i,n){var o=this;return Promise.resolve().then((function(){var s=o._parse(r);return o._loader=o._getLoader(s),o._loader.importMeshAsync(null,t,s,i,n).then((function(r){var i=new e.AssetContainer(t);return Array.prototype.push.apply(i.meshes,r.meshes),Array.prototype.push.apply(i.particleSystems,r.particleSystems),Array.prototype.push.apply(i.skeletons,r.skeletons),Array.prototype.push.apply(i.animationGroups,r.animationGroups),i.removeAllFromScene(),i}))}))},i.prototype.canDirectLoad=function(e){return-1!==e.indexOf("scene")&&-1!==e.indexOf("node")},i.prototype.createPlugin=function(){return new i},i.prototype._parse=function(e){var t;return t=e instanceof ArrayBuffer?i._parseBinary(e):{json:JSON.parse(e),bin:null},this.onParsedObservable.notifyObservers(t),this.onParsedObservable.clear(),t},i.prototype._getLoader=function(e){var t=this,r={major:2,minor:0},n=e.json.asset||{},o=i._parseVersion(n.version);if(!o)throw new Error("Invalid version: "+n.version);if(void 0!==n.minVersion){var s=i._parseVersion(n.minVersion);if(!s)throw new Error("Invalid minimum version: "+n.minVersion);if(i._compareVersion(s,r)>0)throw new Error("Incompatible minimum version: "+n.minVersion)}var a={1:i._CreateGLTFLoaderV1,2:i._CreateGLTFLoaderV2},l=a[o.major];if(!l)throw new Error("Unsupported version: "+n.version);var u=l();return u.coordinateSystemMode=this.coordinateSystemMode,u.animationStartMode=this.animationStartMode,u.compileMaterials=this.compileMaterials,u.useClipPlane=this.useClipPlane,u.compileShadowGenerators=this.compileShadowGenerators,u.transparencyAsCoverage=this.transparencyAsCoverage,u._normalizeAnimationGroupsToBeginAtZero=this._normalizeAnimationGroupsToBeginAtZero,u.preprocessUrlAsync=this.preprocessUrlAsync,u.onMeshLoadedObservable.add((function(e){return t.onMeshLoadedObservable.notifyObservers(e)})),u.onTextureLoadedObservable.add((function(e){return t.onTextureLoadedObservable.notifyObservers(e)})),u.onMaterialLoadedObservable.add((function(e){return t.onMaterialLoadedObservable.notifyObservers(e)})),u.onCameraLoadedObservable.add((function(e){return t.onCameraLoadedObservable.notifyObservers(e)})),u.onExtensionLoadedObservable.add((function(e){return t.onExtensionLoadedObservable.notifyObservers(e)})),u.onCompleteObservable.add((function(){t.onMeshLoadedObservable.clear(),t.onTextureLoadedObservable.clear(),t.onMaterialLoadedObservable.clear(),t.onCameraLoadedObservable.clear(),t.onExtensionLoadedObservable.clear(),t.onCompleteObservable.notifyObservers(t),t.onCompleteObservable.clear()})),u},i._parseBinary=function(e){var t={Magic:1179937895},r=new n(e),o=r.readUint32();if(o!==t.Magic)throw new Error("Unexpected magic: "+o);var s=r.readUint32();switch(s){case 1:return i._parseV1(r);case 2:return i._parseV2(r)}throw new Error("Unsupported version: "+s)},i._parseV1=function(e){var t={JSON:0},r=e.readUint32();if(r!=e.getLength())throw new Error("Length in header does not match actual data length: "+r+" != "+e.getLength());var n,o=e.readUint32(),s=e.readUint32();switch(s){case t.JSON:n=JSON.parse(i._decodeBufferToText(e.readUint8Array(o)));break;default:throw new Error("Unexpected content format: "+s)}var a=e.getLength()-e.getPosition();return{json:n,bin:e.readUint8Array(a)}},i._parseV2=function(e){var t={JSON:1313821514,BIN:5130562},r=e.readUint32();if(r!==e.getLength())throw new Error("Length in header does not match actual data length: "+r+" != "+e.getLength());var n=e.readUint32();if(e.readUint32()!==t.JSON)throw new Error("First chunk format is not JSON");for(var o=JSON.parse(i._decodeBufferToText(e.readUint8Array(n))),s=null;e.getPosition()<e.getLength();){var a=e.readUint32();switch(e.readUint32()){case t.JSON:throw new Error("Unexpected JSON chunk");case t.BIN:s=e.readUint8Array(a);break;default:e.skipBytes(a)}}return{json:o,bin:s}},i._parseVersion=function(e){if("1.0"===e||"1.0.1"===e)return{major:1,minor:0};var t=(e+"").match(/^(\d+)\.(\d+)/);return t?{major:parseInt(t[1]),minor:parseInt(t[2])}:null},i._compareVersion=function(e,t){return e.major>t.major?1:e.major<t.major?-1:e.minor>t.minor?1:e.minor<t.minor?-1:0},i._decodeBufferToText=function(e){for(var t="",r=e.byteLength,i=0;i<r;i++)t+=String.fromCharCode(e[i]);return t},i.IncrementalLoading=!0,i.HomogeneousCoordinates=!1,i})();e.GLTFFileLoader=i;var n=(function(){function e(e){this._arrayBuffer=e,this._dataView=new DataView(e),this._byteOffset=0}return e.prototype.getPosition=function(){return this._byteOffset},e.prototype.getLength=function(){return this._arrayBuffer.byteLength},e.prototype.readUint32=function(){var e=this._dataView.getUint32(this._byteOffset,!0);return this._byteOffset+=4,e},e.prototype.readUint8Array=function(e){var t=new Uint8Array(this._arrayBuffer,this._byteOffset,e);return this._byteOffset+=e,t},e.prototype.skipBytes=function(e){this._byteOffset+=e},e})();e.SceneLoader&&e.SceneLoader.RegisterPlugin(new i)})(e||(e={}));var e;!(function(e){!(function(e){!(function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.FLOAT=5126]="FLOAT"})(e.EComponentType||(e.EComponentType={}));!(function(e){e[e.FRAGMENT=35632]="FRAGMENT",e[e.VERTEX=35633]="VERTEX"})(e.EShaderType||(e.EShaderType={}));!(function(e){e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D"})(e.EParameterType||(e.EParameterType={}));!(function(e){e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.REPEAT=10497]="REPEAT"})(e.ETextureWrapMode||(e.ETextureWrapMode={}));!(function(e){e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9728]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR"})(e.ETextureFilterType||(e.ETextureFilterType={}));!(function(e){e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA"})(e.ETextureFormat||(e.ETextureFormat={}));!(function(e){e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK"})(e.ECullingType||(e.ECullingType={}));!(function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"})(e.EBlendingFunction||(e.EBlendingFunction={}))})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(t){var r;!(function(e){e[e.IDENTIFIER=1]="IDENTIFIER",e[e.UNKNOWN=2]="UNKNOWN",e[e.END_OF_INPUT=3]="END_OF_INPUT"})(r||(r={}));var i=(function(){function e(e){this._pos=0,this.currentToken=r.UNKNOWN,this.currentIdentifier="",this.currentString="",this.isLetterOrDigitPattern=/^[a-zA-Z0-9]+$/,this._toParse=e,this._maxPos=e.length}return e.prototype.getNextToken=function(){if(this.isEnd())return r.END_OF_INPUT;if(this.currentString=this.read(),this.currentToken=r.UNKNOWN,"_"===this.currentString||this.isLetterOrDigitPattern.test(this.currentString))for(this.currentToken=r.IDENTIFIER,this.currentIdentifier=this.currentString;!this.isEnd()&&(this.isLetterOrDigitPattern.test(this.currentString=this.peek())||"_"===this.currentString);)this.currentIdentifier+=this.currentString,this.forward();return this.currentToken},e.prototype.peek=function(){return this._toParse[this._pos]},e.prototype.read=function(){return this._toParse[this._pos++]},e.prototype.forward=function(){this._pos++},e.prototype.isEnd=function(){return this._pos>=this._maxPos},e})(),n=["MODEL","VIEW","PROJECTION","MODELVIEW","MODELVIEWPROJECTION","JOINTMATRIX"],o=["world","view","projection","worldView","worldViewProjection","mBones"],s=["translation","rotation","scale"],a=["position","rotationQuaternion","scaling"],l=function(e,t){for(var r in e){var i=e[r];t.buffers[r]=i,t.buffersCount++}},u=function(e,t){for(var r in e){var i=e[r];t.shaders[r]=i,t.shaderscount++}},h=function(e,t,r){for(var i in e){var n=e[i];r[t][i]=n}},c=function(e){if(e)for(var t=0;t<e.length/2;t++)e[2*t+1]=1-e[2*t+1]},f=function(e){if("NORMAL"===e.semantic)return"normal";if("POSITION"===e.semantic)return"position";if("JOINT"===e.semantic)return"matricesIndices";if("WEIGHT"===e.semantic)return"matricesWeights";if("COLOR"===e.semantic)return"color";if(e.semantic&&-1!==e.semantic.indexOf("TEXCOORD_")){var t=Number(e.semantic.split("_")[1]);return"uv"+(0===t?"":t+1)}return null},d=function(r){for(var i in r.animations){var n=r.animations[i];if(n.channels&&n.samplers)for(var o=null,l=0;l<n.channels.length;l++){var u=n.channels[l],h=n.samplers[u.sampler];if(h){var c=null,f=null;n.parameters?(c=n.parameters[h.input],f=n.parameters[h.output]):(c=h.input,f=h.output);var d=t.GLTFUtils.GetBufferFromAccessor(r,r.accessors[c]),p=t.GLTFUtils.GetBufferFromAccessor(r,r.accessors[f]),A=u.target.id,m=r.scene.getNodeByID(A);if(null===m&&(m=r.scene.getNodeByName(A)),null!==m){var g=m instanceof e.Bone,_=u.target.path,v=s.indexOf(_);-1!==v&&(_=a[v]);var y=e.Animation.ANIMATIONTYPE_MATRIX;g||("rotationQuaternion"===_?(y=e.Animation.ANIMATIONTYPE_QUATERNION,m.rotationQuaternion=new e.Quaternion):y=e.Animation.ANIMATIONTYPE_VECTOR3);var b=null,E=[],T=0,x=!1;g&&o&&o.getKeys().length===d.length&&(b=o,x=!0),x||(b=new e.Animation(i,g?"_matrix":_,1,y,e.Animation.ANIMATIONLOOPMODE_CYCLE));for(var M=0;M<d.length;M++){var C=null;if("rotationQuaternion"===_?(C=e.Quaternion.FromArray([p[T],p[T+1],p[T+2],p[T+3]]),T+=4):(C=e.Vector3.FromArray([p[T],p[T+1],p[T+2]]),T+=3),g){var P=m,S=e.Vector3.Zero(),R=new e.Quaternion,O=e.Vector3.Zero(),D=P.getBaseMatrix();x&&o&&(D=o.getKeys()[M].value),D.decompose(O,R,S),"position"===_?S=C:"rotationQuaternion"===_?R=C:O=C,C=e.Matrix.Compose(O,R,S)}x?o&&(o.getKeys()[M].value=C):E.push({frame:d[M],value:C})}!x&&b&&(b.setKeys(E),m.animations.push(b)),o=b,r.scene.stopAnimation(m),r.scene.beginAnimation(m,0,d[d.length-1],!0,1)}else e.Tools.Warn("Creating animation named "+i+". But cannot find node named "+A+" to attach to")}}}},p=function(t){var r=null;if(t.translation||t.rotation||t.scale){var i=e.Vector3.FromArray(t.scale||[1,1,1]),n=e.Quaternion.FromArray(t.rotation||[0,0,0,1]),o=e.Vector3.FromArray(t.translation||[0,0,0]);r=e.Matrix.Compose(i,n,o)}else r=e.Matrix.FromArray(t.matrix);return r},A=function(t,r,i,n){for(var o=0;o<n.bones.length;o++)if(n.bones[o].name===i)return n.bones[o];var s=t.nodes;for(var a in s){var l=s[a];if(l.jointName)for(var u=l.children,o=0;o<u.length;o++){var h=t.nodes[u[o]];if(h.jointName&&h.jointName===i){var c=p(l),f=new e.Bone(l.name||"",n,A(t,r,l.jointName,n),c);return f.id=a,f}}}return null},m=function(e,t){for(var r=0;r<e.length;r++)for(var i=e[r],n=0;n<i.node.children.length;n++){var o=i.node.children[n];if(o===t)return i.bone}return null},g=function(e,t){var r=e.nodes,i=r[t];if(i)return{node:i,id:t};for(var n in r)if(i=r[n],i.jointName===t)return{node:i,id:n};return null},_=function(e,t){for(var r=0;r<e.jointNames.length;r++)if(e.jointNames[r]===t)return!0;return!1},v=function(t,r,i,n){for(var o in t.nodes){var s=t.nodes[o],a=o;if(s.jointName&&!_(i,s.jointName)){var l=p(s),u=new e.Bone(s.name||"",r,null,l);u.id=a,n.push({bone:u,node:s,id:a})}}for(var h=0;h<n.length;h++)for(var c=n[h],f=c.node.children,d=0;d<f.length;d++){for(var A=null,m=0;m<n.length;m++)if(n[m].id===f[d]){A=n[m];break}A&&(A.bone._parent=c.bone,c.bone.children.push(A.bone))}},y=function(t,r,i,n,o){if(n||(n=new e.Skeleton(r.name||"","",t.scene)),!r.babylonSkeleton)return n;var s=[],a=[];v(t,n,r,s),n.bones=[];for(var l=0;l<r.jointNames.length;l++){var u=g(t,r.jointNames[l]);if(u){var h=u.node;if(h){var o=u.id,c=t.scene.getBoneByID(o);if(c)n.bones.push(c);else{for(var f=!1,d=null,_=0;_<l;_++){var y=g(t,r.jointNames[_]);if(y){var b=y.node;if(b){var E=b.children;if(E){f=!1;for(var T=0;T<E.length;T++)if(E[T]===o){d=A(t,r,r.jointNames[_],n),f=!0;break}if(f)break}}else e.Tools.Warn("Joint named "+r.jointNames[_]+" does not exist when looking for parent")}}var x=p(h);!d&&s.length>0&&(d=m(s,o))&&-1===a.indexOf(d)&&a.push(d);new e.Bone(h.jointName||"",n,d,x).id=o}}else e.Tools.Warn("Joint named "+r.jointNames[l]+" does not exist")}}var M=n.bones;n.bones=[];for(var l=0;l<r.jointNames.length;l++){var u=g(t,r.jointNames[l]);if(u)for(var _=0;_<M.length;_++)if(M[_].id===u.id){n.bones.push(M[_]);break}}n.prepare();for(var l=0;l<a.length;l++)n.bones.push(a[l]);return n},b=function(r,i,n,o,s){if(s||(s=new e.Mesh(i.name||"",r.scene),s.id=o),!i.babylonNode)return s;for(var a=[],l=null,u=new Array,h=new Array,f=new Array,d=new Array,p=0;p<n.length;p++){var A=n[p],m=r.meshes[A];if(m)for(var g=0;g<m.primitives.length;g++){var _=new e.VertexData,v=m.primitives[g];v.mode;var y=v.attributes,b=null,E=null;for(var T in y)if(b=r.accessors[y[T]],E=t.GLTFUtils.GetBufferFromAccessor(r,b),"NORMAL"===T)_.normals=new Float32Array(E.length),_.normals.set(E);else if("POSITION"===T){if(e.GLTFFileLoader.HomogeneousCoordinates){_.positions=new Float32Array(E.length-E.length/4);for(var x=0;x<E.length;x+=4)_.positions[x]=E[x],_.positions[x+1]=E[x+1],_.positions[x+2]=E[x+2]}else _.positions=new Float32Array(E.length),_.positions.set(E);h.push(_.positions.length)}else if(-1!==T.indexOf("TEXCOORD_")){var M=Number(T.split("_")[1]),C=e.VertexBuffer.UVKind+(0===M?"":M+1),P=new Float32Array(E.length);P.set(E),c(P),_.set(P,C)}else"JOINT"===T?(_.matricesIndices=new Float32Array(E.length),_.matricesIndices.set(E)):"WEIGHT"===T?(_.matricesWeights=new Float32Array(E.length),_.matricesWeights.set(E)):"COLOR"===T&&(_.colors=new Float32Array(E.length),_.colors.set(E));if(b=r.accessors[v.indices])E=t.GLTFUtils.GetBufferFromAccessor(r,b),_.indices=new Int32Array(E.length),_.indices.set(E),d.push(_.indices.length);else{for(var S=[],x=0;x<_.positions.length/3;x++)S.push(x);_.indices=new Int32Array(S),d.push(_.indices.length)}l?l.merge(_):l=_;var R=r.scene.getMaterialByID(v.material);a.push(null===R?t.GLTFUtils.GetDefaultMaterial(r.scene):R),u.push(0===u.length?0:u[u.length-1]+h[h.length-2]),f.push(0===f.length?0:f[f.length-1]+d[d.length-2])}}var O;a.length>1?(O=new e.MultiMaterial("multimat"+o,r.scene),O.subMaterials=a):O=new e.StandardMaterial("multimat"+o,r.scene),1===a.length&&(O=a[0]),s.material||(s.material=O),new e.Geometry(o,r.scene,l,!1,s),s.computeWorldMatrix(!0),s.subMeshes=[];for(var D=0,p=0;p<n.length;p++){var A=n[p],m=r.meshes[A];if(m)for(var g=0;g<m.primitives.length;g++)m.primitives[g].mode,e.SubMesh.AddToMesh(D,u[D],h[D],f[D],d[D],s,s,!0),D++}return s},E=function(e,t,r,i){e.position&&(e.position=t),(e.rotationQuaternion||e.rotation)&&(e.rotationQuaternion=r),e.scaling&&(e.scaling=i)},T=function(t,r,i){if(r.matrix){var n=new e.Vector3(0,0,0),o=new e.Quaternion,s=new e.Vector3(0,0,0);e.Matrix.FromArray(r.matrix).decompose(s,o,n),E(t,n,o,s)}else r.translation&&r.rotation&&r.scale&&E(t,e.Vector3.FromArray(r.translation),e.Quaternion.FromArray(r.rotation),e.Vector3.FromArray(r.scale));t.computeWorldMatrix(!0)},x=function(t,r,i,n){var o=null;if(t.importOnlyMeshes&&(r.skin||r.meshes)&&t.importMeshesNames&&t.importMeshesNames.length>0&&-1===t.importMeshesNames.indexOf(r.name||""))return null;if(r.skin){if(r.meshes){var s=t.skins[r.skin],a=b(t,r,r.meshes,i,r.babylonNode);a.skeleton=t.scene.getLastSkeletonByID(r.skin),null===a.skeleton&&(a.skeleton=y(t,s,0,s.babylonSkeleton,r.skin),s.babylonSkeleton||(s.babylonSkeleton=a.skeleton)),o=a}}else if(r.meshes){var a=b(t,r,r.mesh?[r.mesh]:r.meshes,i,r.babylonNode);o=a}else if(!r.light||r.babylonNode||t.importOnlyMeshes){if(r.camera&&!r.babylonNode&&!t.importOnlyMeshes){var l=t.cameras[r.camera];if(l)if("orthographic"===l.type){var u=new e.FreeCamera(r.camera,e.Vector3.Zero(),t.scene,!1);u.name=r.name||"",u.mode=e.Camera.ORTHOGRAPHIC_CAMERA,u.attachControl(t.scene.getEngine().getRenderingCanvas()),o=u}else if("perspective"===l.type){var h=l[l.type],c=new e.FreeCamera(r.camera,e.Vector3.Zero(),t.scene,!1);c.name=r.name||"",c.attachControl(t.scene.getEngine().getRenderingCanvas()),h.aspectRatio||(h.aspectRatio=t.scene.getEngine().getRenderWidth()/t.scene.getEngine().getRenderHeight()),h.znear&&h.zfar&&(c.maxZ=h.zfar,c.minZ=h.znear),o=c}}}else{var f=t.lights[r.light];if(f)if("ambient"===f.type){var d=f[f.type],p=new e.HemisphericLight(r.light,e.Vector3.Zero(),t.scene);p.name=r.name||"",d.color&&(p.diffuse=e.Color3.FromArray(d.color)),o=p}else if("directional"===f.type){var A=f[f.type],m=new e.DirectionalLight(r.light,e.Vector3.Zero(),t.scene);m.name=r.name||"",A.color&&(m.diffuse=e.Color3.FromArray(A.color)),o=m}else if("point"===f.type){var g=f[f.type],_=new e.PointLight(r.light,e.Vector3.Zero(),t.scene);_.name=r.name||"",g.color&&(_.diffuse=e.Color3.FromArray(g.color)),o=_}else if("spot"===f.type){var v=f[f.type],x=new e.SpotLight(r.light,e.Vector3.Zero(),e.Vector3.Zero(),0,0,t.scene);x.name=r.name||"",v.color&&(x.diffuse=e.Color3.FromArray(v.color)),v.fallOfAngle&&(x.angle=v.fallOfAngle),v.fallOffExponent&&(x.exponent=v.fallOffExponent),o=x}}if(!r.jointName){if(r.babylonNode)return r.babylonNode;if(null===o){var M=new e.Mesh(r.name||"",t.scene);r.babylonNode=M,o=M}}if(null!==o){if(r.matrix&&o instanceof e.Mesh)T(o,r);else{var C=r.translation||[0,0,0],P=r.rotation||[0,0,0,1],S=r.scale||[1,1,1];E(o,e.Vector3.FromArray(C),e.Quaternion.FromArray(P),e.Vector3.FromArray(S))}o.updateCache(!0),r.babylonNode=o}return o},M=function(e,t,r,i){void 0===i&&(i=!1);var n=e.nodes[t],o=null;if(i=!(e.importOnlyMeshes&&!i&&e.importMeshesNames)||(-1!==e.importMeshesNames.indexOf(n.name||"")||0===e.importMeshesNames.length),!n.jointName&&i&&null!==(o=x(e,n,t))&&(o.id=t,o.parent=r),n.children)for(var s=0;s<n.children.length;s++)M(e,n.children[s],o,i)},C=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)M(e,t.nodes[r],null);else for(var i in e.scenes){t=e.scenes[i];for(var r=0;r<t.nodes.length;r++)M(e,t.nodes[r],null)}d(e);for(var r=0;r<e.scene.skeletons.length;r++){var n=e.scene.skeletons[r];e.scene.beginAnimation(n,0,Number.MAX_VALUE,!0,1)}},P=function(e,r,i,n,o,s,a){var l=s.values||o.parameters;for(var u in i){var h=i[u],c=h.type;if(c===t.EParameterType.FLOAT_MAT2||c===t.EParameterType.FLOAT_MAT3||c===t.EParameterType.FLOAT_MAT4)if(!h.semantic||h.source||h.node){if(h.semantic&&(h.source||h.node)){var f=r.scene.getNodeByName(h.source||h.node||"");if(null===f&&(f=r.scene.getNodeByID(h.source||h.node||"")),null===f)continue;t.GLTFUtils.SetMatrix(r.scene,f,h,u,n.getEffect())}}else t.GLTFUtils.SetMatrix(r.scene,e,h,u,n.getEffect());else{var d=l[o.uniforms[u]];if(!d)continue;if(c===t.EParameterType.SAMPLER_2D){var p=r.textures[s.values?d:h.value].babylonTexture;if(null===p||void 0===p)continue;n.getEffect().setTexture(u,p)}else t.GLTFUtils.SetUniform(n.getEffect(),u,d,c)}}a(n)},S=function(e,r,i,n,o){var s=n.values||i.parameters,a=i.uniforms;for(var l in o){var u=o[l],h=u.type,c=s[a[l]];if(void 0===c&&(c=u.value),c){var f=function(e){return function(t){u.value&&e&&(r.setTexture(e,t),delete o[e])}};h===t.EParameterType.SAMPLER_2D?t.GLTFLoaderExtension.LoadTextureAsync(e,n.values?c:u.value,f(l),(function(){return f(null)})):u.value&&t.GLTFUtils.SetUniform(r,l,n.values?c:u.value,h)&&delete o[l]}}},R=function(e,t,r){return function(i,n){t.dispose(!0),r("Cannot compile program named "+e.name+". Error: "+n+". Default material will be applied")}},O=function(e,t,r,i,n,o){return function(s){S(e,t,r,i,n),t.onBind=function(s){P(s,e,n,t,r,i,o)}}},D=function(e,t,r){for(var i in t.uniforms){var s=t.uniforms[i],a=t.parameters[s];if(e.currentIdentifier===i&&a.semantic&&!a.source&&!a.node){var l=n.indexOf(a.semantic);if(-1!==l)return delete r[i],o[l]}}return e.currentIdentifier},w=function(e){for(var r in e.materials)t.GLTFLoaderExtension.LoadMaterialAsync(e,r,(function(e){}),(function(){}))},I=(function(){function s(){}return s.CreateRuntime=function(e,t,r){var i={extensions:{},accessors:{},buffers:{},bufferViews:{},meshes:{},lights:{},cameras:{},nodes:{},images:{},textures:{},shaders:{},programs:{},samplers:{},techniques:{},materials:{},animations:{},skins:{},extensionsUsed:[],scenes:{},buffersCount:0,shaderscount:0,scene:t,rootUrl:r,loadedBufferCount:0,loadedBufferViews:{},loadedShaderCount:0,importOnlyMeshes:!1,dummyNodes:[]};return e.extensions&&h(e.extensions,"extensions",i),e.extensionsUsed&&h(e.extensionsUsed,"extensionsUsed",i),e.buffers&&l(e.buffers,i),e.bufferViews&&h(e.bufferViews,"bufferViews",i),e.accessors&&h(e.accessors,"accessors",i),e.meshes&&h(e.meshes,"meshes",i),e.lights&&h(e.lights,"lights",i),e.cameras&&h(e.cameras,"cameras",i),e.nodes&&h(e.nodes,"nodes",i),e.images&&h(e.images,"images",i),e.textures&&h(e.textures,"textures",i),e.shaders&&u(e.shaders,i),e.programs&&h(e.programs,"programs",i),e.samplers&&h(e.samplers,"samplers",i),e.techniques&&h(e.techniques,"techniques",i),e.materials&&h(e.materials,"materials",i),e.animations&&h(e.animations,"animations",i),e.skins&&h(e.skins,"skins",i),e.scenes&&(i.scenes=e.scenes),e.scene&&e.scenes&&(i.currentScene=e.scenes[e.scene]),i},s.LoadBufferAsync=function(t,r,i,n,o){var s=t.buffers[r];e.Tools.IsBase64(s.uri)?setTimeout((function(){return i(new Uint8Array(e.Tools.DecodeBase64(s.uri)))})):e.Tools.LoadFile(t.rootUrl+s.uri,(function(e){return i(new Uint8Array(e))}),o,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))},s.LoadTextureBufferAsync=function(t,r,i,n){var o=t.textures[r];if(!o||!o.source)return void n("");if(o.babylonTexture)return void i(null);var s=t.images[o.source];e.Tools.IsBase64(s.uri)?setTimeout((function(){return i(new Uint8Array(e.Tools.DecodeBase64(s.uri)))})):e.Tools.LoadFile(t.rootUrl+s.uri,(function(e){return i(new Uint8Array(e))}),void 0,void 0,!0,(function(e){e&&n(e.status+" "+e.statusText)}))},s.CreateTextureAsync=function(r,i,n,o,s){var a=r.textures[i];if(a.babylonTexture)return void o(a.babylonTexture);var l=r.samplers[a.sampler],u=l.minFilter===t.ETextureFilterType.NEAREST_MIPMAP_NEAREST||l.minFilter===t.ETextureFilterType.NEAREST_MIPMAP_LINEAR||l.minFilter===t.ETextureFilterType.LINEAR_MIPMAP_NEAREST||l.minFilter===t.ETextureFilterType.LINEAR_MIPMAP_LINEAR,h=e.Texture.BILINEAR_SAMPLINGMODE,c=new Blob([n]),f=URL.createObjectURL(c),d=function(){return URL.revokeObjectURL(f)},p=new e.Texture(f,r.scene,!u,!0,h,d,d);void 0!==l.wrapS&&(p.wrapU=t.GLTFUtils.GetWrapMode(l.wrapS)),void 0!==l.wrapT&&(p.wrapV=t.GLTFUtils.GetWrapMode(l.wrapT)),p.name=i,a.babylonTexture=p,o(p)},s.LoadShaderStringAsync=function(t,r,i,n){var o=t.shaders[r];if(e.Tools.IsBase64(o.uri)){var s=atob(o.uri.split(",")[1]);i&&i(s)
- }else e.Tools.LoadFile(t.rootUrl+o.uri,i,void 0,void 0,!1,(function(e){e&&n&&n(e.status+" "+e.statusText)}))},s.LoadMaterialAsync=function(s,a,l,u){var h=s.materials[a];if(!h.technique)return void(u&&u("No technique found."));var c=s.techniques[h.technique];if(!c){var d=new e.StandardMaterial(a,s.scene);return d.diffuseColor=new e.Color3(.5,.5,.5),d.sideOrientation=e.Material.CounterClockWiseSideOrientation,void l(d)}var p=s.programs[c.program],A=c.states,m=e.Effect.ShadersStore[p.vertexShader+"VertexShader"],g=e.Effect.ShadersStore[p.fragmentShader+"PixelShader"],_="",v="",y=new i(m),b=new i(g),E={},T=[],x=[],M=[];for(var C in c.uniforms){var P=c.uniforms[C],S=c.parameters[P];if(E[C]=S,!S.semantic||S.node||S.source)S.type===t.EParameterType.SAMPLER_2D?M.push(C):T.push(C);else{var w=n.indexOf(S.semantic);-1!==w?(T.push(o[w]),delete E[C]):T.push(C)}}for(var I in c.attributes){var L=c.attributes[I],B=c.parameters[L];B.semantic&&x.push(f(B))}for(;!y.isEnd()&&y.getNextToken();){var F=y.currentToken;if(F===r.IDENTIFIER){var N=!1;for(var I in c.attributes){var L=c.attributes[I],B=c.parameters[L];if(y.currentIdentifier===I&&B.semantic){_+=f(B),N=!0;break}}N||(_+=D(y,c,E))}else _+=y.currentString}for(;!b.isEnd()&&b.getNextToken();){var F=b.currentToken;F===r.IDENTIFIER?v+=D(b,c,E):v+=b.currentString}var U={vertex:p.vertexShader+a,fragment:p.fragmentShader+a},V={attributes:x,uniforms:T,samplers:M,needAlphaBlending:A&&A.enable&&-1!==A.enable.indexOf(3042)};e.Effect.ShadersStore[p.vertexShader+a+"VertexShader"]=_,e.Effect.ShadersStore[p.fragmentShader+a+"PixelShader"]=v;var k=new e.ShaderMaterial(a,s.scene,U,V);if(k.onError=R(p,k,u),k.onCompiled=O(s,k,c,h,E,l),k.sideOrientation=e.Material.CounterClockWiseSideOrientation,A&&A.functions){var G=A.functions;G.cullFace&&G.cullFace[0]!==t.ECullingType.BACK&&(k.backFaceCulling=!1);var z=G.blendFuncSeparate;z&&(z[0]===t.EBlendingFunction.SRC_ALPHA&&z[1]===t.EBlendingFunction.ONE_MINUS_SRC_ALPHA&&z[2]===t.EBlendingFunction.ONE&&z[3]===t.EBlendingFunction.ONE?k.alphaMode=e.Engine.ALPHA_COMBINE:z[0]===t.EBlendingFunction.ONE&&z[1]===t.EBlendingFunction.ONE&&z[2]===t.EBlendingFunction.ZERO&&z[3]===t.EBlendingFunction.ONE?k.alphaMode=e.Engine.ALPHA_ONEONE:z[0]===t.EBlendingFunction.SRC_ALPHA&&z[1]===t.EBlendingFunction.ONE&&z[2]===t.EBlendingFunction.ZERO&&z[3]===t.EBlendingFunction.ONE?k.alphaMode=e.Engine.ALPHA_ADD:z[0]===t.EBlendingFunction.ZERO&&z[1]===t.EBlendingFunction.ONE_MINUS_SRC_COLOR&&z[2]===t.EBlendingFunction.ONE&&z[3]===t.EBlendingFunction.ONE?k.alphaMode=e.Engine.ALPHA_SUBTRACT:z[0]===t.EBlendingFunction.DST_COLOR&&z[1]===t.EBlendingFunction.ZERO&&z[2]===t.EBlendingFunction.ONE&&z[3]===t.EBlendingFunction.ONE?k.alphaMode=e.Engine.ALPHA_MULTIPLY:z[0]===t.EBlendingFunction.SRC_ALPHA&&z[1]===t.EBlendingFunction.ONE_MINUS_SRC_COLOR&&z[2]===t.EBlendingFunction.ONE&&z[3]===t.EBlendingFunction.ONE&&(k.alphaMode=e.Engine.ALPHA_MAXIMIZED))}},s})();t.GLTFLoaderBase=I;var L=(function(){function r(){this.coordinateSystemMode=e.GLTFLoaderCoordinateSystemMode.AUTO,this.animationStartMode=e.GLTFLoaderAnimationStartMode.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this._normalizeAnimationGroupsToBeginAtZero=!0,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable=new e.Observable,this.onTextureLoadedObservable=new e.Observable,this.onMaterialLoadedObservable=new e.Observable,this.onCameraLoadedObservable=new e.Observable,this.onCompleteObservable=new e.Observable,this.onDisposeObservable=new e.Observable,this.onExtensionLoadedObservable=new e.Observable,this.state=null}return r.RegisterExtension=function(t){if(r.Extensions[t.name])return void e.Tools.Error('Tool with the same name "'+t.name+'" already exists');r.Extensions[t.name]=t},r.prototype.dispose=function(){},r.prototype._importMeshAsync=function(r,i,n,o,s,a,l){var u=this;return i.useRightHandedSystem=!0,t.GLTFLoaderExtension.LoadRuntimeAsync(i,n,o,(function(t){t.importOnlyMeshes=!0,""===r?t.importMeshesNames=[]:"string"==typeof r?t.importMeshesNames=[r]:!r||r instanceof Array?(t.importMeshesNames=[],e.Tools.Warn("Argument meshesNames must be of type string or string[]")):t.importMeshesNames=[r],u._createNodes(t);var i=new Array,n=new Array;for(var o in t.nodes){var l=t.nodes[o];l.babylonNode instanceof e.AbstractMesh&&i.push(l.babylonNode)}for(var h in t.skins){var c=t.skins[h];c.babylonSkeleton instanceof e.Skeleton&&n.push(c.babylonSkeleton)}u._loadBuffersAsync(t,(function(){u._loadShadersAsync(t,(function(){w(t),C(t),!e.GLTFFileLoader.IncrementalLoading&&s&&s(i,n)}))}),a),e.GLTFFileLoader.IncrementalLoading&&s&&s(i,n)}),l),!0},r.prototype.importMeshAsync=function(e,t,r,i,n){var o=this;return new Promise(function(s,a){o._importMeshAsync(e,t,r,i,(function(e,t){s({meshes:e,particleSystems:[],skeletons:t,animationGroups:[]})}),n,(function(e){a(new Error(e))}))})},r.prototype._loadAsync=function(r,i,n,o,s,a){var l=this;r.useRightHandedSystem=!0,t.GLTFLoaderExtension.LoadRuntimeAsync(r,i,n,(function(r){t.GLTFLoaderExtension.LoadRuntimeExtensionsAsync(r,(function(){l._createNodes(r),l._loadBuffersAsync(r,(function(){l._loadShadersAsync(r,(function(){w(r),C(r),e.GLTFFileLoader.IncrementalLoading||o()}))})),e.GLTFFileLoader.IncrementalLoading&&o()}),a)}),a)},r.prototype.loadAsync=function(e,t,r,i){var n=this;return new Promise(function(o,s){n._loadAsync(e,t,r,(function(){o()}),i,(function(e){s(new Error(e))}))})},r.prototype._loadShadersAsync=function(r,i){var n=!1,o=function(n,o){t.GLTFLoaderExtension.LoadShaderStringAsync(r,n,(function(s){s instanceof ArrayBuffer||(r.loadedShaderCount++,s&&(e.Effect.ShadersStore[n+(o.type===t.EShaderType.VERTEX?"VertexShader":"PixelShader")]=s),r.loadedShaderCount===r.shaderscount&&i())}),(function(){e.Tools.Error("Error when loading shader program named "+n+" located at "+o.uri)}))};for(var s in r.shaders){n=!0;var a=r.shaders[s];a?o.bind(this,s,a)():e.Tools.Error("No shader named: "+s)}n||i()},r.prototype._loadBuffersAsync=function(r,i,n){var o=!1,s=function(n,o){t.GLTFLoaderExtension.LoadBufferAsync(r,n,(function(t){r.loadedBufferCount++,t&&(t.byteLength!=r.buffers[n].byteLength&&e.Tools.Error("Buffer named "+n+" is length "+t.byteLength+". Expected: "+o.byteLength),r.loadedBufferViews[n]=t),r.loadedBufferCount===r.buffersCount&&i()}),(function(){e.Tools.Error("Error when loading buffer named "+n+" located at "+o.uri)}))};for(var a in r.buffers){o=!0;var l=r.buffers[a];l?s.bind(this,a,l)():e.Tools.Error("No buffer named: "+a)}o||i()},r.prototype._createNodes=function(e){var t=e.currentScene;if(t)for(var r=0;r<t.nodes.length;r++)M(e,t.nodes[r],null);else for(var i in e.scenes){t=e.scenes[i];for(var r=0;r<t.nodes.length;r++)M(e,t.nodes[r],null)}},r.Extensions={},r})();t.GLTFLoader=L,e.GLTFFileLoader._CreateGLTFLoaderV1=function(){return new L}})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function r(){}return r.SetMatrix=function(r,i,n,o,s){var a=null;if("MODEL"===n.semantic?a=i.getWorldMatrix():"PROJECTION"===n.semantic?a=r.getProjectionMatrix():"VIEW"===n.semantic?a=r.getViewMatrix():"MODELVIEWINVERSETRANSPOSE"===n.semantic?a=e.Matrix.Transpose(i.getWorldMatrix().multiply(r.getViewMatrix()).invert()):"MODELVIEW"===n.semantic?a=i.getWorldMatrix().multiply(r.getViewMatrix()):"MODELVIEWPROJECTION"===n.semantic?a=i.getWorldMatrix().multiply(r.getTransformMatrix()):"MODELINVERSE"===n.semantic?a=i.getWorldMatrix().invert():"VIEWINVERSE"===n.semantic?a=r.getViewMatrix().invert():"PROJECTIONINVERSE"===n.semantic?a=r.getProjectionMatrix().invert():"MODELVIEWINVERSE"===n.semantic?a=i.getWorldMatrix().multiply(r.getViewMatrix()).invert():"MODELVIEWPROJECTIONINVERSE"===n.semantic?a=i.getWorldMatrix().multiply(r.getTransformMatrix()).invert():"MODELINVERSETRANSPOSE"===n.semantic&&(a=e.Matrix.Transpose(i.getWorldMatrix().invert())),a)switch(n.type){case t.EParameterType.FLOAT_MAT2:s.setMatrix2x2(o,e.Matrix.GetAsMatrix2x2(a));break;case t.EParameterType.FLOAT_MAT3:s.setMatrix3x3(o,e.Matrix.GetAsMatrix3x3(a));break;case t.EParameterType.FLOAT_MAT4:s.setMatrix(o,a)}},r.SetUniform=function(r,i,n,o){switch(o){case t.EParameterType.FLOAT:return r.setFloat(i,n),!0;case t.EParameterType.FLOAT_VEC2:return r.setVector2(i,e.Vector2.FromArray(n)),!0;case t.EParameterType.FLOAT_VEC3:return r.setVector3(i,e.Vector3.FromArray(n)),!0;case t.EParameterType.FLOAT_VEC4:return r.setVector4(i,e.Vector4.FromArray(n)),!0;default:return!1}},r.GetWrapMode=function(r){switch(r){case t.ETextureWrapMode.CLAMP_TO_EDGE:return e.Texture.CLAMP_ADDRESSMODE;case t.ETextureWrapMode.MIRRORED_REPEAT:return e.Texture.MIRROR_ADDRESSMODE;case t.ETextureWrapMode.REPEAT:default:return e.Texture.WRAP_ADDRESSMODE}},r.GetByteStrideFromType=function(e){switch(e.type){case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16;default:return 1}},r.GetTextureFilterMode=function(r){switch(r){case t.ETextureFilterType.LINEAR:case t.ETextureFilterType.LINEAR_MIPMAP_NEAREST:case t.ETextureFilterType.LINEAR_MIPMAP_LINEAR:return e.Texture.TRILINEAR_SAMPLINGMODE;case t.ETextureFilterType.NEAREST:case t.ETextureFilterType.NEAREST_MIPMAP_NEAREST:return e.Texture.NEAREST_SAMPLINGMODE;default:return e.Texture.BILINEAR_SAMPLINGMODE}},r.GetBufferFromBufferView=function(e,r,i,n,o){var i=r.byteOffset+i,s=e.loadedBufferViews[r.buffer];if(i+n>s.byteLength)throw new Error("Buffer access is out of range");var a=s.buffer;switch(i+=s.byteOffset,o){case t.EComponentType.BYTE:return new Int8Array(a,i,n);case t.EComponentType.UNSIGNED_BYTE:return new Uint8Array(a,i,n);case t.EComponentType.SHORT:return new Int16Array(a,i,n);case t.EComponentType.UNSIGNED_SHORT:return new Uint16Array(a,i,n);default:return new Float32Array(a,i,n)}},r.GetBufferFromAccessor=function(e,t){var i=e.bufferViews[t.bufferView],n=t.count*r.GetByteStrideFromType(t);return r.GetBufferFromBufferView(e,i,t.byteOffset,n,t.componentType)},r.DecodeBufferToText=function(e){for(var t="",r=e.byteLength,i=0;i<r;++i)t+=String.fromCharCode(e[i]);return t},r.GetDefaultMaterial=function(t){if(!r._DefaultMaterial){e.Effect.ShadersStore.GLTFDefaultMaterialVertexShader=["precision highp float;","","uniform mat4 worldView;","uniform mat4 projection;","","attribute vec3 position;","","void main(void)","{"," gl_Position = projection * worldView * vec4(position, 1.0);","}"].join("\n"),e.Effect.ShadersStore.GLTFDefaultMaterialPixelShader=["precision highp float;","","uniform vec4 u_emission;","","void main(void)","{"," gl_FragColor = u_emission;","}"].join("\n");var i={vertex:"GLTFDefaultMaterial",fragment:"GLTFDefaultMaterial"},n={attributes:["position"],uniforms:["worldView","projection","u_emission"],samplers:new Array,needAlphaBlending:!1};r._DefaultMaterial=new e.ShaderMaterial("GLTFDefaultMaterial",t,i,n),r._DefaultMaterial.setColor4("u_emission",new e.Color4(.5,.5,.5,1))}return r._DefaultMaterial},r._DefaultMaterial=null,r})();t.GLTFUtils=r})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(e){var t=(function(){function t(e){this._name=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),t.prototype.loadRuntimeAsync=function(e,t,r,i,n){return!1},t.prototype.loadRuntimeExtensionsAsync=function(e,t,r){return!1},t.prototype.loadBufferAsync=function(e,t,r,i,n){return!1},t.prototype.loadTextureBufferAsync=function(e,t,r,i){return!1},t.prototype.createTextureAsync=function(e,t,r,i,n){return!1},t.prototype.loadShaderStringAsync=function(e,t,r,i){return!1},t.prototype.loadMaterialAsync=function(e,t,r,i){return!1},t.LoadRuntimeAsync=function(r,i,n,o,s){t.ApplyExtensions((function(e){return e.loadRuntimeAsync(r,i,n,o,s)}),(function(){setTimeout((function(){o&&o(e.GLTFLoaderBase.CreateRuntime(i.json,r,n))}))}))},t.LoadRuntimeExtensionsAsync=function(e,r,i){t.ApplyExtensions((function(t){return t.loadRuntimeExtensionsAsync(e,r,i)}),(function(){setTimeout((function(){r()}))}))},t.LoadBufferAsync=function(r,i,n,o,s){t.ApplyExtensions((function(e){return e.loadBufferAsync(r,i,n,o,s)}),(function(){e.GLTFLoaderBase.LoadBufferAsync(r,i,n,o,s)}))},t.LoadTextureAsync=function(e,r,i,n){t.LoadTextureBufferAsync(e,r,(function(o){o&&t.CreateTextureAsync(e,r,o,i,n)}),n)},t.LoadShaderStringAsync=function(r,i,n,o){t.ApplyExtensions((function(e){return e.loadShaderStringAsync(r,i,n,o)}),(function(){e.GLTFLoaderBase.LoadShaderStringAsync(r,i,n,o)}))},t.LoadMaterialAsync=function(r,i,n,o){t.ApplyExtensions((function(e){return e.loadMaterialAsync(r,i,n,o)}),(function(){e.GLTFLoaderBase.LoadMaterialAsync(r,i,n,o)}))},t.LoadTextureBufferAsync=function(r,i,n,o){t.ApplyExtensions((function(e){return e.loadTextureBufferAsync(r,i,n,o)}),(function(){e.GLTFLoaderBase.LoadTextureBufferAsync(r,i,n,o)}))},t.CreateTextureAsync=function(r,i,n,o,s){t.ApplyExtensions((function(e){return e.createTextureAsync(r,i,n,o,s)}),(function(){e.GLTFLoaderBase.CreateTextureAsync(r,i,n,o,s)}))},t.ApplyExtensions=function(t,r){for(var i in e.GLTFLoader.Extensions){if(t(e.GLTFLoader.Extensions[i]))return}r()},t})();e.GLTFLoaderExtension=t})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(e){var r=(function(r){function i(){return r.call(this,"KHR_binary_glTF")||this}return t(i,r),i.prototype.loadRuntimeAsync=function(t,r,i,n,o){var s=r.json.extensionsUsed;return!(!s||-1===s.indexOf(this.name)||!r.bin)&&(this._bin=r.bin,n(e.GLTFLoaderBase.CreateRuntime(r.json,t,i)),!0)},i.prototype.loadBufferAsync=function(e,t,r,i){return-1!==e.extensionsUsed.indexOf(this.name)&&("binary_glTF"===t&&(r(this._bin),!0))},i.prototype.loadTextureBufferAsync=function(t,r,i,n){var o=t.textures[r],s=t.images[o.source];if(!(s.extensions&&this.name in s.extensions))return!1;var a=s.extensions[this.name],l=t.bufferViews[a.bufferView];return i(e.GLTFUtils.GetBufferFromBufferView(t,l,0,l.byteLength,e.EComponentType.UNSIGNED_BYTE)),!0},i.prototype.loadShaderStringAsync=function(t,r,i,n){var o=t.shaders[r];if(!(o.extensions&&this.name in o.extensions))return!1;var s=o.extensions[this.name],a=t.bufferViews[s.bufferView],l=e.GLTFUtils.GetBufferFromBufferView(t,a,0,a.byteLength,e.EComponentType.UNSIGNED_BYTE);return setTimeout((function(){var t=e.GLTFUtils.DecodeBufferToText(l);i(t)})),!0},i})(e.GLTFLoaderExtension);e.GLTFBinaryExtension=r,e.GLTFLoader.RegisterExtension(new r)})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(r){var i=(function(i){function n(){return i.call(this,"KHR_materials_common")||this}return t(n,i),n.prototype.loadRuntimeExtensionsAsync=function(t,r,i){if(!t.extensions)return!1;var n=t.extensions[this.name];if(!n)return!1;var o=n.lights;if(o)for(var s in o){var a=o[s];switch(a.type){case"ambient":var l=new e.HemisphericLight(a.name,new e.Vector3(0,1,0),t.scene),u=a.ambient;u&&(l.diffuse=e.Color3.FromArray(u.color||[1,1,1]));break;case"point":var h=new e.PointLight(a.name,new e.Vector3(10,10,10),t.scene),c=a.point;c&&(h.diffuse=e.Color3.FromArray(c.color||[1,1,1]));break;case"directional":var f=new e.DirectionalLight(a.name,new e.Vector3(0,-1,0),t.scene),d=a.directional;d&&(f.diffuse=e.Color3.FromArray(d.color||[1,1,1]));break;case"spot":var p=a.spot;if(p){var A=new e.SpotLight(a.name,new e.Vector3(0,10,0),new e.Vector3(0,-1,0),p.fallOffAngle||Math.PI,p.fallOffExponent||0,t.scene);A.diffuse=e.Color3.FromArray(p.color||[1,1,1])}break;default:e.Tools.Warn('GLTF Material Common extension: light type "'+a.type+"” not supported")}}return!1},n.prototype.loadMaterialAsync=function(t,r,i,n){var o=t.materials[r];if(!o||!o.extensions)return!1;var s=o.extensions[this.name];if(!s)return!1;var a=new e.StandardMaterial(r,t.scene);return a.sideOrientation=e.Material.CounterClockWiseSideOrientation,"CONSTANT"===s.technique&&(a.disableLighting=!0),a.backFaceCulling=void 0!==s.doubleSided&&!s.doubleSided,a.alpha=void 0===s.values.transparency?1:s.values.transparency,a.specularPower=void 0===s.values.shininess?0:s.values.shininess,"string"==typeof s.values.ambient?this._loadTexture(t,s.values.ambient,a,"ambientTexture",n):a.ambientColor=e.Color3.FromArray(s.values.ambient||[0,0,0]),"string"==typeof s.values.diffuse?this._loadTexture(t,s.values.diffuse,a,"diffuseTexture",n):a.diffuseColor=e.Color3.FromArray(s.values.diffuse||[0,0,0]),"string"==typeof s.values.emission?this._loadTexture(t,s.values.emission,a,"emissiveTexture",n):a.emissiveColor=e.Color3.FromArray(s.values.emission||[0,0,0]),"string"==typeof s.values.specular?this._loadTexture(t,s.values.specular,a,"specularTexture",n):a.specularColor=e.Color3.FromArray(s.values.specular||[0,0,0]),!0},n.prototype._loadTexture=function(e,t,i,n,o){r.GLTFLoaderBase.LoadTextureBufferAsync(e,t,(function(s){r.GLTFLoaderBase.CreateTextureAsync(e,t,s,(function(e){return i[n]=e}),o)}),o)},n})(r.GLTFLoaderExtension);r.GLTFMaterialsCommonExtension=i,r.GLTFLoader.RegisterExtension(new i)})(e.GLTF1||(e.GLTF1={}))})(e||(e={}));var e;!(function(e){!(function(t){var r=(function(){function e(){}return e.Assign=function(e){if(e)for(var t=0;t<e.length;t++)e[t]._index=t},e})(),i=(function(){function i(){this._completePromises=new Array,this._onReadyObservable=new e.Observable,this._disposed=!1,this._state=null,this._extensions={},this._defaultSampler={},this._defaultBabylonMaterials={},this._requests=new Array,this.coordinateSystemMode=e.GLTFLoaderCoordinateSystemMode.AUTO,this.animationStartMode=e.GLTFLoaderAnimationStartMode.FIRST,this.compileMaterials=!1,this.useClipPlane=!1,this.compileShadowGenerators=!1,this.transparencyAsCoverage=!1,this._normalizeAnimationGroupsToBeginAtZero=!0,this.preprocessUrlAsync=function(e){return Promise.resolve(e)},this.onMeshLoadedObservable=new e.Observable,this.onTextureLoadedObservable=new e.Observable,this.onMaterialLoadedObservable=new e.Observable,this.onCameraLoadedObservable=new e.Observable,this.onCompleteObservable=new e.Observable,this.onDisposeObservable=new e.Observable,this.onExtensionLoadedObservable=new e.Observable}return i._Register=function(t,r){if(i._ExtensionFactories[t])return void e.Tools.Error("Extension with the name '"+t+"' already exists");i._ExtensionFactories[t]=r,i._ExtensionNames.push(t)},Object.defineProperty(i.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),i.prototype.dispose=function(){this._disposed||(this._disposed=!0,this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._clear())},i.prototype.importMeshAsync=function(e,t,r,i,n){var o=this;return Promise.resolve().then((function(){o._babylonScene=t,o._rootUrl=i,o._progressCallback=n,o._loadData(r);var s=null;if(e){var a={};if(o._gltf.nodes)for(var l=0,u=o._gltf.nodes;l<u.length;l++){var h=u[l];h.name&&(a[h.name]=h)}s=(e instanceof Array?e:[e]).map((function(e){var t=a[e];if(!t)throw new Error("Failed to find node '"+e+"'");return t}))}return o._loadAsync(s).then((function(){return{meshes:o._getMeshes(),particleSystems:[],skeletons:o._getSkeletons(),animationGroups:o._getAnimationGroups()}}))}))},i.prototype.loadAsync=function(e,t,r,i){var n=this;return Promise.resolve().then((function(){return n._babylonScene=e,n._rootUrl=r,n._progressCallback=i,n._loadData(t),n._loadAsync(null)}))},i.prototype._loadAsync=function(t){var r=this;return Promise.resolve().then((function(){r._state=e.GLTFLoaderState.LOADING,r._loadExtensions(),r._checkExtensions();var n=new Array;if(t)n.push(r._loadNodesAsync(t));else{var o=i._GetProperty("#/scene",r._gltf.scenes,r._gltf.scene||0);n.push(r._loadSceneAsync("#/scenes/"+o._index,o))}r.compileMaterials&&n.push(r._compileMaterialsAsync()),r.compileShadowGenerators&&n.push(r._compileShadowGeneratorsAsync());var s=Promise.all(n).then((function(){r._state=e.GLTFLoaderState.READY,r._onReadyObservable.notifyObservers(r),r._startAnimations()}));return s.then((function(){r._rootBabylonMesh&&r._rootBabylonMesh.setEnabled(!0),e.Tools.SetImmediate((function(){r._disposed||Promise.all(r._completePromises).then((function(){r._state=e.GLTFLoaderState.COMPLETE,r.onCompleteObservable.notifyObservers(r),r.onCompleteObservable.clear(),r._clear()})).catch((function(t){e.Tools.Error("glTF Loader: "+t.message),r._clear()}))}))})),s})).catch((function(t){if(!r._disposed)throw e.Tools.Error("glTF Loader: "+t.message),r._clear(),t}))},i.prototype._loadData=function(t){if(this._gltf=t.json,this._setupData(),t.bin){var r=this._gltf.buffers;if(r&&r[0]&&!r[0].uri){var i=r[0];(i.byteLength<t.bin.byteLength-3||i.byteLength>t.bin.byteLength)&&e.Tools.Warn("Binary buffer length ("+i.byteLength+") from JSON does not match chunk length ("+t.bin.byteLength+")"),i._data=Promise.resolve(t.bin)}else e.Tools.Warn("Unexpected BIN chunk")}},i.prototype._setupData=function(){if(r.Assign(this._gltf.accessors),r.Assign(this._gltf.animations),r.Assign(this._gltf.buffers),r.Assign(this._gltf.bufferViews),r.Assign(this._gltf.cameras),r.Assign(this._gltf.images),r.Assign(this._gltf.materials),r.Assign(this._gltf.meshes),r.Assign(this._gltf.nodes),r.Assign(this._gltf.samplers),r.Assign(this._gltf.scenes),r.Assign(this._gltf.skins),r.Assign(this._gltf.textures),this._gltf.nodes){for(var e={},t=0,i=this._gltf.nodes;t<i.length;t++){var n=i[t];if(n.children)for(var o=0,s=n.children;o<s.length;o++){var a=s[o];e[a]=n._index}}for(var l=this._createRootNode(),u=0,h=this._gltf.nodes;u<h.length;u++){var n=h[u],c=e[n._index];n._parent=void 0===c?l:this._gltf.nodes[c]}}},i.prototype._loadExtensions=function(){for(var e=0,t=i._ExtensionNames;e<t.length;e++){var r=t[e],n=i._ExtensionFactories[r](this);this._extensions[r]=n,this.onExtensionLoadedObservable.notifyObservers(n)}this.onExtensionLoadedObservable.clear()},i.prototype._checkExtensions=function(){if(this._gltf.extensionsRequired)for(var e=0,t=this._gltf.extensionsRequired;e<t.length;e++){var r=t[e],i=this._extensions[r];if(!i||!i.enabled)throw new Error("Require extension "+r+" is not available")}},i.prototype._createRootNode=function(){this._rootBabylonMesh=new e.Mesh("__root__",this._babylonScene),this._rootBabylonMesh.setEnabled(!1);var t={_babylonMesh:this._rootBabylonMesh};switch(this.coordinateSystemMode){case e.GLTFLoaderCoordinateSystemMode.AUTO:this._babylonScene.useRightHandedSystem||(t.rotation=[0,1,0,0],t.scale=[1,1,-1],i._LoadTransform(t,this._rootBabylonMesh));break;case e.GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED:this._babylonScene.useRightHandedSystem=!0;break;default:throw new Error("Invalid coordinate system mode ("+this.coordinateSystemMode+")")}return this.onMeshLoadedObservable.notifyObservers(this._rootBabylonMesh),t},i.prototype._loadNodesAsync=function(e){for(var t=new Array,r=0,i=e;r<i.length;r++){var n=i[r];t.push(this._loadNodeAsync("#/nodes/"+n._index,n))}return t.push(this._loadAnimationsAsync()),Promise.all(t).then((function(){}))},i.prototype._loadSceneAsync=function(e,r){var n=t.GLTFLoaderExtension._LoadSceneAsync(this,e,r);if(n)return n;for(var o=new Array,s=0,a=r.nodes;s<a.length;s++){var l=a[s],u=i._GetProperty(e+"/nodes/"+l,this._gltf.nodes,l);o.push(this._loadNodeAsync("#/nodes/"+u._index,u))}return o.push(this._loadAnimationsAsync()),Promise.all(o).then((function(){}))},i.prototype._forEachPrimitive=function(e,t){if(e._primitiveBabylonMeshes)for(var r=0,i=e._primitiveBabylonMeshes;r<i.length;r++){var n=i[r];t(n)}else t(e._babylonMesh)},i.prototype._getMeshes=function(){var e=new Array;e.push(this._rootBabylonMesh);var t=this._gltf.nodes;if(t)for(var r=0,i=t;r<i.length;r++){var n=i[r];if(n._babylonMesh&&e.push(n._babylonMesh),n._primitiveBabylonMeshes)for(var o=0,s=n._primitiveBabylonMeshes;o<s.length;o++){var a=s[o];e.push(a)}}return e},i.prototype._getSkeletons=function(){var e=new Array,t=this._gltf.skins;if(t)for(var r=0,i=t;r<i.length;r++){var n=i[r];n._babylonSkeleton&&e.push(n._babylonSkeleton)}return e},i.prototype._getAnimationGroups=function(){var e=new Array,t=this._gltf.animations;if(t)for(var r=0,i=t;r<i.length;r++){var n=i[r];n._babylonAnimationGroup&&e.push(n._babylonAnimationGroup)}return e},i.prototype._startAnimations=function(){switch(this.animationStartMode){case e.GLTFLoaderAnimationStartMode.NONE:break;case e.GLTFLoaderAnimationStartMode.FIRST:var t=this._getAnimationGroups();0!==t.length&&t[0].start(!0);break;case e.GLTFLoaderAnimationStartMode.ALL:for(var t=this._getAnimationGroups(),r=0,i=t;r<i.length;r++){i[r].start(!0)}break;default:return void e.Tools.Error("Invalid animation start mode ("+this.animationStartMode+")")}},i.prototype._loadNodeAsync=function(r,n){var o=t.GLTFLoaderExtension._LoadNodeAsync(this,r,n);if(o)return o;if(n._babylonMesh)throw new Error(r+": Invalid recursive node hierarchy");var s=new Array,a=new e.Mesh(n.name||"node"+n._index,this._babylonScene,n._parent?n._parent._babylonMesh:null);if(n._babylonMesh=a,i._LoadTransform(n,a),void 0!=n.mesh){var l=i._GetProperty(r+"/mesh",this._gltf.meshes,n.mesh);s.push(this._loadMeshAsync("#/meshes/"+l._index,n,l,a))}if(void 0!=n.camera){var u=i._GetProperty(r+"/camera",this._gltf.cameras,n.camera);this._loadCamera("#/cameras/"+u._index,u,a)}if(n.children)for(var h=0,c=n.children;h<c.length;h++){var f=c[h],d=i._GetProperty(r+"/children/"+f,this._gltf.nodes,f);s.push(this._loadNodeAsync("#/nodes/"+f,d))}return this.onMeshLoadedObservable.notifyObservers(a),Promise.all(s).then((function(){}))},i.prototype._loadMeshAsync=function(t,n,o,s){var a=this,l=new Array,u=o.primitives;if(!u||0===u.length)throw new Error(t+": Primitives are missing");if(r.Assign(u),1===u.length){var h=u[0];l.push(this._loadPrimitiveAsync(t+"/primitives/"+h._index,n,o,h,s))}else{n._primitiveBabylonMeshes=[];for(var c=0,f=u;c<f.length;c++){var h=f[c],d=new e.Mesh((o.name||s.name)+"_"+h._index,this._babylonScene,s);n._primitiveBabylonMeshes.push(d),l.push(this._loadPrimitiveAsync(t+"/primitives/"+h._index,n,o,h,d)),this.onMeshLoadedObservable.notifyObservers(s)}}if(void 0!=n.skin){var p=i._GetProperty(t+"/skin",this._gltf.skins,n.skin);l.push(this._loadSkinAsync("#/skins/"+p._index,n,o,p))}return Promise.all(l).then((function(){a._forEachPrimitive(n,(function(e){e._refreshBoundingInfo(!0)}))}))},i.prototype._loadPrimitiveAsync=function(e,t,r,n,o){var s=this,a=new Array;this._createMorphTargets(e,t,r,n,o),a.push(this._loadVertexDataAsync(e,n,o).then((function(t){return s._loadMorphTargetsAsync(e,n,o,t).then((function(){t.applyToMesh(o)}))})));var l=i._GetDrawMode(e,n.mode);if(void 0==n.material)o.material=this._getDefaultMaterial(l);else{var u=i._GetProperty(e+"/material}",this._gltf.materials,n.material);a.push(this._loadMaterialAsync("#/materials/"+u._index,u,r,o,l,(function(e){o.material=e})))}return Promise.all(a).then((function(){}))},i.prototype._loadVertexDataAsync=function(r,n,o){var s=this,a=t.GLTFLoaderExtension._LoadVertexDataAsync(this,r,n,o);if(a)return a;var l=n.attributes;if(!l)throw new Error(r+": Attributes are missing");var u=new Array,h=new e.Geometry(o.name,this._babylonScene);if(void 0==n.indices)o.isUnIndexed=!0;else{var c=i._GetProperty(r+"/indices",this._gltf.accessors,n.indices);u.push(this._loadIndicesAccessorAsync("#/accessors/"+c._index,c).then((function(e){h.setIndices(e)})))}var f=function(e,t,n){if(void 0!=l[e]){o._delayInfo=o._delayInfo||[],-1===o._delayInfo.indexOf(t)&&o._delayInfo.push(t);var a=i._GetProperty(r+"/attributes/"+e,s._gltf.accessors,l[e]);u.push(s._loadVertexAccessorAsync("#/accessors/"+a._index,a,t).then((function(e){h.setVerticesBuffer(e,a.count)}))),n&&n(a)}};return f("POSITION",e.VertexBuffer.PositionKind),f("NORMAL",e.VertexBuffer.NormalKind),f("TANGENT",e.VertexBuffer.TangentKind),f("TEXCOORD_0",e.VertexBuffer.UVKind),f("TEXCOORD_1",e.VertexBuffer.UV2Kind),f("JOINTS_0",e.VertexBuffer.MatricesIndicesKind),f("WEIGHTS_0",e.VertexBuffer.MatricesWeightsKind),f("COLOR_0",e.VertexBuffer.ColorKind,(function(e){"VEC4"===e.type&&(o.hasVertexAlpha=!0)})),Promise.all(u).then((function(){return h}))},i.prototype._createMorphTargets=function(t,r,i,n,o){if(n.targets){if(void 0==r._numMorphTargets)r._numMorphTargets=n.targets.length;else if(n.targets.length!==r._numMorphTargets)throw new Error(t+": Primitives do not have the same number of targets");o.morphTargetManager=new e.MorphTargetManager;for(var s=0;s<n.targets.length;s++){var a=r.weights?r.weights[s]:i.weights?i.weights[s]:0;o.morphTargetManager.addTarget(new e.MorphTarget("morphTarget"+s,a))}}},i.prototype._loadMorphTargetsAsync=function(e,t,r,i){if(!t.targets)return Promise.resolve();for(var n=new Array,o=r.morphTargetManager,s=0;s<o.numTargets;s++){var a=o.getTarget(s);n.push(this._loadMorphTargetVertexDataAsync(e+"/targets/"+s,i,t.targets[s],a))}return Promise.all(n).then((function(){}))},i.prototype._loadMorphTargetVertexDataAsync=function(t,r,n,o){var s=this,a=new Array,l=function(e,o,l){if(void 0!=n[e]){var u=r.getVertexBuffer(o);if(u){var h=i._GetProperty(t+"/"+e,s._gltf.accessors,n[e]);a.push(s._loadFloatAccessorAsync("#/accessors/"+h._index,h).then((function(e){l(u,e)})))}}};return l("POSITION",e.VertexBuffer.PositionKind,(function(e,t){e.forEach(t.length,(function(e,r){t[r]+=e})),o.setPositions(t)})),l("NORMAL",e.VertexBuffer.NormalKind,(function(e,t){e.forEach(t.length,(function(e,r){t[r]+=e})),o.setNormals(t)})),l("TANGENT",e.VertexBuffer.TangentKind,(function(e,t){var r=0;e.forEach(t.length/3*4,(function(e,i){(i+1)%4!=0&&(t[r++]+=e)})),o.setTangents(t)})),Promise.all(a).then((function(){}))},i._LoadTransform=function(t,r){var i=e.Vector3.Zero(),n=e.Quaternion.Identity(),o=e.Vector3.One();if(t.matrix){e.Matrix.FromArray(t.matrix).decompose(o,n,i)}else t.translation&&(i=e.Vector3.FromArray(t.translation)),t.rotation&&(n=e.Quaternion.FromArray(t.rotation)),t.scale&&(o=e.Vector3.FromArray(t.scale));r.position=i,r.rotationQuaternion=n,r.scaling=o},i.prototype._loadSkinAsync=function(t,r,i,n){var o=this,s=function(t){o._forEachPrimitive(r,(function(e){e.skeleton=t})),r._babylonMesh.parent=o._rootBabylonMesh,r._babylonMesh.position=e.Vector3.Zero(),r._babylonMesh.rotationQuaternion=e.Quaternion.Identity(),r._babylonMesh.scaling=e.Vector3.One()};if(n._loaded)return n._loaded.then((function(){s(n._babylonSkeleton)}));var a="skeleton"+n._index,l=new e.Skeleton(n.name||a,a,this._babylonScene);return n._babylonSkeleton=l,this._loadBones(t,n),s(l),n._loaded=this._loadSkinInverseBindMatricesDataAsync(t,n).then((function(e){o._updateBoneMatrices(l,e)}))},i.prototype._loadBones=function(e,t){for(var r={},n=0,o=t.joints;n<o.length;n++){var s=o[n],a=i._GetProperty(e+"/joints/"+s,this._gltf.nodes,s);this._loadBone(a,t,r)}},i.prototype._loadBone=function(t,r,i){var n=i[t._index];if(n)return n;var o=null;t._parent&&t._parent._babylonMesh!==this._rootBabylonMesh&&(o=this._loadBone(t._parent,r,i));var s=r.joints.indexOf(t._index);return n=new e.Bone(t.name||"joint"+t._index,r._babylonSkeleton,o,this._getNodeMatrix(t),null,null,s),i[t._index]=n,t._babylonBones=t._babylonBones||[],t._babylonBones.push(n),n},i.prototype._loadSkinInverseBindMatricesDataAsync=function(e,t){if(void 0==t.inverseBindMatrices)return Promise.resolve(null);var r=i._GetProperty(e+"/inverseBindMatrices",this._gltf.accessors,t.inverseBindMatrices);return this._loadFloatAccessorAsync("#/accessors/"+r._index,r)},i.prototype._updateBoneMatrices=function(t,r){for(var i=0,n=t.bones;i<n.length;i++){var o=n[i],s=e.Matrix.Identity(),a=o._index;r&&-1!==a&&(e.Matrix.FromArrayToRef(r,16*a,s),s.invertToRef(s));var l=o.getParent();l&&s.multiplyToRef(l.getInvertedAbsoluteTransform(),s),o.updateMatrix(s,!1,!1),o._updateDifferenceMatrix(void 0,!1)}},i.prototype._getNodeMatrix=function(t){return t.matrix?e.Matrix.FromArray(t.matrix):e.Matrix.Compose(t.scale?e.Vector3.FromArray(t.scale):e.Vector3.One(),t.rotation?e.Quaternion.FromArray(t.rotation):e.Quaternion.Identity(),t.translation?e.Vector3.FromArray(t.translation):e.Vector3.Zero())},i.prototype._loadCamera=function(t,r,i){var n=new e.FreeCamera(r.name||"camera"+r._index,e.Vector3.Zero(),this._babylonScene,!1);switch(n.parent=i,n.rotation=new e.Vector3(0,Math.PI,0),r.type){case"perspective":var o=r.perspective;if(!o)throw new Error(t+": Camera perspective properties are missing");n.fov=o.yfov,n.minZ=o.znear,
- n.maxZ=o.zfar||Number.MAX_VALUE;break;case"orthographic":if(!r.orthographic)throw new Error(t+": Camera orthographic properties are missing");n.mode=e.Camera.ORTHOGRAPHIC_CAMERA,n.orthoLeft=-r.orthographic.xmag,n.orthoRight=r.orthographic.xmag,n.orthoBottom=-r.orthographic.ymag,n.orthoTop=r.orthographic.ymag,n.minZ=r.orthographic.znear,n.maxZ=r.orthographic.zfar;break;default:throw new Error(t+": Invalid camera type ("+r.type+")")}this.onCameraLoadedObservable.notifyObservers(n)},i.prototype._loadAnimationsAsync=function(){var e=this._gltf.animations;if(!e)return Promise.resolve();for(var t=new Array,r=0;r<e.length;r++){var i=e[r];t.push(this._loadAnimationAsync("#/animations/"+r,i))}return Promise.all(t).then((function(){}))},i.prototype._loadAnimationAsync=function(t,i){var n=this,o=new e.AnimationGroup(i.name||"animation"+i._index,this._babylonScene);i._babylonAnimationGroup=o;var s=new Array;r.Assign(i.channels),r.Assign(i.samplers);for(var a=0,l=i.channels;a<l.length;a++){var u=l[a];s.push(this._loadAnimationChannelAsync(t+"/channels/"+u._index,t,i,u,o))}return Promise.all(s).then((function(){o.normalize(n._normalizeAnimationGroupsToBeginAtZero?0:null)}))},i.prototype._loadAnimationChannelAsync=function(t,r,n,o,s){var a=this,l=i._GetProperty(t+"/target/node",this._gltf.nodes,o.target.node);if("weights"===o.target.path&&!l._numMorphTargets||"weights"!==o.target.path&&!l._babylonMesh)return Promise.resolve();if(void 0!=l.skin&&"weights"!==o.target.path)return Promise.resolve();var u=i._GetProperty(t+"/sampler",n.samplers,o.sampler);return this._loadAnimationSamplerAsync(r+"/samplers/"+o.sampler,u).then((function(r){var i,n;switch(o.target.path){case"translation":i="position",n=e.Animation.ANIMATIONTYPE_VECTOR3;break;case"rotation":i="rotationQuaternion",n=e.Animation.ANIMATIONTYPE_QUATERNION;break;case"scale":i="scaling",n=e.Animation.ANIMATIONTYPE_VECTOR3;break;case"weights":i="influence",n=e.Animation.ANIMATIONTYPE_FLOAT;break;default:throw new Error(t+": Invalid target path ("+o.target.path+")")}var u,h=0;switch(i){case"position":u=function(){var t=e.Vector3.FromArray(r.output,h);return h+=3,t};break;case"rotationQuaternion":u=function(){var t=e.Quaternion.FromArray(r.output,h);return h+=4,t};break;case"scaling":u=function(){var t=e.Vector3.FromArray(r.output,h);return h+=3,t};break;case"influence":u=function(){for(var e=new Array(l._numMorphTargets),t=0;t<l._numMorphTargets;t++)e[t]=r.output[h++];return e}}var c;switch(r.interpolation){case"STEP":c=function(t){return{frame:r.input[t],value:u(),interpolation:e.AnimationKeyInterpolation.STEP}};break;case"LINEAR":c=function(e){return{frame:r.input[e],value:u()}};break;case"CUBICSPLINE":c=function(e){return{frame:r.input[e],inTangent:u(),value:u(),outTangent:u()}}}for(var f=new Array(r.input.length),d=0;d<r.input.length;d++)f[d]=c(d);if("influence"===i)for(var p=0;p<l._numMorphTargets;p++)!(function(t){var r=s.name+"_channel"+s.targetedAnimations.length,o=new e.Animation(r,i,1,n);o.setKeys(f.map((function(e){return{frame:e.frame,inTangent:e.inTangent?e.inTangent[t]:void 0,value:e.value[t],outTangent:e.outTangent?e.outTangent[t]:void 0}}))),a._forEachPrimitive(l,(function(e){var r=e.morphTargetManager.getTarget(t),i=o.clone();r.animations.push(i),s.addTargetedAnimation(i,r)}))})(p);else{var A=s.name+"_channel"+s.targetedAnimations.length,m=new e.Animation(A,i,1,n);if(m.setKeys(f),l._babylonBones){for(var g=[l._babylonMesh].concat(l._babylonBones),_=0,v=g;_<v.length;_++){v[_].animations.push(m)}s.addTargetedAnimation(m,g)}else l._babylonMesh.animations.push(m),s.addTargetedAnimation(m,l._babylonMesh)}}))},i.prototype._loadAnimationSamplerAsync=function(e,t){if(t._data)return t._data;var r=t.interpolation||"LINEAR";switch(r){case"STEP":case"LINEAR":case"CUBICSPLINE":break;default:throw new Error(e+": Invalid interpolation ("+t.interpolation+")")}var n=i._GetProperty(e+"/input",this._gltf.accessors,t.input),o=i._GetProperty(e+"/output",this._gltf.accessors,t.output);return t._data=Promise.all([this._loadFloatAccessorAsync("#/accessors/"+n._index,n),this._loadFloatAccessorAsync("#/accessors/"+o._index,o)]).then((function(e){var t=e[0],i=e[1];return{input:t,interpolation:r,output:i}})),t._data},i.prototype._loadBufferAsync=function(e,t){if(t._data)return t._data;if(!t.uri)throw new Error(e+": Uri is missing");return t._data=this._loadUriAsync(e,t.uri),t._data},i.prototype._loadBufferViewAsync=function(e,t){if(t._data)return t._data;var r=i._GetProperty(e+"/buffer",this._gltf.buffers,t.buffer);return t._data=this._loadBufferAsync("#/buffers/"+r._index,r).then((function(r){try{return new Uint8Array(r.buffer,r.byteOffset+(t.byteOffset||0),t.byteLength)}catch(t){throw new Error(e+": "+t.message)}})),t._data},i.prototype._loadIndicesAccessorAsync=function(e,t){if("SCALAR"!==t.type)throw new Error(e+": Invalid type "+t.type);if(5121!==t.componentType&&5123!==t.componentType&&5125!==t.componentType)throw new Error(e+": Invalid component type "+t.componentType);if(t._data)return t._data;var r=i._GetProperty(e+"/bufferView",this._gltf.bufferViews,t.bufferView);return t._data=this._loadBufferViewAsync("#/bufferViews/"+r._index,r).then((function(r){return i._GetTypedArray(e,t.componentType,r,t.byteOffset,t.count)})),t._data},i.prototype._loadFloatAccessorAsync=function(e,t){var r=this;if(5126!==t.componentType)throw new Error("Invalid component type "+t.componentType);if(t._data)return t._data;var n=i._GetNumComponents(e,t.type),o=n*t.count;if(void 0==t.bufferView)t._data=Promise.resolve(new Float32Array(o));else{var s=i._GetProperty(e+"/bufferView",this._gltf.bufferViews,t.bufferView);t._data=this._loadBufferViewAsync("#/bufferViews/"+s._index,s).then((function(r){return i._GetTypedArray(e,t.componentType,r,t.byteOffset,o)}))}if(t.sparse){var a=t.sparse;t._data=t._data.then((function(o){var s=i._GetProperty(e+"/sparse/indices/bufferView",r._gltf.bufferViews,a.indices.bufferView),l=i._GetProperty(e+"/sparse/values/bufferView",r._gltf.bufferViews,a.values.bufferView);return Promise.all([r._loadBufferViewAsync("#/bufferViews/"+s._index,s),r._loadBufferViewAsync("#/bufferViews/"+l._index,l)]).then((function(r){for(var s=r[0],l=r[1],u=i._GetTypedArray(e+"/sparse/indices",a.indices.componentType,s,a.indices.byteOffset,a.count),h=i._GetTypedArray(e+"/sparse/values",t.componentType,l,a.values.byteOffset,n*a.count),c=0,f=0;f<u.length;f++)for(var d=u[f]*n,p=0;p<n;p++)o[d++]=h[c++];return o}))}))}return t._data},i.prototype._loadVertexBufferViewAsync=function(t,r,i){var n=this;return r._babylonBuffer?r._babylonBuffer:(r._babylonBuffer=this._loadBufferViewAsync(t,r).then((function(t){return new e.Buffer(n._babylonScene.getEngine(),t,!1)})),r._babylonBuffer)},i.prototype._loadVertexAccessorAsync=function(t,r,n){var o=this;if(r._babylonVertexBuffer)return r._babylonVertexBuffer;if(r.sparse)r._babylonVertexBuffer=this._loadFloatAccessorAsync(t,r).then((function(t){return new e.VertexBuffer(o._babylonScene.getEngine(),t,n,!1)}));else{var s=i._GetProperty(t+"/bufferView",this._gltf.bufferViews,r.bufferView);r._babylonVertexBuffer=this._loadVertexBufferViewAsync("#/bufferViews/"+s._index,s,n).then((function(a){var l=i._GetNumComponents(t,r.type);return new e.VertexBuffer(o._babylonScene.getEngine(),a,n,!1,!1,s.byteStride,!1,r.byteOffset,l,r.componentType,r.normalized,!0)}))}return r._babylonVertexBuffer},i.prototype._getDefaultMaterial=function(t){var r=this._defaultBabylonMaterials[t];return r||(r=this._createMaterial("__gltf_default",t),r.transparencyMode=e.PBRMaterial.PBRMATERIAL_OPAQUE,r.metallic=1,r.roughness=1,this.onMaterialLoadedObservable.notifyObservers(r)),r},i.prototype._loadMaterialMetallicRoughnessPropertiesAsync=function(t,r,i){var n=new Array;i.metallic=1,i.roughness=1;var o=r.pbrMetallicRoughness;return o&&(o.baseColorFactor?(i.albedoColor=e.Color3.FromArray(o.baseColorFactor),i.alpha=o.baseColorFactor[3]):i.albedoColor=e.Color3.White(),i.metallic=void 0==o.metallicFactor?1:o.metallicFactor,i.roughness=void 0==o.roughnessFactor?1:o.roughnessFactor,o.baseColorTexture&&n.push(this._loadTextureAsync(t+"/baseColorTexture",o.baseColorTexture,(function(e){i.albedoTexture=e}))),o.metallicRoughnessTexture&&(n.push(this._loadTextureAsync(t+"/metallicRoughnessTexture",o.metallicRoughnessTexture,(function(e){i.metallicTexture=e}))),i.useMetallnessFromMetallicTextureBlue=!0,i.useRoughnessFromMetallicTextureGreen=!0,i.useRoughnessFromMetallicTextureAlpha=!1)),this._loadMaterialAlphaProperties(t,r,i),Promise.all(n).then((function(){}))},i.prototype._loadMaterialAsync=function(e,r,i,n,o,s){var a=t.GLTFLoaderExtension._LoadMaterialAsync(this,e,r,i,n,o,s);if(a)return a;r._babylonData=r._babylonData||{};var l=r._babylonData[o];if(!l){var u=new Array,h=r.name||"material_"+r._index,c=this._createMaterial(h,o);u.push(this._loadMaterialBasePropertiesAsync(e,r,c)),u.push(this._loadMaterialMetallicRoughnessPropertiesAsync(e,r,c)),this.onMaterialLoadedObservable.notifyObservers(c),l={material:c,meshes:[],loaded:Promise.all(u).then((function(){}))},r._babylonData[o]=l}return l.meshes.push(n),s(l.material),l.loaded},i.prototype._createMaterial=function(t,r){var i=new e.PBRMaterial(t,this._babylonScene);return i.sideOrientation=this._babylonScene.useRightHandedSystem?e.Material.CounterClockWiseSideOrientation:e.Material.ClockWiseSideOrientation,i.fillMode=r,i.enableSpecularAntiAliasing=!0,i.useRadianceOverAlpha=!this.transparencyAsCoverage,i.useSpecularOverAlpha=!this.transparencyAsCoverage,i},i.prototype._loadMaterialBasePropertiesAsync=function(t,r,i){var n=new Array;return i.emissiveColor=r.emissiveFactor?e.Color3.FromArray(r.emissiveFactor):new e.Color3(0,0,0),r.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),r.normalTexture&&(n.push(this._loadTextureAsync(t+"/normalTexture",r.normalTexture,(function(e){i.bumpTexture=e}))),i.invertNormalMapX=!this._babylonScene.useRightHandedSystem,i.invertNormalMapY=this._babylonScene.useRightHandedSystem,void 0!=r.normalTexture.scale&&(i.bumpTexture.level=r.normalTexture.scale)),r.occlusionTexture&&(n.push(this._loadTextureAsync(t+"/occlusionTexture",r.occlusionTexture,(function(e){i.ambientTexture=e}))),i.useAmbientInGrayScale=!0,void 0!=r.occlusionTexture.strength&&(i.ambientTextureStrength=r.occlusionTexture.strength)),r.emissiveTexture&&n.push(this._loadTextureAsync(t+"/emissiveTexture",r.emissiveTexture,(function(e){i.emissiveTexture=e}))),Promise.all(n).then((function(){}))},i.prototype._loadMaterialAlphaProperties=function(t,r,i){switch(r.alphaMode||"OPAQUE"){case"OPAQUE":i.transparencyMode=e.PBRMaterial.PBRMATERIAL_OPAQUE;break;case"MASK":i.transparencyMode=e.PBRMaterial.PBRMATERIAL_ALPHATEST,i.alphaCutOff=void 0==r.alphaCutoff?.5:r.alphaCutoff,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0);break;case"BLEND":i.transparencyMode=e.PBRMaterial.PBRMATERIAL_ALPHABLEND,i.albedoTexture&&(i.albedoTexture.hasAlpha=!0,i.useAlphaFromAlbedoTexture=!0);break;default:throw new Error(t+": Invalid alpha mode ("+r.alphaMode+")")}},i.prototype._loadTextureAsync=function(r,n,o){var s=this,a=t.GLTFLoaderExtension._LoadTextureAsync(this,r,n,o);if(a)return a;var l=i._GetProperty(r+"/index",this._gltf.textures,n.index);r="#/textures/"+n.index;var u=new Array,h=void 0==l.sampler?this._defaultSampler:i._GetProperty(r+"/sampler",this._gltf.samplers,l.sampler),c=this._loadSampler("#/samplers/"+h._index,h),f=new e.Deferred,d=new e.Texture(null,this._babylonScene,c.noMipMaps,!1,c.samplingMode,function(){s._disposed||f.resolve()},function(e,t){s._disposed||f.reject(new Error(r+": "+(t&&t.message?t.message:e||"Failed to load texture")))});u.push(f.promise),d.name=l.name||"texture"+l._index,d.wrapU=c.wrapU,d.wrapV=c.wrapV,d.coordinatesIndex=n.texCoord||0;var p=i._GetProperty(r+"/source",this._gltf.images,l.source);return u.push(this._loadImageAsync("#/images/"+p._index,p).then((function(e){var t="data:"+s._rootUrl+(p.uri||"image"+p._index);d.updateURL(t,e)}))),o(d),this.onTextureLoadedObservable.notifyObservers(d),Promise.all(u).then((function(){}))},i.prototype._loadSampler=function(e,t){return t._data||(t._data={noMipMaps:9728===t.minFilter||9729===t.minFilter,samplingMode:i._GetTextureSamplingMode(e,t.magFilter,t.minFilter),wrapU:i._GetTextureWrapMode(e,t.wrapS),wrapV:i._GetTextureWrapMode(e,t.wrapT)}),t._data},i.prototype._loadImageAsync=function(e,t){if(t._blob)return t._blob;var r;if(t.uri)r=this._loadUriAsync(e,t.uri);else{var n=i._GetProperty(e+"/bufferView",this._gltf.bufferViews,t.bufferView);r=this._loadBufferViewAsync("#/bufferViews/"+n._index,n)}return t._blob=r.then((function(e){return new Blob([e],{type:t.mimeType})})),t._blob},i.prototype._loadUriAsync=function(r,n){var o=this,s=t.GLTFLoaderExtension._LoadUriAsync(this,r,n);if(s)return s;if(!i._ValidateUri(n))throw new Error(r+": Uri '"+n+"' is invalid");return e.Tools.IsBase64(n)?Promise.resolve(new Uint8Array(e.Tools.DecodeBase64(n))):this.preprocessUrlAsync(this._rootUrl+n).then((function(t){return new Promise(function(i,s){if(!o._disposed){var a=e.Tools.LoadFile(t,(function(e){o._disposed||i(new Uint8Array(e))}),(function(t){if(!o._disposed)try{a&&o._state===e.GLTFLoaderState.LOADING&&(a._lengthComputable=t.lengthComputable,a._loaded=t.loaded,a._total=t.total,o._onProgress())}catch(e){s(e)}}),o._babylonScene.database,!0,(function(t,i){o._disposed||s(new e.LoadFileError(r+": Failed to load '"+n+"'"+(t?": "+t.status+" "+t.statusText:""),t))}));o._requests.push(a)}})}))},i.prototype._onProgress=function(){if(this._progressCallback){for(var t=!0,r=0,i=0,n=0,o=this._requests;n<o.length;n++){var s=o[n];if(void 0===s._lengthComputable||void 0===s._loaded||void 0===s._total)return;t=t&&s._lengthComputable,r+=s._loaded,i+=s._total}this._progressCallback(new e.SceneLoaderProgressEvent(t,r,t?i:0))}},i._GetProperty=function(e,t,r){if(!t||void 0==r||!t[r])throw new Error(e+": Failed to find index ("+r+")");return t[r]},i._GetTextureWrapMode=function(t,r){switch(r=void 0==r?10497:r){case 33071:return e.Texture.CLAMP_ADDRESSMODE;case 33648:return e.Texture.MIRROR_ADDRESSMODE;case 10497:return e.Texture.WRAP_ADDRESSMODE;default:return e.Tools.Warn(t+": Invalid texture wrap mode ("+r+")"),e.Texture.WRAP_ADDRESSMODE}},i._GetTextureSamplingMode=function(t,r,i){if(r=void 0==r?9729:r,i=void 0==i?9987:i,9729===r)switch(i){case 9728:return e.Texture.LINEAR_NEAREST;case 9729:return e.Texture.LINEAR_LINEAR;case 9984:return e.Texture.LINEAR_NEAREST_MIPNEAREST;case 9985:return e.Texture.LINEAR_LINEAR_MIPNEAREST;case 9986:return e.Texture.LINEAR_NEAREST_MIPLINEAR;case 9987:return e.Texture.LINEAR_LINEAR_MIPLINEAR;default:return e.Tools.Warn(t+": Invalid texture minification filter ("+i+")"),e.Texture.LINEAR_LINEAR_MIPLINEAR}else switch(9728!==r&&e.Tools.Warn(t+": Invalid texture magnification filter ("+r+")"),i){case 9728:return e.Texture.NEAREST_NEAREST;case 9729:return e.Texture.NEAREST_LINEAR;case 9984:return e.Texture.NEAREST_NEAREST_MIPNEAREST;case 9985:return e.Texture.NEAREST_LINEAR_MIPNEAREST;case 9986:return e.Texture.NEAREST_NEAREST_MIPLINEAR;case 9987:return e.Texture.NEAREST_LINEAR_MIPLINEAR;default:return e.Tools.Warn(t+": Invalid texture minification filter ("+i+")"),e.Texture.NEAREST_NEAREST_MIPNEAREST}},i._GetTypedArray=function(e,t,r,i,n){var o=r.buffer;i=r.byteOffset+(i||0);try{switch(t){case 5120:return new Int8Array(o,i,n);case 5121:return new Uint8Array(o,i,n);case 5122:return new Int16Array(o,i,n);case 5123:return new Uint16Array(o,i,n);case 5125:return new Uint32Array(o,i,n);case 5126:return new Float32Array(o,i,n);default:throw new Error("Invalid component type "+t)}}catch(t){throw new Error(e+": "+t)}},i._GetNumComponents=function(e,t){switch(t){case"SCALAR":return 1;case"VEC2":return 2;case"VEC3":return 3;case"VEC4":case"MAT2":return 4;case"MAT3":return 9;case"MAT4":return 16}throw new Error(e+": Invalid type ("+t+")")},i._ValidateUri=function(t){return e.Tools.IsBase64(t)||-1===t.indexOf("..")},i._GetDrawMode=function(t,r){switch(void 0==r&&(r=4),r){case 0:return e.Material.PointListDrawMode;case 1:return e.Material.LineListDrawMode;case 2:return e.Material.LineLoopDrawMode;case 3:return e.Material.LineStripDrawMode;case 4:return e.Material.TriangleFillMode;case 5:return e.Material.TriangleStripDrawMode;case 6:return e.Material.TriangleFanDrawMode}throw new Error(t+": Invalid mesh primitive mode ("+r+")")},i.prototype._compileMaterialsAsync=function(){var e=new Array;if(this._gltf.materials)for(var t=0,r=this._gltf.materials;t<r.length;t++){var i=r[t];if(i._babylonData)for(var n in i._babylonData)for(var o=i._babylonData[n],s=0,a=o.meshes;s<a.length;s++){var l=a[s];l.computeWorldMatrix(!0);var u=o.material;e.push(u.forceCompilationAsync(l)),this.useClipPlane&&e.push(u.forceCompilationAsync(l,{clipPlane:!0}))}}return Promise.all(e).then((function(){}))},i.prototype._compileShadowGeneratorsAsync=function(){for(var e=new Array,t=this._babylonScene.lights,r=0,i=t;r<i.length;r++){var n=i[r],o=n.getShadowGenerator();o&&e.push(o.forceCompilationAsync())}return Promise.all(e).then((function(){}))},i.prototype._clear=function(){for(var e=0,t=this._requests;e<t.length;e++){t[e].abort()}this._requests.length=0,delete this._gltf,delete this._babylonScene,this._completePromises.length=0,this._onReadyObservable.clear();for(var r in this._extensions)this._extensions[r].dispose();this._extensions={},delete this._rootBabylonMesh,delete this._progressCallback,this.onMeshLoadedObservable.clear(),this.onTextureLoadedObservable.clear(),this.onMaterialLoadedObservable.clear(),this.onCameraLoadedObservable.clear()},i.prototype._applyExtensions=function(e){for(var t=0,r=i._ExtensionNames;t<r.length;t++){var n=r[t],o=this._extensions[n];if(o.enabled){var s=e(o);if(s)return s}}return null},i._ExtensionNames=new Array,i._ExtensionFactories={},i})();t.GLTFLoader=i,e.GLTFFileLoader._CreateGLTFLoaderV2=function(){return new i}})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(e){var t=(function(){function e(e){this.enabled=!0,this._loader=e}return e.prototype.dispose=function(){delete this._loader},e.prototype._loadSceneAsync=function(e,t){return null},e.prototype._loadNodeAsync=function(e,t){return null},e.prototype._loadVertexDataAsync=function(e,t,r){return null},e.prototype._loadMaterialAsync=function(e,t,r,i,n,o){return null},e.prototype._loadTextureAsync=function(e,t,r){return null},e.prototype._loadUriAsync=function(e,t){return null},e.prototype._loadExtensionAsync=function(e,t,r){if(!t.extensions)return null;var i=t.extensions,n=i[this.name];if(!n)return null;delete i[this.name];try{return r(e+"/extensions/"+this.name,n)}finally{i[this.name]=n}},e.prototype._loadExtrasValueAsync=function(e,t,r){if(!t.extras)return null;var i=t.extras,n=i[this.name];if(void 0===n)return null;delete i[this.name];try{return r(e+"/extras/"+this.name,n)}finally{i[this.name]=n}},e._LoadSceneAsync=function(e,t,r){return e._applyExtensions((function(e){return e._loadSceneAsync(t,r)}))},e._LoadNodeAsync=function(e,t,r){return e._applyExtensions((function(e){return e._loadNodeAsync(t,r)}))},e._LoadVertexDataAsync=function(e,t,r,i){return e._applyExtensions((function(e){return e._loadVertexDataAsync(t,r,i)}))},e._LoadMaterialAsync=function(e,t,r,i,n,o,s){return e._applyExtensions((function(e){return e._loadMaterialAsync(t,r,i,n,o,s)}))},e._LoadTextureAsync=function(e,t,r,i){return e._applyExtensions((function(e){return e._loadTextureAsync(t,r,i)}))},e._LoadUriAsync=function(e,t,r){return e._applyExtensions((function(e){return e._loadUriAsync(t,r)}))},e})();e.GLTFLoaderExtension=t})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(r){!(function(i){var n="MSFT_lod",o=(function(i){function o(t){var r=i.call(this,t)||this;return r.name=n,r.maxLODsToLoad=Number.MAX_VALUE,r.onNodeLODsLoadedObservable=new e.Observable,r.onMaterialLODsLoadedObservable=new e.Observable,r._loadingNodeLOD=null,r._loadNodeSignals={},r._loadNodePromises=new Array,r._loadingMaterialLOD=null,r._loadMaterialSignals={},r._loadMaterialPromises=new Array,r._loader._onReadyObservable.addOnce((function(){for(var e=0;e<r._loadNodePromises.length;e++)!(function(e){Promise.all(r._loadNodePromises[e]).then((function(){r.onNodeLODsLoadedObservable.notifyObservers(e)}))})(e);for(var e=0;e<r._loadMaterialPromises.length;e++)!(function(e){Promise.all(r._loadMaterialPromises[e]).then((function(){r.onMaterialLODsLoadedObservable.notifyObservers(e)}))})(e)})),r}return t(o,i),o.prototype.dispose=function(){i.prototype.dispose.call(this),this._loadingNodeLOD=null,this._loadNodeSignals={},this._loadingMaterialLOD=null,this._loadMaterialSignals={},this.onMaterialLODsLoadedObservable.clear(),this.onNodeLODsLoadedObservable.clear()},o.prototype._loadNodeAsync=function(t,r){var i=this;return this._loadExtensionAsync(t,r,(function(t,n){for(var o,s=i._getLODs(t,r,i._loader._gltf.nodes,n.ids),a=0;a<s.length;a++)!(function(t){var r=s[t];0!==t&&(i._loadingNodeLOD=r,i._loadNodeSignals[r._index]||(i._loadNodeSignals[r._index]=new e.Deferred));var n=i._loader._loadNodeAsync("#/nodes/"+r._index,r).then((function(){if(0!==t){var e=s[t-1];e._babylonMesh&&(e._babylonMesh.dispose(!1,!0),delete e._babylonMesh)}if(t!==s.length-1){var r=s[t+1]._index;i._loadNodeSignals[r]&&(i._loadNodeSignals[r].resolve(),delete i._loadNodeSignals[r])}}));0===t?o=n:(i._loader._completePromises.push(n),i._loadingNodeLOD=null),i._loadNodePromises[t]=i._loadNodePromises[t]||[],i._loadNodePromises[t].push(n)})(a);return o}))},o.prototype._loadMaterialAsync=function(t,r,i,n,o,s){var a=this;return this._loadingNodeLOD?null:this._loadExtensionAsync(t,r,(function(t,l){for(var u,h=a._getLODs(t,r,a._loader._gltf.materials,l.ids),c=0;c<h.length;c++)!(function(t){var r=h[t];0!==t&&(a._loadingMaterialLOD=r,a._loadMaterialSignals[r._index]||(a._loadMaterialSignals[r._index]=new e.Deferred));var l=a._loader._loadMaterialAsync("#/materials/"+r._index,r,i,n,o,0===t?s:function(){}).then((function(){if(0!==t){var e=r._babylonData;s(e[o].material);var i=h[t-1]._babylonData;i[o]&&(i[o].material.dispose(),delete i[o])}if(t!==h.length-1){var n=h[t+1]._index;a._loadMaterialSignals[n]&&(a._loadMaterialSignals[n].resolve(),delete a._loadMaterialSignals[n])}}));0===t?u=l:(a._loader._completePromises.push(l),a._loadingMaterialLOD=null),a._loadMaterialPromises[t]=a._loadMaterialPromises[t]||[],a._loadMaterialPromises[t].push(l)})(c);return u}))},o.prototype._loadUriAsync=function(e,t){var r=this;if(this._loadingMaterialLOD){var i=this._loadingMaterialLOD._index;return this._loadMaterialSignals[i].promise.then((function(){return r._loader._loadUriAsync(e,t)}))}if(this._loadingNodeLOD){var i=this._loadingNodeLOD._index;return this._loadNodeSignals[i].promise.then((function(){return r._loader._loadUriAsync(e,t)}))}return null},o.prototype._getLODs=function(e,t,i,n){if(this.maxLODsToLoad<=0)throw new Error("maxLODsToLoad must be greater than zero");for(var o=new Array,s=n.length-1;s>=0;s--)if(o.push(r.GLTFLoader._GetProperty(e+"/ids/"+n[s],i,n[s])),o.length===this.maxLODsToLoad)return o;return o.push(t),o},o})(r.GLTFLoaderExtension);i.MSFT_lod=o,r.GLTFLoader._Register(n,(function(e){return new o(e)}))})(r.Extensions||(r.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(e){!(function(r){var i="MSFT_minecraftMesh",n=(function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name=i,t}return t(r,e),r.prototype._loadMaterialAsync=function(e,t,r,i,n,o){var s=this;return this._loadExtrasValueAsync(e,r,(function(a,l){return l?s._loader._loadMaterialAsync(e,t,r,i,n,(function(e){e.needAlphaBlending()&&(e.forceDepthWrite=!0,e.separateCullingPass=!0),e.backFaceCulling=e.forceDepthWrite,e.twoSidedLighting=!0,o(e)})):null}))},r})(e.GLTFLoaderExtension);r.MSFT_minecraftMesh=n,e.GLTFLoader._Register(i,(function(e){return new n(e)}))})(e.Extensions||(e.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(e){!(function(r){var i="MSFT_sRGBFactors",n=(function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name=i,t}return t(r,e),r.prototype._loadMaterialAsync=function(e,t,r,i,n,o){var s=this;return this._loadExtrasValueAsync(e,t,(function(a,l){return l?s._loader._loadMaterialAsync(e,t,r,i,n,(function(e){e.albedoTexture||e.albedoColor.toLinearSpaceToRef(e.albedoColor),e.reflectivityTexture||e.reflectivityColor.toLinearSpaceToRef(e.reflectivityColor),o(e)})):null}))},r})(e.GLTFLoaderExtension);r.MSFT_sRGBFactors=n,e.GLTFLoader._Register(i,(function(e){return new n(e)}))})(e.Extensions||(e.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(r){!(function(i){var n="KHR_draco_mesh_compression",o=(function(i){function o(t){var r=i.call(this,t)||this;return r.name=n,r._dracoCompression=null,e.DracoCompression.DecoderAvailable||(r.enabled=!1),r}return t(o,i),o.prototype.dispose=function(){this._dracoCompression&&this._dracoCompression.dispose(),i.prototype.dispose.call(this)},o.prototype._loadVertexDataAsync=function(t,i,n){var o=this;return this._loadExtensionAsync(t,i,(function(s,a){if(void 0!=i.mode){if(5!==i.mode&&4!==i.mode)throw new Error(t+": Unsupported mode "+i.mode);if(5===i.mode)throw new Error(t+": Mode "+i.mode+" is not currently supported")}var l={},u=function(e,t){var r=a.attributes[e];void 0!=r&&(n._delayInfo=n._delayInfo||[],-1===n._delayInfo.indexOf(t)&&n._delayInfo.push(t),l[t]=r)};u("POSITION",e.VertexBuffer.PositionKind),u("NORMAL",e.VertexBuffer.NormalKind),u("TANGENT",e.VertexBuffer.TangentKind),u("TEXCOORD_0",e.VertexBuffer.UVKind),u("TEXCOORD_1",e.VertexBuffer.UV2Kind),u("JOINTS_0",e.VertexBuffer.MatricesIndicesKind),u("WEIGHTS_0",e.VertexBuffer.MatricesWeightsKind),u("COLOR_0",e.VertexBuffer.ColorKind);var h=r.GLTFLoader._GetProperty(s,o._loader._gltf.bufferViews,a.bufferView);return h._dracoBabylonGeometry||(h._dracoBabylonGeometry=o._loader._loadBufferViewAsync("#/bufferViews/"+h._index,h).then((function(r){return o._dracoCompression||(o._dracoCompression=new e.DracoCompression),o._dracoCompression.decodeMeshAsync(r,l).then((function(t){var r=new e.Geometry(n.name,o._loader._babylonScene);return t.applyToGeometry(r),r})).catch((function(e){throw new Error(t+": "+e.message)}))}))),h._dracoBabylonGeometry}))},o})(r.GLTFLoaderExtension);i.KHR_draco_mesh_compression=o,r.GLTFLoader._Register(n,(function(e){return new o(e)}))})(r.Extensions||(r.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(r){!(function(i){var n="KHR_materials_pbrSpecularGlossiness",o=(function(r){function i(){var e=null!==r&&r.apply(this,arguments)||this;return e.name=n,e}return t(i,r),i.prototype._loadMaterialAsync=function(e,t,r,i,n,o){var s=this;return this._loadExtensionAsync(e,t,(function(r,a){t._babylonData=t._babylonData||{};var l=t._babylonData[n];if(!l){var u=new Array,h=t.name||"materialSG_"+t._index,c=s._loader._createMaterial(h,n);u.push(s._loader._loadMaterialBasePropertiesAsync(e,t,c)),u.push(s._loadSpecularGlossinessPropertiesAsync(r,t,a,c)),s._loader.onMaterialLoadedObservable.notifyObservers(c),l={material:c,meshes:[],loaded:Promise.all(u).then((function(){}))},t._babylonData[n]=l}return l.meshes.push(i),o(l.material),l.loaded}))},i.prototype._loadSpecularGlossinessPropertiesAsync=function(t,r,i,n){var o=new Array;return i.diffuseFactor?(n.albedoColor=e.Color3.FromArray(i.diffuseFactor),n.alpha=i.diffuseFactor[3]):n.albedoColor=e.Color3.White(),n.reflectivityColor=i.specularFactor?e.Color3.FromArray(i.specularFactor):e.Color3.White(),n.microSurface=void 0==i.glossinessFactor?1:i.glossinessFactor,i.diffuseTexture&&o.push(this._loader._loadTextureAsync(t+"/diffuseTexture",i.diffuseTexture,(function(e){n.albedoTexture=e}))),i.specularGlossinessTexture&&(o.push(this._loader._loadTextureAsync(t+"/specularGlossinessTexture",i.specularGlossinessTexture,(function(e){n.reflectivityTexture=e}))),n.reflectivityTexture.hasAlpha=!0,n.useMicroSurfaceFromReflectivityMapAlpha=!0),this._loader._loadMaterialAlphaProperties(t,r,n),Promise.all(o).then((function(){}))},i})(r.GLTFLoaderExtension);i.KHR_materials_pbrSpecularGlossiness=o,r.GLTFLoader._Register(n,(function(e){return new o(e)}))})(r.Extensions||(r.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(r){!(function(i){var n="KHR_materials_unlit",o=(function(r){function i(){var e=null!==r&&r.apply(this,arguments)||this;return e.name=n,e}return t(i,r),i.prototype._loadMaterialAsync=function(e,t,r,i,n,o){var s=this;return this._loadExtensionAsync(e,t,(function(){t._babylonData=t._babylonData||{};var r=t._babylonData[n];if(!r){var a=t.name||"materialUnlit_"+t._index,l=s._loader._createMaterial(a,n);l.unlit=!0;var u=s._loadUnlitPropertiesAsync(e,t,l);s._loader.onMaterialLoadedObservable.notifyObservers(l),r={material:l,meshes:[],loaded:u},t._babylonData[n]=r}return r.meshes.push(i),o(r.material),r.loaded}))},i.prototype._loadUnlitPropertiesAsync=function(t,r,i){var n=new Array;i.metallic=1,i.roughness=1;var o=r.pbrMetallicRoughness;return o&&(o.baseColorFactor?(i.albedoColor=e.Color3.FromArray(o.baseColorFactor),i.alpha=o.baseColorFactor[3]):i.albedoColor=e.Color3.White(),o.baseColorTexture&&n.push(this._loader._loadTextureAsync(t+"/baseColorTexture",o.baseColorTexture,(function(e){i.albedoTexture=e})))),r.doubleSided&&(i.backFaceCulling=!1,i.twoSidedLighting=!0),this._loader._loadMaterialAlphaProperties(t,r,i),Promise.all(n).then((function(){}))},i})(r.GLTFLoaderExtension);i.KHR_materials_unlit=o,r.GLTFLoader._Register(n,(function(e){return new o(e)}))})(r.Extensions||(r.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;!(function(e){!(function(r){!(function(i){var n,o="KHR_lights";!(function(e){e.AMBIENT="ambient",e.DIRECTIONAL="directional",e.POINT="point",e.SPOT="spot"})(n||(n={}));var s=(function(i){function s(){var e=null!==i&&i.apply(this,arguments)||this;return e.name=o,e}return t(s,i),s.prototype._loadSceneAsync=function(t,i){var o=this;return this._loadExtensionAsync(t,i,(function(t,s){var a=o._loader._loadSceneAsync(t,i),l=r.GLTFLoader._GetProperty(t,o._lights,s.light);if(l.type!==n.AMBIENT)throw new Error(t+": Only ambient lights are allowed on a scene");return o._loader._babylonScene.ambientColor=l.color?e.Color3.FromArray(l.color):e.Color3.Black(),a}))},s.prototype._loadNodeAsync=function(t,i){var o=this;return this._loadExtensionAsync(t,i,(function(t,s){var a,l=o._loader._loadNodeAsync(t,i),u=r.GLTFLoader._GetProperty(t,o._lights,s.light),h=i._babylonMesh.name;switch(u.type){case n.AMBIENT:throw new Error(t+": Ambient lights are not allowed on a node");case n.DIRECTIONAL:a=new e.DirectionalLight(h,e.Vector3.Forward(),o._loader._babylonScene);break;case n.POINT:a=new e.PointLight(h,e.Vector3.Zero(),o._loader._babylonScene);break;case n.SPOT:var c=u,f=c.outerConeAngle||Math.PI/4;a=new e.SpotLight(h,e.Vector3.Zero(),e.Vector3.Forward(),f,2,o._loader._babylonScene);break;default:throw new Error(t+": Invalid light type ("+u.type+")")}return a.diffuse=u.color?e.Color3.FromArray(u.color):e.Color3.White(),a.intensity=void 0==u.intensity?1:u.intensity,a.parent=i._babylonMesh,l}))},Object.defineProperty(s.prototype,"_lights",{get:function(){var e=this._loader._gltf.extensions;if(!e||!e[this.name])throw new Error("#/extensions: '"+this.name+"' not found");return e[this.name].lights},enumerable:!0,configurable:!0}),s})(r.GLTFLoaderExtension);i.KHR_lights=s,r.GLTFLoader._Register(o,(function(e){return new s(e)}))})(r.Extensions||(r.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={}));var e;return (function(e){!(function(e){!(function(r){var i="KHR_texture_transform",n=(function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name=i,t}return t(r,e),r.prototype._loadTextureAsync=function(e,t,r){var i=this;return this._loadExtensionAsync(e,t,(function(n,o){return i._loader._loadTextureAsync(e,t,(function(e){o.offset&&(e.uOffset=o.offset[0],e.vOffset=o.offset[1]),e.uRotationCenter=0,e.vRotationCenter=0,o.rotation&&(e.wAng=-o.rotation),o.scale&&(e.uScale=o.scale[0],e.vScale=o.scale[1]),void 0!=o.texCoord&&(e.coordinatesIndex=o.texCoord),r(e)}))}))},r})(e.GLTFLoaderExtension);r.KHR_texture_transform=n,e.GLTFLoader._Register(i,(function(e){return new n(e)}))
- })(e.Extensions||(e.Extensions={}))})(e.GLTF2||(e.GLTF2={}))})(e||(e={})),e}))}),(function(e,t,r){e.exports=r(16)}),(function(e,t,r){"use strict";function i(){s.viewerManager.dispose(),n.mapperManager.dispose(),u.telemetryManager.dispose()}Object.defineProperty(t,"__esModule",{value:!0});var n=r(3);t.mapperManager=n.mapperManager;var o=r(4);t.viewerGlobals=o.viewerGlobals;var s=r(7);t.viewerManager=s.viewerManager;var a=r(8);t.DefaultViewer=a.DefaultViewer;var l=r(9);t.AbstractViewer=l.AbstractViewer;var u=r(6);t.telemetryManager=u.telemetryManager;var h=r(13);t.ModelLoader=h.ModelLoader;var c=r(5);t.ViewerModel=c.ViewerModel,t.ModelState=c.ModelState;var f=r(0);t.BABYLON=f,r(14),r(64);var d=r(65);t.InitTags=d.InitTags,f.PromisePolyfill.Apply(),d.initListeners();var p=o.viewerGlobals.disableInit;t.disableInit=p,t.disposeAll=i;var A=o.viewerGlobals.version;t.Version=A,console.log("Babylon.js viewer (v"+A+")"),(function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])})(r(10))}),(function(e,t){var r;r=(function(){return this})();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r}),(function(e,t){if("undefined"==typeof CANNON){var r=new Error('Cannot find module "CANNON"');throw r.code="MODULE_NOT_FOUND",r}e.exports=CANNON}),(function(e,t){if("undefined"==typeof OIMO){var r=new Error('Cannot find module "OIMO"');throw r.code="MODULE_NOT_FOUND",r}e.exports=OIMO}),(function(e,t){if("undefined"==typeof earcut){var r=new Error('Cannot find module "earcut"');throw r.code="MODULE_NOT_FOUND",r}e.exports=earcut}),(function(e,t,r){"use strict";function i(e){return!!e&&"object"==typeof e}function n(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||o(e)}function o(e){return e.$$typeof===d}function s(e){return Array.isArray(e)?[]:{}}function a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?h(s(e),e,t):e}function l(e,t,r){return e.concat(t).map((function(e){return a(e,r)}))}function u(e,t,r){var i={};return r.isMergeableObject(e)&&Object.keys(e).forEach((function(t){i[t]=a(e[t],r)})),Object.keys(t).forEach((function(n){r.isMergeableObject(t[n])&&e[n]?i[n]=h(e[n],t[n],r):i[n]=a(t[n],r)})),i}function h(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):u(e,t,r):a(t,r)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(e){return i(e)&&!n(e)},f="function"==typeof Symbol&&Symbol.for,d=f?Symbol.for("react.element"):60103;h.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,r){return h(e,r,t)}),{})};var p=h;t.default=p}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(10),o=r(5),s=r(1),a=r(24),l=r(26),u=(function(){function e(e,t,r){var n=this;this._engine=e,this._configurationContainer=t,this._observablesManager=r,this._animationBlendingEnabled=!0,this._white=i.Color3.White(),this._forceShadowUpdate=!1,this._processShadows=!0,this._groundEnabled=!0,this._groundMirrorEnabled=!0,this._defaultRenderingPipelineEnabled=!1,this._globalConfiguration={},this._defaultRenderingPipelineShouldBuild=!0,this._bloomEnabled=!1,this._fxaaEnabled=!1,this._focusOnModel=function(e){var t=e.rootMesh.getHierarchyBoundingVectors(!0),r=t.max.subtract(t.min),i=r.scale(.5),o=t.min.add(i);n.camera.setTarget(o),n.camera.alpha=n._globalConfiguration.camera&&n._globalConfiguration.camera.alpha||n.camera.alpha,n.camera.beta=n._globalConfiguration.camera&&n._globalConfiguration.camera.beta||n.camera.beta,n.camera.radius=n._globalConfiguration.camera&&n._globalConfiguration.camera.radius||n.camera.radius},this._cameraBehaviorMapping={},this.models=[],this.onCameraConfiguredObservable=new i.Observable,this.onLightsConfiguredObservable=new i.Observable,this.onModelsConfiguredObservable=new i.Observable,this.onSceneConfiguredObservable=new i.Observable,this.onSceneInitObservable=new i.Observable,this.onSceneOptimizerConfiguredObservable=new i.Observable,this.onEnvironmentConfiguredObservable=new i.Observable,this._handleHardwareLimitations(),this.onSceneInitObservable.add((function(e){n.scene.animationPropertiesOverride=n.scene.animationPropertiesOverride||new i.AnimationPropertiesOverride,n.labs=new a.ViewerLabs(e);var t=function(){for(var e=0,t=n.scene.lights;e<t.length;e++){var r=t[e],o=r.getShadowGenerator();if(o){var s=o.getShadowMap();s&&(s.refreshRate=i.RenderTargetTexture.REFRESHRATE_RENDER_ONCE)}}};return e.registerBeforeRender((function(){n._forceShadowUpdate||e.animatables&&e.animatables.length>0?(t(),n._forceShadowUpdate=!1):n.models.every((function(e){return e.shadowsRenderedAfterLoad?e.state===o.ModelState.COMPLETE&&!e.currentAnimation:(e.shadowsRenderedAfterLoad=!0,!1)}))||t()})),n._observablesManager&&n._observablesManager.onSceneInitObservable.notifyObserversWithPromise(n.scene)})),this._observablesManager&&(this._observablesManager.onModelLoadedObservable.add((function(e){for(var t=0,r=n.scene.lights;t<r.length;t++){var o=r[t],s=o.getShadowGenerator();if(s){var a=s.getShadowMap();a&&(a.refreshRate=i.RenderTargetTexture.REFRESHRATE_RENDER_ONCE)}}n._focusOnModel(e)})),this._observablesManager.onModelAddedObservable.add((function(e){n.models.push(e)})),this._observablesManager.onModelRemovedObservable.add((function(e){n.models.splice(n.models.indexOf(e),1)})))}return Object.defineProperty(e.prototype,"defaultRenderingPipeline",{get:function(){return this._defaultRenderingPipeline},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isHdrSupported",{get:function(){return this._hdrSupport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mainColor",{get:function(){return this._configurationContainer.mainColor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reflectionColor",{get:function(){return this._configurationContainer.reflectionColor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationBlendingEnabled",{get:function(){return this.scene&&this.scene.animationPropertiesOverride.enableBlending},set:function(e){this.scene.animationPropertiesOverride.enableBlending=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"observablesManager",{get:function(){return this._observablesManager},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"processShadows",{get:function(){return this._processShadows},set:function(e){for(var t=e?i.RenderTargetTexture.REFRESHRATE_RENDER_ONEVERYFRAME:i.RenderTargetTexture.REFRESHRATE_RENDER_ONCE,r=0,n=this.scene.lights;r<n.length;r++){var o=n[r],s=o.getShadowGenerator();if(s){var a=s.getShadowMap();a&&(a.refreshRate=t)}}this._processShadows=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundEnabled",{get:function(){return this._groundEnabled},set:function(e){e!==this._groundEnabled&&(this._groundEnabled=e,this.environmentHelper&&this.environmentHelper.ground&&this.environmentHelper.ground.setEnabled(this._groundEnabled))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMirrorEnabled",{get:function(){return this._groundMirrorEnabled},set:function(e){this._groundMirrorEnabled!==e&&(this._groundMirrorEnabled=e,this.environmentHelper&&this.environmentHelper.groundMaterial&&this.environmentHelper.groundMirror&&(this.environmentHelper.groundMaterial.reflectionTexture=e?this.environmentHelper.groundMirror:null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultRenderingPipelineEnabled",{get:function(){return this._defaultRenderingPipelineEnabled},set:function(e){e!==this._defaultRenderingPipelineEnabled&&(this._defaultRenderingPipelineEnabled=e,this._rebuildPostprocesses(),this._defaultRenderingPipeline&&(this._defaultRenderingPipelineShouldBuild=!1,this._defaultRenderingPipeline.prepare(),this.scene.imageProcessingConfiguration.applyByPostProcess=!0))},enumerable:!0,configurable:!0}),e.prototype.unlockBabylonFeatures=function(){this.scene.shadowsEnabled=!0,this.scene.particlesEnabled=!0,this.scene.postProcessesEnabled=!0,this.scene.collisionsEnabled=!0,this.scene.lightsEnabled=!0,this.scene.texturesEnabled=!0,this.scene.lensFlaresEnabled=!0,this.scene.proceduralTexturesEnabled=!0,this.scene.renderTargetsEnabled=!0,this.scene.spritesEnabled=!0,this.scene.skeletonsEnabled=!0,this.scene.audioEnabled=!0},e.prototype.initScene=function(e,t){if(void 0===e&&(e={}),this.scene&&this.scene.dispose(),this.scene=new i.Scene(this._engine),!e.defaultMaterial){var r=new BABYLON.PBRMaterial("defaultMaterial",this.scene);r.reflectivityColor=new BABYLON.Color3(.1,.1,.1),r.microSurface=.6,this.scene.defaultMaterial&&this.scene.defaultMaterial.dispose(),this.scene.defaultMaterial=r}return this.scene.animationPropertiesOverride=new i.AnimationPropertiesOverride,i.Animation.AllowMatricesInterpolation=!0,this.onSceneInitObservable.notifyObserversWithPromise(this.scene)},e.prototype.clearScene=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!1),e&&(this.models.forEach((function(e){return e.dispose()})),this.models.length=0),t&&this.scene.lights.forEach((function(e){return e.dispose()}))},e.prototype.updateConfiguration=function(e){var t=this;if(this._configurationContainer?this._globalConfiguration=this._configurationContainer.configuration:this._globalConfiguration=e,e.lab&&e.lab.assetsRootURL&&(this.labs.assetsRootURL=e.lab.assetsRootURL),e.scene&&this._configureScene(e.scene),void 0!==e.optimizer&&this._configureOptimizer(e.optimizer),this._configureLights(e.lights),void 0===e.skybox&&void 0===e.ground||this._configureEnvironment(e.skybox,e.ground),this._configureCamera(e.camera),e.lab){if(e.lab.environmentMap){var r=e.lab.environmentMap.rotationY;this.labs.loadEnvironment(e.lab.environmentMap.texture,(function(){t.labs.applyEnvironmentMapConfiguration(r)})),!e.lab.environmentMap.texture&&e.lab.environmentMap.rotationY&&this.labs.applyEnvironmentMapConfiguration(e.lab.environmentMap.rotationY)}if(e.lab.defaultRenderingPipelines){var n=e.lab.defaultRenderingPipelines;this.defaultRenderingPipelineEnabled="boolean"!=typeof n||n}if(e.lab.environmentMainColor){var o=(new i.Color3).copyFrom(e.lab.environmentMainColor);this.environmentHelper.setMainColor(o)}void 0!==e.lab.globalLightRotation&&(this.scene.lights.filter((function(e){return e instanceof i.ShadowLight})).forEach((function(r){t.labs.rotateShadowLight(r,e.lab.globalLightRotation)})),this._forceShadowUpdate=!0)}this._defaultRenderingPipeline&&this._defaultRenderingPipeline.imageProcessing&&(this._defaultRenderingPipeline.imageProcessing.fromLinearSpace=!0),this._defaultRenderingPipelineShouldBuild&&this._defaultRenderingPipeline&&(this._defaultRenderingPipelineShouldBuild=!1,this._defaultRenderingPipeline.prepare())},e.prototype._rebuildPostprocesses=function(e){if(!this._defaultRenderingPipelineEnabled||!n.getConfigurationKey("scene.imageProcessingConfiguration.isEnabled",this._globalConfiguration))return void(this._defaultRenderingPipeline&&(this._defaultRenderingPipeline.dispose(),this._defaultRenderingPipeline=null,this.scene.autoClearDepthAndStencil=!0,this.scene.autoClear=!0,this.scene.imageProcessingConfiguration.applyByPostProcess=!1));var t=e||this._globalConfiguration.lab&&this._globalConfiguration.lab.defaultRenderingPipelines;if(t){this._defaultRenderingPipeline||(this._defaultRenderingPipeline=new i.DefaultRenderingPipeline("default rendering pipeline",this._hdrSupport,this.scene,[this.camera],!1)),this.scene.autoClear=!1,this.scene.autoClearDepthAndStencil=!1,this._defaultRenderingPipelineShouldBuild=!0;var r=this._bloomEnabled;"boolean"!=typeof t&&(s.extendClassWithConfig(this._defaultRenderingPipeline,t),this._bloomEnabled=!!t.bloomEnabled,this._fxaaEnabled=!!t.fxaaEnabled,r=this._bloomEnabled&&void 0!==t.bloomWeight&&t.bloomWeight>0,this._defaultRenderingPipeline.bloomWeight=void 0!==t.bloomWeight&&t.bloomWeight||this._defaultRenderingPipeline.bloomWeight),this._defaultRenderingPipeline.bloomEnabled=r,this._defaultRenderingPipeline.fxaaEnabled=this.fxaaEnabled}},Object.defineProperty(e.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._rebuildPostprocesses(),this._defaultRenderingPipeline&&(this._defaultRenderingPipelineShouldBuild=!1,this._defaultRenderingPipeline.prepare(),this.scene.imageProcessingConfiguration.applyByPostProcess=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._rebuildPostprocesses(),this._defaultRenderingPipeline&&(this._defaultRenderingPipelineShouldBuild=!1,this._defaultRenderingPipeline.prepare(),this.scene.imageProcessingConfiguration.applyByPostProcess=!0))},enumerable:!0,configurable:!0}),e.prototype._configureScene=function(e){if(this.scene){var t=e.clearColor,r=this.scene.clearColor;if(t&&(void 0!==t.r&&(r.r=t.r),void 0!==t.g&&(r.g=t.g),void 0!==t.b&&(r.b=t.b),void 0!==t.a&&(r.a=t.a)),e.imageProcessingConfiguration&&s.extendClassWithConfig(this.scene.imageProcessingConfiguration,e.imageProcessingConfiguration),e.animationPropertiesOverride&&s.extendClassWithConfig(this.scene.animationPropertiesOverride,e.animationPropertiesOverride),e.environmentTexture&&(!this.scene.environmentTexture||this.scene.environmentTexture.url!==e.environmentTexture)){this.scene.environmentTexture&&this.scene.environmentTexture.dispose&&this.scene.environmentTexture.dispose();var o=i.CubeTexture.CreateFromPrefilteredData(e.environmentTexture,this.scene);this.scene.environmentTexture=o}!0===e.debug?this.scene.debugLayer.show():!1===e.debug&&this.scene.debugLayer.isVisible()&&this.scene.debugLayer.hide(),e.disableHdr?this._handleHardwareLimitations(!1):this._handleHardwareLimitations(!0),void 0!==e.renderInBackground&&(this._engine.renderEvenInBackground=!!e.renderInBackground);var a=this._engine.getRenderingCanvas();if(a&&(this.camera&&e.disableCameraControl?this.camera.detachControl(a):this.camera&&!1===e.disableCameraControl&&this.camera.attachControl(a)),e.mainColor){this._configurationContainer.mainColor=this.mainColor||i.Color3.White();var l=e.mainColor;void 0!==l.r&&(this.mainColor.r=l.r),void 0!==l.g&&(this.mainColor.g=l.g),void 0!==l.b&&(this.mainColor.b=l.b),this.reflectionColor.copyFrom(this.mainColor);var u=n.getConfigurationKey("lab.environmentMap.tintLevel",this._globalConfiguration)||0;this.reflectionColor.toLinearSpaceToRef(this.reflectionColor),this.reflectionColor.scaleToRef(1/this.scene.imageProcessingConfiguration.exposure,this.reflectionColor);var h=i.Color3.Lerp(this._white,this.reflectionColor,u);this.reflectionColor.copyFrom(h),this.environmentHelper&&(this.environmentHelper.groundMaterial&&(this.environmentHelper.groundMaterial._perceptualColor=this.mainColor),this.environmentHelper.skyboxMaterial&&(this.environmentHelper.skyboxMaterial._perceptualColor=this.mainColor))}if(e.defaultMaterial){var c=e.defaultMaterial;("standard"===c.materialType&&"StandardMaterial"!==this.scene.defaultMaterial.getClassName()||"pbr"===c.materialType&&"PBRMaterial"!==this.scene.defaultMaterial.getClassName())&&(this.scene.defaultMaterial.dispose(),"standard"===c.materialType?this.scene.defaultMaterial=new i.StandardMaterial("defaultMaterial",this.scene):this.scene.defaultMaterial=new i.PBRMaterial("defaultMaterial",this.scene)),s.extendClassWithConfig(this.scene.defaultMaterial,c)}e.flags&&s.extendClassWithConfig(this.scene,e.flags),this.onSceneConfiguredObservable.notifyObservers({sceneManager:this,object:this.scene,newConfiguration:e})}},e.prototype._configureOptimizer=function(e){var t=this;if("boolean"==typeof e)this.sceneOptimizer&&(this.sceneOptimizer.stop(),this.sceneOptimizer.dispose(),delete this.sceneOptimizer),e&&(this.sceneOptimizer=new i.SceneOptimizer(this.scene),this.sceneOptimizer.start());else{var r=new i.SceneOptimizerOptions(e.targetFrameRate,e.trackerDuration);if(e.degradation)switch(e.degradation){case"low":r=i.SceneOptimizerOptions.LowDegradationAllowed(e.targetFrameRate);break;case"moderate":r=i.SceneOptimizerOptions.ModerateDegradationAllowed(e.targetFrameRate);break;case"hight":r=i.SceneOptimizerOptions.HighDegradationAllowed(e.targetFrameRate)}if(this.sceneOptimizer&&(this.sceneOptimizer.stop(),this.sceneOptimizer.dispose()),e.custom){var n=l.getCustomOptimizerByName(e.custom,e.improvementMode);n&&r.addCustomOptimization((function(){return n(t)}),(function(){return"Babylon Viewer "+e.custom+" custom optimization"}))}this.sceneOptimizer=new i.SceneOptimizer(this.scene,r,e.autoGeneratePriorities,e.improvementMode),this.sceneOptimizer.start()}this.onSceneOptimizerConfiguredObservable.notifyObservers({sceneManager:this,object:this.sceneOptimizer,newConfiguration:e})},e.prototype._configureCamera=function(e){var t=this;if(void 0===e&&(e={}),!this.scene.activeCamera){var r=!0;this._globalConfiguration.scene&&this._globalConfiguration.scene.disableCameraControl&&(r=!1),this.scene.createDefaultCamera(!0,!0,r),this.camera=this.scene.activeCamera,this.camera.setTarget(i.Vector3.Zero())}if(e.position){var o=this.camera.position.clone();s.extendClassWithConfig(o,e.position),this.camera.setPosition(o)}if(e.target){var a=this.camera.target.clone();s.extendClassWithConfig(a,e.target),this.camera.setTarget(a)}if(e.rotation&&(this.camera.rotationQuaternion=new i.Quaternion(e.rotation.x||0,e.rotation.y||0,e.rotation.z||0,e.rotation.w||0)),e.behaviors)for(var l in e.behaviors)void 0!==e.behaviors[l]&&this._setCameraBehavior(l,e.behaviors[l]);var u=this.scene.getWorldExtends((function(e){return!t.environmentHelper||e!==t.environmentHelper.ground&&e!==t.environmentHelper.rootMesh&&e!==t.environmentHelper.skybox})),h=u.max.subtract(u.min),c=h.length();isFinite(c)?this.camera.upperRadiusLimit=4*c:this.camera.upperRadiusLimit=10,this.scene.imageProcessingConfiguration&&(this.scene.imageProcessingConfiguration.colorCurvesEnabled=!0,this.scene.imageProcessingConfiguration.vignetteEnabled=!0,this.scene.imageProcessingConfiguration.toneMappingEnabled=!!n.getConfigurationKey("camera.toneMappingEnabled",this._globalConfiguration)),s.extendClassWithConfig(this.camera,e),this.onCameraConfiguredObservable.notifyObservers({sceneManager:this,object:this.camera,newConfiguration:e})},e.prototype._configureEnvironment=function(e,t){var r=this;if(e||t){var n={createGround:!!t&&this._groundEnabled,createSkybox:!!e,setupImageProcessing:!1};if(t){var o="boolean"==typeof t?{}:t,a=o.size||"object"==typeof e&&e.scale;a&&(n.groundSize=a),n.enableGroundShadow=!0===o||o.receiveShadows,void 0!==o.shadowLevel&&(n.groundShadowLevel=o.shadowLevel),n.enableGroundMirror=!!o.mirror&&this.groundMirrorEnabled,o.texture&&(n.groundTexture=this.labs.getAssetUrl(o.texture)),o.color&&(n.groundColor=new i.Color3(o.color.r,o.color.g,o.color.b)),void 0!==o.opacity&&(n.groundOpacity=o.opacity),o.mirror&&(n.enableGroundMirror=!0,"object"==typeof o.mirror&&(void 0!==o.mirror.amount&&(n.groundMirrorAmount=o.mirror.amount),void 0!==o.mirror.sizeRatio&&(n.groundMirrorSizeRatio=o.mirror.sizeRatio),void 0!==o.mirror.blurKernel&&(n.groundMirrorBlurKernel=o.mirror.blurKernel),void 0!==o.mirror.fresnelWeight&&(n.groundMirrorFresnelWeight=o.mirror.fresnelWeight),void 0!==o.mirror.fallOffDistance&&(n.groundMirrorFallOffDistance=o.mirror.fallOffDistance),void 0!==this._defaultPipelineTextureType&&(n.groundMirrorTextureType=this._defaultPipelineTextureType)))}var l=!1;if(e){var u=!0===e?{}:e;u.material&&u.material.imageProcessingConfiguration&&(n.setupImageProcessing=!1);var h=u.scale;h&&(n.skyboxSize=h),n.sizeAuto=!n.skyboxSize,u.color&&(n.skyboxColor=new i.Color3(u.color.r,u.color.g,u.color.b)),u.cubeTexture&&u.cubeTexture.url&&("string"==typeof u.cubeTexture.url?n.skyboxTexture=this.labs.getAssetUrl(u.cubeTexture.url):l=!0),u.material&&(l=!0)}if(n.setupImageProcessing=!1,this.environmentHelper){this.environmentHelper.rootMesh.getScene()!==this.scene?(this.environmentHelper.dispose(),this.environmentHelper=this.scene.createDefaultEnvironment(n)):this.environmentHelper.updateOptions(n)}else this.environmentHelper=this.scene.createDefaultEnvironment(n);this.environmentHelper.rootMesh&&this._globalConfiguration.scene&&void 0!==this._globalConfiguration.scene.environmentRotationY&&(this.environmentHelper.rootMesh.rotation.y=this._globalConfiguration.scene.environmentRotationY);var c="boolean"==typeof t?{}:t;if(this.environmentHelper.groundMaterial&&c&&(this.environmentHelper.groundMaterial._perceptualColor=this.mainColor,c.material&&s.extendClassWithConfig(this.environmentHelper.groundMaterial,c.material),this.environmentHelper.groundMirror)){var f=this.environmentHelper.groundMaterial._perceptualColor.toLinearSpace(),d=Math.pow(2,-this.scene.imageProcessingConfiguration.exposure)*Math.PI;f.scaleToRef(1/d,f),this.environmentHelper.groundMirror.clearColor.r=i.Scalar.Clamp(f.r),this.environmentHelper.groundMirror.clearColor.g=i.Scalar.Clamp(f.g),this.environmentHelper.groundMirror.clearColor.b=i.Scalar.Clamp(f.b),this.environmentHelper.groundMirror.clearColor.a=1,this.groundMirrorEnabled||(this.environmentHelper.groundMaterial.reflectionTexture=null)}var p=this.environmentHelper.skyboxMaterial;p&&(p._perceptualColor=this.mainColor,l&&"object"==typeof e&&e.material&&s.extendClassWithConfig(p,e.material))}else this.environmentHelper&&(this.environmentHelper.dispose(),delete this.environmentHelper);this._observablesManager&&this._observablesManager.onModelLoadedObservable.add((function(e){r._updateGroundMirrorRenderList(e)})),this.onEnvironmentConfiguredObservable.notifyObservers({sceneManager:this,object:this.environmentHelper,newConfiguration:{skybox:e,ground:t}})},e.prototype._configureLights=function(e){var t=this;void 0===e&&(e={});var r=Object.keys(e).filter((function(e){return"globalRotation"!==e}));if(r.length){var n=this.scene.lights.map((function(e){return e.name})),o=Object.keys(this._globalConfiguration.lights||[]);Object.keys(o).length!==n.length&&n.forEach((function(e){-1===o.indexOf(e)&&t.scene.getLightByName(e).dispose()})),r.forEach((function(r,o){var a={type:0};"object"==typeof e[r]&&(a=e[r]),"number"==typeof e[r]&&(a.type=e[r]),a.name=r;var l;if(-1===n.indexOf(r)){var u=i.Light.GetConstructorFromName(a.type,a.name,t.scene);if(!u)return;l=u()}else if(l=t.scene.getLightByName(r),"boolean"==typeof e[r]&&(a.type=l.getTypeID()),n=n.filter((function(e){return e!==r})),void 0!==a.type&&l.getTypeID()!==a.type){l.dispose();var u=i.Light.GetConstructorFromName(a.type,a.name,t.scene);if(!u)return;l=u()}if(!1===e[r])return void l.dispose();var h=void 0!==a.enabled?a.enabled:!a.disabled;if(l.setEnabled(h),s.extendClassWithConfig(l,a),l instanceof i.ShadowLight){if(l.shadowMinZ=l.shadowMinZ||.2,l.shadowMaxZ=Math.min(10,l.shadowMaxZ||10),a.target){if(l.setDirectionToTarget){var c=i.Vector3.Zero().copyFrom(a.target);l.setDirectionToTarget(c)}}else if(a.direction){var f=i.Vector3.Zero().copyFrom(a.direction);l.direction=f}var d=!1;if(l.getTypeID()===BABYLON.Light.LIGHTTYPEID_DIRECTIONALLIGHT)l.shadowFrustumSize=a.shadowFrustumSize||2,d=!0;else if(l.getTypeID()===BABYLON.Light.LIGHTTYPEID_SPOTLIGHT){var p=l;void 0!==a.spotAngle&&(p.angle=a.spotAngle*Math.PI/180),p.angle&&a.shadowFieldOfView&&(p.shadowAngleScale=a.shadowFieldOfView/p.angle),d=!0}else l.getTypeID()===BABYLON.Light.LIGHTTYPEID_POINTLIGHT&&(a.shadowFieldOfView&&(l.shadowAngle=a.shadowFieldOfView*Math.PI/180),d=!0);var A=l.getShadowGenerator();if(d&&a.shadowEnabled&&t._maxShadows){var m=a.shadowBufferSize||256;A||(A=new i.ShadowGenerator(m,l));var g=t.getBlurKernel(l,m);A.bias=t._shadowGeneratorBias,A.blurKernel=g,s.extendClassWithConfig(A,a.shadowConfig||{}),t._observablesManager&&t._observablesManager.onModelLoadedObservable.add((function(e){t._updateShadowRenderList(A,e)})),t._updateShadowRenderList(A)}else A&&A.dispose()}}));var a=this._globalConfiguration.lights||{};Object.keys(a).sort().forEach((function(e,r){var i=t.scene.getLightByName(e);i&&(i.renderPriority=-r)}))}else this.scene.lights.length||this.scene.createDefaultLight(!0);this.onLightsConfiguredObservable.notifyObservers({sceneManager:this,object:this.scene.lights,newConfiguration:e})},e.prototype._updateShadowRenderList=function(e,t,r){var n=t?t.meshes:this.scene.meshes,o=e.getShadowMap();if(o){r&&o.renderList?o.renderList.length=0:o.renderList=o.renderList||[];for(var s=0;s<n.length;s++){var a=n[s];i.Tags.MatchesQuery(a,"castShadow")&&-1===o.renderList.indexOf(a)&&o.renderList.push(a)}if(this._shadowGroundPlane)e.useBlurCloseExponentialShadowMap||(this._shadowGroundPlane.dispose(),this._shadowGroundPlane=null);else if(e.useBlurCloseExponentialShadowMap){var l=i.Mesh.CreatePlane("shadowGroundPlane",100,this.scene,!1);l.useVertexColors=!1,l.material=new i.StandardMaterial("shadowGroundPlaneMaterial",this.scene),l.material.backFaceCulling=!1,l.rotation.x=.5*Math.PI,l.freezeWorldMatrix(),this._shadowGroundPlane=l,this.scene.removeMesh(l)}this._shadowGroundPlane&&-1===o.renderList.indexOf(this._shadowGroundPlane)&&o.renderList.push(this._shadowGroundPlane)}},e.prototype._updateGroundMirrorRenderList=function(e,t){if(this.environmentHelper.groundMirror&&this.environmentHelper.groundMirror.renderList){var r=e?e.meshes:this.scene.meshes,i=this.environmentHelper.groundMirror.renderList;t&&(i.length=0);for(var n=0;n<r.length;n++){var o=r[n];-1===i.indexOf(o)&&i.push(o)}}},e.prototype.getBlurKernel=function(e,t){var r=.05;e.getTypeID()===BABYLON.Light.LIGHTTYPEID_DIRECTIONALLIGHT?r/=e.shadowFrustumSize:e.getTypeID()===BABYLON.Light.LIGHTTYPEID_POINTLIGHT?r/=e.shadowAngle:e.getTypeID()===BABYLON.Light.LIGHTTYPEID_SPOTLIGHT&&(r/=e.angle*e.shadowAngleScale);var i=5/(t/256);return Math.max(t*r,i)},e.prototype._handleHardwareLimitations=function(e){void 0===e&&(e=!0);var t=this._engine.getCaps().maxVaryingVectors,r=this._engine.getCaps().maxTexturesImageUnits;this._maxShadows=t<8||r<8?0:3;var n=this._engine.getCaps(),o=n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering,s=n.textureFloatRender&&n.textureFloatLinearFiltering;this._hdrSupport=e&&!(!s&&!o),o?(this._defaultHighpTextureType=i.Engine.TEXTURETYPE_HALF_FLOAT,this._shadowGeneratorBias=.002):s?(this._defaultHighpTextureType=i.Engine.TEXTURETYPE_FLOAT,this._shadowGeneratorBias=.001):(this._defaultHighpTextureType=i.Engine.TEXTURETYPE_UNSIGNED_INT,this._shadowGeneratorBias=.001),this._defaultPipelineTextureType=this._hdrSupport?this._defaultHighpTextureType:i.Engine.TEXTURETYPE_UNSIGNED_INT},e.prototype.dispose=function(){this.onEnvironmentConfiguredObservable.clear(),this.onLightsConfiguredObservable.clear(),this.onModelsConfiguredObservable.clear(),this.onSceneConfiguredObservable.clear(),this.onSceneInitObservable.clear(),this.onSceneOptimizerConfiguredObservable.clear(),this.sceneOptimizer&&(this.sceneOptimizer.stop(),this.sceneOptimizer.dispose()),this.environmentHelper&&this.environmentHelper.dispose(),this.models.forEach((function(e){e.dispose()})),this._defaultRenderingPipeline&&this._defaultRenderingPipeline.dispose(),this.models.length=0,this.scene&&this.scene.dispose()},e.prototype._setCameraBehavior=function(e,t,r){var i,n;if(void 0!==(n="object"==typeof t?t.type:"number"==typeof t?t:this._cameraBehaviorMapping[e])){var o="object"==typeof t?t:{},a=!0;switch("boolean"==typeof t&&(a=t),n){case 0:this.camera.useAutoRotationBehavior=a,i=this.camera.autoRotationBehavior;break;case 1:this.camera.useBouncingBehavior=a,i=this.camera.bouncingBehavior;break;case 2:this.camera.useFramingBehavior=a,i=this.camera.framingBehavior;break;default:i=null}switch(i&&(this._cameraBehaviorMapping[e]=n,"object"==typeof t&&s.extendClassWithConfig(i,t)),n){case 0:case 1:break;case 2:this._observablesManager&&this._observablesManager.onModelLoadedObservable.add((function(e){o.zoomOnBoundingInfo&&i.zoomOnMeshHierarchy(e.rootMesh)}))}}},e})();t.SceneManager=u}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(function(){function e(e){var t=this;this._animationGroup=e,this._state=0,this._playMode=1,this._animationGroup.onAnimationEndObservable.add((function(){t.stop(),t._state=4}))}return Object.defineProperty(e.prototype,"name",{get:function(){return this._animationGroup.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._animationGroup.speedRatio},set:function(e){this._animationGroup.speedRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frames",{get:function(){return this._animationGroup.to-this._animationGroup.from},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._animationGroup.targetedAnimations[0]&&this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0]?this._animationGroup.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame-this._animationGroup.from:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fps",{get:function(){for(var e=0;e<this._animationGroup.animatables.length;++e){var t=this._animationGroup.animatables[e],r=t.getAnimations();if(r&&r.length)for(var i=0;i<r.length;++i)if(r[i].animation&&r[i].animation.framePerSecond)return r[i].animation.framePerSecond}return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"playMode",{get:function(){return this._playMode},set:function(e){e!==this._playMode&&(this._playMode=e,1===this.state?this._animationGroup.play(1===this._playMode):(this._animationGroup.reset(),this._state=0))},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._animationGroup.reset()},e.prototype.restart=function(){2===this.state?this._animationGroup.restart():this.start()},e.prototype.goToFrame=function(e){this._animationGroup.goToFrame(e+this._animationGroup.from)},e.prototype.start=function(){this._animationGroup.start(1===this.playMode,this.speedRatio),this._animationGroup.isStarted&&(this._state=1)},e.prototype.pause=function(){this._animationGroup.pause(),this._state=2},e.prototype.stop=function(){this._animationGroup.stop(),this._animationGroup.isStarted||(this._state=3)},e.prototype.dispose=function(){this._animationGroup.dispose()},e})();t.GroupModelAnimation=i}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(25),n=r(0),o=r(12),s=(function(){function e(e){this._scene=e,this.environment={irradiancePolynomialCoefficients:{x:new n.Vector3(0,0,0),y:new n.Vector3(0,0,0),z:new n.Vector3(0,0,0),xx:new n.Vector3(0,0,0),yy:new n.Vector3(0,0,0),zz:new n.Vector3(0,0,0),yz:new n.Vector3(0,0,0),zx:new n.Vector3(0,0,0),xy:new n.Vector3(0,0,0)},textureIntensityScale:1}}return e.prototype.loadEnvironment=function(e,t,r,n){var o=this;if(e instanceof ArrayBuffer)this.environment=i.EnvironmentDeserializer.Parse(e),t&&t(this.environment);else if("string"==typeof e){var s=this.getAssetUrl(e);this._scene._loadFile(s,(function(e){o.environment=i.EnvironmentDeserializer.Parse(e),t&&t(o.environment)}),(function(e){r&&r(e.loaded,e.total)}),!1,!0,(function(e,t){n&&n(t)}))}else this.environment=e,t&&t(e)},e.prototype.applyEnvironmentMapConfiguration=function(e){if(this.environment){var t=n.Quaternion.RotationAxis(n.Axis.Y,e||0);if(this.environment.specularTexture&&(this._scene.environmentTexture||(this._scene.environmentTexture=o.TextureUtils.GetBabylonCubeTexture(this._scene,this.environment.specularTexture,!1,!0)),this._scene.environmentTexture)){this._scene.environmentTexture.level=this.environment.textureIntensityScale,this._scene.environmentTexture.invertZ=!0,this._scene.environmentTexture.lodLevelInAlpha=!0;var r=this._scene.environmentTexture.sphericalPolynomial||new n.SphericalPolynomial;r.x=this.environment.irradiancePolynomialCoefficients.x,r.y=this.environment.irradiancePolynomialCoefficients.y,r.z=this.environment.irradiancePolynomialCoefficients.z,
- r.xx=this.environment.irradiancePolynomialCoefficients.xx,r.xy=this.environment.irradiancePolynomialCoefficients.xy,r.yy=this.environment.irradiancePolynomialCoefficients.yy,r.yz=this.environment.irradiancePolynomialCoefficients.yz,r.zx=this.environment.irradiancePolynomialCoefficients.zx,r.zz=this.environment.irradiancePolynomialCoefficients.zz,this._scene.environmentTexture.sphericalPolynomial=r,n.Matrix.FromQuaternionToRef(t,this._scene.environmentTexture.getReflectionTextureMatrix())}}},e.prototype.getAssetUrl=function(e){var t=e;if(e&&-1===e.toLowerCase().indexOf("//")){if(!this.assetsRootURL)return e;t=this.assetsRootURL+t}return t},e.prototype.rotateShadowLight=function(e,t,r,i,o){void 0===r&&(r=n.Vector3.Zero()),void 0===i&&(i=n.Axis.Y),void 0===o&&(o=n.Vector3.Zero()),i.normalize(),r.subtractToRef(e.position,n.Tmp.Vector3[0]),n.Matrix.TranslationToRef(n.Tmp.Vector3[0].x,n.Tmp.Vector3[0].y,n.Tmp.Vector3[0].z,n.Tmp.Matrix[0]),n.Tmp.Matrix[0].invertToRef(n.Tmp.Matrix[2]),n.Matrix.RotationAxisToRef(i,t,n.Tmp.Matrix[1]),n.Tmp.Matrix[2].multiplyToRef(n.Tmp.Matrix[1],n.Tmp.Matrix[2]),n.Tmp.Matrix[2].multiplyToRef(n.Tmp.Matrix[0],n.Tmp.Matrix[2]),n.Tmp.Matrix[2].decompose(n.Tmp.Vector3[0],n.Tmp.Quaternion[0],n.Tmp.Vector3[1]),e.position.addInPlace(n.Tmp.Vector3[1]),e.setDirectionToTarget(o)},e})();t.ViewerLabs=s}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(12),o=(function(){function e(){}return e.Parse=function(t){for(var r={irradiancePolynomialCoefficients:{x:new i.Vector3(0,0,0),y:new i.Vector3(0,0,0),z:new i.Vector3(0,0,0),xx:new i.Vector3(0,0,0),yy:new i.Vector3(0,0,0),zz:new i.Vector3(0,0,0),yz:new i.Vector3(0,0,0),zx:new i.Vector3(0,0,0),xy:new i.Vector3(0,0,0)},textureIntensityScale:1},o=[134,22,135,150,246,214,150,54],s=new DataView(t),a=0,l=0;l<o.length;l++)s.getUint8(a++)!==o[l]&&i.Tools.Error("Not a Spectre environment map");var u=s.getUint16(a,!1);a+=2,1!==u&&i.Tools.Warn('Unsupported Spectre environment map version "'+u+'"');for(var h="",c=0;c=s.getUint8(a++);)h+=String.fromCharCode(c);var f=JSON.parse(h),d=a;switch(f.irradiance.type){case"irradiance_sh_coefficients_9":var p=f.irradiance;e._ConvertSHIrradianceToLambertianRadiance(p),e._ConvertSHToSP(p,r.irradiancePolynomialCoefficients);break;default:i.Tools.Error("Unhandled MapType descriptor.irradiance.type ("+f.irradiance.type+")")}switch(f.specular.type){case"cubemap_faces":var A=f.specular,m=r.specularTexture=new n.TextureCube(6408,5121);r.textureIntensityScale=null!=A.multiplier?A.multiplier:1;for(var g=A.mipmaps,_=A.imageType,v=0;v<g.length;v++){var y=g[v];m.source[v]=[];for(var l=0;l<6;l++){var b=y[l],E=new Uint8Array(t,d+b.pos,b.length);switch(_){case"png":var T=new Image,x=URL.createObjectURL(new Blob([E],{type:"image/png"}));T.src=x,m.source[v][l]=T;break;default:i.Tools.Error("Unhandled ImageType descriptor.specular.imageType ("+_+")")}}}break;default:i.Tools.Error("Unhandled MapType descriptor.specular.type ("+f.specular.type+")")}return r},e._ConvertSHIrradianceToLambertianRadiance=function(t){e._ScaleSH(t,1/Math.PI)},e._ConvertSHToSP=function(e,t){var r=1/Math.PI;t.x.x=1.02333*e.l11[0]*r,t.x.y=1.02333*e.l11[1]*r,t.x.z=1.02333*e.l11[2]*r,t.y.x=1.02333*e.l1_1[0]*r,t.y.y=1.02333*e.l1_1[1]*r,t.y.z=1.02333*e.l1_1[2]*r,t.z.x=1.02333*e.l10[0]*r,t.z.y=1.02333*e.l10[1]*r,t.z.z=1.02333*e.l10[2]*r,t.xx.x=(.886277*e.l00[0]-.247708*e.l20[0]+.429043*e.l22[0])*r,t.xx.y=(.886277*e.l00[1]-.247708*e.l20[1]+.429043*e.l22[1])*r,t.xx.z=(.886277*e.l00[2]-.247708*e.l20[2]+.429043*e.l22[2])*r,t.yy.x=(.886277*e.l00[0]-.247708*e.l20[0]-.429043*e.l22[0])*r,t.yy.y=(.886277*e.l00[1]-.247708*e.l20[1]-.429043*e.l22[1])*r,t.yy.z=(.886277*e.l00[2]-.247708*e.l20[2]-.429043*e.l22[2])*r,t.zz.x=(.886277*e.l00[0]+.495417*e.l20[0])*r,t.zz.y=(.886277*e.l00[1]+.495417*e.l20[1])*r,t.zz.z=(.886277*e.l00[2]+.495417*e.l20[2])*r,t.yz.x=.858086*e.l2_1[0]*r,t.yz.y=.858086*e.l2_1[1]*r,t.yz.z=.858086*e.l2_1[2]*r,t.zx.x=.858086*e.l21[0]*r,t.zx.y=.858086*e.l21[1]*r,t.zx.z=.858086*e.l21[2]*r,t.xy.x=.858086*e.l2_2[0]*r,t.xy.y=.858086*e.l2_2[1]*r,t.xy.z=.858086*e.l2_2[2]*r},e._ScaleSH=function(e,t){e.l00[0]*=t,e.l00[1]*=t,e.l00[2]*=t,e.l1_1[0]*=t,e.l1_1[1]*=t,e.l1_1[2]*=t,e.l10[0]*=t,e.l10[1]*=t,e.l10[2]*=t,e.l11[0]*=t,e.l11[1]*=t,e.l11[2]*=t,e.l2_2[0]*=t,e.l2_2[1]*=t,e.l2_2[2]*=t,e.l2_1[0]*=t,e.l2_1[1]*=t,e.l2_1[2]*=t,e.l20[0]*=t,e.l20[1]*=t,e.l20[2]*=t,e.l21[0]*=t,e.l21[1]*=t,e.l21[2]*=t,e.l22[0]*=t,e.l22[1]*=t,e.l22[2]*=t},e})();t.EnvironmentDeserializer=o}),(function(e,t,r){"use strict";function i(e,t){if(!o[e])switch(e){case"extended":return t?n.extendedUpgrade:n.extendedDegrade}return o[e]}Object.defineProperty(t,"__esModule",{value:!0});var n=r(27),o={};t.getCustomOptimizerByName=i}),(function(e,t,r){"use strict";function i(e){var t=e.defaultRenderingPipeline;if(e.scene.getEngine().getHardwareScalingLevel()>1){var r=o.Scalar.Clamp(e.scene.getEngine().getHardwareScalingLevel()-.25,0,1);return e.scene.getEngine().setHardwareScalingLevel(r),!1}if(!e.scene.postProcessesEnabled)return e.scene.postProcessesEnabled=!0,!1;if(!e.groundEnabled)return e.groundEnabled=!0,!1;if(t&&!e.fxaaEnabled)return e.fxaaEnabled=!0,!1;var i=Math.max(.5,1/(window.devicePixelRatio||2));if(e.scene.getEngine().getHardwareScalingLevel()>i){var r=o.Scalar.Clamp(e.scene.getEngine().getHardwareScalingLevel()-.25,0,i);return e.scene.getEngine().setHardwareScalingLevel(r),!1}return e.processShadows?t&&!e.bloomEnabled?(e.bloomEnabled=!0,!1):!!e.groundMirrorEnabled||(e.groundMirrorEnabled=!0,!1):(e.processShadows=!0,!1)}function n(e){var t=e.defaultRenderingPipeline;if(e.groundMirrorEnabled)return e.groundMirrorEnabled=!1,!1;if(t&&e.bloomEnabled)return e.bloomEnabled=!1,!1;if(e.processShadows)return e.processShadows=!1,!1;if(e.scene.getEngine().getHardwareScalingLevel()<1){var r=o.Scalar.Clamp(e.scene.getEngine().getHardwareScalingLevel()+.25,0,1);return e.scene.getEngine().setHardwareScalingLevel(r),!1}if(t&&e.fxaaEnabled)return e.fxaaEnabled=!1,!1;if(e.groundEnabled)return e.groundEnabled=!1,!1;if(e.scene.postProcessesEnabled)return e.scene.postProcessesEnabled=!1,!1;if(e.scene.getEngine().getHardwareScalingLevel()<1.25){var r=o.Scalar.Clamp(e.scene.getEngine().getHardwareScalingLevel()+.25,0,1.25);return e.scene.getEngine().setHardwareScalingLevel(r),!1}return!0}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0);t.extendedUpgrade=i,t.extendedDegrade=n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),n=r(29),o=r(53),s=r(1),a=r(0),l=(function(){function e(e){void 0===e&&(e=!1),this._enableCache=e,this._configurationCache={},this._loadRequests=[]}return e.prototype.loadConfiguration=function(e,t){var r=this;void 0===e&&(e={});var a=s.deepmerge({},e),l=n.getConfigurationType(a.extends||"");if(a.configuration){var u="json";return Promise.resolve().then((function(){if("string"==typeof a.configuration||a.configuration&&a.configuration.url){var e="";if("string"==typeof a.configuration&&(e=a.configuration),"object"==typeof a.configuration&&a.configuration.url){e=a.configuration.url;var t=a.configuration.mapper;t||(t=a.configuration.url.split(".").pop()),u=t||u}return r._loadFile(e)}return"object"==typeof a.configuration?(u=a.configuration.mapper||u,a.configuration.payload||{}):{}})).then((function(e){var r=i.mapperManager.getMapper(u),n=s.deepmerge(r.map(e),a),h=s.deepmerge(l,n);return o.processConfigurationCompatibility(h),t&&t(h),h}))}return a=s.deepmerge(l,a),o.processConfigurationCompatibility(a),t&&t(a),Promise.resolve(a)},e.prototype.dispose=function(){this._loadRequests.forEach((function(e){e.abort()})),this._loadRequests.length=0},e.prototype._loadFile=function(e){var t=this,r=this._configurationCache;return this._enableCache&&r[e]?Promise.resolve(r[e]):new Promise(function(i,n){var o=a.Tools.LoadFile(e,(function(n){var s=t._loadRequests.indexOf(o);-1!==s&&t._loadRequests.splice(s,1),t._enableCache&&(r[e]=n),i(n)}),void 0,void 0,!1,(function(e,r){var i=t._loadRequests.indexOf(o);-1!==i&&t._loadRequests.splice(i,1),n(r)}));t._loadRequests.push(o)})},e})();t.ConfigurationLoader=l}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(30);t.minimalConfiguration=i.minimalConfiguration;var n=r(49);t.defaultConfiguration=n.defaultConfiguration;var o=r(50),s=r(51),a=r(52),l=r(1),u=function(e){var t={};return e.split(",").forEach((function(e){switch(e.trim()){case"environmentMap":t=l.deepmerge(t,a.environmentMapConfiguration);break;case"shadowDirectionalLight":t=l.deepmerge(t,s.shadowDirectionalLightConfiguration);break;case"shadowSpotLight":t=l.deepmerge(t,s.shadowSpotlLightConfiguration);break;case"extended":t=l.deepmerge(t,o.extendedConfiguration);break;case"minimal":t=l.deepmerge(t,i.minimalConfiguration);break;case"none":break;case"default":default:t=l.deepmerge(t,n.defaultConfiguration)}t.extends&&(t=l.deepmerge(t,u(t.extends)))})),t};t.getConfigurationType=u}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),n=r(2);t.minimalConfiguration={version:"0.1",templates:{main:{html:i.defaultTemplate},fillContainer:{html:i.fillContainer,params:{disable:!1}},loadingScreen:{html:i.loadingScreen,params:{backgroundColor:"#000000",loadingImage:n.loading}},viewer:{html:i.defaultViewer},overlay:{html:i.overlay,params:{closeImage:n.close,closeText:"Close"}},error:{html:i.error}},engine:{antialiasing:!0}}}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.babylonFont=r(32)}),(function(e,t){e.exports="data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAABIgAA8AAAAAH7gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABWAAAAEcAAABgSlp9rlZETVgAAAGgAAACBQAABeCBXolxY21hcAAAA6gAAABxAAAAsqyRvzljdnQgAAAEHAAAACAAAAAqCdkJr2ZwZ20AAAQ8AAAA8AAAAVn8nuaOZ2FzcAAABSwAAAAM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6FfWqIUk7YxxkBu5a28SzSH8WxF1RZzFnR3doNaI4uk4UlBFadXG1Fpa6YJ6QjGc5DP5VVys6p2CTwHlA9WrntfU7mPl5PANFszilOiWwLq7Z1GeK2glkU9PcpQtrjzYFoUugfxl2nNCRr8si9jaG/1vbOXtKTBnIDM2xo84ls1ldlEHn/cm4rvdmADNpc3Hkr3sLkL/NNQXJlDLX9FY+a/bEsamS1Bft1zarFtf0ZtVkidF23ex4ULOgN/npM9p+1UrfmTl794YoX2WcH4x3RJVuezv/Igua4O78F5z6X2t57JtMX+Vj9+A9ejXajN6P3o3ehnXnGFMJ9ndB7yHVrWyjDH4Ivg0ZdXMXNA3Ei9mIfwCJoYWxAHjaY2BmAIP/fgzlDFgAACkqAcgAeNrbwKDNsImRk0mbcRMXiNzO1ZobaqvKwKG9nTs12EFPBsTiifCw0JAEsXidzbXlhUEsPh0VGREeEItfTkKYjwPEEuDj4WRnAbEEwQDEEtowoSDAAMhi2M4IN5oJbjQz3GgWuNGscKPZ5CShRrPDjeaAG80JN3qTMCO79gYGBdfaTAkXAMQBKBoAAAA="}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.babylonLogo=r(34),t.close=r(35),t.fullscreen=r(36),t.helpCircle=r(37),t.loading=r(38)}),(function(e,t){
- e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB7MAAAgHCAYAAABZmyd0AAAACXBIWXMAAC4jAAAuIwF4pT92AAAgAElEQVR42uzd7XEb6Zm24Wtc+5/IgO0IyDcCtiMQNwLBEYgTgaAIhhOBpQhMRSAwghEjWCoCixHw/fE0DIKiKAIE+vM4qlDi1I531/fYRDdOPHf/dn9/HwAAAAAmb5bkNMnSKAAAgD74HyMAAAAAmJwqJVyfJqmbP4+a/9m3JIskH40JAADo0m9OZgMAAACM2ukTr6MX/OtEbQAAoFNiNgAAAMB41FkH6yrJ2R7+d4raAABAJ8RsAAAAgOFZPd+6znpl+MmB/2+K2gAAQKvEbAAAAIB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t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAAAt0lEQVR42u2WAQbDQBBFQ9IbRtDcrrqK3LBbXrEH6OuHEPMBjPd2xHyZKtdNpcLMg11Pr7y4/YdvwIdd4jtw4BU0Rjrbz9mNzkjzgpU3wNhCvH5M3i1fKzzeK3K8V+R4r8jxTpHjlULhc0WOd8fU6e4I8y3y13tFjHel4GswwAvFSR/ZN6Zv2gjvmzbGhwqPzxUenys83is8Pld4vFac/9sy8/SVNrbgYJl8WGhsvkpoA1+pVK6ZLyLNXm2txsT5AAAAAElFTkSuQmCC"}),(function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQAAAAB/ecQqAAAAAnRSTlMAAHaTzTgAAAAeSURBVHgBY6ASsP/A/wcXZQNGhCkyAfE24HUndQAAXlkXcQ24P7gAAAAASUVORK5CYII="}),(function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAAB/ElEQVR42u3Xs4JdQRzH8X9sqYrNNnbqtPELxKgWD7AsI71B7BcI21W9rNa+d27zjSac/5kzZ2J8yqPfGUn++xMwis2UcpsGuilQoJt6blHCJkbKt2I+FbSRpJVy5kos5nAVQxrDJWbFfP4wXYTqYL9kwRiuk9VFRksYJvKEGA+ZEPb3+udrOcNaJjGJtZyhTo8IKIVaOXmOMfKrrnsCo1WU+HFE/fxu9dk9asR+f8fswnU08fmTuDo8nZarat2P/DjobtFPP3dY8bGi6jNUE/MxuM58vNsFVvfHiHNqleqjmwo0a+zdW3zutr26Dk2ZPqW1oZli7/fzuT57dQqaFmUaZDNZ9HoDYIMbUEoWt+xb69EVuwG3CdfNcvtWNbqbbkB9ePVgK4DFDKGrcwO6CNPHJvvGdGpI0uEGGELk2WGfn8or33OxAUc/TulP8cnHVVENI5Vhp+mIa+TT9tm9pKkN7ab6tHEDRVo3LUGjTxuNpClyAzaRSiwG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FvDsAZUa1yYwfcLAh4P3kwI+S6RMybBcrHjKg8XQshTiOZESR+bS+prONUK1niITtvezTcAGYEid2zasSpGUY1ekSztpgRcpHpsK5co1er1YRDu6DelsCMOL5d6DmVo78FBgRzcRy+pgTzFeiqVq1Ki43KZo0b/wP23paVqC/D3gAAAABJRU5ErkJggg=="}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultTemplate=r(40),t.defaultViewer=r(41),t.error=r(42),t.fillContainer=r(43),t.help=r(44),t.loadingScreen=r(45),t.navbar=r(46),t.overlay=r(47),t.share=r(48)}),(function(e,t){e.exports="<style>@font-face{font-family:babylon;src:url({{babylonFont}}) format('woff');font-weight:400;font-style:normal}.icon{font-family:babylon}</style> {{#if fillScreen}} <style>body,html{width:100%;height:100%;margin:0;padding:0}</style> {{/if}} <fill-container></fill-container>"}),(function(e,t){e.exports="<style>viewer{position:relative;overflow:hidden;z-index:1;justify-content:center;align-items:center;width:100%;height:100%}.babylonjs-canvas{flex:1;width:100%;height:100%;touch-action:none}</style> <canvas class=babylonjs-canvas touch-action=none> </canvas> <nav-bar></nav-bar>"}),(function(e,t){e.exports="Error loading the model"}),(function(e,t){e.exports="<style>fill-container{display:flex}fill-container>*{touch-action:none}</style> {{#unless disable}} <style>fill-container{width:100%;height:100%;justify-content:flex-start;align-items:stretch;align-content:stretch}fill-container>*{flex:1 1 auto;flex-direction:row;justify-content:flex-start;align-items:stretch;align-content:stretch}</style> {{/unless}} <viewer></viewer> <loading-screen></loading-screen> <overlay></overlay>"}),(function(e,t){e.exports="HELP"}),(function(e,t){e.exports="<style>loading-screen{position:absolute;left:0;z-index:100;opacity:1;pointer-events:none;display:flex;justify-content:center;align-items:center;-webkit-transition:opacity 1s ease;-moz-transition:opacity 1s ease;transition:opacity 1s ease}img.loading-image{-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style> <img class=loading-image src={{loadingImage}}>"}),(function(e,t){e.exports='<style>nav-bar{position:absolute;height:48px;width:100%;bottom:10px;display:flex;justify-content:center}nav-bar .nav-container{display:flex;flex-direction:row;margin:0 10px;height:100%;width:100%;justify-content:center}nav-bar .animation-control{background-color:rgba(91,93,107,.75);display:flex;flex-direction:row;height:100%;width:100%;max-width:1280px;justify-content:center}nav-bar .flex-container{display:flex;flex-direction:row;justify-content:center;height:100%;width:100%}nav-bar button{background:0 0;border:none;color:#fff;margin:0;padding:0;height:100%;min-width:48px;cursor:pointer}nav-bar button:active,nav-bar button:focus,nav-bar button:hover{background:0 0;border:none;outline:0}nav-bar button:hover{background-color:rgba(22,24,26,.2)}nav-bar .control-text{font-family:"Segoe UI";font-size:12px;font-weight:400;pointer-events:none}nav-bar .icon,nav-bar img{pointer-events:none}.logo-button{display:flex;align-items:center;flex-direction:row;justify-content:center;background-color:rgba(91,93,107,.75);height:48px;min-width:48px;margin-right:4px}.logo-button img{height:20px;width:20px}.types{display:flex;flex-direction:column;width:48px}.speed .flex-container,.types .flex-container{align-items:center}.menu-options{position:absolute;bottom:48px;width:48px;background-color:rgba(22,24,26,.9)}.animation-label,.help,.logo-button,.speed,.types-icon{display:none}.types-icon:after{font-size:16px;content:"\\F6BE"}.up-icon:after{line-height:16px;font-size:12px;content:"\\E70E"}.play-icon:after{font-size:16px;content:"\\E768"}.pause-icon:after{font-size:16px;content:"\\E769"}.fullscreen-icon:after{font-size:16px;content:"\\E740"}.help-icon:after{font-size:16px;content:"\\EF4E"}.progress-control{display:flex;flex:1;position:relative;overflow:hidden;cursor:pointer;align-items:center}.animation-number{margin:0 6px}.speed-text{margin-right:6px}.progress-circle{width:12px;height:12px;border:2px solid #fff;border-radius:50%;background-color:#5b5d6b;cursor:pointer;position:relative;bottom:10px;pointer-events:none}.default-control{display:flex;flex-direction:row;height:100%;background-color:rgba(91,93,107,.75)}.menu-options button{width:100%;height:48px;color:#8e939b}.menu-options button{width:100%;height:48px;color:#8e939b}.menu-options button:hover{background-color:transparent;color:#fff}.menu-options .animation-number{margin:0 18px 0 6px}.menu-options .speed-text{margin-right:18px}.menu-options{visibility:hidden}.open .menu-options{visibility:visible}.types .menu-options{width:144px}.types .menu-options button{padding:0 8px;justify-content:left}.types .menu-options button>*{display:flex;margin:8px}.types .menu-options button span.animation-number{display:none}.fullscreen{display:none}@media screen and (min-width:540px){.help,.speed,.types-icon{display:inline-block}.logo-button{display:flex}.types{width:84px}.progress-bar-container{margin:0 12px}.speed{width:64px}.speed .menu-options{width:64px}.fullscreen{display:block}}@media screen and (min-width:1024px){.animation-label{display:block;margin-left:6px;text-overflow:ellipsis;overflow:hidden}nav-bar button.animation-buttons{padding:0 8px;justify-content:left}.icon.up-icon{margin-left:8px}nav-bar button.animation-buttons>div{display:flex;pointer-events:none}.animation-number{display:none}.progress-bar-container{margin:0 12px}.types{width:144px}}.progress-wrapper{-webkit-appearance:none;cursor:pointer;width:100%;outline:0;margin:0 12px;height:30px;background-color:transparent}.progress-wrapper::-webkit-slider-thumb{-webkit-appearance:none;width:20px;height:20px;border:2px solid #fff;border-radius:50%;background:rgba(91,93,107,1);margin-top:-10px}.progress-wrapper::-webkit-slider-runnable-track{height:2px;-webkit-appearance:none;background-color:#fff}.progress-wrapper::-moz-range-progress{background-color:#fff;height:2px}.progress-wrapper::-moz-range-thumb{width:20px;height:20px;border:2px solid #fff;border-radius:50%;background:rgba(91,93,107,1)}.progress-wrapper::-moz-range-track{background:#fff;height:2px}.progress-wrapper::-ms-track{height:2px;background:0 0;border-color:transparent;border-width:10px 0;color:transparent}.progress-wrapper::-ms-fill-lower{background:#fff;border-radius:5px}.progress-wrapper::-ms-fill-upper{background:#fff;border-radius:5px}.progress-wrapper::-ms-thumb{width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:rgba(91,93,107,1);margin-top:0}span{display:inline-block}</style> {{#if (or (not animations) hideAnimations)}} {{#if hideLogo}} <style>nav-bar .nav-container{justify-content:flex-end}</style> {{else}} <style>nav-bar .nav-container{justify-content:space-between}</style> {{/if}} {{/if}} {{#if disableOnFullscreen}} <style>viewer:fullscreen nav-bar{display:none}viewer:-moz-full-screen nav-bar{display:none}viewer:-webkit-full-screen nav-bar{display:none}</style> {{/if}} <div class=nav-container id=navbar-control> {{#unless hideLogo}} <div class=logo-button title={{logoText}}> {{#if logoLink}} <a href={{logoLink}} target=_blank> <img src={{logoImage}}> </a> {{else}} <img src={{logoImage}}> {{/if}} </div> {{/unless}}{{#unless (or (not animations) hideAnimations)}} <div class=animation-control> <div class=types> <button class="flex-container animation-buttons" id=types-button> <span class="icon types-icon"></span> <span class="control-text animation-label">{{selectedAnimationName}}</span> <span class="control-text animation-number">{{selectedAnimation}}</span> {{#if (gt (count animations) 1)}} <span class="icon up-icon"></span> {{/if}} </button> <div class=menu-options> {{#each animations}} {{#unless (eq ../selectedAnimation (add @index 1))}} <button class="flex-container animation-buttons" id=label-option-button data-value={{this}}> <span class="icon types-icon"></span> <span class="control-text animation-label">{{this}}</span> <span class="control-text animation-number">{{add @index 1}}</span> </button> {{/unless}} {{/each}} </div> </div> <div class=progress-control id=progress-control> <button class=play-pause id=play-pause-button> {{#if paused}} <span class="icon play-icon"></span> {{else}} <span class="icon pause-icon"></span> {{/if}} </button> <input class=progress-wrapper id=progress-wrapper type=range min=0 max=100 step=0.01> </div> <div class=speed> <button class=flex-container id=speed-button> <span class="control-text speed-text">{{selectedSpeed}}</span> <span class="icon up-icon"></span> </button> <div class=menu-options> {{#eachInMap speedList}} {{#unless (eq ../selectedSpeed id)}} <button class=flex-container id=speed-option-button data-value={{value}}> <span class="control-text speed-text">{{id}}</span> </button> {{/unless}} {{/eachInMap}} </div> </div> </div> {{/unless}} <div class=default-control> {{#unless hideHelp}} <button class=help id=help-button title=Help> <span class="icon help-icon"></span> </button> {{/unless}} {{#unless hideFullScreen}} <button class=fullscreen id=fullscreen-button title=Fullscreen> <span class="icon fullscreen-icon"></span> </button> {{/unless}} </div> </div>'}),(function(e,t){e.exports="<style>overlay{position:absolute;z-index:99;opacity:0;display:flex;justify-content:center;align-items:center;-webkit-transition:opacity 1s ease;-moz-transition:opacity 1s ease;transition:opacity 1s ease}.overlay-item{width:100%;height:100%;display:none;align-items:center;justify-content:center;background-color:rgba(121,121,121,.3)}error.overlay-item{background-color:rgba(121,121,121,1)}div#close-button{position:absolute;top:10px;right:10px;width:30px;height:30px;cursor:pointer}div#close-button img{width:100%}</style> <div id=close-button> <img src={{closeImage}} alt={{closeText}}> </div> <help class=overlay-item></help> <error class=overlay-item></error> <share class=overlay-item></share>"}),(function(e,t){e.exports="SHARE"}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(2),n=r(2),o=r(2);t.defaultConfiguration={version:"3.2.0-alpha4",templates:{main:{html:i.defaultTemplate,params:{babylonFont:n.babylonFont,noEscape:!0}},fillContainer:{html:i.fillContainer,params:{disable:!1}},loadingScreen:{html:i.loadingScreen,params:{backgroundColor:"#000000",loadingImage:o.loading}},viewer:{html:i.defaultViewer,params:{enableDragAndDrop:!1}},navBar:{html:i.navbar,params:{speedList:{"0.5x":"0.5","1.0x":"1.0","1.5x":"1.5","2.0x":"2.0"},logoImage:o.babylonLogo,logoText:"BabylonJS",logoLink:"https://babylonjs.com",hideHelp:!0,disableOnFullscreen:!1},events:{pointerdown:{"navbar-control":!0,"help-button":!0},input:{"progress-wrapper":!0},pointerup:{"progress-wrapper":!0}}},overlay:{html:i.overlay,params:{closeImage:o.close,closeText:"Close"}},help:{html:i.help},share:{html:i.share},error:{html:i.error}},camera:{behaviors:{autoRotate:{type:0},framing:{type:2,zoomOnBoundingInfo:!0,zoomStopsAnimation:!1},bouncing:{type:1}},wheelPrecision:200},skybox:{},ground:{receiveShadows:!0},engine:{antialiasing:!0},scene:{}}}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0);t.extendedConfiguration={version:"3.2.0",extends:"default",camera:{exposure:3.034578,fov:.7853981633974483,contrast:1.6,toneMappingEnabled:!0,upperBetaLimit:1.3962634015954636+Math.PI/2,lowerBetaLimit:Math.PI/2-1.4835298641951802,behaviors:{framing:{type:2,mode:0,positionScale:.5,defaultElevation:.2617993877991494,elevationReturnWaitTime:3e3,elevationReturnTime:2e3,framingTime:500,zoomStopsAnimation:!1,radiusScale:.866},autoRotate:{type:0,idleRotationWaitTime:4e3,idleRotationSpeed:.17453292519943295,idleRotationSpinupTime:2500,zoomStopsAnimation:!1},bouncing:{type:1,lowerRadiusTransitionRange:.05,upperRadiusTransitionRange:-.2}},upperRadiusLimit:5,lowerRadiusLimit:.5,frameOnModelLoad:!0,framingElevation:.2617993877991494,framingRotation:1.5707963267948966,radius:2,alpha:1.5708,beta:.5*Math.PI-.2618,wheelPrecision:300,minZ:.1,maxZ:50,fovMode:0,pinchPrecision:1500,panningSensibility:3e3},lights:{light0:{type:0,frustumEdgeFalloff:0,intensity:7,intensityMode:0,radius:.6,range:.6,spotAngle:60,diffuse:{r:1,g:1,b:1},position:{x:-2,y:2.5,z:2},target:{x:0,y:0,z:0},enabled:!0,shadowEnabled:!0,shadowBufferSize:512,shadowMinZ:1,shadowMaxZ:10,shadowFieldOfView:60,shadowFrustumSize:2,shadowConfig:{useBlurCloseExponentialShadowMap:!0,useKernelBlur:!0,blurScale:1,bias:.001,depthScale:450,frustumEdgeFalloff:0}},light1:{type:0,frustumEdgeFalloff:0,intensity:7,intensityMode:0,radius:.4,range:.4,spotAngle:57,diffuse:{r:1,g:1,b:1},position:{x:4,y:3,z:-.5},target:{x:0,y:0,z:0},enabled:!0,shadowEnabled:!1,shadowBufferSize:512,shadowMinZ:.2,shadowMaxZ:10,shadowFieldOfView:28,shadowFrustumSize:2},light2:{type:0,frustumEdgeFalloff:0,intensity:1,intensityMode:0,radius:.5,range:.5,spotAngle:42.85,diffuse:{r:.8,g:.8,b:.8},position:{x:-1,y:3,z:-3},target:{x:0,y:0,z:0},enabled:!0,shadowEnabled:!1,shadowBufferSize:512,shadowMinZ:.2,shadowMaxZ:10,shadowFieldOfView:45,shadowFrustumSize:2}},ground:{shadowLevel:.9,texture:"Ground_2.0-1024.png",material:{primaryColorHighlightLevel:.035,primaryColorShadowLevel:0,enableNoise:!0,useRGBColor:!1,maxSimultaneousLights:1,diffuseTexture:{gammaSpace:!0}},opacity:1,mirror:!1,receiveShadows:!0,size:5},skybox:{scale:11,cubeTexture:{url:"Skybox_2.0-256.dds"},material:{primaryColorHighlightLevel:.03,primaryColorShadowLevel:.03,enableNoise:!0,useRGBColor:!1,reflectionTexture:{gammaSpace:!0}}},engine:{renderInBackground:!0},scene:{flags:{shadowsEnabled:!0,particlesEnabled:!1,collisionsEnabled:!1,lightsEnabled:!0,texturesEnabled:!0,lensFlaresEnabled:!1,proceduralTexturesEnabled:!1,renderTargetsEnabled:!0,spritesEnabled:!1,skeletonsEnabled:!0,audioEnabled:!1},defaultMaterial:{materialType:"pbr",reflectivityColor:{r:.1,g:.1,b:.1},microSurface:.6},clearColor:{r:.9,g:.9,b:.9,a:1},imageProcessingConfiguration:{vignetteCentreX:0,vignetteCentreY:0,vignetteColor:{r:.086,g:.184,b:.259,a:1},vignetteWeight:.855,vignetteStretch:.5,vignetteBlendMode:0,vignetteCameraFov:.7853981633974483,isEnabled:!0,colorCurves:{shadowsHue:0,shadowsDensity:0,shadowsSaturation:0,shadowsExposure:0,midtonesHue:0,midtonesDensity:0,midtonesExposure:0,midtonesSaturation:0,highlightsHue:0,highlightsDensity:0,highlightsExposure:0,highlightsSaturation:0}},mainColor:{r:.8823529411764706,g:.8823529411764706,b:.8823529411764706}},loaderPlugins:{extendedMaterial:!0,applyMaterialConfig:!0,msftLod:!0,telemetry:!0},model:{rotationOffsetAxis:{x:0,y:-1,z:0},rotationOffsetAngle:i.Tools.ToRadians(210),material:{directEnabled:!0,directIntensity:.884,emissiveIntensity:1.04,environmentIntensity:.6},entryAnimation:{scaling:{x:0,y:0,z:0},time:.5,easingFunction:4,easingMode:1},exitAnimation:{scaling:{x:0,y:0,z:0},time:.5,easingFunction:4,easingMode:1},normalize:!0,castShadow:!0,receiveShadows:!0},lab:{assetsRootURL:"https://viewer.babylonjs.com/assets/environment/",environmentMap:{texture:"EnvMap_2.0-256.env",rotationY:3,tintLevel:.4},defaultRenderingPipelines:{bloomEnabled:!0,bloomThreshold:1,fxaaEnabled:!0,bloomWeight:.05}}}}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shadowDirectionalLightConfiguration={model:{receiveShadows:!0,castShadow:!0},ground:{receiveShadows:!0},lights:{shadowDirectionalLight:{type:1,shadowEnabled:!0,target:{x:0,y:0,z:.5},position:{x:1.49,y:2.39,z:-1.33},diffuse:{r:.867,g:.816,b:.788},intensity:4.887,intensityMode:0,shadowBufferSize:1024,shadowFrustumSize:6,shadowFieldOfView:50.977,shadowMinZ:.1,shadowMaxZ:10,shadowConfig:{blurKernel:32,useBlurCloseExponentialShadowMap:!0}}}},t.shadowSpotlLightConfiguration={model:{receiveShadows:!0,castShadow:!0},ground:{receiveShadows:!0},lights:{shadowSpotLight:{type:2,intensity:2,shadowEnabled:!0,target:{x:0,y:0,z:.5},position:{x:0,y:3.5,z:3.7},angle:1,shadowOrthoScale:.5,shadowBufferSize:1024,shadowMinZ:.1,shadowMaxZ:50,shadowConfig:{frustumEdgeFalloff:.5,blurKernel:32,useBlurExponentialShadowMap:!0}}}}}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.environmentMapConfiguration={lab:{assetsRootURL:"/assets/environment/",environmentMap:{texture:"EnvMap_2.0-256.env",rotationY:0,tintLevel:.4}}}}),(function(e,t,r){"use strict";function i(e){if(e.camera&&(void 0!==e.camera.contrast&&n(e,"scene.imageProcessingConfiguration.contrast",e.camera.contrast),void 0!==e.camera.exposure&&n(e,"scene.imageProcessingConfiguration.exposure",e.camera.exposure)),e.scene&&e.scene.glow){n(e,"lab.defaultRenderingPipelines.glowLayerEnabled",!0);!1!==o.getConfigurationKey("scene.imageProcessingConfiguration.isEnabled",e)&&n(e,"scene.imageProcessingConfiguration.isEnabled",!0)}}function n(e,t,r,i){var n=t.split(".");if(0!==n.length){var o=n.pop();if(o){var s=e;n.forEach((function(e){s[e]=s[e]||{},s=s[e]})),(void 0===s[o]||i)&&(s[o]=r)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(11);t.processConfigurationCompatibility=i}),(function(e,t,r){"use strict";function i(e){if(!h[e])switch(e){case"telemetry":h[e]=new o.TelemetryLoaderPlugin;break;case"msftLod":h[e]=new s.MSFTLodLoaderPlugin;break;case"applyMaterialConfig":h[e]=new a.ApplyMaterialConfigPlugin;break;case"extendedMaterial":h[e]=new l.ExtendedMaterialLoaderPlugin}return h[e]}function n(e,t){h[e]&&u.Tools.Warn("Overwriting plugin with the same name - "+e),h[e]=t}Object.defineProperty(t,"__esModule",{value:!0});var o=r(55);t.TelemetryLoaderPlugin=o.TelemetryLoaderPlugin;var s=r(56);t.MSFTLodLoaderPlugin=s.MSFTLodLoaderPlugin;var a=r(57);t.ApplyMaterialConfigPlugin=a.ApplyMaterialConfigPlugin;var l=r(58);t.ExtendedMaterialLoaderPlugin=l.ExtendedMaterialLoaderPlugin;var u=r(0),h={};t.getLoaderPluginByName=i,t.addLoaderPlugin=n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(6),n=r(0),o=(function(){function e(){}return e.prototype.onInit=function(e,t){this._model=t,this._loadStart=n.Tools.Now},e.prototype.onLoaded=function(e){i.telemetryManager.broadcast("Model Loaded",e.getViewerId(),{model:e,loadTime:n.Tools.Now-this._loadStart}),i.telemetryManager.flushWebGLErrors(e.rootMesh.getEngine(),e.getViewerId())},e.prototype.onError=function(e,t){this._loadEnd=n.Tools.Now,i.telemetryManager.broadcast("Load Error",this._model.getViewerId(),{model:this._model,loadTime:this._loadEnd-this._loadStart}),i.telemetryManager.flushWebGLErrors(this._model.rootMesh.getEngine(),this._model.getViewerId())},e.prototype.onComplete=function(){this._loadEnd=n.Tools.Now,i.telemetryManager.broadcast("Load Complete",this._model.getViewerId(),{model:this._model,loadTime:this._loadEnd-this._loadStart}),i.telemetryManager.flushWebGLErrors(this._model.rootMesh.getEngine(),this._model.getViewerId())},e})();t.TelemetryLoaderPlugin=o}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(function(){function e(){}return e.prototype.onInit=function(e,t){this._model=t},e.prototype.onExtensionLoaded=function(e){if("MSFT_lod"===e.name&&this._model.configuration.loaderConfiguration){var t=e;t.enabled=!!this._model.configuration.loaderConfiguration.progressiveLoading,t.maxLODsToLoad=this._model.configuration.loaderConfiguration.maxLODsToLoad||Number.MAX_VALUE}},e})();t.MSFTLodLoaderPlugin=i}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(function(){function e(){}return e.prototype.onInit=function(e,t){this._model=t},e.prototype.onMaterialLoaded=function(e){this._model&&this._model._applyModelMaterialConfiguration(e)},e})();t.ApplyMaterialConfigPlugin=i}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){}return e.prototype.onMaterialLoaded=function(e){e.alphaMode=i.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF},e})();t.ExtendedMaterialLoaderPlugin=n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){this.onSceneInitObservable=new i.Observable,this.onEngineInitObservable=new i.Observable,this.onModelLoadedObservable=new i.Observable,this.onModelLoadProgressObservable=new i.Observable,this.onModelLoadErrorObservable=new i.Observable,this.onModelAddedObservable=new i.Observable,this.onModelRemovedObservable=new i.Observable,this.onViewerInitDoneObservable=new i.Observable,this.onLoaderInitObservable=new i.Observable,this.onFrameRenderedObservable=new i.Observable}return e.prototype.dispose=function(){this.onSceneInitObservable.clear(),this.onEngineInitObservable.clear(),this.onModelLoadedObservable.clear(),this.onModelLoadProgressObservable.clear(),this.onModelLoadErrorObservable.clear(),this.onModelAddedObservable.clear(),this.onModelRemovedObservable.clear(),this.onViewerInitDoneObservable.clear(),this.onLoaderInitObservable.clear(),this.onFrameRenderedObservable.clear()},e})();t.ObservablesManager=n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=(function(){function e(){this.mainColor=i.Color3.White(),this.reflectionColor=i.Color3.White()}return e})();t.ConfigurationContainer=n}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),n=r(1),o=r(62),s=r(63),a=r(1),l=(function(){function e(e){this.containerElement=e,this.templates={},this.onTemplateInit=new i.Observable,this.onTemplateLoaded=new i.Observable,this.onTemplateStateChange=new i.Observable,this.onAllLoaded=new i.Observable,this.onEventTriggered=new i.Observable,this.eventManager=new s.EventManager(this)}return e.prototype.initTemplate=function(e){var t=this,r=function(e,i,o){var s=t.templates[i],a=(Object.keys(e).map((function(t){return r(e[t],t,s)})),function(){var e=o&&o.parent.querySelector(n.camelToKebab(i))||t.containerElement;s.appendTo(e),t._checkLoadedState()});return o&&!o.parent?o.onAppended.add((function(){a()})):a(),s};return this._buildHTMLTree(e).then((function(e){t.templates.main?r(e,"main"):t._checkLoadedState()}))},e.prototype._buildHTMLTree=function(e){var t=this,r=Object.keys(e).map((function(r){if(!e[r])return Promise.resolve(!1);var i=new u(r,e[r]);return i.onLoaded.add((function(){t.onTemplateLoaded.notifyObservers(i)})),i.onStateChange.add((function(){t.onTemplateStateChange.notifyObservers(i)})),t.onTemplateInit.notifyObservers(i),i.onEventTriggered.add((function(e){return t.onEventTriggered.notifyObservers(e)})),t.templates[r]=i,i.initPromise}));return Promise.all(r).then((function(){var e={},r=function(e,i){t.templates[i].isInHtmlTree=!0,t.templates[i].getChildElements().filter((function(e){return!!t.templates[e]})).forEach((function(t){e[t]={},r(e[t],t)}))};return t.templates.main&&r(e,"main"),e}))},e.prototype.getCanvas=function(){return this.containerElement.querySelector("canvas")},e.prototype.getTemplate=function(e){return this.templates[e]},e.prototype._checkLoadedState=function(){var e=this;(0===Object.keys(this.templates).length||Object.keys(this.templates).every((function(t){return e.templates[t].isLoaded&&!!e.templates[t].parent||!e.templates[t].isInHtmlTree})))&&this.onAllLoaded.notifyObservers(this)},e.prototype.dispose=function(){var e=this;Object.keys(this.templates).forEach((function(t){e.templates[t].dispose()})),this.templates={},this.eventManager.dispose(),this.onTemplateInit.clear(),this.onAllLoaded.clear(),this.onEventTriggered.clear(),this.onTemplateLoaded.clear(),this.onTemplateStateChange.clear()},e})();t.TemplateManager=l,o.registerHelper("eachInMap",(function(e,t){var r="";return Object.keys(e).map((function(i){var n=e[i];"object"==typeof n?(n.id=n.id||i,r+=t.fn(n)):r+=t.fn({id:i,value:n})})),r})),o.registerHelper("add",(function(e,t){return e+t})),o.registerHelper("eq",(function(e,t){return e==t})),o.registerHelper("or",(function(e,t){return e||t})),o.registerHelper("not",(function(e){return!e})),o.registerHelper("count",(function(e){return e.length})),o.registerHelper("gt",(function(e,t){return e>t}));var u=(function(){function e(e,t){var r=this;this.name=e,this._configuration=t,this.onLoaded=new i.Observable,this.onAppended=new i.Observable,this.onStateChange=new i.Observable,this.onEventTriggered=new i.Observable,this.loadRequests=[],this.isLoaded=!1,this.isShown=!1,this.isInHtmlTree=!1;var n=this._getTemplateAsHtml(t);this.initPromise=n.then((function(e){if(e){r._htmlTemplate=e;var t=o.compile(e,{
- noEscape:r._configuration.params&&!!r._configuration.params.noEscape}),i=r._configuration.params||{};r._rawHtml=t(i);try{r._fragment=document.createRange().createContextualFragment(r._rawHtml)}catch(e){var n=document.createElement(r.name);n.innerHTML=r._rawHtml,r._fragment=n}r.isLoaded=!0,r.isShown=!0,r.onLoaded.notifyObservers(r)}return r}))}return e.prototype.updateParams=function(e,t){void 0===t&&(t=!0),this._configuration.params=t?a.deepmerge(this._configuration.params,e):e,this.isLoaded;var r=o.compile(this._htmlTemplate),i=this._configuration.params||{};this._rawHtml=r(i);try{this._fragment=document.createRange().createContextualFragment(this._rawHtml)}catch(e){var n=document.createElement(this.name);n.innerHTML=this._rawHtml,this._fragment=n}this.parent&&this.appendTo(this.parent,!0)},Object.defineProperty(e.prototype,"configuration",{get:function(){return this._configuration},enumerable:!0,configurable:!0}),e.prototype.getChildElements=function(){var e=[],t=this._fragment&&this._fragment.children;if(!this._fragment){var r=this.parent.querySelector(this.name);r&&(t=r.querySelectorAll("*"))}t||(t=this._fragment.querySelectorAll("*"));for(var i=0;i<t.length;++i)e.push(n.kebabToCamel(t.item(i).nodeName.toLowerCase()));return e},e.prototype.appendTo=function(e,t){var r=this;if(this.parent){if(!t||!this._addedFragment)return;this.parent.innerHTML=""}this.parent=e,this._configuration.id&&(this.parent.id=this._configuration.id),this._fragment?(this.parent.appendChild(this._fragment),this._addedFragment=this._fragment):this.parent.insertAdjacentHTML("beforeend",this._rawHtml),setTimeout((function(){r._registerEvents(),r.onAppended.notifyObservers(r)}))},e.prototype.show=function(e){var t=this;return this._isHiding?Promise.resolve(this):Promise.resolve().then((function(){return t._isShowing=!0,e?e(t):(t.parent.style.display="flex","flex"!==t.parent.style.display&&(t.parent.style.display=""),t)})).then((function(){return t.isShown=!0,t._isShowing=!1,t.onStateChange.notifyObservers(t),t}))},e.prototype.hide=function(e){var t=this;return this._isShowing?Promise.resolve(this):Promise.resolve().then((function(){return t._isHiding=!0,e?e(t):(t.parent.style.display="none",t)})).then((function(){return t.isShown=!1,t._isHiding=!1,t.onStateChange.notifyObservers(t),t}))},e.prototype.dispose=function(){this.onAppended.clear(),this.onEventTriggered.clear(),this.onLoaded.clear(),this.onStateChange.clear(),this.isLoaded=!1;try{this.parent.removeChild(this._fragment)}catch(e){}this.loadRequests.forEach((function(e){e.abort()})),this._registeredEvents&&this._registeredEvents.forEach((function(e){e.htmlElement.removeEventListener(e.eventName,e.function)})),delete this._fragment},e.prototype._getTemplateAsHtml=function(e){var t=this;if(e){if(void 0!==e.html)return Promise.resolve(e.html);var r=this._getTemplateLocation(e);if(n.isUrl(r))return new Promise(function(e,n){var o=i.Tools.LoadFile(r,(function(t){e(t)}),void 0,void 0,!1,(function(e,t){n(t)}));t.loadRequests.push(o)});r=r.replace("#","");var o=document.getElementById(r);return o?Promise.resolve(o.innerHTML):Promise.reject("Template ID not found")}return Promise.reject("No templateConfig provided")},e.prototype._registerEvents=function(){var e=this;if(this._registeredEvents=this._registeredEvents||[],this._registeredEvents.length&&this._registeredEvents.forEach((function(e){e.htmlElement.removeEventListener(e.eventName,e.function)})),this._configuration.events){var t=this;for(var r in this._configuration.events)!(function(r){if(t._configuration.events&&t._configuration.events[r]){var i=function(t,r){e.onEventTriggered.notifyObservers({event:r,template:e,selector:t})};if("boolean"==typeof t._configuration.events[r]){var n=t.parent.id;n=n?"#"+n:t.parent.tagName;var o=i.bind(t,n);t.parent.addEventListener(r,i.bind(t,n),!1),t._registeredEvents.push({htmlElement:t.parent,eventName:r,function:o})}else if("object"==typeof t._configuration.events[r]){var s=Object.keys(t._configuration.events[r]||{}),a=t._configuration.events[r]||{};s.filter((function(e){return a[e]})).forEach((function(t){t&&0!==t.indexOf("#")&&(t="#"+t);var n=e.parent.querySelector(t);if(n){var o=i.bind(e,t);n.addEventListener(r,o,!1),e._registeredEvents.push({htmlElement:n,eventName:r,function:o})}}))}}})(r)}},e.prototype._getTemplateLocation=function(e){return e&&"string"!=typeof e?e.location:e},e})();t.Template=u}),(function(e,t,r){!(function(t,r){e.exports=r()})(0,(function(){return (function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={exports:{},id:i,loaded:!1};return e[i].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)})([(function(e,t,r){"use strict";function i(){var e=g();return e.compile=function(t,r){return h.compile(t,r,e)},e.precompile=function(t,r){return h.precompile(t,r,e)},e.AST=l.default,e.Compiler=h.Compiler,e.JavaScriptCompiler=f.default,e.Parser=u.parser,e.parse=u.parse,e}var n=r(1).default;t.__esModule=!0;var o=r(2),s=n(o),a=r(35),l=n(a),u=r(36),h=r(41),c=r(42),f=n(c),d=r(39),p=n(d),A=r(34),m=n(A),g=s.default.create,_=i();_.create=i,m.default(_),_.Visitor=p.default,_.default=_,t.default=_,e.exports=t.default}),(function(e,t){"use strict";t.default=function(e){return e&&e.__esModule?e:{default:e}},t.__esModule=!0}),(function(e,t,r){"use strict";function i(){var e=new a.HandlebarsEnvironment;return d.extend(e,a),e.SafeString=u.default,e.Exception=c.default,e.Utils=d,e.escapeExpression=d.escapeExpression,e.VM=A,e.template=function(t){return A.template(t,e)},e}var n=r(3).default,o=r(1).default;t.__esModule=!0;var s=r(4),a=n(s),l=r(21),u=o(l),h=r(6),c=o(h),f=r(5),d=n(f),p=r(22),A=n(p),m=r(34),g=o(m),_=i();_.create=i,g.default(_),_.default=_,t.default=_,e.exports=t.default}),(function(e,t){"use strict";t.default=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t},t.__esModule=!0}),(function(e,t,r){"use strict";function i(e,t,r){this.helpers=e||{},this.partials=t||{},this.decorators=r||{},l.registerDefaultHelpers(this),u.registerDefaultDecorators(this)}var n=r(1).default;t.__esModule=!0,t.HandlebarsEnvironment=i;var o=r(5),s=r(6),a=n(s),l=r(10),u=r(18),h=r(20),c=n(h);t.VERSION="4.0.11";t.COMPILER_REVISION=7;var f={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0"};t.REVISION_CHANGES=f;i.prototype={constructor:i,logger:c.default,log:c.default.log,registerHelper:function(e,t){if("[object Object]"===o.toString.call(e)){if(t)throw new a.default("Arg not supported with multiple helpers");o.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("[object Object]"===o.toString.call(e))o.extend(this.partials,e);else{if(void 0===t)throw new a.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if("[object Object]"===o.toString.call(e)){if(t)throw new a.default("Arg not supported with multiple decorators");o.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]}};var d=c.default.log;t.log=d,t.createFrame=o.createFrame,t.logger=c.default}),(function(e,t){"use strict";function r(e){return h[e]}function i(e){for(var t=1;t<arguments.length;t++)for(var r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&(e[r]=arguments[t][r]);return e}function n(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}function o(e){if("string"!=typeof e){if(e&&e.toHTML)return e.toHTML();if(null==e)return"";if(!e)return e+"";e=""+e}return f.test(e)?e.replace(c,r):e}function s(e){return!e&&0!==e||!(!A(e)||0!==e.length)}function a(e){var t=i({},e);return t._parent=e,t}function l(e,t){return e.path=t,e}function u(e,t){return(e?e+".":"")+t}t.__esModule=!0,t.extend=i,t.indexOf=n,t.escapeExpression=o,t.isEmpty=s,t.createFrame=a,t.blockParams=l,t.appendContextPath=u;var h={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},c=/[&<>"'`=]/g,f=/[&<>"'`=]/,d=Object.prototype.toString;t.toString=d;var p=function(e){return"function"==typeof e};p(/x/)&&(t.isFunction=p=function(e){return"function"==typeof e&&"[object Function]"===d.call(e)}),t.isFunction=p;var A=Array.isArray||function(e){return!(!e||"object"!=typeof e)&&"[object Array]"===d.call(e)};t.isArray=A}),(function(e,t,r){"use strict";function i(e,t){var r=t&&t.loc,s=void 0,a=void 0;r&&(s=r.start.line,a=r.start.column,e+=" - "+s+":"+a);for(var l=Error.prototype.constructor.call(this,e),u=0;u<o.length;u++)this[o[u]]=l[o[u]];Error.captureStackTrace&&Error.captureStackTrace(this,i);try{r&&(this.lineNumber=s,n?Object.defineProperty(this,"column",{value:a,enumerable:!0}):this.column=a)}catch(e){}}var n=r(7).default;t.__esModule=!0;var o=["description","fileName","lineNumber","message","name","number","stack"];i.prototype=new Error,t.default=i,e.exports=t.default}),(function(e,t,r){e.exports={default:r(8),__esModule:!0}}),(function(e,t,r){var i=r(9);e.exports=function(e,t,r){return i.setDesc(e,t,r)}}),(function(e,t){var r=Object;e.exports={create:r.create,getProto:r.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:r.getOwnPropertyDescriptor,setDesc:r.defineProperty,setDescs:r.defineProperties,getKeys:r.keys,getNames:r.getOwnPropertyNames,getSymbols:r.getOwnPropertySymbols,each:[].forEach}}),(function(e,t,r){"use strict";function i(e){s.default(e),l.default(e),h.default(e),f.default(e),p.default(e),m.default(e),_.default(e)}var n=r(1).default;t.__esModule=!0,t.registerDefaultHelpers=i;var o=r(11),s=n(o),a=r(12),l=n(a),u=r(13),h=n(u),c=r(14),f=n(c),d=r(15),p=n(d),A=r(16),m=n(A),g=r(17),_=n(g)}),(function(e,t,r){"use strict";t.__esModule=!0;var i=r(5);t.default=function(e){e.registerHelper("blockHelperMissing",(function(t,r){var n=r.inverse,o=r.fn;if(!0===t)return o(this);if(!1===t||null==t)return n(this);if(i.isArray(t))return t.length>0?(r.ids&&(r.ids=[r.name]),e.helpers.each(t,r)):n(this);if(r.data&&r.ids){var s=i.createFrame(r.data);s.contextPath=i.appendContextPath(r.data.contextPath,r.name),r={data:s}}return o(t,r)}))},e.exports=t.default}),(function(e,t,r){"use strict";var i=r(1).default;t.__esModule=!0;var n=r(5),o=r(6),s=i(o);t.default=function(e){e.registerHelper("each",(function(e,t){function r(t,r,o){u&&(u.key=t,u.index=r,u.first=0===r,u.last=!!o,h&&(u.contextPath=h+t)),l+=i(e[t],{data:u,blockParams:n.blockParams([e[t],t],[h+t,null])})}if(!t)throw new s.default("Must pass iterator to #each");var i=t.fn,o=t.inverse,a=0,l="",u=void 0,h=void 0;if(t.data&&t.ids&&(h=n.appendContextPath(t.data.contextPath,t.ids[0])+"."),n.isFunction(e)&&(e=e.call(this)),t.data&&(u=n.createFrame(t.data)),e&&"object"==typeof e)if(n.isArray(e))for(var c=e.length;a<c;a++)a in e&&r(a,a,a===e.length-1);else{var f=void 0;for(var d in e)e.hasOwnProperty(d)&&(void 0!==f&&r(f,a-1),f=d,a++);void 0!==f&&r(f,a-1,!0)}return 0===a&&(l=o(this)),l}))},e.exports=t.default}),(function(e,t,r){"use strict";var i=r(1).default;t.__esModule=!0;var n=r(6),o=i(n);t.default=function(e){e.registerHelper("helperMissing",(function(){if(1!==arguments.length)throw new o.default('Missing helper: "'+arguments[arguments.length-1].name+'"')}))},e.exports=t.default}),(function(e,t,r){"use strict";t.__esModule=!0;var i=r(5);t.default=function(e){e.registerHelper("if",(function(e,t){return i.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||i.isEmpty(e)?t.inverse(this):t.fn(this)})),e.registerHelper("unless",(function(t,r){return e.helpers.if.call(this,t,{fn:r.inverse,inverse:r.fn,hash:r.hash})}))},e.exports=t.default}),(function(e,t){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("log",(function(){for(var t=[void 0],r=arguments[arguments.length-1],i=0;i<arguments.length-1;i++)t.push(arguments[i]);var n=1;null!=r.hash.level?n=r.hash.level:r.data&&null!=r.data.level&&(n=r.data.level),t[0]=n,e.log.apply(e,t)}))},e.exports=t.default}),(function(e,t){"use strict";t.__esModule=!0,t.default=function(e){e.registerHelper("lookup",(function(e,t){return e&&e[t]}))},e.exports=t.default}),(function(e,t,r){"use strict";t.__esModule=!0;var i=r(5);t.default=function(e){e.registerHelper("with",(function(e,t){i.isFunction(e)&&(e=e.call(this));var r=t.fn;if(i.isEmpty(e))return t.inverse(this);var n=t.data;return t.data&&t.ids&&(n=i.createFrame(t.data),n.contextPath=i.appendContextPath(t.data.contextPath,t.ids[0])),r(e,{data:n,blockParams:i.blockParams([e],[n&&n.contextPath])})}))},e.exports=t.default}),(function(e,t,r){"use strict";function i(e){s.default(e)}var n=r(1).default;t.__esModule=!0,t.registerDefaultDecorators=i;var o=r(19),s=n(o)}),(function(e,t,r){"use strict";t.__esModule=!0;var i=r(5);t.default=function(e){e.registerDecorator("inline",(function(e,t,r,n){var o=e;return t.partials||(t.partials={},o=function(n,o){var s=r.partials;r.partials=i.extend({},s,t.partials);var a=e(n,o);return r.partials=s,a}),t.partials[n.args[0]]=n.fn,o}))},e.exports=t.default}),(function(e,t,r){"use strict";t.__esModule=!0;var i=r(5),n={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if("string"==typeof e){var t=i.indexOf(n.methodMap,e.toLowerCase());e=t>=0?t:parseInt(e,10)}return e},log:function(e){if(e=n.lookupLevel(e),"undefined"!=typeof console&&n.lookupLevel(n.level)<=e){var t=n.methodMap[e];console[t]||(t="log");for(var r=arguments.length,i=Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];console[t].apply(console,i)}}};t.default=n,e.exports=t.default}),(function(e,t){"use strict";function r(e){this.string=e}t.__esModule=!0,r.prototype.toString=r.prototype.toHTML=function(){return""+this.string},t.default=r,e.exports=t.default}),(function(e,t,r){"use strict";function i(e){var t=e&&e[0]||1,r=_.COMPILER_REVISION;if(t!==r){if(t<r){var i=_.REVISION_CHANGES[r],n=_.REVISION_CHANGES[t];throw new g.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+n+").")}throw new g.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+e[1]+").")}}function n(e,t){function r(r,i,n){n.hash&&(i=A.extend({},i,n.hash),n.ids&&(n.ids[0]=!0)),r=t.VM.resolvePartial.call(this,r,i,n);var o=t.VM.invokePartial.call(this,r,i,n);if(null==o&&t.compile&&(n.partials[n.name]=t.compile(r,e.compilerOptions,t),o=n.partials[n.name](i,n)),null!=o){if(n.indent){for(var s=o.split("\n"),a=0,l=s.length;a<l&&(s[a]||a+1!==l);a++)s[a]=n.indent+s[a];o=s.join("\n")}return o}throw new g.default("The partial "+n.name+" could not be compiled when running in runtime-only mode")}function i(t){function r(t){return""+e.main(n,t,n.helpers,n.partials,s,l,a)}var o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],s=o.data;i._setup(o),!o.partial&&e.useData&&(s=u(t,s));var a=void 0,l=e.useBlockParams?[]:void 0;return e.useDepths&&(a=o.depths?t!=o.depths[0]?[t].concat(o.depths):o.depths:[t]),(r=h(e.main,r,n,o.depths||[],s,l))(t,o)}if(!t)throw new g.default("No environment passed to template");if(!e||!e.main)throw new g.default("Unknown template object: "+typeof e);e.main.decorator=e.main_d,t.VM.checkRevision(e.compiler);var n={strict:function(e,t){if(!(t in e))throw new g.default('"'+t+'" not defined in '+e);return e[t]},lookup:function(e,t){for(var r=e.length,i=0;i<r;i++)if(e[i]&&null!=e[i][t])return e[i][t]},lambda:function(e,t){return"function"==typeof e?e.call(t):e},escapeExpression:A.escapeExpression,invokePartial:r,fn:function(t){var r=e[t];return r.decorator=e[t+"_d"],r},programs:[],program:function(e,t,r,i,n){var s=this.programs[e],a=this.fn(e);return t||n||i||r?s=o(this,e,a,t,r,i,n):s||(s=this.programs[e]=o(this,e,a)),s},data:function(e,t){for(;e&&t--;)e=e._parent;return e},merge:function(e,t){var r=e||t;return e&&t&&e!==t&&(r=A.extend({},t,e)),r},nullContext:c({}),noop:t.VM.noop,compilerInfo:e.compiler};return i.isTop=!0,i._setup=function(r){r.partial?(n.helpers=r.helpers,n.partials=r.partials,n.decorators=r.decorators):(n.helpers=n.merge(r.helpers,t.helpers),e.usePartial&&(n.partials=n.merge(r.partials,t.partials)),(e.usePartial||e.useDecorators)&&(n.decorators=n.merge(r.decorators,t.decorators)))},i._child=function(t,r,i,s){if(e.useBlockParams&&!i)throw new g.default("must pass block params");if(e.useDepths&&!s)throw new g.default("must pass parent depths");return o(n,t,e[t],r,0,i,s)},i}function o(e,t,r,i,n,o,s){function a(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],a=s;return!s||t==s[0]||t===e.nullContext&&null===s[0]||(a=[t].concat(s)),r(e,t,e.helpers,e.partials,n.data||i,o&&[n.blockParams].concat(o),a)}return a=h(r,a,e,s,i,o),a.program=t,a.depth=s?s.length:0,a.blockParams=n||0,a}function s(e,t,r){return e?e.call||r.name||(r.name=e,e=r.partials[e]):e="@partial-block"===r.name?r.data["partial-block"]:r.partials[r.name],e}function a(e,t,r){var i=r.data&&r.data["partial-block"];r.partial=!0,r.ids&&(r.data.contextPath=r.ids[0]||r.data.contextPath);var n=void 0;if(r.fn&&r.fn!==l&&(function(){r.data=_.createFrame(r.data);var e=r.fn;n=r.data["partial-block"]=function(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return r.data=_.createFrame(r.data),r.data["partial-block"]=i,e(t,r)},e.partials&&(r.partials=A.extend({},r.partials,e.partials))})(),void 0===e&&n&&(e=n),void 0===e)throw new g.default("The partial "+r.name+" could not be found");if(e instanceof Function)return e(t,r)}function l(){return""}function u(e,t){return t&&"root"in t||(t=t?_.createFrame(t):{},t.root=e),t}function h(e,t,r,i,n,o){if(e.decorator){var s={};t=e.decorator(t,s,r,i&&i[0],n,o,i),A.extend(t,s)}return t}var c=r(23).default,f=r(3).default,d=r(1).default;t.__esModule=!0,t.checkRevision=i,t.template=n,t.wrapProgram=o,t.resolvePartial=s,t.invokePartial=a,t.noop=l;var p=r(5),A=f(p),m=r(6),g=d(m),_=r(4)}),(function(e,t,r){e.exports={default:r(24),__esModule:!0}}),(function(e,t,r){r(25),e.exports=r(30).Object.seal}),(function(e,t,r){var i=r(26);r(27)("seal",(function(e){return function(t){return e&&i(t)?e(t):t}}))}),(function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}}),(function(e,t,r){var i=r(28),n=r(30),o=r(33);e.exports=function(e,t){var r=(n.Object||{})[e]||Object[e],s={};s[e]=t(r),i(i.S+i.F*o((function(){r(1)})),"Object",s)}}),(function(e,t,r){var i=r(29),n=r(30),o=r(31),s=function(e,t,r){var a,l,u,h=e&s.F,c=e&s.G,f=e&s.S,d=e&s.P,p=e&s.B,A=e&s.W,m=c?n:n[t]||(n[t]={}),g=c?i:f?i[t]:(i[t]||{}).prototype;c&&(r=t);for(a in r)(l=!h&&g&&a in g)&&a in m||(u=l?g[a]:r[a],m[a]=c&&"function"!=typeof g[a]?r[a]:p&&l?o(u,i):A&&g[a]==u?(function(e){var t=function(t){return this instanceof e?new e(t):e(t)};return t.prototype=e.prototype,t})(u):d&&"function"==typeof u?o(Function.call,u):u,d&&((m.prototype||(m.prototype={}))[a]=u))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,e.exports=s}),(function(e,t){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)}),(function(e,t){var r=e.exports={version:"1.2.6"};"number"==typeof __e&&(__e=r)}),(function(e,t,r){var i=r(32);e.exports=function(e,t,r){if(i(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,i){return e.call(t,r,i)};case 3:return function(r,i,n){return e.call(t,r,i,n)}}return function(){return e.apply(t,arguments)}}}),(function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}}),(function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}}),(function(e,t){(function(r){"use strict";t.__esModule=!0,t.default=function(e){var t=void 0!==r?r:window,i=t.Handlebars;e.noConflict=function(){return t.Handlebars===e&&(t.Handlebars=i),e}},e.exports=t.default}).call(t,(function(){return this})())}),(function(e,t){"use strict";t.__esModule=!0;var r={helpers:{helperExpression:function(e){return"SubExpression"===e.type||("MustacheStatement"===e.type||"BlockStatement"===e.type)&&!!(e.params&&e.params.length||e.hash)},scopedId:function(e){return/^\.|this\b/.test(e.original)},simpleId:function(e){return 1===e.parts.length&&!r.helpers.scopedId(e)&&!e.depth}}};t.default=r,e.exports=t.default}),(function(e,t,r){"use strict";function i(e,t){return"Program"===e.type?e:(a.default.yy=d,d.locInfo=function(e){return new d.SourceLocation(t&&t.srcName,e)},new u.default(t).accept(a.default.parse(e)))}var n=r(1).default,o=r(3).default;t.__esModule=!0,t.parse=i;var s=r(37),a=n(s),l=r(38),u=n(l),h=r(40),c=o(h),f=r(5);t.parser=a.default;var d={};f.extend(d,c)}),(function(e,t){"use strict";t.__esModule=!0;var r=(function(){function e(){this.yy={}}var t={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition_plus0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,1],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(e,t,r,i,n,o,s){var a=o.length-1;switch(n){case 1:return o[a-1];case 2:this.$=i.prepareProgram(o[a]);break;case 3:case 4:case 5:case 6:case 7:case 8:this.$=o[a];break;case 9:this.$={type:"CommentStatement",value:i.stripComment(o[a]),strip:i.stripFlags(o[a],o[a]),loc:i.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:o[a],value:o[a],loc:i.locInfo(this._$)};break;case 11:this.$=i.prepareRawBlock(o[a-2],o[a-1],o[a],this._$);break;case 12:this.$={path:o[a-3],params:o[a-2],hash:o[a-1]};break;case 13:this.$=i.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!1,this._$);break;case 14:this.$=i.prepareBlock(o[a-3],o[a-2],o[a-1],o[a],!0,this._$);break;case 15:this.$={open:o[a-5],path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:i.stripFlags(o[a-5],o[a])};break;case 16:case 17:this.$={path:o[a-4],params:o[a-3],hash:o[a-2],blockParams:o[a-1],strip:i.stripFlags(o[a-5],o[a])};break;case 18:this.$={strip:i.stripFlags(o[a-1],o[a-1]),program:o[a]};break;case 19:var l=i.prepareBlock(o[a-2],o[a-1],o[a],o[a],!1,this._$),u=i.prepareProgram([l],o[a-1].loc);u.chained=!0,this.$={strip:o[a-2].strip,program:u,chain:!0};break;case 20:this.$=o[a];break;case 21:this.$={path:o[a-1],strip:i.stripFlags(o[a-2],o[a])};break;case 22:case 23:this.$=i.prepareMustache(o[a-3],o[a-2],o[a-1],o[a-4],i.stripFlags(o[a-4],o[a]),this._$);break;case 24:this.$={type:"PartialStatement",name:o[a-3],params:o[a-2],hash:o[a-1],indent:"",strip:i.stripFlags(o[a-4],o[a]),loc:i.locInfo(this._$)};break;case 25:this.$=i.preparePartialBlock(o[a-2],o[a-1],o[a],this._$);break;case 26:this.$={path:o[a-3],params:o[a-2],hash:o[a-1],strip:i.stripFlags(o[a-4],o[a])};break;case 27:case 28:this.$=o[a];break;case 29:this.$={type:"SubExpression",path:o[a-3],params:o[a-2],hash:o[a-1],loc:i.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:o[a],loc:i.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:i.id(o[a-2]),value:o[a],loc:i.locInfo(this._$)};break;case 32:this.$=i.id(o[a-1]);break;case 33:case 34:this.$=o[a];break;case 35:this.$={type:"StringLiteral",value:o[a],original:o[a],loc:i.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(o[a]),original:Number(o[a]),loc:i.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:"true"===o[a],original:"true"===o[a],loc:i.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:i.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:i.locInfo(this._$)};break;case 40:case 41:this.$=o[a];break;case 42:this.$=i.preparePath(!0,o[a],this._$);break;case 43:this.$=i.preparePath(!1,o[a],this._$);break;case 44:o[a-2].push({part:i.id(o[a]),original:o[a],separator:o[a-1]}),this.$=o[a-2];break;case 45:this.$=[{part:i.id(o[a]),original:o[a]}];break;case 46:this.$=[];break;case 47:o[a-1].push(o[a]);break;case 48:this.$=[o[a]];break;case 49:o[a-1].push(o[a]);break;case 50:this.$=[];break;case 51:o[a-1].push(o[a]);break;case 58:this.$=[];break;case 59:o[a-1].push(o[a]);break;case 64:this.$=[];break;case 65:o[a-1].push(o[a]);break;case 70:this.$=[];break;case 71:o[a-1].push(o[a]);break;case 78:this.$=[];break;case 79:o[a-1].push(o[a]);break;case 82:this.$=[];break;case 83:o[a-1].push(o[a]);break;case 86:this.$=[];break;case 87:o[a-1].push(o[a]);break;case 90:this.$=[];break;case 91:o[a-1].push(o[a]);break;case 94:this.$=[];break;case 95:o[a-1].push(o[a]);break;case 98:this.$=[o[a]];break;case 99:o[a-1].push(o[a]);break;case 100:this.$=[o[a]];break;case 101:o[a-1].push(o[a])}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{13:40,15:[1,20],17:39},{20:42,56:41,64:43,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:45,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:48,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:42,56:49,64:43,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:50,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,51]},{72:[1,35],86:52},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:53,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:54,38:56,39:[1,58],43:57,44:[1,59],45:55,47:[2,54]},{28:60,43:61,44:[1,59],47:[2,56]},{13:63,15:[1,20],18:[1,62]},{15:[2,48],18:[2,48]},{33:[2,86],57:64,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:65,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:66,47:[1,67]},{30:68,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:69,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:70,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:71,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],
- 85:[2,90]},{20:75,33:[2,80],50:72,63:73,64:76,65:[1,44],69:74,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,80]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,51]},{20:75,53:81,54:[2,84],63:82,64:76,65:[1,44],69:83,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:84,47:[1,67]},{47:[2,55]},{4:85,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:86,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:87,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:88,47:[1,67]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:75,33:[2,88],58:89,63:90,64:76,65:[1,44],69:91,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:92,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:93,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,31:94,33:[2,60],63:95,64:76,65:[1,44],69:96,70:77,71:78,72:[1,79],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,33:[2,66],36:97,63:98,64:76,65:[1,44],69:99,70:77,71:78,72:[1,79],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,22:100,23:[2,52],63:101,64:76,65:[1,44],69:102,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:75,33:[2,92],62:103,63:104,64:76,65:[1,44],69:105,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,106]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:107,72:[1,108],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,109],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,110]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:56,39:[1,58],43:57,44:[1,59],45:112,46:111,47:[2,76]},{33:[2,70],40:113,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,114]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:75,63:116,64:76,65:[1,44],67:115,68:[2,96],69:117,70:77,71:78,72:[1,79],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,118]},{32:119,33:[2,62],74:120,75:[1,121]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:122,74:123,75:[1,121]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,124]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,125]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,109]},{20:75,63:126,64:76,65:[1,44],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:75,33:[2,72],41:127,63:128,64:76,65:[1,44],69:129,70:77,71:78,72:[1,79],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,130]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,131]},{33:[2,63]},{72:[1,133],76:132},{33:[1,134]},{33:[2,69]},{15:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:135,74:136,75:[1,121]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,138],77:[1,137]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,139]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],55:[2,55],57:[2,20],61:[2,57],74:[2,81],83:[2,85],87:[2,18],91:[2,89],102:[2,53],105:[2,93],111:[2,19],112:[2,77],117:[2,97],120:[2,63],123:[2,69],124:[2,12],136:[2,75],137:[2,32]},parseError:function(e,t){throw new Error(e)},parse:function(e){var t=this,r=[0],i=[null],n=[],o=this.table,s="",a=0,l=0,u=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,void 0===this.lexer.yylloc&&(this.lexer.yylloc={});var h=this.lexer.yylloc;n.push(h);var c=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var f,d,p,A,m,g,_,v,y,b={};;){if(p=r[r.length-1],this.defaultActions[p]?A=this.defaultActions[p]:(null!==f&&void 0!==f||(f=(function(){var e;return e=t.lexer.lex()||1,"number"!=typeof e&&(e=t.symbols_[e]||e),e})()),A=o[p]&&o[p][f]),void 0===A||!A.length||!A[0]){var E="";if(!u){y=[];for(g in o[p])this.terminals_[g]&&g>2&&y.push("'"+this.terminals_[g]+"'");E=this.lexer.showPosition?"Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+y.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(a+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(E,{text:this.lexer.match,token:this.terminals_[f]||f,line:this.lexer.yylineno,loc:h,expected:y})}}if(A[0]instanceof Array&&A.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+f);switch(A[0]){case 1:r.push(f),i.push(this.lexer.yytext),n.push(this.lexer.yylloc),r.push(A[1]),f=null,d?(f=d,d=null):(l=this.lexer.yyleng,s=this.lexer.yytext,a=this.lexer.yylineno,h=this.lexer.yylloc,u>0&&u--);break;case 2:if(_=this.productions_[A[1]][1],b.$=i[i.length-_],b._$={first_line:n[n.length-(_||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(_||1)].first_column,last_column:n[n.length-1].last_column},c&&(b._$.range=[n[n.length-(_||1)].range[0],n[n.length-1].range[1]]),void 0!==(m=this.performAction.call(b,s,l,a,this.yy,A[1],i,n)))return m;_&&(r=r.slice(0,-1*_*2),i=i.slice(0,-1*_),n=n.slice(0,-1*_)),r.push(this.productions_[A[1]][0]),i.push(b.$),n.push(b._$),v=o[r[r.length-2]][r[r.length-1]],r.push(v);break;case 3:return!0}}return!0}},r=(function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var n=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===i.length?this.yylloc.first_column:0)+i[i.length-r.length].length-r[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,r,i,n;this._more||(this.yytext="",this.match="");for(var o=this._currentRules(),s=0;s<o.length&&(!(r=this._input.match(this.rules[o[s]]))||t&&!(r[0].length>t[0].length)||(t=r,i=s,this.options.flex));s++);return t?(n=t[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[i],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,r,i){function n(e,r){return t.yytext=t.yytext.substr(e,t.yyleng-r)}switch(r){case 0:if("\\\\"===t.yytext.slice(-2)?(n(0,1),this.begin("mu")):"\\"===t.yytext.slice(-1)?(n(0,1),this.begin("emu")):this.begin("mu"),t.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),"raw"===this.conditionStack[this.conditionStack.length-1]?15:(t.yytext=t.yytext.substr(5,t.yyleng-9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(t.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return t.yytext=n(1,2).replace(/\\"/g,'"'),80;case 32:return t.yytext=n(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return t.yytext=t.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},e})();return t.lexer=r,e.prototype=t,t.Parser=e,new e})();t.default=r,e.exports=t.default}),(function(e,t,r){"use strict";function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.options=e}function n(e,t,r){void 0===t&&(t=e.length);var i=e[t-1],n=e[t-2];return i?"ContentStatement"===i.type?(n||!r?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(i.original):void 0:r}function o(e,t,r){void 0===t&&(t=-1);var i=e[t+1],n=e[t+2];return i?"ContentStatement"===i.type?(n||!r?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(i.original):void 0:r}function s(e,t,r){var i=e[null==t?0:t+1];if(i&&"ContentStatement"===i.type&&(r||!i.rightStripped)){var n=i.value;i.value=i.value.replace(r?/^\s+/:/^[ \t]*\r?\n?/,""),i.rightStripped=i.value!==n}}function a(e,t,r){var i=e[null==t?e.length-1:t-1];if(i&&"ContentStatement"===i.type&&(r||!i.leftStripped)){var n=i.value;return i.value=i.value.replace(r?/\s+$/:/[ \t]+$/,""),i.leftStripped=i.value!==n,i.leftStripped}}var l=r(1).default;t.__esModule=!0;var u=r(39),h=l(u);i.prototype=new h.default,i.prototype.Program=function(e){var t=!this.options.ignoreStandalone,r=!this.isRootSeen;this.isRootSeen=!0;for(var i=e.body,l=0,u=i.length;l<u;l++){var h=i[l],c=this.accept(h);if(c){var f=n(i,l,r),d=o(i,l,r),p=c.openStandalone&&f,A=c.closeStandalone&&d,m=c.inlineStandalone&&f&&d;c.close&&s(i,l,!0),c.open&&a(i,l,!0),t&&m&&(s(i,l),a(i,l)&&"PartialStatement"===h.type&&(h.indent=/([ \t]+$)/.exec(i[l-1].original)[1])),t&&p&&(s((h.program||h.inverse).body),a(i,l)),t&&A&&(s(i,l),a((h.inverse||h.program).body))}}return e},i.prototype.BlockStatement=i.prototype.DecoratorBlock=i.prototype.PartialBlockStatement=function(e){this.accept(e.program),this.accept(e.inverse);var t=e.program||e.inverse,r=e.program&&e.inverse,i=r,l=r;if(r&&r.chained)for(i=r.body[0].program;l.chained;)l=l.body[l.body.length-1].program;var u={open:e.openStrip.open,close:e.closeStrip.close,openStandalone:o(t.body),closeStandalone:n((i||t).body)};if(e.openStrip.close&&s(t.body,null,!0),r){var h=e.inverseStrip;h.open&&a(t.body,null,!0),h.close&&s(i.body,null,!0),e.closeStrip.open&&a(l.body,null,!0),!this.options.ignoreStandalone&&n(t.body)&&o(i.body)&&(a(t.body),s(i.body))}else e.closeStrip.open&&a(t.body,null,!0);return u},i.prototype.Decorator=i.prototype.MustacheStatement=function(e){return e.strip},i.prototype.PartialStatement=i.prototype.CommentStatement=function(e){var t=e.strip||{};return{inlineStandalone:!0,open:t.open,close:t.close}},t.default=i,e.exports=t.default}),(function(e,t,r){"use strict";function i(){this.parents=[]}function n(e){this.acceptRequired(e,"path"),this.acceptArray(e.params),this.acceptKey(e,"hash")}function o(e){n.call(this,e),this.acceptKey(e,"program"),this.acceptKey(e,"inverse")}function s(e){this.acceptRequired(e,"name"),this.acceptArray(e.params),this.acceptKey(e,"hash")}var a=r(1).default;t.__esModule=!0;var l=r(6),u=a(l);i.prototype={constructor:i,mutating:!1,acceptKey:function(e,t){var r=this.accept(e[t]);if(this.mutating){if(r&&!i.prototype[r.type])throw new u.default('Unexpected node type "'+r.type+'" found when accepting '+t+" on "+e.type);e[t]=r}},acceptRequired:function(e,t){if(this.acceptKey(e,t),!e[t])throw new u.default(e.type+" requires "+t)},acceptArray:function(e){for(var t=0,r=e.length;t<r;t++)this.acceptKey(e,t),e[t]||(e.splice(t,1),t--,r--)},accept:function(e){if(e){if(!this[e.type])throw new u.default("Unknown type: "+e.type,e);this.current&&this.parents.unshift(this.current),this.current=e;var t=this[e.type](e);return this.current=this.parents.shift(),!this.mutating||t?t:!1!==t?e:void 0}},Program:function(e){this.acceptArray(e.body)},MustacheStatement:n,Decorator:n,BlockStatement:o,DecoratorBlock:o,PartialStatement:s,PartialBlockStatement:function(e){s.call(this,e),this.acceptKey(e,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:n,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(e){this.acceptArray(e.pairs)},HashPair:function(e){this.acceptRequired(e,"value")}},t.default=i,e.exports=t.default}),(function(e,t,r){"use strict";function i(e,t){if(t=t.path?t.path.original:t,e.path.original!==t){var r={loc:e.path.loc};throw new m.default(e.path.original+" doesn't match "+t,r)}}function n(e,t){this.source=e,this.start={line:t.first_line,column:t.first_column},this.end={line:t.last_line,column:t.last_column}}function o(e){return/^\[.*\]$/.test(e)?e.substr(1,e.length-2):e}function s(e,t){return{open:"~"===e.charAt(2),close:"~"===t.charAt(t.length-3)}}function a(e){return e.replace(/^\{\{~?\!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function l(e,t,r){r=this.locInfo(r);for(var i=e?"@":"",n=[],o=0,s="",a=0,l=t.length;a<l;a++){var u=t[a].part,h=t[a].original!==u;if(i+=(t[a].separator||"")+u,h||".."!==u&&"."!==u&&"this"!==u)n.push(u);else{if(n.length>0)throw new m.default("Invalid path: "+i,{loc:r});".."===u&&(o++,s+="../")}}return{type:"PathExpression",data:e,depth:o,parts:n,original:i,loc:r}}function u(e,t,r,i,n,o){var s=i.charAt(3)||i.charAt(2),a="{"!==s&&"&"!==s;return{type:/\*/.test(i)?"Decorator":"MustacheStatement",path:e,params:t,hash:r,escaped:a,strip:n,loc:this.locInfo(o)}}function h(e,t,r,n){i(e,r),n=this.locInfo(n);var o={type:"Program",body:t,strip:{},loc:n};return{type:"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:o,openStrip:{},inverseStrip:{},closeStrip:{},loc:n}}function c(e,t,r,n,o,s){n&&n.path&&i(e,n);var a=/\*/.test(e.open);t.blockParams=e.blockParams;var l=void 0,u=void 0;if(r){if(a)throw new m.default("Unexpected inverse block on decorator",r);r.chain&&(r.program.body[0].closeStrip=n.strip),u=r.strip,l=r.program}return o&&(o=l,l=t,t=o),{type:a?"DecoratorBlock":"BlockStatement",path:e.path,params:e.params,hash:e.hash,program:t,inverse:l,openStrip:e.strip,inverseStrip:u,closeStrip:n&&n.strip,loc:this.locInfo(s)}}function f(e,t){if(!t&&e.length){var r=e[0].loc,i=e[e.length-1].loc;r&&i&&(t={source:r.source,start:{line:r.start.line,column:r.start.column},end:{line:i.end.line,column:i.end.column}})}return{type:"Program",body:e,strip:{},loc:t}}function d(e,t,r,n){return i(e,r),{type:"PartialBlockStatement",name:e.path,params:e.params,hash:e.hash,program:t,openStrip:e.strip,closeStrip:r&&r.strip,loc:this.locInfo(n)}}var p=r(1).default;t.__esModule=!0,t.SourceLocation=n,t.id=o,t.stripFlags=s,t.stripComment=a,t.preparePath=l,t.prepareMustache=u,t.prepareRawBlock=h,t.prepareBlock=c,t.prepareProgram=f,t.preparePartialBlock=d;var A=r(6),m=p(A)}),(function(e,t,r){"use strict";function i(){}function n(e,t,r){if(null==e||"string"!=typeof e&&"Program"!==e.type)throw new h.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=r.parse(e,t),n=(new r.Compiler).compile(i,t);return(new r.JavaScriptCompiler).compile(n,t)}function o(e,t,r){function i(){var i=r.parse(e,t),n=(new r.Compiler).compile(i,t),o=(new r.JavaScriptCompiler).compile(n,t,void 0,!0);return r.template(o)}function n(e,t){return o||(o=i()),o.call(this,e,t)}if(void 0===t&&(t={}),null==e||"string"!=typeof e&&"Program"!==e.type)throw new h.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e);t=c.extend({},t),"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var o=void 0;return n._setup=function(e){return o||(o=i()),o._setup(e)},n._child=function(e,t,r,n){return o||(o=i()),o._child(e,t,r,n)},n}function s(e,t){if(e===t)return!0;if(c.isArray(e)&&c.isArray(t)&&e.length===t.length){for(var r=0;r<e.length;r++)if(!s(e[r],t[r]))return!1;return!0}}function a(e){if(!e.path.parts){var t=e.path;e.path={type:"PathExpression",data:!1,depth:0,parts:[t.original+""],original:t.original+"",loc:t.loc}}}var l=r(1).default;t.__esModule=!0,t.Compiler=i,t.precompile=n,t.compile=o;var u=r(6),h=l(u),c=r(5),f=r(35),d=l(f),p=[].slice;i.prototype={compiler:i,equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var r=0;r<t;r++){var i=this.opcodes[r],n=e.opcodes[r];if(i.opcode!==n.opcode||!s(i.args,n.args))return!1}t=this.children.length;for(var r=0;r<t;r++)if(!this.children[r].equals(e.children[r]))return!1;return!0},guid:0,compile:function(e,t){this.sourceNode=[],this.opcodes=[],this.children=[],this.options=t,this.stringParams=t.stringParams,this.trackIds=t.trackIds,t.blockParams=t.blockParams||[];var r=t.knownHelpers;if(t.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},r)for(var i in r)i in r&&(this.options.knownHelpers[i]=r[i]);return this.accept(e)},compileProgram:function(e){var t=new this.compiler,r=t.compile(e,this.options),i=this.guid++;return this.usePartial=this.usePartial||r.usePartial,this.children[i]=r,this.useDepths=this.useDepths||r.useDepths,i},accept:function(e){if(!this[e.type])throw new h.default("Unknown type: "+e.type,e);this.sourceNode.unshift(e);var t=this[e.type](e);return this.sourceNode.shift(),t},Program:function(e){this.options.blockParams.unshift(e.blockParams);for(var t=e.body,r=t.length,i=0;i<r;i++)this.accept(t[i]);return this.options.blockParams.shift(),this.isSimple=1===r,this.blockParams=e.blockParams?e.blockParams.length:0,this},BlockStatement:function(e){a(e);var t=e.program,r=e.inverse;t=t&&this.compileProgram(t),r=r&&this.compileProgram(r);var i=this.classifySexpr(e);"helper"===i?this.helperSexpr(e,t,r):"simple"===i?(this.simpleSexpr(e),this.opcode("pushProgram",t),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("blockValue",e.path.original)):(this.ambiguousSexpr(e,t,r),this.opcode("pushProgram",t),this.opcode("pushProgram",r),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(e){var t=e.program&&this.compileProgram(e.program),r=this.setupFullMustacheParams(e,t,void 0),i=e.path;this.useDecorators=!0,this.opcode("registerDecorator",r.length,i.original)},PartialStatement:function(e){this.usePartial=!0;var t=e.program;t&&(t=this.compileProgram(e.program));var r=e.params;if(r.length>1)throw new h.default("Unsupported number of partial arguments: "+r.length,e);r.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):r.push({type:"PathExpression",parts:[],depth:0}));var i=e.name.original,n="SubExpression"===e.name.type;n&&this.accept(e.name),this.setupFullMustacheParams(e,t,void 0,!0);var o=e.indent||"";this.options.preventIndent&&o&&(this.opcode("appendContent",o),o=""),this.opcode("invokePartial",n,i,o),this.opcode("append")},PartialBlockStatement:function(e){this.PartialStatement(e)},MustacheStatement:function(e){this.SubExpression(e),e.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(e){this.DecoratorBlock(e)},ContentStatement:function(e){e.value&&this.opcode("appendContent",e.value)},CommentStatement:function(){},SubExpression:function(e){a(e);var t=this.classifySexpr(e);"simple"===t?this.simpleSexpr(e):"helper"===t?this.helperSexpr(e):this.ambiguousSexpr(e)},ambiguousSexpr:function(e,t,r){var i=e.path,n=i.parts[0],o=null!=t||null!=r;this.opcode("getContext",i.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",r),i.strict=!0,this.accept(i),this.opcode("invokeAmbiguous",n,o)},simpleSexpr:function(e){var t=e.path;t.strict=!0,this.accept(t),this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,r){var i=this.setupFullMustacheParams(e,t,r),n=e.path,o=n.parts[0];if(this.options.knownHelpers[o])this.opcode("invokeKnownHelper",i.length,o);else{if(this.options.knownHelpersOnly)throw new h.default("You specified knownHelpersOnly, but used the unknown helper "+o,e);n.strict=!0,n.falsy=!0,this.accept(n),this.opcode("invokeHelper",i.length,n.original,d.default.helpers.simpleId(n))}},PathExpression:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0],r=d.default.helpers.scopedId(e),i=!e.depth&&!r&&this.blockParamIndex(t);i?this.opcode("lookupBlockParam",i,e.parts):t?e.data?(this.options.data=!0,this.opcode("lookupData",e.depth,e.parts,e.strict)):this.opcode("lookupOnContext",e.parts,e.falsy,e.strict,r):this.opcode("pushContext")},StringLiteral:function(e){this.opcode("pushString",e.value)},NumberLiteral:function(e){this.opcode("pushLiteral",e.value)},BooleanLiteral:function(e){this.opcode("pushLiteral",e.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(e){var t=e.pairs,r=0,i=t.length;for(this.opcode("pushHash");r<i;r++)this.pushParam(t[r].value);for(;r--;)this.opcode("assignToHash",t[r].key);this.opcode("popHash")},opcode:function(e){this.opcodes.push({opcode:e,args:p.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(e){e&&(this.useDepths=!0)},classifySexpr:function(e){var t=d.default.helpers.simpleId(e.path),r=t&&!!this.blockParamIndex(e.path.parts[0]),i=!r&&d.default.helpers.helperExpression(e),n=!r&&(i||t);if(n&&!i){var o=e.path.parts[0],s=this.options;s.knownHelpers[o]?i=!0:s.knownHelpersOnly&&(n=!1)}return i?"helper":n?"ambiguous":"simple"},pushParams:function(e){for(var t=0,r=e.length;t<r;t++)this.pushParam(e[t])},pushParam:function(e){var t=null!=e.value?e.value:e.original||"";if(this.stringParams)t.replace&&(t=t.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",t,e.type),"SubExpression"===e.type&&this.accept(e);else{if(this.trackIds){var r=void 0;if(!e.parts||d.default.helpers.scopedId(e)||e.depth||(r=this.blockParamIndex(e.parts[0])),r){var i=e.parts.slice(1).join(".");this.opcode("pushId","BlockParam",r,i)}else t=e.original||t,t.replace&&(t=t.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",e.type,t)}this.accept(e)}},setupFullMustacheParams:function(e,t,r,i){var n=e.params;return this.pushParams(n),this.opcode("pushProgram",t),this.opcode("pushProgram",r),e.hash?this.accept(e.hash):this.opcode("emptyHash",i),n},blockParamIndex:function(e){for(var t=0,r=this.options.blockParams.length;t<r;t++){var i=this.options.blockParams[t],n=i&&c.indexOf(i,e);if(i&&n>=0)return[t,n]}}}}),(function(e,t,r){"use strict";function i(e){this.value=e}function n(){}function o(e,t,r,i){var n=t.popStack(),o=0,s=r.length;for(e&&s--;o<s;o++)n=t.nameLookup(n,r[o],i);return e?[t.aliasable("container.strict"),"(",n,", ",t.quotedString(r[o]),")"]:n}var s=r(1).default;t.__esModule=!0;var a=r(4),l=r(6),u=s(l),h=r(5),c=r(43),f=s(c);n.prototype={nameLookup:function(e,t){return n.isValidJavaScriptVariableName(t)?[e,".",t]:[e,"[",JSON.stringify(t),"]"]},depthedLookup:function(e){return[this.aliasable("container.lookup"),'(depths, "',e,'")']},compilerInfo:function(){var e=a.COMPILER_REVISION;return[e,a.REVISION_CHANGES[e]]},appendToBuffer:function(e,t,r){return h.isArray(e)||(e=[e]),e=this.source.wrap(e,t),this.environment.isSimple?["return ",e,";"]:r?["buffer += ",e,";"]:(e.appendToBuffer=!0,e)},initializeBuffer:function(){return this.quotedString("")},compile:function(e,t,r,i){this.environment=e,this.options=t,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!i,this.name=this.environment.name,this.isChild=!!r,this.context=r||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(e,t),this.useDepths=this.useDepths||e.useDepths||e.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||e.useBlockParams;var n=e.opcodes,o=void 0,s=void 0,a=void 0,l=void 0;for(a=0,l=n.length;a<l;a++)o=n[a],this.source.currentLocation=o.loc,s=s||o.loc,this[o.opcode].apply(this,o.args);if(this.source.currentLocation=s,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new u.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend("var decorators = container.decorators;\n"),this.decorators.push("return fn;"),i?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend("function(fn, props, container, depth0, data, blockParams, depths) {\n"),this.decorators.push("}\n"),this.decorators=this.decorators.merge()));var h=this.createFunctionContext(i);if(this.isChild)return h;var c={compiler:this.compilerInfo(),main:h};this.decorators&&(c.main_d=this.decorators,c.useDecorators=!0);var f=this.context,d=f.programs,p=f.decorators;for(a=0,l=d.length;a<l;a++)d[a]&&(c[a]=d[a],p[a]&&(c[a+"_d"]=p[a],c.useDecorators=!0));return this.environment.usePartial&&(c.usePartial=!0),this.options.data&&(c.useData=!0),this.useDepths&&(c.useDepths=!0),this.useBlockParams&&(c.useBlockParams=!0),this.options.compat&&(c.compat=!0),
- i?c.compilerOptions=this.options:(c.compiler=JSON.stringify(c.compiler),this.source.currentLocation={start:{line:1,column:0}},c=this.objectLiteral(c),t.srcName?(c=c.toStringWithSourceMap({file:t.destName}),c.map=c.map&&c.map.toString()):c=c.toString()),c},preamble:function(){this.lastContext=0,this.source=new f.default(this.options.srcName),this.decorators=new f.default(this.options.srcName)},createFunctionContext:function(e){var t="",r=this.stackVars.concat(this.registers.list);r.length>0&&(t+=", "+r.join(", "));var i=0;for(var n in this.aliases){var o=this.aliases[n];this.aliases.hasOwnProperty(n)&&o.children&&o.referenceCount>1&&(t+=", alias"+ ++i+"="+n,o.children[0]="alias"+i)}var s=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&s.push("blockParams"),this.useDepths&&s.push("depths");var a=this.mergeSource(t);return e?(s.push(a),Function.apply(this,s)):this.source.wrap(["function(",s.join(","),") {\n ",a,"}"])},mergeSource:function(e){var t=this.environment.isSimple,r=!this.forceBuffer,i=void 0,n=void 0,o=void 0,s=void 0;return this.source.each((function(e){e.appendToBuffer?(o?e.prepend(" + "):o=e,s=e):(o&&(n?o.prepend("buffer += "):i=!0,s.add(";"),o=s=void 0),n=!0,t||(r=!1))})),r?o?(o.prepend("return "),s.add(";")):n||this.source.push('return "";'):(e+=", buffer = "+(i?"":this.initializeBuffer()),o?(o.prepend("return buffer + "),s.add(";")):this.source.push("return buffer;")),e&&this.source.prepend("var "+e.substring(2)+(i?"":";\n")),this.source.merge()},blockValue:function(e){var t=this.aliasable("helpers.blockHelperMissing"),r=[this.contextName(0)];this.setupHelperArgs(e,0,r);var i=this.popStack();r.splice(1,0,i),this.push(this.source.functionCall(t,"call",r))},ambiguousBlockValue:function(){var e=this.aliasable("helpers.blockHelperMissing"),t=[this.contextName(0)];this.setupHelperArgs("",0,t,!0),this.flushInline();var r=this.topStack();t.splice(1,0,r),this.pushSource(["if (!",this.lastHelper,") { ",r," = ",this.source.functionCall(e,"call",t),"}"])},appendContent:function(e){this.pendingContent?e=this.pendingContent+e:this.pendingLocation=this.source.currentLocation,this.pendingContent=e},append:function(){if(this.isInline())this.replaceStack((function(e){return[" != null ? ",e,' : ""']})),this.pushSource(this.appendToBuffer(this.popStack()));else{var e=this.popStack();this.pushSource(["if (",e," != null) { ",this.appendToBuffer(e,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(e){this.lastContext=e},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(e,t,r,i){var n=0;i||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(e[n++])),this.resolvePath("context",e,n,t,r)},lookupBlockParam:function(e,t){this.useBlockParams=!0,this.push(["blockParams[",e[0],"][",e[1],"]"]),this.resolvePath("context",t,1)},lookupData:function(e,t,r){e?this.pushStackLiteral("container.data(data, "+e+")"):this.pushStackLiteral("data"),this.resolvePath("data",t,0,!0,r)},resolvePath:function(e,t,r,i,n){var s=this;if(this.options.strict||this.options.assumeObjects)return void this.push(o(this.options.strict&&n,this,t,e));for(var a=t.length;r<a;r++)this.replaceStack((function(n){var o=s.nameLookup(n,t[r],e);return i?[" && ",o]:[" != null ? ",o," : ",n]}))},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(e,t){this.pushContext(),this.pushString(t),"SubExpression"!==t&&("string"==typeof e?this.pushString(e):this.pushStackLiteral(e))},emptyHash:function(e){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(e?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(e.ids)),this.stringParams&&(this.push(this.objectLiteral(e.contexts)),this.push(this.objectLiteral(e.types))),this.push(this.objectLiteral(e.values))},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){null!=e?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},registerDecorator:function(e,t){var r=this.nameLookup("decorators",t,"decorator"),i=this.setupHelperArgs(t,e);this.decorators.push(["fn = ",this.decorators.functionCall(r,"",["fn","props","container",i])," || fn;"])},invokeHelper:function(e,t,r){var i=this.popStack(),n=this.setupHelper(e,t),o=r?[n.name," || "]:"",s=["("].concat(o,i);this.options.strict||s.push(" || ",this.aliasable("helpers.helperMissing")),s.push(")"),this.push(this.source.functionCall(s,"call",n.callParams))},invokeKnownHelper:function(e,t){var r=this.setupHelper(e,t);this.push(this.source.functionCall(r.name,"call",r.callParams))},invokeAmbiguous:function(e,t){this.useRegister("helper");var r=this.popStack();this.emptyHash();var i=this.setupHelper(0,e,t),n=this.lastHelper=this.nameLookup("helpers",e,"helper"),o=["(","(helper = ",n," || ",r,")"];this.options.strict||(o[0]="(helper = ",o.push(" != null ? helper : ",this.aliasable("helpers.helperMissing"))),this.push(["(",o,i.paramsInit?["),(",i.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",i.callParams)," : helper))"])},invokePartial:function(e,t,r){var i=[],n=this.setupParams(t,1,i);e&&(t=this.popStack(),delete n.name),r&&(n.indent=JSON.stringify(r)),n.helpers="helpers",n.partials="partials",n.decorators="container.decorators",e?i.unshift(t):i.unshift(this.nameLookup("partials",t,"partial")),this.options.compat&&(n.depths="depths"),n=this.objectLiteral(n),i.push(n),this.push(this.source.functionCall("container.invokePartial","",i))},assignToHash:function(e){var t=this.popStack(),r=void 0,i=void 0,n=void 0;this.trackIds&&(n=this.popStack()),this.stringParams&&(i=this.popStack(),r=this.popStack());var o=this.hash;r&&(o.contexts[e]=r),i&&(o.types[e]=i),n&&(o.ids[e]=n),o.values[e]=t},pushId:function(e,t,r){"BlockParam"===e?this.pushStackLiteral("blockParams["+t[0]+"].path["+t[1]+"]"+(r?" + "+JSON.stringify("."+r):"")):"PathExpression"===e?this.pushString(t):"SubExpression"===e?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:n,compileChildren:function(e,t){for(var r=e.children,i=void 0,n=void 0,o=0,s=r.length;o<s;o++){i=r[o],n=new this.compiler;var a=this.matchExistingProgram(i);if(null==a){this.context.programs.push("");var l=this.context.programs.length;i.index=l,i.name="program"+l,this.context.programs[l]=n.compile(i,t,this.context,!this.precompile),this.context.decorators[l]=n.decorators,this.context.environments[l]=i,this.useDepths=this.useDepths||n.useDepths,this.useBlockParams=this.useBlockParams||n.useBlockParams,i.useDepths=this.useDepths,i.useBlockParams=this.useBlockParams}else i.index=a.index,i.name="program"+a.index,this.useDepths=this.useDepths||a.useDepths,this.useBlockParams=this.useBlockParams||a.useBlockParams}},matchExistingProgram:function(e){for(var t=0,r=this.context.environments.length;t<r;t++){var i=this.context.environments[t];if(i&&i.equals(e))return i}},programExpression:function(e){var t=this.environment.children[e],r=[t.index,"data",t.blockParams];return(this.useBlockParams||this.useDepths)&&r.push("blockParams"),this.useDepths&&r.push("depths"),"container.program("+r.join(", ")+")"},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},push:function(e){return e instanceof i||(e=this.source.wrap(e)),this.inlineStack.push(e),e},pushStackLiteral:function(e){this.push(new i(e))},pushSource:function(e){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),e&&this.source.push(e)},replaceStack:function(e){var t=["("],r=void 0,n=void 0,o=void 0;if(!this.isInline())throw new u.default("replaceStack on non-inline");var s=this.popStack(!0);if(s instanceof i)r=[s.value],t=["(",r],o=!0;else{n=!0;var a=this.incrStack();t=["((",this.push(a)," = ",s,")"],r=this.topStack()}var l=e.call(this,r);o||this.popStack(),n&&this.stackSlot--,this.push(t.concat(l,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;this.inlineStack=[];for(var t=0,r=e.length;t<r;t++){var n=e[t];if(n instanceof i)this.compileStack.push(n);else{var o=this.incrStack();this.pushSource([o," = ",n,";"]),this.compileStack.push(o)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),r=(t?this.inlineStack:this.compileStack).pop();if(!e&&r instanceof i)return r.value;if(!t){if(!this.stackSlot)throw new u.default("Invalid stack pop");this.stackSlot--}return r},topStack:function(){var e=this.isInline()?this.inlineStack:this.compileStack,t=e[e.length-1];return t instanceof i?t.value:t},contextName:function(e){return this.useDepths&&e?"depths["+e+"]":"depth"+e},quotedString:function(e){return this.source.quotedString(e)},objectLiteral:function(e){return this.source.objectLiteral(e)},aliasable:function(e){var t=this.aliases[e];return t?(t.referenceCount++,t):(t=this.aliases[e]=this.source.wrap(e),t.aliasable=!0,t.referenceCount=1,t)},setupHelper:function(e,t,r){var i=[];return{params:i,paramsInit:this.setupHelperArgs(t,e,i,r),name:this.nameLookup("helpers",t,"helper"),callParams:[this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})")].concat(i)}},setupParams:function(e,t,r){var i={},n=[],o=[],s=[],a=!r,l=void 0;a&&(r=[]),i.name=this.quotedString(e),i.hash=this.popStack(),this.trackIds&&(i.hashIds=this.popStack()),this.stringParams&&(i.hashTypes=this.popStack(),i.hashContexts=this.popStack());var u=this.popStack(),h=this.popStack();(h||u)&&(i.fn=h||"container.noop",i.inverse=u||"container.noop");for(var c=t;c--;)l=this.popStack(),r[c]=l,this.trackIds&&(s[c]=this.popStack()),this.stringParams&&(o[c]=this.popStack(),n[c]=this.popStack());return a&&(i.args=this.source.generateArray(r)),this.trackIds&&(i.ids=this.source.generateArray(s)),this.stringParams&&(i.types=this.source.generateArray(o),i.contexts=this.source.generateArray(n)),this.options.data&&(i.data="data"),this.useBlockParams&&(i.blockParams="blockParams"),i},setupHelperArgs:function(e,t,r,i){var n=this.setupParams(e,t,r);return n=this.objectLiteral(n),i?(this.useRegister("options"),r.push("options"),["options=",n]):r?(r.push(n),""):n}},(function(){for(var e="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),t=n.RESERVED_WORDS={},r=0,i=e.length;r<i;r++)t[e[r]]=!0})(),n.isValidJavaScriptVariableName=function(e){return!n.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)},t.default=n,e.exports=t.default}),(function(e,t,r){"use strict";function i(e,t,r){if(o.isArray(e)){for(var i=[],n=0,s=e.length;n<s;n++)i.push(t.wrap(e[n],r));return i}return"boolean"==typeof e||"number"==typeof e?e+"":e}function n(e){this.srcFile=e,this.source=[]}t.__esModule=!0;var o=r(5),s=void 0;try{}catch(e){}s||(s=function(e,t,r,i){this.src="",i&&this.add(i)},s.prototype={add:function(e){o.isArray(e)&&(e=e.join("")),this.src+=e},prepend:function(e){o.isArray(e)&&(e=e.join("")),this.src=e+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}}),n.prototype={isEmpty:function(){return!this.source.length},prepend:function(e,t){this.source.unshift(this.wrap(e,t))},push:function(e,t){this.source.push(this.wrap(e,t))},merge:function(){var e=this.empty();return this.each((function(t){e.add([" ",t,"\n"])})),e},each:function(e){for(var t=0,r=this.source.length;t<r;t++)e(this.source[t])},empty:function(){var e=this.currentLocation||{start:{}};return new s(e.start.line,e.start.column,this.srcFile)},wrap:function(e){var t=arguments.length<=1||void 0===arguments[1]?this.currentLocation||{start:{}}:arguments[1];return e instanceof s?e:(e=i(e,this,t),new s(t.start.line,t.start.column,this.srcFile,e))},functionCall:function(e,t,r){return r=this.generateList(r),this.wrap([e,t?"."+t+"(":"(",r,")"])},quotedString:function(e){return'"'+(e+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(e){var t=[];for(var r in e)if(e.hasOwnProperty(r)){var n=i(e[r],this);"undefined"!==n&&t.push([this.quotedString(r),":",n])}var o=this.generateList(t);return o.prepend("{"),o.add("}"),o},generateList:function(e){for(var t=this.empty(),r=0,n=e.length;r<n;r++)r&&t.add(","),t.add(i(e[r],this));return t},generateArray:function(e){var t=this.generateList(e);return t.prepend("["),t.add("]"),t}},t.default=n,e.exports=t.default})])}))}),(function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(function(){function e(e){var t=this;this._templateManager=e,this._callbacksContainer={},this._templateManager.onEventTriggered.add((function(e){t._eventTriggered(e)}))}return e.prototype.registerCallback=function(e,t,r,i){this._callbacksContainer[e]||(this._callbacksContainer[e]=[]),this._callbacksContainer[e].push({eventType:r,callback:t,selector:i})},e.prototype.unregisterCallback=function(e,t,r,i){var n=this._callbacksContainer[e]||[];this._callbacksContainer[e]=n.filter((function(e){return!(e.eventType&&e.eventType!==r||e.selector&&e.selector!==i)}))},e.prototype._eventTriggered=function(e){var t=e.template.name,r=e.event.type,i=e.selector;(this._callbacksContainer[t]||[]).filter((function(e){return!(e.eventType&&e.eventType!==r||e.selector&&e.selector!==i)})).forEach((function(t){t.callback(e)}))},e.prototype.dispose=function(){this._callbacksContainer={}},e})();t.EventManager=i}),(function(e,t,r){!(function(t,r){e.exports=r()})(0,(function(){"use strict";function e(e,t){t=t||Object.create(null);var r=document.createEvent("Event");r.initEvent(e,t.bubbles||!1,t.cancelable||!1);for(var i,n=2;n<u.length;n++)i=u[n],r[i]=t[i]||h[n];r.buttons=t.buttons||0;var o=0;return o=t.pressure&&r.buttons?t.pressure:r.buttons?.5:0,r.x=r.clientX,r.y=r.clientY,r.pointerId=t.pointerId||0,r.width=t.width||0,r.height=t.height||0,r.pressure=o,r.tiltX=t.tiltX||0,r.tiltY=t.tiltY||0,r.twist=t.twist||0,r.tangentialPressure=t.tangentialPressure||0,r.pointerType=t.pointerType||"",r.hwTimestamp=t.hwTimestamp||0,r.isPrimary=t.isPrimary||!1,r}function t(){this.array=[],this.size=0}function r(e,t,r,i){this.addCallback=e.bind(i),this.removeCallback=t.bind(i),this.changedCallback=r.bind(i),T&&(this.observer=new T(this.mutationWatcher.bind(this)))}function i(e){return"body /shadow-deep/ "+n(e)}function n(e){return'[touch-action="'+e+'"]'}function o(e){return"{ -ms-touch-action: "+e+"; touch-action: "+e+"; }"}function s(e){if(!g.pointermap.has(e)){var t=new Error("InvalidPointerId");throw t.name="InvalidPointerId",t}}function a(e){for(var t=e.parentNode;t&&t!==e.ownerDocument;)t=t.parentNode;if(!t){var r=new Error("InvalidStateError");throw r.name="InvalidStateError",r}}function l(e){return 0!==g.pointermap.get(e).buttons}var u=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],h=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],c=window.Map&&window.Map.prototype.forEach,f=c?Map:t;t.prototype={set:function(e,t){if(void 0===t)return this.delete(e);this.has(e)||this.size++,this.array[e]=t},has:function(e){return void 0!==this.array[e]},delete:function(e){this.has(e)&&(delete this.array[e],this.size--)},get:function(e){return this.array[e]},clear:function(){this.array.length=0,this.size=0},forEach:function(e,t){return this.array.forEach((function(r,i){e.call(t,r,i,this)}),this)}};var d=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp"],p=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0],A={pointerover:1,pointerout:1,pointerenter:1,pointerleave:1},m="undefined"!=typeof SVGElementInstance,g={pointermap:new f,eventMap:Object.create(null),captureInfo:Object.create(null),eventSources:Object.create(null),eventSourceList:[],registerSource:function(e,t){var r=t,i=r.events;i&&(i.forEach((function(e){r[e]&&(this.eventMap[e]=r[e].bind(r))}),this),this.eventSources[e]=r,this.eventSourceList.push(r))},register:function(e){for(var t,r=this.eventSourceList.length,i=0;i<r&&(t=this.eventSourceList[i]);i++)t.register.call(t,e)},unregister:function(e){for(var t,r=this.eventSourceList.length,i=0;i<r&&(t=this.eventSourceList[i]);i++)t.unregister.call(t,e)},contains:function(e,t){try{return e.contains(t)}catch(e){return!1}},down:function(e){e.bubbles=!0,this.fireEvent("pointerdown",e)},move:function(e){e.bubbles=!0,this.fireEvent("pointermove",e)},up:function(e){e.bubbles=!0,this.fireEvent("pointerup",e)},enter:function(e){e.bubbles=!1,this.fireEvent("pointerenter",e)},leave:function(e){e.bubbles=!1,this.fireEvent("pointerleave",e)},over:function(e){e.bubbles=!0,this.fireEvent("pointerover",e)},out:function(e){e.bubbles=!0,this.fireEvent("pointerout",e)},cancel:function(e){e.bubbles=!0,this.fireEvent("pointercancel",e)},leaveOut:function(e){this.out(e),this.propagate(e,this.leave,!1)},enterOver:function(e){this.over(e),this.propagate(e,this.enter,!0)},eventHandler:function(e){if(!e._handledByPE){var t=e.type,r=this.eventMap&&this.eventMap[t];r&&r(e),e._handledByPE=!0}},listen:function(e,t){t.forEach((function(t){this.addEvent(e,t)}),this)},unlisten:function(e,t){t.forEach((function(t){this.removeEvent(e,t)}),this)},addEvent:function(e,t){e.addEventListener(t,this.boundHandler)},removeEvent:function(e,t){e.removeEventListener(t,this.boundHandler)},makeEvent:function(t,r){this.captureInfo[r.pointerId]&&(r.relatedTarget=null);var i=new e(t,r);return r.preventDefault&&(i.preventDefault=r.preventDefault),i._target=i._target||r.target,i},fireEvent:function(e,t){var r=this.makeEvent(e,t);return this.dispatchEvent(r)},cloneEvent:function(e){for(var t,r=Object.create(null),i=0;i<d.length;i++)t=d[i],r[t]=e[t]||p[i],!m||"target"!==t&&"relatedTarget"!==t||r[t]instanceof SVGElementInstance&&(r[t]=r[t].correspondingUseElement);return e.preventDefault&&(r.preventDefault=function(){e.preventDefault()}),r},getTarget:function(e){var t=this.captureInfo[e.pointerId];return t?e._target!==t&&e.type in A?void 0:t:e._target},propagate:function(e,t,r){for(var i=e.target,n=[];i!==document&&!i.contains(e.relatedTarget);)if(n.push(i),!(i=i.parentNode))return;r&&n.reverse(),n.forEach((function(r){e.target=r,t.call(this,e)}),this)},setCapture:function(t,r,i){this.captureInfo[t]&&this.releaseCapture(t,i),this.captureInfo[t]=r,this.implicitRelease=this.releaseCapture.bind(this,t,i),document.addEventListener("pointerup",this.implicitRelease),document.addEventListener("pointercancel",this.implicitRelease);var n=new e("gotpointercapture");n.pointerId=t,n._target=r,i||this.asyncDispatchEvent(n)},releaseCapture:function(t,r){var i=this.captureInfo[t];if(i){this.captureInfo[t]=void 0,document.removeEventListener("pointerup",this.implicitRelease),document.removeEventListener("pointercancel",this.implicitRelease);var n=new e("lostpointercapture");n.pointerId=t,n._target=i,r||this.asyncDispatchEvent(n)}},dispatchEvent:function(e){var t=this.getTarget(e);if(t)return t.dispatchEvent(e)},asyncDispatchEvent:function(e){requestAnimationFrame(this.dispatchEvent.bind(this,e))}};g.boundHandler=g.eventHandler.bind(g);var _={shadow:function(e){if(e)return e.shadowRoot||e.webkitShadowRoot},canTarget:function(e){return e&&Boolean(e.elementFromPoint)},targetingShadow:function(e){var t=this.shadow(e);if(this.canTarget(t))return t},olderShadow:function(e){var t=e.olderShadowRoot;if(!t){var r=e.querySelector("shadow");r&&(t=r.olderShadowRoot)}return t},allShadows:function(e){for(var t=[],r=this.shadow(e);r;)t.push(r),r=this.olderShadow(r);return t},searchRoot:function(e,t,r){if(e){var i,n,o=e.elementFromPoint(t,r);for(n=this.targetingShadow(o);n;){if(i=n.elementFromPoint(t,r)){var s=this.targetingShadow(i);return this.searchRoot(s,t,r)||i}n=this.olderShadow(n)}return o}},owner:function(e){for(var t=e;t.parentNode;)t=t.parentNode;return t.nodeType!==Node.DOCUMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(t=document),t},findTarget:function(e){var t=e.clientX,r=e.clientY,i=this.owner(e.target);return i.elementFromPoint(t,r)||(i=document),this.searchRoot(i,t,r)}},v=Array.prototype.forEach.call.bind(Array.prototype.forEach),y=Array.prototype.map.call.bind(Array.prototype.map),b=Array.prototype.slice.call.bind(Array.prototype.slice),E=Array.prototype.filter.call.bind(Array.prototype.filter),T=window.MutationObserver||window.WebKitMutationObserver,x={subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0,attributeFilter:["touch-action"]};r.prototype={watchSubtree:function(e){this.observer&&_.canTarget(e)&&this.observer.observe(e,x)},enableOnSubtree:function(e){this.watchSubtree(e),e===document&&"complete"!==document.readyState?this.installOnLoad():this.installNewSubtree(e)},installNewSubtree:function(e){v(this.findElements(e),this.addElement,this)},findElements:function(e){return e.querySelectorAll?e.querySelectorAll("[touch-action]"):[]},removeElement:function(e){this.removeCallback(e)},addElement:function(e){this.addCallback(e)},elementChanged:function(e,t){this.changedCallback(e,t)},concatLists:function(e,t){return e.concat(b(t))},installOnLoad:function(){document.addEventListener("readystatechange",function(){"complete"===document.readyState&&this.installNewSubtree(document)}.bind(this))},isElement:function(e){return e.nodeType===Node.ELEMENT_NODE},flattenMutationTree:function(e){var t=y(e,this.findElements,this);return t.push(E(e,this.isElement)),t.reduce(this.concatLists,[])},mutationWatcher:function(e){e.forEach(this.mutationHandler,this)},mutationHandler:function(e){if("childList"===e.type){this.flattenMutationTree(e.addedNodes).forEach(this.addElement,this);this.flattenMutationTree(e.removedNodes).forEach(this.removeElement,this)}else"attributes"===e.type&&this.elementChanged(e.target,e.oldValue)}};var M=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]}],C="",P=window.PointerEvent||window.MSPointerEvent,S=!window.ShadowDOMPolyfill&&document.head.createShadowRoot,R=g.pointermap,O=[1,4,2,8,16],D=!1;try{D=1===new MouseEvent("test",{buttons:1}).buttons}catch(e){}var w,I={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup","mouseover","mouseout"],register:function(e){g.listen(e,this.events)},unregister:function(e){g.unlisten(e,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(e){for(var t,r=this.lastTouches,i=e.clientX,n=e.clientY,o=0,s=r.length;o<s&&(t=r[o]);o++){var a=Math.abs(i-t.x),l=Math.abs(n-t.y);if(a<=25&&l<=25)return!0}},prepareEvent:function(e){var t=g.cloneEvent(e),r=t.preventDefault;return t.preventDefault=function(){e.preventDefault(),r()},t.pointerId=this.POINTER_ID,t.isPrimary=!0,t.pointerType=this.POINTER_TYPE,t},prepareButtonsForMove:function(e,t){var r=R.get(this.POINTER_ID);0!==t.which&&r?e.buttons=r.buttons:e.buttons=0,t.buttons=e.buttons},mousedown:function(e){if(!this.isEventSimulatedFromTouch(e)){var t=R.get(this.POINTER_ID),r=this.prepareEvent(e);D||(r.buttons=O[r.button],t&&(r.buttons|=t.buttons),e.buttons=r.buttons),R.set(this.POINTER_ID,e),t&&0!==t.buttons?g.move(r):g.down(r)}},mousemove:function(e){if(!this.isEventSimulatedFromTouch(e)){var t=this.prepareEvent(e);D||this.prepareButtonsForMove(t,e),t.button=-1,R.set(this.POINTER_ID,e),g.move(t)}},mouseup:function(e){if(!this.isEventSimulatedFromTouch(e)){var t=R.get(this.POINTER_ID),r=this.prepareEvent(e);if(!D){var i=O[r.button];r.buttons=t?t.buttons&~i:0,e.buttons=r.buttons}R.set(this.POINTER_ID,e),r.buttons&=~O[r.button],0===r.buttons?g.up(r):g.move(r)}},mouseover:function(e){if(!this.isEventSimulatedFromTouch(e)){var t=this.prepareEvent(e);D||this.prepareButtonsForMove(t,e),t.button=-1,R.set(this.POINTER_ID,e),g.enterOver(t)}},mouseout:function(e){if(!this.isEventSimulatedFromTouch(e)){var t=this.prepareEvent(e);D||this.prepareButtonsForMove(t,e),t.button=-1,g.leaveOut(t)}},cancel:function(e){var t=this.prepareEvent(e);g.cancel(t),this.deactivateMouse()},deactivateMouse:function(){R.delete(this.POINTER_ID)}},L=g.captureInfo,B=_.findTarget.bind(_),F=_.allShadows.bind(_),N=g.pointermap,U={events:["touchstart","touchmove","touchend","touchcancel"],register:function(e){w.enableOnSubtree(e)},unregister:function(){},elementAdded:function(e){var t=e.getAttribute("touch-action"),r=this.touchActionToScrollType(t);r&&(e._scrollType=r,g.listen(e,this.events),F(e).forEach((function(e){e._scrollType=r,g.listen(e,this.events)}),this))},elementRemoved:function(e){e._scrollType=void 0,g.unlisten(e,this.events),F(e).forEach((function(e){e._scrollType=void 0,g.unlisten(e,this.events)}),this)},elementChanged:function(e,t){var r=e.getAttribute("touch-action"),i=this.touchActionToScrollType(r),n=this.touchActionToScrollType(t);i&&n?(e._scrollType=i,F(e).forEach((function(e){e._scrollType=i}),this)):n?this.elementRemoved(e):i&&this.elementAdded(e)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y",SCROLLER:/^(?:pan-x pan-y)|(?:pan-y pan-x)|auto$/},touchActionToScrollType:function(e){var t=e,r=this.scrollTypes;return"none"===t?"none":t===r.XSCROLLER?"X":t===r.YSCROLLER?"Y":r.SCROLLER.exec(t)?"XY":void 0},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(e){return this.firstTouch===e.identifier},setPrimaryTouch:function(e){(0===N.size||1===N.size&&N.has(1))&&(this.firstTouch=e.identifier,this.firstXY={X:e.clientX,Y:e.clientY},this.scrolling=!1,this.cancelResetClickCount())},removePrimaryPointer:function(e){e.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var e=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(e,200)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(e){var t=0;return"touchstart"!==e&&"touchmove"!==e||(t=1),t},touchToPointer:function(e){var t=this.currentTouchEvent,r=g.cloneEvent(e),i=r.pointerId=e.identifier+2;r.target=L[i]||B(r),r.bubbles=!0,r.cancelable=!0,r.detail=this.clickCount,r.button=0,r.buttons=this.typeToButtons(t.type),r.width=2*(e.radiusX||e.webkitRadiusX||0),r.height=2*(e.radiusY||e.webkitRadiusY||0),r.pressure=e.force||e.webkitForce||.5,r.isPrimary=this.isPrimaryTouch(e),r.pointerType=this.POINTER_TYPE,r.altKey=t.altKey,r.ctrlKey=t.ctrlKey,r.metaKey=t.metaKey,r.shiftKey=t.shiftKey;var n=this;return r.preventDefault=function(){n.scrolling=!1,n.firstXY=null,t.preventDefault()},r},processTouches:function(e,t){var r=e.changedTouches;this.currentTouchEvent=e;for(var i,n=0;n<r.length;n++)i=r[n],t.call(this,this.touchToPointer(i))},shouldScroll:function(e){if(this.firstXY){var t,r=e.currentTarget._scrollType;if("none"===r)t=!1;else if("XY"===r)t=!0;else{var i=e.changedTouches[0],n=r,o="Y"===r?"X":"Y",s=Math.abs(i["client"+n]-this.firstXY[n]),a=Math.abs(i["client"+o]-this.firstXY[o]);t=s>=a}return this.firstXY=null,t}},findTouch:function(e,t){for(var r,i=0,n=e.length;i<n&&(r=e[i]);i++)if(r.identifier===t)return!0},vacuumTouches:function(e){var t=e.touches;if(N.size>=t.length){var r=[];N.forEach((function(e,i){if(1!==i&&!this.findTouch(t,i-2)){var n=e.out;r.push(n)}}),this),r.forEach(this.cancelOut,this)}},touchstart:function(e){this.vacuumTouches(e),this.setPrimaryTouch(e.changedTouches[0]),this.dedupSynthMouse(e),this.scrolling||(this.clickCount++,this.processTouches(e,this.overDown))},overDown:function(e){N.set(e.pointerId,{target:e.target,out:e,outTarget:e.target}),g.enterOver(e),g.down(e)},touchmove:function(e){this.scrolling||(this.shouldScroll(e)?(this.scrolling=!0,this.touchcancel(e)):(e.preventDefault(),this.processTouches(e,this.moveOverOut)))},moveOverOut:function(e){var t=e,r=N.get(t.pointerId);if(r){var i=r.out,n=r.outTarget;g.move(t),i&&n!==t.target&&(i.relatedTarget=t.target,t.relatedTarget=n,i.target=n,t.target?(g.leaveOut(i),g.enterOver(t)):(t.target=n,t.relatedTarget=null,this.cancelOut(t))),r.out=t,r.outTarget=t.target}},touchend:function(e){this.dedupSynthMouse(e),this.processTouches(e,this.upOut)},upOut:function(e){this.scrolling||(g.up(e),g.leaveOut(e)),this.cleanUpPointer(e)},touchcancel:function(e){this.processTouches(e,this.cancelOut)},cancelOut:function(e){g.cancel(e),g.leaveOut(e),this.cleanUpPointer(e)},cleanUpPointer:function(e){N.delete(e.pointerId),this.removePrimaryPointer(e)},dedupSynthMouse:function(e){var t=I.lastTouches,r=e.changedTouches[0];if(this.isPrimaryTouch(r)){var i={x:r.clientX,y:r.clientY};t.push(i);var n=function(e,t){var r=e.indexOf(t);r>-1&&e.splice(r,1)}.bind(null,t,i);setTimeout(n,2500)}}};w=new r(U.elementAdded,U.elementRemoved,U.elementChanged,U);var V,k,G,z=g.pointermap,H=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,j={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerOut","MSPointerOver","MSPointerCancel","MSGotPointerCapture","MSLostPointerCapture"],register:function(e){g.listen(e,this.events)},unregister:function(e){g.unlisten(e,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(e){var t=e;return H&&(t=g.cloneEvent(e),t.pointerType=this.POINTER_TYPES[e.pointerType]),t},cleanup:function(e){z.delete(e)},MSPointerDown:function(e){z.set(e.pointerId,e);var t=this.prepareEvent(e);g.down(t)},MSPointerMove:function(e){var t=this.prepareEvent(e);g.move(t)},MSPointerUp:function(e){var t=this.prepareEvent(e);g.up(t),this.cleanup(e.pointerId)},MSPointerOut:function(e){var t=this.prepareEvent(e);g.leaveOut(t)},MSPointerOver:function(e){var t=this.prepareEvent(e);g.enterOver(t)},MSPointerCancel:function(e){var t=this.prepareEvent(e);g.cancel(t),this.cleanup(e.pointerId)},MSLostPointerCapture:function(e){var t=g.makeEvent("lostpointercapture",e);g.dispatchEvent(t)},MSGotPointerCapture:function(e){var t=g.makeEvent("gotpointercapture",e);g.dispatchEvent(t)}},W=window.navigator;return W.msPointerEnabled?(V=function(e){s(e),a(this),l(e)&&(g.setCapture(e,this,!0),this.msSetPointerCapture(e))},k=function(e){s(e),g.releaseCapture(e,!0),this.msReleasePointerCapture(e)}):(V=function(e){s(e),a(this),l(e)&&g.setCapture(e,this)},k=function(e){s(e),g.releaseCapture(e)}),G=function(e){return!!g.captureInfo[e]},(function(){if(P){M.forEach((function(e){String(e)===e?(C+=n(e)+o(e)+"\n",S&&(C+=i(e)+o(e)+"\n")):(C+=e.selectors.map(n)+o(e.rule)+"\n",S&&(C+=e.selectors.map(i)+o(e.rule)+"\n"))}));var e=document.createElement("style");e.textContent=C,document.head.appendChild(e)}})(),(function(){if(!window.PointerEvent){if(window.PointerEvent=e,window.navigator.msPointerEnabled){var t=window.navigator.msMaxTouchPoints;Object.defineProperty(window.navigator,"maxTouchPoints",{value:t,enumerable:!0}),g.registerSource("ms",j)
- }else Object.defineProperty(window.navigator,"maxTouchPoints",{value:0,enumerable:!0}),g.registerSource("mouse",I),void 0!==window.ontouchstart&&g.registerSource("touch",U);g.register(document)}})(),(function(){window.Element&&!Element.prototype.setPointerCapture&&Object.defineProperties(Element.prototype,{setPointerCapture:{value:V},releasePointerCapture:{value:k},hasPointerCapture:{value:G}})})(),{dispatcher:g,Installer:r,PointerEvent:e,PointerMap:f,targetFinding:_}}))}),(function(e,t,r){"use strict";function i(){function e(t){document.removeEventListener("DOMContentLoaded",e),a.viewerGlobals.disableInit||n()}document.addEventListener("DOMContentLoaded",e)}function n(e){void 0===e&&(e="babylon");for(var t=document.querySelectorAll(e),r=0;r<t.length;++r){var i=t.item(r),n=s.mapperManager.getMapper("dom"),a=n.map(i);new o.DefaultViewer(i,a)}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(8),s=r(3),a=r(4);t.initListeners=i,t.InitTags=n})])}));
|