diff --git a/dist/preview release/babylon.js b/dist/preview release/babylon.js index 0752c909c8c..43b5bd238cc 100644 --- a/dist/preview release/babylon.js +++ b/dist/preview release/babylon.js @@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o=function(){return(o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function s(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}c((n=n.apply(e,t||[])).next())})}function c(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"morphTargetManager",{get:function(){return this._internalMeshDataInfo._morphTargetManager},set:function(e){this._internalMeshDataInfo._morphTargetManager!==e&&(this._internalMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),t.prototype.instantiateHierarychy=function(e){void 0===e&&(e=null);var t=this.createInstance("instance of "+(this.name||this.id));t.parent=e||this.parent,t.position=this.position.clone(),t.scaling=this.scaling.clone(),this.rotationQuaternion?t.rotationQuaternion=this.rotationQuaternion.clone():t.rotation=this.rotation.clone();for(var i=0,n=this.getChildTransformNodes(!0);i0},enumerable:!0,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){this._internalMeshDataInfo._LODLevels.sort(function(e,t){return e.distancet.distance?-1:0})},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return E.a.Warn("You cannot use a mesh as LOD level twice"),this;var i=new R.a(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;ir)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,n._LODLevels[n._LODLevels.length-1].mesh),this;for(var o=0;o0;this.computeWorldMatrix();var a=this.material||r.defaultMaterial;if(a)if(a._storeEffectOnSubMeshes)for(var s=0,c=this.subMeshes;s0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,a=this.subMeshes;o=n){r=!0;break}if(s.verticesStart+s.verticesCount>=t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new _.b(0,0,t,0,this.getTotalIndices(),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r=t);r++)_.b.CreateFromIndices(0,n,Math.min(i,t-n),this),n+=i;this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,n);else{var r=new d.a;r.set(t,e);var o=this.getScene();new f.a(f.a.RandomId(),o,r,i,this)}return this},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=f.a.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},t.prototype.updateVerticesData=function(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(h.b.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(h.b.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(h.b.NormalKind);if(!r)return this;d.a.ComputeNormals(i,n,r),this.updateVerticesData(h.b.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;var e=this._geometry,t=this._geometry.copy(f.a.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var n=new d.a;n.indices=e;var r=this.getScene();new f.a(f.a.RandomId(),r,n,i,this)}return this},t.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry?(this._geometry.updateIndices(e,t,i),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r=this.getScene().getEngine();if(this._unIndexed)n=null;else switch(i){case g.a.PointFillMode:n=null;break;case g.a.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case g.a.TriangleFillMode:n=this._geometry.getIndexBuffer()}return this._geometry._bind(t,n),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==g.a.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==g.a.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,i):n.drawElementsType(t,e.indexStart,e.indexCount,i),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e){if(this._instanceDataStorage.isFrozen&&this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch;var t=this.getScene(),i=t._isInIntermediateRendering(),n=i?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,r=this._instanceDataStorage.batchCache;if(r.mustReturn=!1,r.renderSelf[e]=!n&&this.isEnabled()&&this.isVisible,r.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances){var o=this._instanceDataStorage.visibleInstances,a=t.getRenderId(),s=i?o.intermediateDefaultRenderId:o.defaultRenderId;r.visibleInstances[e]=o[a],!r.visibleInstances[e]&&s&&(r.visibleInstances[e]=o[s])}return r.hardwareInstancedRendering[e]=this._instanceDataStorage.hardwareInstancedRendering&&null!==r.visibleInstances[e]&&void 0!==r.visibleInstances[e],this._instanceDataStorage.previousBatch=r,r},t.prototype._renderWithInstances=function(e,t,i,n,r){var o=i.visibleInstances[e._id];if(!o)return this;for(var a=this._instanceDataStorage,s=a.instancesBufferSize,c=a.instancesBuffer,l=16*(o.length+1)*4;a.instancesBufferSizeu&&n++,0!==_&&f++,d+=_,u=_}if(c[f]++,f>o&&(o=f),0===d)r++;else{var m=1/d,g=0;for(p=0;p.001&&a++}}var v=this.skeleton.bones.length,y=this.getVerticesData(h.b.MatricesIndicesKind),b=this.getVerticesData(h.b.MatricesIndicesExtraKind),T=0;for(l=0;l=v||E<0)&&T++}return{skinned:!0,valid:0===r&&0===a&&0===T,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+a+"\nWeightCounts = ["+c+"]\nNumber of bones = "+v+"\nBad Bone Indices = "+T}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===b.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=b.a.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e._addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return o.b.LoadFile(this.delayLoadingFile,function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach(function(e){e.refreshBoundingInfo(),e._syncSubMeshes()}),t.delayLoadState=b.a.DELAYLOADSTATE_LOADED,e._removePendingData(t)},function(){},e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return this.delayLoadState!==b.a.DELAYLOADSTATE_LOADING&&(!!e.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0))},t.prototype.setMaterialByID=function(e){var t,i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;var n=this.getScene().multiMaterials;for(t=n.length-1;t>-1;t--)if(n[t].id===e)return this.material=n[t],this;return this},t.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(h.b.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(h.b.PositionKind),r=new Array;for(i=0;i-1&&(r.morphTargetManager=i.getMorphTargetManagerById(e.morphTargetManagerId)),e.skeletonId>-1&&(r.skeleton=i.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,u=l?this.getVerticesData(h.b.MatricesIndicesExtraKind):null,d=l?this.getVerticesData(h.b.MatricesWeightsExtraKind):null,f=e.getTransformMatrices(this),p=c.e.Zero(),_=new c.a,m=new c.a,g=0,v=0;v0&&(c.a.FromFloat32ArrayToRefScaled(f,Math.floor(16*o[g+s]),y,m),_.addToSelf(m));if(l)for(s=0;s<4;s++)(y=d[g+s])>0&&(c.a.FromFloat32ArrayToRefScaled(f,Math.floor(16*u[g+s]),y,m),_.addToSelf(m));c.e.TransformCoordinatesFromFloatsToRef(t._sourcePositions[v],t._sourcePositions[v+1],t._sourcePositions[v+2],_,p),p.toArray(n,v),c.e.TransformNormalFromFloatsToRef(t._sourceNormals[v],t._sourceNormals[v+1],t._sourceNormals[v+2],_,p),p.toArray(r,v),_.reset()}return this.updateVerticesData(h.b.PositionKind,n),this.updateVerticesData(h.b.NormalKind,r),this},t.MinMax=function(e){var t=null,i=null;return e.forEach(function(e){var n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)}),t&&i?{min:t,max:i}:{min:c.e.Zero(),max:c.e.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return c.e.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,a){var s;if(void 0===i&&(i=!0),!n){var c=0;for(s=0;s65536)return E.a.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}if(a){var l,u,h=null;o=!1}var f,p=new Array,m=new Array,g=null,y=new Array,b=null;for(s=0;s":i=n>r;break;case"<":i=n=":i=n>=r;break;case"==":i=n===r}return i},t}(f),v=i(50),y=function(){function e(){}return e.Process=function(e,t,i){var n=this;this._ProcessIncludes(e,t,function(e){var r=n._ProcessShaderConversion(e,t);i(r)})},e._ProcessPrecision=function(e,t){var i=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e},e._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new p(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r-1));r++);if(-1===n)return new p(e);var a=e.substring(0,n).trim(),s=e.substring(n+i.length).trim();return new g(a,i,s)},e._BuildSubExpression=function(e){var t=e.indexOf("||");if(-1===t){var i=e.indexOf("&&");if(i>-1){var n=new m,r=e.substring(0,i).trim(),o=e.substring(i+2).trim();return n.leftOperand=this._BuildSubExpression(r),n.rightOperand=this._BuildSubExpression(o),n}return this._ExtractOperation(e)}var a=new _;r=e.substring(0,t).trim(),o=e.substring(t+2).trim();return a.leftOperand=this._BuildSubExpression(r),a.rightOperand=this._BuildSubExpression(o),a},e._BuildExpression=function(e,t){var i=new d,n=e.substring(0,t),r=e.substring(t).trim();return i.testExpression="#ifdef"===n?new p(r):"#ifndef"===n?new p(r,!0):this._BuildSubExpression(r),i},e._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var r=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===r){var o=new c;return t.children.push(o),void this._MoveCursor(e,o)}if("#elif"===r){var a=this._BuildExpression(n,5);t.children.push(a),i=a}}},e._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length){switch(n[0]){case"#ifdef":var r=new h;t.children.push(r);var o=this._BuildExpression(i,6);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":r=new h;t.children.push(r);o=this._BuildExpression(i,7);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#if":r=new h,o=this._BuildExpression(i,3);t.children.push(r),r.children.push(o),this._MoveCursorWithinIf(e,r,o)}}else{var a=new c;if(a.line=i,t.children.push(a),"#"===i[0]&&"d"===i[1]){var s=i.replace(";","").split(" ");a.additionalDefineKey=s[1],3===s.length&&(a.additionalDefineValue=s[2])}}}return!1},e._EvaluatePreProcessors=function(e,t,i){var n=new c,r=new l;return r.lineIndex=-1,r.lines=e.split("\n"),this._MoveCursor(r,n),n.process(t,i)},e._PreparePreProcessors=function(e){for(var t={},i=0,n=e.defines;i1?r[1]:""}return t.GL_ES="true",t.__VERSION__=e.version,t[e.platformName]="true",t},e._ProcessShaderConversion=function(e,t){var i=this._ProcessPrecision(e,t);if(!t.processor)return i;if(-1!==i.indexOf("#version 3"))return i.replace("#version 300 es","");var n=t.defines,r=this._PreparePreProcessors(t);return t.processor.preProcessor&&(i=t.processor.preProcessor(i,n,t.isFragment)),i=this._EvaluatePreProcessors(i,r,t),t.processor.postProcessor&&(i=t.processor.postProcessor(i,n,t.isFragment)),i},e._ProcessIncludes=function(e,t,i){for(var n=this,r=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,o=r.exec(e),a=new String(e);null!=o;){var s=o[1];if(-1!==s.indexOf("__decl__")&&(s=s.replace(/__decl__/,""),t.supportsUniformBuffers&&(s=(s=s.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),s+="Declaration"),!t.includesShadersStore[s]){var c=t.shadersRepository+"ShadersInclude/"+s+".fx";return void v.a.LoadFile(c,function(e){t.includesShadersStore[s]=e,n._ProcessIncludes(a,t,i)})}var l=t.includesShadersStore[s];if(o[2])for(var u=o[3].split(","),h=0;hthis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"hasMoreFallbacks",{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.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n0&&(r.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(n=0;n=2?"WEBGL2":"WEBGL1"};this._loadVertexShader(d,function(e){p._loadFragmentShader(f,function(i){y.Process(e,g,function(e){g.isFragment=!0,y.Process(i,g,function(i){p._useFinalCode(e,i,t)})})})})}return Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new n.c),this._onBindObservable},enumerable:!0,configurable:!0}),e.prototype._useFinalCode=function(e,t,i){if(i){var n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode="#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode="#define SHADER_NAME fragment:"+r+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect()},Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),e.prototype.isReady=function(){try{return this._isReadyInternal()}catch(e){return!1}},e.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},e.prototype.getEngine=function(){return this._engine},e.prototype.getPipelineContext=function(){return this._pipelineContext},e.prototype.getAttributesNames=function(){return this._attributesNames},e.prototype.getAttributeLocation=function(e){return this._attributes[e]},e.prototype.getAttributeLocationByName=function(e){var t=this._attributesNames.indexOf(e);return this._attributes[t]},e.prototype.getAttributesCount=function(){return this._attributes.length},e.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},e.prototype.getUniform=function(e){return this._uniforms[e]},e.prototype.getSamplers=function(){return this._samplerList},e.prototype.getCompilationError=function(){return this._compilationError},e.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add(function(t){e(t)}),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout(function(){t._checkIsReady()},16))},e.prototype._checkIsReady=function(){var e=this;try{if(this._isReadyInternal())return}catch(e){return void this._processCompilationErrors(e)}setTimeout(function(){e._checkIsReady()},16)},e.prototype._loadVertexShader=function(t,i){var n;if(o.a.IsWindowObjectExist()&&t instanceof HTMLElement)return void i(o.a.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+"VertexShader"]?i(e.ShadersStore[t+"VertexShader"]):(n="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(n+".vertex.fx",i)):i(window.atob(t.substr(7))):i(t.substr(7))},e.prototype._loadFragmentShader=function(t,i){var n;if(o.a.IsWindowObjectExist()&&t instanceof HTMLElement)return void i(o.a.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+"PixelShader"]?i(e.ShadersStore[t+"PixelShader"]):e.ShadersStore[t+"FragmentShader"]?i(e.ShadersStore[t+"FragmentShader"]):(n="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(n+".fragment.fx",i)):i(window.atob(t.substr(7))):i(t.substr(7))},e.prototype._dumpShadersSource=function(e,t,i){var n=(this._engine.webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"")+(i?i+"\n":"");t=n+t;var r=2,o=/\n/gm,s="\n1\t"+(e=n+e).replace(o,function(){return"\n"+r+++"\t"});r=2;var c="\n1\t"+t.replace(o,function(){return"\n"+r+++"\t"});this.name.vertexElement?(a.a.Error("Vertex shader: "+this.name.vertexElement+s),a.a.Error("Fragment shader: "+this.name.fragmentElement+c)):this.name.vertex?(a.a.Error("Vertex shader: "+this.name.vertex+s),a.a.Error("Fragment shader: "+this.name.fragment+c)):(a.a.Error("Vertex shader: "+this.name+s),a.a.Error("Fragment shader: "+this.name+c))},e.prototype._rebuildProgram=function(e,t,i,n){var o=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){for(var e=o.getEngine().scenes,t=0;t0},e.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t
";e._AddLogEntry(n)},e._WarnDisabled=function(e){},e._WarnEnabled=function(t){var i=e._FormatMessage(t);console.warn("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._ErrorDisabled=function(e){},e._ErrorEnabled=function(t){e.errorsCount++;var i=e._FormatMessage(t);console.error("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},Object.defineProperty(e,"LogCache",{get:function(){return e._LogCache},enumerable:!0,configurable:!0}),e.ClearLogCache=function(){e._LogCache="",e.errorsCount=0},Object.defineProperty(e,"LogLevels",{set:function(t){(t&e.MessageLogLevel)===e.MessageLogLevel?e.Log=e._LogEnabled:e.Log=e._LogDisabled,(t&e.WarningLogLevel)===e.WarningLogLevel?e.Warn=e._WarnEnabled:e.Warn=e._WarnDisabled,(t&e.ErrorLogLevel)===e.ErrorLogLevel?e.Error=e._ErrorEnabled:e.Error=e._ErrorDisabled},enumerable:!0,configurable:!0}),e.NoneLogLevel=0,e.MessageLogLevel=1,e.WarningLogLevel=2,e.ErrorLogLevel=4,e.AllLogLevel=7,e._LogCache="",e.errorsCount=0,e.Log=e._LogEnabled,e.Warn=e._WarnEnabled,e.Error=e._ErrorEnabled,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return p});var n=i(1),r=i(2),o=i(7),a=i(0),s=i(49),c=i(3),l=i(13),u=i(21),h=i(113),d=i(109),f=i(56),p=function(e){function t(i,n,r,a,s,l,u,d,f,p){void 0===r&&(r=!1),void 0===a&&(a=!0),void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===u&&(u=null),void 0===d&&(d=null),void 0===f&&(f=!1);var _=e.call(this,n&&"Scene"===n.getClassName()?n:null)||this;_.url=null,_.uOffset=0,_.vOffset=0,_.uScale=1,_.vScale=1,_.uAng=0,_.vAng=0,_.wAng=0,_.uRotationCenter=.5,_.vRotationCenter=.5,_.wRotationCenter=.5,_.inspectableCustomProperties=null,_._noMipmap=!1,_._invertY=!1,_._rowGenerationMatrix=null,_._cachedTextureMatrix=null,_._projectionModeMatrix=null,_._t0=null,_._t1=null,_._t2=null,_._cachedUOffset=-1,_._cachedVOffset=-1,_._cachedUScale=0,_._cachedVScale=0,_._cachedUAng=-1,_._cachedVAng=-1,_._cachedWAng=-1,_._cachedProjectionMatrixId=-1,_._cachedCoordinatesMode=-1,_._initialSamplingMode=t.BILINEAR_SAMPLINGMODE,_._buffer=null,_._deleteBuffer=!1,_._format=null,_._delayedOnLoad=null,_._delayedOnError=null,_.onLoadObservable=new o.c,_._isBlocking=!0,_.name=i||"",_.url=i,_._noMipmap=r,_._invertY=a,_._initialSamplingMode=s,_._buffer=d,_._deleteBuffer=f,p&&(_._format=p);var m=_.getScene(),g=n&&n.getCaps?n:m?m.getEngine():null;if(!g)return _;g.onBeforeTextureInitObservable.notifyObservers(_);var v=function(){_._texture&&(_._texture._invertVScale&&(_.vScale*=-1,_.vOffset+=1),null!==_._texture._cachedWrapU&&(_.wrapU=_._texture._cachedWrapU,_._texture._cachedWrapU=null),null!==_._texture._cachedWrapV&&(_.wrapV=_._texture._cachedWrapV,_._texture._cachedWrapV=null),null!==_._texture._cachedWrapR&&(_.wrapR=_._texture._cachedWrapR,_._texture._cachedWrapR=null)),_.onLoadObservable.hasObservers()&&_.onLoadObservable.notifyObservers(_),l&&l(),!_.isBlocking&&m&&m.resetCachedMaterial()};return _.url?(_._texture=_._getFromCache(_.url,r,s,a),_._texture?_._texture.isReady?h.a.SetImmediate(function(){return v()}):_._texture.onLoadedObservable.add(v):m&&m.useDelayedTextureLoading?(_.delayLoadState=c.a.DELAYLOADSTATE_NOTLOADED,_._delayedOnLoad=v,_._delayedOnError=u):(_._texture=g.createTexture(_.url,r,a,m,s,v,u,_._buffer,void 0,_._format),f&&delete _._buffer),_):(_._delayedOnLoad=v,_._delayedOnError=u,_)}return n.d(t,e),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!0,configurable:!0}),t.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag)),this.name=e,this.url=e,this._buffer=t,this.delayLoadState=c.a.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(this.delayLoadState===c.a.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=c.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?h.a.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this.uScale,t*=this.vScale,e-=this.uRotationCenter*this.uScale,t-=this.vRotationCenter*this.vScale,i-=this.wRotationCenter,a.e.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this.uScale+this.uOffset,n.y+=this.vRotationCenter*this.vScale+this.vOffset,n.z+=this.wRotationCenter},t.prototype.getTextureMatrix=function(){var e=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=a.a.Zero(),this._rowGenerationMatrix=new a.a,this._t0=a.e.Zero(),this._t1=a.e.Zero(),this._t2=a.e.Zero()),a.a.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),a.a.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix);var t=this.getScene();return t?(t.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag,function(t){return t.hasTexture(e)}),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=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!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=a.a.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=a.a.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:a.a.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 t.PROJECTION_MODE:a.a.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:a.a.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag,function(t){return-1!==t.getActiveTextures().indexOf(e)}),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this;return r.a.Clone(function(){return new t(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)},this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t?("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)&&(t.base64String=this._buffer,t.name=t.name.replace("data:","")),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t):null},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var o=d.a.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&o.updateSamplingMode&&o._samplingMode&&o._samplingMode!==e.samplingMode&&o.updateSamplingMode(e.samplingMode),o}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var a=r.a.Parse(function(){var r,o=!0;if(e.noMipmap&&(o=!1),e.mirrorPlane){var a=t._CreateMirror(e.name,e.renderTargetSize,i,o);return a._waitingRenderList=e.renderList,a.mirrorPlane=f.a.FromArray(e.mirrorPlane),a}if(e.isRenderTarget){var s=null;if(e.isCube){if(i.reflectionProbes)for(var c=0;c=0&&o<=1?(s=r,c=a):o>=1&&o<=2?(s=a,c=r):o>=2&&o<=3?(c=r,l=a):o>=3&&o<=4?(c=a,l=r):o>=4&&o<=5?(s=a,l=r):o>=5&&o<=6&&(s=r,l=a);var u=i-r;n.set(s+u,c+u,l+u)},e.FromHexString=function(t){if("#"!==t.substring(0,1)||7!==t.length)return new e(0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return e.FromInts(i,n,r)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromInts=function(t,i,n){return new e(t/255,i/255,n/255)},e.Lerp=function(t,i,n){var r=new e(0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,"BlackReadOnly",{get:function(){return e._BlackReadOnly},enumerable:!0,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._BlackReadOnly=e.Black(),e}(),c=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n}return e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.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},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.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},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.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},e.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},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.a.Clamp(this.r,e,t),i.g=n.a.Clamp(this.g,e,t),i.b=n.a.Clamp(this.b,e,t),i.a=n.a.Clamp(this.a,e,t),this},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.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},e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},e.prototype.getClassName=function(){return"Color4"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0,r=255*this.a|0;return"#"+n.a.ToHex(e)+n.a.ToHex(t)+n.a.ToHex(i)+n.a.ToHex(r)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,r.c),e.g=Math.pow(this.g,r.c),e.b=Math.pow(this.b,r.c),e.a=this.a,this},e.prototype.toGammaSpace=function(){var t=new e;return this.toGammaSpaceToRef(t),t},e.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,r.b),e.g=Math.pow(this.g,r.b),e.b=Math.pow(this.b,r.b),e.a=this.a,this},e.FromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length)return new e(0,0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return e.FromInts(i,n,r,o)},e.Lerp=function(t,i,n){var r=new e(0,0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},e.FromColor3=function(t,i){return void 0===i&&(i=1),new e(t.r,t.g,t.b,i)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromInts=function(t,i,n,r){return new e(t/255,i/255,n/255,r/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],n=0;n0)if(parseInt(A[A.length-1])>=E)continue}for(var P=0,S=g;P1&&(this._shaderProcessor=new v.a),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 v"+e.Version+" - "+this.description),this.enableOfflineSupport=void 0!==e.OfflineProviderFactory}}return Object.defineProperty(e,"Instances",{get:function(){return f.a.Instances},enumerable:!0,configurable:!0}),Object.defineProperty(e,"LastCreatedEngine",{get:function(){return f.a.LastCreatedEngine},enumerable:!0,configurable:!0}),Object.defineProperty(e,"LastCreatedScene",{get:function(){return f.a.LastCreatedScene},enumerable:!0,configurable:!0}),e.MarkAllMaterialsAsDirty=function(t,i){for(var n=0;n1&&!this.disableUniformBuffers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_shouldUseHighPrecisionShader",{get:function(){return this._caps.highPrecisionShaderSupported&&this._highPrecisionShadersAllowed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"texturesSupported",{get:function(){return this._texturesSupported},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,e.TEXTUREFORMAT_RGBA,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,e.TEXTUREFORMAT_RGBA,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var t=new Uint8Array(4),i=[t,t,t,t,t,t];this._emptyCubeTexture=this.createRawCubeTexture(i,1,e.TEXTUREFORMAT_RGBA,e.TEXTURETYPE_UNSIGNED_INT,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)}return this._emptyCubeTexture},enumerable:!0,configurable:!0}),e.prototype.initWebVR=function(){throw _.a.WarnImport("WebVRCamera")},e.prototype._prepareVRComponent=function(){},e.prototype._connectVREvents=function(e,t){},e.prototype._submitVRFrame=function(){},e.prototype.disableVR=function(){},e.prototype.isVRPresenting=function(){return!1},e.prototype._requestVRFrame=function(){},e.prototype._disableTouchAction=function(){this._renderingCanvas&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.msTouchAction="none")},e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e1||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=!1,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._caps.multiview=this._gl.getExtension("OVR_multiview2"),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._gl.getParameter(this._gl.MAX_SAMPLES);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 i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=t["COLOR_ATTACHMENT"+i+"_WEBGL"]}else this._caps.drawBuffersExtension=!1}if(this._caps.parallelShaderCompile=this._gl.getExtension("KHR_parallel_shader_compile"),this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var n=this._gl.getExtension("WEBGL_depth_texture");null!=n&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=n.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var r=this._gl.getExtension("OES_vertex_array_object");null!=r?(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=r.createVertexArrayOES.bind(r),this._gl.bindVertexArray=r.bindVertexArrayOES.bind(r),this._gl.deleteVertexArray=r.deleteVertexArrayOES.bind(r)):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 a=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),s=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);a&&s&&(this._caps.highPrecisionShaderSupported=0!==a.precision&&0!==s.precision)}this.setDepthBuffer(!0),this.setDepthFunctionToLessOrEqual(),this.setDepthWrite(!0),this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var c=0;c=0&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},e.prototype._renderLoop=function(){if(!this._contextWasLost){var t=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(t=!1),t){this.beginFrame();for(var i=0;i0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=e.QueueNewFrame(this.customAnimationFrameRequester.renderFunction||this._bindedRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=e.QueueNewFrame(this._bindedRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.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.QueueNewFrame(this._bindedRenderFunction,this.getHostWindow())))},e.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},e.prototype.enterFullscreen=function(t){this.isFullscreen||(this._pointerLockRequested=t,this._renderingCanvas&&e._RequestFullscreen(this._renderingCanvas))},e.prototype.exitFullscreen=function(){this.isFullscreen&&e._ExitFullscreen()},e.prototype.enterPointerlock=function(){this._renderingCanvas&&e._RequestPointerlock(this._renderingCanvas)},e.prototype.exitPointerlock=function(){e._ExitPointerlock()},e.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this.applyStates();var r=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=this._gl.COLOR_BUFFER_BIT),i&&(this._gl.clearDepth(1),r|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),r|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(r)},e.prototype.scissorClear=function(e,t,i,n,r){this.enableScissor(e,t,i,n),this.clear(r,!0,!0,!0),this.disableScissor()},e.prototype.enableScissor=function(e,t,i,n){var r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,n)},e.prototype.disableScissor=function(){var e=this._gl;e.disable(e.SCISSOR_TEST)},e.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},e.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(o*n,a*r,n*e.width,r*e.height)},e.prototype.setDirectViewport=function(e,t,i,n){var r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,n),r},e.prototype.beginFrame=function(){this.onBeginFrameObservable.notifyObservers(this),this._measureFps()},e.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},e.prototype.resize=function(){if(!this.isVRPresenting()){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)}},e.prototype.setSize=function(e,t){if(this._renderingCanvas&&(e|=0,t|=0,this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)){this._renderingCanvas.width=e,this._renderingCanvas.height=t;for(var i=0;i65535){o=!0;break}i=o?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=o,r},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},e.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,a){var s=this._currentBufferPointers[t],c=!1;s.active?(s.buffer!==e&&(s.buffer=e,c=!0),s.size!==i&&(s.size=i,c=!0),s.type!==n&&(s.type=n,c=!0),s.normalized!==r&&(s.normalized=r,c=!0),s.stride!==o&&(s.stride=o,c=!0),s.offset!==a&&(s.offset=a,c=!0)):(c=!0,s.active=!0,s.index=t,s.size=i,s.type=n,s.normalized=r,s.stride=o,s.offset=a,s.buffer=e),(c||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,a))},e.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},e.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var n=0;n=0){var o=e[i[n]];if(!o)continue;this._gl.enableVertexAttribArray(r),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[r]=!0);var a=o.getBuffer();a&&(this._vertexAttribPointer(a,r,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(r,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(a))))}}},e.prototype.recordVertexArrayObject=function(e,t,i){var n=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(n),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),n},e.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)},e.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;var o=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a=0,s=0;s=0&&(this._gl.enableVertexAttribArray(c),this._vertexAttribArraysEnabled[c]=!0,this._vertexAttribPointer(e,c,i[s],this._gl.FLOAT,!1,n,a)),a+=4*i[s]}}this._bindIndexBufferWithCache(t)},e.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},e.prototype.bindBuffers=function(e,t,i){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i)),this._bindIndexBufferWithCache(t)},e.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",s=this._compileShader(t,"vertex",n,a),c=this._compileShader(i,"fragment",n,a),l=this._createShaderProgram(e,s,c,r,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),l},e.prototype.createPipelineContext=function(){var e=new m.a;return e.engine=this,this._caps.parallelShaderCompile&&(e.isParallelCompiled=!0),e},e.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(e.program=o,!o)throw new Error("Unable to create program");if(n.attachShader(o,t),n.attachShader(o,i),this.webGLVersion>1&&r){var a=this.createTransformFeedback();this.bindTransformFeedback(a),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=a}return n.linkProgram(o),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},e.prototype._finalizePipelineContext=function(e){var t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var o,a;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(i))throw new Error("VERTEX SHADER "+o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(n))throw new Error("FRAGMENT SHADER "+o);if(a=t.getProgramInfoLog(r))throw new Error(a)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(a=t.getProgramInfoLog(r))))throw new Error(a);t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},e.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){var s=e;s.program=n?this.createRawShaderProgram(s,t,i,void 0,a):this.createShaderProgram(s,t,i,o,void 0,a),s.program.__SPECTOR_rebuildProgram=r},e.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},e.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i=e;i.isParallelCompiled?i.onCompiled=t:t()},e.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r-1?m.substring(E).toLowerCase():""),P=null,S=0,R=e._TextureLoaders;Su||t.height>u||null===e._RescalePostProcessFactory)return _._prepareWorkingCanvas(),!(!_._workingCanvas||!_._workingContext)&&(_._workingCanvas.width=i,_._workingCanvas.height=n,_._workingContext.drawImage(t,0,0,t.width,t.height,0,0,i,n),a.texImage2D(a.TEXTURE_2D,0,l,l,a.UNSIGNED_BYTE,_._workingCanvas),T.width=i,T.height=n,!1);var d=new c.a(_,c.a.DATASOURCE_TEMP);return _._bindTextureDirectly(a.TEXTURE_2D,d,!0),a.texImage2D(a.TEXTURE_2D,0,l,l,a.UNSIGNED_BYTE,t),_._rescaleTexture(d,T,r,l,function(){_._releaseTexture(d),_._bindTextureDirectly(a.TEXTURE_2D,T,!0),o()}),!0},o)};!g||y?l instanceof HTMLImageElement?I(l):b.a.LoadImage(m,I,M,r?r.offlineProvider:null):"string"==typeof l||l instanceof ArrayBuffer||l instanceof Blob?b.a.LoadImage(l,I,M,r?r.offlineProvider:null):I(l)}return T},e.prototype._rescaleTexture=function(t,i,n,r,o){var a=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var s=this.createRenderTargetTexture({width:i.width,height:i.height},{generateMipMaps:!1,type:e.TEXTURETYPE_UNSIGNED_INT,samplingMode:e.TEXTURE_BILINEAR_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&e._RescalePostProcessFactory&&(this._rescalePostProcess=e._RescalePostProcessFactory(this)),this._rescalePostProcess.getEffect().executeWhenCompiled(function(){a._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)};var e=n;e||(e=a.scenes[a.scenes.length-1]),e.postProcessManager.directRender([a._rescalePostProcess],s,!0),a._bindTextureDirectly(a._gl.TEXTURE_2D,i,!0),a._gl.copyTexImage2D(a._gl.TEXTURE_2D,0,r,0,0,i.width,i.height,0),a.unBindFramebuffer(s),a._releaseTexture(s),o&&o()})},e.prototype.createRawTexture=function(t,i,n,r,o,a,s,c,l){throw void 0===c&&(c=null),void 0===l&&(l=e.TEXTURETYPE_UNSIGNED_INT),_.a.WarnImport("Engine.RawTexture")},e.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},e.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},e.prototype.createDynamicTexture=function(t,i,n,r){var o=new c.a(this,c.a.DATASOURCE_DYNAMIC);return o.baseWidth=t,o.baseHeight=i,n&&(t=this.needPOTTextures?e.GetExponentOfTwo(t,this._caps.maxTextureSize):t,i=this.needPOTTextures?e.GetExponentOfTwo(i,this._caps.maxTextureSize):i),o.width=t,o.height=i,o.isReady=!1,o.generateMipMaps=n,o.samplingMode=r,this.updateTextureSamplingMode(r,o),this._internalTexturesCache.push(o),o},e.prototype.updateTextureSamplingMode=function(e,t){var i=this._getSamplingParameters(e,t.generateMipMaps);t.isCube?(this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):t.is3D?(this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_3D,null)):(this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t.samplingMode=e},e.prototype.updateDynamicTexture=function(e,t,i,n,r,o){if(void 0===n&&(n=!1),void 0===o&&(o=!1),e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0,o),this._unpackFlipY(i),n&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var a=r?this._getInternalFormat(r):this._gl.RGBA;this._gl.texImage2D(this._gl.TEXTURE_2D,0,a,a,this._gl.UNSIGNED_BYTE,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),n&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}},e.prototype.updateVideoTexture=function(e,t,i){if(e&&!e._isDisabled){var n=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!i);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 r=e._workingCanvas.getContext("2d");if(!r)throw new Error("Unable to get 2d context");e._workingContext=r,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),n||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},e.prototype.updateTextureComparisonFunction=function(t,i){if(1!==this.webGLVersion){var n=this._gl;t.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,t,!0),0===i?(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_FUNC,e.LEQUAL),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_MODE,n.NONE)):(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_FUNC,i),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),0===i?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_FUNC,e.LEQUAL),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_MODE,n.NONE)):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_FUNC,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t._comparisonFunction=i}else d.a.Error("WebGL 1 does not support texture comparison.")},e.prototype._setupDepthStencilTexture=function(t,i,n,r,o){var a=i.width||i,s=i.height||i;t.baseWidth=a,t.baseHeight=s,t.width=a,t.height=s,t.isReady=!0,t.samples=1,t.generateMipMaps=!1,t._generateDepthBuffer=!0,t._generateStencilBuffer=n,t.samplingMode=r?e.TEXTURE_BILINEAR_SAMPLINGMODE:e.TEXTURE_NEAREST_SAMPLINGMODE,t.type=e.TEXTURETYPE_UNSIGNED_INT,t._comparisonFunction=o;var c=this._gl,l=t.isCube?c.TEXTURE_CUBE_MAP:c.TEXTURE_2D,u=this._getSamplingParameters(t.samplingMode,!1);c.texParameteri(l,c.TEXTURE_MAG_FILTER,u.mag),c.texParameteri(l,c.TEXTURE_MIN_FILTER,u.min),c.texParameteri(l,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(l,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),0===o?(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,e.LEQUAL),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.NONE)):(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,o),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.COMPARE_REF_TO_TEXTURE))},e.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},e.prototype._createDepthStencilTexture=function(e,t){var i=new c.a(this,c.a.DATASOURCE_DEPTHTEXTURE);if(!this._caps.depthTextureExtension)return d.a.Error("Depth texture is not supported by your browser or hardware."),i;var r=n.a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),o=this._gl;return this._bindTextureDirectly(o.TEXTURE_2D,i,!0),this._setupDepthStencilTexture(i,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction),this.webGLVersion>1?r.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):r.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},e.prototype.setFrameBufferDepthStencilTexture=function(e){var t=e.getInternalTexture();if(t&&t._framebuffer&&e.depthStencilTexture){var i=this._gl,n=e.depthStencilTexture;this._bindUnboundFramebuffer(t._framebuffer),n.isCube?n._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,n._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,n._webGLTexture,0):n._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,n._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,n._webGLTexture,0),this._bindUnboundFramebuffer(null)}},e.prototype.createRenderTargetTexture=function(t,i){var n=new p.a;void 0!==i&&"object"==typeof i?(n.generateMipMaps=i.generateMipMaps,n.generateDepthBuffer=void 0===i.generateDepthBuffer||i.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&i.generateStencilBuffer,n.type=void 0===i.type?e.TEXTURETYPE_UNSIGNED_INT:i.type,n.samplingMode=void 0===i.samplingMode?e.TEXTURE_TRILINEAR_SAMPLINGMODE:i.samplingMode,n.format=void 0===i.format?e.TEXTUREFORMAT_RGBA:i.format):(n.generateMipMaps=i,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=e.TEXTURETYPE_UNSIGNED_INT,n.samplingMode=e.TEXTURE_TRILINEAR_SAMPLINGMODE,n.format=e.TEXTUREFORMAT_RGBA),(n.type!==e.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(n.type!==e.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=e.TEXTURE_NEAREST_SAMPLINGMODE);var r=this._gl,o=new c.a(this,c.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(r.TEXTURE_2D,o,!0);var a=t.width||t,s=t.height||t,l=this._getSamplingParameters(n.samplingMode,!!n.generateMipMaps);n.type!==e.TEXTURETYPE_FLOAT||this._caps.textureFloat||(n.type=e.TEXTURETYPE_UNSIGNED_INT,d.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,l.mag),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,l.min),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(n.type,n.format),a,s,0,this._getInternalFormat(n.format),this._getWebGLTextureType(n.type),null);var u=this._currentFramebuffer,h=r.createFramebuffer();return this._bindUnboundFramebuffer(h),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,o._webGLTexture,0),o._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer,n.generateDepthBuffer,a,s),n.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null),r.bindRenderbuffer(r.RENDERBUFFER,null),this._bindUnboundFramebuffer(u),o._framebuffer=h,o.baseWidth=a,o.baseHeight=s,o.width=a,o.height=s,o.isReady=!0,o.samples=1,o.generateMipMaps=!!n.generateMipMaps,o.samplingMode=n.samplingMode,o.type=n.type,o.format=n.format,o._generateDepthBuffer=n.generateDepthBuffer,o._generateStencilBuffer=!!n.generateStencilBuffer,this._internalTexturesCache.push(o),o},e.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=null,a=this._gl;return e?(o=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,o),r>1?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.DEPTH24_STENCIL8,i,n):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,i,n),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,o)):t&&(o=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,o),r>1?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.DEPTH_COMPONENT16,i,n):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,i,n),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,o)),o},e.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),t>1){var n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=n,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var r=i.createRenderbuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,r),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r),e._MSAARenderBuffer=r}else this._bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),i.bindRenderbuffer(i.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),t},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var s=this._gl,c=s.TEXTURE_2D;e.isCube&&(c=s.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(c,a,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format),l=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,c):this._getInternalFormat(r);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i);var h=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),f=o?e.width:Math.pow(2,Math.max(h-n,0)),p=o?e.height:Math.pow(2,Math.max(d-n,0));a.texImage2D(u,n,l,f,p,0,c,s,t)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(o,null,!0)},e.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),a=this._getInternalFormat(e.format),s=this._getRGBABufferInternalSizedFormat(e.type,a),c=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(c,e,!0),this._unpackFlipY(e.invertY);var l=r.TEXTURE_2D;e.isCube&&(l=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(l,n,s,a,o,t),this._bindTextureDirectly(c,null,!0)},e.prototype._setCubeMapTextureParams=function(e){var t=this._gl;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,null)},e.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=null),_.a.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture3D=function(t,i,n,r,o,a,s,c,l,u){throw void 0===l&&(l=null),void 0===u&&(u=e.TEXTURETYPE_UNSIGNED_INT),_.a.WarnImport("Engine.RawTexture")},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var a=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,a.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,a.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},e.prototype._prepareWebGLTexture=function(t,i,n,r,o,a,s,c,l){var u=this;void 0===l&&(l=e.TEXTURE_TRILINEAR_SAMPLINGMODE);var h=this.getCaps().maxTextureSize,d=Math.min(h,this.needPOTTextures?e.GetExponentOfTwo(n,h):n),f=Math.min(h,this.needPOTTextures?e.GetExponentOfTwo(r,h):r),p=this._gl;p&&(t._webGLTexture?(this._bindTextureDirectly(p.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=n,t.baseHeight=r,t.width=d,t.height=f,t.isReady=!0,c(d,f,function(){u._prepareWebGLTextureContinuation(t,i,a,s,l)})||this._prepareWebGLTextureContinuation(t,i,a,s,l)):i&&i._removePendingData(t))},e.prototype._convertRGBtoRGBATextureData=function(t,i,n,r){var o;o=r===e.TEXTURETYPE_FLOAT?new Float32Array(i*n*4):new Uint32Array(i*n*4);for(var a=0;a-1;return i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n?(this._activateCurrentTexture(),t&&t.isMultiview?this._gl.bindTexture(e,t?t._colorTextureArray:null):this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},e.prototype._bindTexture=function(e,t){void 0!==e&&(t&&(t._associatedChannel=e),this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,t))},e.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},e.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)},e.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype.setDepthStencilTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0):this._setTexture(e,null))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.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},e.prototype._setTexture=function(t,i,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),!i)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(i.video)this._activeChannel=t,i.update();else if(i.delayLoadState===e.DELAYLOADSTATE_NOTLOADED)return i.delayLoad(),!1;var o;o=r?i.depthStencilTexture:i.isReady()?i.getInternalTexture():i.isCube?this.emptyCubeTexture:i.is3D?this.emptyTexture3D:this.emptyTexture,!n&&o&&(o._associatedChannel=t);var a=!0;if(this._boundTexturesCache[t]===o&&(n||this._bindSamplerUniformToChannel(o._associatedChannel,t),a=!1),this._activeChannel=t,o&&o.isMultiview)a&&this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,o,n);else if(o&&o.is3D)a&&this._bindTextureDirectly(this._gl.TEXTURE_3D,o,n),o&&o._cachedWrapU!==i.wrapU&&(o._cachedWrapU=i.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(i.wrapU),o)),o&&o._cachedWrapV!==i.wrapV&&(o._cachedWrapV=i.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i.wrapV),o)),o&&o._cachedWrapR!==i.wrapR&&(o._cachedWrapR=i.wrapR,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(i.wrapR),o)),this._setAnisotropicLevel(this._gl.TEXTURE_3D,i);else if(o&&o.isCube){if(a&&this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,o,n),o._cachedCoordinatesMode!==i.coordinatesMode){o._cachedCoordinatesMode=i.coordinatesMode;var s=i.coordinatesMode!==e.TEXTURE_CUBIC_MODE&&i.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,s,o),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_T,s)}this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP,i)}else a&&this._bindTextureDirectly(this._gl.TEXTURE_2D,o,n),o&&o._cachedWrapU!==i.wrapU&&(o._cachedWrapU=i.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(i.wrapU),o)),o&&o._cachedWrapV!==i.wrapV&&(o._cachedWrapV=i.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i.wrapV),o)),this._setAnisotropicLevel(this._gl.TEXTURE_2D,i);return!0},e.prototype.setTextureArray=function(e,t,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var n=0;n=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||(this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1)}},e.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}},e.prototype.dispose=function(){for(this.hideLoadingUI(),this.stopRenderLoop(),this.onNewSceneAddedObservable.clear();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();1===e.Instances.length&&e.audioEngine&&e.audioEngine.dispose(),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.disableVR(),h.a.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),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));var t=e.Instances.indexOf(this);t>=0&&e.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(),s.a.ResetCache();for(var i=0,n=this._activeRequests;i-1?a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e._webGLTexture,r);var c=void 0!==e.type?this._getWebGLTextureType(e.type):a.UNSIGNED_BYTE;switch(c){case a.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),c=a.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),c=a.FLOAT}return a.readPixels(0,0,t,i,a.RGBA,c,o),a.bindFramebuffer(a.FRAMEBUFFER,this._currentFramebuffer),o},e.prototype._canRenderToFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(e.TEXTURETYPE_FLOAT)},e.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(e.TEXTURETYPE_HALF_FLOAT)},e.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),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 r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var a=t.RGBA,s=t.UNSIGNED_BYTE,c=new Uint8Array(4);t.readPixels(0,0,1,1,a,s,c),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},e.prototype._getWebGLTextureType=function(t){if(1===this._webGLVersion){switch(t){case e.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case e.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case e.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(t){case e.TEXTURETYPE_BYTE:return this._gl.BYTE;case e.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case e.TEXTURETYPE_SHORT:return this._gl.SHORT;case e.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case e.TEXTURETYPE_INT:return this._gl.INT;case e.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case e.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case e.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case e.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},e.prototype._getInternalFormat=function(t){var i=this._gl.RGBA;switch(t){case e.TEXTUREFORMAT_ALPHA:i=this._gl.ALPHA;break;case e.TEXTUREFORMAT_LUMINANCE:i=this._gl.LUMINANCE;break;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:i=this._gl.LUMINANCE_ALPHA;break;case e.TEXTUREFORMAT_RED:i=this._gl.RED;break;case e.TEXTUREFORMAT_RG:i=this._gl.RG;break;case e.TEXTUREFORMAT_RGB:i=this._gl.RGB;break;case e.TEXTUREFORMAT_RGBA:i=this._gl.RGBA}if(this._webGLVersion>1)switch(t){case e.TEXTUREFORMAT_RED_INTEGER:i=this._gl.RED_INTEGER;break;case e.TEXTUREFORMAT_RG_INTEGER:i=this._gl.RG_INTEGER;break;case e.TEXTUREFORMAT_RGB_INTEGER:i=this._gl.RGB_INTEGER;break;case e.TEXTUREFORMAT_RGBA_INTEGER:i=this._gl.RGBA_INTEGER}return i},e.prototype._getRGBABufferInternalSizedFormat=function(t,i){if(1===this._webGLVersion){if(void 0!==i)switch(i){case e.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case e.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA}return this._gl.RGBA}switch(t){case e.TEXTURETYPE_BYTE:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case e.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case e.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case e.TEXTURETYPE_UNSIGNED_BYTE:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R8;case e.TEXTUREFORMAT_RG:return this._gl.RG8;case e.TEXTUREFORMAT_RGB:return this._gl.RGB8;case e.TEXTUREFORMAT_RGBA:return this._gl.RGBA8;case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case e.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case e.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case e.TEXTURETYPE_SHORT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case e.TEXTURETYPE_UNSIGNED_SHORT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case e.TEXTURETYPE_INT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case e.TEXTURETYPE_UNSIGNED_INTEGER:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case e.TEXTURETYPE_FLOAT:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R32F;case e.TEXTUREFORMAT_RG:return this._gl.RG32F;case e.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case e.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case e.TEXTURETYPE_HALF_FLOAT:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R16F;case e.TEXTUREFORMAT_RG:return this._gl.RG16F;case e.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case e.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(i){case e.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},e.prototype._getRGBAMultiSampleBufferFormat=function(t){return t===e.TEXTURETYPE_FLOAT?this._gl.RGBA32F:t===e.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},e.prototype._loadFile=function(e,t,i,n,r,o){var a=this,s=b.a.LoadFile(e,t,i,n,r,o);return this._activeRequests.push(s),s.onCompleteObservable.add(function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)}),s},e.prototype._loadFileAsync=function(e,t,i){var n=this;return new Promise(function(r,o){n._loadFile(e,function(e){r(e)},void 0,t,i,function(e,t){o(t)})})},e.isSupported=function(){try{var e=document.createElement("canvas");return null!=(e.getContext("webgl")||e.getContext("experimental-webgl"))&&!!window.WebGLRenderingContext}catch(e){return!1}},e.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},e.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},e.NearestPOT=function(t){var i=e.CeilingPOT(t),n=e.FloorPOT(t);return i-t>t-n?n:i},e.GetExponentOfTwo=function(t,i,n){var r;switch(void 0===n&&(n=u.a.SCALEMODE_NEAREST),n){case u.a.SCALEMODE_FLOOR:r=e.FloorPOT(t);break;case u.a.SCALEMODE_NEAREST:r=e.NearestPOT(t);break;case u.a.SCALEMODE_CEILING:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.QueueNewFrame=function(e,t){return h.a.IsWindowObjectExist()?(t||(t=window),t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16)):setTimeout(e,16)},e._RequestPointerlock=function(e){e.requestPointerLock=e.requestPointerLock||e.msRequestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock&&e.requestPointerLock()},e._ExitPointerlock=function(){var e=document;document.exitPointerLock=document.exitPointerLock||e.msExitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock,document.exitPointerLock&&document.exitPointerLock()},e._RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},e._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msCancelFullScreen&&e.msCancelFullScreen()},e.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:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]}],e._TextureLoaders=[],e.ALPHA_DISABLE=u.a.ALPHA_DISABLE,e.ALPHA_ADD=u.a.ALPHA_ADD,e.ALPHA_COMBINE=u.a.ALPHA_COMBINE,e.ALPHA_SUBTRACT=u.a.ALPHA_SUBTRACT,e.ALPHA_MULTIPLY=u.a.ALPHA_MULTIPLY,e.ALPHA_MAXIMIZED=u.a.ALPHA_MAXIMIZED,e.ALPHA_ONEONE=u.a.ALPHA_ONEONE,e.ALPHA_PREMULTIPLIED=u.a.ALPHA_PREMULTIPLIED,e.ALPHA_PREMULTIPLIED_PORTERDUFF=u.a.ALPHA_PREMULTIPLIED_PORTERDUFF,e.ALPHA_INTERPOLATE=u.a.ALPHA_INTERPOLATE,e.ALPHA_SCREENMODE=u.a.ALPHA_SCREENMODE,e.DELAYLOADSTATE_NONE=u.a.DELAYLOADSTATE_NONE,e.DELAYLOADSTATE_LOADED=u.a.DELAYLOADSTATE_LOADED,e.DELAYLOADSTATE_LOADING=u.a.DELAYLOADSTATE_LOADING,e.DELAYLOADSTATE_NOTLOADED=u.a.DELAYLOADSTATE_NOTLOADED,e.NEVER=u.a.NEVER,e.ALWAYS=u.a.ALWAYS,e.LESS=u.a.LESS,e.EQUAL=u.a.EQUAL,e.LEQUAL=u.a.LEQUAL,e.GREATER=u.a.GREATER,e.GEQUAL=u.a.GEQUAL,e.NOTEQUAL=u.a.NOTEQUAL,e.KEEP=u.a.KEEP,e.REPLACE=u.a.REPLACE,e.INCR=u.a.INCR,e.DECR=u.a.DECR,e.INVERT=u.a.INVERT,e.INCR_WRAP=u.a.INCR_WRAP,e.DECR_WRAP=u.a.DECR_WRAP,e.TEXTURE_CLAMP_ADDRESSMODE=u.a.TEXTURE_CLAMP_ADDRESSMODE,e.TEXTURE_WRAP_ADDRESSMODE=u.a.TEXTURE_WRAP_ADDRESSMODE,e.TEXTURE_MIRROR_ADDRESSMODE=u.a.TEXTURE_MIRROR_ADDRESSMODE,e.TEXTUREFORMAT_ALPHA=u.a.TEXTUREFORMAT_ALPHA,e.TEXTUREFORMAT_LUMINANCE=u.a.TEXTUREFORMAT_LUMINANCE,e.TEXTUREFORMAT_LUMINANCE_ALPHA=u.a.TEXTUREFORMAT_LUMINANCE_ALPHA,e.TEXTUREFORMAT_RGB=u.a.TEXTUREFORMAT_RGB,e.TEXTUREFORMAT_RGBA=u.a.TEXTUREFORMAT_RGBA,e.TEXTUREFORMAT_RED=u.a.TEXTUREFORMAT_RED,e.TEXTUREFORMAT_R=u.a.TEXTUREFORMAT_R,e.TEXTUREFORMAT_RG=u.a.TEXTUREFORMAT_RG,e.TEXTUREFORMAT_RED_INTEGER=u.a.TEXTUREFORMAT_RED_INTEGER,e.TEXTUREFORMAT_R_INTEGER=u.a.TEXTUREFORMAT_R_INTEGER,e.TEXTUREFORMAT_RG_INTEGER=u.a.TEXTUREFORMAT_RG_INTEGER,e.TEXTUREFORMAT_RGB_INTEGER=u.a.TEXTUREFORMAT_RGB_INTEGER,e.TEXTUREFORMAT_RGBA_INTEGER=u.a.TEXTUREFORMAT_RGBA_INTEGER,e.TEXTURETYPE_UNSIGNED_BYTE=u.a.TEXTURETYPE_UNSIGNED_BYTE,e.TEXTURETYPE_UNSIGNED_INT=u.a.TEXTURETYPE_UNSIGNED_INT,e.TEXTURETYPE_FLOAT=u.a.TEXTURETYPE_FLOAT,e.TEXTURETYPE_HALF_FLOAT=u.a.TEXTURETYPE_HALF_FLOAT,e.TEXTURETYPE_BYTE=u.a.TEXTURETYPE_BYTE,e.TEXTURETYPE_SHORT=u.a.TEXTURETYPE_SHORT,e.TEXTURETYPE_UNSIGNED_SHORT=u.a.TEXTURETYPE_UNSIGNED_SHORT,e.TEXTURETYPE_INT=u.a.TEXTURETYPE_INT,e.TEXTURETYPE_UNSIGNED_INTEGER=u.a.TEXTURETYPE_UNSIGNED_INTEGER,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=u.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=u.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,e.TEXTURETYPE_UNSIGNED_INT_24_8=u.a.TEXTURETYPE_UNSIGNED_INT_24_8,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=u.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=u.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=u.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,e.TEXTURE_NEAREST_SAMPLINGMODE=u.a.TEXTURE_NEAREST_SAMPLINGMODE,e.TEXTURE_BILINEAR_SAMPLINGMODE=u.a.TEXTURE_BILINEAR_SAMPLINGMODE,e.TEXTURE_TRILINEAR_SAMPLINGMODE=u.a.TEXTURE_TRILINEAR_SAMPLINGMODE,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=u.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=u.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=u.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=u.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=u.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=u.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_LINEAR=u.a.TEXTURE_NEAREST_LINEAR,e.TEXTURE_NEAREST_NEAREST=u.a.TEXTURE_NEAREST_NEAREST,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=u.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=u.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR=u.a.TEXTURE_LINEAR_LINEAR,e.TEXTURE_LINEAR_NEAREST=u.a.TEXTURE_LINEAR_NEAREST,e.TEXTURE_EXPLICIT_MODE=u.a.TEXTURE_EXPLICIT_MODE,e.TEXTURE_SPHERICAL_MODE=u.a.TEXTURE_SPHERICAL_MODE,e.TEXTURE_PLANAR_MODE=u.a.TEXTURE_PLANAR_MODE,e.TEXTURE_CUBIC_MODE=u.a.TEXTURE_CUBIC_MODE,e.TEXTURE_PROJECTION_MODE=u.a.TEXTURE_PROJECTION_MODE,e.TEXTURE_SKYBOX_MODE=u.a.TEXTURE_SKYBOX_MODE,e.TEXTURE_INVCUBIC_MODE=u.a.TEXTURE_INVCUBIC_MODE,e.TEXTURE_EQUIRECTANGULAR_MODE=u.a.TEXTURE_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,e.SCALEMODE_FLOOR=u.a.SCALEMODE_FLOOR,e.SCALEMODE_NEAREST=u.a.SCALEMODE_NEAREST,e.SCALEMODE_CEILING=u.a.SCALEMODE_CEILING,e.CollisionsEpsilon=.001,e._RescalePostProcessFactory=null,e}()},function(e,t,i){"use strict";i.d(t,"b",function(){return m}),i.d(t,"c",function(){return g}),i.d(t,"a",function(){return v});var n=i(7),r=i(37),o=i(8),a=i(36),s=i(53),c=i(21),l=i(66),u=i(23),h=i(50),d=i(120),f=i(113),p=i(109),_=i(128),m=function(){function e(){}return Object.defineProperty(e,"BaseUrl",{get:function(){return h.a.BaseUrl},set:function(e){h.a.BaseUrl=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultRetryStrategy",{get:function(){return h.a.DefaultRetryStrategy},set:function(e){h.a.DefaultRetryStrategy=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"UseFallbackTexture",{get:function(){return u.a.UseFallbackTexture},set:function(e){u.a.UseFallbackTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"RegisteredExternalClasses",{get:function(){return p.a.RegisteredExternalClasses},set:function(e){p.a.RegisteredExternalClasses=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"fallbackTexture",{get:function(){return u.a.FallbackTexture},set:function(e){u.a.FallbackTexture=e},enumerable:!0,configurable:!0}),e.FetchToRef=function(e,t,i,n,r,o){var a=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i);o.r=r[a]/255,o.g=r[a+1]/255,o.b=r[a+2]/255,o.a=r[a+3]/255},e.Mix=function(e,t,i){return e*(1-i)+t*i},e.Instantiate=function(e){return p.a.Instantiate(e)},e.Slice=function(e,t,i){return e.slice?e.slice(t,i):Array.prototype.slice.call(e,t,i)},e.SetImmediate=function(e){f.a.SetImmediate(e)},e.IsExponentOfTwo=function(e){var t=1;do{t*=2}while(t>2,o=(3&t)<<4|(i=u>4,a=(15&i)<<2|(n=u>6,s=63&n,isNaN(i)?a=s=64:isNaN(n)&&(s=64),l+=c.charAt(r)+c.charAt(o)+c.charAt(a)+c.charAt(s);return"data:image/png;base64,"+l},e.MakeArray=function(e,t){return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},e.GetPointerPrefix=function(){var e="pointer";return!r.a.IsWindowObjectExist()||window.PointerEvent||navigator.pointerEnabled||(e="mouse"),e},e.SetCorsBehavior=function(e,t){h.a.SetCorsBehavior(e,t)},e.CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},Object.defineProperty(e,"PreprocessUrl",{get:function(){return h.a.PreprocessUrl},set:function(e){h.a.PreprocessUrl=e},enumerable:!0,configurable:!0}),e.LoadImage=function(e,t,i,n){return h.a.LoadImage(e,t,i,n)},e.LoadFile=function(e,t,i,n,r,o){return h.a.LoadFile(e,t,i,n,r,o)},e.LoadFileAsync=function(e){return new Promise(function(t,i){h.a.LoadFile(e,function(e){t(e)},void 0,void 0,!0,function(e,t){i(t)})})},e.LoadScript=function(e,t,i,n){if(r.a.IsWindowObjectExist()){var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("src",e),n&&(a.id=n),a.onload=function(){t&&t()},a.onerror=function(t){i&&i("Unable to load script '"+e+"'",t)},o.appendChild(a)}},e.LoadScriptAsync=function(e,t){return new Promise(function(i,n){if(r.a.IsWindowObjectExist()){var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("src",e),t&&(a.id=t),a.onload=function(){i(!0)},a.onerror=function(e){i(!1)},o.appendChild(a)}else i(!1)})},e.ReadFileAsDataURL=function(e,t,i){var r=new FileReader,o={onCompleteObservable:new n.c,abort:function(){return r.abort()}};return r.onloadend=function(e){o.onCompleteObservable.notifyObservers(o)},r.onload=function(e){t(e.target.result)},r.onprogress=i,r.readAsDataURL(e),o},e.ReadFile=function(e,t,i,n){return h.a.ReadFile(e,t,i,n)},e.FileAsURL=function(e){var t=new Blob([e]);return(window.URL||window.webkitURL).createObjectURL(t)},e.Format=function(e,t){return void 0===t&&(t=2),e.toFixed(t)},e.DeepCopy=function(e,t,i,n){a.a.DeepCopy(e,t,i,n)},e.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},e.RegisterTopRootEvents=function(e,t){for(var i=0;i=t)break;if(n(a),o&&o()){e.breakLoop();break}}e.executeNext()},a)},r)},e}();u.a.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",d.a.Apply()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.GetClass=function(e){return this.RegisteredTypes&&this.RegisteredTypes[e]?this.RegisteredTypes[e]:null},e.RegisteredTypes={},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(0),r=i(4),o=i(21),a=i(10),s=function(){function e(){}return e.prototype.set=function(e,t){switch(t){case r.b.PositionKind:this.positions=e;break;case r.b.NormalKind:this.normals=e;break;case r.b.TangentKind:this.tangents=e;break;case r.b.UVKind:this.uvs=e;break;case r.b.UV2Kind:this.uvs2=e;break;case r.b.UV3Kind:this.uvs3=e;break;case r.b.UV4Kind:this.uvs4=e;break;case r.b.UV5Kind:this.uvs5=e;break;case r.b.UV6Kind:this.uvs6=e;break;case r.b.ColorKind:this.colors=e;break;case r.b.MatricesIndicesKind:this.matricesIndices=e;break;case r.b.MatricesWeightsKind:this.matricesWeights=e;break;case r.b.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case r.b.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},e.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},e.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},e.prototype.updateMesh=function(e){return this._update(e),this},e.prototype.updateGeometry=function(e){return this._update(e),this},e.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(r.b.PositionKind,this.positions,t),this.normals&&e.setVerticesData(r.b.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(r.b.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(r.b.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(r.b.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(r.b.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(r.b.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(r.b.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(r.b.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(r.b.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(r.b.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(r.b.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(r.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(r.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},e.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(r.b.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(r.b.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(r.b.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(r.b.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(r.b.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(r.b.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(r.b.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(r.b.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(r.b.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(r.b.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(r.b.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(r.b.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(r.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(r.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},e.prototype.transform=function(e){var t,i=e.m[0]*e.m[5]*e.m[10]<0,r=n.e.Zero();if(this.positions){var o=n.e.Zero();for(t=0;tr.bbSize.y?r.bbSize.x:r.bbSize.y;$=$>r.bbSize.z?$:r.bbSize.z,L=r.subDiv.X*O/r.bbSize.x,w=r.subDiv.Y*O/r.bbSize.y,F=r.subDiv.Z*O/r.bbSize.z,N=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0}for(o=0;o0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},e.PrepareDefinesForAttributes=function(e,t,i,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;if(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(a.b.NormalKind),t._needNormals&&e.isVerticesDataPresent(a.b.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(a.b.UVKind),t.UV2=e.isVerticesDataPresent(a.b.UV2Kind)):(t.UV1=!1,t.UV2=!1),i){var s=e.useVertexColors&&e.isVerticesDataPresent(a.b.ColorKind);t.VERTEXCOLOR=s,t.VERTEXALPHA=e.hasVertexAlpha&&s&&o}return n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),!0},e.PrepareDefinesForMultiview=function(e,t){if(e.activeCamera){var i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},e.PrepareDefinesForLight=function(e,t,i,n,r,o,a){switch(a.needNormals=!0,void 0===r["LIGHT"+n]&&(a.needRebuild=!0),r["LIGHT"+n]=!0,r["SPOTLIGHT"+n]=!1,r["HEMILIGHT"+n]=!1,r["POINTLIGHT"+n]=!1,r["DIRLIGHT"+n]=!1,i.prepareLightSpecificDefines(r,n),r["LIGHT_FALLOFF_PHYSICAL"+n]=!1,r["LIGHT_FALLOFF_GLTF"+n]=!1,r["LIGHT_FALLOFF_STANDARD"+n]=!1,i.falloffType){case s.a.FALLOFF_GLTF:r["LIGHT_FALLOFF_GLTF"+n]=!0;break;case s.a.FALLOFF_PHYSICAL:r["LIGHT_FALLOFF_PHYSICAL"+n]=!0;break;case s.a.FALLOFF_STANDARD:r["LIGHT_FALLOFF_STANDARD"+n]=!0}if(o&&!i.specular.equalsFloats(0,0,0)&&(a.specularEnabled=!0),r["SHADOW"+n]=!1,r["SHADOWPCF"+n]=!1,r["SHADOWPCSS"+n]=!1,r["SHADOWPOISSON"+n]=!1,r["SHADOWESM"+n]=!1,r["SHADOWCUBE"+n]=!1,r["SHADOWLOWQUALITY"+n]=!1,r["SHADOWMEDIUMQUALITY"+n]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&i.shadowEnabled){var c=i.getShadowGenerator();if(c){var l=c.getShadowMap();l&&l.renderList&&l.renderList.length>0&&(a.shadowEnabled=!0,c.prepareDefines(r,n))}}i.lightmapMode!=s.a.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==s.a.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},e.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var a=0,s={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var c=0,l=t.lightSources;c0&&(r=n+o,t.addFallback(r,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(n,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(n,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(n,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(n,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(n,"SHADOWESM"+o));return r++},e.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},e.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(r>0&&o.a.LastCreatedEngine)for(var s=o.a.LastCreatedEngine.getCaps().maxVertexAttribs,c=t.morphTargetManager,l=c&&c.supportsNormals&&i.NORMAL,u=c&&c.supportsTangents&&i.TANGENT,h=c&&c.supportsUVs&&i.UV1,d=0;ds&&n.a.Error("Cannot add more vertex attributes for mesh "+t.name)},e.PrepareAttributesForBones=function(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(a.b.MatricesIndicesKind),e.push(a.b.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(a.b.MatricesIndicesExtraKind),e.push(a.b.MatricesWeightsExtraKind)))},e.PrepareAttributesForInstances=function(e,t){t.INSTANCES&&this.PushAttributesForInstances(e)},e.PushAttributesForInstances=function(e){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3")},e.BindLightShadow=function(e,t,i,n){if(e.shadowEnabled&&t.receiveShadows){var r=e.getShadowGenerator();r&&r.bindShadowLight(i,n)}},e.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},e.BindLight=function(t,i,n,r,o,a,s){void 0===s&&(s=!1);var l=i.toString(),u=t.getScaledIntensity();t._uniformBuffer.bindToEffect(o,"Light"+l),e.BindLightProperties(t,o,i),t.diffuse.scaleToRef(u,c.c.Color3[0]),t._uniformBuffer.updateColor4("vLightDiffuse",c.c.Color3[0],s?t.radius:t.range,l),a&&(t.specular.scaleToRef(u,c.c.Color3[1]),t._uniformBuffer.updateColor3("vLightSpecular",c.c.Color3[1],l)),n.shadowsEnabled&&this.BindLightShadow(t,r,l,o),t._uniformBuffer.update()},e.BindLights=function(e,t,i,n,r,o){void 0===r&&(r=4),void 0===o&&(o=!1);for(var a=Math.min(t.lightSources.length,r),s=0;s-1){var n=i.getTransformMatrixTexture(e);t.setTexture("boneSampler",n),t.setFloat("boneTextureWidth",4*(i.bones.length+1))}else{var r=i.getTransformMatrices(e);r&&t.setMatrices("mBones",r)}}},e.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},e.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},e.BindClipPlane=function(e,t){if(t.clipPlane){var i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}},e._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},e._tempFogColor=c.a.Black(),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var n=e-t;return-i<=n&&n<=i},e.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},e.Sign=function(e){return 0===(e=+e)||isNaN(e)?e:e>0?1:-1},e.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,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,i){return(e-t)/(i-t)},e.Denormalize=function(e,t,i){return e*(i-t)+t},e.DeltaAngle=function(t,i){var n=e.Repeat(i-t,360);return n>180&&(n-=360),n},e.PingPong=function(t,i){var n=e.Repeat(t,2*i);return i-Math.abs(n-i)},e.SmoothStep=function(t,i,n){var r=e.Clamp(n);return i*(r=-2*r*r*r+3*r*r)+t*(1-r)},e.MoveTowards=function(t,i,n){return Math.abs(i-t)<=n?i:t+e.Sign(i-t)*n},e.MoveTowardsAngle=function(t,i,n){var r=e.DeltaAngle(t,i),o=0;return-n180&&(r-=360),t+r*e.Clamp(n)},e.InverseLerp=function(t,i,n){return t!=i?e.Clamp((n-t)/(i-t)):0},e.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o;return e*(2*a-3*o+1)+i*(-2*a+3*o)+t*(a-2*o+r)+n*(a-o)},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},e.PercentToRange=function(e,t,i){return(i-t)*e+t},e.NormalizeRadians=function(t){return t-=e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.TwoPi=2*Math.PI,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(1),r=function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,e.STEP_BEFORECAMERADRAW_LAYER=1,e.STEP_BEFORERENDERTARGETDRAW_LAYER=0,e.STEP_BEFORERENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_AFTERRENDERTARGETDRAW_LAYER=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,e.STEP_AFTERCAMERADRAW_LAYER=3,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e}(),o=function(e){function t(t){return e.apply(this,t)||this}return n.d(t,e),t.Create=function(){return Object.create(t.prototype)},t.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;ne.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(A.a.ACTION_OnLongPressTrigger,y.a.CreateNew(t.pickedMesh,i)))},e.LongPressDelay)}}else for(var a=0,s=r._pointerDownStage;ae.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>e.DragMovementThreshold},e.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t),r=new I;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,C.a.POINTERUP)||this._processPointerUp(e,n,r)},e.prototype._processPointerUp=function(e,t,i){var n=this._scene;if(e&&e&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){var r=C.a.POINTERPICK,o=new C.b(r,t,e);this._setRayOnPointerInfo(o),n.onPointerObservable.notifyObservers(o,r)}var a=e.pickedMesh._getActionManagerForTrigger();if(a&&!i.ignore){a.processTrigger(A.a.ACTION_OnPickUpTrigger,y.a.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&a.processTrigger(A.a.ACTION_OnPickTrigger,y.a.CreateNew(e.pickedMesh,t));var s=e.pickedMesh._getActionManagerForTrigger(A.a.ACTION_OnDoublePickTrigger);i.doubleClick&&s&&s.processTrigger(A.a.ACTION_OnDoublePickTrigger,y.a.CreateNew(e.pickedMesh,t))}}else if(!i.ignore)for(var c=0,l=n._pointerUpStage;ce.DoubleClickDelay&&!o._doubleClickOccured||t!==o._previousButtonPressed)&&(o._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,n(i,o._currentPickResult))},this._initClickEvent=function(t,i,n,r){var a=new I;o._currentPickResult=null;var s=null,c=t.hasSpecificMask(C.a.POINTERPICK)||i.hasSpecificMask(C.a.POINTERPICK)||t.hasSpecificMask(C.a.POINTERTAP)||i.hasSpecificMask(C.a.POINTERTAP)||t.hasSpecificMask(C.a.POINTERDOUBLETAP)||i.hasSpecificMask(C.a.POINTERDOUBLETAP);!c&&M.a&&(s=o._initActionManager(s,a))&&(c=s.hasPickTriggers);var l=!1;if(c){var u=n.button;if(a.hasSwiped=o._isPointerSwiping(),!a.hasSwiped){var h=!e.ExclusiveDoubleClickMode;h||(h=!t.hasSpecificMask(C.a.POINTERDOUBLETAP)&&!i.hasSpecificMask(C.a.POINTERDOUBLETAP))&&!M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(s=o._initActionManager(s,a))&&(h=!s.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),h?(Date.now()-o._previousStartingPointerTime>e.DoubleClickDelay||u!==o._previousButtonPressed)&&(a.singleClick=!0,r(a,o._currentPickResult),l=!0):(o._previousDelayedSimpleClickTimeout=o._delayedSimpleClickTimeout,o._delayedSimpleClickTimeout=window.setTimeout(o._delayedSimpleClick.bind(o,u,a,r),e.DoubleClickDelay));var d=t.hasSpecificMask(C.a.POINTERDOUBLETAP)||i.hasSpecificMask(C.a.POINTERDOUBLETAP);!d&&M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(s=o._initActionManager(s,a))&&(d=s.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),d&&(u===o._previousButtonPressed&&Date.now()-o._previousStartingPointerTime0){for(var e=0,t=this._transientComponents;e0)return!1;for(e=0;e0,r=0,o=this._isReadyForMeshStage;r0)for(var a=0,s=this.activeCameras;a0},enumerable:!0,configurable:!0}),t.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout(function(){t._checkIsReady()},150))},t.prototype.whenReadyAsync=function(){var e=this;return new Promise(function(t){e.executeWhenReady(function(){t()})})},t.prototype._checkIsReady=function(){var e=this;return this._registerTransientComponents(),this.isReady()?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):void(this._executeWhenReadyTimeoutId=setTimeout(function(){e._checkIsReady()},150))},Object.defineProperty(t.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!0,configurable:!0}),t.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=o.a.Now},t.prototype.getViewMatrix=function(){return this._viewMatrix},t.prototype.getProjectionMatrix=function(){return this._projectionMatrix},t.prototype.getTransformMatrix=function(){return this._transformMatrix},t.prototype.setTransformMatrix=function(e,t,i,n){this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?F.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=F.a.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update()))},t.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},t.prototype.getUniqueId=function(){return N.a.UniqueId},t.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this.meshes.push(e),e._resyncLightSources(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(function(e){i.addMesh(e)})},t.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop()),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(function(e){i.removeMesh(e)}),n},t.prototype.addTransformNode=function(e){e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),this.onNewTransformNodeAddedObservable.notifyObservers(e)},t.prototype.removeTransformNode=function(e){var t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){var i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t},t.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e)),t},t.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},t.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},t.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},t.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},t.prototype.stopAnimation=function(e,t,i){},t.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},t.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),t},t.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;t--)if(this.materials[t].id===e)return this.materials[t];return null},t.prototype.getMaterialByName=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},t.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},t.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var i=this.getTransformNodeByID(e);if(i)return i;var n=this.getLightByID(e);if(n)return n;var r=this.getCameraByID(e);if(r)return r;var o=this.getBoneByID(e);return o||null},t.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getTransformNodeByName(e);if(i)return i;var n=this.getLightByName(e);if(n)return n;var r=this.getCameraByName(e);if(r)return r;var o=this.getBoneByName(e);return o||null},t.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},t.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&0!=(a.layerMask&this.activeCamera.layerMask)&&(a.alwaysSelectAsActiveMesh||a.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(a),this.activeCamera._activeMeshes.push(a),s!==a&&s._activate(this._renderId,!1),a._activate(this._renderId,!1)&&(a.isAnInstance||(s._internalAbstractMeshDataInfo._onlyForInstances=!1),s._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(a,s)),a._postActivate()))}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var c=0;c0)for(var r=this.getActiveSubMeshCandidates(t),o=r.length,a=0;a1)this.activeCamera.outputRenderTarget._bindFrameBuffer();else{var e=this.activeCamera.outputRenderTarget.getInternalTexture();e?this.getEngine().bindFramebuffer(e):S.a.Error("Camera contains invalid customDefaultRenderTarget")}}else this.getEngine().restoreDefaultFramebuffer()},t.prototype._renderForCamera=function(e,t){if(!e||!e._skipRendering){var i=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.getEngine().getCaps().multiview&&e.outputRenderTarget&&e.outputRenderTarget.getViewCount()>1?this.setTransformMatrix(e._rigCameras[0].getViewMatrix(),e._rigCameras[0].getProjectionMatrix(),e._rigCameras[1].getViewMatrix(),e._rigCameras[1].getProjectionMatrix()):this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var a=0,s=this._gatherActiveCameraRenderTargetsStage;a0){r.b.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var l=0;l0),this._renderId++}for(var d=0,f=this._cameraDrawRenderTargetStage;d1&&this.getEngine().getCaps().multiview)return this._renderForCamera(e),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else for(var t=0;t-1&&(n.trigger===A.a.ACTION_OnIntersectionExitTrigger&&n._executeCurrent(y.a.CreateNew(t,void 0,o)),t.actionManager.hasSpecificTrigger(A.a.ACTION_OnIntersectionExitTrigger,function(e){var t=e instanceof d.a?e:e.mesh;return o===t})&&n.trigger!==A.a.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(s,1))}}}},t.prototype._advancePhysicsEngineStep=function(e){},t.prototype._animate=function(){},t.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){var e=Math.max(t.MinDeltaTime,Math.min(this._engine.getDeltaTime(),t.MaxDeltaTime))+this._timeAccumulator,i=this.getDeterministicFrameTime(),n=0,r=this._engine.getLockstepMaxSteps(),o=Math.floor(e/60);o=Math.min(o,r);do{this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=.06*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._advancePhysicsEngineStep(i),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,n++,e-=i}while(e>0&&n0)for(var o=0;o0),this._intermediateRendering=!0;for(var u=0;u0),this._intermediateRendering=!1,this._renderId++}this.activeCamera=l,this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var d=0,p=this._beforeClearStage;d0)for(o=0;o0&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[o]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var g=0,v=this._afterRenderStage;g-1&&this._engine.scenes.splice(r,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.clearCachedVertexData=function(){for(var e=0;e-1?(u.a.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()?this._worldMatrix:(this.getViewMatrix(),this._worldMatrix)},t.prototype._getViewMatrix=function(){return c.a.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()?this._computedViewMatrix:(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix),this._computedViewMatrix)},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){if(this._doNotComputeProjectionMatrix||!e&&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===t.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?c.a.PerspectiveFovRHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED):c.a.PerspectiveFovLHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED);else{var r=i.getRenderWidth()/2,o=i.getRenderHeight()/2;n.useRightHandedSystem?c.a.OrthoOffCenterRHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-o,this.orthoTop||o,this.minZ,this.maxZ,this._projectionMatrix):c.a.OrthoOffCenterLHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-o,this.orthoTop||o,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},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?p.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=p.a.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){var i=!1;return this.rigCameras.forEach(function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)}),i}return e.isInFrustum(this._frustumPlanes)},t.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},t.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),d.a.WarnImport("Ray")},t.prototype.dispose=function(i,n){for(void 0===n&&(n=!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 r=this._rigCameras.pop();r&&r.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var o=this._postProcesses.length;--o>=0;){var a=this._postProcesses[o];a&&a.dispose(this)}for(o=this.customRenderTargets.length;--o>=0;)this.customRenderTargets[o].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),e.prototype.dispose.call(this,i,n)},Object.defineProperty(t.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!0,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,i){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=a.b.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var r=this.createRigCamera(this.name+"_L",0);r&&(r._isLeftCamera=!0);var o=this.createRigCamera(this.name+"_R",1);o&&(o._isRightCamera=!0),r&&o&&(this._rigCameras.push(r),this._rigCameras.push(o))}switch(this.cameraRigMode){case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH:t._setStereoscopicAnaglyphRigMode(this);break;case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case t.RIG_MODE_STEREOSCOPIC_OVERUNDER:t._setStereoscopicRigMode(this);break;case t.RIG_MODE_VR:t._setVRRigMode(this,i);break;case t.RIG_MODE_WEBVR:t._setWebVRRigMode(this,i)}this._cascadePostProcessesToRigCams(),this.update()}},t._setStereoscopicRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"},t._setStereoscopicAnaglyphRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"},t._setVRRigMode=function(e,t){throw"Import Cameras/RigModes/vrRigMode before using VR rig mode"},t._setWebVRRigMode=function(e,t){throw"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"},t.prototype._getVRProjectionMatrix=function(){return c.a.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},t.prototype._updateCameraRotationMatrix=function(){},t.prototype._updateWebVRCameraRotationMatrix=function(){},t.prototype._getWebVRProjectionMatrix=function(){return c.a.Identity()},t.prototype._getWebVRViewMatrix=function(){return c.a.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=a.b.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;es.b.CollisionsEpsilon&&r.position.addInPlace(r._meshCollisionData._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},r.getScene().addMesh(r),r._resyncLightSources(),r}return n.d(t,e),Object.defineProperty(t,"BILLBOARDMODE_NONE",{get:function(){return u.a.BILLBOARDMODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_X",{get:function(){return u.a.BILLBOARDMODE_X},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Y",{get:function(){return u.a.BILLBOARDMODE_Y},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Z",{get:function(){return u.a.BILLBOARDMODE_Z},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_ALL",{get:function(){return u.a.BILLBOARDMODE_ALL},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_USE_POSITION",{get:function(){return u.a.BILLBOARDMODE_USE_POSITION},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!0,configurable:!0}),t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,"onCollide",{set:function(e){this._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver),this._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onCollisionPositionChange",{set:function(e){this._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver),this._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){this._internalAbstractMeshDataInfo._visibility!==e&&(this._internalAbstractMeshDataInfo._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material&&this._material.meshMap&&(this._material.meshMap[this.uniqueId]=void 0),this._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._meshCollisionData._collisionMask},set:function(e){this._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collisionGroup",{get:function(){return this._meshCollisionData._collisionGroup},set:function(e){this._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_positions",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"AbstractMesh"},t.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==u.a.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e4,s=o?this.getVerticesData(c.b.MatricesIndicesExtraKind):null,l=o?this.getVerticesData(c.b.MatricesWeightsExtraKind):null;this.skeleton.prepare();for(var u=this.skeleton.getTransformMatrices(this),h=a.c.Vector3[0],d=a.c.Matrix[0],f=a.c.Matrix[1],p=0,_=0;_0&&(a.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*i[p+m]),g,f),d.addToSelf(f));if(o)for(m=0;m<4;m++)(g=l[p+m])>0&&(a.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*s[p+m]),g,f),d.addToSelf(f));a.e.TransformCoordinatesFromFloatsToRef(t[_],t[_+1],t[_+2],d,h),h.toArray(t,_),this._positions&&this._positions[_/3].copyFrom(h)}}}return t},t.prototype._updateBoundingInfo=function(){var e=this._effectiveMesh;return this._boundingInfo?this._boundingInfo.update(e.worldMatrixFromCache):this._boundingInfo=new d.a(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache),this},t.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||this._updateBoundingInfo()},Object.defineProperty(t.prototype,"_effectiveMesh",{get:function(){return this.skeleton&&this.skeleton.overrideMesh||this},enumerable:!0,configurable:!0}),t.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,i){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(i)for(var n=0,r=this.getChildMeshes();n1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=a.c.Matrix[0],i=a.c.Matrix[1];return a.a.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,i){var n=new h.a,r="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,o=this._boundingInfo;if(!(this.subMeshes&&o&&e.intersectsSphere(o.boundingSphere,r)&&e.intersectsBox(o.boundingBox,r)))return n;if(!this._generatePointsArray())return n;for(var s=null,c=this._scene.getIntersectingSubMeshCandidates(this,e),l=c.length,u=0;u1)||d.canIntersects(e)){var f=d.intersects(e,this._positions,this.getIndices(),t,i);if(f&&(t||!s||f.distance65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var u=this.getScene().activeCamera;e.facetDepthSortFrom=u?u.position:a.e.Zero()}e.depthSortedFacets=[];for(var h=0;hv.a?r.maximum.x-r.minimum.x:v.a,e.bbSize.y=r.maximum.y-r.minimum.y>v.a?r.maximum.y-r.minimum.y:v.a,e.bbSize.z=r.maximum.z-r.minimum.z>v.a?r.maximum.z-r.minimum.z:v.a;var f=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(f=f>e.bbSize.z?f:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/f),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/f),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/f),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),a.e.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,l.a.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var p=e.depthSortedIndices.length/3|0;for(h=0;hr.subDiv.max||a<0||a>r.subDiv.max||s<0||s>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*a+r.subDiv.max*r.subDiv.max*s]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var s=this.getWorldMatrix(),c=a.c.Matrix[5];s.invertToRef(c);var l=a.c.Vector3[8];a.e.TransformCoordinatesFromFloatsToRef(e,t,i,c,l);var u=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,n,r,o);return n&&a.e.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,s,n),u},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=null,s=0,c=0,l=0,u=0,h=0,d=0,f=0,p=0,_=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,y,b,T=Number.MAX_VALUE,E=T,A=0;A=0||r&&!o&&u<=0)&&(u=y.x*b.x+y.y*b.y+y.z*b.z,h=-(y.x*e+y.y*t+y.z*i-u)/(y.x*y.x+y.y*y.y+y.z*y.z),(E=(s=(d=e+y.x*h)-e)*s+(c=(f=t+y.y*h)-t)*c+(l=(p=i+y.z*h)-i)*l)100&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=o.b.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new o.b),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this.soft&&(this._options.mass=this._options.mass>0?this._options.mass:1,this._options.pressure=void 0===i.pressure?200:i.pressure,this._options.stiffness=void 0===i.stiffness?1:i.stiffness,this._options.velocityIterations=void 0===i.velocityIterations?20:i.velocityIterations,this._options.positionIterations=void 0===i.positionIterations?20:i.positionIterations,this._options.fixedPoints=void 0===i.fixedPoints?0:i.fixedPoints,this._options.margin=void 0===i.margin?0:i.margin,this._options.damping=void 0===i.damping?0:i.damping,this._options.path=void 0===i.path?null:i.path,this._options.shape=void 0===i.shape?null:i.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&n.a.Warn("You must affect impostors to children before affecting impostor to parent.")):n.a.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):n.a.Error("No object was provided. A physics object is obligatory")}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"friction",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restitution",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pressure",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPressure&&t.setBodyPressure(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stiffness",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyStiffness&&t.setBodyStiffness(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"velocityIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"positionIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPositionIterations&&t.setBodyPositionIterations(this,e)}},enumerable:!0,configurable:!0}),e.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},e.prototype._getPhysicsParent=function(){return this.object.parent instanceof a.a?this.object.parent.physicsImpostor:null},e.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&!this._parent},e.prototype.setScalingUpdated=function(){this.forceUpdate()},e.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(e.prototype,"physicsBody",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!0,configurable:!0}),e.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},e.prototype.getObjectExtendSize=function(){if(this.object.getBoundingInfo){var t=this.object.rotationQuaternion;this.object.rotationQuaternion=e.IDENTITY_QUATERNION,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);var i=this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2);return this.object.rotationQuaternion=t,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),i}return e.DEFAULT_OBJECT_SIZE},e.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},e.prototype.getParam=function(e){return this._options[e]},e.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},e.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},e.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):o.e.Zero()},e.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},e.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):o.e.Zero()},e.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},e.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},e.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},e.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);t>-1?this._onBeforePhysicsStepCallbacks.splice(t,1):n.a.Warn("Function to remove was not found")},e.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},e.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);t>-1?this._onAfterPhysicsStepCallbacks.splice(t,1):n.a.Warn("Function to remove was not found")},e.prototype.registerOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})},e.prototype.unregisterOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e],r=-1;this._onPhysicsCollideCallbacks.some(function(e,n){if(e.callback===t&&e.otherImpostors.length===i.length){var o=e.otherImpostors.every(function(e){return i.indexOf(e)>-1});return o&&(r=n),o}return!1})?this._onPhysicsCollideCallbacks.splice(r,1):n.a.Warn("Function to remove was not found")},e.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):o.b.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},e.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},e.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},e.prototype.createJoint=function(e,t,i){var n=new c.e(t,i);return this.addJoint(e,n),this},e.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},e.prototype.addAnchor=function(e,t,i,n,r){if(!this._physicsEngine)return this;var o=this._physicsEngine.getPhysicsPlugin();return o.appendAnchor?(this._physicsEngine&&o.appendAnchor(this,e,t,i,n,r),this):this},e.prototype.addHook=function(e,t,i,n){if(!this._physicsEngine)return this;var r=this._physicsEngine.getPhysicsPlugin();return r.appendAnchor?(this._physicsEngine&&r.appendHook(this,e,t,i,n),this):this},e.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},e.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},e.prototype.clone=function(t){return t?new e(t,this.type,this._options,this._scene):null},e.prototype.dispose=function(){var e=this;this._physicsEngine&&(this._joints.forEach(function(t){e._physicsEngine&&e._physicsEngine.removeJoint(e,t.otherImpostor,t.joint)}),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},e.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},e.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new o.b),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},e.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},e.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},e.prototype.syncBoneWithImpostor=function(t,i,n,r,o){var a=e._tmpVecs[0],s=this.object;if(s.rotationQuaternion)if(o){var c=e._tmpQuat;s.rotationQuaternion.multiplyToRef(o,c),t.setRotationQuaternion(c,l.b.WORLD,i)}else t.setRotationQuaternion(s.rotationQuaternion,l.b.WORLD,i);a.x=0,a.y=0,a.z=0,n&&(a.x=n.x,a.y=n.y,a.z=n.z,t.getDirectionToRef(a,i,a),null==r&&(r=n.length()),a.x*=r,a.y*=r,a.z*=r),t.getParent()?(a.addInPlace(s.getAbsolutePosition()),t.setAbsolutePosition(a,i)):(i.setAbsolutePosition(s.getAbsolutePosition()),i.position.x-=a.x,i.position.y-=a.y,i.position.z-=a.z)},e.prototype.syncImpostorWithBone=function(t,i,n,r,o,a){var s=this.object;if(s.rotationQuaternion)if(o){var c=e._tmpQuat;t.getRotationQuaternionToRef(l.b.WORLD,i,c),c.multiplyToRef(o,s.rotationQuaternion)}else t.getRotationQuaternionToRef(l.b.WORLD,i,s.rotationQuaternion);var u=e._tmpVecs[0],h=e._tmpVecs[1];a||((a=e._tmpVecs[2]).x=0,a.y=1,a.z=0),t.getDirectionToRef(a,i,h),t.getAbsolutePositionToRef(i,u),null==r&&n&&(r=n.length()),null!=r&&(u.x+=h.x*r,u.y+=h.y*r,u.z+=h.z*r),s.setAbsolutePosition(u)},e.DEFAULT_OBJECT_SIZE=new o.e(1,1,1),e.IDENTITY_QUATERNION=o.b.Identity(),e._tmpVecs=r.a.BuildArray(3,o.e.Zero),e._tmpQuat=o.b.Identity(),e.NoImpostor=0,e.SphereImpostor=1,e.BoxImpostor=2,e.PlaneImpostor=3,e.MeshImpostor=4,e.CapsuleImpostor=6,e.CylinderImpostor=7,e.ParticleImpostor=8,e.HeightmapImpostor=9,e.ConvexHullImpostor=10,e.RopeImpostor=101,e.ClothImpostor=102,e.SoftbodyImpostor=103,e}()},function(e,t,i){"use strict";var n=i(1),r=i(2),o=i(32),a=i(18),s=i(0),c=i(10),l=i(4),u=i(35),h=i(6),d=i(68),f=i(78),p=i(15),_=i(9),m=i(13),g=i(20),v="uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\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#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\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";h.a.IncludesShadersStore.defaultFragmentDeclaration=v;var y="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;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n";h.a.IncludesShadersStore.defaultUboDeclaration=y;i(63),i(97),i(98),i(138),i(130);var b="#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";h.a.IncludesShadersStore.fresnelFunction=b;i(131),i(99),i(100),i(139),i(110),i(101),i(114),i(102),i(140),i(141),i(132),i(133),i(115);var T="#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\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\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\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\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\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\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a\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[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\n#include\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\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n";h.a.ShadersStore.defaultPixelShader=T;var E="\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 REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n";h.a.IncludesShadersStore.defaultVertexDeclaration=E;i(72),i(73),i(142),i(111),i(116),i(88),i(89),i(90),i(74),i(75),i(143),i(103),i(134),i(135);h.a.IncludesShadersStore.pointCloudVertex="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";i(136);var A="#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\n#include\n\n#include\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\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[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\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#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(positionUpdated,1.0)).xyz;\n#else\nvPositionUVW=positionUpdated;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\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 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";h.a.ShadersStore.defaultVertexShader=A;var P=i(3);i.d(t,"b",function(){return S}),i.d(t,"a",function(){return R});var S=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.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!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.BONETEXTURE=!1,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_SKYBOX_TRANSFORMED=!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.MORPHTARGETS_UV=!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.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.MULTIVIEW=!1,t.IS_REFLECTION_LINEAR=!1,t.IS_REFRACTION_LINEAR=!1,t.EXPOSURE=!1,t.rebuild(),t}return n.d(t,e),t.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===_.a.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,this._reflectionTexture.coordinatesMode){case _.a.EXPLICIT_MODE:o.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case _.a.PLANAR_MODE:o.setReflectionMode("REFLECTIONMAP_PLANAR");break;case _.a.PROJECTION_MODE:o.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case _.a.SKYBOX_MODE:o.setReflectionMode("REFLECTIONMAP_SKYBOX"),o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!this._reflectionTexture.getReflectionTextureMatrix().isIdentity();break;case _.a.SPHERICAL_MODE:o.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case _.a.EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case _.a.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case _.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case _.a.CUBIC_MODE:case _.a.INVCUBIC_MODE:default:o.setReflectionMode("REFLECTIONMAP_CUBIC")}o.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else o.REFLECTION=!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._emissiveTexture,o,"EMISSIVE")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._lightmapTexture,o,"LIGHTMAP"),o.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap}else o.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._specularTexture,o,"SPECULAR"),o.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else o.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;p.a.PrepareDefinesForMergedUV(this._bumpTexture,o,"BUMP"),o.PARALLAX=this._useParallax,o.PARALLAXOCCLUSION=this._useParallaxOcclusion,o.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else o.BUMP=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;o._needUVs=!0,o.REFRACTION=!0,o.REFRACTIONMAP_3D=this._refractionTexture.isCube}else o.REFRACTION=!1;o.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else o.DIFFUSE=!1,o.AMBIENT=!1,o.OPACITY=!1,o.REFLECTION=!1,o.EMISSIVE=!1,o.LIGHTMAP=!1,o.BUMP=!1,o.REFRACTION=!1;o.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),o.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,o.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,o.SPECULAROVERALPHA=this._useSpecularOverAlpha,o.PREMULTIPLYALPHA=this.alphaMode===P.a.ALPHA_PREMULTIPLIED||this.alphaMode===P.a.ALPHA_PREMULTIPLIED_PORTERDUFF}if(o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(o.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,o.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,o.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,o.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,o.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,o.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,o._needNormals=!0,o.FRESNEL=!0):o.FRESNEL=!1),p.a.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),p.a.PrepareDefinesForAttributes(e,o,!0,!0,!0),p.a.PrepareDefinesForFrameBoundValues(r,a,o,n),o.isDirty){o.markAsProcessed();var s=new h.c;o.REFLECTION&&s.addFallback(0,"REFLECTION"),o.SPECULAR&&s.addFallback(0,"SPECULAR"),o.BUMP&&s.addFallback(0,"BUMP"),o.PARALLAX&&s.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&s.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&s.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&s.addFallback(1,"FOG"),o.POINTSIZE&&s.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),p.a.HandleFallbacksForShadows(o,s,this._maxSimultaneousLights),o.SPECULARTERM&&s.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&s.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&s.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&s.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&s.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&s.addFallback(4,"FRESNEL"),o.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");var c=[l.b.PositionKind];o.NORMAL&&c.push(l.b.NormalKind),o.UV1&&c.push(l.b.UVKind),o.UV2&&c.push(l.b.UV2Kind),o.VERTEXCOLOR&&c.push(l.b.ColorKind),p.a.PrepareAttributesForBones(c,e,o,s),p.a.PrepareAttributesForInstances(c,o),p.a.PrepareAttributesForMorphTargets(c,e,o);var d="default",f=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth"],m=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],g=["Material","Scene"];u.a&&(u.a.PrepareUniforms(f,o),u.a.PrepareSamplers(m,o)),p.a.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:g,samplers:m,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(d=this.customShaderNameResolve(d,f,g,m,o));var v=o.toString(),y=i.effect,b=r.getEngine().createEffect(d,{attributes:c,uniformsNames:f,uniformBuffersNames:g,samplers:m,defines:v,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS}},a);b&&(this.allowShaderHotSwapping&&y&&!b.isReady()?(b=y,o.markAsUnprocessed()):(r.resetCachedMaterial(),i.setEffect(b,o),this.buildUniformLayout()))}return!(!i.effect||!i.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vDiffuseColor",4),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var s=n.effect;if(s){this._activeEffect=s,o.INSTANCES||this.bindOnlyWorldMatrix(e),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var l=this._mustRebind(r,s,i.visibility);p.a.BindBonesParameters(i,s);var u=this._uniformBuffer;if(l){if(u.bindToEffect(s,"Material"),this.bindViewProjection(s),!u.useUbo||!this.isFrozen||!u.isSync){if(t.FresnelEnabled&&o.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(u.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),u.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&u.updateColor4("opacityParts",new c.a(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(u.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),u.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(u.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),u.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(u.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),u.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&t.DiffuseTextureEnabled&&(u.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),p.a.BindTextureMatrix(this._diffuseTexture,u,"diffuse"),this._diffuseTexture.hasAlpha&&s.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&t.AmbientTextureEnabled&&(u.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),p.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&t.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),p.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),this._reflectionTexture&&t.ReflectionTextureEnabled&&(u.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),u.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var h=this._reflectionTexture;u.updateVector3("vReflectionPosition",h.boundingBoxPosition),u.updateVector3("vReflectionSize",h.boundingBoxSize)}if(this._emissiveTexture&&t.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),p.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&t.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),p.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),this._specularTexture&&t.SpecularTextureEnabled&&(u.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),p.a.BindTextureMatrix(this._specularTexture,u,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),p.a.BindTextureMatrix(this._bumpTexture,u,"bump"),r._mirroredCameraPosition?u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&t.RefractionTextureEnabled){var d=1;this._refractionTexture.isCube||(u.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(d=this._refractionTexture.depth)),u.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,d,this.invertRefractionY?-1:1)}}this.pointsCloud&&u.updateFloat("pointSize",this.pointSize),o.SPECULARTERM&&u.updateColor4("vSpecularColor",this.specularColor,this.specularPower),u.updateColor3("vEmissiveColor",t.EmissiveTextureEnabled?this.emissiveColor:c.a.BlackReadOnly),u.updateFloat("visibility",i.visibility),u.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)}if(r.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&s.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&s.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&s.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?s.setTexture("reflectionCubeSampler",this._reflectionTexture):s.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&s.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&s.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&s.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&s.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled)){d=1;this._refractionTexture.isCube?s.setTexture("refractionCubeSampler",this._refractionTexture):s.setTexture("refraction2DSampler",this._refractionTexture)}p.a.BindClipPlane(s,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),p.a.BindEyePosition(s,r),s.setColor3("vAmbientColor",this._globalAmbientColor)}!l&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&p.a.BindLights(r,i,s,o,this._maxSimultaneousLights),(r.fogEnabled&&i.applyFog&&r.fogMode!==a.a.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(s),p.a.BindFogParameters(r,i,s),o.NUM_MORPH_INFLUENCERS&&p.a.BindMorphTargetParameters(i,s),p.a.BindLogDepth(o,s,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),u.update(),this._afterBind(i,this._activeEffect)}}},t.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},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._emissiveTexture===t||(this._specularTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||this._refractionTexture===t))))))))},t.prototype.dispose=function(t,i){i&&(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),e.prototype.dispose.call(this,t,i)},t.prototype.clone=function(e){var i=this,n=r.a.Clone(function(){return new t(e,i.getScene())},this);return n.name=e,n.id=e,n},t.prototype.serialize=function(){return r.a.Serialize(this)},t.Parse=function(e,i,n){return r.a.Parse(function(){return new t(e.name,i)},e,i,n)},Object.defineProperty(t,"DiffuseTextureEnabled",{get:function(){return g.a.DiffuseTextureEnabled},set:function(e){g.a.DiffuseTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"AmbientTextureEnabled",{get:function(){return g.a.AmbientTextureEnabled},set:function(e){g.a.AmbientTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"OpacityTextureEnabled",{get:function(){return g.a.OpacityTextureEnabled},set:function(e){g.a.OpacityTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ReflectionTextureEnabled",{get:function(){return g.a.ReflectionTextureEnabled},set:function(e){g.a.ReflectionTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"EmissiveTextureEnabled",{get:function(){return g.a.EmissiveTextureEnabled},set:function(e){g.a.EmissiveTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"SpecularTextureEnabled",{get:function(){return g.a.SpecularTextureEnabled},set:function(e){g.a.SpecularTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BumpTextureEnabled",{get:function(){return g.a.BumpTextureEnabled},set:function(e){g.a.BumpTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LightmapTextureEnabled",{get:function(){return g.a.LightmapTextureEnabled},set:function(e){g.a.LightmapTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"RefractionTextureEnabled",{get:function(){return g.a.RefractionTextureEnabled},set:function(e){g.a.RefractionTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ColorGradingTextureEnabled",{get:function(){return g.a.ColorGradingTextureEnabled},set:function(e){g.a.ColorGradingTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"FresnelEnabled",{get:function(){return g.a.FresnelEnabled},set:function(e){g.a.FresnelEnabled=e},enumerable:!0,configurable:!0}),n.c([Object(r.m)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"diffuseTexture",void 0),n.c([Object(r.m)("ambientTexture")],t.prototype,"_ambientTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),n.c([Object(r.m)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),n.c([Object(r.m)("reflectionTexture")],t.prototype,"_reflectionTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),n.c([Object(r.m)("emissiveTexture")],t.prototype,"_emissiveTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),n.c([Object(r.m)("specularTexture")],t.prototype,"_specularTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularTexture",void 0),n.c([Object(r.m)("bumpTexture")],t.prototype,"_bumpTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),n.c([Object(r.m)("lightmapTexture")],t.prototype,"_lightmapTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"lightmapTexture",void 0),n.c([Object(r.m)("refractionTexture")],t.prototype,"_refractionTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),n.c([Object(r.e)("ambient")],t.prototype,"ambientColor",void 0),n.c([Object(r.e)("diffuse")],t.prototype,"diffuseColor",void 0),n.c([Object(r.e)("specular")],t.prototype,"specularColor",void 0),n.c([Object(r.e)("emissive")],t.prototype,"emissiveColor",void 0),n.c([Object(r.c)()],t.prototype,"specularPower",void 0),n.c([Object(r.c)("useAlphaFromDiffuseTexture")],t.prototype,"_useAlphaFromDiffuseTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFromDiffuseTexture",void 0),n.c([Object(r.c)("useEmissiveAsIllumination")],t.prototype,"_useEmissiveAsIllumination",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useEmissiveAsIllumination",void 0),n.c([Object(r.c)("linkEmissiveWithDiffuse")],t.prototype,"_linkEmissiveWithDiffuse",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkEmissiveWithDiffuse",void 0),n.c([Object(r.c)("useSpecularOverAlpha")],t.prototype,"_useSpecularOverAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),n.c([Object(r.c)("useReflectionOverAlpha")],t.prototype,"_useReflectionOverAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useReflectionOverAlpha",void 0),n.c([Object(r.c)("disableLighting")],t.prototype,"_disableLighting",void 0),n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.c([Object(r.c)("useObjectSpaceNormalMap")],t.prototype,"_useObjectSpaceNormalMap",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),n.c([Object(r.c)("useParallax")],t.prototype,"_useParallax",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),n.c([Object(r.c)("useParallaxOcclusion")],t.prototype,"_useParallaxOcclusion",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),n.c([Object(r.c)()],t.prototype,"parallaxScaleBias",void 0),n.c([Object(r.c)("roughness")],t.prototype,"_roughness",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),n.c([Object(r.c)()],t.prototype,"indexOfRefraction",void 0),n.c([Object(r.c)()],t.prototype,"invertRefractionY",void 0),n.c([Object(r.c)()],t.prototype,"alphaCutOff",void 0),n.c([Object(r.c)("useLightmapAsShadowmap")],t.prototype,"_useLightmapAsShadowmap",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),n.c([Object(r.h)("diffuseFresnelParameters")],t.prototype,"_diffuseFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"diffuseFresnelParameters",void 0),n.c([Object(r.h)("opacityFresnelParameters")],t.prototype,"_opacityFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelAndMiscDirty")],t.prototype,"opacityFresnelParameters",void 0),n.c([Object(r.h)("reflectionFresnelParameters")],t.prototype,"_reflectionFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"reflectionFresnelParameters",void 0),n.c([Object(r.h)("refractionFresnelParameters")],t.prototype,"_refractionFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"refractionFresnelParameters",void 0),n.c([Object(r.h)("emissiveFresnelParameters")],t.prototype,"_emissiveFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"emissiveFresnelParameters",void 0),n.c([Object(r.c)("useReflectionFresnelFromSpecular")],t.prototype,"_useReflectionFresnelFromSpecular",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"useReflectionFresnelFromSpecular",void 0),n.c([Object(r.c)("useGlossinessFromSpecularMapAlpha")],t.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGlossinessFromSpecularMapAlpha",void 0),n.c([Object(r.c)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),n.c([Object(r.c)("invertNormalMapX")],t.prototype,"_invertNormalMapX",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),n.c([Object(r.c)("invertNormalMapY")],t.prototype,"_invertNormalMapY",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),n.c([Object(r.c)("twoSidedLighting")],t.prototype,"_twoSidedLighting",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),n.c([Object(r.c)()],t.prototype,"useLogarithmicDepth",null),t}(f.a);m.a.RegisteredTypes["BABYLON.StandardMaterial"]=R,a.a.DefaultMaterialFactory=function(e){return new R("default material",e)}},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(1),r=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;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return n.d(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;t0)if("object"==typeof a[0])for(var c=0;cl.x)return!1}else if(r=1/this.direction.x,o=(c.x-this.origin.x)*r,(a=(l.x-this.origin.x)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yl.y)return!1}else if(r=1/this.direction.y,o=(c.y-this.origin.y)*r,(a=(l.y-this.origin.y)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zl.z)return!1}else if(r=1/this.direction.z,o=(c.z-this.origin.z)*r,(a=(l.z-this.origin.z)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,a=e.radius+t,s=a*a;if(o<=s)return!0;var c=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(c<0)&&o-c*c<=s},e.prototype.intersectsTriangle=function(t,i,n){var o=e.TmpVector3[0],s=e.TmpVector3[1],c=e.TmpVector3[2],l=e.TmpVector3[3],u=e.TmpVector3[4];i.subtractToRef(t,o),n.subtractToRef(t,s),r.e.CrossToRef(this.direction,s,c);var h=r.e.Dot(o,c);if(0===h)return null;var d=1/h;this.origin.subtractToRef(t,l);var f=r.e.Dot(l,c)*d;if(f<0||f>1)return null;r.e.CrossToRef(l,o,u);var p=r.e.Dot(this.direction,u)*d;if(p<0||f+p>1)return null;var _=r.e.Dot(s,u)*d;return _>this.length?null:new a.a(1-f-p,f,_)},e.prototype.intersectsPlane=function(e){var t,i=r.e.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=r.e.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return(i=(this.origin.y-t)/this.direction.y)>0?null:new r.e(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return(i=(this.origin.x-t)/this.direction.x)>0?null:new r.e(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return(i=(this.origin.z-t)/this.direction.z)>0?null:new r.e(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},e.prototype.intersectsMesh=function(t,i){var n=r.c.Matrix[0];return t.getWorldMatrix().invertToRef(n),this._tmpRay?e.TransformToRef(this,n,this._tmpRay):this._tmpRay=e.Transform(this,n),t.intersects(this._tmpRay,i)},e.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;nt.distance?1:0},e.prototype.intersectionSegment=function(t,i,n){var o=this.origin,a=r.c.Vector3[0],s=r.c.Vector3[1],c=r.c.Vector3[2],l=r.c.Vector3[3];i.subtractToRef(t,a),this.direction.scaleToRef(e.rayl,c),o.addToRef(c,s),t.subtractToRef(o,l);var u,h,d,f,p=r.e.Dot(a,a),_=r.e.Dot(a,c),m=r.e.Dot(c,c),g=r.e.Dot(a,l),v=r.e.Dot(c,l),y=p*m-_*_,b=y,T=y;yb&&(h=b,f=v+_,T=m)),f<0?(f=0,-g<0?h=0:-g>p?h=b:(h=-g,b=p)):f>T&&(f=T,-g+_<0?h=0:-g+_>p?h=b:(h=-g+_,b=p)),u=Math.abs(h)0&&d<=this.length&&P.lengthSquared()=r.distance))&&(r=l,i)))break}return r||new o.a},s.a.prototype._internalMultiPick=function(e,t,i){if(!o.a)return null;for(var n=new Array,r=0;r0)):!i._pointerCaptures[c.pointerId]&&a.distance>s.distance&&(i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(s.pickedMesh)?(i._notifyObservers(t,s,c),t.skipOnPointerObservable=!0):i._lastPointerEvents[c.pointerId]&&(i.onPointerOutObservable.notifyObservers(c.pointerId),delete i._lastPointerEvents[c.pointerId])),t.type===o.a.POINTERUP&&i._pointerCaptures[c.pointerId]&&(i._pointerCaptures[c.pointerId]=!1))}}}}),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterCameraRenderObservable.add(function(e){i.shouldRender&&e==i.getRenderCamera()&&i.render()}),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(function(){i.dispose()}),this._updateCamera()}return e.prototype.getRenderCamera=function(){return this._renderCamera?this._renderCamera:this.originalScene.activeCameras.length>1?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera},e.prototype.setRenderCamera=function(e){this._renderCamera=e},e.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new s.a("shared gizmo light",new c.e(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=l.a.Gray()),this._sharedGizmoLight},Object.defineProperty(e,"DefaultUtilityLayer",{get:function(){return null==e._DefaultUtilityLayer&&(e._DefaultUtilityLayer=new e(a.a.LastCreatedScene),e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function(){e._DefaultUtilityLayer=null})),e._DefaultUtilityLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultKeepDepthUtilityLayer",{get:function(){return null==e._DefaultKeepDepthUtilityLayer&&(e._DefaultKeepDepthUtilityLayer=new e(a.a.LastCreatedScene),e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function(){e._DefaultKeepDepthUtilityLayer=null})),e._DefaultKeepDepthUtilityLayer},enumerable:!0,configurable:!0}),e.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(e.type,e.event,t)),this._lastPointerEvents[i.pointerId]=!0)},e.prototype.render=function(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){var e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}},e.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},e.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(1),r=i(2),o=i(0),a=i(10),s=i(27),c=i(76),l=i(13),u=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.diffuse=new a.a(1,1,1),r.specular=new a.a(1,1,1),r.falloffType=t.FALLOFF_DEFAULT,r.intensity=1,r._range=Number.MAX_VALUE,r._inverseSquaredRange=0,r._photometricScale=1,r._intensityMode=t.INTENSITYMODE_AUTOMATIC,r._radius=1e-5,r.renderPriority=0,r._shadowEnabled=!0,r._excludeWithLayerMask=0,r._includeOnlyWithLayerMask=0,r._lightmapMode=0,r._excludedMeshesIds=new Array,r._includedOnlyMeshesIds=new Array,r._isLight=!0,r.getScene().addLight(r),r._uniformBuffer=new c.a(r.getScene().getEngine()),r._buildUniformLayout(),r.includedOnlyMeshes=new Array,r.excludedMeshes=new Array,r._resyncMeshes(),r}return n.d(t,e),Object.defineProperty(t.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"Light"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i0&&-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)))},t.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var n=0,r=this.getScene().meshes;n0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach(function(t){e.excludedMeshesIds.push(t.id)})),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach(function(t){e.includedOnlyMeshesIds.push(t.id)})),r.a.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},t.GetConstructorFromName=function(e,t,i){var n=s.a.Construct("Light_Type_"+e,t,i);return n||null},t.Parse=function(e,i){var n=t.GetConstructorFromName(e.type,e.name,i);if(!n)return null;var o=r.a.Parse(n,e,i);if(e.excludedMeshesIds&&(o._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(o._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(o._waitingParentId=e.parentId),void 0!==e.falloffType&&(o.falloffType=e.falloffType),void 0!==e.lightmapMode&&(o.lightmapMode=e.lightmapMode),e.animations){for(var a=0;a0&&(t.push(s-1),t.push(s)),s++}var d=new o.a;return d.indices=t,d.positions=i,r&&(d.colors=a),d},o.a.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,a=e.gapSize||1,s=e.dashNb||200,c=e.points,l=new Array,u=new Array,h=n.e.Zero(),d=0,f=0,p=0,_=0,m=0;for(m=0;ml.max||l.min>c.max)},d=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new a.a(e,t,i),this.boundingSphere=new s.a(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,i){var n=e.TmpVector3[0].copyFrom(t).subtractInPlace(i),r=e.TmpVector3[1].copyFrom(t).addInPlace(i);return this.boundingBox.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=o.a.MESHES_CULLINGSTRATEGY_STANDARD),!(t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(t!==o.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e.TmpVector3[0]).length()},enumerable:!0,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},e.prototype.intersects=function(e,t){if(!s.a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!a.a.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!h(i.directions[0],i,n)&&(!!h(i.directions[1],i,n)&&(!!h(i.directions[2],i,n)&&(!!h(n.directions[0],i,n)&&(!!h(n.directions[1],i,n)&&(!!h(n.directions[2],i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[1]),i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[2]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[1]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[2]),i,n)&&(!!h(r.e.Cross(i.directions[2],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[2],n.directions[1]),i,n)&&!!h(r.e.Cross(i.directions[2],n.directions[2]),i,n))))))))))))))},e.TmpVector3=n.a.BuildArray(2,r.e.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(53),r=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,i){e.Enabled&&(this._current+=t,i&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=n.a.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=n.a.Now;this._current=i-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=n.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}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(5),o=i(14);o.a.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,a=e.diameterZ||e.diameter||1,s=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,c=e.slice&&e.slice<=0?1:e.slice||1,l=0===e.sideOrientation?0:e.sideOrientation||o.a.DEFAULTSIDE,u=new n.e(i/2,r/2,a/2),h=2+t,d=2*h,f=[],p=[],_=[],m=[],g=0;g<=h;g++){for(var v=g/h,y=v*Math.PI*c,b=0;b<=d;b++){var T=b/d,E=T*Math.PI*2*s,A=n.a.RotationZ(-y),P=n.a.RotationY(E),S=n.e.TransformCoordinates(n.e.Up(),A),R=n.e.TransformCoordinates(S,P),x=R.multiply(u),C=R.divide(u).normalize();p.push(x.x,x.y,x.z),_.push(C.x,C.y,C.z),m.push(T,v)}if(g>0)for(var M=p.length/3,O=M-2*(d+1);O+d+2=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),void 0!==this._texture&&(this.releaseInternalTexture(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear())}},e.prototype.serialize=function(){if(!this.name)return null;var e=r.a.Serialize(this);return r.a.AppendSerializedAnimations(this,e),e},e.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n,r,o=function(){if((n=e[a]).isReady())0==--i&&t();else{r=n.onLoadObservable;var o=function(){r.removeCallback(o),0==--i&&t()};r.add(o)}},a=0;a=200&&e.status<300||0===e.status&&(!o.a.IsWindowObjectExist()||h.IsFileURL()))return void t(l?e.response:e.responseText,e.responseURL);var i=h.DefaultRetryStrategy;if(i){var _=i(f,e,c);if(-1!==_)return e.removeEventListener("loadend",d),e=new n.a,void(a=setTimeout(function(){return s(c+1)},_))}var g=new r.a("Error status: "+e.status+" "+e.statusText+" - Unable to load "+f,e);if(!u)throw g;u(e,g)}};e.addEventListener("readystatechange",m),e.send()};s(0)};if(c&&c.enableSceneOffline){var g=function(e){e&&e.status>400?u&&u(e):p||m()};c.open(function(){p||c&&c.loadFile(e,function(e){p||t(e),_.onCompleteObservable.notifyObservers(_)},i?function(e){p||i(e)}:void 0,g,l)},g)}else m();return _},e.IsFileURL=function(){return"file:"===location.protocol},e.DefaultRetryStrategy=c.a.ExponentialBackoff(),e.BaseUrl="",e.CorsBehavior="anonymous",e.PreprocessUrl=function(e){return e},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){function e(){}return e._RemoveAndStorePivotPoint=function(t){t&&0===e._PivotCached&&(t.getPivotPointToRef(e._OldPivotPoint),e._OldPivotPoint.equalsToFloats(0,0,0)||(t.setPivotMatrix(n.a.IdentityReadOnly),e._OldPivotPoint.subtractToRef(t.getPivotPoint(),e._PivotTranslation),e._PivotTmpVector.copyFromFloats(1,1,1),e._PivotTmpVector.subtractInPlace(t.scaling),e._PivotTmpVector.multiplyInPlace(e._PivotTranslation),t.position.addInPlace(e._PivotTmpVector))),e._PivotCached++},e._RestorePivotPoint=function(t){t&&!e._OldPivotPoint.equalsToFloats(0,0,0)&&1===e._PivotCached&&(t.setPivotPoint(e._OldPivotPoint),e._PivotTmpVector.copyFromFloats(1,1,1),e._PivotTmpVector.subtractInPlace(t.scaling),e._PivotTmpVector.multiplyInPlace(e._PivotTranslation),t.position.subtractInPlace(e._PivotTmpVector)),this._PivotCached--},e._PivotCached=0,e._OldPivotPoint=new n.e,e._PivotTranslation=new n.e,e._PivotTmpVector=new n.e,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(5),o=i(43),a=function(){function e(e){var t=this;void 0===e&&(e=o.a.DefaultUtilityLayer),this.gizmoLayer=e,this._attachedMesh=null,this.scaleRatio=1,this._customMeshSet=!1,this.updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this.updateScale=!0,this._interactionsEnabled=!0,this._tempVector=new n.e,this._rootMesh=new r.a("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=n.b.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function(){t._update()})}return Object.defineProperty(e.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){this._attachedMesh=e,this._rootMesh.setEnabled(!!e),this._attachedMeshChanged(e)},enumerable:!0,configurable:!0}),e.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach(function(e){e.dispose()}),e.parent=this._rootMesh,this._customMeshSet=!0},e.prototype._attachedMeshChanged=function(e){},e.prototype._update=function(){if(this.attachedMesh){var e=this.attachedMesh._effectiveMesh||this.attachedMesh;if(this.updateGizmoPositionToMatchAttachedMesh&&this._rootMesh.position.copyFrom(e.absolutePosition),this.updateGizmoRotationToMatchAttachedMesh?e.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1),this.updateScale){var t=this.gizmoLayer.utilityLayerScene.activeCamera,i=t.globalPosition;t.devicePosition&&(i=t.devicePosition),this._rootMesh.position.subtractToRef(i,this._tempVector);var n=this._tempVector.length()*this.scaleRatio;this._rootMesh.scaling.set(n,n,n),e._getWorldMatrixDeterminant()<0&&(this._rootMesh.scaling.y*=-1)}else this._rootMesh.scaling.setAll(this.scaleRatio)}},e.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(37),r=function(){function e(){}return Object.defineProperty(e,"Now",{get:function(){return n.a.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!0,configurable:!0}),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(0),r=i(4),o=function(){function e(){this._pickingUnavailable=!1,this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshId=0,this.pickedSprite=null,this.originMesh=null,this.ray=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.b.NormalKind))return null;var i,o=this.pickedMesh.getIndices();if(!o)return null;if(t){var a=this.pickedMesh.getVerticesData(r.b.NormalKind),s=n.e.FromArray(a,3*o[3*this.faceId]),c=n.e.FromArray(a,3*o[3*this.faceId+1]),l=n.e.FromArray(a,3*o[3*this.faceId+2]);s=s.scale(this.bu),c=c.scale(this.bv),l=l.scale(1-this.bu-this.bv),i=new n.e(s.x+c.x+l.x,s.y+c.y+l.y,s.z+c.z+l.z)}else{var u=this.pickedMesh.getVerticesData(r.b.PositionKind),h=n.e.FromArray(u,3*o[3*this.faceId]),d=n.e.FromArray(u,3*o[3*this.faceId+1]),f=n.e.FromArray(u,3*o[3*this.faceId+2]),p=h.subtract(d),_=f.subtract(d);i=n.e.Cross(p,_)}if(e){var m=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(n.c.Matrix[0].copyFrom(m),(m=n.c.Matrix[0]).setTranslationFromFloats(0,0,0),m.invert(),m.transposeToRef(n.c.Matrix[1]),m=n.c.Matrix[1]),i=n.e.TransformNormal(i,m)}return i.normalize(),i},e.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.b.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(r.b.UVKind);if(!t)return null;var i=n.d.FromArray(t,2*e[3*this.faceId]),o=n.d.FromArray(t,2*e[3*this.faceId+1]),a=n.d.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(this.bu),o=o.scale(this.bv),a=a.scale(1-this.bu-this.bv),new n.d(i.x+o.x+a.x,i.y+o.y+a.y)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"b",function(){return u});var n=i(1),r=i(4),o=i(96),a=i(46),s=i(3),c=i(106),l=function(){function e(){this._materialDefines=null,this._materialEffect=null}return Object.defineProperty(e.prototype,"effect",{get:function(){return this._materialEffect},enumerable:!0,configurable:!0}),e.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},e}(),u=function(e){function t(t,i,n,r,o,a,s,c){void 0===c&&(c=!0);var l=e.call(this)||this;return l.materialIndex=t,l.verticesStart=i,l.verticesCount=n,l.indexStart=r,l.indexCount=o,l._linesIndexCount=0,l._linesIndexBuffer=null,l._lastColliderWorldVertices=null,l._lastColliderTransformMatrix=null,l._renderId=0,l._alphaIndex=0,l._distanceToCamera=0,l._currentMaterial=null,l._mesh=a,l._renderingMesh=s||a,a.subMeshes.push(l),l._trianglePlanes=[],l._id=a.subMeshes.length-1,c&&(l.refreshBoundingInfo(),a.computeWorldMatrix(!0)),l}return n.d(t,e),t.AddToMesh=function(e,i,n,r,o,a,s,c){return void 0===c&&(c=!0),new t(e,i,n,r,o,a,s,c)},Object.defineProperty(t.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!0,configurable:!0}),t.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},t.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},t.prototype.getMesh=function(){return this._mesh},t.prototype.getRenderingMesh=function(){return this._renderingMesh},t.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(e.getSubMaterial){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},t.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(r.b.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var n=this._renderingMesh.getBoundingInfo();t={minimum:n.minimum.clone(),maximum:n.maximum.clone()}}else t=Object(c.b)(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new a.a(t.minimum,t.maximum),this},t.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},t.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t.update(e),this},t.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},t.prototype.render=function(e){return this._renderingMesh.render(this,e),this},t.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;ns&&(s=u)}return new t(e,a,s-a+1,i,n,r,o)},t}(l)},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){function e(e,t,i,r){this.normal=new n.e(e,t,i),this.d=r}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^(0|this.d)},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 i=e._TmpMatrix;n.a.TransposeToRef(t,i);var r=i.m,o=this.normal.x,a=this.normal.y,s=this.normal.z,c=this.d;return new e(o*r[0]+a*r[1]+s*r[2]+c*r[3],o*r[4]+a*r[5]+s*r[6]+c*r[7],o*r[8]+a*r[9]+s*r[10]+c*r[11],o*r[12]+a*r[13]+s*r[14]+c*r[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,i){var n,r=t.x-e.x,o=t.y-e.y,a=t.z-e.z,s=i.x-e.x,c=i.y-e.y,l=i.z-e.z,u=o*l-a*c,h=a*s-r*l,d=r*c-o*s,f=Math.sqrt(u*u+h*h+d*d);return n=0!==f?1/f:0,this.normal.x=u*n,this.normal.y=h*n,this.normal.z=d*n,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.e.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return n.e.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,i,n){var r=new e(0,0,0,0);return r.copyFromPoints(t,i,n),r},e.FromPositionAndNormal=function(t,i){var n=new e(0,0,0,0);return i.normalize(),n.normal=i,n.d=-(i.x*t.x+i.y*t.y+i.z*t.z),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var r=-(t.x*e.x+t.y*e.y+t.z*e.z);return n.e.Dot(i,t)+r},e._TmpMatrix=n.a.Identity(),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.toGlobal=function(t,i){return new e(this.x*t,this.y*i,this.width*t,this.height*i)},e.prototype.toGlobalToRef=function(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(5),r=i(18),o=i(7),a=i(0),s=i(19),c=i(38),l=i(51),u=(i(82),function(){function e(e){this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this.maxDragAngle=0,this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerID=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new o.c,this.onDragStartObservable=new o.c,this.onDragEndObservable=new o.c,this.moveAttached=!0,this.enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrienationForDragging=!0,this.validateDrag=function(e){return!0},this._tmpVector=new a.e(0,0,0),this._alternatePickedPoint=new a.e(0,0,0),this._worldDragAxis=new a.e(0,0,0),this._targetPosition=new a.e(0,0,0),this._attachedElement=null,this._startDragRay=new c.a(new a.e,new a.e),this._lastPointerRay={},this._dragDelta=new a.e,this._pointA=new a.e(0,0,0),this._pointB=new a.e(0,0,0),this._pointC=new a.e(0,0,0),this._lineA=new a.e(0,0,0),this._lineB=new a.e(0,0,0),this._localAxis=new a.e(0,0,0),this._lookAt=new a.e(0,0,0),this._options=e||{};var t=0;if(this._options.dragAxis&&t++,this._options.dragPlaneNormal&&t++,t>1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._scene=t.getScene(),this.attachedNode=t,e._planeScene||(this._debugMode?e._planeScene=this._scene:(e._planeScene=new r.a(this._scene.getEngine(),{virtual:!0}),e._planeScene.detachControl(),this._scene.onDisposeObservable.addOnce(function(){e._planeScene.dispose(),e._planeScene=null}))),this._dragPlane=n.a.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,e._planeScene,!1,n.a.DOUBLESIDE),this.lastDragPosition=new a.e(0,0,0);this._pointerObserver=this._scene.onPointerObservable.add(function(t,n){var r;if(i.enabled)if(t.type==s.a.POINTERDOWN)i.startAndReleaseDragOnPointerEvents&&!i.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&(r=t.pickInfo.pickedMesh,i.attachedNode==r||r.isDescendantOf(i.attachedNode))&&i._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==s.a.POINTERUP)i.startAndReleaseDragOnPointerEvents&&i.currentDraggingPointerID==t.event.pointerId&&i.releaseDrag();else if(t.type==s.a.POINTERMOVE){var o=t.event.pointerId;i.currentDraggingPointerID===e._AnyMouseID&&o!==e._AnyMouseID&&"mouse"==t.event.pointerType&&(i._lastPointerRay[i.currentDraggingPointerID]&&(i._lastPointerRay[o]=i._lastPointerRay[i.currentDraggingPointerID],delete i._lastPointerRay[i.currentDraggingPointerID]),i.currentDraggingPointerID=o),i._lastPointerRay[o]||(i._lastPointerRay[o]=new c.a(new a.e,new a.e)),t.pickInfo&&t.pickInfo.ray&&(i._lastPointerRay[o].origin.copyFrom(t.pickInfo.ray.origin),i._lastPointerRay[o].direction.copyFrom(t.pickInfo.ray.direction),i.currentDraggingPointerID==o&&i.dragging&&i._moveDrag(t.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){i._moving&&i.moveAttached&&(l.a._RemoveAndStorePivotPoint(i.attachedNode),i._targetPosition.subtractToRef(i.attachedNode.absolutePosition,i._tmpVector),i._tmpVector.scaleInPlace(i.dragDeltaRatio),i.attachedNode.getAbsolutePosition().addToRef(i._tmpVector,i._tmpVector),i.validateDrag(i._tmpVector)&&i.attachedNode.setAbsolutePosition(i._tmpVector),l.a._RestorePivotPoint(i.attachedNode))})},e.prototype.releaseDrag=function(){this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID}),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&this._scene.activeCamera.attachControl(this._attachedElement,!0)},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseID),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){l.a._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this.attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedElement?(this._attachedElement=this._scene.activeCamera.inputs.attachedElement,this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement)):this._attachedElement=null)),l.a._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=a.e.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(t)}},e.prototype._pickWithRayOnDragPlane=function(t){var i=this;if(!t)return null;var n=Math.acos(a.e.Dot(this._dragPlane.forward,t.direction));if(n>Math.PI/2&&(n=Math.PI-n),this.maxDragAngle>0&&n>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*a.e.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=a.e.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var o=e._planeScene.pickWithRay(t,function(e){return e==i._dragPlane});return o&&o.hit&&o.pickedMesh&&o.pickedPoint?o.pickedPoint:null},e.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),this._pointA.addToRef(this._localAxis,this._pointB),e.origin.subtractToRef(this._pointA,this._pointC),this._pointA.addToRef(this._pointC.normalize(),this._pointC),this._pointB.subtractToRef(this._pointA,this._lineA),this._pointC.subtractToRef(this._pointA,this._lineB),a.e.CrossToRef(this._lineA,this._lineB,this._lookAt),a.e.CrossToRef(this._lineA,this._lookAt,this._lookAt),this._lookAt.normalize(),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this.releaseDrag()},e._AnyMouseID=-2,e}())},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"c",function(){return a});var n=i(1),r=function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e}(),o=function(e,t){this.type=e,this.event=t},a=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type=t,n.event=i,n.skipOnPointerObservable=!1,n}return n.d(t,e),t}(o)},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(0),r=i(10),o=i(5),a=i(14);a.a.CreateBox=function(e){var t,i=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],o=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],s=[],c=e.width||e.size||1,l=e.height||e.size||1,u=e.depth||e.size||1,h=e.wrap||!1,d=void 0===e.topBaseAt?1:e.topBaseAt,f=void 0===e.bottomBaseAt?0:e.bottomBaseAt,p=[2,0,3,1][d=(d+4)%4],_=[2,0,1,3][f=(f+4)%4],m=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(h){i=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],m=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];for(var g=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],v=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],y=[17,18,19,16],b=[22,23,20,21];p>0;)g.unshift(g.pop()),y.unshift(y.pop()),p--;for(;_>0;)v.unshift(v.pop()),b.unshift(b.pop()),_--;g=g.flat(),v=v.flat(),m=m.concat(g).concat(v),i.push(y[0],y[2],y[3],y[0],y[1],y[2]),i.push(b[0],b[2],b[3],b[0],b[1],b[2])}var T=[c/2,l/2,u/2];t=m.reduce(function(e,t,i){return e.concat(t*T[i%3])},[]);for(var E=0===e.sideOrientation?0:e.sideOrientation||a.a.DEFAULTSIDE,A=e.faceUV||new Array(6),P=e.faceColors,S=[],R=0;R<6;R++)void 0===A[R]&&(A[R]=new n.f(0,0,1,1)),P&&void 0===P[R]&&(P[R]=new r.b(1,1,1,1));for(var x=0;x<6;x++)if(s.push(A[x].z,A[x].w),s.push(A[x].x,A[x].w),s.push(A[x].x,A[x].y),s.push(A[x].z,A[x].y),P)for(var C=0;C<4;C++)S.push(P[x].r,P[x].g,P[x].b,P[x].a);a.a._ComputeSides(E,t,i,o,s,e.frontUVs,e.backUVs);var M=new a.a;if(M.indices=i,M.positions=t,M.normals=o,M.uvs=s,P){var O=E===a.a.DOUBLESIDE?S.concat(S):S;M.colors=O}return M},o.a.CreateBox=function(e,t,i,n,r){void 0===i&&(i=null);var o={size:t,sideOrientation:r,updatable:n};return s.CreateBox(e,o,i)};var s=function(){function e(){}return e.CreateBox=function(e,t,i){void 0===i&&(i=null);var n=new o.a(e,i);return t.sideOrientation=o.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,a.a.CreateBox(t).applyToMesh(n,t.updatable),n},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(0),r=i(10),o=i(5),a=i(14),s=i(18),c=i(22);a.a.CreateCylinder=function(e){var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,s=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,s=s||1e-5;var l,u=e.tessellation||24,h=e.subdivisions||1,d=!!e.hasRings,f=!!e.enclose,p=0===e.cap?0:e.cap||o.a.CAP_ALL,_=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,m=0===e.sideOrientation?0:e.sideOrientation||a.a.DEFAULTSIDE,g=e.faceUV||new Array(3),v=e.faceColors,y=2+(1+(1!==_&&f?2:0))*(d?h:1);for(l=0;l0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t0){var u=new Float32Array(t,l.positionsAttrDesc.offset,l.positionsAttrDesc.count);i.setVerticesData(a.b.PositionKind,u,!1)}if(l.normalsAttrDesc&&l.normalsAttrDesc.count>0){var h=new Float32Array(t,l.normalsAttrDesc.offset,l.normalsAttrDesc.count);i.setVerticesData(a.b.NormalKind,h,!1)}if(l.tangetsAttrDesc&&l.tangetsAttrDesc.count>0){var d=new Float32Array(t,l.tangetsAttrDesc.offset,l.tangetsAttrDesc.count);i.setVerticesData(a.b.TangentKind,d,!1)}if(l.uvsAttrDesc&&l.uvsAttrDesc.count>0){var f=new Float32Array(t,l.uvsAttrDesc.offset,l.uvsAttrDesc.count);i.setVerticesData(a.b.UVKind,f,!1)}if(l.uvs2AttrDesc&&l.uvs2AttrDesc.count>0){var p=new Float32Array(t,l.uvs2AttrDesc.offset,l.uvs2AttrDesc.count);i.setVerticesData(a.b.UV2Kind,p,!1)}if(l.uvs3AttrDesc&&l.uvs3AttrDesc.count>0){var _=new Float32Array(t,l.uvs3AttrDesc.offset,l.uvs3AttrDesc.count);i.setVerticesData(a.b.UV3Kind,_,!1)}if(l.uvs4AttrDesc&&l.uvs4AttrDesc.count>0){var m=new Float32Array(t,l.uvs4AttrDesc.offset,l.uvs4AttrDesc.count);i.setVerticesData(a.b.UV4Kind,m,!1)}if(l.uvs5AttrDesc&&l.uvs5AttrDesc.count>0){var g=new Float32Array(t,l.uvs5AttrDesc.offset,l.uvs5AttrDesc.count);i.setVerticesData(a.b.UV5Kind,g,!1)}if(l.uvs6AttrDesc&&l.uvs6AttrDesc.count>0){var v=new Float32Array(t,l.uvs6AttrDesc.offset,l.uvs6AttrDesc.count);i.setVerticesData(a.b.UV6Kind,v,!1)}if(l.colorsAttrDesc&&l.colorsAttrDesc.count>0){var y=new Float32Array(t,l.colorsAttrDesc.offset,l.colorsAttrDesc.count);i.setVerticesData(a.b.ColorKind,y,!1,l.colorsAttrDesc.stride)}if(l.matricesIndicesAttrDesc&&l.matricesIndicesAttrDesc.count>0){for(var b=new Int32Array(t,l.matricesIndicesAttrDesc.offset,l.matricesIndicesAttrDesc.count),T=[],E=0;E>8),T.push((16711680&A)>>16),T.push(A>>24)}i.setVerticesData(a.b.MatricesIndicesKind,T,!1)}if(l.matricesWeightsAttrDesc&&l.matricesWeightsAttrDesc.count>0){var P=new Float32Array(t,l.matricesWeightsAttrDesc.offset,l.matricesWeightsAttrDesc.count);i.setVerticesData(a.b.MatricesWeightsKind,P,!1)}if(l.indicesAttrDesc&&l.indicesAttrDesc.count>0){var S=new Int32Array(t,l.indicesAttrDesc.offset,l.indicesAttrDesc.count);i.setIndices(S,null)}if(l.subMeshesAttrDesc&&l.subMeshesAttrDesc.count>0){var R=new Int32Array(t,l.subMeshesAttrDesc.offset,5*l.subMeshesAttrDesc.count);i.subMeshes=[];for(E=0;E>8),T.push((16711680&D)>>16),T.push(D>>24)}i.setVerticesData(a.b.MatricesIndicesKind,T,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(a.b.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable);else{for(T=[],E=0;E>8),T.push((16711680&D)>>16),T.push(D>>24)}i.setVerticesData(a.b.MatricesIndicesExtraKind,T,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(a.b.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(a.b.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),i.setIndices(t.indices,null)}if(t.subMeshes){i.subMeshes=[];for(var L=0;L-1){var n=t.getScene().getLastSkeletonByID(e.skeletonId);if(n){i=n.bones.length;for(var r=t.getVerticesData(a.b.MatricesIndicesKind),o=t.getVerticesData(a.b.MatricesIndicesExtraKind),s=e.matricesWeights,l=e.matricesWeightsExtra,u=e.numBoneInfluencer,h=s.length,d=0;du-1)&&(p=u-1),f>.001){var g=1/f;for(_=0;_<4;_++)s[d+_]*=g;if(l)for(_=0;_<4;_++)l[d+_]*=g}else p>=4?(l[d+p-4]=1-f,o[d+p-4]=i):(s[d+p]=1-f,r[d+p]=i)}t.setVerticesData(a.b.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(a.b.MatricesIndicesExtraKind,o)}}}},e.Parse=function(t,i,r){if(i.getGeometryByID(t.id))return null;var s=new e(t.id,i,void 0,t.updatable);return d.a&&d.a.AddTagsTo(s,t.tags),t.delayLoadingFile?(s.delayLoadState=u.a.DELAYLOADSTATE_NOTLOADED,s.delayLoadingFile=r+t.delayLoadingFile,s._boundingInfo=new l.a(n.e.FromArray(t.boundingBoxMinimum),n.e.FromArray(t.boundingBoxMaximum)),s._delayInfo=[],t.hasUVs&&s._delayInfo.push(a.b.UVKind),t.hasUVs2&&s._delayInfo.push(a.b.UV2Kind),t.hasUVs3&&s._delayInfo.push(a.b.UV3Kind),t.hasUVs4&&s._delayInfo.push(a.b.UV4Kind),t.hasUVs5&&s._delayInfo.push(a.b.UV5Kind),t.hasUVs6&&s._delayInfo.push(a.b.UV6Kind),t.hasColors&&s._delayInfo.push(a.b.ColorKind),t.hasMatricesIndices&&s._delayInfo.push(a.b.MatricesIndicesKind),t.hasMatricesWeights&&s._delayInfo.push(a.b.MatricesWeightsKind),s._delayLoadingFunction=o.a.ImportVertexData):o.a.ImportVertexData(t,s),i.pushGeometry(s,!0),s},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){this._xhr=new XMLHttpRequest}return e.prototype._injectCustomRequestHeaders=function(){for(var t in e.CustomRequestHeaders){var i=e.CustomRequestHeaders[t];i&&this._xhr.setRequestHeader(t,i)}},Object.defineProperty(e.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._xhr.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"response",{get:function(){return this._xhr.response},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},e.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},e.prototype.abort=function(){this._xhr.abort()},e.prototype.send=function(t){e.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(t)},e.prototype.open=function(t,i){for(var n=0,r=e.CustomRequestModifiers;nl.snapDistance){var t=Math.floor(Math.abs(f)/l.snapDistance);f%=l.snapDistance,m.normalizeToRef(p),p.scaleInPlace(l.snapDistance*t),l.attachedMesh.position.addInPlace(p),_.snapDistance=l.snapDistance*t,l.onSnapObservable.notifyObservers(_)}}),l._pointerObserver=a.utilityLayerScene.onPointerObservable.add(function(e){if(!l._customMeshSet){var t=e.pickInfo&&-1!=l._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?l._hoverMaterial:l._coloredMaterial;l._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var v=a._getSharedGizmoLight();return v.includedOnlyMeshes=v.includedOnlyMeshes.concat(l._rootMesh.getChildMeshes(!1)),l}return n.d(t,e),t._CreateArrow=function(e,t){var i=new a.a("arrow",e),n=s.a.CreateCylinder("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375,tessellation:96},e),r=s.a.CreateCylinder("cylinder",{diameterTop:.005,height:.275,diameterBottom:.005,tessellation:96},e);return r.material=t,n.parent=i,r.parent=i,n.material=t,n.rotation.x=Math.PI/2,n.position.z+=.3,r.position.z+=.1375,r.rotation.x=Math.PI/2,i},t._CreateArrowInstance=function(e,t){for(var i=new a.a("arrow",e),n=0,r=t.getChildMeshes();n=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map(function(e){return e?e.getActiveTextures():[]}))},t.prototype.getClassName=function(){return"MultiMaterial"},t.prototype.isReadyForSubMesh=function(e,t,i){for(var n=0;n=0&&r.multiMaterials.splice(o,1),e.prototype.dispose.call(this,t,i)}},t.ParseMultiMaterial=function(e,i){var n=new t(e.name,i);n.id=e.id,o.a&&o.a.AddTagsTo(n,e.tags);for(var r=0;r=n.a.ACTION_OnPickTrigger&&i<=n.a.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),e.HasSpecificTrigger=function(t){for(var i in e.Triggers){if(e.Triggers.hasOwnProperty(i))if(parseInt(i)===t)return!0}return!1},e.Triggers={},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(5),r=i(14);r.a.CreatePlane=function(e){var t=[],i=[],n=[],o=[],a=e.width||e.size||1,s=e.height||e.size||1,c=0===e.sideOrientation?0:e.sideOrientation||r.a.DEFAULTSIDE,l=a/2,u=s/2;i.push(-l,-u,0),n.push(0,0,-1),o.push(0,0),i.push(l,-u,0),n.push(0,0,-1),o.push(1,0),i.push(l,u,0),n.push(0,0,-1),o.push(1,1),i.push(-l,u,0),n.push(0,0,-1),o.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),r.a._ComputeSides(c,i,t,n,o,e.frontUVs,e.backUVs);var h=new r.a;return h.indices=t,h.positions=i,h.normals=n,h.uvs=o,h},n.a.CreatePlane=function(e,t,i,n,r){var a={size:t,width:t,height:t,sideOrientation:r,updatable:n};return o.CreatePlane(e,a,i)};var o=function(){function e(){}return e.CreatePlane=function(e,t,i){void 0===i&&(i=null);var o=new n.a(e,i);return t.sideOrientation=n.a._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,r.a.CreatePlane(t).applyToMesh(o,t.updatable),t.sourcePlane&&(o.translate(t.sourcePlane.normal,-t.sourcePlane.d),o.setDirection(t.sourcePlane.normal.scale(-1))),o},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(0),r=i(16),o=i(71),a=i(3),s=i(28),c=i(10),l=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},u=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i,n=e.getSize().width,r=e.readPixels(0),o=e.readPixels(1);e.isRenderTarget?(t=e.readPixels(3),i=e.readPixels(2)):(t=e.readPixels(2),i=e.readPixels(3));var s=e.readPixels(4),c=e.readPixels(5),l=e.gammaSpace,u=a.a.TEXTUREFORMAT_RGBA,h=a.a.TEXTURETYPE_UNSIGNED_INT;e.textureType&&e.textureType!==a.a.TEXTURETYPE_UNSIGNED_INT&&(h=a.a.TEXTURETYPE_FLOAT);var d={size:n,right:r,left:o,up:t,down:i,front:s,back:c,format:u,type:h,gammaSpace:l};return this.ConvertCubeMapToSphericalPolynomial(d)},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new o.a,i=0,n=2/e.size,l=n,u=.5*n-1,h=0;h<6;h++)for(var d=this.FileFaces[h],f=e[d.name],p=u,_=e.format===a.a.TEXTUREFORMAT_RGBA?4:3,m=0;m-1&&this._debugMeshMeshes.splice(o,1),this._numMeshes--,this._numMeshes>0?(this._meshes[n]=this._meshes[this._numMeshes],this._impostors[n]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},e.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new r.a("",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=a.a.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=g.a.CreateBox("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=n.b.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=v.a.CreateSphere("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=n.b.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=E.a.CreateCylinder("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=n.b.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugMeshMesh=function(e,t){var i=new m.a(e.name,t,null,e);return i.position=n.e.Zero(),i.setParent(e),i.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(i),i},e.prototype._getDebugMesh=function(e,t){var i=this;if(!this._utilityLayer)return null;if(t&&t.parent&&t.parent.physicsImpostor)return null;var n=null,r=this._utilityLayer.utilityLayerScene;switch(e.type){case b.a.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case b.a.SphereImpostor:n=this._getDebugSphereMesh(r);var o=e.getRadius();n.scaling.x=2*o,n.scaling.y=2*o,n.scaling.z=2*o;break;case b.a.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case b.a.NoImpostor:if(t)t.getChildMeshes().filter(function(e){return e.physicsImpostor?1:0}).forEach(function(e){i._getDebugBoxMesh(r).parent=e});break;case b.a.CylinderImpostor:n=this._getDebugCylinderMesh(r);var a=e.object.getBoundingInfo();n.scaling.x=a.boundingBox.maximum.x-a.boundingBox.minimum.x,n.scaling.y=a.boundingBox.maximum.y-a.boundingBox.minimum.y,n.scaling.z=a.boundingBox.maximum.z-a.boundingBox.minimum.z}return n},e.prototype.dispose=function(){for(var e=this._numMeshes,t=0;t=0;s--){var c=e[s],l=c.getParent();if(l){var u=this._debugLines[r];u||(u=[n.e.Zero(),n.e.Zero()],this._debugLines[r]=u),c.getAbsolutePositionToRef(o,u[0]),l.getAbsolutePositionToRef(o,u[1]),u[0].subtractInPlace(a),u[1].subtractInPlace(a),r++}}},e.prototype.update=function(){if(this._utilityLayer){this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms();var e=this.mesh._effectiveMesh;void 0===this.skeleton.bones[0].length?this._getLinesForBonesNoLength(this.skeleton.bones,e.getWorldMatrix()):this._getLinesForBonesWithLength(this.skeleton.bones,e.getWorldMatrix());var t=this._utilityLayer.utilityLayerScene;this._debugMesh?P.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},t):(this._debugMesh=P.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:null},t),this._debugMesh.renderingGroupId=this.renderingGroupId),this._debugMesh.position.copyFrom(this.mesh.position),this._debugMesh.color=this.color}},e.prototype.dispose=function(){this.isEnabled=!1,this._debugMesh&&(this.isEnabled=!1,this._debugMesh.dispose(),this._debugMesh=null),this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null)},e}();i.d(t,"AxesViewer",function(){return s}),i.d(t,"BoneAxesViewer",function(){return u}),i.d(t,"DebugLayer",function(){return _}),i.d(t,"PhysicsViewer",function(){return A}),i.d(t,"RayHelper",function(){return S}),i.d(t,"SkeletonViewer",function(){return R})},function(e,t,i){"use strict";var n="morphTargetsVertexGlobalDeclaration",r="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="morphTargetsVertexDeclaration",r="#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#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="morphTargetsVertex",r="#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#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";i.d(t,"a",function(){return f});var n=i(1),r=i(2),o=i(0),a=i(4),s=i(9),c=i(15),l=i(6),u=i(25),h=i(13),d=i(10),f=function(e){function t(t,i,r,a){void 0===a&&(a={});var s=e.call(this,t,i)||this;return s._textures={},s._textureArrays={},s._floats={},s._ints={},s._floatsArrays={},s._colors3={},s._colors3Arrays={},s._colors4={},s._colors4Arrays={},s._vectors2={},s._vectors3={},s._vectors4={},s._matrices={},s._matrices3x3={},s._matrices2x2={},s._vectors2Arrays={},s._vectors3Arrays={},s._vectors4Arrays={},s._cachedWorldViewMatrix=new o.a,s._cachedWorldViewProjectionMatrix=new o.a,s._shaderPath=r,s._options=n.a({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},a),s}return n.d(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"ShaderMaterial"},t.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},t.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},t.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},t.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},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.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},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce(function(e,t){return t.toArray(e,e.length),e},[]),this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},t.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},t.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},t.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},t.prototype.setArray4=function(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this},t.prototype._checkCache=function(e,t){return!e||(this._effect&&this._effect.defines.indexOf("#define INSTANCES"),!1)},t.prototype.isReadyForSubMesh=function(e,t,i){return this.isReady(e,i)},t.prototype.isReady=function(e,t){var i=this.getScene(),n=i.getEngine();if(!this.checkReadyOnEveryCall&&this._renderId===i.getRenderId()&&this._checkCache(e,t))return!0;for(var r=[],o=[],s=new l.c,u=0;u4&&(o.push(a.b.MatricesIndicesExtraKind),o.push(a.b.MatricesWeightsExtraKind));var h=e.skeleton;r.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),s.addCPUSkinningFallback(0,e),h.isUsingTextureForMatrices?(r.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(r.push("#define BonesPerMesh "+(h.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))}else r.push("#define NUM_BONE_INFLUENCERS 0");for(var d in this._textures)if(!this._textures[d].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&r.push("#define ALPHATEST");var f=this._effect,p=r.join("\n");return this._effect=n.createEffect(this._shaderPath,{attributes:o,uniformsNames:this._options.uniforms,uniformBuffersNames:this._options.uniformBuffers,samplers:this._options.samplers,defines:p,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError},n),!!this._effect.isReady()&&(f!==this._effect&&i.resetCachedMaterial(),this._renderId=i.getRenderId(),!0)},t.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")&&(e.multiplyToRef(t.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),this._effect.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},t.prototype.bind=function(e,t){if(this.bindOnlyWorldMatrix(e),this._effect&&this.getScene().getCachedMaterial()!==this){var i;for(i in-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()),c.a.BindBonesParameters(t,this._effect),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._colors4Arrays)this._effect.setArray4(i,this._colors4Arrays[i]);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]);for(i in this._vectors4Arrays)this._effect.setArray4(i,this._vectors4Arrays[i])}this._afterBind(t)},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var i in this._textures)t.push(this._textures[i]);for(var i in this._textureArrays)for(var n=this._textureArrays[i],r=0;ru-n)&&(!(c-hh-r)&&!(l-dd-a))},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,a=i.z,s=n.x,c=n.y,l=n.z,u=e.x,h=e.y,d=e.z,f=t.x,p=t.y,_=t.z;return!(sf)&&(!(cp)&&!(l_))},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,o){var a=e.TmpVector3[0];return r.e.ClampToRef(n,t,i,a),r.e.DistanceSquared(n,a)<=o*o},e.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(r.dotCoordinate(e[o])>=0){n=!1;break}if(n)return!1}return!0},e.TmpVector3=n.a.BuildArray(3,r.e.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(39),r=i(0),o=function(){function e(e,t,i){this.center=r.e.Zero(),this.centerWorld=r.e.Zero(),this.minimum=r.e.Zero(),this.maximum=r.e.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=r.e.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.a.IdentityReadOnly)},e.prototype.scale=function(t){var i=this.radius*t,n=e.TmpVector3,r=n[0].setAll(i),o=this.center.subtractToRef(r,n[1]),a=this.center.addToRef(r,n[2]);return this.reConstruct(o,a,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{r.e.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e.TmpVector3[0];r.e.TransformNormalFromFloatsToRef(1,1,1,t,i),this.radiusWorld=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=r.e.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldthis.value;case t.IsLesser:return this._effectiveTarget[this._property]-1&&this._scene.actionManagers.splice(e,1)},t.prototype.getScene=function(){return this._scene},t.prototype.hasSpecificTriggers=function(e){for(var t=0;t-1)return!0}return!1},t.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i=t.OnPickTrigger&&i.trigger<=t.OnPointerOutTrigger)return!0}return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasPickTriggers",{get:function(){for(var e=0;e=t.OnPickTrigger&&i.trigger<=t.OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),t.prototype.registerAction=function(e){return e.trigger===t.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(m.a.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),t.Triggers[e.trigger]?t.Triggers[e.trigger]++:t.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},t.prototype.unregisterAction=function(e){var i=this.actions.indexOf(e);return-1!==i&&(this.actions.splice(i,1),t.Triggers[e.trigger]-=1,0===t.Triggers[e.trigger]&&delete t.Triggers[e.trigger],delete e._actionManager,!0)},t.prototype.processTrigger=function(e,i){for(var n=0;n0;if(2===e.type?h.push(r):h.push(i),m){for(var g=new Array,v=0;v0){var _=p.properties[0].value,m=null===p.properties[0].targetType?_:n.getMeshByName(_);m._meshId&&(m.mesh=n.getMeshByID(m._meshId)),h={trigger:t[p.name],parameter:m}}else h=t[p.name];for(var g=0;g=0;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t0)return i.highLimitValue.clone?i.highLimitValue.clone():i.highLimitValue;var n=this._keys;if(1===n.length)return this._getKeyValue(n[0].value);var r=i.key;if(n[r].frame>=t)for(;r-1>=0&&n[r].frame>=t;)r--;for(var o=r;o=t){i.key=o;var s=n[o],c=this._getKeyValue(s.value);if(s.interpolation===L.STEP)return c;var l=this._getKeyValue(a.value),u=void 0!==s.outTangent&&void 0!==a.inTangent,h=a.frame-s.frame,d=(t-s.frame)/h,f=this.getEasingFunction();switch(null!=f&&(d=f.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var p=u?this.floatInterpolateFunctionWithTangents(c,s.outTangent*h,l,a.inTangent*h,d):this.floatInterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return p;case e.ANIMATIONLOOPMODE_RELATIVE:return i.offsetValue*i.repeatCount+p}break;case e.ANIMATIONTYPE_QUATERNION:var _=u?this.quaternionInterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.quaternionInterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return _;case e.ANIMATIONLOOPMODE_RELATIVE:return _.addInPlace(i.offsetValue.scale(i.repeatCount))}return _;case e.ANIMATIONTYPE_VECTOR3:var m=u?this.vector3InterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.vector3InterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return m;case e.ANIMATIONLOOPMODE_RELATIVE:return m.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_VECTOR2:var g=u?this.vector2InterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.vector2InterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return g;case e.ANIMATIONLOOPMODE_RELATIVE:return g.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_SIZE:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(c,l,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(c,l,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR3:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(c,l,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(c,l,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_MATRIX:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:if(e.AllowMatricesInterpolation)return this.matrixInterpolateFunction(c,l,d,i.workValue);case e.ANIMATIONLOOPMODE_RELATIVE:return c}}break}}return this._getKeyValue(n[n.length-1].value)},e.prototype.matrixInterpolateFunction=function(t,i,n,r){return e.AllowMatrixDecomposeForInterpolation?r?(a.a.DecomposeLerpToRef(t,i,n,r),r):a.a.DecomposeLerp(t,i,n):r?(a.a.LerpToRef(t,i,n,r),r):a.a.Lerp(t,i,n)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var i in t._ranges={},this._ranges){var n=this._ranges[i];n&&(t._ranges[i]=n.clone())}return t},e.prototype.setKeys=function(e){this._keys=e.slice(0)},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var i=this.dataType;t.keys=[];for(var n=this.getKeys(),r=0;r=1&&(l=h.values[1]),h.values.length>=2&&(u=h.values[2]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=a.b.FromArray(h.values),h.values.length>=8){var d=a.b.FromArray(h.values.slice(4,8));d.equals(a.b.Zero())||(l=d)}if(h.values.length>=12){var f=a.b.FromArray(h.values.slice(8,12));f.equals(a.b.Zero())||(u=f)}break;case e.ANIMATIONTYPE_MATRIX:i=a.a.FromArray(h.values);break;case e.ANIMATIONTYPE_COLOR3:i=s.a.FromArray(h.values);break;case e.ANIMATIONTYPE_VECTOR3:default:i=a.e.FromArray(h.values)}var p={};p.frame=h.frame,p.value=i,null!=l&&(p.inTangent=l),null!=u&&(p.outTangent=u),c.push(p)}if(r.setKeys(c),t.ranges)for(n=0;n0&&h.forEach(function(e){r._events.push(e._clone())}),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}return Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!0,configurable:!0}),e.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(i.length>1){for(var n=e[i[0]],r=1;r-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;nthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var l,u,h=i-t,d=e*(a.framePerSecond*r)/1e3+this._ratioOffset,f=0;if(this._previousDelay=e,this._previousRatio=d,!n&&i>=t&&d>=h)c=!1,f=a._getKeyValue(this._maxValue);else if(!n&&t>=i&&d<=h)c=!1,f=a._getKeyValue(this._minValue);else if(this._animationState.loopMode!==k.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){this._animationState.repeatCount=0,this._animationState.loopMode=k.ANIMATIONLOOPMODE_CYCLE;var _=a._interpolate(t,this._animationState),m=a._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),a.dataType){case k.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=m-_;break;case k.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=m.subtract(_);break;case k.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=m.subtract(_)}this._highLimitsCache[p]=m}f=this._highLimitsCache[p],l=this._offsetsCache[p]}if(void 0===l)switch(a.dataType){case k.ANIMATIONTYPE_FLOAT:l=0;break;case k.ANIMATIONTYPE_QUATERNION:l=z;break;case k.ANIMATIONTYPE_VECTOR3:l=j;break;case k.ANIMATIONTYPE_VECTOR2:l=W;break;case k.ANIMATIONTYPE_SIZE:l=H;break;case k.ANIMATIONTYPE_COLOR3:l=X}if(this._host&&this._host.syncRoot){var g=this._host.syncRoot;u=t+(i-t)*((g.masterFrame-g.fromFrame)/(g.toFrame-g.fromFrame))}else u=c&&0!==h?t+d%h:i;var v=this._events;if((h>0&&this.currentFrame>u||h<0&&this.currentFrame>0,this._animationState.highLimitValue=f,this._animationState.offsetValue=l;var b=a._interpolate(u,this._animationState);if(this.setValue(b,o),v.length)for(y=0;y0&&u>=v[y].frame&&v[y].frame>=t||h<0&&u<=v[y].frame&&v[y].frame<=t){var T=v[y];T.isDone||(T.onlyOnce&&(v.splice(y,1),y--),T.isDone=!0,T.action(u))}return c||(this._stopped=!0),c},e}(),K=i(18),Q=i(53),q=i(39),Z=i(22),J=function(e){function t(t,i,n,r,o,s,c){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=null);var l=e.call(this,t,i.getScene(),!1)||this;return l.name=t,l.children=new Array,l.animations=new Array,l._index=null,l._absoluteTransform=new a.a,l._invertedAbsoluteTransform=new a.a,l._scalingDeterminant=1,l._worldTransform=new a.a,l._needToDecompose=!0,l._needToCompose=!1,l._linkedTransformNode=null,l._waitingTransformNodeId=null,l._skeleton=i,l._localMatrix=r?r.clone():a.a.Identity(),l._restPose=o||l._localMatrix.clone(),l._baseMatrix=s||l._localMatrix.clone(),l._index=c,i.bones.push(l),l.setParent(n,!1),(s||r)&&l._updateDifferenceMatrix(),l}return h.d(t,e),Object.defineProperty(t.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"Bone"},t.prototype.getSkeleton=function(){return this._skeleton},t.prototype.getParent=function(){return this._parent},t.prototype.getChildren=function(){return this.children},t.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this._parent!==e){if(this._parent){var i=this._parent.children.indexOf(this);-1!==i&&this._parent.children.splice(i,1)}this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}},t.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},t.prototype.getBaseMatrix=function(){return this._baseMatrix},t.prototype.getRestPose=function(){return this._restPose},t.prototype.getWorldMatrix=function(){return this._worldTransform},t.prototype.returnToRest=function(){this.updateMatrix(this._restPose.clone())},t.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},t.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},t.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},t.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(t.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!0,configurable:!0}),t.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=a.e.Zero(),this._localRotation=a.b.Zero(),this._localPosition=a.e.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,a.a.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},t.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?(this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose()):this.markAsDirty()},t.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e||(e=this._baseMatrix),this._parent?e.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n-1){for(var n=(o=this._runtimeAnimations).length-1;n>=0;n--){var r=o[n];e&&r.animation.name!=e||(t&&!t(r.target)||(r.dispose(),o.splice(n,1)))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{if((n=this._scene._activeAnimatables.indexOf(this))>-1){this._scene._activeAnimatables.splice(n,1);var o=this._runtimeAnimations;for(n=0;n0)return;this._animationTimeLast=t}var i=this.useConstantAnimationDeltaTime?16:(t-this._animationTimeLast)*this.animationTimeScale;this._animationTime+=i;var n=this._animationTime;this._animationTimeLast=t;for(var r=0;ri&&r>0&&(r*=-1),s&&this.stopAnimation(e,void 0,c),a||(a=new $(this,e,t,i,n,r,o,void 0,l));var u=!c||c(e);if(e.animations&&u&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var h=e.getAnimatables(),d=0;d=l&&a.frame<=u&&(n?(c=a.value.clone(),_?(s=c.getTranslation(),c.setTranslation(s.scaleInPlace(m))):g&&r?(s=c.getTranslation(),c.setTranslation(s.multiplyInPlace(r))):c=a.value):c=a.value,v.push({frame:a.frame+i,value:c}));return this.animations[0].createRange(t,l+i,u+i),!0};var ee,te=function(){function e(){}return e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),ie=function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this.onAnimationEndObservable=new o.c,this.onAnimationLoopObservable=new o.c,this.onAnimationGroupEndObservable=new o.c,this.onAnimationGroupPauseObservable=new o.c,this.onAnimationGroupPlayObservable=new o.c,this._scene=t||C.a.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.animationGroups.push(this)}return Object.defineProperty(e.prototype,"from",{get:function(){return this._from},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"to",{get:function(){return this._to},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;tn[0].frame&&(this._from=n[0].frame),this._toe){var a={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,a)}if(o.framen&&this._speedRatio>0&&(this._speedRatio=-t);return this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},e.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e-1&&this._scene.animationGroups.splice(e,1),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.prototype.clone=function(t,i){for(var n=new e(t||this.name,this._scene),r=0,o=this._targetedAnimations;r180&&(l-=360),l-c<-180&&(l+=360),u-l>180&&(u-=360),u-l<-180&&(u+=360),this.orientation=l-c<0?ee.CW:ee.CCW,this.angle=ae.FromDegrees(this.orientation===ee.CW?c-u:u-c)},ce=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new a.d(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new a.d(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,i,n,r){if(void 0===r&&(r=36),this.closed)return this;var o=this._points[this._points.length-1],s=new a.d(e,t),c=new a.d(i,n),l=new se(o,s,c),u=l.angle.radians()/r;l.orientation===ee.CW&&(u*=-1);for(var h=l.startAngle.radians()+u,d=0;d1)return a.d.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=c){var l=s.normalize(),u=t-i;return new a.d(o.x+l.x*u,o.y+l.y*u)}i=c}return a.d.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),le=function(){function e(e,t,i){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 n=0;nt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t){var i,n,r=e.length();(0===r&&(r=1),null==t)?(n=w.a.WithinEpsilon(Math.abs(e.y)/r,1,re.a)?w.a.WithinEpsilon(Math.abs(e.x)/r,1,re.a)?w.a.WithinEpsilon(Math.abs(e.z)/r,1,re.a)?a.e.Zero():new a.e(0,0,1):new a.e(1,0,0):new a.e(0,-1,0),i=a.e.Cross(e,n)):(i=a.e.Cross(e,t),a.e.CrossToRef(i,e,i));return i.normalize(),i},e}(),ue=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,i,n,r){r=r>2?r:3;for(var o=new Array,s=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},c=0;c<=r;c++)o.push(new a.e(s(c/r,t.x,i.x,n.x),s(c/r,t.y,i.y,n.y),s(c/r,t.z,i.z,n.z)));return new e(o)},e.CreateCubicBezier=function(t,i,n,r,o){o=o>3?o:4;for(var s=new Array,c=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},l=0;l<=o;l++)s.push(new a.e(c(l/o,t.x,i.x,n.x,r.x),c(l/o,t.y,i.y,n.y,r.y),c(l/o,t.z,i.z,n.z,r.z)));return new e(s)},e.CreateHermiteSpline=function(t,i,n,r,o){for(var s=new Array,c=1/o,l=0;l<=o;l++)s.push(a.e.Hermite(t,i,n,r,l*c));return new e(s)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,o=1/i,s=0;if(n){for(var c=t.length,l=0;l=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t}(he),fe=function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(he),pe=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=2);var n=e.call(this)||this;return n.bounces=t,n.bounciness=i,n}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,a=e*o,s=Math.log(-a*(1-i)+1)/Math.log(i),c=Math.floor(s),l=c+1,u=(1-Math.pow(i,c))/(r*o),h=.5*(u+(1-Math.pow(i,l))/(r*o)),d=e-h,f=h-u;return-Math.pow(1/i,t-c)/(f*f)*(d-f)*(d+f)},t}(he),_e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e},t}(he),me=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=3);var n=e.call(this)||this;return n.oscillations=t,n.springiness=i,n}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},t}(he),ge=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(he),ve=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},t}(he),ye=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e},t}(he),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t}(he),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t}(he),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t}(he),Ae=function(e){function t(t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1);var o=e.call(this)||this;return o.x1=t,o.y1=i,o.x2=n,o.y2=r,o}return h.d(t,e),t.prototype.easeInCore=function(e){return oe.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},t}(he),Pe=function(){function e(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}return e.prototype._clone=function(){return new e(this.frame,this.action,this.onlyOnce)},e}(),Se=i(5),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t}(n.a),xe=function(e){function t(t){var i=e.call(this)||this;return i.scene=t,i.sounds=[],i.effectLayers=[],i.layers=[],i.lensFlareSystems=[],i.proceduralTextures=[],i.reflectionProbes=[],i}return h.d(t,e),t.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.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.actionManagers.forEach(function(t){e.scene.addActionManager(t)}),this.textures.forEach(function(t){e.scene.addTexture(t)}),this.reflectionProbes.forEach(function(t){e.scene.addReflectionProbe(t)}),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(var t=0,i=this.scene._serializableComponents;t0&&(h=!0,this._soundLoaded(i));break;case"String":u.push(i);case"Array":0===u.length&&(u=i);for(var d=0;d0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if(Ce.b.audioEngine.audioContext&&this._soundSource){var i=e?Ce.b.audioEngine.audioContext.currentTime+e:Ce.b.audioEngine.audioContext.currentTime;this._soundSource.stop(i),this._soundSource.onended=function(){t.isPlaying=!1},this.isPaused||(this._startOffset=0)}},e.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():Ce.b.audioEngine.audioContext&&(this.stop(0),this._startOffset+=Ce.b.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){Ce.b.audioEngine.canUseWebAudio&&this._soundGain&&(t&&Ce.b.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(Ce.b.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,Ce.b.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,Ce.b.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){if(e.getBoundingInfo){var t=e;if(this._positionInEmitterSpace)t.worldMatrixFromCache.invertToRef(a.c.Matrix[0]),this.setPosition(a.c.Matrix[0].getTranslation());else{var i=t.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}Ce.b.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()}},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var i=function(){t._isReadyToPlay?(r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)):window.setTimeout(i,300)},n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),i(),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId};return this.spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,i,n,r){var o,s=t.name;o=t.url?n+t.url:n+s;var c,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(r){var u=function(){r._isReadyToPlay?(c._audioBuffer=r.getAudioBuffer(),c._isReadyToPlay=!0,c.autoplay&&c.play(0,c._offset,c._length)):window.setTimeout(u,300)};c=new e(s,new ArrayBuffer(0),i,null,l),u()}else c=new e(s,o,i,function(){i._removePendingData(c)},l),i._addPendingData(c);if(t.position){var h=a.e.FromArray(t.position);c.setPosition(h)}if(t.isDirectional&&(c.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var d=a.e.FromArray(t.localDirectionToMesh);c.setLocalDirectionToMesh(d)}if(t.connectedMeshId){var f=i.getMeshByID(t.connectedMeshId);f&&c.attachToMesh(f)}return c},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("AudioSceneComponent")},e}(),we=function(){function e(e,t){void 0===t&&(t={}),this.id=-1,this._isMainTrack=!1,this._isInitialized=!1,this._scene=e,this.soundCollection=new Array,this._options=t,!this._isMainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}return e.prototype._initializeSoundTrackAudioGraph=function(){Ce.b.audioEngine.canUseWebAudio&&Ce.b.audioEngine.audioContext&&(this._outputAudioNode=Ce.b.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(Ce.b.audioEngine.masterGain),this._options&&(this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._options.mainTrack&&(this._isMainTrack=this._options.mainTrack)),this._isInitialized=!0)},e.prototype.dispose=function(){if(Ce.b.audioEngine&&Ce.b.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},e.prototype.AddSound=function(e){this._isInitialized||this._initializeSoundTrackAudioGraph(),Ce.b.audioEngine.canUseWebAudio&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.RemoveSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].RemoveSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},e.prototype.RemoveSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},e.prototype.setVolume=function(e){Ce.b.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){if(Ce.b.audioEngine.canUseWebAudio)for(var e=0;e0?e.activeCameras[0]:e.activeCamera){t.audioContext.listener.setPosition(n.globalPosition.x,n.globalPosition.y,n.globalPosition.z),n.rigCameras&&n.rigCameras.length>0&&(n=n.rigCameras[0]);var r=a.a.Invert(n.getViewMatrix()),o=a.e.TransformNormal(new a.e(0,0,-1),r);o.normalize(),isNaN(o.x)||isNaN(o.y)||isNaN(o.z)||t.audioContext.listener.setOrientation(o.x,o.y,o.z,0,1,0)}else t.audioContext.listener.setPosition(0,0,0)}var s;for(s=0;s0?1/r:0,c=0;c0},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add(function(e){e.type!==Ue.a.POINTERDOWN?e.type===Ue.a.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){var e=Q.a.Now,i=0;null!=t._lastFrameTime&&(i=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var n=e-t._lastInteractionTime-t._idleRotationWaitTime,r=Math.max(Math.min(n/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*r,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(i/1e3))})},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=Q.a.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e}(),ke=function(){function e(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(e.prototype,"name",{get:function(){return"Bouncing"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var i=this._attachedCamera;i&&(e?this._onMeshTargetChangedObserver=i.onMeshTargetChangedObservable.add(function(e){if(e){e.computeWorldMatrix(!0);var i=e.getBoundingInfo().diagonalLength;t.lowerRadiusTransitionRange=.05*i,t.upperRadiusTransitionRange=.05*i}}):this._onMeshTargetChangedObserver&&i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))})},e.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},e.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&(this._attachedCamera.radius===e&&!this._radiusIsAnimating)},e.prototype._applyBoundRadiusAnimation=function(t){var i=this;if(this._attachedCamera){this._radiusBounceTransition||(e.EasingFunction.setEasingMode(e.EasingMode),this._radiusBounceTransition=k.CreateAnimation("radius",k.ANIMATIONTYPE_FLOAT,60,e.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var n=k.TransitionTo("radius",this._attachedCamera.radius+t,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,function(){return i._clearAnimationLocks()});n&&this._animatables.push(n)}},e.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.EasingFunction=new fe(.3),e.EasingMode=he.EASINGMODE_EASEOUT,e}(),Ge=function(){function e(){this._mode=e.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"Framing"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._attachedCamera=t;var n=this._attachedCamera.getScene();e.EasingFunction.setEasingMode(e.EasingMode),this._onPrePointerObservableObserver=n.onPrePointerObservable.add(function(e){e.type!==Ue.a.POINTERDOWN?e.type===Ue.a.POINTERUP&&(i._isPointerDown=!1):i._isPointerDown=!0}),this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add(function(e){e&&i.zoomOnMesh(e)}),this._onAfterCheckInputsObserver=t.onAfterCheckInputsObservable.add(function(){i._applyUserInteraction(),i._maintainCameraAboveGround()})},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},e.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)},e.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)},e.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new a.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;ol.upperRadiusLimit?l.upperRadiusLimit:c),c):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=Q.a.Now-this._lastInteractionTime,n=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&i>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=k.CreateAnimation("beta",k.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=k.TransitionTo("beta",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,function(){t._clearAnimationLocks(),t.stopAllAnimations()});o&&this._animatables.push(o)}}},e.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return a.d.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new a.d(n,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=Q.a.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!0,configurable:!0}),e.EasingFunction=new ge,e.EasingMode=he.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),ze=function(e,t,i,n){void 0===t&&(t=new a.e),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n},je=function(){function e(e){this.ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new ze(a.e.Up()),new ze(a.e.Down()),new ze(a.e.Left()),new ze(a.e.Right()),new ze(a.e.Forward()),new ze(a.e.Forward().scaleInPlace(-1))],this._tmpMatrix=new a.a,this._tmpVector=new a.e,this._zeroVector=a.e.Zero(),this._lookAtTmpMatrix=new a.a}return e.prototype.init=function(){},e.prototype._closestFace=function(e){var t=this;return this._faceVectors.forEach(function(i){t._target.rotationQuaternion||(t._target.rotationQuaternion=a.b.RotationYawPitchRoll(t._target.rotation.y,t._target.rotation.x,t._target.rotation.z)),t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix),a.e.TransformCoordinatesToRef(i.direction,t._tmpMatrix,i.rotatedDirection),i.diff=a.e.GetAngleBetweenVectors(i.rotatedDirection,e,a.e.Cross(i.rotatedDirection,e))}),this._faceVectors.reduce(function(e,t){return e.ignore?t:t.ignore?e:e.diff1)return e._setAllVisibility(e._ownerNode,1),void(e._hoverValue=e.fadeInTime+e.delay);if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return void(e._hoverValue=0);setTimeout(e._update,e._millisecondsPerFrame)}}}return Object.defineProperty(e.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},e.prototype.detach=function(){this._ownerNode=null},e.prototype.fadeIn=function(e){this._hovered=e,this._update()},e.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach(function(e){i._setAllVisibility(e,t)})},e}(),He=i(58),Xe=function(){function e(){this._startDistance=0,this._initialScale=new a.e(0,0,0),this._targetScale=new a.e(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new He.a({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new He.a({}),this._dragBehaviorB.moveAttached=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},e.prototype.attach=function(e){var t=this;this._ownerNode=e,this._dragBehaviorA.onDragStartObservable.add(function(i){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerID==t._dragBehaviorB.currentDraggingPointerID?t._dragBehaviorA.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))}),this._dragBehaviorB.onDragStartObservable.add(function(i){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerID==t._dragBehaviorB.currentDraggingPointerID?t._dragBehaviorB.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))}),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(e){e.onDragObservable.add(function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var e=t._getCurrentDistance()/t._startDistance;t._initialScale.scaleToRef(e,t._targetScale)}})}),e.addBehavior(this._dragBehaviorA),e.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add(function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var i=t._targetScale.subtract(e.scaling).scaleInPlace(.1);i.length()>.01&&e.scaling.addInPlace(i)}})},e.prototype.detach=function(){var e=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(t){t.onDragStartObservable.clear(),t.onDragObservable.clear(),e._ownerNode.removeBehavior(t)})},e}(),Ye=i(26),Ke=i(24),Qe=i(51),qe=function(){function e(){this._sceneRenderObserver=null,this._targetPosition=new a.e(0,0,0),this._moving=!1,this._startingOrientation=new a.b,this.zDragFactor=3,this.rotateDraggedObject=!0,this.dragging=!1,this.dragDeltaRatio=.2,this.currentDraggingPointerID=-1,this.detachCameraControls=!0,this.onDragStartObservable=new o.c,this.onDragEndObservable=new o.c}return Object.defineProperty(e.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},Object.defineProperty(e.prototype,"_pointerCamera",{get:function(){return this._scene.cameraToUseForPointers?this._scene.cameraToUseForPointers:this._scene.activeCamera},enumerable:!0,configurable:!0}),e.prototype.attach=function(t){var i=this;this._ownerNode=t,this._scene=this._ownerNode.getScene(),e._virtualScene||(e._virtualScene=new K.a(this._scene.getEngine()),e._virtualScene.detachControl(),this._scene.getEngine().scenes.pop());var n=null,r=new a.e(0,0,0);this._virtualOriginMesh=new Ye.a("",e._virtualScene),this._virtualOriginMesh.rotationQuaternion=new a.b,this._virtualDragMesh=new Ye.a("",e._virtualScene),this._virtualDragMesh.rotationQuaternion=new a.b;var o=null;this._pointerObserver=this._scene.onPointerObservable.add(function(e,t){if(e.type==Ue.a.POINTERDOWN){if(!i.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.ray&&(h=e.pickInfo.pickedMesh,i._ownerNode==h||h.isDescendantOf(i._ownerNode))){i._pointerCamera&&i._pointerCamera.cameraRigMode==Ke.a.RIG_MODE_NONE&&e.pickInfo.ray.origin.copyFrom(i._pointerCamera.globalPosition),n=i._ownerNode,Qe.a._RemoveAndStorePivotPoint(n),r.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),i._virtualOriginMesh.removeChild(i._virtualDragMesh),n.computeWorldMatrix(),i._virtualDragMesh.position.copyFrom(n.absolutePosition),n.rotationQuaternion||(n.rotationQuaternion=a.b.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z));var s=n.parent;n.setParent(null),i._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion),n.setParent(s),i._virtualOriginMesh.addChild(i._virtualDragMesh),i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition),i.dragging=!0,i.currentDraggingPointerID=e.event.pointerId,i.detachCameraControls&&i._pointerCamera&&!i._pointerCamera.leftCamera&&(i._pointerCamera.inputs.attachedElement?(o=i._pointerCamera.inputs.attachedElement,i._pointerCamera.detachControl(i._pointerCamera.inputs.attachedElement)):o=null),Qe.a._RestorePivotPoint(n),i.onDragStartObservable.notifyObservers({})}}else if(e.type==Ue.a.POINTERUP)i.currentDraggingPointerID==e.event.pointerId&&(i.dragging=!1,i._moving=!1,i.currentDraggingPointerID=-1,n=null,i._virtualOriginMesh.removeChild(i._virtualDragMesh),i.detachCameraControls&&o&&i._pointerCamera&&!i._pointerCamera.leftCamera&&i._pointerCamera.attachControl(o,!0),i.onDragEndObservable.notifyObservers({}));else if(e.type==Ue.a.POINTERMOVE&&i.currentDraggingPointerID==e.event.pointerId&&i.dragging&&e.pickInfo&&e.pickInfo.ray&&n){var c=i.zDragFactor;i._pointerCamera&&i._pointerCamera.cameraRigMode==Ke.a.RIG_MODE_NONE&&(e.pickInfo.ray.origin.copyFrom(i._pointerCamera.globalPosition),c=0);var l=e.pickInfo.ray.origin.subtract(r);r.copyFrom(e.pickInfo.ray.origin);var u=-a.e.Dot(l,e.pickInfo.ray.direction);i._virtualOriginMesh.addChild(i._virtualDragMesh),i._virtualDragMesh.position.z-=i._virtualDragMesh.position.z<1?u*i.zDragFactor:u*c*i._virtualDragMesh.position.z,i._virtualDragMesh.position.z<0&&(i._virtualDragMesh.position.z=0),i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),i._virtualOriginMesh.removeChild(i._virtualDragMesh),i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition),n.parent&&a.e.TransformCoordinatesToRef(i._targetPosition,a.a.Invert(n.parent.getWorldMatrix()),i._targetPosition),i._moving||i._startingOrientation.copyFrom(i._virtualDragMesh.rotationQuaternion),i._moving=!0}var h});var s=new a.b;this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add(function(){if(i.dragging&&i._moving&&n){if(Qe.a._RemoveAndStorePivotPoint(n),n.position.addInPlace(i._targetPosition.subtract(n.position).scale(i.dragDeltaRatio)),i.rotateDraggedObject){s.copyFrom(i._startingOrientation),s.x=-s.x,s.y=-s.y,s.z=-s.z,i._virtualDragMesh.rotationQuaternion.multiplyToRef(s,s),a.b.RotationYawPitchRollToRef(s.toEulerAngles("xyz").y,0,0,s),s.multiplyToRef(i._startingOrientation,s);var e=n.parent;(!e||e.scaling&&!e.scaling.isNonUniformWithinEpsilon(.001))&&(n.setParent(null),a.b.SlerpToRef(n.rotationQuaternion,s,i.dragDeltaRatio,n.rotationQuaternion),n.setParent(e))}Qe.a._RestorePivotPoint(n)}})},e.prototype.detach=function(){this._scene&&this._scene.onPointerObservable.remove(this._pointerObserver),this._ownerNode&&this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),this._virtualOriginMesh&&this._virtualOriginMesh.dispose(),this._virtualDragMesh&&this._virtualDragMesh.dispose(),this.onDragEndObservable.clear(),this.onDragStartObservable.clear()},e}(),Ze=function(){function e(e,t,i){if(this.targetPosition=a.e.Zero(),this.poleTargetPosition=a.e.Zero(),this.poleTargetLocalOffset=a.e.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=a.b.Identity(),this._bone1Mat=a.a.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=a.e.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),this._bone1){this.mesh=e;var n=t.getPosition();if(t.getAbsoluteTransform().determinant()>0&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,n.x>n.y&&n.x>n.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length){var r=this._bone1.getScale(),o=this._bone2.getScale();this._bone1Length=this._bone1.length*r.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*o.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);var s=this._bone2.children[0].getAbsolutePosition(e),c=this._bone2.getAbsolutePosition(e),l=this._bone1.getAbsolutePosition(e);this._bone1Length=a.e.Distance(s,c),this._bone2Length=a.e.Distance(c,l)}this._bone1.getRotationMatrixToRef(Z.b.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}}return Object.defineProperty(e.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!0,configurable:!0}),e.prototype._setMaxAngle=function(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))},e.prototype.update=function(){var t=this._bone1;if(t){var i=this.targetPosition,n=this.poleTargetPosition,r=e._tmpMats[0],o=e._tmpMats[1];this.targetMesh&&i.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,n):this.poleTargetMesh&&a.e.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),n);var s=e._tmpVecs[0],c=e._tmpVecs[1],l=e._tmpVecs[2],u=e._tmpVecs[3],h=e._tmpVecs[4],d=e._tmpQuat;t.getAbsolutePositionToRef(this.mesh,s),n.subtractToRef(s,h),0==h.x&&0==h.y&&0==h.z?h.y=1:h.normalize(),i.subtractToRef(s,u),u.normalize(),a.e.CrossToRef(u,h,c),c.normalize(),a.e.CrossToRef(u,c,l),l.normalize(),a.a.FromXYZAxesToRef(l,u,c,r);var f=this._bone1Length,p=this._bone2Length,_=a.e.Distance(s,i);this._maxReach>0&&(_=Math.min(this._maxReach,_));var m=(p*p+_*_-f*f)/(2*p*_),g=(_*_+f*f-p*p)/(2*_*f);m>1&&(m=1),g>1&&(g=1),m<-1&&(m=-1),g<-1&&(g=-1);var v=Math.acos(m),y=Math.acos(g),b=-v-y;if(this._rightHandedSystem)a.a.RotationYawPitchRollToRef(0,0,this._adjustRoll,o),o.multiplyToRef(r,r),a.a.RotationAxisToRef(this._bendAxis,y,o),o.multiplyToRef(r,r);else{var T=e._tmpVecs[5];T.copyFrom(this._bendAxis),T.x*=-1,a.a.RotationAxisToRef(T,-y,o),o.multiplyToRef(r,r)}this.poleAngle&&(a.a.RotationAxisToRef(u,this.poleAngle,o),r.multiplyToRef(o,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||a.b.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),a.b.FromRotationMatrixToRef(r,d),a.b.SlerpToRef(this._bone1Quat,d,this.slerpAmount,this._bone1Quat),b=this._bone2Ang*(1-this.slerpAmount)+b*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,Z.b.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,Z.b.WORLD,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1)),this._bone2.setAxisAngle(this._bendAxis,b,Z.b.LOCAL),this._bone2Ang=b}},e._tmpVecs=[a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero()],e._tmpQuat=a.b.Identity(),e._tmpMats=[a.a.Identity(),a.a.Identity()],e}(),Je=function(){function e(e,t,i,n){if(this.upAxis=a.e.Up(),this.upAxisSpace=Z.b.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=a.b.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=a.e.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)){var r=Z.a.Y,o=Z.a.X;null!=n.yawAxis&&(r=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(o=n.pitchAxis.clone()).normalize();var s=a.e.Cross(o,r);this._transformYawPitch=a.a.Identity(),a.a.FromXYZAxesToRef(o,r,s,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=Z.b.BONE||(this.upAxisSpace=Z.b.LOCAL)}return Object.defineProperty(e.prototype,"minYaw",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxYaw",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),e.prototype.update=function(){if(this.slerpAmount<1&&!this._firstFrameSkipped)this._firstFrameSkipped=!0;else{var t=this.bone,i=e._tmpVecs[0];t.getAbsolutePositionToRef(this.mesh,i);var n=this.target,r=e._tmpMats[0],o=e._tmpMats[1],s=this.mesh,c=t.getParent(),l=e._tmpVecs[1];l.copyFrom(this.upAxis),this.upAxisSpace==Z.b.BONE&&c?(this._transformYawPitch&&a.e.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),c.getDirectionToRef(l,this.mesh,l)):this.upAxisSpace==Z.b.LOCAL&&(s.getDirectionToRef(l,l),1==s.scaling.x&&1==s.scaling.y&&1==s.scaling.z||l.normalize());var u=!1,h=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(u=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(h=!0),u||h){var d=e._tmpMats[2],f=e._tmpMats[3];if(this.upAxisSpace==Z.b.BONE&&1==l.y&&c)c.getRotationMatrixToRef(Z.b.WORLD,this.mesh,d);else if(this.upAxisSpace!=Z.b.LOCAL||1!=l.y||c){(_=e._tmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&a.e.TransformCoordinatesToRef(_,this._transformYawPitchInv,_),c?c.getDirectionToRef(_,this.mesh,_):s.getDirectionToRef(_,_);var p=a.e.Cross(l,_);p.normalize();var _=a.e.Cross(p,l);a.a.FromXYZAxesToRef(p,l,_,d)}else d.copyFrom(s.getWorldMatrix());d.invertToRef(f);var m=null;if(h){var g=e._tmpVecs[3];n.subtractToRef(i,g),a.e.TransformCoordinatesToRef(g,f,g),m=Math.sqrt(g.x*g.x+g.z*g.z);var v=Math.atan2(g.y,m),y=v;v>this._maxPitch?(g.y=this._maxPitchTan*m,y=this._maxPitch):vthis._maxYaw||bMath.PI?this._isAngleBetween(b,this._maxYaw,this._midYawConstraint)?(g.z=this._maxYawCos*m,g.x=this._maxYawSin*m,T=this._maxYaw):this._isAngleBetween(b,this._midYawConstraint,this._minYaw)&&(g.z=this._minYawCos*m,g.x=this._minYawSin*m,T=this._minYaw):b>this._maxYaw?(g.z=this._maxYawCos*m,g.x=this._maxYawSin*m,T=this._maxYaw):bMath.PI){var E=e._tmpVecs[8];E.copyFrom(Z.a.Z),this._transformYawPitch&&a.e.TransformCoordinatesToRef(E,this._transformYawPitchInv,E);var A=e._tmpMats[4];this._boneQuat.toRotationMatrix(A),this.mesh.getWorldMatrix().multiplyToRef(A,A),a.e.TransformCoordinatesToRef(E,A,E),a.e.TransformCoordinatesToRef(E,f,E);var P=Math.atan2(E.x,E.z);if(this._getAngleBetween(P,b)>this._getAngleBetween(P,this._midYawConstraint)){null==m&&(m=Math.sqrt(g.x*g.x+g.z*g.z));var S=this._getAngleBetween(P,this._maxYaw);this._getAngleBetween(P,this._minYaw)Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},e.prototype._getAngleBetween=function(e,t){var i=0;return(i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI&&(i=2*Math.PI-i),i},e.prototype._isAngleBetween=function(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(e>t&&ei&&e>v,b=0;b<6;b++){var T=g[v][b];m&&(T=d._convertRGBtoRGBATextureData(T,y,y,r)),f.texImage2D(b,v,_,y,y,0,u,l,T)}d._bindTextureDirectly(f.TEXTURE_CUBE_MAP,null)}else d.updateRawCubeTexture(p,o,n,r,h);p.isReady=!0,t._removePendingData(p),c&&c()}}(e)},void 0,t.offlineProvider,!0,function(e,i){t._removePendingData(p),l&&e&&l(e.status+" "+e.statusText,i)}),p},Ce.b.prototype.createRawTexture3D=function(e,t,i,n,r,o,a,s,c,l){void 0===c&&(c=null),void 0===l&&(l=Ce.b.TEXTURETYPE_UNSIGNED_INT);var u=new et.a(this,et.a.DATASOURCE_RAW3D);u.baseWidth=t,u.baseHeight=i,u.baseDepth=n,u.width=t,u.height=i,u.depth=n,u.format=r,u.type=l,u.generateMipMaps=o,u.samplingMode=s,u.is3D=!0,this._doNotHandleContextLost||(u._bufferView=e),this.updateRawTexture3D(u,e,r,a,c,l),this._bindTextureDirectly(this._gl.TEXTURE_3D,u,!0);var h=this._getSamplingParameters(s,o);return this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,h.mag),this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,h.min),o&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._internalTexturesCache.push(u),u},Ce.b.prototype.updateRawTexture3D=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=Ce.b.TEXTURETYPE_UNSIGNED_INT);var a=this._getWebGLTextureType(o),s=this._getInternalFormat(i),c=this._getRGBABufferInternalSizedFormat(o,i);this._bindTextureDirectly(this._gl.TEXTURE_3D,e,!0),this._unpackFlipY(void 0===n||!!n),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),r&&t?this._gl.compressedTexImage3D(this._gl.TEXTURE_3D,0,this.getCaps().s3tc[r],e.width,e.height,e.depth,0,t):this._gl.texImage3D(this._gl.TEXTURE_3D,0,c,e.width,e.height,e.depth,0,s,a,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),e.isReady=!0};var tt=function(e){function t(t,i,n,r,o,a,s,c,l){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===c&&(c=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=g.a.TEXTURETYPE_UNSIGNED_INT);var u=e.call(this,null,o,!a,s)||this;return u.format=r,u._engine=o.getEngine(),u._texture=o.getEngine().createRawTexture(t,i,n,r,a,s,c,null,l),u.wrapU=$e.a.CLAMP_ADDRESSMODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,u}return h.d(t,e),t.prototype.update=function(e){this._engine.updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},t.CreateLuminanceTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_LUMINANCE,r,o,a,s)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_LUMINANCE_ALPHA,r,o,a,s)},t.CreateAlphaTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_ALPHA,r,o,a,s)},t.CreateRGBTexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,g.a.TEXTUREFORMAT_RGB,r,o,a,s,c)},t.CreateRGBATexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,g.a.TEXTUREFORMAT_RGBA,r,o,a,s,c)},t.CreateRTexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=$e.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_FLOAT),new t(e,i,n,g.a.TEXTUREFORMAT_R,r,o,a,s,c)},t}($e.a),it=function(){function e(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this.overrideMesh=null,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=a.a.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new o.c,this.bones=[],this._scene=i||C.a.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;var n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&n.maxVertexTextureImageUnits>0}return Object.defineProperty(e.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"Skeleton"},e.prototype.getChildren=function(){return this.bones.filter(function(e){return!e.getParent()})},e.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t="Name: "+this.name+", nBones: "+this.bones.length;if(t+=", nAnimationRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var n in this._ranges)i&&(t+=", ",i=!1),t+=n;t+="}"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i0)for(var e=0,t=this.bones;e0&&(r.animation=i.animations[0].serialize()),e.ranges=[],this._ranges){var a=this._ranges[o];if(a){var s={};s.name=o,s.from=a.from,s.to=a.to,e.ranges.push(s)}}}return e},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=a.e.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,n=0;n-1&&(s=r.bones[o.parentBoneIndex]);var c=o.rest?a.a.FromArray(o.rest):null,l=new J(o.name,r,s,a.a.FromArray(o.matrix),c);void 0!==o.id&&null!==o.id&&(l.id=o.id),o.length&&(l.length=o.length),o.metadata&&(l.metadata=o.metadata),o.animation&&l.animations.push(k.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(r._hasWaitingData=!0,l._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(n=0;n0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i=2&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),this.browserGamepad.axes.length>=4&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}return Object.defineProperty(e.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!0,configurable:!0}),e.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},e.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(e.prototype,"leftStick",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightStick",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!0,configurable:!0}),e.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},e.prototype.dispose=function(){},e.GAMEPAD=0,e.GENERIC=1,e.XBOX=2,e.POSE_ENABLED=3,e.DUALSHOCK=4,e}(),st=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.onButtonDownObservable=new o.c,r.onButtonUpObservable=new o.c,r.type=at.GENERIC,r._buttons=new Array(n.buttons.length),r}return h.d(t,e),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t.005&&(e.inertialAlphaOffset+=i)}if(0!=t.y){var n=t.y/this.gamepadRotationSensibility;0!=n&&Math.abs(n)>.005&&(e.inertialBetaOffset+=n)}}var r=this.gamepad.leftStick;if(r&&0!=r.y){var o=r.y/this.gamepadMoveSensibility;0!=o&&Math.abs(o)>.005&&(this.camera.inertialRadiusOffset-=o)}}},e.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},h.c([Object(F.c)()],e.prototype,"gamepadRotationSensibility",void 0),h.c([Object(F.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();nt.ArcRotateCameraGamepadInput=ct;var lt=i(59),ut=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;r.metaKey||(e.type===lt.a.KEYDOWN?(i._ctrlPressed=r.ctrlKey,i._altPressed=r.altKey,(-1!==i.keysUp.indexOf(r.keyCode)||-1!==i.keysDown.indexOf(r.keyCode)||-1!==i.keysLeft.indexOf(r.keyCode)||-1!==i.keysRight.indexOf(r.keyCode)||-1!==i.keysReset.indexOf(r.keyCode))&&(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),r.preventDefault&&(t||r.preventDefault()))):-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)&&-1===i.keysReset.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),r.preventDefault&&(t||r.preventDefault())))}))},e.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=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e,t){var i=this;this._wheel=function(e,n){if(e.type===Ue.a.POINTERWHEEL){var r=e.event,o=0,a=r;if(a.wheelDelta)if(i.wheelDeltaPercentage){if((o=i.computeDeltaFromMouseWheelLegacyEvent(a,i.camera.radius))>0){for(var s=i.camera.radius,c=i.camera.inertialRadiusOffset+o,l=0;l<20&&Math.abs(c)>.001;l++)s-=c,c*=i.camera.inertia;s=w.a.Clamp(s,0,Number.MAX_VALUE),o=i.computeDeltaFromMouseWheelLegacyEvent(a,s)}}else o=a.wheelDelta/(40*i.wheelPrecision);else o=-(r.deltaY||r.detail)/i.wheelPrecision;o&&(i.camera.inertialRadiusOffset+=o),r.preventDefault&&(t||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Ue.a.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},h.c([Object(F.c)()],e.prototype,"wheelPrecision",void 0),h.c([Object(F.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();nt.ArcRotateCameraMouseWheelInput=ht;var dt=function(){function e(){this.buttons=[0,1,2]}return e.prototype.attachControl=function(e,t){var i=this,n=this.camera.getEngine(),r=0,o=null;this.pointA=null,this.pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=function(a,s){var c=a.event,l="touch"===c.pointerType;if(!n.isInVRExclusivePointerMode&&(a.type===Ue.a.POINTERMOVE||-1!==i.buttons.indexOf(c.button))){var u=c.srcElement||c.target;if(i._altKey=c.altKey,i._ctrlKey=c.ctrlKey,i._metaKey=c.metaKey,i._shiftKey=c.shiftKey,i._buttonsPressed=c.buttons,n.isPointerLock){var h=c.movementX||c.mozMovementX||c.webkitMovementX||c.msMovementX||0,d=c.movementY||c.mozMovementY||c.webkitMovementY||c.msMovementY||0;i.onTouch(null,h,d),i.pointA=null,i.pointB=null}else if(a.type===Ue.a.POINTERDOWN&&u){try{u.setPointerCapture(c.pointerId)}catch(e){}null===i.pointA?i.pointA={x:c.clientX,y:c.clientY,pointerId:c.pointerId,type:c.pointerType}:null===i.pointB&&(i.pointB={x:c.clientX,y:c.clientY,pointerId:c.pointerId,type:c.pointerType}),i.onButtonDown(c),t||(c.preventDefault(),e.focus())}else if(a.type===Ue.a.POINTERDOUBLETAP)i.onDoubleTap(c.pointerType);else if(a.type===Ue.a.POINTERUP&&u){try{u.releasePointerCapture(c.pointerId)}catch(e){}l||(i.pointB=null),n._badOS?i.pointA=i.pointB=null:i.pointB&&i.pointA&&i.pointA.pointerId==c.pointerId?(i.pointA=i.pointB,i.pointB=null):i.pointA&&i.pointB&&i.pointB.pointerId==c.pointerId?i.pointB=null:i.pointA=i.pointB=null,(0!==r||o)&&(i.onMultiTouch(i.pointA,i.pointB,r,0,o,null),r=0,o=null),i.onButtonUp(c),t||c.preventDefault()}else if(a.type===Ue.a.POINTERMOVE)if(t||c.preventDefault(),i.pointA&&null===i.pointB){h=c.clientX-i.pointA.x,d=c.clientY-i.pointA.y;i.onTouch(i.pointA,h,d),i.pointA.x=c.clientX,i.pointA.y=c.clientY}else if(i.pointA&&i.pointB){var f=i.pointA.pointerId===c.pointerId?i.pointA:i.pointB;f.x=c.clientX,f.y=c.clientY;var p=i.pointA.x-i.pointB.x,_=i.pointA.y-i.pointB.y,m=p*p+_*_,g={x:(i.pointA.x+i.pointB.x)/2,y:(i.pointA.y+i.pointB.y)/2,pointerId:c.pointerId,type:a.type};i.onMultiTouch(i.pointA,i.pointB,r,m,o,g),o=g,r=m}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,Ue.a.POINTERDOWN|Ue.a.POINTERUP|Ue.a.POINTERMOVE),this._onLostFocus=function(){i.pointA=i.pointB=null,r=0,o=null,i.onLostFocus()},e.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),Ie.b.RegisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(),[{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){this._onLostFocus&&Ie.b.UnregisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(),[{name:"blur",handler:this._onLostFocus}]),e&&this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this.onContextMenu&&e.removeEventListener("contextmenu",this.onContextMenu),this._onLostFocus=null),this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0},e.prototype.getClassName=function(){return"BaseCameraPointersInput"},e.prototype.getSimpleName=function(){return"pointers"},e.prototype.onDoubleTap=function(e){},e.prototype.onTouch=function(e,t,i){},e.prototype.onMultiTouch=function(e,t,i,n,r,o){},e.prototype.onContextMenu=function(e){e.preventDefault()},e.prototype.onButtonDown=function(e){},e.prototype.onButtonUp=function(e){},e.prototype.onLostFocus=function(){},h.c([Object(F.c)()],e.prototype,"buttons",void 0),e}(),ft=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[0,1,2],t.angularSensibilityX=1e3,t.angularSensibilityY=1e3,t.pinchPrecision=12,t.pinchDeltaPercentage=0,t.panningSensibility=1e3,t.multiTouchPanning=!0,t.multiTouchPanAndZoom=!0,t.pinchInwards=!0,t._isPanClick=!1,t._twoFingerActivityCount=0,t._isPinching=!1,t}return h.d(t,e),t.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},t.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},t.prototype.onDoubleTap=function(e){this.camera.useInputToRestoreState&&this.camera.restoreState()},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var a=this.pinchInwards?1:-1;if(this.multiTouchPanAndZoom){if(this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o){var s=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility}}else{this._twoFingerActivityCount++;var l=Math.sqrt(i),u=Math.sqrt(n);if(this._isPinching||this._twoFingerActivityCount<20&&Math.abs(u-l)>this.camera.pinchToPanMaxDistance)this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0;else if(0!==this.panningSensibility&&this.multiTouchPanning&&o&&r){s=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility}}}},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},h.c([Object(F.c)()],t.prototype,"buttons",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityX",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityY",void 0),h.c([Object(F.c)()],t.prototype,"pinchPrecision",void 0),h.c([Object(F.c)()],t.prototype,"pinchDeltaPercentage",void 0),h.c([Object(F.c)()],t.prototype,"panningSensibility",void 0),h.c([Object(F.c)()],t.prototype,"multiTouchPanning",void 0),h.c([Object(F.c)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(dt);nt.ArcRotateCameraPointersInput=ft;var pt=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addMouseWheel=function(){return this.add(new ht),this},t.prototype.addPointers=function(){return this.add(new ft),this},t.prototype.addKeyboard=function(){return this.add(new ut),this},t}(rt);pt.prototype.addVRDeviceOrientation=function(){return this.add(new _t),this};var _t=function(){function e(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}return e.prototype.attachControl=function(e,t){this.camera.attachControl(e,t),this.camera.getScene().getEngine().getHostWindow().addEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0},e.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},e.prototype.detachControl=function(e){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"VRDeviceOrientation"},e}();nt.ArcRotateCameraVRDeviceOrientationInput=_t;var mt=function(){function e(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;e.type===lt.a.KEYDOWN?-1===i.keysForward.indexOf(r.keyCode)&&-1===i.keysBackward.indexOf(r.keyCode)&&-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),t||r.preventDefault()):-1===i.keysForward.indexOf(r.keyCode)&&-1===i.keysBackward.indexOf(r.keyCode)&&-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),t||r.preventDefault())}))},e.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=[]},e.prototype.getClassName=function(){return"FlyCameraKeyboardInput"},e.prototype._onLostFocus=function(e){this._keys=[]},e.prototype.getSimpleName=function(){return"keyboard"},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t=0&&i._keys.splice(n,1),r.preventDefault&&(t||r.preventDefault())))}))},e.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=[]},e.prototype.checkInputs=function(){var e=this;this._onKeyboardObserver&&this._keys.forEach(function(t){-1!==e.keysHeightOffsetIncr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset+=e.heightSensibility:-1!==e.keysHeightOffsetDecr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset-=e.heightSensibility:-1!==e.keysRotationOffsetIncr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset+=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRotationOffsetDecr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset-=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRadiusIncr.indexOf(t)&&e._modifierRadius()?e.camera.radius+=e.radiusSensibility:-1!==e.keysRadiusDecr.indexOf(t)&&e._modifierRadius()&&(e.camera.radius-=e.radiusSensibility)})},e.prototype.getClassName=function(){return"FollowCameraKeyboardMoveInput"},e.prototype.getSimpleName=function(){return"keyboard"},e.prototype._modifierHeightOffset=function(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed},e.prototype._modifierRotationOffset=function(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed},e.prototype._modifierRadius=function(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed},h.c([Object(F.c)()],e.prototype,"keysHeightOffsetIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"heightSensibility",void 0),h.c([Object(F.c)()],e.prototype,"rotationSensibility",void 0),h.c([Object(F.c)()],e.prototype,"radiusSensibility",void 0),e}();nt.FollowCameraKeyboardMoveInput=vt;var yt=function(){function e(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}return e.prototype.attachControl=function(e,t){var i=this;this._wheel=function(e,n){if(e.type===Ue.a.POINTERWHEEL){var r=e.event,o=0,a=Math.max(-1,Math.min(1,r.deltaY||r.wheelDelta||-r.detail));i.wheelDeltaPercentage?(console.assert(i.axisControlRadius+i.axisControlHeight+i.axisControlRotation<=1,"wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: "+i.axisControlRadius+", axisControlHeightOffset: "+i.axisControlHeight+", axisControlRotationOffset: "+i.axisControlRotation),i.axisControlRadius?o=.01*a*i.wheelDeltaPercentage*i.camera.radius:i.axisControlHeight?o=.01*a*i.wheelDeltaPercentage*i.camera.heightOffset:i.axisControlRotation&&(o=.01*a*i.wheelDeltaPercentage*i.camera.rotationOffset)):o=a*i.wheelPrecision,o&&(i.axisControlRadius?i.camera.radius+=o:i.axisControlHeight?i.camera.heightOffset-=o:i.axisControlRotation&&(i.camera.rotationOffset-=o)),r.preventDefault&&(t||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Ue.a.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},h.c([Object(F.c)()],e.prototype,"axisControlRadius",void 0),h.c([Object(F.c)()],e.prototype,"axisControlHeight",void 0),h.c([Object(F.c)()],e.prototype,"axisControlRotation",void 0),h.c([Object(F.c)()],e.prototype,"wheelPrecision",void 0),h.c([Object(F.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();nt.FollowCameraMouseWheelInput=yt;var bt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.angularSensibilityX=1,t.angularSensibilityY=1,t.pinchPrecision=1e4,t.pinchDeltaPercentage=0,t.axisXControlRadius=!1,t.axisXControlHeight=!1,t.axisXControlRotation=!0,t.axisYControlRadius=!1,t.axisYControlHeight=!0,t.axisYControlRotation=!1,t.axisPinchControlRadius=!0,t.axisPinchControlHeight=!1,t.axisPinchControlRotation=!1,t.warningEnable=!0,t._warningCounter=0,t}return h.d(t,e),t.prototype.getClassName=function(){return"FollowCameraPointersInput"},t.prototype.onTouch=function(e,t,i){this._warning(),this.axisXControlRotation?this.camera.rotationOffset+=t/this.angularSensibilityX:this.axisYControlRotation&&(this.camera.rotationOffset+=i/this.angularSensibilityX),this.axisXControlHeight?this.camera.heightOffset+=t/this.angularSensibilityY:this.axisYControlHeight&&(this.camera.heightOffset+=i/this.angularSensibilityY),this.axisXControlRadius?this.camera.radius-=t/this.angularSensibilityY:this.axisYControlRadius&&(this.camera.radius-=i/this.angularSensibilityY)},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var a=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2);this.pinchDeltaPercentage?(a*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=a*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=a*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=a*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=a),this.axisPinchControlHeight&&(this.camera.heightOffset+=a),this.axisPinchControlRadius&&(this.camera.radius-=a))}},t.prototype._warning=function(){if(this.warningEnable&&this._warningCounter++%100==0){var e="It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: ";console.assert(this.axisXControlRotation+this.axisXControlHeight+this.axisXControlRadius<=1,e+"axisXControlRotation: "+this.axisXControlRotation+", axisXControlHeight: "+this.axisXControlHeight+", axisXControlRadius: "+this.axisXControlRadius),console.assert(this.axisYControlRotation+this.axisYControlHeight+this.axisYControlRadius<=1,e+"axisYControlRotation: "+this.axisYControlRotation+", axisYControlHeight: "+this.axisYControlHeight+", axisYControlRadius: "+this.axisYControlRadius),console.assert(this.axisPinchControlRotation+this.axisPinchControlHeight+this.axisPinchControlRadius<=1,e+"axisPinchControlRotation: "+this.axisPinchControlRotation+", axisPinchControlHeight: "+this.axisPinchControlHeight+", axisPinchControlRadius: "+this.axisPinchControlRadius)}},h.c([Object(F.c)()],t.prototype,"angularSensibilityX",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityY",void 0),h.c([Object(F.c)()],t.prototype,"pinchPrecision",void 0),h.c([Object(F.c)()],t.prototype,"pinchDeltaPercentage",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlRotation",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlRotation",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlRotation",void 0),t}(dt);nt.FollowCameraPointersInput=bt;var Tt=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;r.metaKey||(e.type===lt.a.KEYDOWN?-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),t||r.preventDefault()):-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),t||r.preventDefault()))}))},e.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=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x+=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new a.e(0,0,t*this._offsetY/this.touchMoveSensibility);a.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(a.e.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},h.c([Object(F.c)()],e.prototype,"touchAngularSensibility",void 0),h.c([Object(F.c)()],e.prototype,"touchMoveSensibility",void 0),e}();nt.FreeCameraTouchInput=At;var Pt=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new Tt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new Et(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addTouch=function(){return this.add(new At),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(rt);Pt.prototype.addDeviceOrientation=function(){return this._deviceOrientationInput||(this._deviceOrientationInput=new St,this.add(this._deviceOrientationInput)),this};var St=function(){function e(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new a.b,this._alpha=0,this._beta=0,this._gamma=0,this._onDeviceOrientationChangedObservable=new o.c,this._orientationChanged=function(){e._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,e._screenOrientationAngle=-Ie.b.ToRadians(e._screenOrientationAngle/2),e._screenQuaternion.copyFromFloats(0,Math.sin(e._screenOrientationAngle),0,Math.cos(e._screenOrientationAngle))},this._deviceOrientation=function(t){e._alpha=null!==t.alpha?t.alpha:0,e._beta=null!==t.beta?t.beta:0,e._gamma=null!==t.gamma?t.gamma:0,null!==t.alpha&&e._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new a.b(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return e.WaitForOrientationChangeAsync=function(e){return new Promise(function(t,i){var n=!1,r=function(){window.removeEventListener("deviceorientation",r),n=!0,t()};e&&setTimeout(function(){n||(window.removeEventListener("deviceorientation",r),i("WaitForOrientationChangeAsync timed out"))},e),window.addEventListener("deviceorientation",r)})},Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new a.b),this._camera&&this._camera.onDisposeObservable.add(function(){t._onDeviceOrientationChangedObservable.clear()})},enumerable:!0,configurable:!0}),e.prototype.attachControl=function(e,t){var i=this.camera.getScene().getEngine().getHostWindow();i.addEventListener("orientationchange",this._orientationChanged),i.addEventListener("deviceorientation",this._deviceOrientation),this._orientationChanged()},e.prototype.detachControl=function(e){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0},e.prototype.checkInputs=function(){this._alpha&&(a.b.RotationYawPitchRollToRef(Ie.b.ToRadians(this._alpha),Ie.b.ToRadians(this._beta),-Ie.b.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},e.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"deviceOrientation"},e}();nt.FreeCameraDeviceOrientationInput=St;var Rt=function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this._cameraTransform=a.a.Identity(),this._deltaTransform=a.e.Zero(),this._vector3=a.e.Zero(),this._vector2=a.d.Zero()}return e.prototype.attachControl=function(e,t){var i=this,n=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=n.onGamepadConnectedObservable.add(function(e){e.type!==at.POSE_ENABLED&&(i.gamepad&&e.type!==at.XBOX||(i.gamepad=e))}),this._onGamepadDisconnectedObserver=n.onGamepadDisconnectedObservable.add(function(e){i.gamepad===e&&(i.gamepad=null)}),this.gamepad=n.getGamepadByType(at.XBOX)},e.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad&&this.gamepad.leftStick){var e=this.camera,t=this.gamepad.leftStick,i=t.x/this.gamepadMoveSensibility,n=t.y/this.gamepadMoveSensibility;t.x=Math.abs(i)>.005?0+i:0,t.y=Math.abs(n)>.005?0+n:0;var r=this.gamepad.rightStick;if(r){var o=r.x/this.gamepadAngularSensibility,s=r.y/this.gamepadAngularSensibility;r.x=Math.abs(o)>.001?0+o:0,r.y=Math.abs(s)>.001?0+s:0}else r={x:0,y:0};e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):a.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);var c=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*c,0,-t.y*c),a.e.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(r.y,r.x),e.cameraRotation.addInPlace(this._vector2)}},e.prototype.getClassName=function(){return"FreeCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},h.c([Object(F.c)()],e.prototype,"gamepadAngularSensibility",void 0),h.c([Object(F.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();nt.FreeCameraGamepadInput=Rt;var xt,Ct=i(70);!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(xt||(xt={}));var Mt=function(){function e(t){var i=this;if(this._leftJoystick=!!t,e._globalJoystickIndex++,this._axisTargetedByLeftAndRight=xt.X,this._axisTargetedByUpAndDown=xt.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new Ct.a,this.deltaPosition=a.e.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(t){e.vjCanvasWidth=window.innerWidth,e.vjCanvasHeight=window.innerHeight,e.Canvas&&(e.Canvas.width=e.vjCanvasWidth,e.Canvas.height=e.vjCanvasHeight),e.halfWidth=e.vjCanvasWidth/2},!e.Canvas){window.addEventListener("resize",this._onResize,!1),e.Canvas=document.createElement("canvas"),e.vjCanvasWidth=window.innerWidth,e.vjCanvasHeight=window.innerHeight,e.Canvas.width=window.innerWidth,e.Canvas.height=window.innerHeight,e.Canvas.style.width="100%",e.Canvas.style.height="100%",e.Canvas.style.position="absolute",e.Canvas.style.backgroundColor="transparent",e.Canvas.style.top="0px",e.Canvas.style.left="0px",e.Canvas.style.zIndex="5",e.Canvas.style.msTouchAction="none",e.Canvas.setAttribute("touch-action","none");var n=e.Canvas.getContext("2d");if(!n)throw new Error("Unable to create canvas for virtual joystick");e.vjCanvasContext=n,e.vjCanvasContext.strokeStyle="#ffffff",e.vjCanvasContext.lineWidth=2,document.body.appendChild(e.Canvas)}e.halfWidth=e.Canvas.width/2,this.pressed=!1,this._joystickColor="cyan",this._joystickPointerID=-1,this._joystickPointerPos=new a.d(0,0),this._joystickPreviousPointerPos=new a.d(0,0),this._joystickPointerStartPos=new a.d(0,0),this._deltaJoystickVector=new a.d(0,0),this._onPointerDownHandlerRef=function(e){i._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){i._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){i._onPointerUp(e)},e.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),e.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),e.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("contextmenu",function(e){e.preventDefault()},!1),requestAnimationFrame(function(){i._drawVirtualJoystick()})}return e.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},e.prototype._onPointerDown=function(t){t.preventDefault(),(!0===this._leftJoystick?t.clientXe.halfWidth)&&this._joystickPointerID<0?(this._joystickPointerID=t.pointerId,this._joystickPointerStartPos.x=t.clientX,this._joystickPointerStartPos.y=t.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone(),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(t.pointerId.toString(),t)):e._globalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(t.pointerId.toString(),{x:t.clientX,y:t.clientY,prevX:t.clientX,prevY:t.clientY}))},e.prototype._onPointerMove=function(e){if(this._joystickPointerID==e.pointerId){this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY,this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos);var t=(this.reverseLeftRight?-1:1)*this._deltaJoystickVector.x/this._inversedSensibility;switch(this._axisTargetedByLeftAndRight){case xt.X:this.deltaPosition.x=Math.min(1,Math.max(-1,t));break;case xt.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,t));break;case xt.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,t))}var i=(this.reverseUpDown?1:-1)*this._deltaJoystickVector.y/this._inversedSensibility;switch(this._axisTargetedByUpAndDown){case xt.X:this.deltaPosition.x=Math.min(1,Math.max(-1,i));break;case xt.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,i));break;case xt.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,i))}}else{var n=this._touches.get(e.pointerId.toString());n&&(n.x=e.clientX,n.y=e.clientY)}},e.prototype._onPointerUp=function(t){if(this._joystickPointerID==t.pointerId)e.vjCanvasContext.clearRect(this._joystickPointerStartPos.x-64,this._joystickPointerStartPos.y-64,128,128),e.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x-42,this._joystickPreviousPointerPos.y-42,84,84),this._joystickPointerID=-1,this.pressed=!1;else{var i=this._touches.get(t.pointerId.toString());i&&e.vjCanvasContext.clearRect(i.prevX-44,i.prevY-44,88,88)}this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this._touches.remove(t.pointerId.toString())},e.prototype.setJoystickColor=function(e){this._joystickColor=e},e.prototype.setActionOnTouch=function(e){this._action=e},e.prototype.setAxisForLeftRight=function(e){switch(e){case xt.X:case xt.Y:case xt.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=xt.X}},e.prototype.setAxisForUpDown=function(e){switch(e){case xt.X:case xt.Y:case xt.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=xt.Y}},e.prototype._drawVirtualJoystick=function(){var t=this;this.pressed&&this._touches.forEach(function(i,n){n.pointerId===t._joystickPointerID?(e.vjCanvasContext.clearRect(t._joystickPointerStartPos.x-64,t._joystickPointerStartPos.y-64,128,128),e.vjCanvasContext.clearRect(t._joystickPreviousPointerPos.x-42,t._joystickPreviousPointerPos.y-42,84,84),e.vjCanvasContext.beginPath(),e.vjCanvasContext.lineWidth=6,e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.arc(t._joystickPointerStartPos.x,t._joystickPointerStartPos.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.lineWidth=2,e.vjCanvasContext.arc(t._joystickPointerStartPos.x,t._joystickPointerStartPos.y,60,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.arc(t._joystickPointerPos.x,t._joystickPointerPos.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),t._joystickPreviousPointerPos=t._joystickPointerPos.clone()):(e.vjCanvasContext.clearRect(n.prevX-44,n.prevY-44,88,88),e.vjCanvasContext.beginPath(),e.vjCanvasContext.fillStyle="white",e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle="red",e.vjCanvasContext.lineWidth=6,e.vjCanvasContext.arc(n.x,n.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),n.prevX=n.x,n.prevY=n.y)}),requestAnimationFrame(function(){t._drawVirtualJoystick()})},e.prototype.releaseCanvas=function(){e.Canvas&&(e.Canvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),e.Canvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),e.Canvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),e.Canvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(e.Canvas),e.Canvas=null)},e._globalJoystickIndex=0,e}();Pt.prototype.addVirtualJoystick=function(){return this.add(new Ot),this};var Ot=function(){function e(){}return e.prototype.getLeftJoystick=function(){return this._leftjoystick},e.prototype.getRightJoystick=function(){return this._rightjoystick},e.prototype.checkInputs=function(){if(this._leftjoystick){var e=this.camera,t=50*e._computeLocalCameraSpeed(),i=a.a.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),n=a.e.TransformCoordinates(new a.e(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i);e.cameraDirection=e.cameraDirection.add(n),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9))}},e.prototype.attachControl=function(e,t){this._leftjoystick=new Mt(!0),this._leftjoystick.setAxisForUpDown(xt.Z),this._leftjoystick.setAxisForLeftRight(xt.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new Mt(!1),this._rightjoystick.setAxisForUpDown(xt.X),this._rightjoystick.setAxisForLeftRight(xt.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")},e.prototype.detachControl=function(e){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()},e.prototype.getClassName=function(){return"FreeCameraVirtualJoystickInput"},e.prototype.getSimpleName=function(){return"virtualJoystick"},e}();nt.FreeCameraVirtualJoystickInput=Ot;var It=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.cameraDirection=new a.e(0,0,0),o.cameraRotation=new a.d(0,0),o.updateUpVectorFromRotation=!1,o._tmpQuaternion=new a.b,o.rotation=new a.e(0,0,0),o.speed=2,o.noRotationConstraint=!1,o.lockedTarget=null,o._currentTarget=a.e.Zero(),o._initialFocalDistance=1,o._viewMatrix=a.a.Zero(),o._camMatrix=a.a.Zero(),o._cameraTransformMatrix=a.a.Zero(),o._cameraRotationMatrix=a.a.Zero(),o._referencePoint=new a.e(0,0,1),o._transformedReferencePoint=a.e.Zero(),o._globalCurrentTarget=a.e.Zero(),o._globalCurrentUpVector=a.e.Zero(),o._defaultUp=a.e.Up(),o._cachedRotationZ=0,o._cachedQuaternionRotationZ=0,o}return h.d(t,e),t.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},t.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},t.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.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)},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.lockedTarget=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new a.b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this);var i=this._getLockedTargetPosition();i?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(i):this._cache.lockedTarget=i.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},t.prototype._isSynchronizedViewMatrix=function(){if(!e.prototype._isSynchronizedViewMatrix.call(this))return!1;var t=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(t):!t)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},t.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},t.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=re.a),a.a.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);t.x>=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.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&&a.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(a.c.Matrix[0]),a.e.TransformNormalToRef(this.cameraDirection,a.c.Matrix[0],a.c.Vector3[0]),void this.position.addInPlace(a.c.Vector3[0]);this.position.addInPlace(this.cameraDirection)},t.prototype._checkInputs=function(){var t=this._decideIfNeedsToMove(),i=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(t&&this._updatePosition(),i){if(this.rotation.x+=this.cameraRotation.x,this.rotation.y+=this.cameraRotation.y,this.rotationQuaternion)this.rotation.lengthSquared()&&a.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion);if(!this.noRotationConstraint){this.rotation.x>1.570796&&(this.rotation.x=1.570796),this.rotation.x<-1.570796&&(this.rotation.x=-1.570796)}}t&&(Math.abs(this.cameraDirection.x)Ce.b.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new Pt(o),o.inputs.addKeyboard().addMouse(),o}return h.d(t,e),Object.defineProperty(t.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(t.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(t.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(t.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(t.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}),t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new a.e(0,0,0),this.cameraRotation=new a.d(0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?a.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=a.e.Zero(),this._transformedDirection=a.e.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FreeCamera"},h.c([Object(F.o)()],t.prototype,"ellipsoid",void 0),h.c([Object(F.o)()],t.prototype,"ellipsoidOffset",void 0),h.c([Object(F.c)()],t.prototype,"checkCollisions",void 0),h.c([Object(F.c)()],t.prototype,"applyGravity",void 0),t}(It);B.a.AddNodeConstructor("TouchCamera",function(e,t){return function(){return new Lt(e,a.e.Zero(),t)}});var Lt=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addTouch(),r._setupInputs(),r}return h.d(t,e),Object.defineProperty(t.prototype,"touchAngularSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchMoveSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"TouchCamera"},t.prototype._setupInputs=function(){var e=this.inputs.attached.mouse;e&&(e.touchEnabled=!1)},t}(Dt);B.a.AddNodeConstructor("ArcRotateCamera",function(e,t){return function(){return new wt(e,0,0,1,a.e.Zero(),t)}});var wt=function(e){function t(t,i,n,r,s,c,l){void 0===l&&(l=!0);var u=e.call(this,t,a.e.Zero(),c,l)||this;return u._upVector=a.e.Up(),u.inertialAlphaOffset=0,u.inertialBetaOffset=0,u.inertialRadiusOffset=0,u.lowerAlphaLimit=null,u.upperAlphaLimit=null,u.lowerBetaLimit=.01,u.upperBetaLimit=Math.PI-.01,u.lowerRadiusLimit=null,u.upperRadiusLimit=null,u.inertialPanningX=0,u.inertialPanningY=0,u.pinchToPanMaxDistance=20,u.panningDistanceLimit=null,u.panningOriginTarget=a.e.Zero(),u.panningInertia=.9,u.zoomOnFactor=1,u.targetScreenOffset=a.d.Zero(),u.allowUpsideDown=!0,u.useInputToRestoreState=!0,u._viewMatrix=new a.a,u.panningAxis=new a.e(1,1,0),u.onMeshTargetChangedObservable=new o.c,u.checkCollisions=!1,u.collisionRadius=new a.e(.5,.5,.5),u._previousPosition=a.e.Zero(),u._collisionVelocity=a.e.Zero(),u._newPosition=a.e.Zero(),u._computationVector=a.e.Zero(),u._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(u.setPosition(t),u.onCollide&&u.onCollide(i)):u._previousPosition.copyFrom(u._position);var n=Math.cos(u.alpha),r=Math.sin(u.alpha),o=Math.cos(u.beta),a=Math.sin(u.beta);0===a&&(a=1e-4);var s=u._getTargetPosition();u._computationVector.copyFromFloats(u.radius*n*a,u.radius*o,u.radius*r*a),s.addToRef(u._computationVector,u._newPosition),u._position.copyFrom(u._newPosition);var c=u.upVector;u.allowUpsideDown&&u.beta<0&&(c=(c=c.clone()).negate()),u._computeViewMatrix(u._position,s,c),u._viewMatrix.addAtIndex(12,u.targetScreenOffset.x),u._viewMatrix.addAtIndex(13,u.targetScreenOffset.y),u._collisionTriggered=!1},u._target=a.e.Zero(),s&&u.setTarget(s),u.alpha=i,u.beta=n,u.radius=r,u.getViewMatrix(),u.inputs=new pt(u),u.inputs.addKeyboard().addMouseWheel().addPointers(),u}return h.d(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._YToUpMatrix=new a.a,this._upToYMatrix=new a.a,this._upVector=a.e.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!0,configurable:!0}),t.prototype.setMatUp=function(){a.a.RotationAlignToRef(a.e.UpReadOnly,this._upVector,this._YToUpMatrix),a.a.RotationAlignToRef(this._upVector,a.e.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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}),Object.defineProperty(t.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new ke,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new Ge,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new Ve,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!0,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=a.d.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.absolutePosition;this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}var t=this._getLockedTargetPosition();return t||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&(this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset))},t.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2),this._useCtrlForPanning=i,this._panningMouseButton=n,this.inputs.attachElement(e,t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var t=this.inertialAlphaOffset;this.beta<=0&&(t*=-1),this.getScene().useRightHandedSystem&&(t*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this.alpha+=t,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||a.e.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4),0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha),this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var n=e,r=this._getTargetPosition();if(r&&!i&&r.equals(n))return;this._targetHost=null,this._target=n,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4);var r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||a.e.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var s=this.upVector;this.allowUpsideDown&&n<0&&(s=s.negate()),this._computeViewMatrix(this._position,r,s),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=Se.a.MinMax(e),n=a.e.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},t.prototype.focusOn=function(e,t){var i,n;if(void 0===t&&(t=!1),void 0===e.min){var r=e||this.getScene().meshes;i=Se.a.MinMax(r),n=a.e.Distance(i.min,i.max)}else{i=e,n=e.distance}this._target=Se.a.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ke.a.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:n=this._cameraRigParams.stereoHalfAngle*(0===i?-1:1)}var r=new t(e,this.alpha+n,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],i=this._rigCameras[1];switch(t.beta=i.beta=this.beta,this.cameraRigMode){case Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ke.a.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"ArcRotateCamera"},h.c([Object(F.c)()],t.prototype,"alpha",void 0),h.c([Object(F.c)()],t.prototype,"beta",void 0),h.c([Object(F.c)()],t.prototype,"radius",void 0),h.c([Object(F.o)("target")],t.prototype,"_target",void 0),h.c([Object(F.o)("upVector")],t.prototype,"_upVector",void 0),h.c([Object(F.c)()],t.prototype,"inertialAlphaOffset",void 0),h.c([Object(F.c)()],t.prototype,"inertialBetaOffset",void 0),h.c([Object(F.c)()],t.prototype,"inertialRadiusOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerAlphaLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperAlphaLimit",void 0),h.c([Object(F.c)()],t.prototype,"lowerBetaLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperBetaLimit",void 0),h.c([Object(F.c)()],t.prototype,"lowerRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"inertialPanningX",void 0),h.c([Object(F.c)()],t.prototype,"inertialPanningY",void 0),h.c([Object(F.c)()],t.prototype,"pinchToPanMaxDistance",void 0),h.c([Object(F.c)()],t.prototype,"panningDistanceLimit",void 0),h.c([Object(F.o)()],t.prototype,"panningOriginTarget",void 0),h.c([Object(F.c)()],t.prototype,"panningInertia",void 0),h.c([Object(F.c)()],t.prototype,"zoomOnFactor",void 0),h.c([Object(F.c)()],t.prototype,"targetScreenOffset",void 0),h.c([Object(F.c)()],t.prototype,"allowUpsideDown",void 0),h.c([Object(F.c)()],t.prototype,"useInputToRestoreState",void 0),t}(It);B.a.AddNodeConstructor("DeviceOrientationCamera",function(e,t){return function(){return new Ft(e,a.e.Zero(),t)}});var Ft=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r._tmpDragQuaternion=new a.b,r._disablePointerInputWhenUsingDeviceOrientation=!0,r._dragFactor=0,r._quaternionCache=new a.b,r.inputs.addDeviceOrientation(),r.inputs._deviceOrientationInput&&r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function(){r._disablePointerInputWhenUsingDeviceOrientation&&r.inputs._mouseInput&&(r.inputs._mouseInput._allowCameraRotation=!1,r.inputs._mouseInput.onPointerMovedObservable.add(function(e){0!=r._dragFactor&&(r._initialQuaternion||(r._initialQuaternion=new a.b),a.b.FromEulerAnglesToRef(0,e.offsetX*r._dragFactor,0,r._tmpDragQuaternion),r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion,r._initialQuaternion))}))}),r}return h.d(t,e),Object.defineProperty(t.prototype,"disablePointerInputWhenUsingDeviceOrientation",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!0,configurable:!0}),t.prototype.enableHorizontalDragging=function(e){void 0===e&&(e=1/300),this._dragFactor=e},t.prototype.getClassName=function(){return"DeviceOrientationCamera"},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},t.prototype.resetToCurrentRotation=function(e){var t=this;void 0===e&&(e=Z.a.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new a.b),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach(function(i){e[i]?t._initialQuaternion[i]*=-1:t._initialQuaternion[i]=0}),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},t}(Dt),Nt=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new mt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this.add(new gt(e)),this},t}(rt),Bt=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.ellipsoid=new a.e(1,1,1),o.ellipsoidOffset=new a.e(0,0,0),o.checkCollisions=!1,o.applyGravity=!1,o.cameraDirection=a.e.Zero(),o._trackRoll=0,o.rollCorrect=100,o.bankedTurn=!1,o.bankedTurnLimit=Math.PI/2,o.bankedTurnMultiplier=1,o._needMoveForGravity=!1,o._oldPosition=a.e.Zero(),o._diffPosition=a.e.Zero(),o._newPosition=a.e.Zero(),o._collisionMask=-1,o._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null);var n;n=t,o._newPosition.copyFrom(n),o._newPosition.subtractToRef(o._oldPosition,o._diffPosition),o._diffPosition.length()>Ce.b.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new Nt(o),o.inputs.addKeyboard().addMouse(),o}return h.d(t,e),Object.defineProperty(t.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(t.prototype,"keysForward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysForward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysForward=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keysBackward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysBackward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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}),t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new a.e(0,0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?a.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=a.e.Zero(),this._transformedDirection=a.e.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.restoreRoll=function(e){var t=this._trackRoll,i=t-this.rotation.z;Math.abs(i)>=.001&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FlyCamera"},h.c([Object(F.o)()],t.prototype,"ellipsoid",void 0),h.c([Object(F.o)()],t.prototype,"ellipsoidOffset",void 0),h.c([Object(F.c)()],t.prototype,"checkCollisions",void 0),h.c([Object(F.c)()],t.prototype,"applyGravity",void 0),t}(It),Ut=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new vt),this},t.prototype.addMouseWheel=function(){return this.add(new yt),this},t.prototype.addPointers=function(){return this.add(new bt),this},t.prototype.addVRDeviceOrientation=function(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this},t}(rt);B.a.AddNodeConstructor("FollowCamera",function(e,t){return function(){return new kt(e,a.e.Zero(),t)}}),B.a.AddNodeConstructor("ArcFollowCamera",function(e,t){return function(){return new Gt(e,0,0,1,null,t)}});var Vt,kt=function(e){function t(t,i,n,r){void 0===r&&(r=null);var o=e.call(this,t,i,n)||this;return o.radius=12,o.lowerRadiusLimit=null,o.upperRadiusLimit=null,o.rotationOffset=0,o.lowerRotationOffsetLimit=null,o.upperRotationOffsetLimit=null,o.heightOffset=4,o.lowerHeightOffsetLimit=null,o.upperHeightOffsetLimit=null,o.cameraAcceleration=.05,o.maxCameraSpeed=20,o.lockedTarget=r,o.inputs=new Ut(o),o.inputs.addKeyboard().addMouseWheel().addPointers(),o}return h.d(t,e),t.prototype._follow=function(e){if(e){var t;if(e.rotationQuaternion){var i=new a.a;e.rotationQuaternion.toRotationMatrix(i),t=Math.atan2(i.m[8],i.m[10])}else t=e.rotation.y;var n=Ie.b.ToRadians(this.rotationOffset)+t,r=e.getAbsolutePosition(),o=r.x+Math.sin(n)*this.radius,s=r.z+Math.cos(n)*this.radius,c=o-this.position.x,l=r.y+this.heightOffset-this.position.y,u=s-this.position.z,h=c*this.cameraAcceleration*2,d=l*this.cameraAcceleration,f=u*this.cameraAcceleration*2;(h>this.maxCameraSpeed||h<-this.maxCameraSpeed)&&(h=h<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),(f>this.maxCameraSpeed||f<-this.maxCameraSpeed)&&(f=f<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new a.e(this.position.x+h,this.position.y+d,this.position.z+f),this.setTarget(r)}},t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t),this._reset=function(){}},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},t.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),e.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},t.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffsetthis.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffsetthis.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},t.prototype.getClassName=function(){return"FollowCamera"},h.c([Object(F.c)()],t.prototype,"radius",void 0),h.c([Object(F.c)()],t.prototype,"lowerRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"rotationOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerRotationOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRotationOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"heightOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerHeightOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperHeightOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"cameraAcceleration",void 0),h.c([Object(F.c)()],t.prototype,"maxCameraSpeed",void 0),h.c([Object(F.k)("lockedTargetId")],t.prototype,"lockedTarget",void 0),t}(It),Gt=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,a.e.Zero(),s)||this;return c.alpha=i,c.beta=n,c.radius=r,c.target=o,c._cartesianCoordinates=a.e.Zero(),c._follow(),c}return h.d(t,e),t.prototype._follow=function(){if(this.target){this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);var e=this.target.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._follow()},t.prototype.getClassName=function(){return"ArcFollowCamera"},t}(It),zt=i(37),jt=i(38);!function(e){e[e.VIVE=0]="VIVE",e[e.OCULUS=1]="OCULUS",e[e.WINDOWS=2]="WINDOWS",e[e.GEAR_VR=3]="GEAR_VR",e[e.DAYDREAM=4]="DAYDREAM",e[e.GENERIC=5]="GENERIC"}(Vt||(Vt={}));var Wt,Ht,Xt=function(){function e(){}return e.InitiateController=function(e){for(var t=0,i=this._ControllerFactories;tthis._maxRotationDistFromHeadset){var n=i-(i<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset);this._draggedRoomRotation+=n;var r=Math.sin(-n),o=Math.cos(-n);this._calculatedPosition.x=this._calculatedPosition.x*o-this._calculatedPosition.z*r,this._calculatedPosition.z=this._calculatedPosition.x*r+this._calculatedPosition.z*o}}a.e.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),a.b.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion))}},t.prototype.updateFromDevice=function(e){if(!this.isXR&&e){this.rawPose=e,e.position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position));var t=this.rawPose;e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation))}},t.prototype.attachToMesh=function(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new a.b),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;t.reverse().forEach(function(e){e.computeWorldMatrix(!0)})}this._meshAttachedObservable.notifyObservers(e)},t.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},t.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),t.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new jt.a(a.e.Zero(),new a.e(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new a.e(0,0,-1),r=a.e.TransformNormal(n,t),o=a.e.Normalize(r);return new jt.a(i,o,e)},t.POINTING_POSE="POINTING_POSE",t}(at);!function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.Start=4]="Start",e[e.Back=5]="Back",e[e.LB=6]="LB",e[e.RB=7]="RB",e[e.LeftStick=8]="LeftStick",e[e.RightStick=9]="RightStick"}(Wt||(Wt={})),function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(Ht||(Ht={}));var Kt,Qt,qt=function(e){function t(t,i,n,r){void 0===r&&(r=!1);var a=e.call(this,t,i,n,0,1,2,3)||this;return a._leftTrigger=0,a._rightTrigger=0,a.onButtonDownObservable=new o.c,a.onButtonUpObservable=new o.c,a.onPadDownObservable=new o.c,a.onPadUpObservable=new o.c,a._buttonA=0,a._buttonB=0,a._buttonX=0,a._buttonY=0,a._buttonBack=0,a._buttonStart=0,a._buttonLB=0,a._buttonRB=0,a._buttonLeftStick=0,a._buttonRightStick=0,a._dPadUp=0,a._dPadDown=0,a._dPadLeft=0,a._dPadRight=0,a._isXboxOnePad=!1,a.type=at.XBOX,a._isXboxOnePad=r,a}return h.d(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!0,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,Wt.A)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,Wt.B)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,Wt.X)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,Wt.Y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,Wt.Start)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,Wt.Back)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLB",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,Wt.LB)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRB",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,Wt.RB)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Wt.LeftStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Wt.RightStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Ht.Up)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Ht.Down)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Ht.Left)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Ht.Right)},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(at);!function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.Options=4]="Options",e[e.Share=5]="Share",e[e.L1=6]="L1",e[e.R1=7]="R1",e[e.LeftStick=8]="LeftStick",e[e.RightStick=9]="RightStick"}(Kt||(Kt={})),function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(Qt||(Qt={}));var Zt=function(e){function t(t,i,n){var r=e.call(this,t.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),i,n,0,1,2,3)||this;return r._leftTrigger=0,r._rightTrigger=0,r.onButtonDownObservable=new o.c,r.onButtonUpObservable=new o.c,r.onPadDownObservable=new o.c,r.onPadUpObservable=new o.c,r._buttonCross=0,r._buttonCircle=0,r._buttonSquare=0,r._buttonTriangle=0,r._buttonShare=0,r._buttonOptions=0,r._buttonL1=0,r._buttonR1=0,r._buttonLeftStick=0,r._buttonRightStick=0,r._dPadUp=0,r._dPadDown=0,r._dPadLeft=0,r._dPadRight=0,r.type=at.DUALSHOCK,r}return h.d(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!0,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,"buttonCross",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,Kt.Cross)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonCircle",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,Kt.Circle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonSquare",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,Kt.Square)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonTriangle",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,Kt.Triangle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonOptions",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,Kt.Options)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonShare",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,Kt.Share)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonL1",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,Kt.L1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonR1",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,Kt.R1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Kt.LeftStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Kt.RightStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Qt.Up)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Qt.Down)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Qt.Left)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Qt.Right)},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(at),Jt=function(){function e(e){var t=this;if(this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new o.c,zt.a.IsWindowObjectExist()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator.getGamepads||navigator.webkitGetGamepads||navigator.msGetGamepads||navigator.webkitGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new o.c(function(e){for(var i in t._babylonGamepads){var n=t._babylonGamepads[i];n&&n._isConnected&&t.onGamepadConnectedObservable.notifyObserver(e,n)}}),this._onGamepadConnectedEvent=function(e){var i,n=e.gamepad;n.index in t._babylonGamepads&&t._babylonGamepads[n.index].isConnected||(t._babylonGamepads[n.index]?((i=t._babylonGamepads[n.index]).browserGamepad=n,i._isConnected=!0):i=t._addNewGamepad(n),t.onGamepadConnectedObservable.notifyObservers(i),t._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var i=e.gamepad;for(var n in t._babylonGamepads)if(t._babylonGamepads[n].index===i.index){var r=t._babylonGamepads[n];r._isConnected=!1,t.onGamepadDisconnectedObservable.notifyObservers(r);break}},this._gamepadSupport)if(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported){var i=this._scene?this._scene.getEngine().getHostWindow():window;i.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),i.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)}else this._startMonitoringGamepads()}return Object.defineProperty(e.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!0,configurable:!0}),e.prototype.getGamepadByType=function(e){void 0===e&&(e=at.XBOX);for(var t=0,i=this._babylonGamepads;t0){for(var p=0;p0)for(var e=0;e0){var n=this._camera._getFirstPostProcess();n&&n.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e}(),ai="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";ni.a.ShadersStore.passPixelShader=ai;var si="\nvarying vec2 vUV;\nuniform samplerCube textureSampler;\nvoid main(void)\n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}";ni.a.ShadersStore.passCubePixelShader=si;var ci=function(e){function t(t,i,n,r,o,a,s,c){return void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1),e.call(this,t,"pass",null,null,i,n,r,o,a,void 0,s,void 0,null,c)||this}return h.d(t,e),t}(oi),li=function(e){function t(t,i,n,r,o,a,s,c){void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"passCube",null,null,i,n,r,o,a,"#define POSITIVEX",s,void 0,null,c)||this;return l._face=0,l}return h.d(t,e),Object.defineProperty(t.prototype,"face",{get:function(){return this._face},set:function(e){if(!(e<0||e>5))switch(this._face=e,this._face){case 0:this.updateEffect("#define POSITIVEX");break;case 1:this.updateEffect("#define NEGATIVEX");break;case 2:this.updateEffect("#define POSITIVEY");break;case 3:this.updateEffect("#define NEGATIVEY");break;case 4:this.updateEffect("#define POSITIVEZ");break;case 5:this.updateEffect("#define NEGATIVEZ")}},enumerable:!0,configurable:!0}),t}(oi);Ce.b._RescalePostProcessFactory=function(e){return new ci("rescale",1,null,Ce.b.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,Ce.b.TEXTURETYPE_UNSIGNED_INT)};var ui="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}";ni.a.ShadersStore.anaglyphPixelShader=ui;var hi=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,"anaglyph",null,["leftSampler"],i,n[1],r,o,a)||this;return s._passedProcess=n[0]._rigPostProcess,s.onApplyObservable.add(function(e){e.setTextureFromPostProcess("leftSampler",s._passedProcess)}),s}return h.d(t,e),t}(oi);Ke.a._setStereoscopicAnaglyphRigMode=function(e){e._rigCameras[0]._rigPostProcess=new ci(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new hi(e.name+"_anaglyph",1,e._rigCameras)},B.a.AddNodeConstructor("AnaglyphArcRotateCamera",function(e,t,i){return function(){return new di(e,0,0,1,a.e.Zero(),i.interaxial_distance,t)}});var di=function(e){function t(t,i,n,r,o,a,s){var c=e.call(this,t,i,n,r,o,s)||this;return c.interaxialDistance=a,c.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:a}),c}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},t}(wt);B.a.AddNodeConstructor("AnaglyphFreeCamera",function(e,t,i){return function(){return new fi(e,a.e.Zero(),i.interaxial_distance,t)}});var fi=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphFreeCamera"},t}(Dt);B.a.AddNodeConstructor("AnaglyphGamepadCamera",function(e,t,i){return function(){return new pi(e,a.e.Zero(),i.interaxial_distance,t)}});var pi=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},t}(ti);B.a.AddNodeConstructor("AnaglyphUniversalCamera",function(e,t,i){return function(){return new _i(e,a.e.Zero(),i.interaxial_distance,t)}});var _i=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},t}(ei),mi="const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}";ni.a.ShadersStore.stereoscopicInterlacePixelShader=mi;var gi=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,"stereoscopicInterlace",["stepSize"],["camASampler"],1,i[1],r,o,s,n?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return c._passedProcess=i[0]._rigPostProcess,c._stepSize=new a.d(1/c.width,1/c.height),c.onSizeChangedObservable.add(function(){c._stepSize=new a.d(1/c.width,1/c.height)}),c.onApplyObservable.add(function(e){e.setTextureFromPostProcess("camASampler",c._passedProcess),e.setFloat2("stepSize",c._stepSize.x,c._stepSize.y)}),c}return h.d(t,e),t}(oi);Ke.a._setStereoscopicRigMode=function(e){var t=e.cameraRigMode===Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e._rigCameras[0]._rigPostProcess=new ci(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new gi(e.name+"_stereoInterlace",e._rigCameras,t)},B.a.AddNodeConstructor("StereoscopicArcRotateCamera",function(e,t,i){return function(){return new vi(e,0,0,1,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var vi=function(e){function t(t,i,n,r,o,a,s,c){var l=e.call(this,t,i,n,r,o,c)||this;return l.interaxialDistance=a,l.isStereoscopicSideBySide=s,l.setCameraRigMode(s?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:a}),l}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},t}(wt);B.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new yi(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var yi=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicFreeCamera"},t}(Dt);B.a.AddNodeConstructor("StereoscopicGamepadCamera",function(e,t,i){return function(){return new bi(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var bi=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},t}(ti);B.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new Ti(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var Ti=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},t}(ei);B.a.AddNodeConstructor("VirtualJoysticksCamera",function(e,t){return function(){return new Ei(e,a.e.Zero(),t)}});var Ei=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addVirtualJoystick(),r}return h.d(t,e),t.prototype.getClassName=function(){return"VirtualJoysticksCamera"},t}(Dt),Ai=function(){function e(){this.compensateDistortion=!0,this.multiviewEnabled=!1}return Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return this.hResolution/(2*this.vResolution)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatioFov",{get:function(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return a.a.Translation(e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return a.a.Translation(-e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftPreViewMatrix",{get:function(){return a.a.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightPreViewMatrix",{get:function(){return a.a.Translation(-.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),e.GetDefault=function(){var t=new e;return t.hResolution=1280,t.vResolution=800,t.hScreenSize=.149759993,t.vScreenSize=.0935999975,t.vScreenCenter=.0467999987,t.eyeToScreenDistance=.0410000011,t.lensSeparationDistance=.063500002,t.interpupillaryDistance=.064000003,t.distortionK=[1,.219999999,.239999995,0],t.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],t.postProcessScaleFactor=1.714605507808412,t.lensCenterOffset=.151976421,t},e}(),Pi="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn;\nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}";ni.a.ShadersStore.vrDistortionCorrectionPixelShader=Pi;var Si=function(e){function t(t,i,n,r){var o=e.call(this,t,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,r.postProcessScaleFactor,i,$e.a.BILINEAR_SAMPLINGMODE)||this;return o._isRightEye=n,o._distortionFactors=r.distortionK,o._postProcessScaleFactor=r.postProcessScaleFactor,o._lensCenterOffset=r.lensCenterOffset,o.adaptScaleToCurrentViewport=!0,o.onSizeChangedObservable.add(function(){o._scaleIn=new a.d(2,2/o.aspectRatio),o._scaleFactor=new a.d(1/o._postProcessScaleFactor*.5,1/o._postProcessScaleFactor*.5*o.aspectRatio),o._lensCenter=new a.d(o._isRightEye?.5-.5*o._lensCenterOffset:.5+.5*o._lensCenterOffset,.5)}),o.onApplyObservable.add(function(e){e.setFloat2("LensCenter",o._lensCenter.x,o._lensCenter.y),e.setFloat2("Scale",o._scaleFactor.x,o._scaleFactor.y),e.setFloat2("ScaleIn",o._scaleIn.x,o._scaleIn.y),e.setFloat4("HmdWarpParam",o._distortionFactors[0],o._distortionFactors[1],o._distortionFactors[2],o._distortionFactors[3])}),o}return h.d(t,e),t}(oi),Ri="precision mediump sampler2DArray;\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}";ni.a.ShadersStore.vrMultiviewToSingleviewPixelShader=Ri;var xi=i(76),Ci=i(95),Mi=i(104);Ce.b.prototype.createRenderTargetCubeTexture=function(e,t){var i=h.a({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:Ce.b.TEXTURETYPE_UNSIGNED_INT,samplingMode:Ce.b.TEXTURE_TRILINEAR_SAMPLINGMODE,format:Ce.b.TEXTUREFORMAT_RGBA},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type!==Ce.b.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==Ce.b.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=Ce.b.TEXTURE_NEAREST_SAMPLINGMODE);var n=this._gl,r=new et.a(this,et.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,r,!0);var o=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type!==Ce.b.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,m.a.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,o.mag),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,o.min),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);for(var a=0;a<6;a++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var s=n.createFramebuffer();return this._bindUnboundFramebuffer(s),r._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&n.generateMipmap(n.TEXTURE_CUBE_MAP),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null),n.bindRenderbuffer(n.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),r._framebuffer=s,r.width=e,r.height=e,r.isReady=!0,r.isCube=!0,r.samples=1,r.generateMipMaps=i.generateMipMaps,r.samplingMode=i.samplingMode,r.type=i.type,r.format=i.format,r._generateDepthBuffer=i.generateDepthBuffer,r._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(r),r};var Oi=function(e){function t(t,i,n,r,s,c,l,u,h,d,f,p,_){void 0===s&&(s=!0),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=!1),void 0===u&&(u=$e.a.TRILINEAR_SAMPLINGMODE),void 0===h&&(h=!0),void 0===d&&(d=!1),void 0===f&&(f=!1),void 0===p&&(p=g.a.TEXTUREFORMAT_RGBA),void 0===_&&(_=!1);var m=e.call(this,null,n,!r)||this;return m.isCube=l,m.renderParticles=!0,m.renderSprites=!1,m.coordinatesMode=$e.a.PROJECTION_MODE,m.ignoreCameraViewport=!1,m.onBeforeBindObservable=new o.c,m.onAfterUnbindObservable=new o.c,m.onBeforeRenderObservable=new o.c,m.onAfterRenderObservable=new o.c,m.onClearObservable=new o.c,m.onResizeObservable=new o.c,m._currentRefreshId=-1,m._refreshRate=1,m._samples=1,m.boundingBoxPosition=a.e.Zero(),(n=m.getScene())?(m.renderList=new Array,m._engine=n.getEngine(),m.name=t,m.isRenderTarget=!0,m._initialSizeParameter=i,m._processSizeParameter(i),m._resizeObserver=m.getScene().getEngine().onResizeObservable.add(function(){}),m._generateMipMaps=!!r,m._doNotChangeAspectRatio=s,m._renderingManager=new Mi.b(n),m._renderingManager._useSceneAutoClearSetup=!0,f?m:(m._renderTargetOptions={generateMipMaps:r,type:c,format:p,samplingMode:u,generateDepthBuffer:h,generateStencilBuffer:d},u===$e.a.NEAREST_SAMPLINGMODE&&(m.wrapU=$e.a.CLAMP_ADDRESSMODE,m.wrapV=$e.a.CLAMP_ADDRESSMODE),_||(l?(m._texture=n.getEngine().createRenderTargetCubeTexture(m.getRenderSize(),m._renderTargetOptions),m.coordinatesMode=$e.a.INVCUBIC_MODE,m._textureMatrix=a.a.Identity()):m._texture=n.getEngine().createRenderTargetTexture(m._size,m._renderTargetOptions)),m)):m}return h.d(t,e),Object.defineProperty(t.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!0,configurable:!0}),t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r0&&(this._postProcesses[0].autoClear=!1))}},t.prototype._shouldRender=function(){return-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.scale=function(e){var t=this.getRenderSize()*e;this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t=this.isCube;this.releaseInternalTexture();var i=this.getScene();i&&(this._processSizeParameter(e),this._texture=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),s=this.getScene()){var i,n=s.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var r=0;r=0&&this._renderingManager.dispatchParticles(v))}if(this.isCube)for(var b=0;b<6;b++)this.renderToTarget(b,u,e,t),s.incrementRenderId(),s.resetCachedMaterial();else this.renderToTarget(0,u,e,t);this.onAfterUnbindObservable.notifyObservers(this),s.activeCamera&&((s.getEngine().scenes.length>1||this.activeCamera&&this.activeCamera!==s.activeCamera)&&s.setTransformMatrix(s.activeCamera.getViewMatrix(),s.activeCamera.getProjectionMatrix(!0)),n.setViewport(s.activeCamera.viewport)),s.resetCachedMaterial()}},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=Ce.b.NearestPOT(i+16384/(128+i));return Math.min(Ce.b.FloorPOT(e),n)},t.prototype._bindFrameBuffer=function(e){void 0===e&&(e=0);var t=this.getScene();if(t){var i=t.getEngine();this._texture&&i.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,this.depthStencilTexture?this.depthStencilTexture:void 0)}},t.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,function(){i.onAfterRenderObservable.notifyObservers(t)})},t.prototype.renderToTarget=function(e,t,i,n){var r=this.getScene();if(r){var o=r.getEngine();if(this._texture){this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):i&&r.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(e),this.onBeforeRenderObservable.notifyObservers(e),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(o):o.clear(this.clearColor||r.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||r.updateTransformMatrix(!0);for(var a=0,s=r._beforeRenderTargetDrawStage;a=0&&t.customRenderTargets.splice(i,1);for(var n=0,r=t.cameras;n=0&&o.customRenderTargets.splice(i,1)}this.depthStencilTexture&&this.getScene().getEngine()._releaseTexture(this.depthStencilTexture),e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this.refreshRate===t.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=t.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=0,t.REFRESHRATE_RENDER_ONEVERYFRAME=1,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,t}($e.a);$e.a._CreateRenderTargetTexture=function(e,t,i,n){return new Oi(e,t,i,n)};var Ii=function(e){function t(t,i){void 0===i&&(i=512);var n=e.call(this,"multiview rtt",i,t,!1,!0,et.a.DATASOURCE_UNKNOWN,!1,void 0,!1,!1,!0,void 0,!0)||this,r=t.getEngine().createMultiviewRenderTargetTexture(n.getRenderWidth(),n.getRenderHeight());return r.isMultiview=!0,n._texture=r,n}return h.d(t,e),t.prototype._bindFrameBuffer=function(e){void 0===e&&(e=0),this._texture&&this.getScene().getEngine().bindMultiviewFramebuffer(this._texture)},t.prototype.getViewCount=function(){return 2},t}(Oi),Di=i(79);Ce.b.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";var n=new et.a(this,et.a.DATASOURCE_UNKNOWN,!0);return n.width=e,n.height=t,n._framebuffer=i.createFramebuffer(),n._colorTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._colorTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.RGBA8,e,t,2),n._depthStencilTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._depthStencilTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.DEPTH32F_STENCIL8,e,t,2),n.isReady=!0,n},Ce.b.prototype.bindMultiviewFramebuffer=function(e){var t=this._gl,i=this.getCaps().multiview;if(this.bindFramebuffer(e,void 0,void 0,void 0,!0),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer),!e._colorTextureArray||!e._depthStencilTextureArray)throw"Invalid multiview frame buffer";i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,e._colorTextureArray,0,0,2),i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,e._depthStencilTextureArray,0,0,2)},Ke.a.prototype._useMultiviewToSingleView=!1,Ke.a.prototype._multiviewTexture=null,Ke.a.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new Ii(this.getScene(),{width:e,height:t})):this._multiviewTexture=new Ii(this.getScene(),{width:e,height:t})},K.a.prototype._transformMatrixR=a.a.Zero(),K.a.prototype._multiviewSceneUbo=null,K.a.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=new xi.a(this.getEngine(),void 0,!0),this._multiviewSceneUbo.addUniform("viewProjection",16),this._multiviewSceneUbo.addUniform("viewProjectionR",16),this._multiviewSceneUbo.addUniform("view",16)},K.a.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,a.c.Matrix[0]),Di.a.GetRightPlaneToRef(a.c.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix("viewProjection",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix("viewProjectionR",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix("view",this._viewMatrix),this._multiviewSceneUbo.update())},K.a.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.width>0?e._rigPostProcess.width/2:this.getEngine().getRenderWidth(!0)/2,e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.height>0?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(var t=0;t=2&&e.onControllersAttachedObservable.notifyObservers(e.controllers)}}})},t}(Dt),ki=function(e){function t(t){var i=e.call(this,t)||this;return i.onTriggerStateChangedObservable=new o.c,i.onMainButtonStateChangedObservable=new o.c,i.onSecondaryButtonStateChangedObservable=new o.c,i.onPadStateChangedObservable=new o.c,i.onPadValuesChangedObservable=new o.c,i.pad={x:0,y:0},i._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},i._buttons=new Array(t.buttons.length),i.hand=t.hand,i}return h.d(t,e),t.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(t.prototype,"defaultModel",{get:function(){return this._defaultModel},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t\n#include\n#include\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\n\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}");ni.a.ShadersStore.imageProcessingPixelShader=Wi;var Hi=function(e){function t(t,i,n,r,o,a,s,c){void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT);var l=e.call(this,t,"imageProcessing",[],[],i,n,r,o,a,null,s,"postprocess",null,!0)||this;return l._fromLinearSpace=!0,l._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1},c?(c.applyByPostProcess=!0,l._attachImageProcessingConfiguration(c,!0),l.fromLinearSpace=!1):(l._attachImageProcessingConfiguration(null,!0),l.imageProcessingConfiguration.applyByPostProcess=!0),l.onApply=function(e){l.imageProcessingConfiguration.bind(e,l.aspectRatio)},l}return h.d(t,e),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e,t){var i=this;if(void 0===t&&(t=!1),e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{var n=null,r=this.getEngine(),o=this.getCamera();if(o)n=o.getScene();else if(r&&r.scenes){var a=r.scenes;n=a[a.length-1]}else n=C.a.LastCreatedScene;this._imageProcessingConfiguration=n.imageProcessingConfiguration}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){i._updateParameters()})),t||this._updateParameters()}},Object.defineProperty(t.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingType",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCentreX},set:function(e){this.imageProcessingConfiguration.vignetteCentreX=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCentreY},set:function(e){this.imageProcessingConfiguration.vignetteCentreY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"ImageProcessingPostProcess"},t.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e="";for(var t in this._defines)this._defines[t]&&(e+="#define "+t+";\r\n");var i=["textureSampler"],n=["scale"];Gi.a&&(Gi.a.PrepareSamplers(i,this._defines),Gi.a.PrepareUniforms(n,this._defines)),this.updateEffect(e,n,i)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},h.c([Object(F.c)()],t.prototype,"_fromLinearSpace",void 0),t}(oi),Xi=i(14),Yi=i(4);Se.a._GroundMeshParser=function(e,t){return Ki.Parse(e,t)};var Ki=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.generateOctree=!1,n}return h.d(t,e),t.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(t.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!0,configurable:!0}),t.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e);this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)},t.prototype.getHeightAtCoordinates=function(e,t){var i=this.getWorldMatrix(),n=a.c.Matrix[5];i.invertToRef(n);var r=a.c.Vector3[8];if(a.e.TransformCoordinatesFromFloatsToRef(e,0,t,n,r),e=r.x,t=r.z,ethis._maxX||tthis._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),s=-(o.x*e+o.z*t+o.w)/o.y;return a.e.TransformCoordinatesFromFloatsToRef(0,s,0,i,r),r.y},t.prototype.getNormalAtCoordinates=function(e,t){var i=new a.e(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},t.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=a.c.Matrix[5];n.invertToRef(r);var o=a.c.Vector3[8];if(a.e.TransformCoordinatesFromFloatsToRef(e,0,t,r,o),e=o.x,t=o.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var s=this._getFacetAt(e,t);return a.e.TransformNormalFromFloatsToRef(s.x,s.y,s.z,n,i),this},t.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},t.prototype._getFacetAt=function(e,t){var i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),n=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),r=this._heightQuads[n*this._subdivisionsX+i];return te.maxHeight){h=!0;var d=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=d}for(t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var f=new a.e(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),p=4*(((f.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(f.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),_=e.buffer[p]/255,m=e.buffer[p+1]/255,g=e.buffer[p+2]/255,v=e.buffer[p+3]/255;h&&(_=1-_,m=1-m,g=1-g);var y=_*l.r+m*l.g+g*l.b;f.y=v>=u?e.minHeight+(e.maxHeight-e.minHeight)*y:e.minHeight-re.a,r.push(f.x,f.y,f.z),o.push(0,0,0),c.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t=e.minHeight,S=r[3*T+1]>=e.minHeight,R=r[3*E+1]>=e.minHeight;P&&S&&R&&(n.push(b),n.push(T),n.push(E)),r[3*A+1]>=e.minHeight&&P&&R&&(n.push(A),n.push(b),n.push(E))}Xi.a.ComputeNormals(r,n,o);var x=new Xi.a;return x.indices=n,x.positions=r,x.normals=o,x.uvs=c,x},Se.a.CreateGround=function(e,t,i,n,r,o){var a={width:t,height:i,subdivisions:n,updatable:o};return Qi.CreateGround(e,a,r)},Se.a.CreateTiledGround=function(e,t,i,n,r,o,a,s,c){var l={xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:a,updatable:c};return Qi.CreateTiledGround(e,l,s)},Se.a.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,c,l,u){var h={width:i,height:n,subdivisions:r,minHeight:o,maxHeight:a,updatable:c,onReady:l,alphaFilter:u};return Qi.CreateGroundFromHeightMap(e,t,h,s)};var Qi=function(){function e(){}return e.CreateGround=function(e,t,i){var n=new Ki(e,i);return n._setReady(!1),n._subdivisionsX=t.subdivisionsX||t.subdivisions||1,n._subdivisionsY=t.subdivisionsY||t.subdivisions||1,n._width=t.width||1,n._height=t.height||1,n._maxX=n._width/2,n._maxZ=n._height/2,n._minX=-n._maxX,n._minZ=-n._maxZ,Xi.a.CreateGround(t).applyToMesh(n,t.updatable),n._setReady(!0),n},e.CreateTiledGround=function(e,t,i){void 0===i&&(i=null);var n=new Se.a(e,i);return Xi.a.CreateTiledGround(t).applyToMesh(n,t.updatable),n},e.CreateGroundFromHeightMap=function(e,t,i,n){void 0===n&&(n=null);var r=i.width||10,o=i.height||10,a=i.subdivisions||1,c=i.minHeight||0,l=i.maxHeight||1,u=i.colorFilter||new s.a(.3,.59,.11),h=i.alphaFilter||0,d=i.updatable,f=i.onReady;n=n||C.a.LastCreatedScene;var p=new Ki(e,n);p._subdivisionsX=a,p._subdivisionsY=a,p._width=r,p._height=o,p._maxX=p._width/2,p._maxZ=p._height/2,p._minX=-p._maxX,p._minZ=-p._maxZ,p._setReady(!1);return Ie.b.LoadImage(t,function(e){var t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");if(!n.isDisposed){var s=e.width,_=e.height;t.width=s,t.height=_,i.drawImage(e,0,0);var m=i.getImageData(0,0,s,_).data;Xi.a.CreateGroundFromHeightMap({width:r,height:o,subdivisions:a,minHeight:c,maxHeight:l,colorFilter:u,buffer:m,bufferWidth:s,bufferHeight:_,alphaFilter:h}).applyToMesh(p,d),f&&f(p),p._setReady(!0)}},function(){},n.offlineProvider),p},e}();Xi.a.CreateTorus=function(e){for(var t=[],i=[],n=[],r=[],o=e.diameter||1,s=e.thickness||.5,c=e.tessellation||16,l=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,u=c+1,h=0;h<=c;h++)for(var d=h/c,f=h*Math.PI*2/c-Math.PI/2,p=a.a.Translation(o/2,0,0).multiply(a.a.RotationY(f)),_=0;_<=c;_++){var m=1-_/c,g=_*Math.PI*2/c+Math.PI,v=Math.cos(g),y=Math.sin(g),b=new a.e(v,y,0),T=b.scale(s/2),E=new a.d(d,m);T=a.e.TransformCoordinates(T,p),b=a.e.TransformNormal(b,p),i.push(T.x,T.y,T.z),n.push(b.x,b.y,b.z),r.push(E.x,E.y);var A=(h+1)%u,P=(_+1)%u;t.push(h*u+_),t.push(h*u+P),t.push(A*u+_),t.push(h*u+P),t.push(A*u+P),t.push(A*u+_)}Xi.a._ComputeSides(l,i,t,n,r,e.frontUVs,e.backUVs);var S=new Xi.a;return S.indices=t,S.positions=i,S.normals=n,S.uvs=r,S},Se.a.CreateTorus=function(e,t,i,n,r,o,a){var s={diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o};return Zi.CreateTorus(e,s,r)};var qi,Zi=function(){function e(){}return e.CreateTorus=function(e,t,i){var n=new Se.a(e,i);return t.sideOrientation=Se.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,Xi.a.CreateTorus(t).applyToMesh(n,t.updatable),n},e}(),Ji=i(61),$i=function(){function e(t,i){if(void 0===i&&(i=null),this.scene=t,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=e._idCounter++,i)this._gazeTracker=i.clone("gazeTracker");else{this._gazeTracker=Se.a.CreateTorus("gazeTracker",.0035,.0025,20,t,!1),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var n=new zi.a("targetMat",t);n.specularColor=s.a.Black(),n.emissiveColor=new s.a(.7,.7,.7),n.backFaceCulling=!1,this._gazeTracker.material=n}}return e.prototype._getForwardRay=function(e){return new jt.a(a.e.Zero(),new a.e(0,0,e))},e.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},e.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},e.prototype._activatePointer=function(){this._activePointer=!0},e.prototype._deactivatePointer=function(){this._activePointer=!1},e.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},e.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},e._idCounter=0,e}(),en=function(e){function t(t,i,n){var r=e.call(this,i,n)||this;r.webVRController=t,r._laserPointer=Se.a.CreateCylinder("laserPointer",1,.004,2e-4,20,1,i,!1);var o=new zi.a("laserPointerMat",i);if(o.emissiveColor=new s.a(.7,.7,.7),o.alpha=.6,r._laserPointer.material=o,r._laserPointer.rotation.x=Math.PI/2,r._laserPointer.position.z=-.5,r._laserPointer.isVisible=!1,r._laserPointer.isPickable=!1,!t.mesh){var a=new Se.a("preloadControllerMesh",i),c=new Se.a(Yt.POINTING_POSE,i);c.rotation.x=-.7,a.addChild(c),t.attachToMesh(a)}return r._setLaserPointerParent(t.mesh),r._meshAttachedObserver=t._meshAttachedObservable.add(function(e){r._setLaserPointerParent(e)}),r}return h.d(t,e),t.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},t.prototype._activatePointer=function(){e.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},t.prototype._deactivatePointer=function(){e.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},t.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},t.prototype._setLaserPointerParent=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach(function(e){t(e)})};t(e);var i=e.getChildren(void 0,!1),n=e;this.webVRController._pointingPoseNode=null;for(var r=0;r=0){n=i[r],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n},t.prototype._updatePointerDistance=function(e){void 0===e&&(e=100),this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},t}($i),tn=function(e){function t(t,i){var n=e.call(this,i)||this;return n.getCamera=t,n}return h.d(t,e),t.prototype._getForwardRay=function(e){var t=this.getCamera();return t?t.getForwardRay(e):new jt.a(a.e.Zero(),a.e.Forward())},t}($i),nn=function(){},rn=function(){function e(e,t){var i=this;if(void 0===t&&(t={}),this.webVROptions=t,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new o.c,this.onAfterEnteringVRObservable=new o.c,this.onExitingVRObservable=new o.c,this.onControllerMeshLoadedObservable=new o.c,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._rotationAllowed=!0,this._teleportBackwardsVector=new a.e(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new a.e(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this.onNewMeshSelected=new o.c,this.onMeshSelectedWithController=new o.c,this.onNewMeshPicked=new o.c,this.onBeforeCameraTeleport=new o.c,this.onAfterCameraTeleport=new o.c,this.onSelectedMeshUnselected=new o.c,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.requestPointerLockOnFullScreen=!0,this._onResize=function(){i.moveButtonToBottomRight(),i._fullscreenVRpresenting&&i._webVRready&&i.exitVR()},this._onFullscreenChange=function(){var e=document;void 0!==e.fullscreen?i._fullscreenVRpresenting=document.fullscreen:void 0!==e.mozFullScreen?i._fullscreenVRpresenting=e.mozFullScreen:void 0!==e.webkitIsFullScreen?i._fullscreenVRpresenting=e.webkitIsFullScreen:void 0!==e.msIsFullScreen?i._fullscreenVRpresenting=e.msIsFullScreen:void 0!==document.msFullscreenElement&&(i._fullscreenVRpresenting=document.msFullscreenElement),!i._fullscreenVRpresenting&&i._canvas&&(i.exitVR(),!i._useCustomVRButton&&i._btnVR&&(i._btnVR.style.top=i._canvas.offsetTop+i._canvas.offsetHeight-70+"px",i._btnVR.style.left=i._canvas.offsetLeft+i._canvas.offsetWidth-100+"px"))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this.beforeRender=function(){i._leftController&&i._leftController._activePointer&&i._castRayAndSelectObject(i._leftController),i._rightController&&i._rightController._activePointer&&i._castRayAndSelectObject(i._rightController),i._noControllerIsActive&&(i._scene.getEngine().isPointerLock||i.enableGazeEvenWhenNoPointerLock)?i._castRayAndSelectObject(i._cameraGazer):i._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){if(e.type!==at.POSE_ENABLED)e.leftStick&&e.onleftstickchanged(function(e){i._teleportationInitialized&&i.teleportationEnabled&&(!i._leftController&&!i._rightController||i._leftController&&!i._leftController._activePointer&&i._rightController&&!i._rightController._activePointer)&&(i._checkTeleportWithRay(e,i._cameraGazer),i._checkTeleportBackwards(e,i._cameraGazer))}),e.rightStick&&e.onrightstickchanged(function(e){i._teleportationInitialized&&i._checkRotate(e,i._cameraGazer)}),e.type===at.XBOX&&(e.onbuttondown(function(e){i._interactionsEnabled&&e===Wt.A&&i._cameraGazer._selectionPointerDown()}),e.onbuttonup(function(e){i._interactionsEnabled&&e===Wt.A&&i._cameraGazer._selectionPointerUp()}));else{var t=e,n=new en(t,i._scene,i._cameraGazer._gazeTracker);"right"===t.hand||i._leftController&&i._leftController.webVRController!=t?i._rightController=n:i._leftController=n,i._tryEnableInteractionOnController(n)}},this._tryEnableInteractionOnController=function(e){i._interactionsRequested&&!e._interactionsEnabled&&i._enableInteractionOnController(e),i._teleportationRequested&&!e._teleportationEnabled&&i._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof ki&&("left"===e.hand&&null!=i._leftController&&(i._leftController.dispose(),i._leftController=null),"right"===e.hand&&null!=i._rightController&&(i._rightController.dispose(),i._rightController=null))},this._workingVector=a.e.Zero(),this._workingQuaternion=a.b.Identity(),this._workingMatrix=a.a.Identity(),this._scene=e,this._canvas=e.getEngine().getRenderingCanvas(),void 0===t.createFallbackVRDeviceOrientationFreeCamera&&(t.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===t.createDeviceOrientationCamera&&(t.createDeviceOrientationCamera=!0),void 0===t.laserToggle&&(t.laserToggle=!0),void 0===t.defaultHeight&&(t.defaultHeight=1.7),t.useCustomVRButton&&(this._useCustomVRButton=!0,t.customVRButton&&(this._btnVR=t.customVRButton)),t.rayLength&&(this._rayLength=t.rayLength),this._defaultHeight=t.defaultHeight,t.positionScale&&(this._rayLength*=t.positionScale,this._defaultHeight*=t.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new a.e(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new Ft("deviceOrientationVRHelper",this._position.clone(),e),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof It&&this._scene.activeCamera.rotation)){var n=this._scene.activeCamera;n.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(n.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(a.b.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z)),this._deviceOrientationCamera.rotation=n.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas)}else this._existingCamera=this._scene.activeCamera;if(t.createFallbackVRDeviceOrientationFreeCamera&&(t.useMultiview&&(t.vrDeviceOrientationCameraMetrics||(t.vrDeviceOrientationCameraMetrics=Ai.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new Ni("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new Vi("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new tn(function(){return i.currentVRCamera},e),!this._useCustomVRButton){this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR";".babylonVRicon.vrdisplaypresenting { display: none; }";var r=document.createElement("style");r.appendChild(document.createTextNode(".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }.babylonVRicon.vrdisplaypresenting { display: none; }")),document.getElementsByTagName("head")[0].appendChild(r),this.moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",function(){i.isInVRMode?i.exitVR():i.enterVR()});var s=this._scene.getEngine().getHostWindow();s.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",this._onFullscreenChange,!1),document.onmsfullscreenchange=this._onFullscreenChange,t.createFallbackVRDeviceOrientationFreeCamera?this.displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add(function(e){e.vrDisplay&&i.displayVRButton()}),this._onKeyDown=function(e){27===e.keyCode&&i.isInVRMode&&i.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add(function(){i.isInVRMode&&i.exitVROnDoubleTap&&(i.exitVR(),i._fullscreenVRpresenting&&i._scene.getEngine().exitFullscreen())},Ue.a.POINTERDOUBLETAP,!1),this._onVRDisplayChanged=function(e){return i.onVRDisplayChanged(e)},this._onVrDisplayPresentChange=function(){return i.onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){i._webVRrequesting=!0,i.updateButtonVisibility()},this._onVRRequestPresentComplete=function(){i._webVRrequesting=!1,i.updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),s.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),e.onDisposeObservable.add(function(){i.dispose()}),this._webVRCamera.onControllerMeshLoadedObservable.add(function(e){return i._onDefaultMeshLoaded(e)}),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this.updateButtonVisibility(),this._circleEase=new de,this._circleEase.setEasingMode(he.EASINGMODE_EASEINOUT),e.onPointerObservable.add(function(t){i._interactionsEnabled&&e.activeCamera===i.vrDeviceOrientationCamera&&"mouse"===t.event.pointerType&&(t.type===Ue.a.POINTERDOWN?i._cameraGazer._selectionPointerDown():t.type===Ue.a.POINTERUP&&i._cameraGazer._selectionPointerUp())}),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes})}return Object.defineProperty(e.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onControllerMeshLoaded",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gazeTrackerMesh",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftControllerGazeTrackerMesh",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightControllerGazeTrackerMesh",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){this._displayGaze=e,e||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){this._displayLaserPointer=e,e?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentVRCamera",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"webVRCamera",{get:function(){return this._webVRCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vrButton",{get:function(){return this._btnVR},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!0,configurable:!0}),e.prototype._onDefaultMeshLoaded=function(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){m.a.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}},Object.defineProperty(e.prototype,"isInVRMode",{get:function(){return this._webVRpresenting||this._fullscreenVRpresenting},enumerable:!0,configurable:!0}),e.prototype.onVrDisplayPresentChange=function(){var e=this._scene.getEngine().getVRDevice();if(e){var t=this._webVRpresenting;this._webVRpresenting=e.isPresenting,t&&!this._webVRpresenting&&this.exitVR()}else m.a.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");this.updateButtonVisibility()},e.prototype.onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this.updateButtonVisibility()},e.prototype.moveButtonToBottomRight=function(){if(this._canvas&&!this._useCustomVRButton&&this._btnVR){var e=this._canvas.getBoundingClientRect();this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px"}},e.prototype.displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},e.prototype.updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode?this._btnVR.className+=" vrdisplaypresenting":(this._webVRready&&(this._btnVR.className+=" vrdisplayready"),this._webVRsupported&&(this._btnVR.className+=" vrdisplaysupported"),this._webVRrequesting&&(this._btnVR.className+=" vrdisplayrequesting")))},e.prototype.enterVR=function(){var e=this;if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){m.a.Warn("Error in your custom logic onEnteringVR: "+e)}if(this._scene.activeCamera){if(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=a.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera){var t=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,i=a.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-t,n=this.webVRCamera.rotationQuaternion.toEulerAngles().y;this.webVRCamera.rotationQuaternion=a.b.FromEulerAngles(0,n+i,0)}this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)}this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._scene.getEngine().onVRRequestPresentComplete.addOnce(function(t){e.onAfterEnteringVRObservable.notifyObservers({success:t})}),this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this.updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function(){e.onAfterEnteringVRObservable.notifyObservers({success:!0})})),this._scene.activeCamera&&this._canvas&&this._scene.activeCamera.attachControl(this._canvas),this._interactionsEnabled&&this._scene.registerBeforeRender(this.beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach(function(e){e&&e._activatePointer()}),this._hasEnteredVR=!0)},e.prototype.exitVR=function(){if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){m.a.Warn("Error in your custom logic onExitingVR: "+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas),this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this.updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this.beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),[this._leftController,this._rightController].forEach(function(e){e&&e._deactivatePointer()}),this._hasEnteredVR=!1;var e=this._scene.getEngine();e._onVrDisplayPresentChange&&e._onVrDisplayPresentChange()}},Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!0,configurable:!0}),e.prototype.enableInteractions=function(){var e=this;this._interactionsEnabled||(this._interactionsRequested=!0,this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(t){return t.isVisible&&(t.isPickable||t.name===e._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(t){return!!(e._isTeleportationFloor(t)||-1===t.name.indexOf("gazeTracker")&&-1===t.name.indexOf("teleportationTarget")&&-1===t.name.indexOf("torusTeleportation"))&&e.raySelectionPredicate(t)},this._interactionsEnabled=!0)},Object.defineProperty(e.prototype,"_noControllerIsActive",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!0,configurable:!0}),e.prototype._isTeleportationFloor=function(e){for(var t=0;t-1||this._floorMeshesCollection.push(e))},e.prototype.removeFloorMesh=function(e){if(this._floorMeshesCollection){var t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}},e.prototype.enableTeleportation=function(e){if(void 0===e&&(e={}),!this._teleportationInitialized){this._teleportationRequested=!0,this.enableInteractions(),e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);var t=new Gi.a;t.vignetteColor=new s.b(0,0,0,0),t.vignetteEnabled=!0,this._postProcessMove=new Hi("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,t),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},e.prototype._enableInteractionOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&e._activatePointer(),this.webVROptions.laserToggle&&e.webVRController.onMainButtonStateChangedObservable.add(function(i){t._displayLaserPointer&&1===i.value&&(e._activePointer?e._deactivatePointer():e._activatePointer(),t.displayGaze&&(e._gazeTracker.isVisible=e._activePointer))}),e.webVRController.onTriggerStateChangedObservable.add(function(i){var n=e;t._noControllerIsActive&&(n=t._cameraGazer),n._pointerDownOnMeshAsked?i.valuet._padSensibilityUp&&n._selectionPointerDown()}))},e.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.xthis._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},e.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var i=a.b.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),n=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,n=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,a.b.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),a.e.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var r=new jt.a(n,this._workingVector),o=this._scene.pickWithRay(r,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},e.prototype._enableTeleportationOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled||this._enableInteractionOnController(e),e._interactionsEnabled=!0,e._teleportationEnabled=!0,e.webVRController.controllerType===Vt.VIVE&&(e._dpadPressed=!1,e.webVRController.onPadStateChangedObservable.add(function(t){e._dpadPressed=t.pressed,e._dpadPressed||(e._rotationLeftAsked=!1,e._rotationRightAsked=!1,e._teleportationBackRequestInitiated=!1)})),e.webVRController.onPadValuesChangedObservable.add(function(i){t.teleportationEnabled&&(t._checkTeleportBackwards(i,e),t._checkTeleportWithRay(i,e)),t._checkRotate(i,e)}))},e.prototype._createTeleportationCircles=function(){this._teleportationTarget=Se.a.CreateGround("teleportationTarget",2,2,2,this._scene),this._teleportationTarget.isPickable=!1;var e=new ji("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var i=new zi.a("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var n=Se.a.CreateTorus("torusTeleportation",.75,.1,25,this._scene,!1);n.isPickable=!1,n.parent=this._teleportationTarget;var r=new k("animationInnerCircle","position.y",30,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),r.setKeys(o);var a=new Ee;a.setEasingMode(he.EASINGMODE_EASEINOUT),r.setEasingFunction(a),n.animations=[],n.animations.push(r),this._scene.beginAnimation(n,0,60,!0),this._hideTeleportationTarget()},e.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},e.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},e.prototype._rotateCamera=function(e){var t=this;if(this.currentVRCamera instanceof Dt){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var i=a.b.FromRotationMatrix(a.a.RotationY(Math.PI/4*this._rotationAngle)),n=new k("animationRotation","rotationQuaternion",90,k.ANIMATIONTYPE_QUATERNION,k.ANIMATIONLOOPMODE_CONSTANT),r=[];r.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),r.push({frame:6,value:i}),n.setKeys(r),n.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(n),this._postProcessMove.animations=[];var o=new k("animationPP","vignetteWeight",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:3,value:4}),s.push({frame:6,value:0}),o.setKeys(s),o.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(o);var c=new k("animationPP2","vignetteStretch",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:3,value:10}),l.push({frame:6,value:0}),c.setKeys(l),c.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(c),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,function(){t._webVRCamera.detachPostProcess(t._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}},e.prototype._moveTeleportationSelectorTo=function(e,t,i){if(e.pickedPoint){t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint));var n=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i);if(n){var r=a.e.Cross(Z.a.Y,n),o=a.e.Cross(n,r);a.e.RotationFromAxisToRef(o,n,r,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}},e.prototype.teleportCamera=function(e){var t=this;if(this.currentVRCamera instanceof Dt){this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),e.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(e),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this.currentVRCamera.animations=[];var i=new k("animationCameraTeleportation","position",90,k.ANIMATIONTYPE_VECTOR3,k.ANIMATIONLOOPMODE_CONSTANT),n=[{frame:0,value:this.currentVRCamera.position},{frame:11,value:this._workingVector}];i.setKeys(n),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[];var r=new k("animationPP","vignetteWeight",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),o=[];o.push({frame:0,value:0}),o.push({frame:5,value:8}),o.push({frame:11,value:0}),r.setKeys(o),this._postProcessMove.animations.push(r);var a=new k("animationPP2","vignetteStretch",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:5,value:10}),s.push({frame:11,value:0}),a.setKeys(s),this._postProcessMove.animations.push(a),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,11,!1,1,function(){t._webVRCamera.detachPostProcess(t._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,11,!1,1,function(){t.onAfterCameraTeleport.notifyObservers(t._workingVector)}),this._hideTeleportationTarget()}},e.prototype._convertNormalToDirectionOfRay=function(e,t){e&&(Math.acos(a.e.Dot(e,t.direction))e;){var i=this.rigCameras.pop();i&&i.dispose()}},t.prototype._updateForDualEyeDebugging=function(e){void 0===e&&(e=.01),this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new wi.a(0,0,.5,1),this.rigCameras[0].position.x=-e/2,this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new wi.a(.5,0,.5,1),this.rigCameras[1].position.x=e/2,this.rigCameras[1].outputRenderTarget=null},t.prototype.updateFromXRSessionManager=function(e){var i=this;if(!e.currentFrame||!e.currentFrame.getViewerPose)return!1;var n=e.currentFrame.getViewerPose(e.referenceSpace);return!!(n&&n.transform&&n.transform.matrix)&&(a.a.FromFloat32ArrayToRefScaled(n.transform.matrix,0,1,t._TmpMatrix),this._scene.useRightHandedSystem||t._TmpMatrix.toggleModelMatrixHandInPlace(),t._TmpMatrix.getTranslationToRef(this.position),t._TmpMatrix.getRotationMatrixToRef(t._TmpMatrix),a.b.FromRotationMatrixToRef(t._TmpMatrix,this.rotationQuaternion),this.computeWorldMatrix(),this._updateNumberOfRigCameras(n.views.length),n.views.forEach(function(t,n){if(a.a.FromFloat32ArrayToRefScaled(t.transform.matrix,0,1,i.rigCameras[n]._computedViewMatrix),a.a.FromFloat32ArrayToRefScaled(t.projectionMatrix,0,1,i.rigCameras[n]._projectionMatrix),i._scene.useRightHandedSystem||(i.rigCameras[n]._computedViewMatrix.toggleModelMatrixHandInPlace(),i.rigCameras[n]._projectionMatrix.toggleProjectionMatrixHandInPlace()),e.session.renderState.baseLayer){var r=e.session.renderState.baseLayer.getViewport(t),o=e.session.renderState.baseLayer.framebufferWidth,s=e.session.renderState.baseLayer.framebufferHeight;i.rigCameras[n].viewport.width=r.width/o,i.rigCameras[n].viewport.height=r.height/s,i.rigCameras[n].viewport.x=r.x/o,i.rigCameras[n].viewport.y=r.y/s}i.rigCameras[n].outputRenderTarget=e._sessionRenderTargetTexture}),!0)},t._TmpMatrix=new a.a,t}(Dt),an=function(){function e(e){this.scene=e,this.onXRFrameObservable=new o.c,this.onXRSessionEnded=new o.c,this._sessionRenderTargetTexture=null,this.baseLayer=null}return e.prototype.initializeAsync=function(){return m.a.Warn("The WebXR APIs are still under development and are subject to change in the future."),this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject("webXR not supported by this browser")},e.prototype.initializeSessionAsync=function(e){var t=this;return this._xrNavigator.xr.requestSession(e).then(function(e){t.session=e,t.session.addEventListener("end",function(){t._sessionRenderTargetTexture=null,t.scene.getEngine().restoreDefaultFramebuffer(),t.scene.getEngine().customAnimationFrameRequester=null,t.onXRSessionEnded.notifyObservers(null),t.scene.getEngine()._renderLoop()},{once:!0})})},e.prototype.setReferenceSpaceAsync=function(e){var t=this;return this.session.requestReferenceSpace(e).then(function(e){t.referenceSpace=e})},e.prototype.updateRenderStateAsync=function(e){return e.baseLayer&&(this.baseLayer=e.baseLayer),this.session.updateRenderState(e)},e.prototype.startRenderingToXRAsync=function(){var t=this;return this.scene.getEngine().customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:function(e,i){t.currentFrame=i,t.onXRFrameObservable.notifyObservers(null),t.scene.getEngine()._renderLoop()}},this._sessionRenderTargetTexture=e._CreateRenderTargetTextureFromSession(this.session,this.scene,this.baseLayer),window.cancelAnimationFrame(this.scene.getEngine()._frameHandler),this.scene.getEngine()._renderLoop(),Promise.resolve()},e.prototype.exitXRAsync=function(){return this.session&&this.session.end(),new Promise(function(){})},e.prototype.supportsSessionAsync=function(e){return navigator.xr&&navigator.xr.supportsSession?navigator.xr.supportsSession(e).then(function(){return Promise.resolve(!0)}).catch(function(e){return m.a.Warn(e),Promise.resolve(!1)}):Promise.resolve(!1)},e._CreateRenderTargetTextureFromSession=function(e,t,i){if(!i)throw"no layer";var n=new et.a(t.getEngine(),et.a.DATASOURCE_UNKNOWN,!0);n.width=i.framebufferWidth,n.height=i.framebufferHeight,n._framebuffer=i.framebuffer;var r=new Oi("XR renderTargetTexture",{width:n.width,height:n.height},t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0);return r._texture=n,r},e.prototype.dispose=function(){this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear()},e}();!function(e){e[e.ENTERING_XR=0]="ENTERING_XR",e[e.EXITING_XR=1]="EXITING_XR",e[e.IN_XR=2]="IN_XR",e[e.NOT_IN_XR=3]="NOT_IN_XR"}(qi||(qi={}));var sn=function(){function e(e){var t=this;this.scene=e,this.state=qi.NOT_IN_XR,this.onStateChangedObservable=new o.c,this._nonVRCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this.camera=new on("",e),this.sessionManager=new an(e),this.container=new Ye.a("WebXR Container",e),this.camera.parent=this.container,e.onDisposeObservable.add(function(){t.exitXRAsync()})}return e.prototype._setState=function(e){this.state=e,this.onStateChangedObservable.notifyObservers(this.state)},e.CreateAsync=function(t){var i=new e(t);return i.sessionManager.initializeAsync().then(function(){return i._supported=!0,i}).catch(function(){return i})},e.prototype.exitXRAsync=function(){return this._setState(qi.EXITING_XR),this.sessionManager.exitXRAsync()},e.prototype.enterXRAsync=function(e,t,i){var n=this;if(!this._supported)throw"XR session not supported by this browser";return this._setState(qi.ENTERING_XR),this.sessionManager.initializeSessionAsync(e).then(function(){return n.sessionManager.setReferenceSpaceAsync(t)}).then(function(){return i.initializeXRLayerAsync(n.sessionManager.session)}).then(function(){return n.sessionManager.updateRenderStateAsync({depthFar:n.camera.maxZ,depthNear:n.camera.minZ,baseLayer:i.xrLayer})}).then(function(){return n.sessionManager.startRenderingToXRAsync()}).then(function(){n._originalSceneAutoClear=n.scene.autoClear,n._nonVRCamera=n.scene.activeCamera,n.scene.autoClear=!1,n.scene.activeCamera=n.camera,n.sessionManager.onXRFrameObservable.add(function(){n.camera.updateFromXRSessionManager(n.sessionManager)}),n.sessionManager.onXRSessionEnded.addOnce(function(){n.camera.rigCameras.forEach(function(e){e.outputRenderTarget=null}),n.scene.autoClear=n._originalSceneAutoClear,n.scene.activeCamera=n._nonVRCamera,n._setState(qi.NOT_IN_XR)}),n.sessionManager.onXRFrameObservable.addOnce(function(){n._setState(qi.IN_XR)})}).catch(function(e){console.log(e),console.log(e.message)})},e.prototype.setPositionOfCameraUsingContainer=function(t){this.camera.globalPosition.subtractToRef(t,e._TmpVector),this.container.position.subtractInPlace(e._TmpVector)},e.prototype.rotateCameraByQuaternionUsingContainer=function(e){this.container.rotationQuaternion||(this.container.rotationQuaternion=a.b.FromEulerVector(this.container.rotation)),this.container.rotationQuaternion.multiplyInPlace(e),this.container.position.rotateByQuaternionAroundPointToRef(e,this.camera.globalPosition,this.container.position)},e.prototype.dispose=function(){this.camera.dispose(),this.container.dispose(),this.onStateChangedObservable.clear(),this.sessionManager.dispose()},e._TmpVector=new a.e,e}(),cn=function(){function e(e,t,i){this.element=e,this.sessionMode=t,this.referenceSpaceType=i}return e.prototype.update=function(e){},e}(),ln=function(){},un=function(){function e(e,t){var i=this;if(this.scene=e,this._buttons=[],this._activeButton=null,this.activeButtonChangedObservable=new o.c,this._overlay=document.createElement("div"),this._overlay.style.cssText="z-index:11;position: absolute; right: 20px;bottom: 50px;",t.customButtons)this._buttons=t.customButtons;else{var n=document.createElement("button");n.style.cssText="color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-repeat:no-repeat; background-position: center; outline: none;",n.innerText="HMD",this._buttons.push(new cn(n,"immersive-vr","local-floor")),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",this.element.innerText=e===this?"EXIT":"HMD"},this._updateButtons(null)}var r=e.getEngine().getRenderingCanvas();r&&r.parentNode&&(r.parentNode.appendChild(this._overlay),e.onDisposeObservable.addOnce(function(){i.dispose()}))}return e.CreateAsync=function(t,i,n){var r=this,o=new e(t,n),a=o._buttons.map(function(e){return i.sessionManager.supportsSessionAsync(e.sessionMode)});return i.onStateChangedObservable.add(function(e){e==qi.NOT_IN_XR&&o._updateButtons(null)}),Promise.all(a).then(function(e){return e.forEach(function(e,t){e&&(o._overlay.appendChild(o._buttons[t].element),o._buttons[t].element.onclick=function(){return h.b(r,void 0,void 0,function(){return h.e(this,function(e){switch(e.label){case 0:return i.state!=qi.IN_XR?[3,2]:(o._updateButtons(null),[4,i.exitXRAsync()]);case 1:return e.sent(),[2];case 2:return i.state!=qi.NOT_IN_XR?[3,4]:(o._updateButtons(o._buttons[t]),n.webXRManagedOutputCanvas?[4,i.enterXRAsync(o._buttons[t].sessionMode,o._buttons[t].referenceSpaceType,n.webXRManagedOutputCanvas)]:[3,4]);case 3:e.sent(),e.label=4;case 4:return[2]}})})})}),o})},e.prototype._updateButtons=function(e){var t=this;this._activeButton=e,this._buttons.forEach(function(e){e.update(t._activeButton)}),this.activeButtonChangedObservable.notifyObservers(this._activeButton)},e.prototype.dispose=function(){var e=this.scene.getEngine().getRenderingCanvas();e&&e.parentNode&&e.parentNode.contains(this._overlay)&&e.parentNode.removeChild(this._overlay),this.activeButtonChangedObservable.clear()},e}(),hn=function(){function e(e,t,i){void 0===i&&(i=null),this.scene=e,this.inputSource=t,this.parentContainer=i,this.onDisposeObservable=new o.c,this._tmpMatrix=new a.a,this._tmpQuaternion=new a.b,this._tmpVector=new a.e,this.pointer=new Ye.a("controllerPointer",e),i&&i.addChild(this.pointer),this.inputSource.gripSpace&&(this.grip=new Ye.a("controllerGrip",this.scene),this.parentContainer&&this.parentContainer.addChild(this.grip))}return e.prototype.updateFromXRFrame=function(e,t){var i=e.getPose(this.inputSource.targetRaySpace,t);if(i&&(a.a.FromFloat32ArrayToRefScaled(i.transform.matrix,0,1,this._tmpMatrix),this.pointer.getScene().useRightHandedSystem||this._tmpMatrix.toggleModelMatrixHandInPlace(),this.pointer.rotationQuaternion||(this.pointer.rotationQuaternion=new a.b),this._tmpMatrix.decompose(this.pointer.scaling,this.pointer.rotationQuaternion,this.pointer.position)),this.inputSource.gripSpace&&this.grip){var n=e.getPose(this.inputSource.gripSpace,t);n&&(a.a.FromFloat32ArrayToRefScaled(n.transform.matrix,0,1,this._tmpMatrix),this.grip.getScene().useRightHandedSystem||this._tmpMatrix.toggleModelMatrixHandInPlace(),this.grip.rotationQuaternion||(this.grip.rotationQuaternion=new a.b),this._tmpMatrix.decompose(this.grip.scaling,this.grip.rotationQuaternion,this.grip.position))}},e.prototype.getWorldPointerRayToRef=function(e){this.pointer.computeWorldMatrix(!0).decompose(void 0,this._tmpQuaternion,void 0),this._tmpVector.set(0,0,1),this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion,this._tmpVector),e.origin=this.pointer.absolutePosition,e.direction.copyFrom(this._tmpVector),e.length=1e3},e.prototype.dispose=function(){this.grip&&this.grip.dispose(),this.pointer.dispose(),this.onDisposeObservable.notifyObservers({})},e}(),dn=function(){function e(e){var t=this;this.baseExperience=e,this.controllers=[],this.onControllerAddedObservable=new o.c,this.onControllerRemovedObservable=new o.c,this._onInputSourcesChange=function(e){t._addAndRemoveControllers(e.added,e.removed)},this._stateObserver=e.onStateChangedObservable.add(function(e){e===qi.NOT_IN_XR&&t._addAndRemoveControllers([],t.controllers.map(function(e){return e.inputSource}))}),this._frameObserver=e.sessionManager.onXRFrameObservable.add(function(){e.sessionManager.currentFrame&&(0==t.controllers.length&&e.sessionManager.session.inputSources&&(t._addAndRemoveControllers(e.sessionManager.session.inputSources,[]),e.sessionManager.session.addEventListener("inputsourceschange",t._onInputSourcesChange)),t.controllers.forEach(function(t){t.updateFromXRFrame(e.sessionManager.currentFrame,e.sessionManager.referenceSpace)}))})}return e.prototype._addAndRemoveControllers=function(e,t){for(var i=this,n=this.controllers.map(function(e){return e.inputSource}),r=0,o=e;r.7)s=!0;else{if(s){var h,d=e.baseExperience.camera.computeWorldMatrix(),f=new a.b;d.decompose(void 0,f,i._tmpRay.origin),i._tmpVector.set(0,0,-1),i._tmpVector.rotateByQuaternionToRef(f,i._tmpVector),i._tmpVector.y=0,i._tmpVector.normalize(),i._tmpVector.y=-1.5,i._tmpVector.normalize(),i._tmpRay.direction.copyFrom(i._tmpVector),(h=r.pickWithRay(i._tmpRay,function(e){return-1!==t.indexOf(e)}))&&h.pickedPoint&&(i._tmpVector.copyFrom(h.pickedPoint),i._tmpVector.y+=e.baseExperience.camera.position.y,e.baseExperience.setPositionOfCameraUsingContainer(i._tmpVector))}s=!1}void 0!==n.inputSource.gamepad.axes[0]&&(n.inputSource.gamepad.axes[0]<-.7?c=!0:(c&&e.baseExperience.rotateCameraByQuaternionUsingContainer(a.b.FromEulerAngles(0,-Math.PI/4,0)),c=!1),n.inputSource.gamepad.axes[0]>.7?l=!0:(l&&e.baseExperience.rotateCameraByQuaternionUsingContainer(a.b.FromEulerAngles(0,Math.PI/4,0)),l=!1))}});n.onDisposeObservable.addOnce(function(){u.dispose(),h.dispose(),f.dispose(),p.dispose(),r.onBeforeRenderObservable.remove(v)})})},pn=function(){function e(t){var i=this;this._tmpRay=new jt.a(new a.e,new a.e),t.onControllerAddedObservable.add(function(t){var n,r,o,c=t.pointer.getScene(),l=!1;o=e._idCounter++,(n=Se.a.CreateCylinder("laserPointer",1,2e-4,.004,20,1,c,!1)).parent=t.pointer;var u=new zi.a("laserPointerMat",c);u.emissiveColor=new s.a(.7,.7,.7),u.alpha=.6,n.material=u,n.rotation.x=Math.PI/2,i._updatePointerDistance(n,1),n.isPickable=!1,(r=Se.a.CreateTorus("gazeTracker",.0105,.0075,20,c,!1)).bakeCurrentTransformIntoVertices(),r.isPickable=!1,r.isVisible=!1;var h=new zi.a("targetMat",c);h.specularColor=s.a.Black(),h.emissiveColor=new s.a(.7,.7,.7),h.backFaceCulling=!1,r.material=h;var d=c.onBeforeRenderObservable.add(function(){t.getWorldPointerRayToRef(i._tmpRay);var e=c.pickWithRay(i._tmpRay);if(e&&(t.inputSource.gamepad&&t.inputSource.gamepad.buttons[0]&&t.inputSource.gamepad.buttons[0].value>.7?(l||c.simulatePointerDown(e,{pointerId:o}),l=!0):(l&&c.simulatePointerUp(e,{pointerId:o}),l=!1),c.simulatePointerMove(e,{pointerId:o})),e&&e.pickedPoint&&e.hit){i._updatePointerDistance(n,e.distance),r.position.copyFrom(e.pickedPoint),r.scaling.x=Math.sqrt(e.distance),r.scaling.y=Math.sqrt(e.distance),r.scaling.z=Math.sqrt(e.distance);var s=i._convertNormalToDirectionOfRay(e.getNormal(),i._tmpRay);if(r.position.copyFrom(e.pickedPoint),s){var u=a.e.Cross(Z.a.Y,s),h=a.e.Cross(s,u);a.e.RotationFromAxisToRef(h,s,u,r.rotation),r.position.addInPlace(s.scale(.002))}r.isVisible=!0}else r.isVisible=!1});t.onDisposeObservable.addOnce(function(){n.dispose(),r.dispose(),c.onBeforeRenderObservable.remove(d)})})}return e.prototype._convertNormalToDirectionOfRay=function(e,t){e&&(Math.acos(a.e.Dot(e,t.direction))s){var c=s;s=a,a=c}return a>0&&a0&&s=0))},e.prototype._canDoCollision=function(e,t,i,n){var r=a.e.Distance(this._basePointWorld,e),o=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+o+t)&&!!function(e,t,i,n){return!(e.x>i.x+n||i.x-n>t.x||e.y>i.y+n||i.y-n>t.y||e.z>i.z+n||i.z-n>t.z)}(i,n,this._basePointWorld,this._velocityWorldLength+o)},e.prototype._testTriangle=function(e,t,i,n,r,o,s){var c,l=!1;t||(t=[]),t[e]||(t[e]=new xn.a(0,0,0,0),t[e].copyFromPoints(i,n,r));var u=t[e];if(o||u.isFrontFacingTo(this._normalizedVelocity,0)){var h=u.signedDistanceTo(this._basePoint),d=a.e.Dot(u.normal,this._velocity);if(0==d){if(Math.abs(h)>=1)return;l=!0,c=0}else{var f=(1-h)/d;if((c=(-1-h)/d)>f){var p=f;f=c,c=p}if(c>1||f<0)return;c<0&&(c=0),c>1&&(c=1)}this._collisionPoint.copyFromFloats(0,0,0);var _=!1,m=1;if(l||(this._basePoint.subtractToRef(u.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(c,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,u.normal)&&(_=!0,m=c,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!_){var g=this._velocity.lengthSquared(),v=g;this._basePoint.subtractToRef(i,this._tempVector);var y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,T=Cn(v,y,b,m);T.found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(T=Cn(v,y,b,m)).found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(T=Cn(v,y,b,m)).found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex);var E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex);if(v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found){var S=(A*T.root-P)/E;S>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),i.addToRef(this._edge,this._collisionPoint))}r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex),v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found&&(S=(A*T.root-P)/E)>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),n.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex),v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found&&(S=(A*T.root-P)/E)>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),r.addToRef(this._edge,this._collisionPoint))}if(_){var R=m*this._velocity.length();(!this.collisionFound||R=n)r.copyFrom(e);else{var s=o?o.collisionMask:i.collisionMask;i._initialize(e,t,a);for(var c=0;cthis.capacity&&this._depth-1&&this.entries.splice(i,1)}},e.prototype.addEntries=function(e){for(var t=0;te.occlusionRetryCount))return!1;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==Ye.a.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var n=this.getScene();if(n.getBoundingBoxRenderer){var r=n.getBoundingBoxRenderer();this._occlusionQuery||(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery),r.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0}return e.isOccluded};Ce.b.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},Ce.b.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},Ce.b.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},Ce.b.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},Ce.b.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},Ce.b.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},Ce.b.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)};var Wn=i(122),Hn=i(123),Xn=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),Yn=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return Xn.COPY;case 86:return Xn.PASTE;case 88:return Xn.CUT;default:return-1}},e}(),Kn=function(e){function t(t){var i=e.call(this,t)||this;return i.controllerType=Vt.DAYDREAM,i}return h.d(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;vn.ImportMesh("",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,function(e){n._defaultModel=e[1],n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)})},t.prototype._handleButtonChange=function(e,t,i){if(0===e){var n=this.onTriggerStateChangedObservable;n&&n.notifyObservers(t)}else m.a.Warn("Unrecognized Daydream button index: "+e)},t.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",t.MODEL_FILENAME="generic.babylon",t.GAMEPAD_ID_PREFIX="Daydream",t}(ki);Xt._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(Kn.GAMEPAD_ID_PREFIX)},create:function(e){return new Kn(e)}});var Qn=function(e){function t(t){var i=e.call(this,t)||this;return i._buttonIndexToObservableNameMap=["onPadStateChangedObservable","onTriggerStateChangedObservable"],i.controllerType=Vt.GEAR_VR,i._calculatedPosition=new a.e("left"==i.hand?-.15:.15,-.5,.25),i._disableTrackPosition(i._calculatedPosition),i}return h.d(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;vn.ImportMesh("",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,function(t){var r=new Se.a("",e);t[1].parent=r,t[1].position.z=-.15,n._defaultModel=r,n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)})},t.prototype._handleButtonChange=function(e,t,i){if(ec.snapDistance?(r=Math.floor(Math.abs(h)/c.snapDistance),h<0&&(r*=-1),h%=c.snapDistance,d.scaleToRef(c.snapDistance*r,d),n=!0):d.scaleInPlace(0)),c.attachedMesh.scaling.addInPlace(d),n&&(f.snapDistance=c.snapDistance*r,c.onSnapObservable.notifyObservers(f))}}),c._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!c._customMeshSet){var t=e.pickInfo&&-1!=c._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?c._hoverMaterial:c._coloredMaterial;c._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var p=n._getSharedGizmoLight();return p.includedOnlyMeshes=p.includedOnlyMeshes.concat(c._rootMesh.getChildMeshes()),c}return h.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._arrow&&this._arrow.dispose(),[this._coloredMaterial,this._hoverMaterial].forEach(function(e){e&&e.dispose()}),e.prototype.dispose.call(this)},t.prototype.setCustomMesh=function(t,i){var n=this;void 0===i&&(i=!1),e.prototype.setCustomMesh.call(this,t),i&&(this._rootMesh.getChildMeshes().forEach(function(e){e.material=n._coloredMaterial,e.color&&(e.color=n._coloredMaterial.diffuseColor)}),this._customMeshSet=!1)},t}(Jn.a),tr=i(48),ir=i(45),nr=function(e){function t(t,i){void 0===t&&(t=s.a.Gray()),void 0===i&&(i=$n.a.DefaultKeepDepthUtilityLayer);var n=e.call(this,i)||this;n._boundingDimensions=new a.e(1,1,1),n._renderObserver=null,n._pointerObserver=null,n._scaleDragSpeed=.2,n._tmpQuaternion=new a.b,n._tmpVector=new a.e(0,0,0),n._tmpRotationMatrix=new a.a,n.ignoreChildren=!1,n.includeChildPredicate=null,n.rotationSphereSize=.1,n.scaleBoxSize=.1,n.fixedDragMeshScreenSize=!1,n.fixedDragMeshScreenSizeDistanceFactor=10,n.onDragStartObservable=new o.c,n.onScaleBoxDragObservable=new o.c,n.onScaleBoxDragEndObservable=new o.c,n.onRotationSphereDragObservable=new o.c,n.onRotationSphereDragEndObservable=new o.c,n.scalePivot=null,n._existingMeshScale=new a.e,n._dragMesh=null,n.pointerDragBehavior=new He.a,n.updateScale=!1,n._anchorMesh=new Ye.a("anchor",i.utilityLayerScene),n.coloredMaterial=new zi.a("",i.utilityLayerScene),n.coloredMaterial.disableLighting=!0,n.hoverColoredMaterial=new zi.a("",i.utilityLayerScene),n.hoverColoredMaterial.disableLighting=!0,n._lineBoundingBox=new Ye.a("",i.utilityLayerScene),n._lineBoundingBox.rotationQuaternion=new a.b;var r=[];r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(n._boundingDimensions.x,0,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,0,0),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,0,0),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,n._boundingDimensions.y,0),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,n._boundingDimensions.y,0),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,n._boundingDimensions.z),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.forEach(function(e){e.color=t,e.position.addInPlace(new a.e(-n._boundingDimensions.x/2,-n._boundingDimensions.y/2,-n._boundingDimensions.z/2)),e.isPickable=!1,n._lineBoundingBox.addChild(e)}),n._rootMesh.addChild(n._lineBoundingBox),n.setColor(t),n._rotateSpheresParent=new Ye.a("",i.utilityLayerScene),n._rotateSpheresParent.rotationQuaternion=new a.b;for(var c=function(e){var t=tr.a.CreateSphere("",{diameter:1},i.utilityLayerScene);t.rotationQuaternion=new a.b,t.material=l.coloredMaterial,(f=new He.a({})).moveAttached=!1,f.updateDragPlane=!1,t.addBehavior(f);var r=new a.e(1,0,0),o=0;f.onDragStartObservable.add(function(){r.copyFrom(t.forward),o=0}),f.onDragObservable.add(function(t){if(n.onRotationSphereDragObservable.notifyObservers({}),n.attachedMesh){var i=n.attachedMesh.parent;if(i&&i.scaling&&i.scaling.isNonUniformWithinEpsilon(.001))return void m.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Qe.a._RemoveAndStorePivotPoint(n.attachedMesh);var s=r,c=t.dragPlaneNormal.scale(a.e.Dot(t.dragPlaneNormal,s)),l=s.subtract(c).normalizeToNew(),u=a.e.Dot(l,t.delta)<0?Math.abs(t.delta.length()):-Math.abs(t.delta.length());u=u/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),n.attachedMesh.rotationQuaternion||(n.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(n.attachedMesh.rotation.y,n.attachedMesh.rotation.x,n.attachedMesh.rotation.z)),n._anchorMesh.rotationQuaternion||(n._anchorMesh.rotationQuaternion=a.b.RotationYawPitchRoll(n._anchorMesh.rotation.y,n._anchorMesh.rotation.x,n._anchorMesh.rotation.z)),o+=u,Math.abs(o)<=2*Math.PI&&(e>=8?a.b.RotationYawPitchRollToRef(0,0,u,n._tmpQuaternion):e>=4?a.b.RotationYawPitchRollToRef(u,0,0,n._tmpQuaternion):a.b.RotationYawPitchRollToRef(0,u,0,n._tmpQuaternion),n._anchorMesh.addChild(n.attachedMesh),n._anchorMesh.rotationQuaternion.multiplyToRef(n._tmpQuaternion,n._anchorMesh.rotationQuaternion),n._anchorMesh.removeChild(n.attachedMesh),n.attachedMesh.setParent(i)),n.updateBoundingBox(),Qe.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),f.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(t)}),f.onDragEndObservable.add(function(){n.onRotationSphereDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),l._rotateSpheresParent.addChild(t)},l=this,u=0;u<12;u++)c(u);n._rootMesh.addChild(n._rotateSpheresParent),n._scaleBoxesParent=new Ye.a("",i.utilityLayerScene),n._scaleBoxesParent.rotationQuaternion=new a.b;for(var h=0;h<2;h++)for(var d=0;d<2;d++)for(var f,p=function(){var e=Zn.a.CreateBox("",{size:1},i.utilityLayerScene);e.material=_.coloredMaterial;var t=new a.e(0==h?-1:1,0==d?-1:1,0==g?-1:1);(f=new He.a({dragAxis:t})).moveAttached=!1,e.addBehavior(f),f.onDragObservable.add(function(t){if(n.onScaleBoxDragObservable.notifyObservers({}),n.attachedMesh){var i=n.attachedMesh.parent;if(i&&i.scaling&&i.scaling.isNonUniformWithinEpsilon(.001))return void m.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Qe.a._RemoveAndStorePivotPoint(n.attachedMesh);var r=t.dragDistance/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),o=new a.e(r,r,r);o.scaleInPlace(n._scaleDragSpeed),n.updateBoundingBox(),n.scalePivot?(n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix),n._boundingDimensions.scaleToRef(.5,n._tmpVector),a.e.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector),n._boundingDimensions.multiplyToRef(n.scalePivot,n._tmpVector),a.e.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.addInPlace(n._tmpVector)):(e.absolutePosition.subtractToRef(n._anchorMesh.position,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector)),n._anchorMesh.addChild(n.attachedMesh),n._anchorMesh.scaling.addInPlace(o),(n._anchorMesh.scaling.x<0||n._anchorMesh.scaling.y<0||n._anchorMesh.scaling.z<0)&&n._anchorMesh.scaling.subtractInPlace(o),n._anchorMesh.removeChild(n.attachedMesh),n.attachedMesh.setParent(i),Qe.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),f.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(e)}),f.onDragEndObservable.add(function(){n.onScaleBoxDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),_._scaleBoxesParent.addChild(e)},_=this,g=0;g<2;g++)p();n._rootMesh.addChild(n._scaleBoxesParent);var v=new Array;return n._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(e){v[e.event.pointerId]?e.pickInfo&&e.pickInfo.pickedMesh!=v[e.event.pointerId]&&(v[e.event.pointerId].material=n.coloredMaterial,delete v[e.event.pointerId]):n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach(function(t){e.pickInfo&&e.pickInfo.pickedMesh==t&&(v[e.event.pointerId]=t,t.material=n.hoverColoredMaterial)})}),n._renderObserver=n.gizmoLayer.originalScene.onBeforeRenderObservable.add(function(){n.attachedMesh&&!n._existingMeshScale.equals(n.attachedMesh.scaling)?n.updateBoundingBox():n.fixedDragMeshScreenSize&&(n._updateRotationSpheres(),n._updateScaleBoxes()),n._dragMesh&&n.attachedMesh&&n.pointerDragBehavior.dragging&&(n._lineBoundingBox.position.rotateByQuaternionToRef(n._rootMesh.rotationQuaternion,n._tmpVector),n.attachedMesh.setAbsolutePosition(n._dragMesh.position.add(n._tmpVector.scale(-1))))}),n.updateBoundingBox(),n}return h.d(t,e),t.prototype.setColor=function(e){this.coloredMaterial.emissiveColor=e,this.hoverColoredMaterial.emissiveColor=e.clone().add(new s.a(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach(function(t){t.color&&(t.color=e)})},t.prototype._attachedMeshChanged=function(e){var t=this;if(e){Qe.a._RemoveAndStorePivotPoint(e);var i=e.parent;this._anchorMesh.addChild(e),this._anchorMesh.removeChild(e),e.setParent(i),Qe.a._RestorePivotPoint(e),this.updateBoundingBox(),e.getChildMeshes(!1).forEach(function(e){e.markAsDirty("scaling")}),this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function(){t._updateDummy()})}},t.prototype._selectNode=function(e){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach(function(t){t.isVisible=!e||t==e})},t.prototype.updateBoundingBox=function(){if(this.attachedMesh){Qe.a._RemoveAndStorePivotPoint(this.attachedMesh);var e=this.attachedMesh.parent;this.attachedMesh.setParent(null);var t=null;this.attachedMesh.skeleton&&(t=this.attachedMesh.skeleton.overrideMesh,this.attachedMesh.skeleton.overrideMesh=null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=a.b.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var i=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate);i.max.subtractToRef(i.min,this._boundingDimensions),this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions),this._lineBoundingBox.position.set((i.max.x+i.min.x)/2,(i.max.y+i.min.y)/2,(i.max.z+i.min.z)/2),this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position),this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position),this._lineBoundingBox.computeWorldMatrix(),this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),this.attachedMesh.setParent(e),this.attachedMesh.skeleton&&(this.attachedMesh.skeleton.overrideMesh=t)}this._updateRotationSpheres(),this._updateScaleBoxes(),this.attachedMesh&&(this._existingMeshScale.copyFrom(this.attachedMesh.scaling),Qe.a._RestorePivotPoint(this.attachedMesh))},t.prototype._updateRotationSpheres=function(){for(var e=this._rotateSpheresParent.getChildMeshes(),t=0;t<3;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r=4*t+2*i+n;if(0==t&&(e[r].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Right()).normalizeToNew().add(e[r].position))),1==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y/2,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Up()).normalizeToNew().add(e[r].position))),2==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*n,this._boundingDimensions.z/2),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Forward()).normalizeToNew().add(e[r].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var o=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(o,o,o)}else e[r].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}},t.prototype._updateScaleBoxes=function(){for(var e=this._scaleBoxesParent.getChildMeshes(),t=0;t<2;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r=4*t+2*i+n;if(e[r])if(e[r].position.set(this._boundingDimensions.x*t,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var o=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(o,o,o)}else e[r].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize)}},t.prototype.setEnabledRotationAxis=function(e){this._rotateSpheresParent.getChildMeshes().forEach(function(t,i){i<4?t.setEnabled(-1!=e.indexOf("x")):i<8?t.setEnabled(-1!=e.indexOf("y")):t.setEnabled(-1!=e.indexOf("z"))})},t.prototype.setEnabledScaling=function(e){this._scaleBoxesParent.getChildMeshes().forEach(function(t,i){t.setEnabled(e)})},t.prototype._updateDummy=function(){this._dragMesh&&(this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()),this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling),this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion))},t.prototype.enableDragBehavior=function(){this._dragMesh=Se.a.CreateBox("dummy",1,this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new a.b,this.pointerDragBehavior.useObjectOrienationForDragging=!1,this._dragMesh.addBehavior(this.pointerDragBehavior)},t.prototype.dispose=function(){this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),this._lineBoundingBox.dispose(),this._rotateSpheresParent.dispose(),this._scaleBoxesParent.dispose(),this._dragMesh&&this._dragMesh.dispose(),e.prototype.dispose.call(this)},t.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach(function(e){t(e)})};t(e),e.rotationQuaternion||(e.rotationQuaternion=a.b.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),n=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var r=Zn.a.CreateBox("box",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,r.scaling),0===r.scaling.y&&(r.scaling.y=re.a),0===r.scaling.x&&(r.scaling.x=re.a),0===r.scaling.z&&(r.scaling.z=re.a),r.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(r),e.rotationQuaternion.copyFrom(n),e.position.copyFrom(i),e.removeChild(r),r.addChild(e),r.visibility=0,r},t.prototype.setCustomMesh=function(e){m.a.Error("Custom meshes are not supported on this gizmo")},t}(Jn.a),rr=function(e){function t(t,i,n,r,c,l){void 0===i&&(i=s.a.Gray()),void 0===n&&(n=$n.a.DefaultUtilityLayer),void 0===r&&(r=32),void 0===c&&(c=null),void 0===l&&(l=!1);var u=e.call(this,n)||this;u._pointerObserver=null,u.snapDistance=0,u.onSnapObservable=new o.c,u._isEnabled=!0,u._parent=null,u._parent=c;var h=new zi.a("",n.utilityLayerScene);h.diffuseColor=i,h.specularColor=i.subtract(new s.a(.1,.1,.1));var d=new zi.a("",n.utilityLayerScene);d.diffuseColor=i.add(new s.a(.3,.3,.3));var f=new Ye.a("",n.utilityLayerScene),p=Se.a.CreateTorus("",.6,.03,r,n.utilityLayerScene);p.visibility=0;var _=Se.a.CreateTorus("",.6,.005,r,n.utilityLayerScene);_.material=h,_.rotation.x=Math.PI/2,p.rotation.x=Math.PI/2,f.addChild(_),f.addChild(p),f.lookAt(u._rootMesh.position.add(t)),u._rootMesh.addChild(f),f.scaling.scaleInPlace(1/3),u.dragBehavior=new He.a({dragPlaneNormal:t}),u.dragBehavior.moveAttached=!1,u.dragBehavior.maxDragAngle=9*Math.PI/20,u.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,u._rootMesh.addBehavior(u.dragBehavior);var m=new a.e;u.dragBehavior.onDragStartObservable.add(function(e){u.attachedMesh&&m.copyFrom(e.dragPlanePoint)});var g=new a.a,v=new a.e,y=new a.e,b={snapDistance:0},T=0,E=new a.a,A=new a.e,P=new a.b;u.dragBehavior.onDragObservable.add(function(e){if(u.attachedMesh){u.attachedMesh.rotationQuaternion&&!l||(u.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(u.attachedMesh.rotation.y,u.attachedMesh.rotation.x,u.attachedMesh.rotation.z));var i=u.attachedMesh.parent;i&&u.attachedMesh.setParent(null);var r=e.dragPlanePoint.subtract(u.attachedMesh.absolutePosition).normalize(),o=m.subtract(u.attachedMesh.absolutePosition).normalize(),s=a.e.Cross(r,o),c=a.e.Dot(r,o),h=Math.atan2(s.length(),c);if(v.copyFrom(t),y.copyFrom(t),u.updateGizmoRotationToMatchAttachedMesh&&(u.attachedMesh.rotationQuaternion.toRotationMatrix(g),y=a.e.TransformCoordinates(v,g)),n.utilityLayerScene.activeCamera){var d=n.utilityLayerScene.activeCamera.position.subtract(u.attachedMesh.position);a.e.Dot(d,y)>0&&(v.scaleInPlace(-1),y.scaleInPlace(-1))}a.e.Dot(y,s)>0&&(h=-h);var f=!1;if(0!=u.snapDistance)if(T+=h,Math.abs(T)>u.snapDistance){var p=Math.floor(Math.abs(T)/u.snapDistance);T<0&&(p*=-1),T%=u.snapDistance,h=u.snapDistance*p,f=!0}else h=0;E.reset(),u.attachedMesh.parent&&(u.attachedMesh.parent.computeWorldMatrix().invertToRef(E),E.getRotationMatrixToRef(E),a.e.TransformCoordinatesToRef(v,E,v));var _=Math.sin(h/2);P.set(v.x*_,v.y*_,v.z*_,Math.cos(h/2)),E.determinant()>0&&(P.toEulerAnglesToRef(A),a.b.RotationYawPitchRollToRef(A.y,-A.x,-A.z,P)),u.updateGizmoRotationToMatchAttachedMesh?u.attachedMesh.rotationQuaternion.multiplyToRef(P,u.attachedMesh.rotationQuaternion):P.multiplyToRef(u.attachedMesh.rotationQuaternion,u.attachedMesh.rotationQuaternion),l&&(u.attachedMesh.rotationQuaternion.toEulerAnglesToRef(A),u.attachedMesh.rotationQuaternion=null,u.attachedMesh.rotation.copyFrom(A)),m.copyFrom(e.dragPlanePoint),f&&(b.snapDistance=h,u.onSnapObservable.notifyObservers(b)),i&&u.attachedMesh.setParent(i)}}),u._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!u._customMeshSet){var t=e.pickInfo&&-1!=u._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?d:h;u._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var S=n._getSharedGizmoLight();return S.includedOnlyMeshes=S.includedOnlyMeshes.concat(u._rootMesh.getChildMeshes(!1)),u}return h.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),e.prototype.dispose.call(this)},t}(Jn.a),or=function(e){function t(t,i,n){void 0===t&&(t=$n.a.DefaultUtilityLayer),void 0===i&&(i=32),void 0===n&&(n=!1);var r=e.call(this,t)||this;return r.onDragStartObservable=new o.c,r.onDragEndObservable=new o.c,r.xGizmo=new rr(new a.e(1,0,0),s.a.Red().scale(.5),t,i,r,n),r.yGizmo=new rr(new a.e(0,1,0),s.a.Green().scale(.5),t,i,r,n),r.zGizmo=new rr(new a.e(0,0,1),s.a.Blue().scale(.5),t,i,r,n),[r.xGizmo,r.yGizmo,r.zGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){r.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){r.onDragEndObservable.notifyObservers({})})}),r.attachedMesh=null,r}return h.d(t,e),Object.defineProperty(t.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo].forEach(function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},t.prototype.setCustomMesh=function(e){m.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)")},t}(Jn.a),ar=i(41),sr=i(82),cr=function(e){function t(i,n,r,c){void 0===n&&(n=s.a.Gray()),void 0===r&&(r=$n.a.DefaultUtilityLayer),void 0===c&&(c=null);var l=e.call(this,r)||this;l._pointerObserver=null,l.snapDistance=0,l.onSnapObservable=new o.c,l._isEnabled=!1,l._parent=null,l._parent=c,l._coloredMaterial=new zi.a("",r.utilityLayerScene),l._coloredMaterial.diffuseColor=n,l._coloredMaterial.specularColor=n.subtract(new s.a(.1,.1,.1)),l._hoverMaterial=new zi.a("",r.utilityLayerScene),l._hoverMaterial.diffuseColor=n.add(new s.a(.3,.3,.3)),l._plane=t._CreatePlane(r.utilityLayerScene,l._coloredMaterial),l._plane.lookAt(l._rootMesh.position.add(i)),l._plane.scaling.scaleInPlace(1/3),l._plane.parent=l._rootMesh;var u=0,h=new a.e,d={snapDistance:0};l.dragBehavior=new He.a({dragPlaneNormal:i}),l.dragBehavior.moveAttached=!1,l._rootMesh.addBehavior(l.dragBehavior);var f=new a.e,p=new a.a;l.dragBehavior.onDragObservable.add(function(e){if(l.attachedMesh)if(l.attachedMesh.parent?(l.attachedMesh.parent.computeWorldMatrix().invertToRef(p),p.setTranslationFromFloats(0,0,0),a.e.TransformCoordinatesToRef(e.delta,p,f)):f.copyFrom(e.delta),0==l.snapDistance)l.attachedMesh.position.addInPlace(f);else if(u+=e.dragDistance,Math.abs(u)>l.snapDistance){var t=Math.floor(Math.abs(u)/l.snapDistance);u%=l.snapDistance,f.normalizeToRef(h),h.scaleInPlace(l.snapDistance*t),l.attachedMesh.position.addInPlace(h),d.snapDistance=l.snapDistance*t,l.onSnapObservable.notifyObservers(d)}}),l._pointerObserver=r.utilityLayerScene.onPointerObservable.add(function(e){if(!l._customMeshSet){var t=e.pickInfo&&-1!=l._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?l._hoverMaterial:l._coloredMaterial;l._rootMesh.getChildMeshes().forEach(function(e){e.material=t})}});var _=r._getSharedGizmoLight();return _.includedOnlyMeshes=_.includedOnlyMeshes.concat(l._rootMesh.getChildMeshes(!1)),l}return h.d(t,e),t._CreatePlane=function(e,t){var i=new ar.a("plane",e),n=sr.a.CreatePlane("dragPlane",{width:.1375,height:.1375,sideOrientation:2},e);return n.material=t,n.parent=i,n.material=t,i},t._CreateArrowInstance=function(e,t){for(var i=new ar.a("arrow",e),n=0,r=t.getChildMeshes();n=t.length)?0:e.type||0,h=e.size,d=e.sizeX||h||1,f=e.sizeY||h||1,p=e.sizeZ||h||1,_=e.custom||t[u],m=_.face.length,g=e.faceUV||new Array(m),v=e.faceColors,y=void 0===e.flat||e.flat,b=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,T=new Array,E=new Array,A=new Array,P=new Array,S=new Array,R=0,x=0,C=new Array,M=0,O=0;if(y)for(O=0;O0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&a.a.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=a.e.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=0;othis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y)}}var u=this._orthoRight-this._orthoLeft,h=this._orthoTop-this._orthoBottom;this.getScene().useRightHandedSystem?a.a.OrthoOffCenterRHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-h*this.shadowOrthoScale,this._orthoTop+h*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e):a.a.OrthoOffCenterLHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-h*this.shadowOrthoScale,this._orthoTop+h*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e)}},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightData",-this.transformedDirection.x,-this.transformedDirection.y,-this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightData",-this.direction.x,-this.direction.y,-this.direction.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.getDepthMinZ=function(e){return 1},t.prototype.getDepthMaxZ=function(e){return 1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},h.c([Object(F.c)()],t.prototype,"shadowFrustumSize",null),h.c([Object(F.c)()],t.prototype,"shadowOrthoScale",null),h.c([Object(F.c)()],t.prototype,"autoUpdateExtends",void 0),t}(pr);Se.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return mr.CreateHemisphere(e,r,n)};var mr=function(){function e(){}return e.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=tr.a.CreateSphere("",{slice:.5,diameter:t.diameter,segments:t.segments},i),r=Se.a.CreateDisc("",t.diameter/2,3*t.segments+(4-t.segments),i);r.rotation.x=-Math.PI/2,r.parent=n;var o=Se.a.MergeMeshes([r,n],!0);return o.name=e,o},e}();B.a.AddNodeConstructor("Light_Type_2",function(e,t){return function(){return new gr(e,a.e.Zero(),a.e.Zero(),0,0,t)}});var gr=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,s)||this;return c._innerAngle=0,c._projectionTextureMatrix=a.a.Zero(),c._projectionTextureLightNear=1e-6,c._projectionTextureLightFar=1e3,c._projectionTextureUpDirection=a.e.Up(),c._projectionTextureViewLightDirty=!0,c._projectionTextureProjectionLightDirty=!0,c._projectionTextureDirty=!0,c._projectionTextureViewTargetVector=a.e.Zero(),c._projectionTextureViewLightMatrix=a.a.Zero(),c._projectionTextureProjectionLightMatrix=a.a.Zero(),c._projectionTextureScalingMatrix=a.a.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),c.position=i,c.direction=n,c.angle=r,c.exponent=o,c}return h.d(t,e),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var t=this;if(this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady())){var i=this._projectionTexture;i.onLoadObservable&&i.onLoadObservable.addOnce(function(){t._markMeshesAsLightDirty()})}},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"SpotLight"},t.prototype.getTypeID=function(){return fr.a.LIGHTTYPEID_SPOTLIGHT},t.prototype._setDirection=function(t){e.prototype._setDirection.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setPosition=function(t){e.prototype._setPosition.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){this._shadowAngleScale=this._shadowAngleScale||1;var r=this._shadowAngleScale*this._angle;a.a.PerspectiveFovLHToRef(r,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)}},t.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),a.a.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},t.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),n=-i*t,r=1/Math.tan(this._angle/2);a.a.FromValuesToRef(r/1,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)},t.prototype._computeProjectionTextureMatrix=function(){this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},t.prototype.transferToEffect=function(e,t){var i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=a.e.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=a.e.Normalize(this.direction)),this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightDirection",-i.x,-i.y,-i.z,this._cosHalfAngle,t):this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},t.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},h.c([Object(F.c)()],t.prototype,"angle",null),h.c([Object(F.c)()],t.prototype,"innerAngle",null),h.c([Object(F.c)()],t.prototype,"shadowAngleScale",null),h.c([Object(F.c)()],t.prototype,"exponent",void 0),h.c([Object(F.c)()],t.prototype,"projectionTextureLightNear",null),h.c([Object(F.c)()],t.prototype,"projectionTextureLightFar",null),h.c([Object(F.c)()],t.prototype,"projectionTextureUpDirection",null),h.c([Object(F.m)("projectedLightTexture")],t.prototype,"_projectionTexture",void 0),t}(pr),vr=function(e){function t(t){var i=e.call(this,t)||this;return i.cachedPosition=new a.e,i.cachedForward=new a.e(0,0,1),i._light=null,i.attachedMesh=new Ye.a("",i.gizmoLayer.utilityLayerScene),i._material=new zi.a("light",i.gizmoLayer.originalScene),i._material.diffuseColor=new s.a(.5,.5,.5),i._material.specularColor=new s.a(.1,.1,.1),i}return h.d(t,e),Object.defineProperty(t.prototype,"light",{get:function(){return this._light},set:function(e){var i=this;if(this._light=e,e){this._lightMesh&&this._lightMesh.dispose(),e instanceof Ui.a?this._lightMesh=t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):this._lightMesh=e instanceof _r?t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof gr?t._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene):t._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene),this._lightMesh.getChildMeshes(!1).forEach(function(e){e.material=i._material}),this._lightMesh.parent=this._rootMesh;var n=this.gizmoLayer._getSharedGizmoLight();n.includedOnlyMeshes=n.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)),this._lightMesh.rotationQuaternion=new a.b,this.attachedMesh.reservedDataStore||(this.attachedMesh.reservedDataStore={}),this.attachedMesh.reservedDataStore.lightGizmo=this,e.position&&this.attachedMesh.position.copyFrom(e.position),e.direction&&this.attachedMesh.setDirection(e.direction),this._update()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},enumerable:!0,configurable:!0}),t.prototype._update=function(){e.prototype._update.call(this),this._light&&(this._light.position&&(this.attachedMesh.position.equals(this.cachedPosition)?this.attachedMesh.position.copyFrom(this._light.position):(this._light.position.copyFrom(this.attachedMesh.position),this.cachedPosition.copyFrom(this.attachedMesh.position))),this._light.direction&&(a.e.DistanceSquared(this.attachedMesh.forward,this.cachedForward)>1e-4?(this._light.direction.copyFrom(this.attachedMesh.forward),this.cachedForward.copyFrom(this.attachedMesh.forward)):a.e.DistanceSquared(this.attachedMesh.forward,this._light.direction)>1e-4&&(this.attachedMesh.setDirection(this._light.direction),this.cachedForward.copyFrom(this._lightMesh.forward))),this._light.isEnabled()?this._material.diffuseColor.set(this._light.diffuse.r/3,this._light.diffuse.g/3,this._light.diffuse.b/3):this._material.diffuseColor.set(0,0,0))},t.prototype.dispose=function(){this._material.dispose(),e.prototype.dispose.call(this)},t._CreateHemisphericLightMesh=function(e){var i=new Se.a("hemisphereLight",e),n=mr.CreateHemisphere(i.name,{segments:10,diameter:1},e);n.position.z=-.15,n.rotation.x=Math.PI/2,n.parent=i;var r=this._createLightLines(3,e);return r.parent=i,r.position.z,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreatePointLightMesh=function(e){var i=new Se.a("pointLight",e),n=tr.a.CreateSphere(i.name,{segments:10,diameter:1},e);return n.rotation.x=Math.PI/2,n.parent=i,this._createLightLines(5,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateSpotLightMesh=function(e){var i=new Se.a("spotLight",e);tr.a.CreateSphere(i.name,{segments:10,diameter:1},e).parent=i;var n=mr.CreateHemisphere(i.name,{segments:10,diameter:2},e);return n.parent=i,n.rotation.x=-Math.PI/2,this._createLightLines(2,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateDirectionalLightMesh=function(e){var i=new Se.a("directionalLight",e),n=new Se.a(i.name,e);n.parent=i,tr.a.CreateSphere(i.name,{diameter:1.2,segments:10},e).parent=n;var r=Se.a.CreateCylinder(i.name,6,.3,.3,6,1,e);r.parent=n,(o=r.clone(i.name)).scaling.y=.5,o.position.x+=1.25,(a=r.clone(i.name)).scaling.y=.5,a.position.x+=-1.25;var o,a,s=Se.a.CreateCylinder(i.name,1,0,.6,6,1,e);return s.position.y+=3,s.parent=n,(o=s.clone(i.name)).position.y=1.5,o.position.x+=1.25,(a=s.clone(i.name)).position.y=1.5,a.position.x+=-1.25,n.scaling.scaleInPlace(t._Scale),n.rotation.z=Math.PI/2,n.rotation.y=Math.PI/2,i},t._Scale=.007,t._createLightLines=function(e,t){var i=new Se.a("root",t);i.rotation.x=Math.PI/2;var n=new Se.a("linePivot",t);n.parent=i;var r=Se.a.CreateCylinder("line",2,.2,.3,6,1,t);if(r.position.y=r.scaling.y/2+1.2,r.parent=n,e<2)return n;for(var o=0;o<4;o++){(a=n.clone("lineParentClone")).rotation.z=Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(o=0;o<4;o++){(a=n.clone("linePivotClone")).rotation.z=Math.PI/2,a.rotation.y=Math.PI/2*o}if(e<4)return i;for(o=0;o<4;o++){var a;(a=n.clone("linePivotClone")).rotation.z=Math.PI+Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}return e<5?i:((a=n.clone("linePivotClone")).rotation.z=Math.PI,i)},t}(Jn.a),yr=i(49);ni.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";var br="vec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\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}";ni.a.IncludesShadersStore.packingFunctions=br;var Tr="#ifdef DOF\nfactor=sampleCoC(sampleCoord{X});\ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif";ni.a.IncludesShadersStore.kernelBlurFragment=Tr;var Er="#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif";ni.a.IncludesShadersStore.kernelBlurFragment2=Er;var Ar="\nuniform sampler2D textureSampler;\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(const in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g;\nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth;\n}\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc;\n}\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT;\nfloat factor=0.0;\n\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}";ni.a.ShadersStore.kernelBlurPixelShader=Ar;ni.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";var Pr="\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.kernelBlurVertexShader=Pr;var Sr=function(e){function t(t,i,n,r,o,a,s,c,l,u,h){void 0===a&&(a=$e.a.BILINEAR_SAMPLINGMODE),void 0===l&&(l=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=""),void 0===h&&(h=!1);var d=e.call(this,t,"kernelBlur",["delta","direction","cameraMinMaxZ"],["circleOfConfusionSampler"],r,o,a,s,c,null,l,"kernelBlur",{varyingCount:0,depCount:0},!0)||this;return d.direction=i,d.blockCompilation=h,d._packedFloat=!1,d._staticDefines="",d._staticDefines=u,d.onApplyObservable.add(function(e){d._outputTexture?e.setFloat2("delta",1/d._outputTexture.width*d.direction.x,1/d._outputTexture.height*d.direction.y):e.setFloat2("delta",1/d.width*d.direction.x,1/d.height*d.direction.y)}),d.kernel=n,d}return h.d(t,e),Object.defineProperty(t.prototype,"kernel",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),t.prototype.updateEffect=function(e,t,i,n,r,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._updateParameters(r,o)},t.prototype._updateParameters=function(t,i){for(var n=this._kernel,r=(n-1)/2,o=[],a=[],s=0,c=0;c0)return Math.max(r,3)}return Math.max(t,3)},t.prototype._gaussianWeight=function(e){var t=-e*e/(1/3*2*(1/3));return 1/(Math.sqrt(2*Math.PI)*(1/3))*Math.exp(t)},t.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,"")},t}(oi),Rr=function(e){function t(t,i,n,r,o,s,c){void 0===o&&(o=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=$e.a.BILINEAR_SAMPLINGMODE),void 0===c&&(c=!0);var l=e.call(this,t,i,n,r,!0,o,!1,s,c)||this;return l.scene=n,l.mirrorPlane=new xn.a(0,1,0,1),l._transformMatrix=a.a.Zero(),l._mirrorMatrix=a.a.Zero(),l._adaptiveBlurKernel=0,l._blurKernelX=0,l._blurKernelY=0,l._blurRatio=1,l.ignoreCameraViewport=!0,l._updateGammaSpace(),l._imageProcessingConfigChangeObserver=n.imageProcessingConfiguration.onUpdateParameters.add(function(){l._updateGammaSpace}),l.onBeforeRenderObservable.add(function(){a.a.ReflectionToRef(l.mirrorPlane,l._mirrorMatrix),l._savedViewMatrix=n.getViewMatrix(),l._mirrorMatrix.multiplyToRef(l._savedViewMatrix,l._transformMatrix),n.setTransformMatrix(l._transformMatrix,n.getProjectionMatrix()),n.clipPlane=l.mirrorPlane,n.getEngine().cullBackFaces=!1,n._mirroredCameraPosition=a.e.TransformCoordinates(n.activeCamera.globalPosition,l._mirrorMatrix)}),l.onAfterRenderObservable.add(function(){n.setTransformMatrix(l._savedViewMatrix,n.getProjectionMatrix()),n.getEngine().cullBackFaces=!0,n._mirroredCameraPosition=null,n.clipPlane=null}),l}return h.d(t,e),Object.defineProperty(t.prototype,"blurRatio",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"adaptiveBlurKernel",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernel",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernelX",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernelY",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),t.prototype._autoComputeBlurKernel=function(){var e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth(),i=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*i},t.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},t.prototype._updateGammaSpace=function(){this.gammaSpace=!this.scene.imageProcessingConfiguration.isEnabled||!this.scene.imageProcessingConfiguration.applyByPostProcess},t.prototype._preparePostProcesses=function(){if(this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY){var e=this.getScene().getEngine(),t=e.getCaps().textureFloatRender?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_HALF_FLOAT;this._blurX=new Sr("horizontal blur",new a.d(1,0),this._blurKernelX,this._blurRatio,null,$e.a.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._texture:this._blurX.alwaysForcePOT=!0,this._blurY=new Sr("vertical blur",new a.d(0,1),this._blurKernelY,this._blurRatio,null,$e.a.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)}else this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(n.renderList=this.renderList.slice(0)),n},t.prototype.serialize=function(){if(!this.name)return null;var t=e.prototype.serialize.call(this);return t.mirrorPlane=this.mirrorPlane.asArray(),t},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver)},t}(Oi);$e.a._CreateMirror=function(e,t,i,n){return new Rr(e,t,i,n)};var xr=i(50);Ce.b.prototype._createDepthStencilCubeTexture=function(e,t){var i=new et.a(this,et.a.DATASOURCE_UNKNOWN);if(i.isCube=!0,1===this.webGLVersion)return m.a.Error("Depth cube texture is not supported by WebGL 1."),i;var n=h.a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),r=this._gl;this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,i,!0),this._setupDepthStencilTexture(i,e,n.generateStencil,n.bilinearFiltering,n.comparisonFunction);for(var o=0;o<6;o++)n.generateStencil?r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r.DEPTH24_STENCIL8,e,e,0,r.DEPTH_STENCIL,r.UNSIGNED_INT_24_8,null):r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r.DEPTH_COMPONENT24,e,e,0,r.DEPTH_COMPONENT,r.UNSIGNED_INT,null);return this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,null),i},Ce.b.prototype._partialLoadFile=function(e,t,i,n,r){void 0===r&&(r=null);this._loadFile(e,function(e){i[t]=e,i._internalCount++,6===i._internalCount&&n(i)},void 0,void 0,!0,function(e,t){r&&e&&r(e.status+" "+e.statusText,t)})},Ce.b.prototype._cascadeLoadFiles=function(e,t,i,n){void 0===n&&(n=null);var r=[];r._internalCount=0;for(var o=0;o<6;o++)this._partialLoadFile(i[o],o,r,t,n)},Ce.b.prototype._cascadeLoadImgs=function(e,t,i,n){void 0===n&&(n=null);var r=[];r._internalCount=0;for(var o=0;o<6;o++)this._partialLoadImg(i[o],o,r,e,t,n)},Ce.b.prototype._partialLoadImg=function(e,t,i,n,r,o){var a;void 0===o&&(o=null);a=xr.a.LoadImage(e,function(){i[t]=a,i._internalCount++,n&&n._removePendingData(a),6===i._internalCount&&r(i)},function(e,t){n&&n._removePendingData(a),o&&o(e,t)},n?n.offlineProvider:null),n&&n._addPendingData(a)},Ce.b.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,c,l,u,h,d){var f=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=!1),void 0===l&&(l=0),void 0===u&&(u=0),void 0===h&&(h=null),void 0===d&&(d=[]);var p=this._gl,_=h||new et.a(this,et.a.DATASOURCE_CUBE);_.isCube=!0,_.url=e,_.generateMipMaps=!n,_._lodGenerationScale=l,_._lodGenerationOffset=u,this._doNotHandleContextLost||(_._extension=s,_._files=i);for(var g=e.lastIndexOf("."),v=s||(g>-1?e.substring(g).toLowerCase():""),y=null,b=0,T=Ce.b._TextureLoaders;b-1?t.substring(m).toLowerCase():""),y=".dds"===v,b=".env"===v;if(b?(_.gammaSpace=!1,_._prefiltered=!1):(_._prefiltered=u,u&&(_.gammaSpace=!1)),_._texture=_._getFromCache(t,r),!o&&(b||y||n||(n=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),o=[],n))for(var T=0;T0,o.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,o.LODINREFLECTIONALPHA=s.lodLevelInAlpha,o.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,o.REFLECTIONBGR=this.switchToBGR,s.coordinatesMode===$e.a.INVCUBIC_MODE&&(o.INVERTCUBICMAP=!0),o.REFLECTIONMAP_3D=s.isCube,s.coordinatesMode){case $e.a.EXPLICIT_MODE:o.REFLECTIONMAP_EXPLICIT=!0;break;case $e.a.PLANAR_MODE:o.REFLECTIONMAP_PLANAR=!0;break;case $e.a.PROJECTION_MODE:o.REFLECTIONMAP_PROJECTION=!0;break;case $e.a.SKYBOX_MODE:o.REFLECTIONMAP_SKYBOX=!0,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!s.getReflectionTextureMatrix().isIdentity();break;case $e.a.SPHERICAL_MODE:o.REFLECTIONMAP_SPHERICAL=!0;break;case $e.a.EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case $e.a.CUBIC_MODE:case $e.a.INVCUBIC_MODE:default:o.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(o.REFLECTIONFRESNEL=!0,o.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1)}else o.REFLECTION=!1,o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1,o.REFLECTIONBLUR=!1,o.REFLECTIONMAP_3D=!1,o.REFLECTIONMAP_SPHERICAL=!1,o.REFLECTIONMAP_PLANAR=!1,o.REFLECTIONMAP_CUBIC=!1,o.REFLECTIONMAP_PROJECTION=!1,o.REFLECTIONMAP_SKYBOX=!1,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,o.REFLECTIONMAP_EXPLICIT=!1,o.REFLECTIONMAP_EQUIRECTANGULAR=!1,o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,o.INVERTCUBICMAP=!1,o.REFLECTIONMAP_OPPOSITEZ=!1,o.LODINREFLECTIONALPHA=!1,o.GAMMAREFLECTION=!1,o.RGBDREFLECTION=!1}o.PREMULTIPLYALPHA=this.alphaMode===g.a.ALPHA_PREMULTIPLIED||this.alphaMode===g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,o.USERGBCOLOR=this._useRGBColor,o.NOISE=this._enableNoise}if(o._areLightsDirty&&(o.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel)),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o)}if(Mr.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),Mr.a.PrepareDefinesForFrameBoundValues(r,a,o,i),Mr.a.PrepareDefinesForAttributes(e,o,!1,!0,!1)&&e&&(r.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(Yi.b.NormalKind)||(e.createNormals(!0),m.a.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var c=new ni.c;o.FOG&&c.addFallback(0,"FOG"),o.POINTSIZE&&c.addFallback(1,"POINTSIZE"),o.MULTIVIEW&&c.addFallback(0,"MULTIVIEW"),Mr.a.HandleFallbacksForShadows(o,c,this._maxSimultaneousLights);var l=[Yi.b.PositionKind];o.NORMAL&&l.push(Yi.b.NormalKind),o.UV1&&l.push(Yi.b.UVKind),o.UV2&&l.push(Yi.b.UV2Kind),Mr.a.PrepareAttributesForBones(l,e,o,c),Mr.a.PrepareAttributesForInstances(l,o);var u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"],h=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],d=["Material","Scene"];Gi.a&&(Gi.a.PrepareUniforms(u,o),Gi.a.PrepareSamplers(h,o)),Mr.a.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var f=o.toString();t.setEffect(r.getEngine().createEffect("background",{attributes:l,uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:f,fallbacks:c,onCompiled:function(e){n.onCompiled&&n.onCompiled(e),n.bindSceneUniformBuffer(e,r.getSceneUniformBuffer())},onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},t.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},t.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()},t.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),e.prototype.unbind.call(this)},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i._materialDefines;if(r){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),Mr.a.BindBonesParameters(t,this._activeEffect);var a=this._mustRebind(n,o,t.visibility);if(a){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o);var s=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(n.texturesEnabled&&(this._diffuseTexture&&Dr.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Mr.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),s&&Dr.a.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",s.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",s.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset))),this.shadowLevel>0&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),r.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),n.texturesEnabled&&(this._diffuseTexture&&Dr.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),s&&Dr.a.ReflectionTextureEnabled&&(r.REFLECTIONBLUR&&r.TEXTURELODSUPPORT?this._uniformBuffer.setTexture("reflectionSampler",s):r.REFLECTIONBLUR?(this._uniformBuffer.setTexture("reflectionSampler",s._lodTextureMid||s),this._uniformBuffer.setTexture("reflectionSamplerLow",s._lodTextureLow||s),this._uniformBuffer.setTexture("reflectionSamplerHigh",s._lodTextureHigh||s)):this._uniformBuffer.setTexture("reflectionSampler",s),r.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),Mr.a.BindClipPlane(this._activeEffect,n),Mr.a.BindEyePosition(o,n)}!a&&this.isFrozen||(n.lightsEnabled&&Mr.a.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,!1),this.bindView(o),Mr.a.BindFogParameters(n,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._reflectionTexture===t||this._diffuseTexture===t)},t.prototype.dispose=function(t,i){void 0===t&&(t=!1),void 0===i&&(i=!1),i&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return F.a.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=F.a.Serialize(this);return e.customType="BABYLON.BackgroundMaterial",e},t.prototype.getClassName=function(){return"BackgroundMaterial"},t.Parse=function(e,i,n){return F.a.Parse(function(){return new t(e.name,i)},e,i,n)},t.StandardReflectance0=.05,t.StandardReflectance90=.5,h.c([Object(F.e)()],t.prototype,"_primaryColor",void 0),h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColor",void 0),h.c([Object(F.e)()],t.prototype,"__perceptualColor",void 0),h.c([Object(F.c)()],t.prototype,"_primaryColorShadowLevel",void 0),h.c([Object(F.c)()],t.prototype,"_primaryColorHighlightLevel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColorHighlightLevel",null),h.c([Object(F.m)()],t.prototype,"_reflectionTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionBlur",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionBlur",void 0),h.c([Object(F.m)()],t.prototype,"_diffuseTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLights",void 0),h.c([Object(F.c)()],t.prototype,"_shadowLevel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLevel",void 0),h.c([Object(F.o)()],t.prototype,"_sceneCenter",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"sceneCenter",void 0),h.c([Object(F.c)()],t.prototype,"_opacityFresnel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityFresnel",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionFresnel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFresnel",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionFalloffDistance",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFalloffDistance",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionAmount",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionAmount",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionReflectance0",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance0",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionReflectance90",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance90",void 0),h.c([Object(F.c)()],t.prototype,"_useRGBColor",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRGBColor",void 0),h.c([Object(F.c)()],t.prototype,"_enableNoise",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableNoise",void 0),h.c([Object(F.c)()],t.prototype,"_maxSimultaneousLights",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"maxSimultaneousLights",void 0),h.c([Object(F.i)()],t.prototype,"_imageProcessingConfiguration",void 0),t}(Ir.a);c.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=Vr;var kr=function(){function e(t,i){var n=this;this._errorHandler=function(e,t){n.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=h.a({},e._getDefaultOptions(),t),this._scene=i,this.onErrorObservable=new o.c,this._setupBackground(),this._setupImageProcessing()}return e._getDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._groundTextureCDNUrl,groundColor:new s.a(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:g.a.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._skyboxTextureCDNUrl,skyboxColor:new s.a(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:a.e.Zero(),setupImageProcessing:!0,environmentTexture:this._environmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(e.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skybox",{get:function(){return this._skybox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ground",{get:function(){return this._ground},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!0,configurable:!0}),e.prototype.updateOptions=function(e){var t=h.a({},this._options,e);this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()},e.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new s.b(e.r,e.g,e.b,1))},e.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},e.prototype._setupEnvironmentTexture=function(){if(!this._scene.environmentTexture)if(this._options.environmentTexture instanceof yr.a)this._scene.environmentTexture=this._options.environmentTexture;else{var e=Cr.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},e.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new Se.a("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},e.prototype._getSceneSize=function(){var e=this,t=this._options.groundSize,i=this._options.skyboxSize,n=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:t,skyboxSize:i,rootPosition:n};var r=this._scene.getWorldExtends(function(t){return t!==e._ground&&t!==e._rootMesh&&t!==e._skybox}),o=r.max.subtract(r.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof wt&&this._scene.activeCamera.upperRadiusLimit&&(i=t=2*this._scene.activeCamera.upperRadiusLimit);var a=o.length();a>t&&(i=t=2*a),t*=1.1,i*=1.5,(n=r.min.add(o.scale(.5))).y=r.min.y-this._options.groundYBias}return{groundSize:t,skyboxSize:i,rootPosition:n}},e.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=Se.a.CreatePlane("BackgroundPlane",e.groundSize,this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add(function(){t._ground=null})),this._ground.receiveShadows=this._options.enableGroundShadow},e.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new Vr("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},e.prototype._setupGroundDiffuseTexture=function(){if(this._groundMaterial&&!this._groundTexture)if(this._options.groundTexture instanceof yr.a)this._groundMaterial.diffuseTexture=this._options.groundTexture;else{var e=new $e.a(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler);e.gammaSpace=!1,e.hasAlpha=!0,this._groundMaterial.diffuseTexture=e}},e.prototype._setupGroundMirrorTexture=function(e){var t=$e.a.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new Rr("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,$e.a.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new xn.a(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.gammaSpace=!1,this._groundMirror.renderList))for(var i=0;i\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";ni.a.ShadersStore.rgbdDecodePixelShader=zr;var jr=function(){function e(){}return e._ExpandDefaultBRDFTexture=function(e){var t=e.getEngine(),i=t.getCaps(),n=!1;if(i.textureHalfFloatRender&&i.textureHalfFloatLinearFiltering?(n=!0,e.type=g.a.TEXTURETYPE_HALF_FLOAT):i.textureFloatRender&&i.textureFloatLinearFiltering&&(n=!0,e.type=g.a.TEXTURETYPE_FLOAT),n){e.isReady=!1;var r=new oi("rgbdDecode","rgbdDecode",null,null,1,null,g.a.TEXTURE_TRILINEAR_SAMPLINGMODE,t,!1,void 0,e.type,void 0,null,!1);e._isRGBD=!1,e.invertY=!1;var o=t.createRenderTargetTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:g.a.TEXTURE_BILINEAR_SAMPLINGMODE,type:e.type,format:g.a.TEXTUREFORMAT_RGBA});r.getEffect().executeWhenCompiled(function(){r.onApply=function(t){t._bindTexture("textureSampler",e),t.setFloat2("scale",1,1)},t.scenes[0].postProcessManager.directRender([r],o,!0),t.restoreDefaultFramebuffer(),t._releaseTexture(e),t._releaseFramebufferObjects(o),r&&r.dispose(),o._swapAndDie(e),e.isReady=!0})}},e.GetEnvironmentBRDFTexture=function(e){var t=this;if(!e.environmentBRDFTexture){var i=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;var n=$e.a.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture",e,!0,!1,$e.a.BILINEAR_SAMPLINGMODE);n._texture._isRGBD=!0,n.wrapU=$e.a.CLAMP_ADDRESSMODE,n.wrapV=$e.a.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=i,n.onLoadObservable.addOnce(function(){t._ExpandDefaultBRDFTexture(n._texture)})}return e.environmentBRDFTexture},e._environmentBRDFBase64Texture="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==",e}(),Wr=function(){function e(t){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=e._DefaultIndexOfRefraction,this.indexOfRefraction=e._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=s.a.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=t}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Dr.a.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(t,i){this._isEnabled?(t.CLEARCOAT=!0,t._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Dr.a.ClearCoatTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,t,"CLEARCOAT_TEXTURE"):t.CLEARCOAT_TEXTURE=!1,this._bumpTexture&&Dr.a.ClearCoatBumpTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._bumpTexture,t,"CLEARCOAT_BUMP"):t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===e._DefaultIndexOfRefraction,this._isTintEnabled?(t.CLEARCOAT_TINT=!0,this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._tintTexture,t,"CLEARCOAT_TINT_TEXTURE"):t.CLEARCOAT_TINT_TEXTURE=!1):(t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1))):(t.CLEARCOAT=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i,n,r,o,a){if(!e.useUbo||!r||!e.isSync){this._texture&&Dr.a.ClearCoatTextureEnabled&&(e.updateFloat2("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"clearCoat")),this._bumpTexture&&i.getCaps().standardDerivatives&&Dr.a.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),Mr.a.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,a?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,a?-1:1)),this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),Mr.a.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);var s=1-this._indexOfRefraction,c=1+this._indexOfRefraction,l=Math.pow(-s/c,2),u=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",l,u,s,c),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&Dr.a.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._bumpTexture&&i.getCaps().standardDerivatives&&Dr.a.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},e.prototype.hasTexture=function(e){return this._texture===e||(this._bumpTexture===e||this._tintTexture===e)},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},e.prototype.dispose=function(e){e&&(this._texture&&this._texture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._tintTexture&&this._tintTexture.dispose())},e.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},e.AddFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},e.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},e.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatBumpSampler","clearCoatTintSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vClearCoatParams",2),e.addUniform("vClearCoatRefractionParams",4),e.addUniform("vClearCoatInfos",2),e.addUniform("clearCoatMatrix",16),e.addUniform("vClearCoatBumpInfos",2),e.addUniform("vClearCoatTangentSpaceParams",2),e.addUniform("clearCoatBumpMatrix",16),e.addUniform("vClearCoatTintParams",4),e.addUniform("clearCoatColorAtDistance",1),e.addUniform("vClearCoatTintInfos",2),e.addUniform("clearCoatTintMatrix",16)},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},e._DefaultIndexOfRefraction=1.5,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.c)()],e.prototype,"roughness",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"bumpTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTintEnabled",void 0),h.c([Object(F.e)()],e.prototype,"tintColor",void 0),h.c([Object(F.c)()],e.prototype,"tintColorAtDistance",void 0),h.c([Object(F.c)()],e.prototype,"tintThickness",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"tintTexture",void 0),e}(),Hr=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new a.d(1,0),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Dr.a.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(Yi.b.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Dr.a.AnisotropicTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Dr.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Dr.a.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},e.AddFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},e.AddUniforms=function(e){e.push("vAnisotropy","vAnisotropyInfos","anisotropyMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vAnisotropy",3),e.addUniform("vAnisotropyInfos",2),e.addUniform("anisotropyMatrix",16)},e.AddSamplers=function(e){e.push("anisotropySampler")},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.n)()],e.prototype,"direction",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Xr=function(){function e(t){this._useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this._internalMarkAllSubMeshesAsMiscDirty=t}return e.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},e.prototype.prepareDefines=function(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics},e.prototype.getClassName=function(){return"PBRBRDFConfiguration"},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},e.DEFAULT_USE_ENERGY_CONSERVATION=!0,e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,e.DEFAULT_USE_SPHERICAL_HARMONICS=!0,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useEnergyConservation",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSmithVisibilityHeightCorrelated",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSphericalHarmonics",void 0),e}(),Yr=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=s.a.White(),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Dr.a.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t){this._isEnabled?(e.SHEEN=this._isEnabled,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Dr.a.SheenTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"):e.SHEEN_TEXTURE=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_LINKWITHALBEDO=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Dr.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity)),t.texturesEnabled&&this._texture&&Dr.a.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRSheenConfiguration"},e.AddFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},e.AddUniforms=function(e){e.push("vSheenColor","vSheenInfos","sheenMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vSheenColor",4),e.addUniform("vSheenInfos",2),e.addUniform("sheenMatrix",16)},e.AddSamplers=function(e){e.push("sheenSampler")},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkSheenWithAlbedo",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.e)()],e.prototype,"color",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Kr=function(){function e(e){this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.refractionIntensity=1,this.translucencyIntensity=1,this.scatteringIntensity=1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1,this.indexOfRefraction=1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.tintColor=s.a.White(),this.tintColorAtDistance=1,this.diffusionDistance=s.a.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Dr.a.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){if(e._areTexturesDirty&&(e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_SCATERRING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_REFRACTION=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(e.SUBSURFACE=!0,e._areTexturesDirty&&t.texturesEnabled&&this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&Mr.a.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),e.SS_MASK_FROM_THICKNESS_TEXTURE=this._useMaskFromThicknessTexture),this._isRefractionEnabled&&t.texturesEnabled)){var i=this._getRefractionTexture(t);i&&Dr.a.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency)}},e.prototype.bindForSubMesh=function(e,t,i,n,r){var o=this._getRefractionTexture(t);if(!e.useUbo||!n||!e.isSync){if(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),Mr.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),o&&Dr.a.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",o.getReflectionTextureMatrix());var a=1;o.isCube||o.depth&&(a=o.depth),e.updateFloat4("vRefractionInfos",o.level,1/this._indexOfRefraction,a,this._invertRefractionY?-1:1),e.updateFloat3("vRefractionMicrosurfaceInfos",o.getSize().width,o.lodGenerationScale,o.lodGenerationOffset)}e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,this.tintColorAtDistance),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,this.scatteringIntensity)}t.texturesEnabled&&(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),o&&Dr.a.RefractionTextureEnabled&&(r?e.setTexture("refractionSampler",o):(e.setTexture("refractionSampler",o._lodTextureMid||o),e.setTexture("refractionSamplerLow",o._lodTextureLow||o),e.setTexture("refractionSamplerHigh",o._lodTextureHigh||o))))},e.prototype.unbind=function(e){return!(!this._refractionTexture||!this._refractionTexture.isRenderTarget)&&(e.setTexture("refractionSampler",null),!0)},e.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(e.prototype,"disableAlphaBlending",{get:function(){return this.isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!0,configurable:!0}),e.prototype.fillRenderTargetTextures=function(e){Dr.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},e.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},e.prototype.hasRenderTargetTextures=function(){return!!(Dr.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},e.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},e.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)},e.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},e.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},e.AddFallbacks=function(e,t,i){return e.SS_SCATERRING&&t.addFallback(i++,"SS_SCATERRING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},e.AddUniforms=function(e){e.push("vDiffusionDistance","vTintColor","vSubSurfaceIntensity","vRefractionMicrosurfaceInfos","vRefractionInfos","vThicknessInfos","vThicknessParam","refractionMatrix","thicknessMatrix")},e.AddSamplers=function(e){e.push("thicknessSampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},e.PrepareUniformBuffer=function(e){e.addUniform("vRefractionMicrosurfaceInfos",3),e.addUniform("vRefractionInfos",4),e.addUniform("refractionMatrix",16),e.addUniform("vThicknessInfos",2),e.addUniform("thicknessMatrix",16),e.addUniform("vThicknessParam",2),e.addUniform("vDiffusionDistance",3),e.addUniform("vTintColor",4),e.addUniform("vSubSurfaceIntensity",3)},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isRefractionEnabled",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTranslucencyEnabled",void 0),h.c([Object(F.c)()],e.prototype,"refractionIntensity",void 0),h.c([Object(F.c)()],e.prototype,"translucencyIntensity",void 0),h.c([Object(F.c)()],e.prototype,"scatteringIntensity",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"thicknessTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"refractionTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertRefractionY",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkRefractionWithTransparency",void 0),h.c([Object(F.c)()],e.prototype,"minimumThickness",void 0),h.c([Object(F.c)()],e.prototype,"maximumThickness",void 0),h.c([Object(F.e)()],e.prototype,"tintColor",void 0),h.c([Object(F.c)()],e.prototype,"tintColorAtDistance",void 0),h.c([Object(F.e)()],e.prototype,"diffusionDistance",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTexture",void 0),e}(),Qr="uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\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 REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif";ni.a.IncludesShadersStore.pbrFragmentDeclaration=Qr;var qr="layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec2 vAlbedoInfos;\nuniform vec4 vAmbientInfos;\nuniform vec2 vOpacityInfos;\nuniform vec2 vEmissiveInfos;\nuniform vec2 vLightmapInfos;\nuniform vec3 vReflectivityInfos;\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform vec2 vReflectionInfos;\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\nuniform vec3 vBumpInfos;\nuniform mat4 albedoMatrix;\nuniform mat4 ambientMatrix;\nuniform mat4 opacityMatrix;\nuniform mat4 emissiveMatrix;\nuniform mat4 lightmapMatrix;\nuniform mat4 reflectivityMatrix;\nuniform mat4 microSurfaceSamplerMatrix;\nuniform mat4 bumpMatrix;\nuniform vec2 vTangentSpaceParams;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float pointSize;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\nuniform vec3 vAnisotropy;\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\nuniform vec4 vSheenColor;\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};";ni.a.IncludesShadersStore.pbrUboDeclaration=qr;var Zr="uniform vec4 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vCameraInfos;\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif";ni.a.IncludesShadersStore.pbrFragmentExtraDeclaration=Zr;var Jr="#ifdef ALBEDO\n#if ALBEDODIRECTUV == 1\n#define vAlbedoUV vMainUV1\n#elif ALBEDODIRECTUV == 2\n#define vAlbedoUV vMainUV2\n#else\nvarying vec2 vAlbedoUV;\n#endif\nuniform sampler2D albedoSampler;\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 REFLECTIVITY\n#if REFLECTIVITYDIRECTUV == 1\n#define vReflectivityUV vMainUV1\n#elif REFLECTIVITYDIRECTUV == 2\n#define vReflectivityUV vMainUV2\n#else\nvarying vec2 vReflectivityUV;\n#endif\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef MICROSURFACEMAP\n#if MICROSURFACEMAPDIRECTUV == 1\n#define vMicroSurfaceSamplerUV vMainUV1\n#elif MICROSURFACEMAPDIRECTUV == 2\n#define vMicroSurfaceSamplerUV vMainUV2\n#else\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\nuniform sampler2D microSurfaceSampler;\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\n#define vClearCoatUV vMainUV1\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\n#define vClearCoatUV vMainUV2\n#else\nvarying vec2 vClearCoatUV;\n#endif\nuniform sampler2D clearCoatSampler;\n#endif\n#ifdef CLEARCOAT_BUMP\n#if CLEARCOAT_BUMPDIRECTUV == 1\n#define vClearCoatBumpUV vMainUV1\n#elif CLEARCOAT_BUMPDIRECTUV == 2\n#define vClearCoatBumpUV vMainUV2\n#else\nvarying vec2 vClearCoatBumpUV;\n#endif\nuniform sampler2D clearCoatBumpSampler;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\n#define vClearCoatTintUV vMainUV1\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\n#define vClearCoatTintUV vMainUV2\n#else\nvarying vec2 vClearCoatTintUV;\n#endif\nuniform sampler2D clearCoatTintSampler;\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\n#if SHEEN_TEXTUREDIRECTUV == 1\n#define vSheenUV vMainUV1\n#elif SHEEN_TEXTUREDIRECTUV == 2\n#define vSheenUV vMainUV2\n#else\nvarying vec2 vSheenUV;\n#endif\nuniform sampler2D sheenSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\n#define vAnisotropyUV vMainUV1\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\n#define vAnisotropyUV vMainUV2\n#else\nvarying vec2 vAnisotropyUV;\n#endif\nuniform sampler2D anisotropySampler;\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;\nuniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\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#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\n#define vThicknessUV vMainUV1\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\n#define vThicknessUV vMainUV2\n#else\nvarying vec2 vThicknessUV;\n#endif\nuniform sampler2D thicknessSampler;\n#endif\n#endif";ni.a.IncludesShadersStore.pbrFragmentSamplersDeclaration=Jr;i(101);var $r="\n#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\n\n\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\n\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\n\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\n\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n\n\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\n\n\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\n\n\n\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\n\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\n\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n\n\n\n\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif";ni.a.IncludesShadersStore.pbrHelperFunctions=$r;var eo="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n\n\n\n\n\n\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+vSphericalL1_1*(normal.y)\n+vSphericalL10*(normal.z)\n+vSphericalL11*(normal.x)\n+vSphericalL2_2*(normal.y*normal.x)\n+vSphericalL2_1*(normal.y*normal.z)\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+vSphericalL21*(normal.z*normal.x)\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\n\n\n\n\n\n\n\n\n\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz*Nz+C1;\nvec3 t2=a2*Ny+t1;\nvec3 t3=b3*Nx+t2;\nreturn t3;\n}\n#endif\n#endif";ni.a.IncludesShadersStore.harmonicsFunctions=eo;var to="\nstruct preLightingInfo\n{\n\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\n\nfloat attenuation;\n\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\n\nresult.lightDistance=sqrt(result.lightDistanceSquared);\n\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightDistance=length(-lightData.xyz);\n\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\n\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}";ni.a.IncludesShadersStore.pbrDirectLightingSetupFunctions=to;var io="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\n\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\n\n\n\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\n\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}";ni.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions=io;var no="\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness,sampler2D brdfSampler) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(brdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(REFLECTION)\n\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\n\n\n\n\n\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn t*t;\n#endif\n}\n#endif\n\n\n\n\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n\n\n\n\n#ifdef BRDF_V_HEIGHT_CORRELATED\n\n\n\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\n\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\n\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\n\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\n\n\n\nreturn 0.25/(VdotH*VdotH);\n}\n#endif\n#ifdef SHEEN\n\n\n\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\n\n\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\n\n\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\n\n\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n";ni.a.IncludesShadersStore.pbrBRDFFunctions=no;var ro="#define CLEARCOATREFLECTANCE90 1.0\n\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\n\n\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\n\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\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 toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\n\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\n\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat visibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat visibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat visibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat visibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*visibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n\n\nvec3 fresnel=reflectance0;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\nvec3 sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n";ni.a.IncludesShadersStore.pbrDirectLightingFunctions=ro;var oo="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,normal));\nreturn square(temp);\n}\n#endif\n\n\n\n\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n\n\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\n\n\n\n\n\n\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif";ni.a.IncludesShadersStore.pbrIBLFunctions=oo;i(139),i(140),i(141),i(133);var ao="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w=1)&&e.prototype.needAlphaBlendingForMesh.call(this,t)},t.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||!this.subSurface.disableAlphaBlending&&(null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&(null==this._transparencyMode||this._transparencyMode===t.PBRMATERIAL_ALPHATEST))},t.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==t.PBRMATERIAL_OPAQUE},t.prototype.getAlphaTestTexture=function(){return this._albedoTexture},t.prototype.isReadyForSubMesh=function(e,t,i){if(t.effect&&this.isFrozen&&this._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new uo);var n=t._materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&n._renderId===this.getScene().getRenderId())return!0;var r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&r.texturesEnabled){if(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&Dr.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&Dr.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&Dr.a.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(Dr.a.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&Dr.a.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(!(this.subSurface.isReadyForSubMesh(n,r)&&this.clearCoat.isReadyForSubMesh(n,r,o,this._disableBumpMap)&&this.sheen.isReadyForSubMesh(n,r)&&this.anisotropy.isReadyForSubMesh(n,r)))return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(Yi.b.NormalKind)||(e.createNormals(!0),m.a.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var s=t.effect,c=this._prepareEffect(e,n,this.onCompiled,this.onError,i);return c&&(this.allowShaderHotSwapping&&s&&!c.isReady()?(c=s,n.markAsUnprocessed()):(r.resetCachedMaterial(),t.setEffect(c,n),this.buildUniformLayout())),!(!t.effect||!t.effect.isReady())&&(n._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},t.prototype._prepareEffect=function(e,t,i,n,r,o){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),this._prepareDefines(e,t,r,o),!t.isDirty)return null;t.markAsProcessed();var a=this.getScene().getEngine(),s=new ni.c,c=0;t.USESPHERICALINVERTEX&&s.addFallback(c++,"USESPHERICALINVERTEX"),t.FOG&&s.addFallback(c,"FOG"),t.SPECULARAA&&s.addFallback(c,"SPECULARAA"),t.POINTSIZE&&s.addFallback(c,"POINTSIZE"),t.LOGARITHMICDEPTH&&s.addFallback(c,"LOGARITHMICDEPTH"),t.PARALLAX&&s.addFallback(c,"PARALLAX"),t.PARALLAXOCCLUSION&&s.addFallback(c++,"PARALLAXOCCLUSION"),c=Hr.AddFallbacks(t,s,c),c=Hr.AddFallbacks(t,s,c),c=Kr.AddFallbacks(t,s,c),c=Yr.AddFallbacks(t,s,c),t.ENVIRONMENTBRDF&&s.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&s.addFallback(c++,"TANGENT"),t.BUMP&&s.addFallback(c++,"BUMP"),c=Mr.a.HandleFallbacksForShadows(t,s,this._maxSimultaneousLights,c++),t.SPECULARTERM&&s.addFallback(c++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&s.addFallback(c++,"USESPHERICALFROMREFLECTIONMAP"),t.USEIRRADIANCEMAP&&s.addFallback(c++,"USEIRRADIANCEMAP"),t.LIGHTMAP&&s.addFallback(c++,"LIGHTMAP"),t.NORMAL&&s.addFallback(c++,"NORMAL"),t.AMBIENT&&s.addFallback(c++,"AMBIENT"),t.EMISSIVE&&s.addFallback(c++,"EMISSIVE"),t.VERTEXCOLOR&&s.addFallback(c++,"VERTEXCOLOR"),t.MORPHTARGETS&&s.addFallback(c++,"MORPHTARGETS"),t.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");var l=[Yi.b.PositionKind];t.NORMAL&&l.push(Yi.b.NormalKind),t.TANGENT&&l.push(Yi.b.TangentKind),t.UV1&&l.push(Yi.b.UVKind),t.UV2&&l.push(Yi.b.UV2Kind),t.VERTEXCOLOR&&l.push(Yi.b.ColorKind),Mr.a.PrepareAttributesForBones(l,e,t,s),Mr.a.PrepareAttributesForInstances(l,t),Mr.a.PrepareAttributesForMorphTargets(l,e,t);var u="pbr",h=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vEmissiveColor","visibility","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","vLightingIntensity","logarithmicDepthConstant","vSphericalX","vSphericalY","vSphericalZ","vSphericalXX_ZZ","vSphericalYY_ZZ","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vSphericalL00","vSphericalL1_1","vSphericalL10","vSphericalL11","vSphericalL2_2","vSphericalL2_1","vSphericalL20","vSphericalL21","vSphericalL22","vReflectionMicrosurfaceInfos","vTangentSpaceParams","boneTextureWidth","vDebugMode"],d=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","microSurfaceSampler","environmentBrdfSampler","boneSampler"],f=["Material","Scene"];Kr.AddUniforms(h),Kr.AddSamplers(d),Wr.AddUniforms(h),Wr.AddSamplers(d),Hr.AddUniforms(h),Hr.AddSamplers(d),Yr.AddUniforms(h),Yr.AddSamplers(d),Gi.a&&(Gi.a.PrepareUniforms(h,t),Gi.a.PrepareSamplers(d,t)),Mr.a.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:f,samplers:d,defines:t,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(u=this.customShaderNameResolve(u,h,f,d,t));var p=t.toString();return a.createEffect(u,{attributes:l,uniformsNames:h,uniformBuffersNames:f,samplers:d,defines:p,fallbacks:s,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS}},a)},t.prototype._prepareDefines=function(e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o=this.getScene(),a=o.getEngine();if(Mr.a.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,Mr.a.PrepareDefinesForMultiview(o,i),i.METALLICWORKFLOW=this.isMetallicWorkflow(),i._areTexturesDirty){if(i._needUVs=!1,o.texturesEnabled){o.getEngine().getCaps().textureLOD&&(i.LODBASEDMICROSFURACE=!0),this._albedoTexture&&Dr.a.DiffuseTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._albedoTexture,i,"ALBEDO"):i.ALBEDO=!1,this._ambientTexture&&Dr.a.AmbientTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&Dr.a.OpacityTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var s=this._getReflectionTexture();if(s&&Dr.a.ReflectionTextureEnabled){switch(i.REFLECTION=!0,i.GAMMAREFLECTION=s.gammaSpace,i.RGBDREFLECTION=s.isRGBD,i.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,i.LODINREFLECTIONALPHA=s.lodLevelInAlpha,i.LINEARSPECULARREFLECTION=s.linearSpecularLOD,s.coordinatesMode===$e.a.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=s.isCube,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,s.coordinatesMode){case $e.a.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case $e.a.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case $e.a.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case $e.a.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case $e.a.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case $e.a.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case $e.a.CUBIC_MODE:case $e.a.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!s.boundingBoxSize}s.coordinatesMode!==$e.a.SKYBOX_MODE?s.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1):s.sphericalPolynomial&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||o.getEngine().getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0):i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!s.getReflectionTextureMatrix().isIdentity()}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&Dr.a.LightmapTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace):i.LIGHTMAP=!1,this._emissiveTexture&&Dr.a.EmissiveTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Dr.a.SpecularTextureEnabled?(this._metallicTexture?(Mr.a.PrepareDefinesForMergedUV(this._metallicTexture,i,"REFLECTIVITY"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(Mr.a.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._microSurfaceTexture?Mr.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap?(Mr.a.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Dr.a.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Dr.a.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===t.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===t.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.SPECULARAA=o.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),i.PREMULTIPLYALPHA=this.alphaMode===g.a.ALPHA_PREMULTIPLIED||this.alphaMode===g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(Mr.a.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,i),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(Yi.b.NormalKind),i.DEBUGMODE=this._debugMode),this.subSurface.prepareDefines(i,o),this.clearCoat.prepareDefines(i,o),this.anisotropy.prepareDefines(i,e,o),this.brdf.prepareDefines(i),this.sheen.prepareDefines(i,o),Mr.a.PrepareDefinesForFrameBoundValues(o,a,i,!!n,r),Mr.a.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=h.a({clipPlane:!1},i),o=new uo,a=this._prepareEffect(e,o,void 0,void 0,void 0,r.clipPlane);a.isReady()?t&&t(this):a.onCompileObservable.add(function(){t&&t(n)})},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),Wr.PrepareUniformBuffer(e),Hr.PrepareUniformBuffer(e),Yr.PrepareUniformBuffer(e),Kr.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this.subSurface.unbind(this._activeEffect)&&(t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var a=n.effect;if(a){this._activeEffect=a,o.INSTANCES||this.bindOnlyWorldMatrix(e),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var c=this._mustRebind(r,a,i.visibility);Mr.a.BindBonesParameters(i,this._activeEffect);var l=null,u=this._uniformBuffer;if(c){var h=r.getEngine();if(u.bindToEffect(a,"Material"),this.bindViewProjection(a),l=this._getReflectionTexture(),!u.useUbo||!this.isFrozen||!u.isSync){if(r.texturesEnabled){if(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),Mr.a.BindTextureMatrix(this._albedoTexture,u,"albedo")),this._ambientTexture&&Dr.a.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),Mr.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&Dr.a.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Mr.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),l&&Dr.a.ReflectionTextureEnabled){if(u.updateMatrix("reflectionMatrix",l.getReflectionTextureMatrix()),u.updateFloat2("vReflectionInfos",l.level,0),l.boundingBoxSize){var d=l;u.updateVector3("vReflectionPosition",d.boundingBoxPosition),u.updateVector3("vReflectionSize",d.boundingBoxSize)}if(!o.USEIRRADIANCEMAP){var f=l.sphericalPolynomial;if(o.USESPHERICALFROMREFLECTIONMAP&&f)if(o.SPHERICAL_HARMONICS){var p=f.preScaledHarmonics;this._activeEffect.setVector3("vSphericalL00",p.l00),this._activeEffect.setVector3("vSphericalL1_1",p.l1_1),this._activeEffect.setVector3("vSphericalL10",p.l10),this._activeEffect.setVector3("vSphericalL11",p.l11),this._activeEffect.setVector3("vSphericalL2_2",p.l2_2),this._activeEffect.setVector3("vSphericalL2_1",p.l2_1),this._activeEffect.setVector3("vSphericalL20",p.l20),this._activeEffect.setVector3("vSphericalL21",p.l21),this._activeEffect.setVector3("vSphericalL22",p.l22)}else this._activeEffect.setFloat3("vSphericalX",f.x.x,f.x.y,f.x.z),this._activeEffect.setFloat3("vSphericalY",f.y.x,f.y.y,f.y.z),this._activeEffect.setFloat3("vSphericalZ",f.z.x,f.z.y,f.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",f.xx.x-f.zz.x,f.xx.y-f.zz.y,f.xx.z-f.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",f.yy.x-f.zz.x,f.yy.y-f.zz.y,f.yy.z-f.zz.z),this._activeEffect.setFloat3("vSphericalZZ",f.zz.x,f.zz.y,f.zz.z),this._activeEffect.setFloat3("vSphericalXY",f.xy.x,f.xy.y,f.xy.z),this._activeEffect.setFloat3("vSphericalYZ",f.yz.x,f.yz.y,f.yz.z),this._activeEffect.setFloat3("vSphericalZX",f.zx.x,f.zx.y,f.zx.z)}u.updateFloat3("vReflectionMicrosurfaceInfos",l.getSize().width,l.lodGenerationScale,l.lodGenerationOffset)}this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Mr.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Mr.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),Dr.a.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),Mr.a.BindTextureMatrix(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),Mr.a.BindTextureMatrix(this._reflectivityTexture,u,"reflectivity")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),Mr.a.BindTextureMatrix(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),Mr.a.BindTextureMatrix(this._bumpTexture,u,"bump"),r._mirroredCameraPosition?u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}this.pointsCloud&&u.updateFloat("pointSize",this.pointSize),o.METALLICWORKFLOW?(s.c.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,s.c.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,u.updateColor4("vReflectivityColor",s.c.Color3[0],0)):u.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),u.updateColor3("vEmissiveColor",Dr.a.EmissiveTextureEnabled?this._emissiveColor:s.a.BlackReadOnly),u.updateColor3("vReflectionColor",this._reflectionColor),!o.SS_REFRACTION&&this.subSurface.linkRefractionWithTransparency?u.updateColor4("vAlbedoColor",this._albedoColor,1):u.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),u.updateFloat("visibility",i.visibility),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*r.environmentIntensity,this._lightingInfos.w=this._specularIntensity,u.updateVector4("vLightingIntensity",this._lightingInfos)}r.texturesEnabled&&(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Dr.a.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Dr.a.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),l&&Dr.a.ReflectionTextureEnabled&&(o.LODBASEDMICROSFURACE?u.setTexture("reflectionSampler",l):(u.setTexture("reflectionSampler",l._lodTextureMid||l),u.setTexture("reflectionSamplerLow",l._lodTextureLow||l),u.setTexture("reflectionSamplerHigh",l._lodTextureHigh||l)),o.USEIRRADIANCEMAP&&u.setTexture("irradianceSampler",l.irradianceTexture)),o.ENVIRONMENTBRDF&&u.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),Dr.a.SpecularTextureEnabled&&(this._metallicTexture?u.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&u.setTexture("reflectivitySampler",this._reflectivityTexture),this._microSurfaceTexture&&u.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&h.getCaps().standardDerivatives&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&u.setTexture("bumpSampler",this._bumpTexture)),this.subSurface.bindForSubMesh(u,r,h,this.isFrozen,o.LODBASEDMICROSFURACE),this.clearCoat.bindForSubMesh(u,r,h,this._disableBumpMap,this.isFrozen,this._invertNormalMapX,this._invertNormalMapY),this.anisotropy.bindForSubMesh(u,r,this.isFrozen),this.sheen.bindForSubMesh(u,r,this.isFrozen),Mr.a.BindClipPlane(this._activeEffect,r),r.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var _=r._forcedViewPosition?r._forcedViewPosition:r._mirroredCameraPosition?r._mirroredCameraPosition:r.activeCamera.globalPosition,m=r.useRightHandedSystem===(null!=r._mirroredCameraPosition);a.setFloat4("vEyePosition",_.x,_.y,_.z,m?-1:1),a.setColor3("vAmbientColor",this._globalAmbientColor),a.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)}!c&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&Mr.a.BindLights(r,i,this._activeEffect,o,this._maxSimultaneousLights,this._lightFalloff!==t.LIGHTFALLOFF_STANDARD),(r.fogEnabled&&i.applyFog&&r.fogMode!==K.a.FOGMODE_NONE||l)&&this.bindView(a),Mr.a.BindFogParameters(r,i,this._activeEffect,!0),o.NUM_MORPH_INFLUENCERS&&Mr.a.BindMorphTargetParameters(i,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),Mr.a.BindLogDepth(o,this._activeEffect,r)),u.update(),this._afterBind(i,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),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._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),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.subSurface.getAnimatables(e),this.clearCoat.getAnimatables(e),this.sheen.getAnimatables(e),this.anisotropy.getAnimatables(e),e},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this.subSurface.getActiveTextures(t),this.clearCoat.getActiveTextures(t),this.sheen.getActiveTextures(t),this.anisotropy.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._albedoTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._reflectivityTexture===t||(this._metallicTexture===t||(this._microSurfaceTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this.subSurface.hasTexture(t)||this.clearCoat.hasTexture(t)||this.sheen.hasTexture(t)||this.anisotropy.hasTexture(t)))))))))))},t.prototype.dispose=function(t,i){i&&(this._albedoTexture&&this._albedoTexture.dispose(),this._ambientTexture&&this._ambientTexture.dispose(),this._opacityTexture&&this._opacityTexture.dispose(),this._reflectionTexture&&this._reflectionTexture.dispose(),this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._emissiveTexture&&this._emissiveTexture.dispose(),this._metallicTexture&&this._metallicTexture.dispose(),this._reflectivityTexture&&this._reflectivityTexture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._lightmapTexture&&this._lightmapTexture.dispose()),this.subSurface.dispose(i),this.clearCoat.dispose(i),this.sheen.dispose(i),this.anisotropy.dispose(i),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.PBRMATERIAL_OPAQUE=0,t.PBRMATERIAL_ALPHATEST=1,t.PBRMATERIAL_ALPHABLEND=2,t.PBRMATERIAL_ALPHATESTANDBLEND=3,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,h.c([Object(F.i)()],t.prototype,"_imageProcessingConfiguration",void 0),h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),h.c([Object(F.c)()],t.prototype,"useLogarithmicDepth",null),h.c([Object(F.c)()],t.prototype,"transparencyMode",null),t}(Ir.a),fo=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.directIntensity=1,r.emissiveIntensity=1,r.environmentIntensity=1,r.specularIntensity=1,r.disableBumpMap=!1,r.ambientTextureStrength=1,r.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r.ambientColor=new s.a(0,0,0),r.albedoColor=new s.a(1,1,1),r.reflectivityColor=new s.a(1,1,1),r.reflectionColor=new s.a(1,1,1),r.emissiveColor=new s.a(0,0,0),r.microSurface=1,r.useLightmapAsShadowmap=!1,r.useAlphaFromAlbedoTexture=!1,r.forceAlphaTest=!1,r.alphaCutOff=.4,r.useSpecularOverAlpha=!0,r.useMicroSurfaceFromReflectivityMapAlpha=!1,r.useRoughnessFromMetallicTextureAlpha=!0,r.useRoughnessFromMetallicTextureGreen=!1,r.useMetallnessFromMetallicTextureBlue=!1,r.useAmbientOcclusionFromMetallicTextureRed=!1,r.useAmbientInGrayScale=!1,r.useAutoMicroSurfaceFromReflectivityMap=!1,r.useRadianceOverAlpha=!0,r.useObjectSpaceNormalMap=!1,r.useParallax=!1,r.useParallaxOcclusion=!1,r.parallaxScaleBias=.05,r.disableLighting=!1,r.forceIrradianceInFragment=!1,r.maxSimultaneousLights=4,r.invertNormalMapX=!1,r.invertNormalMapY=!1,r.twoSidedLighting=!1,r.useAlphaFresnel=!1,r.useLinearAlphaFresnel=!1,r.environmentBRDFTexture=null,r.forceNormalForward=!1,r.enableSpecularAntiAliasing=!1,r.useHorizonOcclusion=!0,r.useRadianceOcclusion=!0,r.unlit=!1,r._environmentBRDFTexture=jr.GetEnvironmentBRDFTexture(n),r}return h.d(t,e),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return 1/this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=1/e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===ho.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ho.LIGHTFALLOFF_PHYSICAL:ho.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===ho.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ho.LIGHTFALLOFF_GLTF:ho.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"PBRMaterial"},t.prototype.clone=function(e){var i=this,n=F.a.Clone(function(){return new t(e,i.getScene())},this);return n.id=e,n.name=e,this.clearCoat.copyTo(n.clearCoat),this.anisotropy.copyTo(n.anisotropy),this.brdf.copyTo(n.brdf),this.sheen.copyTo(n.sheen),n},t.prototype.serialize=function(){var e=F.a.Serialize(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},t.Parse=function(e,i,n){var r=F.a.Parse(function(){return new t(e.name,i)},e,i,n);return e.clearCoat&&r.clearCoat.parse(e.clearCoat,i,n),e.anisotropy&&r.anisotropy.parse(e.anisotropy,i,n),e.brdf&&r.brdf.parse(e.brdf,i,n),e.sheen&&r.sheen.parse(e.sheen,i,n),e.subSurface&&r.subSurface.parse(e.subSurface,i,n),r},t.PBRMATERIAL_OPAQUE=ho.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=ho.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=ho.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=ho.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=ho.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),h.c([Object(F.e)("ambient"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),h.c([Object(F.e)("albedo"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),h.c([Object(F.e)("reflectivity"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),h.c([Object(F.e)("reflection"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),h.c([Object(F.e)("emissive"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),h.c([Object(F.c)()],t.prototype,"usePhysicalLightFalloff",null),h.c([Object(F.c)()],t.prototype,"useGLTFLightFalloff",null),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),t}(ho);c.a.RegisteredTypes["BABYLON.PBRMaterial"]=fo;var po=i(71),_o=i(83);function mo(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var go=mo("DXT1"),vo=mo("DXT3"),yo=mo("DXT5"),bo=mo("DX10"),To=function(){function e(){}return e.GetDDSInfo=function(e){var t=new Int32Array(e,0,31),i=new Int32Array(e,0,35),n=1;131072&t[2]&&(n=Math.max(1,t[7]));var r=t[21],o=r===bo?i[32]:0,a=g.a.TEXTURETYPE_UNSIGNED_INT;switch(r){case 113:a=g.a.TEXTURETYPE_HALF_FLOAT;break;case 116:a=g.a.TEXTURETYPE_FLOAT;break;case bo:if(10===o){a=g.a.TEXTURETYPE_HALF_FLOAT;break}if(2===o){a=g.a.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:131072==(131072&t[20]),isCube:512==(512&t[28]),isCompressed:r===go||r===vo||r===yo,dxgiFormat:o,textureType:a}},e._ToHalfFloat=function(t){e._FloatView||(e._FloatView=new Float32Array(1),e._Int32View=new Int32Array(e._FloatView.buffer)),e._FloatView[0]=t;var i=e._Int32View[0],n=i>>16&32768,r=i>>12&2047,o=i>>23&255;return o<103?n:o>142?(n|=31744,n|=(255==o?0:1)&&8388607&i):o<113?n|=((r|=2048)>>114-o)+(r>>113-o&1):(n|=o-112<<10|r>>1,n+=1&r)},e._FromHalfFloat=function(e){var t=(32768&e)>>15,i=(31744&e)>>10,n=1023&e;return 0===i?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):31==i?n?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+n/Math.pow(2,10))},e._GetHalfFloatAsFloatRGBAArrayBuffer=function(t,i,n,r,o,a){for(var s=new Float32Array(r),c=new Uint16Array(o,n),l=0,u=0;u>8)},e._GetRGBArrayBuffer=function(e,t,i,n,r,o,a,s){for(var c=new Uint8Array(n),l=new Uint8Array(r,i),u=0,h=0;h>8&255,S>>16&255,S>>24&255)))}var C=e._ExtractLongWordOrder(b[23]),M=e._ExtractLongWordOrder(b[24]),O=e._ExtractLongWordOrder(b[25]),I=e._ExtractLongWordOrder(b[26]);R&&(E=t._getRGBABufferInternalSizedFormat(r.textureType)),_=1,131072&b[2]&&!1!==o&&(_=Math.max(1,b[7]));for(var D=c||0;D0?r.sphericalPolynomial=_o.a.ConvertCubeMapToSphericalPolynomial({size:b[4],right:l[0],left:l[1],up:l[2],down:l[3],front:l[4],back:l[5],format:g.a.TEXTUREFORMAT_RGBA,type:g.a.TEXTURETYPE_FLOAT,gammaSpace:!1}):r.sphericalPolynomial=void 0}else m.a.Error("Compressed textures are not supported on this platform.");else m.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else m.a.Error("Invalid magic number in DDS header")},e.StoreLODInAlphaChannel=!1,e}();Ce.b.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r,o,a,s,c){var l=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=!0);return this.createCubeTexture(e,t,null,!1,function(e){if(e){var o=e.texture;if(c?e.info.sphericalPolynomial&&(o._sphericalPolynomial=e.info.sphericalPolynomial):o._sphericalPolynomial=new po.b,o._dataSource=et.a.DATASOURCE_CUBEPREFILTERED,l.getCaps().textureLOD)r&&r(o);else{var a=l._gl,s=e.width;if(s){for(var u=[],h=0;h<3;h++){var d=1-h/2,f=n,p=w.a.Log2(s)*i+n,_=f+(p-f)*d,g=Math.round(Math.min(Math.max(_,0),p)),v=new et.a(l,et.a.DATASOURCE_TEMP);if(v.type=o.type,v.format=o.format,v.width=Math.pow(2,Math.max(w.a.Log2(s)-g,0)),v.height=v.width,v.isCube=!0,l._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),e.isDDS){var y=e.info,b=e.data;l._unpackFlipY(y.isCompressed),To.UploadDDSLevels(l,v,b,y,!0,6,g)}else m.a.Warn("DDS is the only prefiltered cube map supported so far.");l._bindTextureDirectly(a.TEXTURE_CUBE_MAP,null);var T=new yr.a(t);T.isCube=!0,T._texture=v,v.isReady=!0,u.push(T)}o._lodTextureHigh=u[2],o._lodTextureMid=u[1],o._lodTextureLow=u[0],r&&r(o)}}}else r&&r(null)},o,a,s,c,i,n)};var Eo=function(){function e(){this.supportCascades=!0}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".dds")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,n,r){var o,a=t.getEngine(),s=!1;if(Array.isArray(e))for(var c=0;c1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),To.UploadDDSLevels(a,t,l,o,s,6,-1,c),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}else{var u=e;o=To.GetDDSInfo(u),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new po.b),s=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),To.UploadDDSLevels(a,t,u,o,s,6),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}a._setCubeMapTextureParams(s),t.isReady=!0,n&&n({isDDS:!0,width:t.width,info:o,data:e,texture:t})},e.prototype.loadData=function(e,t,i){var n=To.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,function(){To.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},e}();Ce.b._TextureLoaders.push(new Eo);var Ao="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";ni.a.ShadersStore.rgbdEncodePixelShader=Ao;var Po=function(){function e(){}return e.GetEnvInfo=function(t){for(var i=new DataView(t),n=0,r=0;r-1?e.substring(0,i):e)+t},e.prototype.getFallbackTextureUrl=function(e,t){var i=new RegExp(t+"$");return e.replace(i,"")},e.prototype.loadCubeData=function(e,t,i,n,r){if(!Array.isArray(e)){t._invertVScale=!t.invertY;var o=t.getEngine(),a=new Ro(e,6),s=a.numberOfMipmapLevels>1&&t.generateMipMaps;o._unpackFlipY(!0),a.uploadLevels(t,t.generateMipMaps),t.width=a.pixelWidth,t.height=a.pixelHeight,o._setCubeMapTextureParams(s),t.isReady=!0}},e.prototype.loadData=function(e,t,i){t._invertVScale=!t.invertY;var n=new Ro(e,1);i(n.pixelWidth,n.pixelHeight,!1,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)},e}();Ce.b._TextureLoaders.unshift(new xo);var Co=function(){function e(){}return e.CreateAsync=function(t,i){var n=new e;return sn.CreateAsync(t).then(function(e){return n.baseExperience=e,n.input=new dn(e),n.controllerModelLoader=new Sn(n.input),n.pointerSelection=new pn(n.input),n.teleportation=new fn(n.input,i.floorMeshes),n.outputCanvas=new Rn(e,t.getEngine().getRenderingCanvas()),un.CreateAsync(t,n.baseExperience,{webXRManagedOutputCanvas:n.outputCanvas})}).then(function(e){return n.enterExitUI=e,n})},e.prototype.dispose=function(){this.baseExperience&&this.baseExperience.dispose(),this.input&&this.input.dispose(),this.enterExitUI&&this.enterExitUI.dispose(),this.outputCanvas&&this.outputCanvas.dispose()},e}();K.a.prototype.createDefaultLight=function(e){if(void 0===e&&(e=!1),e&&this.lights)for(var t=0;t=c.video.HAVE_CURRENT_DATA;return!s.poster||s.autoPlay&&l?l&&c._createInternalTexture():(c._texture=c._engine.createTexture(s.poster,!1,!0,n),c._displayingPosterTexture=!0),c}return h.d(t,e),Object.defineProperty(t.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new o.c),this._onUserActionRequestedObservable},enumerable:!0,configurable:!0}),t.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},t.prototype._getVideo=function(e){if(e instanceof HTMLVideoElement)return Ie.b.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement("video");return"string"==typeof e?(Ie.b.SetCorsBehavior(e,t),t.src=e):(Ie.b.SetCorsBehavior(e[0],t),e.forEach(function(e){var i=document.createElement("source");i.src=e,t.appendChild(i)})),t},t.prototype._rebuild=function(){this.update()},t.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},t.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},t.prototype.updateURL=function(e){this.video.src=e},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener(this._createInternalTextureOnEvent,this._createInternalTexture),this.video.removeEventListener("paused",this._updateInternalTexture),this.video.removeEventListener("seeked",this._updateInternalTexture),this.video.removeEventListener("emptied",this.reset),this.video.pause()},t.CreateFromStreamAsync=function(e,i){var n=document.createElement("video");return n.setAttribute("autoplay",""),n.setAttribute("muted","true"),n.setAttribute("playsinline",""),n.muted=!0,void 0!==n.mozSrcObject?n.mozSrcObject=i:"object"==typeof n.srcObject?n.srcObject=i:(window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,n.src=window.URL&&window.URL.createObjectURL(i)),new Promise(function(i){var r=function(){i(new t("video",n,e,!0,!0)),n.removeEventListener("playing",r)};n.addEventListener("playing",r),n.play()})},t.CreateFromWebCamAsync=function(e,t,i){var n,r=this;return void 0===i&&(i=!1),t&&t.deviceId&&(n={exact:t.deviceId}),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({video:t,audio:i}).then(function(t){return r.CreateFromStreamAsync(e,t)}):(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia&&navigator.getUserMedia({video:{deviceId:n,width:{min:t&&t.minWidth||256,max:t&&t.maxWidth||640},height:{min:t&&t.minHeight||256,max:t&&t.maxHeight||480}},audio:i},function(t){return r.CreateFromStreamAsync(e,t)},function(e){m.a.Error(e.name)}),Promise.reject("No support for userMedia on this device"))},t.CreateFromWebCam=function(e,t,i,n){void 0===n&&(n=!1),this.CreateFromWebCamAsync(e,i,n).then(function(e){t&&t(e)}).catch(function(e){m.a.Error(e.name)})},t}($e.a),Oo=function(){function e(e,t){void 0===e&&(e=a.e.Zero()),void 0===t&&(t=a.e.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e}(),Io=function(){function e(e,t,i){void 0===e&&(e=a.e.Zero()),void 0===t&&(t=a.e.Up()),void 0===i&&(i=a.d.Zero()),this.position=e,this.normal=t,this.uv=i}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e}(),Do=function(e){function t(i,n,r,o){var s=e.call(this,i,o)||this;s._halfDome=!1,s._useDirectMapping=!1,s._videoMode=t.MODE_MONOSCOPIC,s._onBeforeCameraRenderObserver=null,o=s.getScene(),i=i||"videoDome",r.resolution=0|Math.abs(r.resolution)||32,r.clickToPlay=Boolean(r.clickToPlay),r.autoPlay=void 0===r.autoPlay||Boolean(r.autoPlay),r.loop=void 0===r.loop||Boolean(r.loop),r.size=Math.abs(r.size)||(o.activeCamera?.48*o.activeCamera.maxZ:1e3),void 0===r.useDirectMapping?s._useDirectMapping=!0:s._useDirectMapping=r.useDirectMapping,void 0===r.faceForward&&(r.faceForward=!0),s._setReady(!1);var c={loop:r.loop,autoPlay:r.autoPlay,autoUpdateTexture:!0,poster:r.poster},l=s._material=new Vr(i+"_material",o),u=s._videoTexture=new Mo(i+"_texture",n,o,!1,s._useDirectMapping,$e.a.TRILINEAR_SAMPLINGMODE,c);if(s._mesh=Se.a.CreateSphere(i+"_mesh",r.resolution,r.size,o,!1,Se.a.BACKSIDE),u.onLoadObservable.addOnce(function(){s._setReady(!0)}),l.useEquirectangularFOV=!0,l.fovMultiplier=1,l.opacityFresnel=!1,s._useDirectMapping?(u.wrapU=$e.a.CLAMP_ADDRESSMODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,l.diffuseTexture=u):(u.coordinatesMode=$e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,l.reflectionTexture=u),s._mesh.material=l,s._mesh.parent=s,s._halfDomeMask=tr.a.CreateSphere("",{slice:.5,diameter:.99*r.size,segments:r.resolution,sideOrientation:Se.a.BACKSIDE},o),s._halfDomeMask.rotate(Z.a.X,-Math.PI/2),s._halfDomeMask.parent=s._mesh,s._halfDome=!!r.halfDomeMode,s._halfDomeMask.setEnabled(s._halfDome),r.clickToPlay&&(o.onPointerUp=function(){s._videoTexture.video.play()}),r.faceForward&&o.activeCamera){var h=o.activeCamera,d=a.e.Forward(),f=a.e.TransformNormal(d,h.getViewMatrix());f.normalize(),s.rotation.y=Math.acos(a.e.Dot(d,f))}return s}return h.d(t,e),Object.defineProperty(t.prototype,"videoTexture",{get:function(){return this._videoTexture},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"videoMode",{get:function(){return this._videoMode},set:function(e){this._videoMode!==e&&this._changeVideoMode(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"halfDome",{get:function(){return this._halfDome},set:function(e){this._halfDome=e,this._halfDomeMask.setEnabled(e)},enumerable:!0,configurable:!0}),t.prototype._changeVideoMode=function(e){var i=this;switch(this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._videoMode=e,this._videoTexture.uScale=1,this._videoTexture.vScale=1,this._videoTexture.uOffset=0,this._videoTexture.vOffset=0,e){case t.MODE_SIDEBYSIDE:this._videoTexture.uScale=this._halfDome?.99999:.5;var n=this._halfDome?0:.5,r=this._halfDome?.5:0;this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){i._videoTexture.uOffset=e.isRightCamera?n:r});break;case t.MODE_TOPBOTTOM:this._videoTexture.vScale=this._halfDome?.99999:.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){i._videoTexture.vOffset=e.isRightCamera?.5:0})}},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._videoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),e.prototype.dispose.call(this,t,i)},t.MODE_MONOSCOPIC=0,t.MODE_TOPBOTTOM=1,t.MODE_SIDEBYSIDE=2,t}(ar.a),Lo=i(47),wo=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new Lo.a,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Lo.a,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}return Object.defineProperty(e.prototype,"gpuFrameTimeCounter",{get:function(){return this._gpuFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureGPUFrameTime",{get:function(){return this._captureGPUFrameTime},set:function(e){var t=this;e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,e?(this._onBeginFrameObserver=this.engine.onBeginFrameObservable.add(function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.engine.startTimeQuery())}),this._onEndFrameObserver=this.engine.onEndFrameObservable.add(function(){if(t._gpuFrameTimeToken){var e=t.engine.endTimeQuery(t._gpuFrameTimeToken);e>-1&&(t._gpuFrameTimeToken=null,t._gpuFrameTime.fetchNewFrame(),t._gpuFrameTime.addCount(e,!0))}})):(this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shaderCompilationTimeCounter",{get:function(){return this._shaderCompilationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureShaderCompilationTime",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&(this._captureShaderCompilationTime=e,e?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add(function(){t._shaderCompilationTime.fetchNewFrame(),t._shaderCompilationTime.beginMonitoring()}),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add(function(){t._shaderCompilationTime.endMonitoring()})):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null},e}(),Fo=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Lo.a,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Lo.a,this._captureFrameTime=!1,this._frameTime=new Lo.a,this._captureRenderTime=!1,this._renderTime=new Lo.a,this._captureInterFrameTime=!1,this._interFrameTime=new Lo.a,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Lo.a,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Lo.a,this._capturePhysicsTime=!1,this._physicsTime=new Lo.a,this._captureAnimationsTime=!1,this._animationsTime=new Lo.a,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Lo.a,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add(function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(Ie.b.StartPerformanceCounter("Scene rendering"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame()}),this._onAfterRenderObserver=e.onAfterRenderObservable.add(function(){t._captureFrameTime&&(Ie.b.EndPerformanceCounter("Scene rendering"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()})}return Object.defineProperty(e.prototype,"activeMeshesEvaluationTimeCounter",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureActiveMeshesEvaluationTime",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&(this._captureActiveMeshesEvaluationTime=e,e?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add(function(){Ie.b.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()}),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add(function(){Ie.b.EndPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.endMonitoring()})):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTargetsRenderTimeCounter",{get:function(){return this._renderTargetsRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTargetsRenderTime",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&(this._captureRenderTargetsRenderTime=e,e?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add(function(){Ie.b.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()}),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add(function(){Ie.b.EndPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.endMonitoring(!1)})):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"particlesRenderTimeCounter",{get:function(){return this._particlesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureParticlesRenderTime",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&(this._captureParticlesRenderTime=e,e?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add(function(){Ie.b.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()}),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add(function(){Ie.b.EndPerformanceCounter("Particles"),t._particlesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spritesRenderTimeCounter",{get:function(){return this._spritesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureSpritesRenderTime",{get:function(){return this._captureSpritesRenderTime},set:function(e){var t=this;e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add(function(){Ie.b.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()}),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add(function(){Ie.b.EndPerformanceCounter("Sprites"),t._spritesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicsTimeCounter",{get:function(){return this._physicsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"capturePhysicsTime",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&(this._capturePhysicsTime=e,e?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add(function(){Ie.b.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()}),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add(function(){Ie.b.EndPerformanceCounter("Physics"),t._physicsTime.endMonitoring()})):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationsTimeCounter",{get:function(){return this._animationsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureAnimationsTime",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&(this._captureAnimationsTime=e,e?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add(function(){t._animationsTime.endMonitoring()}):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameTimeCounter",{get:function(){return this._frameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureFrameTime",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interFrameTimeCounter",{get:function(){return this._interFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureInterFrameTime",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&(this._captureRenderTime=e,e?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add(function(){t._renderTime.beginMonitoring(),Ie.b.StartPerformanceCounter("Main render")}),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add(function(){t._renderTime.endMonitoring(!1),Ie.b.EndPerformanceCounter("Main render")})):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraRenderTimeCounter",{get:function(){return this._cameraRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureCameraRenderTime",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&(this._captureCameraRenderTime=e,e?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add(function(e){t._cameraRenderTime.beginMonitoring(),Ie.b.StartPerformanceCounter("Rendering camera "+e.name)}),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add(function(e){t._cameraRenderTime.endMonitoring(!1),Ie.b.EndPerformanceCounter("Rendering camera "+e.name)})):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"drawCallsCounter",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null},e}(),No=i(25),Bo="#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform sampler2D opacitySampler;\nuniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;\nvoid main(void)\n{\nvec4 finalColor=glowColor;\n\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a4&&(o.push(Yi.b.MatricesIndicesExtraKind),o.push(Yi.b.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+a.numBoneInfluencers);var p=a.skeleton;p&&p.isUsingTextureForMatrices?r.push("#define BONETEXTURE"):r.push("#define BonesPerMesh "+(p?p.bones.length+1:0)),a.numBoneInfluencers>0&&f.addCPUSkinningFallback(0,a)}else r.push("#define NUM_BONE_INFLUENCERS 0");var _=a.morphTargetManager,m=0;_&&_.numInfluencers>0&&(r.push("#define MORPHTARGETS"),m=_.numInfluencers,r.push("#define NUM_MORPH_INFLUENCERS "+m),Mr.a.PrepareAttributesForMorphTargetsInfluencers(o,a,m)),t&&(r.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(o)),this._addCustomEffectDefines(r);var g=r.join("\n");return this._cachedDefines!==g&&(this._cachedDefines=g,this._effectLayerMapGenerationEffect=this._scene.getEngine().createEffect("glowMapGeneration",o,["world","mBones","viewProjection","glowColor","morphTargetInfluences","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity"],["diffuseSampler","emissiveSampler","opacitySampler","boneSampler"],g,f,void 0,void 0,{maxSimultaneousMorphTargets:m})),this._effectLayerMapGenerationEffect.isReady()},e.prototype.render=function(){var e=this._mergeEffect;if(e.isReady()){for(var t=0;t-1&&this._scene.effectLayers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},e.prototype.getClassName=function(){return"EffectLayer"},e.Parse=function(e,t,i){return Ie.b.Instantiate(e.customType).Parse(e,t,i)},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("EffectLayerSceneComponent")},h.c([Object(F.c)()],e.prototype,"name",void 0),h.c([Object(F.f)()],e.prototype,"neutralColor",void 0),h.c([Object(F.c)()],e.prototype,"isEnabled",void 0),h.c([Object(F.d)()],e.prototype,"camera",null),h.c([Object(F.c)()],e.prototype,"renderingGroupId",null),e}();n.a.AddParser(Fe.a.NAME_EFFECTLAYER,function(e,t,i,n){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var r=0;r0){this._previousStencilState=this._engine.getStencilBuffer();for(var n=0,r=i;n-1)){this._renderEffects=!0,this._needStencil=this._needStencil||o.needStencil();var a=o._mainTexture;a._shouldRender()&&(this.scene.incrementRenderId(),a.render(!1,!1),t=!0)}}this.scene.incrementRenderId()}return t},e.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},e.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},e.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i0&&e.isBackground===t&&e.renderTargetTextures.indexOf(n)>-1&&0!=(e.layerMask&i)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw(function(i){return t._drawRenderTargetPredicate(i,!0,t.scene.activeCamera.layerMask,e)})},e.prototype._drawRenderTargetForeground=function(e){var t=this;this._draw(function(i){return t._drawRenderTargetPredicate(i,!1,t.scene.activeCamera.layerMask,e)})},e.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach(function(e){t.scene.layers.push(e)})},e.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach(function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()})},e}(),Ko="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}";ni.a.ShadersStore.layerPixelShader=Ko;var Qo="\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}";ni.a.ShadersStore.layerVertexShader=Qo;var qo=function(){function e(e,t,i,n,r){this.name=e,this.scale=new a.d(1,1),this.offset=new a.d(0,0),this.alphaBlendingMode=g.a.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new o.c,this.onBeforeRenderObservable=new o.c,this.onAfterRenderObservable=new o.c,this.texture=t?new $e.a(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===r?new s.b(1,1,1,1):r,this._scene=i||C.a.LastCreatedScene;var c=this._scene._getComponent(Fe.a.NAME_LAYER);c||(c=new Yo(this._scene),this._scene._addComponent(c)),this._scene.layers.push(this);var l=this._scene.getEngine(),u=[];u.push(1,1),u.push(-1,1),u.push(-1,-1),u.push(1,-1);var h=new Yi.b(l,u,Yi.b.PositionKind,!1,!1,2);this._vertexBuffers[Yi.b.PositionKind]=h,this._createIndexBuffer(),this._effect=l.createEffect("layer",[Yi.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],""),this._alphaTestEffect=l.createEffect("layer",[Yi.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],"#define ALPHATEST")}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!0,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){var e=this.alphaTest?this._alphaTestEffect:this._effect;if(e.isReady()&&this.texture&&this.texture.isReady()){var t=this._scene.getEngine();this.onBeforeRenderObservable.notifyObservers(this),t.enableEffect(e),t.setState(!1),e.setTexture("textureSampler",this.texture),e.setMatrix("textureMatrix",this.texture.getTextureMatrix()),e.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),e.setVector2("offset",this.offset),e.setVector2("scale",this.scale),t.bindBuffers(this._vertexBuffers,this._indexBuffer,e),this.alphaTest?t.drawElementsType(No.a.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(No.a.TriangleFillMode,0,6),t.setAlphaMode(g.a.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[Yi.b.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e}(),Zo=function(){function e(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=g.a.ALPHA_ONEONE,this.color=i||new s.a(1,1,1),this.texture=n?new $e.a(n,r.getScene(),!0):null,this._system=r,r.lensFlares.push(this)}return e.AddFlare=function(t,i,n,r,o){return new e(t,i,n,r,o)},e.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},e}(),Jo="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}";ni.a.ShadersStore.lensFlarePixelShader=Jo;var $o="\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.lensFlareVertexShader=$o;var ea=function(){function e(t,i,n){this.name=t,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=n||C.a.LastCreatedScene,e._SceneComponentInitialization(this._scene),this._emitter=i,this.id=t,n.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return n.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&n.activeCamera.layerMask)};var r=n.getEngine(),o=[];o.push(1,1),o.push(-1,1),o.push(-1,-1),o.push(1,-1),this._vertexBuffers[Yi.b.PositionKind]=new Yi.b(r,o,Yi.b.PositionKind,!1,!1,2);var a=[];a.push(0),a.push(1),a.push(2),a.push(0),a.push(2),a.push(3),this._indexBuffer=r.createIndexBuffer(a),this._effect=r.createEffect("lensFlare",[Yi.b.PositionKind],["color","viewportMatrix"],["textureSampler"],"")}return Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEmitter=function(){return this._emitter},e.prototype.setEmitter=function(e){this._emitter=e},e.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},e.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition();return t=a.e.Project(t,a.a.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=a.e.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),this.viewportBorder>0&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder),t.z>0&&(this._positionX>e.x&&this._positionXe.y&&(this._positionY,e.y,e.height),!0)},e.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();var i=new jt.a(this._scene.activeCamera.globalPosition,e),n=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!n||!n.hit||n.distance>t},e.prototype.render=function(){if(!this._effect.isReady()||!this._scene.activeCamera)return!1;var e,t,i=this._scene.getEngine(),n=this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(!0),i.getRenderHeight(!0));if(!this.computeEffectivePosition(n))return!1;if(!this._isVisible())return!1;var r=(e=this._positionXn.x+n.width-this.borderLimit?this._positionX-n.x-n.width+this.borderLimit:0)>(t=this._positionYn.y+n.height-this.borderLimit?this._positionY-n.y-n.height+this.borderLimit:0)?e:t;(r-=this.viewportBorder)>this.borderLimit&&(r=this.borderLimit);var o=1-w.a.Clamp(r/this.borderLimit,0,1);if(o<0)return!1;o>1&&(o=1),this.viewportBorder>0&&(n.x+=this.viewportBorder,n.y+=this.viewportBorder,n.width-=2*this.viewportBorder,n.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var s=n.x+n.width/2,c=n.y+n.height/2,l=s-this._positionX,u=c-this._positionY;i.enableEffect(this._effect),i.setState(!1),i.setDepthBuffer(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect);for(var h=0;h0);for(var i=0,n=t;i0)}},e}();ea._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_LENSFLARESYSTEM);t||(t=new ta(e),e._addComponent(t))};var ia="#ifndef FLOAT\n#include\n#endif\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=vDepthMetric;\n#ifdef ESM\ndepth=clamp(exp(-min(87.,biasAndScale.z*depth)),0.,1.);\n#endif\n#ifdef FLOAT\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depth);\n#endif\n}";ni.a.ShadersStore.shadowMapPixelShader=ia;var na="\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\nuniform vec3 lightData;\n#endif\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\n#include\n#include\nuniform mat4 viewProjection;\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvec3 worldNor=normalize(normalWorld*normal);\n#ifdef DIRECTIONINLIGHTDATA\nvec3 worldLightDir=normalize(-lightData.xyz);\n#else\nvec3 directionToLight=lightData.xyz-worldPos.xyz;\nvec3 worldLightDir=normalize(directionToLight);\n#endif\nfloat ndl=dot(worldNor,worldLightDir);\nfloat sinNL=sqrt(1.0-ndl*ndl);\nfloat normalBias=biasAndScale.y*sinNL;\nworldPos.xyz-=worldNor*normalBias;\n#endif\n\ngl_Position=viewProjection*worldPos;\n#ifdef DEPTHTEXTURE\n\ngl_Position.z+=biasAndScale.x*gl_Position.w;\n#endif\n\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y))+biasAndScale.x;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";ni.a.ShadersStore.shadowMapVertexShader=na;var ra="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}";ni.a.ShadersStore.depthBoxBlurPixelShader=ra;var oa=function(){function e(t,i,n){this.onBeforeShadowMapRenderObservable=new o.c,this.onAfterShadowMapRenderObservable=new o.c,this.onBeforeShadowMapRenderMeshObservable=new o.c,this.onAfterShadowMapRenderMeshObservable=new o.c,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=e.FILTER_NONE,this._filteringQuality=e.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=a.e.Zero(),this._viewMatrix=a.a.Zero(),this._projectionMatrix=a.a.Zero(),this._transformMatrix=a.a.Zero(),this._cachedPosition=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=a.a.Identity(),this._mapSize=t,this._light=i,this._scene=i.getScene(),i._shadowGenerator=this,e._SceneComponentInitialization(this._scene);var r=this._scene.getEngine().getCaps();n?r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_FLOAT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_HALF_FLOAT:this._textureType=g.a.TEXTURETYPE_UNSIGNED_INT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_HALF_FLOAT:r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_FLOAT:this._textureType=g.a.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}return Object.defineProperty(e.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},set:function(t){if(this._light.needCube()){if(t===e.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(t===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(t===e.FILTER_PCF||t===e.FILTER_PCSS)return void(this.usePoissonSampling=!0)}t!==e.FILTER_PCF&&t!==e.FILTER_PCSS||1!==this._scene.getEngine().webGLVersion?this._filter!==t&&(this._filter=t,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePoissonSampling",{get:function(){return this.filter===e.FILTER_POISSONSAMPLING},set:function(t){(t||this.filter===e.FILTER_POISSONSAMPLING)&&(this.filter=t?e.FILTER_POISSONSAMPLING:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useExponentialShadowMap",{get:function(){return this.filter===e.FILTER_EXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_EXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_BLUREXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_CLOSEEXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===e.FILTER_PCF},set:function(t){(t||this.filter===e.FILTER_PCF)&&(this.filter=t?e.FILTER_PCF:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useContactHardeningShadow",{get:function(){return this.filter===e.FILTER_PCSS},set:function(t){(t||this.filter===e.FILTER_PCSS)&&(this.filter=t?e.FILTER_PCSS:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"darkness",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!0,configurable:!0}),e.prototype.getDarkness=function(){return this._darkness},e.prototype.setDarkness=function(e){return this._darkness=e>=1?1:e<=0?0:e,this},Object.defineProperty(e.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!0,configurable:!0}),e.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},e.prototype.getShadowMap=function(){return this._shadowMap},e.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},e.prototype.getClassName=function(){return"ShadowGenerator"},e.prototype.addShadowCaster=function(e,t){var i;return void 0===t&&(t=!0),this._shadowMap?(this._shadowMap.renderList||(this._shadowMap.renderList=[]),this._shadowMap.renderList.push(e),t&&(i=this._shadowMap.renderList).push.apply(i,e.getChildMeshes()),this):this},e.prototype.removeShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap||!this._shadowMap.renderList)return this;var i=this._shadowMap.renderList.indexOf(e);if(-1!==i&&this._shadowMap.renderList.splice(i,1),t)for(var n=0,r=e.getChildren();n1?(this._shadowMap=new Oi(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(g.a.LESS,!0)):this._shadowMap=new Oi(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube()),this._shadowMap.wrapU=$e.a.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=$e.a.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode($e.a.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._shadowMap.onBeforeRenderObservable.add(function(n){t._currentFaceIndex=n,t._filter===e.FILTER_PCF&&i.setColorWrite(!1)}),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.onAfterUnbindObservable.add(function(){if(t._filter===e.FILTER_PCF&&i.setColorWrite(!0),t.useBlurExponentialShadowMap||t.useBlurCloseExponentialShadowMap){var n=t.getShadowMapForRendering();n&&t._scene.postProcessManager.directRender(t._blurPostProcesses,n.getInternalTexture(),!0)}});var n=new s.b(0,0,0,0),r=new s.b(1,1,1,1);this._shadowMap.onClearObservable.add(function(i){t._filter===e.FILTER_PCF?i.clear(r,!1,!0,!1):t.useExponentialShadowMap||t.useBlurExponentialShadowMap?i.clear(n,!0,!0,!1):i.clear(r,!0,!0,!1)}),this._shadowMap.onResizeObservable.add(function(e){t._mapSize=e.getRenderSize(),t._light._markMeshesAsLightDirty(),t.recreateShadowMap()})},e.prototype._initializeBlurRTTAndPostProcesses=function(){var e=this,t=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new Oi(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType),this._shadowMap2.wrapU=$e.a.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=$e.a.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode($e.a.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new Sr(this._light.name+"KernelBlurX",new a.d(1,0),this.blurKernel,1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.width=i,this._kernelBlurXPostprocess.height=i,this._kernelBlurXPostprocess.onApplyObservable.add(function(t){t.setTexture("textureSampler",e._shadowMap)}),this._kernelBlurYPostprocess=new Sr(this._light.name+"KernelBlurY",new a.d(0,1),this.blurKernel,1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===g.a.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new oi(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.onApplyObservable.add(function(t){t.setFloat2("screenSize",i,i),t.setTexture("textureSampler",e._shadowMap)}),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])},e.prototype._renderForShadowMap=function(e,t,i,n){var r,o=this._scene.getEngine();if(n.length){for(o.setColorWrite(!1),r=0;r=a.length)return void(e&&e(i));setTimeout(d,16)}};d()}else e&&e(this)}else e&&e(this)}else e&&e(this)},e.prototype.forceCompilationAsync=function(e){var t=this;return new Promise(function(i){t.forceCompilation(function(){i()},e)})},e.prototype.isReady=function(e,t){var i=[];this._textureType!==g.a.TEXTURETYPE_UNSIGNED_INT&&i.push("#define FLOAT"),this.useExponentialShadowMap||this.useBlurExponentialShadowMap?i.push("#define ESM"):(this.usePercentageCloserFiltering||this.useContactHardeningShadow)&&i.push("#define DEPTHTEXTURE");var n=[Yi.b.PositionKind],r=e.getMesh(),o=e.getMaterial();if(this.normalBias&&r.isVerticesDataPresent(Yi.b.NormalKind)&&(n.push(Yi.b.NormalKind),i.push("#define NORMAL"),r.nonUniformScaling&&i.push("#define NONUNIFORMSCALING"),this.getLight().getTypeID()===fr.a.LIGHTTYPEID_DIRECTIONALLIGHT&&i.push("#define DIRECTIONINLIGHTDATA")),o&&o.needAlphaTesting()){var a=o.getAlphaTestTexture();a&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Yi.b.UVKind)&&(n.push(Yi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Yi.b.UV2Kind)&&1===a.coordinatesIndex&&(n.push(Yi.b.UV2Kind),i.push("#define UV2")))}var s=new ni.c;if(r.useBones&&r.computeBonesUsingShaders&&r.skeleton){n.push(Yi.b.MatricesIndicesKind),n.push(Yi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Yi.b.MatricesIndicesExtraKind),n.push(Yi.b.MatricesWeightsExtraKind));var c=r.skeleton;i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),r.numBoneInfluencers>0&&s.addCPUSkinningFallback(0,r),c.isUsingTextureForMatrices?i.push("#define BONETEXTURE"):i.push("#define BonesPerMesh "+(c.bones.length+1))}else i.push("#define NUM_BONE_INFLUENCERS 0");var l=r.morphTargetManager,u=0;if(l&&l.numInfluencers>0&&(i.push("#define MORPHTARGETS"),u=l.numInfluencers,i.push("#define NUM_MORPH_INFLUENCERS "+u),Mr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,u)),t&&(i.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(n)),this.customShaderOptions&&this.customShaderOptions.defines)for(var h=0,d=this.customShaderOptions.defines;hMath.PI;)r-=2*Math.PI;var a=r/Math.PI,s=o/Math.PI;a=.5*a+.5;var c=Math.round(a*i);c<0?c=0:c>=i&&(c=i-1);var l=Math.round(s*n);l<0?l=0:l>=n&&(l=n-1);var u=n-l-1;return{r:t[u*i*3+3*c+0],g:t[u*i*3+3*c+1],b:t[u*i*3+3*c+2]}},e.FACE_FRONT=[new a.e(-1,-1,-1),new a.e(1,-1,-1),new a.e(-1,1,-1),new a.e(1,1,-1)],e.FACE_BACK=[new a.e(1,-1,1),new a.e(-1,-1,1),new a.e(1,1,1),new a.e(-1,1,1)],e.FACE_RIGHT=[new a.e(1,-1,-1),new a.e(1,-1,1),new a.e(1,1,-1),new a.e(1,1,1)],e.FACE_LEFT=[new a.e(-1,-1,1),new a.e(-1,-1,-1),new a.e(-1,1,1),new a.e(-1,1,-1)],e.FACE_DOWN=[new a.e(-1,1,-1),new a.e(1,1,-1),new a.e(-1,1,1),new a.e(1,1,1)],e.FACE_UP=[new a.e(-1,-1,1),new a.e(1,-1,1),new a.e(-1,-1,-1),new a.e(1,-1,-1)],e}(),da=function(){function e(){}return e.Ldexp=function(e,t){return t>1023?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)},e.Rgbe2float=function(e,t,i,n,r,o){r>0?(r=this.Ldexp(1,r-136),e[o+0]=t*r,e[o+1]=i*r,e[o+2]=n*r):(e[o+0]=0,e[o+1]=0,e[o+2]=0)},e.readStringLine=function(e,t){for(var i="",n="",r=t;r32767)throw"HDR Bad header format, unsupported size";return{height:t,width:i,dataPosition:a+=n.length+1}},e.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e),n=this.RGBE_ReadHeader(i),r=this.RGBE_ReadPixels_RLE(i,n);return ha.ConvertPanoramaToCubemap(r,n.width,n.height,t)},e.RGBE_ReadPixels=function(e,t){return this.RGBE_ReadPixels_RLE(e,t)},e.RGBE_ReadPixels_RLE=function(e,t){for(var i,n,r,o,a,s=t.height,c=t.width,l=t.dataPosition,u=0,h=0,d=0,f=new ArrayBuffer(4*c),p=new Uint8Array(f),_=new ArrayBuffer(t.width*t.height*4*3),m=new Float32Array(_);s>0;){if(i=e[l++],n=e[l++],r=e[l++],o=e[l++],2!=i||2!=n||128&r)throw"HDR Bad header format, not RLE";if((r<<8|o)!=c)throw"HDR Bad header format, wrong scan line width";for(u=0,d=0;d<4;d++)for(h=(d+1)*c;u128){if(0==(a=i-128)||a>h-u)throw"HDR Bad Format, bad scanline data (run)";for(;a-- >0;)p[u++]=n}else{if(0==(a=i)||a>h-u)throw"HDR Bad Format, bad scanline data (non-run)";if(p[u++]=n,--a>0)for(var g=0;g255){var m=255/_;d*=m,f*=m,p*=m}s[3*h+0]=d,s[3*h+1]=f,s[3*h+2]=p}s?a.push(s):a.push(u)}return a},null,this._onLoad,this._onError))},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=new t(this.url,e,this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i.coordinatesIndex=this.coordinatesIndex,i.coordinatesMode=this.coordinatesMode,i},t.prototype.delayLoad=function(){this.delayLoadState===Ce.b.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=Ce.b.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this.loadTexture())},t.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},t.prototype.setReflectionTextureMatrix=function(e){var t=this;this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&this.getScene().markAllMaterialsAsDirty(g.a.MATERIAL_TextureDirtyFlag,function(e){return-1!==e.getActiveTextures().indexOf(t)})},t.Parse=function(e,i,n){var r=null;return e.name&&!e.isRenderTarget&&((r=new t(n+e.name,i,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,r.hasAlpha=e.hasAlpha,r.level=e.level,r.coordinatesMode=e.coordinatesMode,r.isBlocking=e.isBlocking),r&&(e.boundingBoxPosition&&(r.boundingBoxPosition=a.e.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=a.e.FromArray(e.boundingBoxSize)),e.rotationY&&(r.rotationY=e.rotationY)),r},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType="BABYLON.HDRCubeTexture",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},t._facesMapping=["right","left","up","down","front","back"],t}(yr.a);c.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=fa;var pa=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this.onInfluenceChanged=new o.c,this._onDataLayoutChanged=new o.c,this._animationPropertiesOverride=null,this._scene=i||C.a.LastCreatedScene,this.influence=t}return Object.defineProperty(e.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!0,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),F.a.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return"MorphTarget"},e.Parse=function(t){var i=new e(t.name,t.influence);if(i.setPositions(t.positions),null!=t.id&&(i.id=t.id),t.normals&&i.setNormals(t.normals),t.tangents&&i.setTangents(t.tangents),t.uvs&&i.setUVs(t.uvs),t.animations)for(var n=0;n=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},e.prototype.serialize=function(){var e={};e.id=this.uniqueId,e.targets=[];for(var t=0,i=this._targets;t-1&&(this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e))},e.prototype.addJoint=function(e,t,i){var n={mainImpostor:e,connectedImpostor:t,joint:i};i.physicsPlugin=this._physicsPlugin,this._joints.push(n),this._physicsPlugin.generateJoint(n)},e.prototype.removeJoint=function(e,t,i){var n=this._joints.filter(function(n){return n.connectedImpostor===t&&n.joint===i&&n.mainImpostor===e});n.length&&this._physicsPlugin.removeJoint(n[0])},e.prototype._step=function(e){var t=this;this._impostors.forEach(function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)}),e>.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.getImpostors=function(){return this._impostors},e.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t0&&(this._physicsBodysToRemoveAfterStep.forEach(function(t){e.world.remove(t)}),this._physicsBodysToRemoveAfterStep=[])},e.prototype.applyImpulse=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyImpulse(r,n)},e.prototype.applyForce=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyForce(r,n)},e.prototype.generatePhysicsBody=function(e){if(this._removeMarkedPhysicsBodiesFromWorld(),e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var t=this._createShape(e),i=e.physicsBody;i&&this.removePhysicsBody(e);var n=this._addMaterial("mat-"+e.uniqueId,e.getParam("friction"),e.getParam("restitution")),r={mass:e.getParam("mass"),material:n},o=e.getParam("nativeOptions");for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a]);e.physicsBody=new this.BJSCANNON.Body(r),e.physicsBody.addEventListener("collide",e.onCollide),this.world.addEventListener("preStep",e.beforeStep),this.world.addEventListener("postStep",e.afterStep),e.physicsBody.addShape(t),this.world.add(e.physicsBody),i&&["force","torque","velocity","angularVelocity"].forEach(function(t){e.physicsBody[t].copy(i[t])}),this._processChildMeshes(e)}this._updatePhysicsBodyTransformation(e)}},e.prototype._processChildMeshes=function(e){var t=this,i=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],n=e.object.rotationQuaternion;if(i.length){var r=function(i,o){if(n&&o.rotationQuaternion){var s=o.getPhysicsImpostor();if(s)if(s.parent!==e){var c=o.getAbsolutePosition().subtract(e.object.getAbsolutePosition()),l=o.rotationQuaternion.multiply(a.b.Inverse(n));s.physicsBody&&(t.removePhysicsBody(s),s.physicsBody=null),s.parent=e,s.resetUpdateFlags(),e.physicsBody.addShape(t._createShape(s),new t.BJSCANNON.Vec3(c.x,c.y,c.z),new t.BJSCANNON.Quaternion(l.x,l.y,l.z,l.w)),e.physicsBody.mass+=s.getParam("mass")}n.multiplyInPlace(o.rotationQuaternion),o.getChildMeshes(!0).filter(function(e){return!!e.physicsImpostor}).forEach(r.bind(t,o.getAbsolutePosition()))}};i.filter(function(e){return!!e.physicsImpostor}).forEach(r.bind(this,e.object.getAbsolutePosition()))}},e.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),-1===this._physicsBodysToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodysToRemoveAfterStep.push(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o={pivotA:r.mainPivot?(new this.BJSCANNON.Vec3).copy(r.mainPivot):null,pivotB:r.connectedPivot?(new this.BJSCANNON.Vec3).copy(r.connectedPivot):null,axisA:r.mainAxis?(new this.BJSCANNON.Vec3).copy(r.mainAxis):null,axisB:r.connectedAxis?(new this.BJSCANNON.Vec3).copy(r.connectedAxis):null,maxForce:r.nativeParams.maxForce,collideConnected:!!r.collision};switch(e.joint.type){case ga.e.HingeJoint:case ga.e.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case ga.e.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case ga.e.SpringJoint:var a=r;n=new this.BJSCANNON.Spring(t,i,{restLength:a.length,stiffness:a.stiffness,damping:a.damping,localAnchorA:o.pivotA,localAnchorB:o.pivotB});break;case ga.e.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case ga.e.PointToPointJoint:case ga.e.BallAndSocketJoint:default:n=new this.BJSCANNON.PointToPointConstraint(t,o.pivotA,i,o.pivotB,o.maxForce)}n.collideConnected=!!r.collision,e.joint.physicsJoint=n,e.joint.type!==ga.e.SpringJoint?this.world.addConstraint(n):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){n.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},e.prototype.removeJoint=function(e){e.joint.type!==ga.e.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},e.prototype._addMaterial=function(e,t,i){var n,r;for(n=0;n1e3*i));s++);this.time+=n;for(var c=this.time%i/i,l=e,u=this.bodies,h=0;h!==u.length;h++){var d=u[h];d.type!==t.Body.STATIC&&d.sleepState!==t.Body.SLEEPING?(d.position.vsub(d.previousPosition,l),l.scale(c,l),d.position.vadd(l,d.interpolatedPosition)):(d.interpolatedPosition.copy(d.position),d.interpolatedQuaternion.copy(d.quaternion))}}}},e.prototype.raycast=function(e,t){return this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),this._raycastResult.reset(e,t),this._cannonRaycastResult.hasHit&&(this._raycastResult.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)),this._raycastResult},e}();va.DefaultPluginFactory=function(){return new ba};var Ta=function(){function e(e,t){void 0===t&&(t=OIMO),this.name="OimoJSPlugin",this._tmpImpostorsArray=[],this._tmpPositionVector=a.e.Zero(),this.BJSOIMO=t,this.world=new this.BJSOIMO.World({iterations:e}),this.world.clear(),this._raycastResult=new ya}return e.prototype.setGravity=function(e){this.world.gravity.copy(e)},e.prototype.setTimeStep=function(e){this.world.timeStep=e},e.prototype.getTimeStep=function(){return this.world.timeStep},e.prototype.executeStep=function(e,t){var i=this;t.forEach(function(e){e.beforeStep()}),this.world.step(),t.forEach(function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e});for(var n=this.world.contacts;null!==n;)if(!n.touching||n.body1.sleeping||n.body2.sleeping){var r=this._tmpImpostorsArray[+n.body1.name],o=this._tmpImpostorsArray[+n.body2.name];r&&o?(r.onCollide({body:o.physicsBody}),o.onCollide({body:r.physicsBody}),n=n.next):n=n.next}else n=n.next},e.prototype.applyImpulse=function(e,t,i){var n=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*n))},e.prototype.applyForce=function(e,t,i){m.a.Warn("Oimo doesn't support applying force. Using impule instead."),this.applyImpulse(e,t,i)},e.prototype.generatePhysicsBody=function(e){var t=this;if(e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var i={name:e.uniqueId,config:[e.getParam("mass")||1,e.getParam("friction"),e.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==e.getParam("mass"),density:e.getParam("mass"),friction:e.getParam("friction"),restitution:e.getParam("restitution"),world:this.world},n=[e];(s=e.object).getChildMeshes&&s.getChildMeshes().forEach(function(e){e.physicsImpostor&&n.push(e.physicsImpostor)});var r=function(e){return Math.max(e,va.Epsilon)},o=new a.b;n.forEach(function(n){if(n.object.rotationQuaternion){var a=n.object.rotationQuaternion;o=a.clone();var s=a.toEulerAngles(),c=n.getObjectExtendSize();if(n===e){var l=e.getObjectCenter();e.object.getAbsolutePivotPoint().subtractToRef(l,t._tmpPositionVector),t._tmpPositionVector.divideInPlace(e.object.scaling),i.pos.push(l.x),i.pos.push(l.y),i.pos.push(l.z),i.posShape.push(0,0,0),i.rotShape.push(0,0,0)}else{var u=n.object.getAbsolutePosition().subtract(e.object.getAbsolutePosition());i.posShape.push(u.x),i.posShape.push(u.y),i.posShape.push(u.z),i.pos.push(0,0,0),i.rotShape.push(57.29577951308232*s.x),i.rotShape.push(57.29577951308232*s.y),i.rotShape.push(57.29577951308232*s.z)}switch(n.type){case ma.a.ParticleImpostor:m.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case ma.a.SphereImpostor:var h=c.x,d=c.y,f=c.z,p=Math.max(r(h),r(d),r(f))/2;i.type.push("sphere"),i.size.push(p),i.size.push(p),i.size.push(p);break;case ma.a.CylinderImpostor:var _=r(c.x)/2,g=r(c.y);i.type.push("cylinder"),i.size.push(_),i.size.push(g),i.size.push(g);break;case ma.a.PlaneImpostor:case ma.a.BoxImpostor:default:_=r(c.x),g=r(c.y);var v=r(c.z);i.type.push("box"),i.size.push(_),i.size.push(g),i.size.push(v)}n.object.rotationQuaternion=a}}),e.physicsBody=this.world.add(i),e.physicsBody.resetQuaternion(o),e.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);var s;e.setDeltaPosition(this._tmpPositionVector)}},e.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o=r.nativeParams||{},a={body1:t,body2:i,axe1:o.axe1||(r.mainAxis?r.mainAxis.asArray():null),axe2:o.axe2||(r.connectedAxis?r.connectedAxis.asArray():null),pos1:o.pos1||(r.mainPivot?r.mainPivot.asArray():null),pos2:o.pos2||(r.connectedPivot?r.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||r.collision,spring:o.spring,world:this.world};switch(e.joint.type){case ga.e.BallAndSocketJoint:n="jointBall";break;case ga.e.SpringJoint:m.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");var s=r;a.min=s.length||a.min,a.max=Math.max(a.min,a.max);case ga.e.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case ga.e.PrismaticJoint:n="jointPrisme";break;case ga.e.SliderJoint:n="jointSlide";break;case ga.e.WheelJoint:n="jointWheel";break;case ga.e.HingeJoint:default:n="jointHinge"}a.type=n,e.joint.physicsJoint=this.world.add(a)}},e.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){m.a.Warn(e)}},e.prototype.isSupported=function(){return void 0!==this.BJSOIMO},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.sleeping||(e.object.position.copyFrom(e.physicsBody.getPosition()),e.object.rotationQuaternion&&e.object.rotationQuaternion.copyFrom(e.physicsBody.getQuaternion()))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody;n.position.copy(t),n.orientation.copy(i),n.syncShapes(),n.awake()},e.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.copy(t)},e.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.copy(t)},e.prototype.getLinearVelocity=function(e){var t=e.physicsBody.linearVelocity;return t?new a.e(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new a.e(t.x,t.y,t.z):null},e.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},e.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},e.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},e.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},e.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},e.prototype.sleepBody=function(e){e.physicsBody.sleep()},e.prototype.wakeUpBody=function(e){e.physicsBody.awake()},e.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},e.prototype.setMotor=function(e,t,i,n){void 0!==i?m.a.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter"):i=1e6,t*=-1;var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setMotor(t,i)},e.prototype.setLimit=function(e,t,i,n){var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setLimit(t,void 0===i?-t:i)},e.prototype.syncMeshWithImpostor=function(e,t){var i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.orientation.x,e.rotationQuaternion.y=i.orientation.y,e.rotationQuaternion.z=i.orientation.z,e.rotationQuaternion.w=i.orientation.s)},e.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},e.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes;t.x=2*i.halfWidth,t.y=2*i.halfHeight,t.z=2*i.halfDepth},e.prototype.dispose=function(){this.world.clear()},e.prototype.raycast=function(e,t){return m.a.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult},e}();Xi.a.CreateRibbon=function(e){var t=e.pathArray,i=e.closeArray||!1,n=e.closePath||!1,r=e.invertUV||!1,o=Math.floor(t[0].length/2),a=e.offset||o;a=a>o?o:Math.floor(a);var s,c,l,u,h=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,d=e.uvs,f=e.colors,p=[],_=[],m=[],g=[],v=[],y=[],b=[],T=[],E=[],A=[];if(t.length<2){var P=[],S=[];for(l=0;l0&&(C=R[u].subtract(R[u-1]).length()+b[c],v[c].push(C),b[c]=C),u++;n&&(u--,p.push(R[0].x,R[0].y,R[0].z),C=R[u].subtract(R[0]).length()+b[c],v[c].push(C),b[c]=C),E[c]=x+D,A[c]=I,I+=x+D}var L,w,F=null,N=null;for(l=0;l3?0:u,h);var A=Ea.CreateRibbon(e,{pathArray:b,closeArray:c,closePath:l,updatable:f,sideOrientation:p,invertUV:m,frontUVs:g||void 0,backUVs:v||void 0},d);return A._creationDataStorage.pathArray=b,A._creationDataStorage.path3D=y,A._creationDataStorage.cap=u,A},e}(),Pa=function(){function e(e,t,i){var n=this;void 0===e&&(e=!0),void 0===t&&(t=Ammo),void 0===i&&(i=null),this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new a.b,this._tmpContactCallbackResult=!1,this._tmpVector=new a.e,this._tmpMatrix=new a.a,"function"==typeof t?t(this.bjsAMMO):this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=function(){n._tmpContactCallbackResult=!0},this._raycastResult=new ya,this._tmpAmmoTransform=new this.bjsAMMO.btTransform,this._tmpAmmoTransform.setIdentity(),this._tmpAmmoQuaternion=new this.bjsAMMO.btQuaternion(0,0,0,1),this._tmpAmmoVectorA=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorB=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorC=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorD=new this.bjsAMMO.btVector3(0,0,0)):m.a.Error("AmmoJS is not available. Please make sure you included the js file.")}return e.prototype.setGravity=function(e){this._tmpAmmoVectorA.setValue(e.x,e.y,e.z),this.world.setGravity(this._tmpAmmoVectorA),this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA)},e.prototype.setTimeStep=function(e){this._timeStep=e},e.prototype.setFixedTimeStep=function(e){this._fixedTimeStep=e},e.prototype.setMaxSteps=function(e){this._maxSteps=e},e.prototype.getTimeStep=function(){return this._timeStep},e.prototype._isImpostorInContact=function(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._isImpostorPairInContact=function(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._stepSimulation=function(e,t,i){if(void 0===e&&(e=1/60),void 0===t&&(t=10),void 0===i&&(i=1/60),0==t)this.world.stepSimulation(e,0);else for(;t>0&&e>0;)e-i0&&this._isImpostorInContact(s))for(var c=0,l=s._onPhysicsCollideCallbacks;c3?3:s;var c=(new Ammo.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,s);return c.get_m_cfg().set_collisions(17),c},e.prototype._addHullVerts=function(e,t,i){var n=this,r=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){var o=i.getIndices();o||(o=[]);var s=i.getVerticesData(Yi.b.PositionKind);s||(s=[]),i.computeWorldMatrix(!1);for(var c=o.length/3,l=0;l0){if(e.type!=ma.a.NoImpostor){var l=this._createShape(e,!0);l&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,l))}return n}Ammo.destroy(n),n=null}switch(e.type){case ma.a.SphereImpostor:if(w.a.WithinEpsilon(o.x,o.y,1e-4)&&w.a.WithinEpsilon(o.x,o.z,1e-4))n=new Ammo.btSphereShape(o.x/2);else{var u=[new Ammo.btVector3(0,0,0)];(n=new Ammo.btMultiSphereShape(u,[1],1)).setLocalScaling(new Ammo.btVector3(o.x/2,o.y/2,o.z/2))}break;case ma.a.CapsuleImpostor:n=new Ammo.btCapsuleShape(o.x/2,o.y/2);break;case ma.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btCylinderShape(this._tmpAmmoVectorA);break;case ma.a.PlaneImpostor:case ma.a.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btBoxShape(this._tmpAmmoVectorA);break;case ma.a.MeshImpostor:if(0==e.getParam("mass")){var h=new Ammo.btTriangleMesh;e._pluginData.toDispose.push(h);var d=this._addMeshVerts(h,r,r);n=0==d?new Ammo.btCompoundShape:new Ammo.btBvhTriangleMeshShape(h);break}case ma.a.ConvexHullImpostor:var f=new Ammo.btConvexHullShape;0==(d=this._addHullVerts(f,r,r))?(e._pluginData.toDispose.push(f),n=new Ammo.btCompoundShape):n=f;break;case ma.a.NoImpostor:n=new Ammo.btSphereShape(o.x/2);break;case ma.a.SoftbodyImpostor:n=this._createSoftbody(e);break;case ma.a.ClothImpostor:n=this._createCloth(e);break;case ma.a.RopeImpostor:n=this._createRope(e);break;default:m.a.Warn("The impostor type is not currently supported by the ammo plugin.")}return n},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody.getWorldTransform();if(n.getOrigin().x()!=t.x||n.getOrigin().y()!=t.y||n.getOrigin().z()!=t.z||n.getRotation().x()!=i.x||n.getRotation().y()!=i.y||n.getRotation().z()!=i.z||n.getRotation().w()!=i.w)if(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),n.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),n.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(n),0==e.mass){var r=e.physicsBody.getMotionState();r&&r.setWorldTransform(n)}else e.physicsBody.activate()},e.prototype.isSupported=function(){return void 0!==this.bjsAMMO},e.prototype.setLinearVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)},e.prototype.setAngularVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)},e.prototype.getLinearVelocity=function(e){if(e.soft)var t=e.physicsBody.linearVelocity();else t=e.physicsBody.getLinearVelocity();if(!t)return null;var i=new a.e(t.x(),t.y(),t.z());return Ammo.destroy(t),i},e.prototype.getAngularVelocity=function(e){if(e.soft)var t=e.physicsBody.angularVelocity();else t=e.physicsBody.getAngularVelocity();if(!t)return null;var i=new a.e(t.x(),t.y(),t.z());return Ammo.destroy(t),i},e.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},e.prototype.getBodyMass=function(e){return e._pluginData.mass||0},e.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},e.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},e.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},e.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(m.a.Warn("Pressure is not a property of a rigid body"),0)},e.prototype.setBodyPressure=function(e,t){e.soft?e.type===ma.a.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):m.a.Warn("Pressure can only be applied to a softbody")},e.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(m.a.Warn("Stiffness is not a property of a rigid body"),0)},e.prototype.setBodyStiffness=function(e,t){e.soft?(t=(t=t<0?0:t)>1?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):m.a.Warn("Stiffness cannot be applied to a rigid body")},e.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(m.a.Warn("Velocity iterations is not a property of a rigid body"),0)},e.prototype.setBodyVelocityIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):m.a.Warn("Velocity iterations cannot be applied to a rigid body")},e.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(m.a.Warn("Position iterations is not a property of a rigid body"),0)},e.prototype.setBodyPositionIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):m.a.Warn("Position iterations cannot be applied to a rigid body")},e.prototype.appendAnchor=function(e,t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=!1);var a=e.segments,s=Math.round((a-1)*i)+a*(a-1-Math.round((a-1)*n));e.physicsBody.appendAnchor(s,t.physicsBody,o,r)},e.prototype.appendHook=function(e,t,i,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var o=Math.round(e.segments*i);e.physicsBody.appendAnchor(o,t.physicsBody,r,n)},e.prototype.sleepBody=function(e){m.a.Warn("sleepBody is not currently supported by the Ammo physics plugin")},e.prototype.wakeUpBody=function(e){e.physicsBody.activate()},e.prototype.updateDistanceJoint=function(e,t,i){m.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")},e.prototype.setMotor=function(e,t,i,n){e.physicsJoint.enableAngularMotor(!0,t,i)},e.prototype.setLimit=function(e,t,i){m.a.Warn("setLimit is not currently supported by the Ammo physics plugin")},e.prototype.syncMeshWithImpostor=function(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())},e.prototype.getRadius=function(e){return e.getObjectExtendSize().x/2},e.prototype.getBoxSizeToRef=function(e,t){var i=e.getObjectExtendSize();t.x=i.x,t.y=i.y,t.z=i.z},e.prototype.dispose=function(){Ammo.destroy(this.world),Ammo.destroy(this._solver),Ammo.destroy(this._overlappingPairCache),Ammo.destroy(this._dispatcher),Ammo.destroy(this._collisionConfiguration),Ammo.destroy(this._tmpAmmoVectorA),Ammo.destroy(this._tmpAmmoVectorB),Ammo.destroy(this._tmpAmmoVectorC),Ammo.destroy(this._tmpAmmoTransform),Ammo.destroy(this._tmpAmmoQuaternion),Ammo.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},e.prototype.raycast=function(e,t){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);var i=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);return this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,i),this._raycastResult.reset(e,t),i.hasHit()&&(this._raycastResult.setHitData({x:i.get_m_hitNormalWorld().x(),y:i.get_m_hitNormalWorld().y(),z:i.get_m_hitNormalWorld().z()},{x:i.get_m_hitPointWorld().x(),y:i.get_m_hitPointWorld().y(),z:i.get_m_hitPointWorld().z()}),this._raycastResult.calculateHitDistance()),Ammo.destroy(i),Ammo.destroy(this._tmpAmmoVectorRCA),Ammo.destroy(this._tmpAmmoVectorRCB),this._raycastResult},e.DISABLE_COLLISION_FLAG=4,e.KINEMATIC_FLAG=2,e.DISABLE_DEACTIVATION_FLAG=4,e}();n.a.prototype.removeReflectionProbe=function(e){if(!this.reflectionProbes)return-1;var t=this.reflectionProbes.indexOf(e);return-1!==t&&this.reflectionProbes.splice(t,1),t},n.a.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var Sa=function(){function e(e,t,i,n,r){var o=this;void 0===n&&(n=!0),void 0===r&&(r=!1),this.name=e,this._viewMatrix=a.a.Identity(),this._target=a.e.Zero(),this._add=a.e.Zero(),this._invertYAxis=!1,this.position=a.e.Zero(),this._scene=i,this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this),this._renderTargetTexture=new Oi(e,t,i,n,!0,r?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_UNSIGNED_INT,!0),this._renderTargetTexture.onBeforeRenderObservable.add(function(e){switch(e){case 0:o._add.copyFromFloats(1,0,0);break;case 1:o._add.copyFromFloats(-1,0,0);break;case 2:o._add.copyFromFloats(0,o._invertYAxis?1:-1,0);break;case 3:o._add.copyFromFloats(0,o._invertYAxis?-1:1,0);break;case 4:o._add.copyFromFloats(0,0,1);break;case 5:o._add.copyFromFloats(0,0,-1)}o._attachedMesh&&o.position.copyFrom(o._attachedMesh.getAbsolutePosition()),o.position.addToRef(o._add,o._target),a.a.LookAtLHToRef(o.position,o._target,a.e.Up(),o._viewMatrix),i.activeCamera&&(o._projectionMatrix=a.a.PerspectiveFovLH(Math.PI/2,1,i.activeCamera.minZ,i.activeCamera.maxZ),i.setTransformMatrix(o._viewMatrix,o._projectionMatrix)),i._forcedViewPosition=o.position}),this._renderTargetTexture.onAfterUnbindObservable.add(function(){i._forcedViewPosition=null,i.updateTransformMatrix(!0)})}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},enumerable:!0,configurable:!0}),e.prototype.attachToMesh=function(e){this._attachedMesh=e},e.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},e.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);-1!==e&&this._scene.reflectionProbes.splice(e,1),this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null)},e.prototype.toString=function(e){var t="Name: "+this.name;return e&&(t+=", position: "+this.position.toString(),this._attachedMesh&&(t+=", attached mesh: "+this._attachedMesh.name)),t},e.prototype.getClassName=function(){return"ReflectionProbe"},e.prototype.serialize=function(){var e=F.a.Serialize(this,this._renderTargetTexture.serialize());return e.isReflectionProbe=!0,e},e.Parse=function(t,i,n){var r=null;if(i.reflectionProbes)for(var o=0;o0){var n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=n.length){var a=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var s=0;s0&&i.addLODLevel(a,null),!0===r&&i.setEnabled(!0)}else Ie.b.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},Ia=function(e,t,i,r,o){void 0===o&&(o=!1);var a=new xe(e),s="importScene has failed JSON parse";try{var l=JSON.parse(t);s="";var u,h,d=vn.loggingLevel===vn.DETAILED_LOGGING;if(void 0!==l.environmentTexture&&null!==l.environmentTexture){var f=void 0===l.isPBR||l.isPBR;if(l.environmentTextureType&&"BABYLON.HDRCubeTexture"===l.environmentTextureType){var p=l.environmentTextureSize?l.environmentTextureSize:128,_=new fa((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e,p,!0,!f);l.environmentTextureRotationY&&(_.rotationY=l.environmentTextureRotationY),e.environmentTexture=_}else if(Ra.a.EndsWith(l.environmentTexture,".env")){var g=new Cr((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}else{var v=Cr.CreateFromPrefilteredData((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(v.rotationY=l.environmentTextureRotationY),e.environmentTexture=v}if(!0===l.createDefaultSkybox){var y=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,b=l.skyboxBlurLevel||0;e.createDefaultSkybox(e.environmentTexture,f,y,b)}a.environmentTexture=e.environmentTexture}if(void 0!==l.environmentIntensity&&null!==l.environmentIntensity&&(e.environmentIntensity=l.environmentIntensity),void 0!==l.lights&&null!==l.lights)for(u=0,h=l.lights.length;u0){for(var ee=0;ee<$._excludedMeshesIds.length;ee++){var te=e.getMeshByID($._excludedMeshesIds[ee]);te&&$.excludedMeshes.push(te)}$._excludedMeshesIds=[]}if($._includedOnlyMeshesIds.length>0){for(var ne=0;ne<$._includedOnlyMeshesIds.length;ne++){var re=e.getMeshByID($._includedOnlyMeshesIds[ne]);re&&$.includedOnlyMeshes.push(re)}$._includedOnlyMeshesIds=[]}}for(n.a.Parse(l,e,a,i),u=0,h=e.meshes.length;u-1&&void 0!==u.skeletons&&null!==u.skeletons)if(!1===g.indexOf(y.skeletonId)>-1)for(var O=0,I=u.skeletons.length;O1,n.wrapU=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapV=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapR=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.anisotropicFilteringLevel=1,n._texture=n._getFromCache(t,!0),n._texture||(i.useDelayedTextureLoading?n.delayLoadState=g.a.DELAYLOADSTATE_NOTLOADED:n.loadTexture()),n):n}return h.d(t,e),t.prototype.getTextureMatrix=function(){return this._textureMatrix},t.prototype.load3dlTexture=function(){var e,i=this._engine;e=1===i.webGLVersion?i.createRawTexture(null,1,1,g.a.TEXTUREFORMAT_RGBA,!1,!1,g.a.TEXTURE_BILINEAR_SAMPLINGMODE):i.createRawTexture3D(null,1,1,1,g.a.TEXTUREFORMAT_RGBA,!1,!1,g.a.TEXTURE_BILINEAR_SAMPLINGMODE),this._texture=e;var n=function(n){if("string"==typeof n){for(var r,o=null,a=null,s=n.split("\n"),c=0,l=0,u=0,h=0,d=0,f=0;f0&&(f+1)%4==0)o[f]=255;else{var b=a[f];o[f]=b/d*255}e.is3D?(e.updateSize(c,c,c),i.updateRawTexture3D(e,o,g.a.TEXTUREFORMAT_RGBA,!1)):(e.updateSize(c*c,c),i.updateRawTexture(e,o,g.a.TEXTUREFORMAT_RGBA,!1))}},r=this.getScene();return r?r._loadFile(this.url,n):this._engine._loadFile(this.url,n),this._texture},t.prototype.loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this.load3dlTexture()},t.prototype.clone=function(){var e=new t(this.url,this.getScene());return e.level=this.level,e},t.prototype.delayLoad=function(){this.delayLoadState===g.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=g.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this.loadTexture())},t.Parse=function(e,i){var n=null;return e.name&&!e.isRenderTarget&&((n=new t(e.name,i)).name=e.name,n.level=e.level),n},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},t._noneEmptyLineRegex=/\S+/,t}(yr.a);c.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=Ua;var Va=function(e){function t(t,i,n,r,o,a,s){void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===a&&(a=null),void 0===s&&(s=null);var c=e.call(this,i)||this;if(c._onLoad=null,c._onError=null,c.coordinatesMode=$e.a.CUBIC_MODE,!t)throw new Error("Image url is not set");return c.name=t,c.url=t,c._size=n,c._noMipmap=r,c.gammaSpace=o,c._onLoad=a,c._onError=s,c.hasAlpha=!1,c.isCube=!0,c._texture=c._getFromCache(t,c._noMipmap),c._texture?a&&(c._texture.isReady?Ie.b.SetImmediate(function(){return a()}):c._texture.onLoadedObservable.add(a)):i.useDelayedTextureLoading?c.delayLoadState=Ce.b.DELAYLOADSTATE_NOTLOADED:c.loadImage(c.loadTexture.bind(c),c._onError),c}return h.d(t,e),t.prototype.loadImage=function(e,t){var i=this,n=document.createElement("canvas"),r=new Image;r.addEventListener("load",function(){i._width=r.width,i._height=r.height,n.width=i._width,n.height=i._height;var t=n.getContext("2d");t.drawImage(r,0,0);var o=t.getImageData(0,0,r.width,r.height);i._buffer=o.data.buffer,n.remove(),e()}),r.addEventListener("error",function(e){t&&t(i.getClassName()+" could not be loaded",e)}),r.src=this.url},t.prototype.loadTexture=function(){var e=this,i=this.getScene();i&&(this._texture=i.getEngine().createRawCubeTextureFromUrl(this.url,i,this._size,Ce.b.TEXTUREFORMAT_RGB,i.getEngine().getCaps().textureFloat?Ce.b.TEXTURETYPE_FLOAT:Ce.b.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,function(){for(var i=e.getFloat32ArrayFromArrayBuffer(e._buffer),n=ha.ConvertPanoramaToCubemap(i,e._width,e._height,e._size),r=[],o=0;o<6;o++){var a=n[t._FacesMapping[o]];r.push(a)}return r},null,this._onLoad,this._onError))},t.prototype.getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),i=new Float32Array(3*e.byteLength/4),n=0,r=0;ri.length)m.a.Error("Unable to load TGA file - Not enough data");else{n+=r.id_length;var o,a=!1,s=!1,c=!1;switch(r.image_type){case e._TYPE_RLE_INDEXED:a=!0;case e._TYPE_INDEXED:s=!0;break;case e._TYPE_RLE_RGB:a=!0;case e._TYPE_RGB:break;case e._TYPE_RLE_GREY:a=!0;case e._TYPE_GREY:c=!0}var l,u,h,d,f,p,_,g=r.pixel_size>>3,v=r.width*r.height*g;if(s&&(l=i.subarray(n,n+=r.colormap_length*(r.colormap_size>>3))),a){var y,b,T;o=new Uint8Array(v);for(var E=0,A=new Uint8Array(g);n>e._ORIGIN_SHIFT){default:case e._ORIGIN_UL:u=0,d=1,_=r.width,h=0,f=1,p=r.height;break;case e._ORIGIN_BL:u=0,d=1,_=r.width,h=r.height-1,f=-1,p=-1;break;case e._ORIGIN_UR:u=r.width-1,d=-1,_=-1,h=0,f=1,p=r.height;break;case e._ORIGIN_BR:u=r.width-1,d=-1,_=-1,h=r.height-1,f=-1,p=-1}var P=e["_getImageData"+(c?"Grey":"")+r.pixel_size+"bits"](r,l,o,h,f,p,u,d,_);t.getEngine()._uploadDataToTextureDirectly(t,P)}}},e._getImageData8bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=t,p=e.width,_=e.height,m=0,g=new Uint8Array(p*_*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,m++)l=d[m],g[4*(u+p*h)+3]=255,g[4*(u+p*h)+2]=f[3*l+0],g[4*(u+p*h)+1]=f[3*l+1],g[4*(u+p*h)+0]=f[3*l+2];return g},e._getImageData16bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,_+=2){var g=255*((31744&(l=d[_+0]+(d[_+1]<<8)))>>10)/31|0,v=255*((992&l)>>5)/31|0,y=255*(31&l)/31|0;m[4*(u+f*h)+0]=g,m[4*(u+f*h)+1]=v,m[4*(u+f*h)+2]=y,m[4*(u+f*h)+3]=32768&l?0:255}return m},e._getImageData24bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=3)_[4*(l+d*u)+3]=255,_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+1]=h[p+1],_[4*(l+d*u)+0]=h[p+2];return _},e._getImageData32bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=4)_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+1]=h[p+1],_[4*(l+d*u)+0]=h[p+2],_[4*(l+d*u)+3]=h[p+3];return _},e._getImageDataGrey8bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,_++)l=d[_],m[4*(u+f*h)+0]=l,m[4*(u+f*h)+1]=l,m[4*(u+f*h)+2]=l,m[4*(u+f*h)+3]=255;return m},e._getImageDataGrey16bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=2)_[4*(l+d*u)+0]=h[p+0],_[4*(l+d*u)+1]=h[p+0],_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+3]=h[p+1];return _},e._TYPE_INDEXED=1,e._TYPE_RGB=2,e._TYPE_GREY=3,e._TYPE_RLE_INDEXED=9,e._TYPE_RLE_RGB=10,e._TYPE_RLE_GREY=11,e._ORIGIN_MASK=48,e._ORIGIN_SHIFT=4,e._ORIGIN_BL=0,e._ORIGIN_BR=1,e._ORIGIN_UL=2,e._ORIGIN_UR=3,e}(),Ga=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".tga")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,n,r){throw".env not supported in Cube."},e.prototype.loadData=function(e,t,i){var n=new Uint8Array(e),r=ka.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){ka.UploadContent(t,n)})},e}();Ce.b._TextureLoaders.push(new Ga);var za;!function(e){e[e.cTFETC1=0]="cTFETC1",e[e.cTFBC1=1]="cTFBC1",e[e.cTFBC4=2]="cTFBC4",e[e.cTFPVRTC1_4_OPAQUE_ONLY=3]="cTFPVRTC1_4_OPAQUE_ONLY",e[e.cTFBC7_M6_OPAQUE_ONLY=4]="cTFBC7_M6_OPAQUE_ONLY",e[e.cTFETC2=5]="cTFETC2",e[e.cTFBC3=6]="cTFBC3",e[e.cTFBC5=7]="cTFBC5"}(za||(za={}));var ja=function(){function e(){}return e.GetInternalFormatFromBasisFormat=function(e){if(e===za.cTFETC1)return 36196;if(e===za.cTFBC1)return 33776;if(e===za.cTFBC3)return 33779;throw"The chosen Basis transcoder format is not currently supported"},e._CreateWorkerAsync=function(){var t=this;return this._WorkerPromise||(this._WorkerPromise=new Promise(function(i){t._Worker?i(t._Worker):Ie.b.LoadFileAsync(e.WasmModuleURL).then(function(n){var r=URL.createObjectURL(new Blob(["("+Wa+")()"],{type:"application/javascript"}));t._Worker=new Worker(r);var o=function(e){"init"===e.data.action&&(t._Worker.removeEventListener("message",o),i(t._Worker))};t._Worker.addEventListener("message",o),t._Worker.postMessage({action:"init",url:e.JSModuleURL,wasmBinary:n})})})),this._WorkerPromise},e.TranscodeAsync=function(e,t){var i=this;return new Promise(function(n,r){i._CreateWorkerAsync().then(function(){var o=i._actionId++,a=function(e){"transcode"===e.data.action&&e.data.id===o&&(i._Worker.removeEventListener("message",a),e.data.success?n(e.data):r("Transcode is not supported on this device"))};i._Worker.addEventListener("message",a),i._Worker.postMessage({action:"transcode",id:o,imageData:e,config:t,ignoreSupportedFormats:i._IgnoreSupportedFormats},[e])})})},e.LoadTextureFromTranscodeResult=function(t,i){for(var n,r=function(){if(n=i.fileInfo.images[o].levels[0],t._invertVScale=t.invertY,-1===i.format)if(t.type=Ce.b.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,t.format=Ce.b.TEXTUREFORMAT_RGB,t.getEngine().webGLVersion<2&&(w.a.Log2(n.width)%1!=0||w.a.Log2(n.height)%1!=0)){var r=new et.a(t.getEngine(),et.a.DATASOURCE_TEMP);t._invertVScale=t.invertY,r.type=Ce.b.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,r.format=Ce.b.TEXTUREFORMAT_RGB,r.width=n.width+3&-4,r.height=n.height+3&-4,t.getEngine()._bindTextureDirectly(r.getEngine()._gl.TEXTURE_2D,r,!0),t.getEngine()._uploadDataToTextureDirectly(r,n.transcodedPixels,o,0,Ce.b.TEXTUREFORMAT_RGB,!0),r.getEngine()._rescaleTexture(r,t,t.getEngine().scenes[0],r.getEngine()._getInternalFormat(Ce.b.TEXTUREFORMAT_RGB),function(){r.getEngine()._releaseTexture(r),r.getEngine()._bindTextureDirectly(r.getEngine()._gl.TEXTURE_2D,t,!0)})}else t._invertVScale=!t.invertY,t.width=n.width+3&-4,t.height=n.height+3&-4,t.getEngine()._uploadDataToTextureDirectly(t,n.transcodedPixels,o,0,Ce.b.TEXTUREFORMAT_RGB,!0);else t.width=n.width,t.height=n.height,i.fileInfo.images[o].levels.forEach(function(n,r){t.getEngine()._uploadCompressedDataToTextureDirectly(t,e.GetInternalFormatFromBasisFormat(i.format),n.width,n.height,n.transcodedPixels,o,r)}),t.getEngine().webGLVersion<2&&(w.a.Log2(t.width)%1!=0||w.a.Log2(t.height)%1!=0)&&(Ie.b.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),t._cachedWrapU=$e.a.CLAMP_ADDRESSMODE,t._cachedWrapV=$e.a.CLAMP_ADDRESSMODE)},o=0;o>2&3],o[f++]=r[d>>4&3],o[f++]=r[d>>6&3]}}return o}(a,0,e.getImageWidth(t,i)+3&-4,e.getImageHeight(t,i)+3&-4));return a}onmessage=function(n){if("init"===n.data.action)t||(Module={wasmBinary:n.data.wasmBinary},importScripts(n.data.url),t=new Promise(function(e){Module.onRuntimeInitialized=function(){Module.initializeBasis(),e()}})),t.then(function(){postMessage({action:"init"})});else if("transcode"===n.data.action){var r=n.data.config,o=n.data.imageData,a=new Module.BasisFile(new Uint8Array(o)),s=function(e){for(var t=e.getHasAlpha(),i=e.getNumImages(),n=[],r=0;r1&&t.generateMipMaps;ja.LoadTextureFromTranscodeResult(t,e),t.getEngine()._setCubeMapTextureParams(i),t.isReady=!0}).catch(function(e){Ie.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0})}},e.prototype.loadData=function(e,t,i){var n=t.getEngine().getCaps(),r={supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2}};ja.TranscodeAsync(e,r).then(function(e){var n=e.fileInfo.images[0].levels[0],r=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;i(n.width,n.height,r,-1!==e.format,function(){ja.LoadTextureFromTranscodeResult(t,e)})}).catch(function(e){Ie.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),i(0,0,!1,!1,function(){})})},e}();Ce.b._TextureLoaders.push(new Ha),Ce.b.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl;if(e[0]._MSAAFramebuffer){n.bindFramebuffer(n.READ_FRAMEBUFFER,e[0]._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e[0]._framebuffer);var r=e[0]._attachments;r||(r=new Array(e.length),e[0]._attachments=r);for(var o=0;o1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"],n.readBuffer(r[o]),n.drawBuffers(r),n.blitFramebuffer(0,0,a.width,a.height,0,0,a.width,a.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(o=0;o1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"];n.drawBuffers(r)}for(o=0;o1?"COLOR_ATTACHMENT"+y:"COLOR_ATTACHMENT"+y+"_WEBGL"];_.push(A),g.push(P),h.activeTexture(h["TEXTURE"+y]),h.bindTexture(h.TEXTURE_2D,A._webGLTexture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,E.mag),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,E.min),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(T),f,p,0,h.RGBA,this._getWebGLTextureType(T),null),h.framebufferTexture2D(h.DRAW_FRAMEBUFFER,P,h.TEXTURE_2D,A._webGLTexture,0),i&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(h.TEXTURE_2D,null),A._framebuffer=d,A._depthStencilBuffer=v,A.baseWidth=f,A.baseHeight=p,A.width=f,A.height=p,A.isReady=!0,A.samples=1,A.generateMipMaps=i,A.samplingMode=b,A.type=T,A._generateDepthBuffer=n,A._generateStencilBuffer=r,A._attachments=g,this._internalTexturesCache.push(A)}if(o&&this._caps.depthTextureExtension){var S=new et.a(this,et.a.DATASOURCE_MULTIRENDERTARGET);h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,S._webGLTexture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,this.webGLVersion<2?h.DEPTH_COMPONENT:h.DEPTH_COMPONENT16,f,p,0,h.DEPTH_COMPONENT,h.UNSIGNED_SHORT,null),h.framebufferTexture2D(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.TEXTURE_2D,S._webGLTexture,0),S._framebuffer=d,S.baseWidth=f,S.baseHeight=p,S.width=f,S.height=p,S.isReady=!0,S.samples=1,S.generateMipMaps=i,S.samplingMode=h.NEAREST,S._generateDepthBuffer=n,S._generateStencilBuffer=r,_.push(S),this._internalTexturesCache.push(S)}return h.drawBuffers(g),h.bindRenderbuffer(h.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),this.resetTextureCache(),_},Ce.b.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||0==e.length)return 1;if(e[0].samples===t)return t;var i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e[0]._depthStencilBuffer&&(i.deleteRenderbuffer(e[0]._depthStencilBuffer),e[0]._depthStencilBuffer=null),e[0]._MSAAFramebuffer&&(i.deleteFramebuffer(e[0]._MSAAFramebuffer),e[0]._MSAAFramebuffer=null);for(var n=0;n1){var r=i.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");this._bindUnboundFramebuffer(r);var o=this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer,e[0]._generateDepthBuffer,e[0].width,e[0].height,t),a=[];for(n=0;n1?"COLOR_ATTACHMENT"+n:"COLOR_ATTACHMENT"+n+"_WEBGL"],l=i.createRenderbuffer();if(!l)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,l),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(s.type),s.width,s.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,c,i.RENDERBUFFER,l),s._MSAAFramebuffer=r,s._MSAARenderBuffer=l,s.samples=t,s._depthStencilBuffer=o,i.bindRenderbuffer(i.RENDERBUFFER,null),a.push(c)}i.drawBuffers(a)}else this._bindUnboundFramebuffer(e[0]._framebuffer);return this._bindUnboundFramebuffer(null),t};var Xa=function(e){function t(t,i,n,r,o){var a=this,s=!(!o||!o.generateMipMaps)&&o.generateMipMaps,c=!(!o||!o.generateDepthTexture)&&o.generateDepthTexture,l=!o||void 0===o.doNotChangeAspectRatio||o.doNotChangeAspectRatio;if((a=e.call(this,t,i,r,s,l)||this)._engine=r.getEngine(),a.isSupported){for(var u=[],h=[],d=0;d1||this._engine.getCaps().drawBuffersExtension},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this._textures},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t=0;e--)void 0!==this._internalTextures[e]&&(this._internalTextures[e].dispose(),this._internalTextures.splice(e,1))},t}(Oi),Ya=function(){function e(e){this.name=Fe.a.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}return e.prototype.register=function(){this.scene._beforeClearStage.registerStep(Fe.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){Ie.b.StartPerformanceCounter("Procedural textures",this.scene.proceduralTextures.length>0);for(var e=0;e0)}},e}(),Ka="\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.proceduralVertexShader=Ka;var Qa=function(e){function t(t,i,n,r,a,s,c){void 0===a&&(a=null),void 0===s&&(s=!0),void 0===c&&(c=!1);var l=e.call(this,null,r,!s)||this;l.isCube=c,l.isEnabled=!0,l.autoClear=!0,l.onGeneratedObservable=new o.c,l._textures={},l._currentRefreshId=-1,l._refreshRate=1,l._vertexBuffers={},l._uniforms=new Array,l._samplers=new Array,l._floats={},l._ints={},l._floatsArrays={},l._colors3={},l._colors4={},l._vectors2={},l._vectors3={},l._matrices={},l._fallbackTextureUsed=!1,l._cachedDefines="",l._contentUpdateId=-1;var u=(r=l.getScene())._getComponent(Fe.a.NAME_PROCEDURALTEXTURE);u||(u=new Ya(r),r._addComponent(u)),r.proceduralTextures.push(l),l._engine=r.getEngine(),l.name=t,l.isRenderTarget=!0,l._size=i,l._generateMipMaps=s,l.setFragment(n),l._fallbackTexture=a,c?(l._texture=l._engine.createRenderTargetCubeTexture(i,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1}),l.setFloat("face",0)):l._texture=l._engine.createRenderTargetTexture(i,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1});var h=[];return h.push(1,1),h.push(-1,1),h.push(-1,-1),h.push(1,-1),l._vertexBuffers[Yi.b.PositionKind]=new Yi.b(l._engine,h,Yi.b.PositionKind,!1,!1,2),l._createIndexBuffer(),l}return h.d(t,e),t.prototype.getEffect=function(){return this._effect},t.prototype.getContent=function(){return this._contentData&&this._currentRefreshId==this._contentUpdateId?this._contentData:(this._contentData=this.readPixels(0,0,this._contentData),this._contentUpdateId=this._currentRefreshId,this._contentData)},t.prototype._createIndexBuffer=function(){var e=this._engine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},t.prototype._rebuild=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===Oi.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Oi.REFRESHRATE_RENDER_ONCE)},t.prototype.reset=function(){void 0!==this._effect&&this._effect.dispose()},t.prototype._getDefines=function(){return""},t.prototype.isReady=function(){var e,t=this,i=this._engine;if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;var n=this._getDefines();return!(!this._effect||n!==this._cachedDefines||!this._effect.isReady())||(e=void 0!==this._fragment.fragmentElement?{vertex:"procedural",fragmentElement:this._fragment.fragmentElement}:{vertex:"procedural",fragment:this._fragment},this._cachedDefines=n,this._effect=i.createEffect(e,[Yi.b.PositionKind],this._uniforms,this._samplers,n,void 0,void 0,function(){t.releaseInternalTexture(),t._fallbackTexture&&(t._texture=t._fallbackTexture._texture,t._texture&&t._texture.incrementReferences()),t._fallbackTextureUsed=!0}),this._effect.isReady())},t.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},t.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(t.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!0,configurable:!0}),t.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},t.prototype.getRenderSize=function(){return this._size},t.prototype.resize=function(e,t){this._fallbackTextureUsed||(this.releaseInternalTexture(),this._texture=this._engine.createRenderTargetTexture(e,t),this._size=e,this._generateMipMaps=t)},t.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.render=function(e){var t=this.getScene();if(t){var i=this._engine;for(var n in i.enableEffect(this._effect),i.setState(!1),this._textures)this._effect.setTexture(n,this._textures[n]);for(n in this._ints)this._effect.setInt(n,this._ints[n]);for(n in this._floats)this._effect.setFloat(n,this._floats[n]);for(n in this._floatsArrays)this._effect.setArray(n,this._floatsArrays[n]);for(n in this._colors3)this._effect.setColor3(n,this._colors3[n]);for(n in this._colors4){var r=this._colors4[n];this._effect.setFloat4(n,r.r,r.g,r.b,r.a)}for(n in this._vectors2)this._effect.setVector2(n,this._vectors2[n]);for(n in this._vectors3)this._effect.setVector3(n,this._vectors3[n]);for(n in this._matrices)this._effect.setMatrix(n,this._matrices[n]);if(this._texture){if(this.isCube)for(var o=0;o<6;o++)i.bindFramebuffer(this._texture,o,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this._effect.setFloat("face",o),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(No.a.TriangleFillMode,0,6),5===o&&i.generateMipMapsForCubemap(this._texture);else i.bindFramebuffer(this._texture,0,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(No.a.TriangleFillMode,0,6);i.unBindFramebuffer(this._texture,this.isCube),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},t.prototype.clone=function(){var e=this.getSize(),i=new t(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.coordinatesMode=this.coordinatesMode,i},t.prototype.dispose=function(){var t=this.getScene();if(t){var i=t.proceduralTextures.indexOf(this);i>=0&&t.proceduralTextures.splice(i,1);var n=this._vertexBuffers[Yi.b.PositionKind];n&&(n.dispose(),this._vertexBuffers[Yi.b.PositionKind]=null),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),e.prototype.dispose.call(this)}},h.c([Object(F.c)()],t.prototype,"isEnabled",void 0),h.c([Object(F.c)()],t.prototype,"autoClear",void 0),h.c([Object(F.c)()],t.prototype,"_generateMipMaps",void 0),h.c([Object(F.c)()],t.prototype,"_size",void 0),h.c([Object(F.c)()],t.prototype,"refreshRate",null),t}($e.a),qa=i(66),Za=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,n,null,r,o,a)||this;return s._animate=!0,s._time=0,s._texturePath=i,s._loadJson(i),s.refreshRate=1,s}return h.d(t,e),t.prototype._loadJson=function(e){var t=this,i=function(){m.a.Log("No config file found in "+e+" trying to use ShadersStore or DOM element");try{t.setFragment(t._texturePath)}catch(e){m.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture")}},n=e+"/config.json",r=new qa.a;r.open("GET",n),r.addEventListener("load",function(){if(200===r.status||r.responseText&&r.responseText.length>0)try{t._config=JSON.parse(r.response),t.updateShaderUniforms(),t.updateTextures(),t.setFragment(t._texturePath+"/custom"),t._animate=t._config.animate,t.refreshRate=t._config.refreshrate}catch(e){i()}else i()},!1),r.addEventListener("error",function(){i()},!1);try{r.send()}catch(e){m.a.Error("CustomProceduralTexture: Error on XHR send request.")}},t.prototype.isReady=function(){if(!e.prototype.isReady.call(this))return!1;for(var t in this._textures){if(!this._textures[t].isReady())return!1}return!0},t.prototype.render=function(t){var i=this.getScene();this._animate&&i&&(this._time+=.03*i.getAnimationRatio(),this.updateShaderUniforms()),e.prototype.render.call(this,t)},t.prototype.updateTextures=function(){for(var e=0;e0},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"NodeMaterialConnectionPoint"},e.prototype.canConnectTo=function(e){if(this.type!==e.type&&e.type!==ts.AutoDetect){switch(this.type){case ts.Vector3:if(e.type===ts.Color3)return!0;case ts.Vector4:if(e.type===ts.Color4)return!0;case ts.Color3:if(e.type===ts.Vector3)return!0;case ts.Color4:if(e.type===ts.Vector4)return!0}return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)}return!0},e.prototype.connectTo=function(e){if(!this.canConnectTo(e))throw"Cannot connect two different connection types.";return this._endpoints.push(e),e._connectedPoint=this,this._enforceAssociatedVariableName=!1,this},e.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t?this:(this._endpoints.splice(t,1),e._connectedPoint=null,this._enforceAssociatedVariableName=!1,e._enforceAssociatedVariableName=!1,this)},e.prototype.serialize=function(){var e={};return e.name=this.name,this.connectedPoint&&(e.inputName=this.name,e.targetBlockId=this.connectedPoint.ownerBlock.uniqueId,e.targetConnectionName=this.connectedPoint.name),e},e}(),ss=i(129),cs=function(){function e(e,t,i,n){void 0===t&&(t=es.Vertex),void 0===i&&(i=!1),void 0===n&&(n=!1),this._isFinalMerger=!1,this._isInput=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.name=e,this._target=t,this._isFinalMerger=i,this._isInput=n,this.uniqueId=ss.a.UniqueId}return Object.defineProperty(e.prototype,"isFinalMerger",{get:function(){return this._isFinalMerger},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInput",{get:function(){return this._isInput},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs},enumerable:!0,configurable:!0}),e.prototype.getInputByName=function(e){var t=this._inputs.filter(function(t){return t.name===e});return t.length?t[0]:null},e.prototype.getOutputByName=function(e){var t=this._outputs.filter(function(t){return t.name===e});return t.length?t[0]:null},e.prototype.initialize=function(e){},e.prototype.bind=function(e,t,i){},e.prototype._declareOutput=function(e,t){return t._getGLType(e.type)+" "+e.associatedVariableName},e.prototype._writeVariable=function(e){return e.connectedPoint?""+e.associatedVariableName:"0."},e.prototype._writeFloat=function(e){var t=e.toString();return-1===t.indexOf(".")&&(t+=".0"),""+t},e.prototype.getClassName=function(){return"NodeMaterialBlock"},e.prototype.registerInput=function(e,t,i,n){void 0===i&&(i=!1);var r=new as(e,this);return r.type=t,r.isOptional=i,n&&(r.target=n),this._inputs.push(r),this},e.prototype.registerOutput=function(e,t,i){var n=new as(e,this);return n.type=t,i&&(n.target=i),this._outputs.push(n),this},e.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,i=this._inputs;t=this._outputs.length?null:this._outputs[t+1]},e.prototype.connectTo=function(e,t){if(0!==this._outputs.length){for(var i=t&&t.output?this.getOutputByName(t.output):this.getFirstAvailableOutput(e),n=!0;n;){var r=t&&t.input?e.getInputByName(t.input):e.getFirstAvailableInput(i);if(i&&r&&i.canConnectTo(r))i.connectTo(r),n=!1;else{if(!i)throw"Unable to find a compatible match";i=this.getSiblingOutput(i)}}return this}},e.prototype._buildBlock=function(e){},e.prototype.updateUniformsAndSamples=function(e,t,i){},e.prototype.provideFallbacks=function(e,t){},e.prototype.prepareDefines=function(e,t,i,n){void 0===n&&(n=!1)},e.prototype.initializeDefines=function(e,t,i,n){void 0===n&&(n=!1)},e.prototype.autoConfigure=function(e){},e.prototype.replaceRepeatableContent=function(e,t,i,n){},e.prototype.isReady=function(e,t,i,n){return void 0===n&&(n=!1),!0},e.prototype._processBuild=function(e,t,i,n){if(e.build(t,n),t._vertexState&&0==(e.target&this.target)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute)){var r=i.connectedPoint;t._vertexState._emitVaryingFromString("v_"+r.associatedVariableName,t._getGLType(r.type)),t._vertexState.compilationString+="v_"+r.associatedVariableName+" = "+r.associatedVariableName+";\r\n",i.associatedVariableName="v_"+r.associatedVariableName,i._enforceAssociatedVariableName=!0}},e.prototype.build=function(e,t){if(this._buildId===e.sharedData.buildId)return!0;for(var i=0,n=this._inputs;i[0.."+i.repeatKey+"]\r\n";var n=ni.a.IncludesShadersStore[e]+"\r\n";if(this.sharedData.emitComments&&(n=t+"\r\n"+n),!i)return n;if(i.replaceStrings)for(var r=0;r[0.."+i.repeatKey+"]\r\n":this.functions[r]="#include<"+e+">\r\n",void(this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]));if(this.functions[r]=ni.a.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\s*?#ifdef.+$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#endif.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#else.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#elif.*$/gm,"")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\s*?attribute.+$/gm,"")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\s*?uniform.+$/gm,"")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\s*?varying.+$/gm,"")),i.replaceStrings)for(var o=0;o-1))return this._optimizers.push(e),this},t.prototype.unregisterOptimizer=function(e){var t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this},t.prototype.addOutputNode=function(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!=(e.target&es.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&es.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target?this:(0!=(e.target&es.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&es.Fragment)&&this._removeFragmentOutputNode(e),this)},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=es.Vertex,this._vertexOutputNodes.push(e),this},t.prototype._removeVertexOutputNode=function(e){var t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this},t.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=es.Fragment,this._fragmentOutputNodes.push(e),this},t.prototype._removeFragmentOutputNode=function(e){var t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this},t.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},t.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},t.prototype._initializeBlock=function(e,t,i){e.initialize(t),e.autoConfigure(this),-1===this.attachedBlocks.indexOf(e)&&this.attachedBlocks.push(e);for(var n=0,r=e.inputs;n0)for(y=0;y1&&r!=e.length-1?i._getNextFrameBuffer():t,i.setViewport(),i.applyEffectWrapper(n),o&&i.engine.bindFramebuffer(o.getInternalTexture()),i.draw(),o&&i.engine.unBindFramebuffer(o.getInternalTexture())})},e.prototype.dispose=function(){this._ringScreenBuffer&&(this._ringScreenBuffer.forEach(function(e){e.dispose()}),this._ringScreenBuffer=null);var e=this._vertexBuffers[Yi.b.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[Yi.b.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer)},e._DefaultOptions={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]},e}(),qs=function(){function e(e){var t;this.onApplyObservable=new o.c,t=e.vertexShader?{fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:{fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.effect=new ni.a(t,e.attributeNames||["position"],e.uniformNames||["scale"],e.samplerNames,e.engine)}return e.prototype.dispose=function(){this.effect.dispose()},e}(),Zs=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;ee.EPSILON?1:0;l|=h,u.push(h)}switch(l){case 0:(a.e.Dot(this.normal,t.plane.normal)>0?i:n).push(t);break;case 1:r.push(t);break;case 2:o.push(t);break;case 3:var d,f=[],p=[];for(s=0;s=3&&(d=new sc(f,t.shared)).plane&&r.push(d),p.length>=3&&(d=new sc(p,t.shared)).plane&&o.push(d)}},e.EPSILON=1e-5,e}(),sc=function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=ac.FromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map(function(e){return e.clone()}),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map(function(e){e.flip()}),this.plane.flip()},e}(),cc=function(){function e(e){this.plane=null,this.front=null,this.back=null,this.polygons=new Array,e&&this.build(e)}return e.prototype.clone=function(){var t=new e;return t.plane=this.plane&&this.plane.clone(),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t.polygons=this.polygons.map(function(e){return e.clone()}),t},e.prototype.invert=function(){for(var e=0;e1)?1:e.arc||1,c=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var l=2*Math.PI*s,u=l/a,h=0;ht.x&&(t.x=i.x),i.yt.y&&(t.y=i.y)}),{min:e,max:t,width:t.x-e.x,height:t.y-e.y}},e}(),vc=function(){function e(){}return e.Rectangle=function(e,t,i,n){return[new a.d(e,t),new a.d(i,t),new a.d(i,n),new a.d(e,n)]},e.Circle=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=32);for(var r=new Array,o=0,s=2*Math.PI/n,c=0;c0){var u=r.length/3;this._points.elements.forEach(function(t){n.push(0,-1,0),r.push(t.x,-e,t.y),o.push(1-(t.x-a.min.x)/a.width,1-(t.y-a.min.y)/a.height)});var h=s.length;for(l=0;lo.elements.length-1?o.elements[0]:o.elements[h+1],e.push(f.x,0,f.y),e.push(f.x,-s,f.y),e.push(d.x,0,d.y),e.push(d.x,-s,d.y);var p=new a.e(f.x,0,f.y),_=new a.e(d.x,0,d.y).subtract(p),m=new a.e(0,1,0),g=a.e.Cross(_,m);g=g.normalize(),i.push(u/r.width,0),i.push(u/r.width,1),u+=_.length(),i.push(u/r.width,0),i.push(u/r.width,1),c?(t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),n.push(l),n.push(l+2),n.push(l+1),n.push(l+1),n.push(l+2),n.push(l+3)):(t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),n.push(l),n.push(l+1),n.push(l+2),n.push(l+1),n.push(l+3),n.push(l+2)),l+=4}},e}();Xi.a.CreatePolygon=function(e,t,i,n,r,o){for(var c=i||new Array(3),l=n,u=[],h=0;h<3;h++)void 0===c[h]&&(c[h]=new a.f(0,0,1,1)),l&&void 0===l[h]&&(l[h]=new s.b(1,1,1,1));for(var d=e.getVerticesData(Yi.b.PositionKind),f=e.getVerticesData(Yi.b.NormalKind),p=e.getVerticesData(Yi.b.UVKind),_=e.getIndices(),m=0,g=0,v=0;v1?1:t.arc:1,o=void 0===t.closed||t.closed,s=t.shape,c=t.radius||1,l=t.tessellation||64,u=t.clip||0,h=t.updatable,d=Se.a._GetDefaultSideOrientation(t.sideOrientation),f=t.cap||Se.a.NO_CAP,p=2*Math.PI,_=new Array,m=t.invertUV||!1,g=0,v=0,y=p/l*r,b=new Array;for(g=0;g<=l-u;g++){b=[];for(f!=Se.a.CAP_START&&f!=Se.a.CAP_ALL||(b.push(new a.e(0,s[0].y,0)),b.push(new a.e(Math.cos(g*y)*s[0].x*c,s[0].y,Math.sin(g*y)*s[0].x*c))),v=0;v0||h>0){m=-d,g=-f;v=d,y=f;switch(r){case Se.a.CENTER:m-=c/=2,v+=c;break;case Se.a.LEFT:v+=c,p=-c/2;break;case Se.a.RIGHT:m-=c,p=c/2}switch(o){case Se.a.CENTER:g-=h/=2,y+=h;break;case Se.a.BOTTOM:y+=h,_=-h/2;break;case Se.a.TOP:g-=h,_=h/2}}var b=[],T=[],E=[];E[0]=[0,0,1,0,1,1,0,1],E[1]=[0,0,1,0,1,1,0,1],t!==Se.a.ROTATE_TILE&&t!==Se.a.ROTATE_ROW||(E[1]=[1,1,0,1,0,0,1,0]),t!==Se.a.FLIP_TILE&&t!==Se.a.FLIP_ROW||(E[1]=[1,0,0,0,0,1,1,1]),t!==Se.a.FLIP_N_ROTATE_TILE&&t!==Se.a.FLIP_N_ROTATE_ROW||(E[1]=[0,1,1,1,1,0,0,0]);for(var A=[],P=[],S=[],R=0,x=0;x0||h>0){var M,O,I,D,L=h>0&&(o===Se.a.CENTER||o===Se.a.TOP),w=h>0&&(o===Se.a.CENTER||o===Se.a.BOTTOM),F=c>0&&(r===Se.a.CENTER||r===Se.a.RIGHT),N=c>0&&(r===Se.a.CENTER||r===Se.a.LEFT),B=[];if(L&&F&&(b.push(m+p,g+_,0),b.push(-d+p,g+_,0),b.push(-d+p,g+h+_,0),b.push(m+p,g+h+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=1-c/i,O=1-h/n,I=1,O,I,D=1,M,D],t===Se.a.ROTATE_ROW&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),t===Se.a.FLIP_ROW&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),t===Se.a.FLIP_N_ROTATE_ROW&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),L&&N&&(b.push(d+p,g+_,0),b.push(v+p,g+_,0),b.push(v+p,g+h+_,0),b.push(d+p,g+h+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=0,O=1-h/n,I=c/i,O,I,D=1,M,D],(t===Se.a.ROTATE_ROW||t===Se.a.ROTATE_TILE&&s%2==0)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW||t===Se.a.FLIP_TILE&&s%2==0)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW||t===Se.a.FLIP_N_ROTATE_TILE&&s%2==0)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&F&&(b.push(m+p,f+_,0),b.push(-d+p,f+_,0),b.push(-d+p,y+_,0),b.push(m+p,y+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=1-c/i,O=0,I=1,O,I,D=h/n,M,D],(t===Se.a.ROTATE_ROW&&u%2==1||t===Se.a.ROTATE_TILE&&u%1==0)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW&&u%2==1||t===Se.a.FLIP_TILE&&u%2==0)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW&&u%2==1||t===Se.a.FLIP_N_ROTATE_TILE&&u%2==0)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&N&&(b.push(d+p,f+_,0),b.push(v+p,f+_,0),b.push(v+p,y+_,0),b.push(d+p,y+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=0,O=0,I=c/i,O,I,D=h/n,M,D],(t===Se.a.ROTATE_ROW&&u%2==1||t===Se.a.ROTATE_TILE&&(u+s)%2==1)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW&&u%2==1||t===Se.a.FLIP_TILE&&(u+s)%2==1)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW&&u%2==1||t===Se.a.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),L){var U=[];M=0,O=1-h/n,I=1,D=1,U[0]=[M,O,I,O,I,D,M,D],U[1]=[M,O,I,O,I,D,M,D],t!==Se.a.ROTATE_TILE&&t!==Se.a.ROTATE_ROW||(U[1]=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),t!==Se.a.FLIP_TILE&&t!==Se.a.FLIP_ROW||(U[1]=[1-M,O,1-I,O,1-I,D,1-M,D]),t!==Se.a.FLIP_N_ROTATE_TILE&&t!==Se.a.FLIP_N_ROTATE_ROW||(U[1]=[M,1-O,I,1-O,I,1-D,M,1-D]);for(C=0;C1)?1:t.arc||1;var f,p,_=function(e,t,i,n,r,o,s,c){for(var l,u,h,d,f=t.getTangents(),p=t.getNormals(),_=t.getDistances(),m=2*Math.PI/r*c,g=o||function(){return n},v=a.c.Matrix[0],y=s===Se.a.NO_CAP||s===Se.a.CAP_END?0:2,b=0;b3?0:l,t.arc);var v=Ea.CreateRibbon(e,{pathArray:p,closePath:!0,closeArray:!1,updatable:h,sideOrientation:d,invertUV:u,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return v._creationDataStorage.pathArray=p,v._creationDataStorage.path3D=f,v._creationDataStorage.tessellation=s,v._creationDataStorage.cap=l,v._creationDataStorage.arc=t.arc,v._creationDataStorage.radius=o,v},e}();Xi.a.CreateIcoSphere=function(e){var t,i=e.sideOrientation||Xi.a.DEFAULTSIDE,n=e.radius||1,r=void 0===e.flat||e.flat,o=e.subdivisions||4,s=e.radiusX||n,c=e.radiusY||n,l=e.radiusZ||n,u=(1+Math.sqrt(5))/2,h=[-1,u,-0,1,u,0,-1,-u,0,1,-u,0,0,-1,-u,0,1,-u,0,-1,u,0,1,u,u,0,1,u,0,-1,-u,0,1,-u,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],f=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],p=[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],_=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],m=new Array,g=new Array,v=new Array,y=new Array,b=0,T=new Array(3),E=new Array(3);for(t=0;t<3;t++)T[t]=a.e.Zero(),E[t]=a.d.Zero();for(var A=0;A<20;A++){for(t=0;t<3;t++){var P=d[3*A+t];T[t].copyFromFloats(h[3*f[P]],h[3*f[P]+1],h[3*f[P]+2]),T[t].normalize().scaleInPlace(n),E[t].copyFromFloats(p[2*P]*(138/1024)+60/1024+_[A]*(-40/1024),p[2*P+1]*(239/1024)+26/1024+_[A]*(20/1024))}for(var S=function(e,t,i,n){var u,h=a.e.Lerp(T[0],T[2],t/o),d=a.e.Lerp(T[1],T[2],t/o),f=o===t?T[2]:a.e.Lerp(h,d,e/(o-t));if(f.normalize(),r){var p=a.e.Lerp(T[0],T[2],n/o),_=a.e.Lerp(T[1],T[2],n/o);u=a.e.Lerp(p,_,i/(o-n))}else u=new a.e(f.x,f.y,f.z);u.x/=s,u.y/=c,u.z/=l,u.normalize();var A=a.d.Lerp(E[0],E[2],t/o),P=a.d.Lerp(E[1],E[2],t/o),S=o===t?E[2]:a.d.Lerp(A,P,e/(o-t));g.push(f.x*s,f.y*c,f.z*l),v.push(u.x,u.y,u.z),y.push(S.x,S.y),m.push(b),b++},R=0;R0)?1:0)+((c=a.e.Dot(e[o+1].position,t)-i>0)?1:0)+((u=a.e.Dot(e[o+2].position,t)-i>0)?1:0)){case 0:r.push(e[o]),r.push(e[o+1]),r.push(e[o+2]);break;case 1:if(s&&(h=e[o+1],d=e[o+2],f=n(e[o],h),p=n(e[o],d)),c){h=e[o],d=e[o+2],f=n(e[o+1],h),p=n(e[o+1],d),r.push(f),r.push(d.clone()),r.push(h.clone()),r.push(d.clone()),r.push(f.clone()),r.push(p);break}u&&(h=e[o],d=e[o+1],f=n(e[o+2],h),p=n(e[o+2],d)),h&&d&&f&&p&&(r.push(h.clone()),r.push(d.clone()),r.push(f),r.push(p),r.push(f.clone()),r.push(d.clone()));break;case 2:s||(d=n(h=e[o].clone(),e[o+1]),f=n(h,e[o+2]),r.push(h),r.push(d),r.push(f)),c||(d=n(h=e[o+1].clone(),e[o+2]),f=n(h,e[o]),r.push(h),r.push(d),r.push(f)),u||(d=n(h=e[o+2].clone(),e[o]),f=n(h,e[o+1]),r.push(h),r.push(d),r.push(f))}}return r},P=0;Pc||i.deleted||i.isDirty))for(var r=0;r<3;++r)if(i.error[r]>0,function(e){if(r){var t=e+s.verticesStart,o=a.e.FromArray(r,3*t),l=function(e){if(i)for(var t=0;t0&&this._reconstructedMesh.setVerticesData(Yi.b.UVKind,s),c.length>0&&this._reconstructedMesh.setVerticesData(Yi.b.ColorKind,c);var y=this._mesh.subMeshes[e];e>0&&(this._reconstructedMesh.subMeshes=[],m.forEach(function(e){nc.b.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),nc.b.AddToMesh(y.materialIndex,_,d,p,3*r.length,this._reconstructedMesh))},e.prototype.initDecimatedMesh=function(){this._reconstructedMesh=new Se.a(this._mesh.name+"Decimated",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId},e.prototype.isFlipped=function(e,t,i,n,r){for(var o=0;o.999)return!0;var f=a.e.Cross(h,d).normalize();if(n[o]=!1,a.e.Dot(f,s.normal)<.2)return!0}else n[o]=!0,r.push(s)}}return!1},e.prototype.updateTriangles=function(e,t,i,n){for(var r=n,o=0;o-1&&(this.agents.splice(t,1),this.transforms.splice(t,1))},e.prototype.getAgents=function(){return this.agents},e.prototype.update=function(e){this.recastCrowd.update(e);for(var t=0;t=400&&o?o(l):i()},!1),l.addEventListener("error",function(){m.a.Error("error on XHR request."),i()},!1),l.send()}else m.a.Error("Error: IndexedDB not supported by your browser or Babylon.js Database is not open."),i()},e._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&e.responseText.length>0)return!0;if(1===t)return!1}if(2&t){var i=ka.GetTGAHeader(e.response);if(i.width&&i.height&&i.width>0&&i.height>0)return!0;if(2===t)return!1}if(4&t){var n=new Uint8Array(e.response,0,3);return 68===n[0]&&68===n[1]&&83===n[2]}}catch(e){}return!1},e.IsUASupportingBlobStorage=!0,e.IDBStorageEnabled=!1,e._ParseURL=function(e){document.createElement("a").href=e;var t=e.substring(0,e.lastIndexOf("#")),i=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(i,0))},e._ReturnFullUrlLocation=function(t){return-1===t.indexOf("http:/")&&-1===t.indexOf("https:/")?e._ParseURL(window.location.href)+t:t},e}(),jc=function(){function e(){this.direction1=new a.e(0,1,0),this.direction2=new a.e(0,1,0),this.minEmitBox=new a.e(-.5,-.5,-.5),this.maxEmitBox=new a.e(.5,.5,.5)}return e.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=w.a.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),r=w.a.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),o=w.a.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);a.e.TransformCoordinatesFromFloatsToRef(n,r,o,e,t)},e.prototype.clone=function(){var t=new e;return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)},e.prototype.getEffectDefines=function(){return"#define BOXEMITTER"},e.prototype.getClassName=function(){return"BoxParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e},e.prototype.parse=function(e){a.e.FromArrayToRef(e.direction1,0,this.direction1),a.e.FromArrayToRef(e.direction2,0,this.direction2),a.e.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),a.e.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},e}(),Wc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=Math.PI),void 0===i&&(i=0),this.directionRandomizer=i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}return Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!0,configurable:!0}),e.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},e.prototype.startDirectionFunction=function(e,t,i){if(1===Math.abs(Math.cos(this._angle)))a.e.TransformNormalFromFloatsToRef(0,1,0,e,t);else{var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)}},e.prototype.startPositionFunction=function(e,t,i){var n,r=w.a.RandomRange(0,2*Math.PI);n=this.emitFromSpawnPointOnly?1e-4:1-(n=w.a.RandomRange(0,this.heightRange))*n;var o=this._radius-w.a.RandomRange(0,this._radius*this.radiusRange),s=(o*=n)*Math.sin(r),c=o*Math.cos(r),l=n*this._height;a.e.TransformCoordinatesFromFloatsToRef(s,l,c,e,t)},e.prototype.clone=function(){var t=new e(this._radius,this._angle,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},e.prototype.getClassName=function(){return"ConeParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer},e}(),Hc=function(){function e(e,t,i,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=0),this.radius=e,this.height=t,this.radiusRange=i,this.directionRandomizer=n}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),o=Math.atan2(n.x,n.z);o+=w.a.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,n.y=r,n.x=Math.sin(o),n.z=Math.cos(o),n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=w.a.RandomRange(-this.height/2,this.height/2),r=w.a.RandomRange(0,2*Math.PI),o=w.a.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(o)*this.radius,c=s*Math.cos(r),l=s*Math.sin(r);a.e.TransformCoordinatesFromFloatsToRef(c,n,l,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},e.prototype.getClassName=function(){return"CylinderParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Xc=function(e){function t(t,i,n,r,o){void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=new a.e(0,1,0)),void 0===o&&(o=new a.e(0,1,0));var s=e.call(this,t,i,n)||this;return s.direction1=r,s.direction2=o,s}return h.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return M.a.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},t.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(Hc),Yc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-w.a.RandomRange(0,this.radius*this.radiusRange),r=w.a.RandomRange(0,1),o=w.a.RandomRange(0,2*Math.PI),s=Math.acos(2*r-1),c=n*Math.cos(o)*Math.sin(s),l=n*Math.cos(s),u=n*Math.sin(o)*Math.sin(s);a.e.TransformCoordinatesFromFloatsToRef(c,Math.abs(l),u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},e.prototype.getClassName=function(){return"HemisphericParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Kc=function(){function e(){this.direction1=new a.e(0,1,0),this.direction2=new a.e(0,1,0)}return e.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},e.prototype.startPositionFunction=function(e,t,i){a.e.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},e.prototype.clone=function(){var t=new e;return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},e.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},e.prototype.getClassName=function(){return"PointParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},e.prototype.parse=function(e){a.e.FromArrayToRef(e.direction1,0,this.direction1),a.e.FromArrayToRef(e.direction2,0,this.direction2)},e}(),Qc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-w.a.RandomRange(0,this.radius*this.radiusRange),r=w.a.RandomRange(0,1),o=w.a.RandomRange(0,2*Math.PI),s=Math.acos(2*r-1),c=n*Math.cos(o)*Math.sin(s),l=n*Math.cos(s),u=n*Math.sin(o)*Math.sin(s);a.e.TransformCoordinatesFromFloatsToRef(c,l,u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},e.prototype.getClassName=function(){return"SphereParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),qc=function(e){function t(t,i,n){void 0===t&&(t=1),void 0===i&&(i=new a.e(0,1,0)),void 0===n&&(n=new a.e(0,1,0));var r=e.call(this,t)||this;return r.direction1=i,r.direction2=n,r}return h.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return M.a.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},t.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(Qc),Zc=function(){function e(t){this.animations=[],this.renderingGroupId=0,this.emitter=null,this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this.noiseStrength=new a.e(10,10,10),this.onAnimationEnd=null,this.blendMode=e.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteRandomStartCell=!1,this.translationPivot=new a.d(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new a.e(0,0,0),this.gravity=a.e.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new s.b(1,1,1,1),this.color2=new s.b(1,1,1,1),this.colorDead=new s.b(0,0,0,1),this.textureMask=new s.b(1,1,1,1),this._isSubEmitter=!1,this.billboardMode=g.a.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new Gi.b,this.id=t,this.name=t}return Object.defineProperty(e.prototype,"noiseTexture",{get:function(){return this._noiseTexture},set:function(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnimationSheetEnabled",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&this._startSizeGradients.length>0||this._emitRateGradients&&this._emitRateGradients.length>0||this._lifeTimeGradients&&this._lifeTimeGradients.length>0},e.prototype.getDragGradients=function(){return this._dragGradients},e.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},e.prototype.getColorGradients=function(){return this._colorGradients},e.prototype.getSizeGradients=function(){return this._sizeGradients},e.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},e.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},e.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},e.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},e.prototype.getVelocityGradients=function(){return this._velocityGradients},e.prototype.getStartSizeGradients=function(){return this._startSizeGradients},e.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(e.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:a.e.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:a.e.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration=e||this._scene.imageProcessingConfiguration)},e.prototype._reset=function(){},e.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var n=0,r=0,o=t;r=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var a=t.length-1;i(t[a],t[a],1)},e}(),il=function(){function e(t){this.particleSystem=t,this.position=a.e.Zero(),this.direction=a.e.Zero(),this.color=new s.b(0,0,0,0),this.colorStep=new s.b(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new a.d(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new s.b(0,0,0,0),this._currentColor2=new s.b(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=e._Count++,this.particleSystem.isAnimationSheetEnabled&&this.updateCellInfoFromSystem()}return e.prototype.updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},e.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i=this._initialEndSpriteCellID-this._initialStartSpriteCellID,n=w.a.Clamp(e*t%this.lifeTime/this.lifeTime);this.cellIndex=this._initialStartSpriteCellID+n*i|0},e.prototype._inheritParticleInfoToSubEmitter=function(e){if(e.particleSystem.emitter.position){var t=e.particleSystem.emitter;t.position.copyFrom(this.position),e.inheritDirection&&(t.position.subtractToRef(this.direction,a.c.Vector3[0]),t.lookAt(a.c.Vector3[0],0,Math.PI/2))}else{e.particleSystem.emitter.copyFrom(this.position)}this.direction.scaleToRef(e.inheritedVelocityAmount/2,a.c.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(a.c.Vector3[0])},e.prototype._inheritParticleInfoToSubEmitters=function(){var e=this;this._attachedSubEmitters&&this._attachedSubEmitters.length>0&&this._attachedSubEmitters.forEach(function(t){e._inheritParticleInfoToSubEmitter(t)})},e.prototype._reset=function(){this.age=0,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0},e.prototype.copyTo=function(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID),this.particleSystem.useRampGradients&&e.remapData.copyFrom(this.remapData),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},e._Count=0,e}();!function(e){e[e.ATTACHED=0]="ATTACHED",e[e.END=1]="END"}(Gc||(Gc={}));var nl=function(){function e(e){this.particleSystem=e,this.type=Gc.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(e.emitter=new Ye.a("SubemitterSystemEmitter",e.getScene())),e.onDisposeObservable.add(function(){e.emitter&&e.emitter.dispose&&e.emitter.dispose()})}return e.prototype.clone=function(){var t=this.particleSystem.emitter;t?t instanceof a.e?t=t.clone():t instanceof Ye.a&&((t=new Se.a("",t.getScene())).isVisible=!1):t=new a.e;var i=new e(this.particleSystem.clone("",t));return i.particleSystem.name+="Clone",i.type=this.type,i.inheritDirection=this.inheritDirection,i.inheritedVelocityAmount=this.inheritedVelocityAmount,i.particleSystem._disposeEmitterOnDispose=!0,i.particleSystem.disposeOnStop=!0,i},e.prototype.serialize=function(){var e={};return e.type=this.type,e.inheritDirection=this.inheritDirection,e.inheritedVelocityAmount=this.inheritedVelocityAmount,e.particleSystem=this.particleSystem.serialize(),e},e._ParseParticleSystem=function(e,t,i){throw De.a.WarnImport("ParseParticle")},e.Parse=function(t,i,n){var r=t.particleSystem,o=new e(e._ParseParticleSystem(r,i,n));return o.type=t.type,o.inheritDirection=t.inheritDirection,o.inheritedVelocityAmount=t.inheritedVelocityAmount,o.particleSystem._isSubEmitter=!0,o},e.prototype.dispose=function(){this.particleSystem.dispose()},e}(),rl="\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\n\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n}";ni.a.ShadersStore.particlesPixelShader=rl;var ol="\nattribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos;\n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\nvoid main(void) {\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\n\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\n\ngl_Position=projection*vec4(viewPos,1.0);\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(worldPos,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset*particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*vec4(viewPos,1.0);\n#endif\n#include\n}";ni.a.ShadersStore.particlesVertexShader=ol;var al=function(e){function t(t,i,n,r,c,l){void 0===r&&(r=null),void 0===c&&(c=!1),void 0===l&&(l=.01);var u=e.call(this,t)||this;return u._inheritedVelocityOffset=new a.e,u.onDisposeObservable=new o.c,u._particles=new Array,u._stockParticles=new Array,u._newPartsExcess=0,u._vertexBuffers={},u._scaledColorStep=new s.b(0,0,0,0),u._colorDiff=new s.b(0,0,0,0),u._scaledDirection=a.e.Zero(),u._scaledGravity=a.e.Zero(),u._currentRenderId=-1,u._useInstancing=!1,u._started=!1,u._stopped=!1,u._actualFrame=0,u._currentEmitRate1=0,u._currentEmitRate2=0,u._currentStartSize1=0,u._currentStartSize2=0,u._rawTextureWidth=256,u._useRampGradients=!1,u._disposeEmitterOnDispose=!1,u.recycleParticle=function(e){var t=u._particles.pop();t!==e&&t.copyTo(e),u._stockParticles.push(t)},u._createParticle=function(){var e;if(0!==u._stockParticles.length?(e=u._stockParticles.pop())._reset():e=new il(u),u._subEmitters&&u._subEmitters.length>0){var t=u._subEmitters[Math.floor(Math.random()*u._subEmitters.length)];e._attachedSubEmitters=[],t.forEach(function(t){if(t.type===Gc.ATTACHED){var i=t.clone();e._attachedSubEmitters.push(i),i.particleSystem.start()}})}return e},u._emitFromParticle=function(e){if(u._subEmitters&&0!==u._subEmitters.length){var t=Math.floor(Math.random()*u._subEmitters.length);u._subEmitters[t].forEach(function(t){if(t.type===Gc.END){var i=t.clone();e._inheritParticleInfoToSubEmitter(i),i.particleSystem._rootParticleSystem=u,u.activeSubSystems.push(i.particleSystem),i.particleSystem.start()}})}},u._capacity=i,u._epsilon=l,u._isAnimationSheetEnabled=c,u._scene=n||C.a.LastCreatedScene,u._attachImageProcessingConfiguration(null),u._customEffect=r,u._scene.particleSystems.push(u),u._useInstancing=u._scene.getEngine().getCaps().instancedArrays,u._createIndexBuffer(),u._createVertexBuffers(),u.particleEmitterType=new jc,u.updateFunction=function(e){var t=null,i=null;u.noiseTexture&&(t=u.noiseTexture.getSize(),i=u.noiseTexture.getContent());for(var n,r=function(){n=e[o];var r=u._scaledUpdateSpeed,c=n.age;if(n.age+=r,n.age>n.lifeTime){var l=n.age-c;r=(n.lifeTime-c)*r/l,n.age=n.lifeTime}var h=n.age/n.lifeTime;u._colorGradients&&u._colorGradients.length>0?tl.GetCurrentGradient(h,u._colorGradients,function(e,t,i){e!==n._currentColorGradient&&(n._currentColor1.copyFrom(n._currentColor2),t.getColorToRef(n._currentColor2),n._currentColorGradient=e),s.b.LerpToRef(n._currentColor1,n._currentColor2,i,n.color)}):(n.colorStep.scaleToRef(r,u._scaledColorStep),n.color.addInPlace(u._scaledColorStep),n.color.a<0&&(n.color.a=0)),u._angularSpeedGradients&&u._angularSpeedGradients.length>0&&tl.GetCurrentGradient(h,u._angularSpeedGradients,function(e,t,i){e!==n._currentAngularSpeedGradient&&(n._currentAngularSpeed1=n._currentAngularSpeed2,n._currentAngularSpeed2=t.getFactor(),n._currentAngularSpeedGradient=e),n.angularSpeed=w.a.Lerp(n._currentAngularSpeed1,n._currentAngularSpeed2,i)}),n.angle+=n.angularSpeed*r;var d=r;if(u._velocityGradients&&u._velocityGradients.length>0&&tl.GetCurrentGradient(h,u._velocityGradients,function(e,t,i){e!==n._currentVelocityGradient&&(n._currentVelocity1=n._currentVelocity2,n._currentVelocity2=t.getFactor(),n._currentVelocityGradient=e),d*=w.a.Lerp(n._currentVelocity1,n._currentVelocity2,i)}),n.direction.scaleToRef(d,u._scaledDirection),u._limitVelocityGradients&&u._limitVelocityGradients.length>0&&tl.GetCurrentGradient(h,u._limitVelocityGradients,function(e,t,i){e!==n._currentLimitVelocityGradient&&(n._currentLimitVelocity1=n._currentLimitVelocity2,n._currentLimitVelocity2=t.getFactor(),n._currentLimitVelocityGradient=e);var r=w.a.Lerp(n._currentLimitVelocity1,n._currentLimitVelocity2,i);n.direction.length()>r&&n.direction.scaleInPlace(u.limitVelocityDamping)}),u._dragGradients&&u._dragGradients.length>0&&tl.GetCurrentGradient(h,u._dragGradients,function(e,t,i){e!==n._currentDragGradient&&(n._currentDrag1=n._currentDrag2,n._currentDrag2=t.getFactor(),n._currentDragGradient=e);var r=w.a.Lerp(n._currentDrag1,n._currentDrag2,i);u._scaledDirection.scaleInPlace(1-r)}),n.position.addInPlace(u._scaledDirection),i&&t&&n._randomNoiseCoordinates1){var f=u._fetchR(n._randomNoiseCoordinates1.x,n._randomNoiseCoordinates1.y,t.width,t.height,i),p=u._fetchR(n._randomNoiseCoordinates1.z,n._randomNoiseCoordinates2.x,t.width,t.height,i),_=u._fetchR(n._randomNoiseCoordinates2.y,n._randomNoiseCoordinates2.z,t.width,t.height,i),m=a.c.Vector3[0],g=a.c.Vector3[1];m.copyFromFloats((2*f-1)*u.noiseStrength.x,(2*p-1)*u.noiseStrength.y,(2*_-1)*u.noiseStrength.z),m.scaleToRef(r,g),n.direction.addInPlace(g)}if(u.gravity.scaleToRef(r,u._scaledGravity),n.direction.addInPlace(u._scaledGravity),u._sizeGradients&&u._sizeGradients.length>0&&tl.GetCurrentGradient(h,u._sizeGradients,function(e,t,i){e!==n._currentSizeGradient&&(n._currentSize1=n._currentSize2,n._currentSize2=t.getFactor(),n._currentSizeGradient=e),n.size=w.a.Lerp(n._currentSize1,n._currentSize2,i)}),u._useRampGradients&&(u._colorRemapGradients&&u._colorRemapGradients.length>0&&tl.GetCurrentGradient(h,u._colorRemapGradients,function(e,t,i){var r=w.a.Lerp(e.factor1,t.factor1,i),o=w.a.Lerp(e.factor2,t.factor2,i);n.remapData.x=r,n.remapData.y=o-r}),u._alphaRemapGradients&&u._alphaRemapGradients.length>0&&tl.GetCurrentGradient(h,u._alphaRemapGradients,function(e,t,i){var r=w.a.Lerp(e.factor1,t.factor1,i),o=w.a.Lerp(e.factor2,t.factor2,i);n.remapData.z=r,n.remapData.w=o-r})),u._isAnimationSheetEnabled&&n.updateCellIndex(),n._inheritParticleInfoToSubEmitters(),n.age>=n.lifeTime)return u._emitFromParticle(n),n._attachedSubEmitters&&(n._attachedSubEmitters.forEach(function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()}),n._attachedSubEmitters=null),u.recycleParticle(n),o--,"continue"},o=0;ot.gradient?1:0})},t.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,n=0,r=e;nt.gradient?1:0}),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture(),this},t.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&this._rampGradients.length>0&&this._createRampGradientTexture(),this},t.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new Jc;return n.gradient=e,n.color1=t,n.color2=i,this._colorGradients.push(n),this._colorGradients.sort(function(e,t){return e.gradientt.gradient?1:0}),this},t.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,n=this._colorGradients;i0&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),this._emitRateGradients.length>1&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(this._startSizeGradients.length>0&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),this._startSizeGradients.length>1&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){this.emitter instanceof Ye.a&&this.emitter.computeWorldMatrix(!0);var i=this.noiseTexture;if(i&&i.onGeneratedObservable)i.onGeneratedObservable.addOnce(function(){setTimeout(function(){for(var e=0;e0&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},t.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped=!0,e&&this._stopSubEmitters()},t.prototype.reset=function(){this._stockParticles=[],this._particles=[]},t.prototype._appendParticleVertex=function(e,i,n,r){var o=e*this._vertexBufferSize;this._vertexData[o++]=i.position.x+this.worldOffset.x,this._vertexData[o++]=i.position.y+this.worldOffset.y,this._vertexData[o++]=i.position.z+this.worldOffset.z,this._vertexData[o++]=i.color.r,this._vertexData[o++]=i.color.g,this._vertexData[o++]=i.color.b,this._vertexData[o++]=i.color.a,this._vertexData[o++]=i.angle,this._vertexData[o++]=i.scale.x*i.size,this._vertexData[o++]=i.scale.y*i.size,this._isAnimationSheetEnabled&&(this._vertexData[o++]=i.cellIndex),this._isBillboardBased?this.billboardMode===t.BILLBOARDMODE_STRETCHED&&(this._vertexData[o++]=i.direction.x,this._vertexData[o++]=i.direction.y,this._vertexData[o++]=i.direction.z):i._initialDirection?(this._vertexData[o++]=i._initialDirection.x,this._vertexData[o++]=i._initialDirection.y,this._vertexData[o++]=i._initialDirection.z):(this._vertexData[o++]=i.direction.x,this._vertexData[o++]=i.direction.y,this._vertexData[o++]=i.direction.z),this._useRampGradients&&(this._vertexData[o++]=i.remapData.x,this._vertexData[o++]=i.remapData.y,this._vertexData[o++]=i.remapData.z,this._vertexData[o++]=i.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon)),this._vertexData[o++]=n,this._vertexData[o++]=r)},t.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach(function(e){e.stop(!0)}),this.activeSubSystems=new Array)},t.prototype._removeFromRoot=function(){if(this._rootParticleSystem){var e=this._rootParticleSystem.activeSubSystems.indexOf(this);-1!==e&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null}},t.prototype._update=function(e){var t,i=this;if(this._alive=this._particles.length>0,this.emitter.position){var n=this.emitter;this._emitterWorldMatrix=n.getWorldMatrix()}else{var r=this.emitter;this._emitterWorldMatrix=a.a.Translation(r.x,r.y,r.z)}this.updateFunction(this._particles);for(var o,c=function(){if(l._particles.length===l._capacity)return"break";t=l._createParticle(),l._particles.push(t);var e=w.a.RandomRange(l.minEmitPower,l.maxEmitPower);if(l.startPositionFunction?l.startPositionFunction(l._emitterWorldMatrix,t.position,t):l.particleEmitterType.startPositionFunction(l._emitterWorldMatrix,t.position,t),l.startDirectionFunction?l.startDirectionFunction(l._emitterWorldMatrix,t.direction,t):l.particleEmitterType.startDirectionFunction(l._emitterWorldMatrix,t.direction,t),0===e?t._initialDirection?t._initialDirection.copyFrom(t.direction):t._initialDirection=t.direction.clone():t._initialDirection=null,t.direction.scaleInPlace(e),l.targetStopDuration&&l._lifeTimeGradients&&l._lifeTimeGradients.length>0){var n=w.a.Clamp(l._actualFrame/l.targetStopDuration);tl.GetCurrentGradient(n,l._lifeTimeGradients,function(e,i){var r=e,o=i,a=r.getFactor(),s=o.getFactor(),c=(n-r.gradient)/(o.gradient-r.gradient);t.lifeTime=w.a.Lerp(a,s,c)})}else t.lifeTime=w.a.RandomRange(l.minLifeTime,l.maxLifeTime);if(l._sizeGradients&&0!==l._sizeGradients.length?(t._currentSizeGradient=l._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,l._sizeGradients.length>1?t._currentSize2=l._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=w.a.RandomRange(l.minSize,l.maxSize),t.scale.copyFromFloats(w.a.RandomRange(l.minScaleX,l.maxScaleX),w.a.RandomRange(l.minScaleY,l.maxScaleY)),l._startSizeGradients&&l._startSizeGradients[0]&&l.targetStopDuration){var r=l._actualFrame/l.targetStopDuration;tl.GetCurrentGradient(r,l._startSizeGradients,function(e,n,r){e!==i._currentStartSizeGradient&&(i._currentStartSize1=i._currentStartSize2,i._currentStartSize2=n.getFactor(),i._currentStartSizeGradient=e);var o=w.a.Lerp(i._currentStartSize1,i._currentStartSize2,r);t.scale.scaleInPlace(o)})}l._angularSpeedGradients&&0!==l._angularSpeedGradients.length?(t._currentAngularSpeedGradient=l._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,l._angularSpeedGradients.length>1?t._currentAngularSpeed2=l._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=w.a.RandomRange(l.minAngularSpeed,l.maxAngularSpeed),t.angle=w.a.RandomRange(l.minInitialRotation,l.maxInitialRotation),l._velocityGradients&&l._velocityGradients.length>0&&(t._currentVelocityGradient=l._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),l._velocityGradients.length>1?t._currentVelocity2=l._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),l._limitVelocityGradients&&l._limitVelocityGradients.length>0&&(t._currentLimitVelocityGradient=l._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),l._limitVelocityGradients.length>1?t._currentLimitVelocity2=l._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),l._dragGradients&&l._dragGradients.length>0&&(t._currentDragGradient=l._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),l._dragGradients.length>1?t._currentDrag2=l._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),l._colorGradients&&0!==l._colorGradients.length?(t._currentColorGradient=l._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),l._colorGradients.length>1?l._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color)):(o=w.a.RandomRange(0,1),s.b.LerpToRef(l.color1,l.color2,o,t.color),l.colorDead.subtractToRef(t.color,l._colorDiff),l._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)),l._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=l.startSpriteCellID,t._initialEndSpriteCellID=l.endSpriteCellID),t.direction.addInPlace(l._inheritedVelocityOffset),l._useRampGradients&&(t.remapData=new a.f(0,1,0,1)),l.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new a.e(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new a.e(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()},l=this,u=0;u-1)i=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{var n=this.emitRate;if(this._emitRateGradients&&this._emitRateGradients.length>0&&this.targetStopDuration){var r=this._actualFrame/this.targetStopDuration;tl.GetCurrentGradient(r,this._emitRateGradients,function(e,i,r){e!==t._currentEmitRateGradient&&(t._currentEmitRate1=t._currentEmitRate2,t._currentEmitRate2=i.getFactor(),t._currentEmitRateGradient=e),n=w.a.Lerp(t._currentEmitRate1,t._currentEmitRate2,r)})}i=n*this._scaledUpdateSpeed>>0,this._newPartsExcess+=n*this._scaledUpdateSpeed-i}if(this._newPartsExcess>1&&(i+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?i=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(i),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene._toBeDisposed.push(this))),!e){for(var o=0,a=0;a-1&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.reset()},t.prototype.clone=function(e,i){var n=null,r=null;if(null!=this.customShader){var o=(r=this.customShader).shaderOptions.defines.length>0?r.shaderOptions.defines.join("\n"):"";n=this._scene.getEngine().createEffectForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,o)}else this._customEffect&&(n=this._customEffect);var a=new t(e,this._capacity,this._scene,n);return a.customShader=r,M.a.DeepCopy(this,a,["particles","customShader","noiseTexture","particleTexture","onDisposeObservable"]),void 0===i&&(i=this.emitter),a.noiseTexture=this.noiseTexture,a.emitter=i,this.particleTexture&&(a.particleTexture=new $e.a(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach(function(e){a.addColorGradient(e.gradient,e.color1,e.color2)}),this._dragGradients&&this._dragGradients.forEach(function(e){a.addDragGradient(e.gradient,e.factor1,e.factor2)}),this._angularSpeedGradients&&this._angularSpeedGradients.forEach(function(e){a.addAngularSpeedGradient(e.gradient,e.factor1,e.factor2)}),this._emitRateGradients&&this._emitRateGradients.forEach(function(e){a.addEmitRateGradient(e.gradient,e.factor1,e.factor2)}),this._lifeTimeGradients&&this._lifeTimeGradients.forEach(function(e){a.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)}),this._limitVelocityGradients&&this._limitVelocityGradients.forEach(function(e){a.addLimitVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._sizeGradients&&this._sizeGradients.forEach(function(e){a.addSizeGradient(e.gradient,e.factor1,e.factor2)}),this._startSizeGradients&&this._startSizeGradients.forEach(function(e){a.addStartSizeGradient(e.gradient,e.factor1,e.factor2)}),this._velocityGradients&&this._velocityGradients.forEach(function(e){a.addVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._rampGradients&&this._rampGradients.forEach(function(e){a.addRampGradient(e.gradient,e.color)}),this._colorRemapGradients&&this._colorRemapGradients.forEach(function(e){a.addColorRemapGradient(e.gradient,e.factor1,e.factor2)}),this._alphaRemapGradients&&this._alphaRemapGradients.forEach(function(e){a.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)}),this.preventAutoStart||a.start(),a},t.prototype.serialize=function(){var e={};if(t._Serialize(e,this),e.textureMask=this.textureMask.asArray(),e.customShader=this.customShader,e.preventAutoStart=this.preventAutoStart,this.subEmitters){e.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var i=0,n=this._subEmitters;i0?c.shaderOptions.defines.join("\n"):"";a=i.getEngine().createEffectForParticles(c.shaderPath.fragmentElement,c.shaderOptions.uniforms,c.shaderOptions.samplers,l)}var u=new t(o,e.capacity,i,a,e.isAnimationSheetEnabled);if(u.customShader=c,e.id&&(u.id=e.id),e.subEmitters){u.subEmitters=[];for(var h=0,d=e.subEmitters;h1},enumerable:!0,configurable:!0}),t.prototype.getCapacity=function(){return this._capacity},Object.defineProperty(t.prototype,"activeParticleCount",{get:function(){return this._activeCount},set:function(e){this._activeCount=Math.min(e,this._capacity)},enumerable:!0,configurable:!0}),t.prototype.isReady=function(){return this._updateEffect?!!(this.emitter&&this._updateEffect.isReady()&&this._imageProcessingConfiguration.isReady()&&this._renderEffect.isReady()&&this.particleTexture&&this.particleTexture.isReady()):(this._recreateUpdateEffect(),this._recreateRenderEffect(),!1)},t.prototype.isStarted=function(){return this._started},t.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";e?setTimeout(function(){t.start(0)},e):(this._started=!0,this._stopped=!1,this._preWarmDone=!1,this.beginAnimationOnStart&&this.animations&&this.animations.length>0&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._releaseBuffers(),this._releaseVAOs(),this._currentActiveCount=0,this._targetIndex=0},t.prototype.getClassName=function(){return"GPUParticleSystem"},t.prototype._removeGradientAndTexture=function(t,i,n){return e.prototype._removeGradientAndTexture.call(this,t,i,n),this._releaseBuffers(),this},t.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new Jc;return n.gradient=e,n.color1=t,this._colorGradients.push(n),this._colorGradients.sort(function(e,t){return e.gradientt.gradient?1:0}),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},t.prototype._addFactorGradient=function(e,t,i){var n=new el;n.gradient=t,n.factor1=i,e.push(n),e.sort(function(e,t){return e.gradientt.gradient?1:0}),this._releaseBuffers()},t.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},t.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},t.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},t.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},t.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},t.prototype.addEmitRateGradient=function(e,t,i){return this},t.prototype.removeEmitRateGradient=function(e){return this},t.prototype.addStartSizeGradient=function(e,t,i){return this},t.prototype.removeStartSizeGradient=function(e){return this},t.prototype.addColorRemapGradient=function(e,t,i){return this},t.prototype.removeColorRemapGradient=function(){return this},t.prototype.addAlphaRemapGradient=function(e,t,i){return this},t.prototype.removeAlphaRemapGradient=function(){return this},t.prototype.addRampGradient=function(e,t){return this},t.prototype.removeRampGradient=function(){return this},t.prototype.getRampGradients=function(){return null},Object.defineProperty(t.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!0,configurable:!0}),t.prototype.addLifeTimeGradient=function(e,t,i){return this},t.prototype.removeLifeTimeGradient=function(e){return this},t.prototype._reset=function(){this._releaseBuffers()},t.prototype._createUpdateVAO=function(e){var t={};t.position=e.createVertexBuffer("position",0,3),t.age=e.createVertexBuffer("age",3,1),t.life=e.createVertexBuffer("life",4,1),t.seed=e.createVertexBuffer("seed",5,4),t.size=e.createVertexBuffer("size",9,3);var i=12;this._colorGradientsTexture||(t.color=e.createVertexBuffer("color",i,4),i+=4),t.direction=e.createVertexBuffer("direction",i,3),i+=3,this._isBillboardBased||(t.initialDirection=e.createVertexBuffer("initialDirection",i,3),i+=3),this._angularSpeedGradientsTexture?(t.angle=e.createVertexBuffer("angle",i,1),i+=1):(t.angle=e.createVertexBuffer("angle",i,2),i+=2),this._isAnimationSheetEnabled&&(t.cellIndex=e.createVertexBuffer("cellIndex",i,1),i+=1,this.spriteRandomStartCell&&(t.cellStartOffset=e.createVertexBuffer("cellStartOffset",i,1),i+=1)),this.noiseTexture&&(t.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",i,3),i+=3,t.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",i,3),i+=3);var n=this._engine.recordVertexArrayObject(t,null,this._updateEffect);return this._engine.bindArrayBuffer(null),n},t.prototype._createRenderVAO=function(e,t){var i={};i.position=e.createVertexBuffer("position",0,3,this._attributesStrideSize,!0),i.age=e.createVertexBuffer("age",3,1,this._attributesStrideSize,!0),i.life=e.createVertexBuffer("life",4,1,this._attributesStrideSize,!0),i.size=e.createVertexBuffer("size",9,3,this._attributesStrideSize,!0);var n=12;this._colorGradientsTexture||(i.color=e.createVertexBuffer("color",n,4,this._attributesStrideSize,!0),n+=4),this.billboardMode===al.BILLBOARDMODE_STRETCHED&&(i.direction=e.createVertexBuffer("direction",n,3,this._attributesStrideSize,!0)),n+=3,this._isBillboardBased||(i.initialDirection=e.createVertexBuffer("initialDirection",n,3,this._attributesStrideSize,!0),n+=3),i.angle=e.createVertexBuffer("angle",n,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?n++:n+=2,this._isAnimationSheetEnabled&&(i.cellIndex=e.createVertexBuffer("cellIndex",n,1,this._attributesStrideSize,!0),n+=1,this.spriteRandomStartCell&&(i.cellStartOffset=e.createVertexBuffer("cellStartOffset",n,1,this._attributesStrideSize,!0),n+=1)),this.noiseTexture&&(i.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",n,3,this._attributesStrideSize,!0),n+=3,i.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",n,3,this._attributesStrideSize,!0),n+=3),i.offset=t.createVertexBuffer("offset",0,2),i.uv=t.createVertexBuffer("uv",2,2);var r=this._engine.recordVertexArrayObject(i,null,this._renderEffect);return this._engine.bindArrayBuffer(null),r},t.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._scene.getEngine(),i=new Array;this._attributesStrideSize=21,this._targetIndex=0,this.isBillboardBased||(this._attributesStrideSize+=3),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6);for(var n=0;n=this.targetStopDuration&&this.stop()},t.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var n=new Float32Array(this._rawTextureWidth),r=0;r1){var i=0|this._accumulatedCount;this._accumulatedCount-=i,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+i)}if(!this._currentActiveCount)return 0;var n;if(this._engine.enableEffect(this._updateEffect),this._engine.setState(!1),this._updateEffect.setFloat("currentCount",this._currentActiveCount),this._updateEffect.setFloat("timeDelta",this._timeDelta),this._updateEffect.setFloat("stopFactor",this._stopped?0:1),this._updateEffect.setTexture("randomSampler",this._randomTexture),this._updateEffect.setTexture("randomSampler2",this._randomTexture2),this._updateEffect.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateEffect.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateEffect.setDirectColor4("color1",this.color1),this._updateEffect.setDirectColor4("color2",this.color2)),this._updateEffect.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateEffect.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateEffect.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateEffect.setVector3("gravity",this.gravity),this._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._sizeGradientsTexture),this._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._angularSpeedGradientsTexture),this._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._velocityGradientsTexture),this._limitVelocityGradientsTexture&&(this._updateEffect.setTexture("limitVelocityGradientSampler",this._limitVelocityGradientsTexture),this._updateEffect.setFloat("limitVelocityDamping",this.limitVelocityDamping)),this._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._dragGradientsTexture),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateEffect),this._isAnimationSheetEnabled&&this._updateEffect.setFloat3("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed),this.noiseTexture&&(this._updateEffect.setTexture("noiseSampler",this.noiseTexture),this._updateEffect.setVector3("noiseStrength",this.noiseStrength)),this.emitter.position){n=this.emitter.getWorldMatrix()}else{var r=this.emitter;n=a.a.Translation(r.x,r.y,r.z)}if(this._updateEffect.setMatrix("emitterWM",n),this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex],null),this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer()),this._engine.setRasterizerState(!1),this._engine.beginTransformFeedback(!0),this._engine.drawArraysType(No.a.PointListDrawMode,0,this._currentActiveCount),this._engine.endTransformFeedback(),this._engine.setRasterizerState(!0),this._engine.bindTransformFeedbackBuffer(null),!e){this._engine.enableEffect(this._renderEffect);var o=this._scene.getViewMatrix();if(this._renderEffect.setMatrix("view",o),this._renderEffect.setMatrix("projection",this._scene.getProjectionMatrix()),this._renderEffect.setTexture("textureSampler",this.particleTexture),this._renderEffect.setVector2("translationPivot",this.translationPivot),this._renderEffect.setVector3("worldOffset",this.worldOffset),this._colorGradientsTexture?this._renderEffect.setTexture("colorGradientSampler",this._colorGradientsTexture):this._renderEffect.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture){var s=this.particleTexture.getBaseSize();this._renderEffect.setFloat3("sheetInfos",this.spriteCellWidth/s.width,this.spriteCellHeight/s.height,s.width/this.spriteCellWidth)}if(this._isBillboardBased){var c=this._scene.activeCamera;this._renderEffect.setVector3("eyePosition",c.globalPosition)}if(this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4){var l=o.clone();l.invert(),this._renderEffect.setMatrix("invView",l),Mr.a.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case al.BLENDMODE_ADD:this._engine.setAlphaMode(g.a.ALPHA_ADD);break;case al.BLENDMODE_ONEONE:this._engine.setAlphaMode(g.a.ALPHA_ONEONE);break;case al.BLENDMODE_STANDARD:this._engine.setAlphaMode(g.a.ALPHA_COMBINE);break;case al.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(g.a.ALPHA_MULTIPLY)}this.forceDepthWrite&&this._engine.setDepthWrite(!0),this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex],null),this._engine.drawArraysType(No.a.TriangleFanDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(g.a.ALPHA_DISABLE)}this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var u=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=u,this._currentActiveCount},t.prototype.rebuild=function(){this._initialize(!0)},t.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null)},t.prototype._releaseVAOs=function(){if(this._updateVAO){for(var e=0;e-1&&this._scene.particleSystems.splice(t,1),this._releaseBuffers(),this._releaseVAOs(),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},t.prototype.clone=function(e,i){var n=new t(e,{capacity:this._capacity,randomTextureSize:this._randomTextureSize},this._scene);return M.a.DeepCopy(this,n,["particles","customShader","noiseTexture","particleTexture","onDisposeObservable"]),void 0===i&&(i=this.emitter),n.emitter=i,this.particleTexture&&(n.particleTexture=new $e.a(this.particleTexture.url,this._scene)),n.noiseTexture=this.noiseTexture,n.emitter=i,this.particleTexture&&(n.particleTexture=new $e.a(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach(function(e){n.addColorGradient(e.gradient,e.color1,e.color2)}),this._dragGradients&&this._dragGradients.forEach(function(e){n.addDragGradient(e.gradient,e.factor1)}),this._angularSpeedGradients&&this._angularSpeedGradients.forEach(function(e){n.addAngularSpeedGradient(e.gradient,e.factor1)}),this._emitRateGradients&&this._emitRateGradients.forEach(function(e){n.addEmitRateGradient(e.gradient,e.factor1,e.factor2)}),this._lifeTimeGradients&&this._lifeTimeGradients.forEach(function(e){n.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)}),this._limitVelocityGradients&&this._limitVelocityGradients.forEach(function(e){n.addLimitVelocityGradient(e.gradient,e.factor1)}),this._sizeGradients&&this._sizeGradients.forEach(function(e){n.addSizeGradient(e.gradient,e.factor1)}),this._startSizeGradients&&this._startSizeGradients.forEach(function(e){n.addStartSizeGradient(e.gradient,e.factor1,e.factor2)}),this._velocityGradients&&this._velocityGradients.forEach(function(e){n.addVelocityGradient(e.gradient,e.factor1)}),this._rampGradients&&this._rampGradients.forEach(function(e){n.addRampGradient(e.gradient,e.color)}),this._colorRemapGradients&&this._colorRemapGradients.forEach(function(e){n.addColorRemapGradient(e.gradient,e.factor1,e.factor2)}),this._alphaRemapGradients&&this._alphaRemapGradients.forEach(function(e){n.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)}),n},t.prototype.serialize=function(){var e={};return al._Serialize(e,this),e.activeParticleCount=this.activeParticleCount,e},t.Parse=function(e,i,n,r){void 0===r&&(r=!1);var o=new t(e.name,{capacity:e.capacity,randomTextureSize:e.randomTextureSize},i);return e.activeParticleCount&&(o.activeParticleCount=e.activeParticleCount),al._Parse(e,o,i,n),e.preventAutoStart&&(o.preventAutoStart=e.preventAutoStart),r||o.preventAutoStart||o.start(),o},t}(Zc),fl=function(){function e(){this.systems=new Array}return Object.defineProperty(e.prototype,"emitterNode",{get:function(){return this._emitterNode},enumerable:!0,configurable:!0}),e.prototype.setEmitterAsSphere=function(e,t,i){this._emitterNode&&this._emitterNode.dispose(),this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};var n=tr.a.CreateSphere("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t;var r=new zi.a("emitterSphereMaterial",i);r.emissiveColor=e.color,n.material=r;for(var o=0,a=this.systems;o0&&t.set(this._uvs32,Yi.b.UVKind),this._colors32.length>0&&t.set(this._colors32,Yi.b.ColorKind);var i=new Se.a(this.name,this._scene);return t.applyToMesh(i,this._updatable),this.mesh=i,this.mesh.isPickable=this._pickable,this._depthSort||(this._indices=null),this._positions=null,this._normals=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0),i},e.prototype.digest=function(e,t){var i=t&&t.facetNb||1,n=t&&t.number||0,r=t&&t.delta||0,o=e.getVerticesData(Yi.b.PositionKind),s=e.getIndices(),c=e.getVerticesData(Yi.b.UVKind),l=e.getVerticesData(Yi.b.ColorKind),u=e.getVerticesData(Yi.b.NormalKind),h=0,d=s.length/3;n?(n=n>d?d:n,i=Math.round(d/n),r=0):i=i>d?d:i;for(var f=[],p=[],_=[],m=[],g=a.e.Zero(),v=i;hd-(i=v+Math.floor((1+r)*Math.random()))&&(i=d-h),f.length=0,p.length=0,_.length=0,m.length=0;for(var y=0,b=3*h;b<3*(h+i);b++){p.push(y);var T=s[b];f.push(o[3*T],o[3*T+1],o[3*T+2]),c&&_.push(c[2*T],c[2*T+1]),l&&m.push(l[4*T],l[4*T+1],l[4*T+2],l[4*T+3]),y++}var E,A,P=this.nbParticles,S=this._posToShape(f),R=this._uvsToShapeUV(_);for(E=0;E65535&&(this._needs32Bits=!0)}if(this._pickable){var C=n.length/3;for(_=0;_=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var O=this.mesh._boundingInfo;O&&(v.copyFrom(O.minimum),y.copyFrom(O.maximum))}var I=(P=this.particles[e]._pos)/3|0;R=4*I,C=2*I;for(var D=e;D<=t;D++){var L=this.particles[D];this.updateParticle(L);var w=L._model._shape,F=L._model._shapeUV,N=L._rotationMatrix,B=L.position,U=L.rotation,V=L.scaling,k=L._globalPosition;if(this._depthSort&&this._depthSortParticles){var G=this.depthSortedParticles[D];G.ind=L._ind,G.indicesLength=L._model._indicesLength,G.sqDistance=a.e.DistanceSquared(L.position,b)}if(!L.alive||L._stillInvisible&&!L.isVisible)P+=3*(M=w.length),R+=4*M,C+=2*M;else{if(L.isVisible){L._stillInvisible=!1;var z=p[12];if(L.pivot.multiplyToRef(V,z),this.billboard&&(U.x=0,U.y=0),(this._computeParticleRotation||this.billboard)&&L.getRotationMatrix(n),null!==L.parentId){var j=this.particles[L.parentId],W=j._rotationMatrix,H=j._globalPosition,X=B.x*W[1]+B.y*W[4]+B.z*W[7],Y=B.x*W[0]+B.y*W[3]+B.z*W[6],K=B.x*W[2]+B.y*W[5]+B.z*W[8];if(k.x=H.x+Y,k.y=H.y+X,k.z=H.z+K,this._computeParticleRotation||this.billboard){var Q=n.m;N[0]=Q[0]*W[0]+Q[1]*W[3]+Q[2]*W[6],N[1]=Q[0]*W[1]+Q[1]*W[4]+Q[2]*W[7],N[2]=Q[0]*W[2]+Q[1]*W[5]+Q[2]*W[8],N[3]=Q[4]*W[0]+Q[5]*W[3]+Q[6]*W[6],N[4]=Q[4]*W[1]+Q[5]*W[4]+Q[6]*W[7],N[5]=Q[4]*W[2]+Q[5]*W[5]+Q[6]*W[8],N[6]=Q[8]*W[0]+Q[9]*W[3]+Q[10]*W[6],N[7]=Q[8]*W[1]+Q[9]*W[4]+Q[10]*W[7],N[8]=Q[8]*W[2]+Q[9]*W[5]+Q[10]*W[8]}}else if(k.x=B.x,k.y=B.y,k.z=B.z,this._computeParticleRotation||this.billboard){Q=n.m;N[0]=Q[0],N[1]=Q[1],N[2]=Q[2],N[3]=Q[4],N[4]=Q[5],N[5]=Q[6],N[6]=Q[8],N[7]=Q[9],N[8]=Q[10]}var q=p[11];for(L.translateFromPivot?q.setAll(0):q.copyFrom(z),M=0;Mthis._options.radius)return null;var o=this._options.falloff===bl.Constant?this._options.strength:this._options.strength*(1-r/this._options.radius);return{force:i.multiplyByFloats(o,o,o),contactPoint:n,distanceFromOrigin:r}},e.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},e.prototype._prepareSphere=function(){this._sphere||(this._sphere=tr.a.CreateSphere("radialExplosionEventSphere",this._options.sphere,this._scene),this._sphere.isVisible=!1)},e.prototype._intersectsWithSphere=function(e,t,i){var n=e.object;return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling=new a.e(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(n,!0)},e}(),Sl=function(){function e(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=h.a({},new Cl,this._options),this._tickCallback=this._tick.bind(this),this._options.strength=-1*this._options.strength}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},e.prototype._tick=function(){if(this._sphere)this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);else{var e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);e&&(this._sphere=e.getData().sphere.clone("radialExplosionEventSphereClone"))}},e}(),Rl=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=a.e.Zero(),this._originDirection=a.e.Zero(),this._cylinderPosition=a.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=h.a({},new Ml,this._options),this._origin.addToRef(new a.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new a.e(0,this._options.height,0),this._originTop),this._options.updraftMode===Tl.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._cylinder&&(e?this._cylinder.dispose():setTimeout(function(){t._dataFetched||t._cylinder.dispose()},0))},e.prototype.getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;var t=e.getObjectCenter();if(this._options.updraftMode===Tl.Perpendicular)var i=this._originDirection;else i=t.subtract(this._originTop);var n=a.e.Distance(this._origin,t),r=-1*this._options.strength;return{force:i.multiplyByFloats(r,r,r),contactPoint:t,distanceFromOrigin:n}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach(function(t){var i=e.getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)})},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Ji.a.CreateCylinder("updraftEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),xl=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=a.e.Zero(),this._cylinderPosition=a.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=h.a({},new Ol,this._options),this._origin.addToRef(new a.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new a.e(0,this._options.height,0),this._originTop),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout(function(){t._dataFetched||t._cylinder.dispose()},0)},e.prototype.getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return null;var t=e.getObjectCenter(),i=new a.e(this._origin.x,t.y,this._origin.z),n=t.subtract(i),r=new jt.a(i,n,this._options.radius).intersectsMesh(e.object),o=r.pickedPoint;if(!o)return null;var s=r.distance/this._options.radius,c=o.normalize();if(s>this._options.centripetalForceThreshold&&(c=c.negate()),s>this._options.centripetalForceThreshold)var l=c.x*this._options.centripetalForceMultiplier,u=c.y*this._options.updraftForceMultiplier,h=c.z*this._options.centripetalForceMultiplier;else{var d=a.e.Cross(i,t).normalize();l=(d.x+c.x)*this._options.centrifugalForceMultiplier,u=this._originTop.y*this._options.updraftForceMultiplier,h=(d.z+c.z)*this._options.centrifugalForceMultiplier}var f=new a.e(l,u,h);return{force:f=f.multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),contactPoint:t,distanceFromOrigin:s}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach(function(t){var i=e.getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)})},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Ji.a.CreateCylinder("vortexEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),Cl=function(){this.radius=5,this.strength=10,this.falloff=bl.Constant,this.sphere={segments:32,diameter:1}},Ml=function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Tl.Center},Ol=function(){this.radius=5,this.strength=10,this.height=10,this.centripetalForceThreshold=.7,this.centripetalForceMultiplier=5,this.centrifugalForceMultiplier=.5,this.updraftForceMultiplier=.02};!function(e){e[e.Constant=0]="Constant",e[e.Linear=1]="Linear"}(bl||(bl={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(Tl||(Tl={}));var Il="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\nvoid main(void)\n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11));\nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}";ni.a.ShadersStore.blackAndWhitePixelShader=Il;var Dl=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,"blackAndWhite",["degree"],null,i,n,r,o,a)||this;return s.degree=1,s.onApplyObservable.add(function(e){e.setFloat("degree",s.degree)}),s}return h.d(t,e),t}(oi),Ll=function(){function e(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}return Object.defineProperty(e.prototype,"isSupported",{get:function(){for(var e in this._postProcesses)if(this._postProcesses.hasOwnProperty(e))for(var t=this._postProcesses[e],i=0;i-1?"#define MALI 1\n":null},t}(oi),au="#include\n\nuniform sampler2D textureSampler;\n\nuniform float intensity;\nuniform float animatedSeed;\n\nvarying vec2 vUV;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\n\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}";ni.a.ShadersStore.grainPixelShader=au;var su=function(e){function t(t,i,n,r,o,a,s,c){void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"grain",["intensity","animatedSeed"],[],i,n,r,o,a,null,s,void 0,null,c)||this;return l.intensity=30,l.animated=!1,l.onApplyObservable.add(function(e){e.setFloat("intensity",l.intensity),e.setFloat("animatedSeed",l.animated?Math.random()+1:1)}),l}return h.d(t,e),t}(oi),cu="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvoid main(void)\n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);\n}";ni.a.ShadersStore.highlightsPixelShader=cu;var lu=function(e){function t(t,i,n,r,o,a,s){return void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),e.call(this,t,"highlights",null,null,i,n,r,o,a,null,s)||this}return h.d(t,e),t}(oi);ni.a.IncludesShadersStore.mrtFragmentDeclaration="#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n";var uu="#extension GL_EXT_draw_buffers : require\nprecision highp float;\nprecision highp int;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include[RENDER_TARGET_COUNT]\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPosition,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n}";ni.a.ShadersStore.geometryPixelShader=uu;var hu="precision highp float;\nprecision highp int;\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nattribute vec3 position;\nattribute vec3 normal;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n\nuniform mat4 viewProjection;\nuniform mat4 view;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\n#ifdef BONES_VELOCITY_ENABLED\n#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\nvec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";ni.a.ShadersStore.geometryVertexShader=hu;var du=function(){function e(t,i){void 0===i&&(i=1),this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this._enablePosition=!1,this._enableVelocity=!1,this._positionIndex=-1,this._velocityIndex=-1,this._scene=t,this._ratio=i,e._SceneComponentInitialization(this._scene),this._createRenderTargets()}return Object.defineProperty(e.prototype,"renderList",{set:function(e){this._multiRenderTarget.renderList=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSupported",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!0,configurable:!0}),e.prototype.getTextureIndex=function(t){switch(t){case e.POSITION_TEXTURE_TYPE:return this._positionIndex;case e.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;default:return-1}},Object.defineProperty(e.prototype,"enablePosition",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this.dispose(),this._createRenderTargets()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableVelocity",{get:function(){return this._enableVelocity},set:function(e){this._enableVelocity=e,e||(this._previousTransformationMatrices={}),this.dispose(),this._createRenderTargets()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ratio",{get:function(){return this._ratio},enumerable:!0,configurable:!0}),e.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var n=[],r=[Yi.b.PositionKind,Yi.b.NormalKind],o=e.getMesh();i&&i.needAlphaTesting()&&(n.push("#define ALPHATEST"),o.isVerticesDataPresent(Yi.b.UVKind)&&(r.push(Yi.b.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(Yi.b.UV2Kind)&&(r.push(Yi.b.UV2Kind),n.push("#define UV2"))),this._enablePosition&&(n.push("#define POSITION"),n.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(n.push("#define VELOCITY"),n.push("#define VELOCITY_INDEX "+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(o)&&n.push("#define BONES_VELOCITY_ENABLED")),o.useBones&&o.computeBonesUsingShaders?(r.push(Yi.b.MatricesIndicesKind),r.push(Yi.b.MatricesWeightsKind),o.numBoneInfluencers>4&&(r.push(Yi.b.MatricesIndicesExtraKind),r.push(Yi.b.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(r)),n.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length);var c=n.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffect("geometry",r,["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{buffersCount:this._enablePosition?3:2,maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(e.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.getGBuffer().dispose()},e.prototype._createRenderTargets=function(){var e=this,t=this._scene.getEngine(),i=2;if(this._enablePosition&&(this._positionIndex=i,i++),this._enableVelocity&&(this._velocityIndex=i,i++),this._multiRenderTarget=new Xa("gBuffer",{width:t.getRenderWidth()*this._ratio,height:t.getRenderHeight()*this._ratio},i,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:g.a.TEXTURETYPE_FLOAT}),this.isSupported){this._multiRenderTarget.wrapU=$e.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=$e.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add(function(e){e.clear(new s.b(0,0,0,1),!0,!0,!0)});var n=function(t){var i=t.getRenderingMesh(),n=e._scene,r=n.getEngine(),o=t.getMaterial();if(o){if(i._internalAbstractMeshDataInfo._isActiveIntermediate=!1,e._enableVelocity&&!e._previousTransformationMatrices[i.uniqueId]&&(e._previousTransformationMatrices[i.uniqueId]={world:a.a.Identity(),viewProjection:n.getTransformMatrix()},i.skeleton)){var s=i.skeleton.getTransformMatrices(i);e._previousBonesTransformationMatrices[i.uniqueId]=e._copyBonesTransformationMatrices(s,new Float32Array(s.length))}r.setState(o.backFaceCulling,0,!1,n.useRightHandedSystem);var c=i._getInstancesRenderList(t._id);if(!c.mustReturn){var l=r.getCaps().instancedArrays&&null!==c.visibleInstances[t._id];if(e.isReady(t,l)){if(r.enableEffect(e._effect),i._bind(t,e._effect,No.a.TriangleFillMode),e._effect.setMatrix("viewProjection",n.getTransformMatrix()),e._effect.setMatrix("view",n.getViewMatrix()),o&&o.needAlphaTesting()){var u=o.getAlphaTestTexture();u&&(e._effect.setTexture("diffuseSampler",u),e._effect.setMatrix("diffuseMatrix",u.getTextureMatrix()))}i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&(e._effect.setMatrices("mBones",i.skeleton.getTransformMatrices(i)),e._enableVelocity&&e._effect.setMatrices("mPreviousBones",e._previousBonesTransformationMatrices[i.uniqueId])),Mr.a.BindMorphTargetParameters(i,e._effect),e._enableVelocity&&(e._effect.setMatrix("previousWorld",e._previousTransformationMatrices[i.uniqueId].world),e._effect.setMatrix("previousViewProjection",e._previousTransformationMatrices[i.uniqueId].viewProjection)),i._processRendering(t,e._effect,No.a.TriangleFillMode,c,l,function(t,i){return e._effect.setMatrix("world",i)})}e._enableVelocity&&(e._previousTransformationMatrices[i.uniqueId].world=i.getWorldMatrix().clone(),e._previousTransformationMatrices[i.uniqueId].viewProjection=e._scene.getTransformMatrix().clone(),i.skeleton&&e._copyBonesTransformationMatrices(i.skeleton.getTransformMatrices(i),e._previousBonesTransformationMatrices[i.uniqueId]))}}};this._multiRenderTarget.customRenderFunction=function(e,i,r,o){var a;if(o.length){for(t.setColorWrite(!1),a=0;a0){var i=this._renderEffects[t[0]].getPostProcesses();i&&(i[0].samples=e)}return!0},e.prototype.dispose=function(){},h.c([Object(F.c)()],e.prototype,"_name",void 0),e}(),Tu=function(){function e(){this._renderPipelines={}}return Object.defineProperty(e.prototype,"supportedPipelines",{get:function(){var e=[];for(var t in this._renderPipelines)if(this._renderPipelines.hasOwnProperty(t)){var i=this._renderPipelines[t];i.isSupported&&e.push(i)}return e},enumerable:!0,configurable:!0}),e.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},e.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1);var n=this._renderPipelines[e];n&&n._attachCameras(t,i)},e.prototype.detachCamerasFromRenderPipeline=function(e,t){var i=this._renderPipelines[e];i&&i._detachCameras(t)},e.prototype.enableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._enableEffect(t,i)},e.prototype.disableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._disableEffect(t,i)},e.prototype.update=function(){for(var e in this._renderPipelines)if(this._renderPipelines.hasOwnProperty(e)){var t=this._renderPipelines[e];t.isSupported?t._update():(t.dispose(),delete this._renderPipelines[e])}},e.prototype._rebuild=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e]._rebuild()}},e.prototype.dispose=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e].dispose()}},e}();Object.defineProperty(K.a.prototype,"postProcessRenderPipelineManager",{get:function(){if(!this._postProcessRenderPipelineManager){var e=this._getComponent(Fe.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new Eu(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Tu}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var Eu=function(){function e(e){this.name=Fe.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Fe.a.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},e.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},e.prototype._gatherRenderTargets=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()},e}(),Au=function(e){function t(t,i,n,r,o){void 0===t&&(t=""),void 0===i&&(i=!0),void 0===n&&(n=C.a.LastCreatedScene),void 0===o&&(o=!0);var a=e.call(this,n.getEngine(),t)||this;a._camerasToBeAttached=[],a.SharpenPostProcessId="SharpenPostProcessEffect",a.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",a.FxaaPostProcessId="FxaaPostProcessEffect",a.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",a.GrainPostProcessId="GrainPostProcessEffect",a._glowLayer=null,a.animations=[],a._imageProcessingConfigurationObserver=null,a._sharpenEnabled=!1,a._bloomEnabled=!1,a._depthOfFieldEnabled=!1,a._depthOfFieldBlurLevel=Ql.Low,a._fxaaEnabled=!1,a._imageProcessingEnabled=!0,a._bloomScale=.5,a._chromaticAberrationEnabled=!1,a._grainEnabled=!1,a._buildAllowed=!0,a._resizeObserver=null,a._hardwareScaleLevel=1,a._bloomKernel=64,a._bloomWeight=.15,a._bloomThreshold=.9,a._samples=1,a._hasCleared=!1,a._prevPostProcess=null,a._prevPrevPostProcess=null,a._depthOfFieldSceneObserver=null,a._cameras=r||n.cameras,a._cameras=a._cameras.slice(),a._camerasToBeAttached=a._cameras.slice(),a._buildAllowed=o,a._scene=n;var s=a._scene.getEngine().getCaps();a._hdr=i&&(s.textureHalfFloatRender||s.textureFloatRender),a._hdr?s.textureHalfFloatRender?a._defaultPipelineTextureType=g.a.TEXTURETYPE_HALF_FLOAT:s.textureFloatRender&&(a._defaultPipelineTextureType=g.a.TEXTURETYPE_FLOAT):a._defaultPipelineTextureType=g.a.TEXTURETYPE_UNSIGNED_INT,n.postProcessRenderPipelineManager.addPipeline(a);var c=a._scene.getEngine();return a.sharpen=new yu("sharpen",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._sharpenEffect=new Ll(c,a.SharpenPostProcessId,function(){return a.sharpen},!0),a.depthOfField=new Jl(a._scene,null,a._depthOfFieldBlurLevel,a._defaultPipelineTextureType,!0),a.bloom=new Ul(a._scene,a._bloomScale,a._bloomWeight,a.bloomKernel,a._defaultPipelineTextureType,!0),a.chromaticAberration=new kl("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._chromaticAberrationEffect=new Ll(c,a.ChromaticAberrationPostProcessId,function(){return a.chromaticAberration},!0),a.grain=new su("Grain",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._grainEffect=new Ll(c,a.GrainPostProcessId,function(){return a.grain},!0),a._resizeObserver=c.onResizeObservable.add(function(){a._hardwareScaleLevel=c.getHardwareScalingLevel(),a.bloomKernel=a.bloomKernel}),a._imageProcessingConfigurationObserver=a._scene.imageProcessingConfiguration.onUpdateParameters.add(function(){a.bloom._downscale._exposure=a._scene.imageProcessingConfiguration.exposure}),a._buildPipeline(),a}return h.d(t,e),Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sharpenEnabled",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomKernel",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomWeight",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomThreshold",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomScale",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),t.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new Ul(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t1){for(var i=0,n=this._cameras;i-1&&(e.depthOfField.depthTexture=t.enableDepthRenderer(t.activeCamera).getDepthMap())})}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new Hi("imageProcessing",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this._hdr?(this.addEffect(new Ll(t,this.ImageProcessingPostProcessId,function(){return e.imageProcessing},!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new ou("fxaa",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new Ll(t,this.FxaaPostProcessId,function(){return e.fxaa},!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),this._scene.activeCameras&&this._scene.activeCameras.length>1&&(this._scene.autoClear=!0),!this._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&m.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")}},t.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t0?i._ssaoCombinePostProcess.width:i._originalColorPostProcess.width),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&e.setArray("samplerOffsets",i._samplerOffsets))},this._blurVPostProcess=new oi("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],t,null,$e.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE "+(n?"1":"0")+"\n"),this._blurVPostProcess.onApply=function(e){i._scene.activeCamera&&(e.setFloat("outSize",i._ssaoCombinePostProcess.height>0?i._ssaoCombinePostProcess.height:i._originalColorPostProcess.height),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&(e.setArray("samplerOffsets",i._samplerOffsets),i._firstUpdate=!1))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples},t.prototype._rebuild=function(){this._firstUpdate=!0,e.prototype._rebuild.call(this)},t.prototype._radicalInverse_VdC=function(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},t.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},t.prototype._hemisphereSample_uniform=function(e,t){var i=2*t*Math.PI,n=1-(.85*e+.15),r=Math.sqrt(1-n*n);return new a.e(Math.cos(i)*r,Math.sin(i)*r,n)},t.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],n=0;n1&&m.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},t.prototype._createDownSampleX4PostProcess=function(e,t){var i=this,n=new Array(32);this.downSampleX4PostProcess=new oi("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",g.a.TEXTURETYPE_UNSIGNED_INT),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,r=i.downSampleX4PostProcess.width,o=i.downSampleX4PostProcess.height,a=-2;a<2;a++)for(var s=-2;s<2;s++)n[t]=(a+.5)*(1/r),n[t+1]=(s+.5)*(1/o),t+=2;e.setArray2("dsOffsets",n)},this.addEffect(new Ll(e.getEngine(),"HDRDownSampleX4",function(){return i.downSampleX4PostProcess},!0))},t.prototype._createBrightPassPostProcess=function(e,t){var i=this,n=new Array(8);this.brightPassPostProcess=new oi("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",g.a.TEXTURETYPE_UNSIGNED_INT),this.brightPassPostProcess.onApply=function(e){var t=1/i.brightPassPostProcess.width,r=1/i.brightPassPostProcess.height;n[0]=-.5*t,n[1]=.5*r,n[2]=.5*t,n[3]=.5*r,n[4]=-.5*t,n[5]=-.5*r,n[6]=.5*t,n[7]=-.5*r,e.setArray2("dsOffsets",n),e.setFloat("brightThreshold",i.brightThreshold)},this.addEffect(new Ll(e.getEngine(),"HDRBrightPass",function(){return i.brightPassPostProcess},!0))},t.prototype._createBlurPostProcesses=function(e,t,i,n){var r=this;void 0===n&&(n="blurWidth");var o=e.getEngine(),s=new Sr("HDRBlurH_"+i,new a.d(1,0),this[n],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT),c=new Sr("HDRBlurV_"+i,new a.d(0,1),this[n],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT);s.onActivateObservable.add(function(){var e=s.width/o.getRenderWidth();s.kernel=r[n]*e}),c.onActivateObservable.add(function(){var e=c.height/o.getRenderHeight();c.kernel=r.horizontalBlur?64*e:r[n]*e}),this.addEffect(new Ll(e.getEngine(),"HDRBlurH"+i,function(){return s},!0)),this.addEffect(new Ll(e.getEngine(),"HDRBlurV"+i,function(){return c},!0)),this.blurHPostProcesses.push(s),this.blurVPostProcesses.push(c)},t.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new oi("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",g.a.TEXTURETYPE_UNSIGNED_INT),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._vlsEnabled?i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture("lensSampler",i.lensTexture),e.setFloat("exposure",i._currentExposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDRTextureAdder",function(){return i.textureAdderPostProcess},!0))},t.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,n=e.enableGeometryBufferRenderer();n.enablePosition=!0;var r=n.getGBuffer();this.volumetricLightPostProcess=new oi("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=a.d.Zero();this.volumetricLightPostProcess.onApply=function(e){if(i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera){var t=i.sourceLight.getShadowGenerator();e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",r.textures[2]),e.setColor3("sunColor",i.sourceLight.diffuse),e.setVector3("sunDirection",i.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",i._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",i.volumetricLightCoefficient),e.setFloat("scatteringPower",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",o)}},this.addEffect(new Ll(e.getEngine(),"HDRVLS",function(){return i.volumetricLightPostProcess},!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new oi("HDRVLSMerge","standard",[],["originalSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess("originalSampler",i._bloomEnabled?i.textureAdderFinalPostProcess:i.originalPostProcess),i._currentDepthOfFieldSource=i.volumetricLightFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDRVLSMerge",function(){return i.volumetricLightMergePostProces},!0))},t.prototype._createLuminancePostProcesses=function(e,i){var n=this,r=Math.pow(3,t.LuminanceSteps);this.luminancePostProcess=new oi("HDRLuminance","standard",["lumOffsets"],[],{width:r,height:r},null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",i);var o=[];this.luminancePostProcess.onApply=function(e){var t=1/n.luminancePostProcess.width,i=1/n.luminancePostProcess.height;o[0]=-.5*t,o[1]=.5*i,o[2]=.5*t,o[3]=.5*i,o[4]=-.5*t,o[5]=-.5*i,o[6]=.5*t,o[7]=-.5*i,e.setArray2("lumOffsets",o)},this.addEffect(new Ll(e.getEngine(),"HDRLuminance",function(){return n.luminancePostProcess},!0));for(var s=t.LuminanceSteps-1;s>=0;s--){r=Math.pow(3,s);var c="#define LUMINANCE_DOWN_SAMPLE\n";0===s&&(c+="#define FINAL_DOWN_SAMPLER");var l=new oi("HDRLuminanceDownSample"+s,"standard",["dsOffsets","halfDestPixelSize"],[],{width:r,height:r},null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,c,i);this.luminanceDownSamplePostProcesses.push(l)}var u=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach(function(t,i){var r=new Array(18);t.onApply=function(e){if(u){for(var o=0,a=-1;a<2;a++)for(var s=-1;s<2;s++)r[o]=a/u.width,r[o+1]=s/u.height,o+=2;e.setArray2("dsOffsets",r),e.setFloat("halfDestPixelSize",.5/u.width),u=i===n.luminanceDownSamplePostProcesses.length-1?n.luminancePostProcess:t}},i===n.luminanceDownSamplePostProcesses.length-1&&(t.onAfterRender=function(){var t=e.getEngine().readPixels(0,0,1,1),i=new a.f(1/16581375,1/65025,1/255,1);n._hdrCurrentLuminance=(t[0]*i.x+t[1]*i.y+t[2]*i.z+t[3]*i.w)/100}),n.addEffect(new Ll(e.getEngine(),"HDRLuminanceDownSample"+i,function(){return t},!0))})},t.prototype._createHdrPostProcess=function(e,t){var i=this,n=["#define HDR"];this._hdrAutoExposure&&n.push("#define AUTO_EXPOSURE"),this.hdrPostProcess=new oi("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n.join("\n"),g.a.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,a=0;this.hdrPostProcess.onApply=function(t){if(t.setTextureFromPostProcess("textureAdderSampler",i._currentDepthOfFieldSource),o+=e.getEngine().getDeltaTime(),r<0)r=i._hdrCurrentLuminance;else{var n=(a-o)/1e3;i._hdrCurrentLuminancer-i.hdrIncreaseRate*n?r-=i.hdrIncreaseRate*n:r=i._hdrCurrentLuminance}i.hdrAutoExposure?i._currentExposure=i._fixedExposure/r:(r=w.a.Clamp(r,i.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",r)),a=o,i._currentDepthOfFieldSource=i.hdrFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDR",function(){return i.hdrPostProcess},!0))},t.prototype._createLensFlarePostProcess=function(e,t){var i=this;this.lensFlarePostProcess=new oi("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",g.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ll(e.getEngine(),"HDRLensFlare",function(){return i.lensFlarePostProcess},!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new oi("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",g.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ll(e.getEngine(),"HDRLensFlareCompose",function(){return i.lensFlareComposePostProcess},!0));var n=new a.d(0,0);this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",i._bloomEnabled?i.blurHPostProcesses[0]:i.originalPostProcess),e.setTexture("lensColorSampler",i.lensColorTexture),e.setFloat("strength",i.lensFlareStrength),e.setFloat("ghostDispersal",i.lensFlareGhostDispersal),e.setFloat("haloWidth",i.lensFlareHaloWidth),n.x=i.lensFlarePostProcess.width,n.y=i.lensFlarePostProcess.height,e.setVector2("resolution",n),e.setFloat("distortionStrength",i.lensFlareDistortionStrength)};var r=a.a.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),o=a.a.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){if(i._scene.activeCamera){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("lensDirtSampler",i.lensFlareDirtTexture),e.setTexture("lensStarSampler",i.lensStarTexture);var t=i._scene.activeCamera.getViewMatrix().getRow(0),n=i._scene.activeCamera.getViewMatrix().getRow(2),s=a.e.Dot(t.toVector3(),new a.e(1,0,0))+a.e.Dot(n.toVector3(),new a.e(0,0,1));s*=4;var c=a.a.FromValues(.5*Math.cos(s),-Math.sin(s),0,0,Math.sin(s),.5*Math.cos(s),0,0,0,0,1,0,0,0,0,1),l=o.multiply(c).multiply(r);e.setMatrix("lensStarMatrix",l),i._currentDepthOfFieldSource=i.lensFlareFinalPostProcess}}},t.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new oi("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",g.a.TEXTURETYPE_UNSIGNED_INT),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("depthSampler",i._getDepthTexture()),e.setFloat("distance",i.depthOfFieldDistance)},this.addEffect(new Ll(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;if(this._isObjectBasedMotionBlur){var n=new _u("HDRMotionBlur",e,t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT);n.motionStrength=this.motionStrength,n.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=n}else{this.motionBlurPostProcess=new oi("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),g.a.TEXTURETYPE_UNSIGNED_INT);var r=0,o=a.a.Identity(),s=a.a.Identity(),c=a.a.Identity(),l=a.d.Zero();this.motionBlurPostProcess.onApply=function(t){(c=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(s),t.setMatrix("inverseViewProjection",s),t.setMatrix("prevViewProjection",o),o=c,l.x=i.motionBlurPostProcess.width,l.y=i.motionBlurPostProcess.height,t.setVector2("screenSize",l),r=e.getEngine().getFps()/60,t.setFloat("motionScale",r),t.setFloat("motionStrength",i.motionStrength),t.setTexture("depthSampler",i._getDepthTexture())}}this.addEffect(new Ll(e.getEngine(),"HDRMotionBlur",function(){return i.motionBlurPostProcess},!0))},t.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},t.prototype._disposePostProcesses=function(){for(var e=0;e0&&-1!==this.excludedMeshes.indexOf(e)},t.prototype._createPass=function(e,t){var i=this,n=e.getEngine();this._volumetricLightScatteringRTT=new Oi("volumetricLightScatteringMap",{width:n.getRenderWidth()*t,height:n.getRenderHeight()*t},e,!1,!0,g.a.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=$e.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=$e.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var r=this.getCamera();r?r.customRenderTargets.push(this._volumetricLightScatteringRTT):e.customRenderTargets.push(this._volumetricLightScatteringRTT);var o,a=function(e){var t=e.getRenderingMesh();if(!i._meshExcluded(t)){t._internalAbstractMeshDataInfo._isActiveIntermediate=!1;var n=e.getMaterial();if(n){var r=t.getScene(),o=r.getEngine();o.setState(n.backFaceCulling);var a=t._getInstancesRenderList(e._id);if(!a.mustReturn){var s=o.getCaps().instancedArrays&&null!==a.visibleInstances[e._id];if(i._isReady(e,s)){var c=i._volumetricLightScatteringPass;if(t===i.mesh&&(c=e.effect?e.effect:n.getEffect()),o.enableEffect(c),t._bind(e,c,No.a.TriangleFillMode),t===i.mesh)n.bind(t.getWorldMatrix(),t);else{if(i._volumetricLightScatteringPass.setMatrix("viewProjection",r.getTransformMatrix()),n&&n.needAlphaTesting()){var l=n.getAlphaTestTexture();i._volumetricLightScatteringPass.setTexture("diffuseSampler",l),l&&i._volumetricLightScatteringPass.setMatrix("diffuseMatrix",l.getTextureMatrix())}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&i._volumetricLightScatteringPass.setMatrices("mBones",t.skeleton.getTransformMatrices(t))}t._processRendering(e,i._volumetricLightScatteringPass,No.a.TriangleFillMode,a,s,function(e,t){return c.setMatrix("world",t)})}}}}},c=new s.b(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function(){o=e.clearColor,e.clearColor=c}),this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function(){e.clearColor=o}),this._volumetricLightScatteringRTT.customRenderFunction=function(t,i,n,r){var o,s=e.getEngine();if(r.length){for(s.setColorWrite(!1),o=0;ot._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0}),s.setAlphaMode(g.a.ALPHA_COMBINE),o=0;o\n#endif\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n}";ni.a.ShadersStore.depthPixelShader=ju;var Wu=function(){function e(t,i,n,r){var o=this;void 0===i&&(i=g.a.TEXTURETYPE_FLOAT),void 0===n&&(n=null),void 0===r&&(r=!1),this.useOnlyInActiveCamera=!1,this._scene=t,this._storeNonLinearDepth=r,this.isPacked=i===g.a.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this._clearColor=new s.b(1,1,1,1):this._clearColor=new s.b(1,0,0,1),e._SceneComponentInitialization(this._scene),this._camera=n;var a=t.getEngine(),c=this.isPacked||1===a.webGLVersion?g.a.TEXTUREFORMAT_RGBA:g.a.TEXTUREFORMAT_R;this._depthMap=new Oi("depthMap",{width:a.getRenderWidth(),height:a.getRenderHeight()},this._scene,!1,!0,i,!1,void 0,void 0,void 0,void 0,c),this._depthMap.wrapU=$e.a.CLAMP_ADDRESSMODE,this._depthMap.wrapV=$e.a.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add(function(e){e.clear(o._clearColor,!0,!0,!0)});var l=function(e){var t=e.getRenderingMesh(),i=o._scene,n=i.getEngine(),r=e.getMaterial();if(t._internalAbstractMeshDataInfo._isActiveIntermediate=!1,r){n.setState(r.backFaceCulling,0,!1,i.useRightHandedSystem);var a=t._getInstancesRenderList(e._id);if(!a.mustReturn){var s=n.getCaps().instancedArrays&&null!==a.visibleInstances[e._id],c=o._camera||i.activeCamera;if(o.isReady(e,s)&&c){if(n.enableEffect(o._effect),t._bind(e,o._effect,No.a.TriangleFillMode),o._effect.setMatrix("viewProjection",i.getTransformMatrix()),o._effect.setFloat2("depthValues",c.minZ,c.minZ+c.maxZ),r&&r.needAlphaTesting()){var l=r.getAlphaTestTexture();l&&(o._effect.setTexture("diffuseSampler",l),o._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()))}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&o._effect.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),Mr.a.BindMorphTargetParameters(t,o._effect),t._processRendering(e,o._effect,No.a.TriangleFillMode,a,s,function(e,t){return o._effect.setMatrix("world",t)})}}}};this._depthMap.customRenderFunction=function(e,t,i,n){var r;if(n.length){for(a.setColorWrite(!1),r=0;r4&&(r.push(Yi.b.MatricesIndicesExtraKind),r.push(Yi.b.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(r)),this._storeNonLinearDepth&&n.push("#define NONLINEARDEPTH"),this.isPacked&&n.push("#define PACKED");var c=n.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffect("depth",r,["world","mBones","viewProjection","diffuseMatrix","depthValues","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){this._depthMap.dispose()},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("DepthRendererSceneComponent")},e}();K.a.prototype.enableDepthRenderer=function(e,t){if(void 0===t&&(t=!1),!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";if(this._depthRenderer||(this._depthRenderer={}),!this._depthRenderer[e.id]){var i=0;i=this.getEngine().getCaps().textureHalfFloatRender?g.a.TEXTURETYPE_HALF_FLOAT:this.getEngine().getCaps().textureFloatRender?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_UNSIGNED_BYTE,this._depthRenderer[e.id]=new Wu(this,i,e,t)}return this._depthRenderer[e.id]},K.a.prototype.disableDepthRenderer=function(e){(e=e||this.activeCamera)&&this._depthRenderer&&this._depthRenderer[e.id]&&(this._depthRenderer[e.id].dispose(),delete this._depthRenderer[e.id])};var Hu=function(){function e(e){this.name=Fe.a.NAME_DEPTHRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Fe.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Fe.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER,this,this._gatherActiveCameraRenderTargets)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){for(var e in this.scene._depthRenderer)this.scene._depthRenderer[e].dispose()},e.prototype._gatherRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera||e.push(i.getDepthMap())}},e.prototype._gatherActiveCameraRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera&&this.scene.activeCamera.id===t&&e.push(i.getDepthMap())}},e}();Wu._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_DEPTHRENDERER);t||(t=new Hu(e),e._addComponent(t))};var Xu="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";ni.a.ShadersStore.linePixelShader=Xu;var Yu="\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}";ni.a.ShadersStore.lineVertexShader=Yu;Ye.a.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},Ye.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new Qu(this,e,t),this},Object.defineProperty(Ye.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),dc.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new qu(this,e,t),this},dc.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),dc.b.prototype.enableEdgesRendering.apply(this,arguments),this};var Ku=function(){this.edges=new Array,this.edgesConnectedCount=0},Qu=function(){function e(e,t,i,n){var r=this;void 0===t&&(t=.95),void 0===i&&(i=!1),void 0===n&&(n=!0),this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this._source=e,this._checkVerticesInsteadOfIndices=i,this._epsilon=t,this._prepareRessources(),n&&this._generateEdgesLines(),this._meshRebuildObserver=this._source.onRebuildObservable.add(function(){r._rebuild()}),this._meshDisposeObserver=this._source.onDisposeObservable.add(function(){r.dispose()})}return e.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=new Ba.a("lineShader",this._source.getScene(),"line",{attributes:["position","normal"],uniforms:["worldViewProjection","color","width","aspectRatio"]}),this._lineShader.disableDepthWrite=!0,this._lineShader.backFaceCulling=!1)},e.prototype._rebuild=function(){var e=this._buffers[Yi.b.PositionKind];e&&e._rebuild(),(e=this._buffers[Yi.b.NormalKind])&&e._rebuild();var t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)},e.prototype.dispose=function(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var e=this._buffers[Yi.b.PositionKind];e&&(e.dispose(),this._buffers[Yi.b.PositionKind]=null),(e=this._buffers[Yi.b.NormalKind])&&(e.dispose(),this._buffers[Yi.b.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose()},e.prototype._processEdgeForAdjacencies=function(e,t,i,n,r){return e===i&&t===n||e===n&&t===i?0:e===n&&t===r||e===r&&t===n?1:e===r&&t===i||e===i&&t===r?2:-1},e.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,n,r){return e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(n)||e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(i)?0:e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(r)||e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(n)?1:e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(i)||e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(r)?2:-1},e.prototype._checkEdge=function(e,t,i,n,r){var o;void 0===t?o=!0:o=a.e.Dot(i[e],i[t])\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n}";ni.a.ShadersStore.outlinePixelShader=Zu;var Ju="\nattribute vec3 position;\nattribute vec3 normal;\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n}\n";ni.a.ShadersStore.outlineVertexShader=Ju;K.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new $u(this)),this._outlineRenderer},Object.defineProperty(Ye.a.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ye.a.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var $u=function(){function e(e){this.name=Fe.a.NAME_OUTLINERENDERER,this.zOffset=1,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this)}return e.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(Fe.a.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(Fe.a.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype.render=function(e,t,i){var n=this;void 0===i&&(i=!1);var r=this.scene,o=r.getEngine(),a=o.getCaps().instancedArrays&&null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id];if(this.isReady(e,a)){var s=e.getRenderingMesh(),c=e.getMaterial();if(c&&r.activeCamera){if(o.enableEffect(this._effect),c.useLogarithmicDepth&&this._effect.setFloat("logarithmicDepthConstant",2/(Math.log(r.activeCamera.maxZ+1)/Math.LN2)),this._effect.setFloat("offset",i?0:s.outlineWidth),this._effect.setColor4("color",i?s.overlayColor:s.outlineColor,i?s.overlayAlpha:c.alpha),this._effect.setMatrix("viewProjection",r.getTransformMatrix()),s.useBones&&s.computeBonesUsingShaders&&s.skeleton&&this._effect.setMatrices("mBones",s.skeleton.getTransformMatrices(s)),Mr.a.BindMorphTargetParameters(s,this._effect),s._bind(e,this._effect,No.a.TriangleFillMode),c&&c.needAlphaTesting()){var l=c.getAlphaTestTexture();l&&(this._effect.setTexture("diffuseSampler",l),this._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()))}o.setZOffset(-this.zOffset),s._processRendering(e,this._effect,No.a.TriangleFillMode,t,a,function(e,t){n._effect.setMatrix("world",t)}),o.setZOffset(0)}}},e.prototype.isReady=function(e,t){var i=[],n=[Yi.b.PositionKind,Yi.b.NormalKind],r=e.getMesh(),o=e.getMaterial();o&&(o.needAlphaTesting()&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Yi.b.UVKind)&&(n.push(Yi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Yi.b.UV2Kind)&&(n.push(Yi.b.UV2Kind),i.push("#define UV2"))),o.useLogarithmicDepth&&i.push("#define LOGARITHMICDEPTH")),r.useBones&&r.computeBonesUsingShaders?(n.push(Yi.b.MatricesIndicesKind),n.push(Yi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Yi.b.MatricesIndicesExtraKind),n.push(Yi.b.MatricesWeightsExtraKind)),i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),i.push("#define BonesPerMesh "+(r.skeleton?r.skeleton.bones.length+1:0))):i.push("#define NUM_BONE_INFLUENCERS 0");var a=r.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,i.push("#define MORPHTARGETS"),i.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,s)),t&&(i.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(n));var c=i.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this.scene.getEngine().createEffect("outline",n,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype._beforeRenderingMesh=function(t,i,n){if(this._savedDepthWrite=this._engine.getDepthWrite(),t.renderOutline){var r=i.getMaterial();r&&r.needAlphaBlending()&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(g.a.REPLACE),this._engine.setStencilFunction(g.a.ALWAYS),this._engine.setStencilMask(e._StencilReference),this._engine.setStencilFunctionReference(e._StencilReference),this.render(i,n,!0),this._engine.setColorWrite(!0),this._engine.setStencilFunction(g.a.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(i,n),this._engine.setDepthWrite(this._savedDepthWrite),r&&r.needAlphaBlending()&&this._engine.restoreStencilState()}},e.prototype._afterRenderingMesh=function(e,t,i){if(e.renderOverlay){var n=this._engine.getAlphaMode();this._engine.setAlphaMode(g.a.ALPHA_COMBINE),this.render(t,i,!0),this._engine.setAlphaMode(n)}e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i),this._engine.setColorWrite(!0))},e._StencilReference=4,e}(),eh=i(125),th=function(){function e(e,t){this.name=e,this.color=new s.b(1,1,1,1),this.width=1,this.height=1,this.angle=0,this.invertU=0,this.invertV=0,this.animations=new Array,this.isPickable=!1,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this.isVisible=!0,this._manager=t,this._manager.sprites.push(this),this.position=a.e.Zero()}return Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!0,configurable:!0}),e.prototype.playAnimation=function(e,t,i,n,r){this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=n,this._animationStarted=!0,ethis._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(this._direction>0&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex0?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onAnimationEnd&&this._onAnimationEnd(),this.disposeWhenFinishedAnimating&&this.dispose()))))},e.prototype.dispose=function(){for(var e=0;e0)for(var o=0;o=r.distance))&&(r=s,i))break}}return r||new In.a},K.a.prototype._internalMultiPickSprites=function(e,t,i){if(!In.a)return null;var n=new Array;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(this.spriteManagers.length>0)for(var r=0;r0&&(i=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(r._pickedDownSprite=i.pickedSprite,n.button){case 0:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnLeftPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnCenterPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnRightPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickDownTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n))}return i},e.prototype._pointerUp=function(e,t,i,n){var r=this.scene;if(r.spriteManagers.length>0){var o=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0);o&&(o.hit&&o.pickedSprite&&o.pickedSprite.actionManager&&(o.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickUpTrigger,u.a.CreateNewFromSprite(o.pickedSprite,r,n)),o.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||o.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickTrigger,u.a.CreateNewFromSprite(o.pickedSprite,r,n)))),r._pickedDownSprite&&r._pickedDownSprite.actionManager&&r._pickedDownSprite!==o.pickedSprite&&r._pickedDownSprite.actionManager.processTrigger(g.a.ACTION_OnPickOutTrigger,u.a.CreateNewFromSprite(r._pickedDownSprite,r,n)))}return i},e}(),nh="uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include\ngl_FragColor=color;\n}";ni.a.ShadersStore.spritesPixelShader=nh;var rh="\nattribute vec4 position;\nattribute vec4 options;\nattribute vec2 inverts;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include\nvoid main(void) {\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz;\nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0);\n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\nvec2 uvPlace=cellInfo.xy;\nvec2 uvSize=cellInfo.zw;\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}";ni.a.ShadersStore.spritesVertexShader=rh;var oh,ah=function(){function e(e,t,i,n,r,a,s,c,l){if(void 0===a&&(a=.01),void 0===s&&(s=$e.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=!1),void 0===l&&(l=null),this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.fogEnabled=!0,this.isPickable=!1,this._packedAndReady=!1,this.onDisposeObservable=new o.c,this._vertexBuffers={},r._getComponent(Fe.a.NAME_SPRITE)||r._addComponent(new ih(r)),this._capacity=i,this._fromPacked=c,this._spriteTexture=new $e.a(t,r,!0,!1,s),this._spriteTexture.wrapU=$e.a.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=$e.a.CLAMP_ADDRESSMODE,n.width&&n.height)this.cellWidth=n.width,this.cellHeight=n.height;else{if(void 0===n)return;this.cellWidth=n,this.cellHeight=n}this._epsilon=a,this._scene=r,this._scene.spriteManagers.push(this);for(var u=[],h=0,d=0;d0);var s=e.substring(0,a-1)+".json",c=new XMLHttpRequest;c.open("GET",s,!0),c.onerror=function(){m.a.Error("Unable to Load Sprite JSON Data. Spritesheet managed with constant cell size."),i._fromPacked=!1,i._packedAndReady=!1},c.onload=function(){try{var e=JSON.parse(c.response),t=Reflect.ownKeys(e.frames);i._spriteMap=t,i._packedAndReady=!0,i._cellData=e.frames}catch(e){throw i._fromPacked=!1,i._packedAndReady=!1,new Error("Invalid JSON from file. Spritesheet managed with constant cell size.")}},c.send()}},e.prototype._appendSpriteVertex=function(e,t,i,n,r){var o=18*e;if(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),this._vertexData[o]=t.position.x,this._vertexData[o+1]=t.position.y,this._vertexData[o+2]=t.position.z,this._vertexData[o+3]=t.angle,this._vertexData[o+4]=t.width,this._vertexData[o+5]=t.height,this._vertexData[o+6]=i,this._vertexData[o+7]=n,this._vertexData[o+8]=t.invertU?1:0,this._vertexData[o+9]=t.invertV?1:0,this._packedAndReady){t.cellRef||(t.cellIndex=0);var a=t.cellIndex;"number"==typeof a&&isFinite(a)&&Math.floor(a)===a&&(t.cellRef=this._spriteMap[t.cellIndex]),this._vertexData[o+10]=this._cellData[t.cellRef].frame.x/r.width,this._vertexData[o+11]=this._cellData[t.cellRef].frame.y/r.height,this._vertexData[o+12]=this._cellData[t.cellRef].frame.w/r.width,this._vertexData[o+13]=this._cellData[t.cellRef].frame.h/r.height}else{t.cellIndex||(t.cellIndex=0);var s=r.width/this.cellWidth,c=t.cellIndex/s>>0;this._vertexData[o+10]=(t.cellIndex-c*s)*this.cellWidth/r.width,this._vertexData[o+11]=c*this.cellHeight/r.height,this._vertexData[o+12]=this.cellWidth/r.width,this._vertexData[o+13]=this.cellHeight/r.height}this._vertexData[o+14]=t.color.r,this._vertexData[o+15]=t.color.g,this._vertexData[o+16]=t.color.b,this._vertexData[o+17]=t.color.a},e.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this._capacity,this.sprites.length),o=a.e.Zero(),s=a.e.Zero(),c=Number.MAX_VALUE,l=null,u=a.c.Vector3[0],h=a.c.Vector3[1],d=t.getViewMatrix(),f=0;f_&&(c=_,l=p,n))break}}}if(l){var m=new In.a;d.invertToRef(a.c.Matrix[0]),m.hit=!0,m.pickedSprite=l,m.distance=c;var g=a.c.Vector3[2];return g.copyFrom(e.direction),g.normalize(),g.scaleInPlace(c),e.origin.addToRef(g,u),m.pickedPoint=a.e.TransformCoordinates(u,a.c.Matrix[0]),m}return null},e.prototype.multiIntersects=function(e,t,i){for(var n,r=Math.min(this._capacity,this.sprites.length),o=a.e.Zero(),s=a.e.Zero(),c=[],l=a.c.Vector3[0].copyFromFloats(0,0,0),u=a.c.Vector3[1].copyFromFloats(0,0,0),h=t.getViewMatrix(),d=0;d-1&&this._tasks.splice(t,1)},e.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new dh(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){m.a.Error("Error running progress callbacks."),console.log(e)}if(0===this._waitingTasksCount){try{this.onFinish&&this.onFinish(this._tasks);for(var t=this._tasks.slice(),i=0,n=t;i-1&&this._tasks.splice(r,1)}}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){m.a.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},e.prototype._runTask=function(e){var t=this,i=function(i,n){e._setErrorObject(i,n),t.onTaskError&&t.onTaskError(e),t.onTaskErrorObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)};e.run(this._scene,function(){try{t.onTaskSuccess&&t.onTaskSuccess(e),t.onTaskSuccessObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)}catch(e){i("Error executing task success callbacks",e)}},i)},e.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},e.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e=0&&this._meshes.splice(i,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var n=0;n0&&this._textureLoadingCallback(e)}this._currentScene.render()}},e.prototype.drag=function(e){e.stopPropagation(),e.preventDefault()},e.prototype.drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},e.prototype._traverseFolder=function(e,t,i,n){var r=this,o=e.createReader(),a=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");o.readEntries(function(e){i.count+=e.length;for(var o=0,s=e;o0)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o0&&m.a.ClearLogCache(),this._engine.stopRenderLoop()),vn.LoadAsync("file:",this._sceneFileToLoad,this._engine,function(t){e._progressCallback&&e._progressCallback(t)}).then(function(t){e._currentScene&&e._currentScene.dispose(),e._currentScene=t,e._sceneLoadedCallback&&e._sceneLoadedCallback(e._sceneFileToLoad,e._currentScene),e._currentScene.executeWhenReady(function(){e._engine.runRenderLoop(function(){e.renderFunction()})})}).catch(function(t){e._errorCallback&&e._errorCallback(e._sceneFileToLoad,e._currentScene,t.message)})):m.a.Error("Please provide a valid .babylon file.")},e}(),Sh=i(121),Rh=i(120),xh=function(){function e(e){void 0===e&&(e=0),this.priority=e}return e.prototype.getDescription=function(){return""},e.prototype.apply=function(e,t){return!0},e}(),Ch=function(e){function t(t,i,n){void 0===t&&(t=0),void 0===i&&(i=1024),void 0===n&&(n=.5);var r=e.call(this,t)||this;return r.priority=t,r.maximumSize=i,r.step=n,r}return h.d(t,e),t.prototype.getDescription=function(){return"Reducing render target texture size to "+this.maximumSize},t.prototype.apply=function(e,t){for(var i=!0,n=0;nthis.maximumSize&&(r.scale(this.step),i=!1)}}return i},t}(xh),Mh=function(e){function t(t,i,n){void 0===t&&(t=0),void 0===i&&(i=2),void 0===n&&(n=.25);var r=e.call(this,t)||this;return r.priority=t,r.maximumScale=i,r.step=n,r._currentScale=-1,r._directionOffset=1,r}return h.d(t,e),t.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},t.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},t}(xh),Oh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning shadows on/off"},t.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},t}(xh),Ih=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning post-processes on/off"},t.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},t}(xh),Dh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning lens flares on/off"},t.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},t}(xh),Lh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},t.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},t}(xh),wh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning particles on/off"},t.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},t}(xh),Fh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning render targets off"},t.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},t}(xh),Nh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._canBeMerged=function(e){if(!(e instanceof Se.a))return!1;var t=e;return!t.isDisposed()&&(!(!t.isVisible||!t.isEnabled())&&(!(t.instances.length>0)&&(!t.skeleton&&!t.hasLODLevels)))},t}return h.d(t,e),Object.defineProperty(t,"UpdateSelectionTree",{get:function(){return t._UpdateSelectionTree},set:function(e){t._UpdateSelectionTree=e},enumerable:!0,configurable:!0}),t.prototype.getDescription=function(){return"Merging similar meshes together"},t.prototype.apply=function(e,i,n){for(var r=e.meshes.slice(0),o=r.length,a=0;a=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o0){o.animationGroups=[];for(var h=0;h0)for(o.reflectionProbes=[],i=0;i0&&setTimeout(function(){i.stopRecording()},1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise(function(e,t){i._resolve=e,i._reject=t})},e.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},e.prototype._handleDataAvailable=function(e){e.data.size>0&&this._recordedChunks.push(e.data)},e.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},e.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&Ie.b.Download(e,this._fileName)},e._defaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},e}(),Xh=function(){function e(){}return e.CreateScreenshot=function(t,i,n,r,o){void 0===o&&(o="image/png");var a=e._getScreenshotSize(t,i,n),s=a.height,c=a.width;if(s&&c){Ie.b._ScreenshotCanvas||(Ie.b._ScreenshotCanvas=document.createElement("canvas")),Ie.b._ScreenshotCanvas.width=c,Ie.b._ScreenshotCanvas.height=s;var l=Ie.b._ScreenshotCanvas.getContext("2d"),u=t.getRenderWidth()/t.getRenderHeight(),h=c,d=h/u;d>s&&(h=(d=s)*u);var f=Math.max(0,c-h)/2,p=Math.max(0,s-d)/2,_=t.getRenderingCanvas();l&&_&&l.drawImage(_,f,p,h,d),Ie.b.EncodeScreenshotCanvasData(r,o)}else m.a.Error("Invalid 'size' parameter !")},e.CreateScreenshotAsync=function(t,i,n,r){return void 0===r&&(r="image/png"),new Promise(function(o,a){e.CreateScreenshot(t,i,n,function(e){void 0!==e?o(e):a(new Error("Data is undefined"))},r)})},e.CreateScreenshotUsingRenderTarget=function(t,i,n,r,o,a,s,c){void 0===o&&(o="image/png"),void 0===a&&(a=1),void 0===s&&(s=!1);var l=e._getScreenshotSize(t,i,n),u=l.height,h=l.width,d={width:h,height:u};if(u&&h){var f=i.getScene(),p=null;f.activeCamera!==i&&(p=f.activeCamera,f.activeCamera=i);var _=t.getRenderingCanvas();if(_){var v={width:_.width,height:_.height};t.setSize(h,u),f.render();var y=new Oi("screenShot",d,f,!1,!1,g.a.TEXTURETYPE_UNSIGNED_INT,!1,$e.a.NEAREST_SAMPLINGMODE);y.renderList=null,y.samples=a,s&&y.addPostProcess(new ou("antialiasing",1,f.activeCamera)),y.onAfterRenderObservable.add(function(){Ie.b.DumpFramebuffer(h,u,t,r,o,c)}),f.incrementRenderId(),f.resetCachedMaterial(),y.render(!0),y.dispose(),p&&(f.activeCamera=p),t.setSize(v.width,v.height),i.getProjectionMatrix(!0)}else m.a.Error("No rendering canvas found !")}else m.a.Error("Invalid 'size' parameter !")},e.CreateScreenshotUsingRenderTargetAsync=function(t,i,n,r,o,a,s){return void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),new Promise(function(c,l){e.CreateScreenshotUsingRenderTarget(t,i,n,function(e){void 0!==e?c(e):l(new Error("Data is undefined"))},r,o,a,s)})},e._getScreenshotSize=function(e,t,i){var n=0,r=0;if("object"==typeof i){var o=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*o,r=i.width*o):i.width&&!i.height?(r=i.width*o,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*o,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*o),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return{height:n,width:r}},e}();Ie.b.CreateScreenshot=Xh.CreateScreenshot,Ie.b.CreateScreenshotAsync=Xh.CreateScreenshotAsync,Ie.b.CreateScreenshotUsingRenderTarget=Xh.CreateScreenshotUsingRenderTarget,Ie.b.CreateScreenshotUsingRenderTargetAsync=Xh.CreateScreenshotUsingRenderTargetAsync,function(e){e[e.Checkbox=0]="Checkbox",e[e.Slider=1]="Slider",e[e.Vector3=2]="Vector3",e[e.Quaternion=3]="Quaternion",e[e.Color3=4]="Color3",e[e.String=5]="String"}(uh||(uh={}));var Yh=i(119),Kh=i(118);i.d(t,"AbstractScene",function(){return n.a}),i.d(t,"AbstractActionManager",function(){return r.a}),i.d(t,"Action",function(){return l}),i.d(t,"ActionEvent",function(){return u.a}),i.d(t,"ActionManager",function(){return O}),i.d(t,"Condition",function(){return d}),i.d(t,"ValueCondition",function(){return f}),i.d(t,"PredicateCondition",function(){return p}),i.d(t,"StateCondition",function(){return _}),i.d(t,"SwitchBooleanAction",function(){return v}),i.d(t,"SetStateAction",function(){return y}),i.d(t,"SetValueAction",function(){return b}),i.d(t,"IncrementValueAction",function(){return T}),i.d(t,"PlayAnimationAction",function(){return E}),i.d(t,"StopAnimationAction",function(){return A}),i.d(t,"DoNothingAction",function(){return P}),i.d(t,"CombineAction",function(){return S}),i.d(t,"ExecuteCodeAction",function(){return R}),i.d(t,"SetParentAction",function(){return x}),i.d(t,"PlaySoundAction",function(){return I}),i.d(t,"StopSoundAction",function(){return D}),i.d(t,"InterpolateValueAction",function(){return G}),i.d(t,"Animatable",function(){return $}),i.d(t,"_IAnimationState",function(){return V}),i.d(t,"Animation",function(){return k}),i.d(t,"TargetedAnimation",function(){return te}),i.d(t,"AnimationGroup",function(){return ie}),i.d(t,"AnimationPropertiesOverride",function(){return ne}),i.d(t,"EasingFunction",function(){return he}),i.d(t,"CircleEase",function(){return de}),i.d(t,"BackEase",function(){return fe}),i.d(t,"BounceEase",function(){return pe}),i.d(t,"CubicEase",function(){return _e}),i.d(t,"ElasticEase",function(){return me}),i.d(t,"ExponentialEase",function(){return ge}),i.d(t,"PowerEase",function(){return ve}),i.d(t,"QuadraticEase",function(){return ye}),i.d(t,"QuarticEase",function(){return be}),i.d(t,"QuinticEase",function(){return Te}),i.d(t,"SineEase",function(){return Ee}),i.d(t,"BezierCurveEase",function(){return Ae}),i.d(t,"RuntimeAnimation",function(){return Y}),i.d(t,"AnimationEvent",function(){return Pe}),i.d(t,"AnimationKeyInterpolation",function(){return L}),i.d(t,"AnimationRange",function(){return N}),i.d(t,"KeepAssets",function(){return Re}),i.d(t,"AssetContainer",function(){return xe}),i.d(t,"Analyser",function(){return Me}),i.d(t,"AudioEngine",function(){return Oe}),i.d(t,"AudioSceneComponent",function(){return Ne}),i.d(t,"Sound",function(){return Le}),i.d(t,"SoundTrack",function(){return we}),i.d(t,"WeightedSound",function(){return Be}),i.d(t,"AutoRotationBehavior",function(){return Ve}),i.d(t,"BouncingBehavior",function(){return ke}),i.d(t,"FramingBehavior",function(){return Ge}),i.d(t,"AttachToBoxBehavior",function(){return je}),i.d(t,"FadeInOutBehavior",function(){return We}),i.d(t,"MultiPointerScaleBehavior",function(){return Xe}),i.d(t,"PointerDragBehavior",function(){return He.a}),i.d(t,"SixDofDragBehavior",function(){return qe}),i.d(t,"Bone",function(){return J}),i.d(t,"BoneIKController",function(){return Ze}),i.d(t,"BoneLookController",function(){return Je}),i.d(t,"Skeleton",function(){return it}),i.d(t,"CameraInputTypes",function(){return nt}),i.d(t,"CameraInputsManager",function(){return rt}),i.d(t,"Camera",function(){return Ke.a}),i.d(t,"TargetCamera",function(){return It}),i.d(t,"FreeCamera",function(){return Dt}),i.d(t,"FreeCameraInputsManager",function(){return Pt}),i.d(t,"TouchCamera",function(){return Lt}),i.d(t,"ArcRotateCamera",function(){return wt}),i.d(t,"ArcRotateCameraInputsManager",function(){return pt}),i.d(t,"DeviceOrientationCamera",function(){return Ft}),i.d(t,"FlyCamera",function(){return Bt}),i.d(t,"FlyCameraInputsManager",function(){return Nt}),i.d(t,"FollowCamera",function(){return kt}),i.d(t,"ArcFollowCamera",function(){return Gt}),i.d(t,"FollowCameraInputsManager",function(){return Ut}),i.d(t,"GamepadCamera",function(){return ti}),i.d(t,"UniversalCamera",function(){return ei}),i.d(t,"VirtualJoysticksCamera",function(){return Ei}),i.d(t,"ArcRotateCameraGamepadInput",function(){return ct}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return ut}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return ht}),i.d(t,"ArcRotateCameraPointersInput",function(){return ft}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return _t}),i.d(t,"FlyCameraKeyboardInput",function(){return mt}),i.d(t,"FlyCameraMouseInput",function(){return gt}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return vt}),i.d(t,"FollowCameraMouseWheelInput",function(){return yt}),i.d(t,"FollowCameraPointersInput",function(){return bt}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return St}),i.d(t,"FreeCameraGamepadInput",function(){return Rt}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return Tt}),i.d(t,"FreeCameraMouseInput",function(){return Et}),i.d(t,"FreeCameraTouchInput",function(){return At}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return Ot}),i.d(t,"AnaglyphArcRotateCamera",function(){return di}),i.d(t,"AnaglyphFreeCamera",function(){return fi}),i.d(t,"AnaglyphGamepadCamera",function(){return pi}),i.d(t,"AnaglyphUniversalCamera",function(){return _i}),i.d(t,"StereoscopicArcRotateCamera",function(){return vi}),i.d(t,"StereoscopicFreeCamera",function(){return yi}),i.d(t,"StereoscopicGamepadCamera",function(){return bi}),i.d(t,"StereoscopicUniversalCamera",function(){return Ti}),i.d(t,"VRCameraMetrics",function(){return Ai}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return Fi}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return Ni}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return Bi}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return nn}),i.d(t,"VRExperienceHelper",function(){return rn}),i.d(t,"WebVRFreeCamera",function(){return Vi}),i.d(t,"WebXRCamera",function(){return on}),i.d(t,"WebXREnterExitUIButton",function(){return cn}),i.d(t,"WebXREnterExitUIOptions",function(){return ln}),i.d(t,"WebXREnterExitUI",function(){return un}),i.d(t,"WebXRState",function(){return qi}),i.d(t,"WebXRExperienceHelper",function(){return sn}),i.d(t,"WebXRInput",function(){return dn}),i.d(t,"WebXRControllerTeleportation",function(){return fn}),i.d(t,"WebXRControllerPointerSelection",function(){return pn}),i.d(t,"WebXRControllerModelLoader",function(){return Sn}),i.d(t,"WebXRController",function(){return hn}),i.d(t,"WebXRManagedOutputCanvas",function(){return Rn}),i.d(t,"WebXRSessionManager",function(){return an}),i.d(t,"Collider",function(){return Mn}),i.d(t,"DefaultCollisionCoordinator",function(){return On}),i.d(t,"PickingInfo",function(){return In.a}),i.d(t,"IntersectionInfo",function(){return Dn.a}),i.d(t,"_MeshCollisionData",function(){return Ln.a}),i.d(t,"BoundingBox",function(){return wn.a}),i.d(t,"BoundingInfo",function(){return Fn.a}),i.d(t,"BoundingSphere",function(){return Nn.a}),i.d(t,"Ray",function(){return jt.a}),i.d(t,"Octree",function(){return Un}),i.d(t,"OctreeBlock",function(){return Bn}),i.d(t,"OctreeSceneComponent",function(){return Vn}),i.d(t,"AxesViewer",function(){return kn.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return kn.BoneAxesViewer}),i.d(t,"DebugLayer",function(){return kn.DebugLayer}),i.d(t,"PhysicsViewer",function(){return kn.PhysicsViewer}),i.d(t,"RayHelper",function(){return kn.RayHelper}),i.d(t,"SkeletonViewer",function(){return kn.SkeletonViewer}),i.d(t,"Constants",function(){return g.a}),i.d(t,"InstancingAttributeInfo",function(){return Ce.d}),i.d(t,"DepthTextureCreationOptions",function(){return Ce.a}),i.d(t,"EngineCapabilities",function(){return Ce.c}),i.d(t,"Engine",function(){return Ce.b}),i.d(t,"EngineStore",function(){return C.a}),i.d(t,"NullEngineOptions",function(){return Gn.b}),i.d(t,"NullEngine",function(){return Gn.a}),i.d(t,"WebGLPipelineContext",function(){return Wn.a}),i.d(t,"WebGL2ShaderProcessor",function(){return Hn.a}),i.d(t,"_OcclusionDataStorage",function(){return jn}),i.d(t,"_forceTransformFeedbackToBundle",function(){return!0}),i.d(t,"KeyboardEventTypes",function(){return lt.a}),i.d(t,"KeyboardInfo",function(){return lt.b}),i.d(t,"KeyboardInfoPre",function(){return lt.c}),i.d(t,"PointerEventTypes",function(){return Ue.a}),i.d(t,"PointerInfoBase",function(){return Ue.c}),i.d(t,"PointerInfoPre",function(){return Ue.d}),i.d(t,"PointerInfo",function(){return Ue.b}),i.d(t,"ClipboardEventTypes",function(){return Xn}),i.d(t,"ClipboardInfo",function(){return Yn}),i.d(t,"StickValues",function(){return ot}),i.d(t,"Gamepad",function(){return at}),i.d(t,"GenericPad",function(){return st}),i.d(t,"GamepadManager",function(){return Jt}),i.d(t,"GamepadSystemSceneComponent",function(){return $t}),i.d(t,"Xbox360Button",function(){return Wt}),i.d(t,"Xbox360Dpad",function(){return Ht}),i.d(t,"Xbox360Pad",function(){return qt}),i.d(t,"DualShockButton",function(){return Kt}),i.d(t,"DualShockDpad",function(){return Qt}),i.d(t,"DualShockPad",function(){return Zt}),i.d(t,"DaydreamController",function(){return Kn}),i.d(t,"GearVRController",function(){return Qn}),i.d(t,"GenericController",function(){return yn}),i.d(t,"OculusTouchController",function(){return En}),i.d(t,"PoseEnabledControllerType",function(){return Vt}),i.d(t,"PoseEnabledControllerHelper",function(){return Xt}),i.d(t,"PoseEnabledController",function(){return Yt}),i.d(t,"ViveController",function(){return An}),i.d(t,"WebVRController",function(){return ki}),i.d(t,"WindowsMotionController",function(){return Tn}),i.d(t,"AxisDragGizmo",function(){return qn.a}),i.d(t,"AxisScaleGizmo",function(){return er}),i.d(t,"BoundingBoxGizmo",function(){return nr}),i.d(t,"Gizmo",function(){return Jn.a}),i.d(t,"GizmoManager",function(){return dr}),i.d(t,"PlaneRotationGizmo",function(){return rr}),i.d(t,"PositionGizmo",function(){return lr}),i.d(t,"RotationGizmo",function(){return or}),i.d(t,"ScaleGizmo",function(){return hr}),i.d(t,"LightGizmo",function(){return vr}),i.d(t,"PlaneDragGizmo",function(){return cr}),i.d(t,"EnvironmentHelper",function(){return kr}),i.d(t,"PhotoDome",function(){return Gr}),i.d(t,"_forceSceneHelpersToBundle",function(){return!0}),i.d(t,"VideoDome",function(){return Do}),i.d(t,"EngineInstrumentation",function(){return wo}),i.d(t,"SceneInstrumentation",function(){return Fo}),i.d(t,"_TimeToken",function(){return zn}),i.d(t,"EffectLayer",function(){return Vo}),i.d(t,"EffectLayerSceneComponent",function(){return ko}),i.d(t,"GlowLayer",function(){return jo}),i.d(t,"HighlightLayer",function(){return Xo}),i.d(t,"Layer",function(){return qo}),i.d(t,"LayerSceneComponent",function(){return Yo}),i.d(t,"LensFlare",function(){return Zo}),i.d(t,"LensFlareSystem",function(){return ea}),i.d(t,"LensFlareSystemSceneComponent",function(){return ta}),i.d(t,"Light",function(){return fr.a}),i.d(t,"ShadowLight",function(){return pr}),i.d(t,"DirectionalLight",function(){return _r}),i.d(t,"HemisphericLight",function(){return Ui.a}),i.d(t,"PointLight",function(){return sa}),i.d(t,"SpotLight",function(){return gr}),i.d(t,"ShadowGenerator",function(){return oa}),i.d(t,"ShadowGeneratorSceneComponent",function(){return aa}),i.d(t,"DefaultLoadingScreen",function(){return ca}),i.d(t,"SceneLoaderProgressEvent",function(){return gn}),i.d(t,"SceneLoader",function(){return vn}),i.d(t,"SceneLoaderFlags",function(){return mn.a}),i.d(t,"_BabylonLoaderRegistered",function(){return!0}),i.d(t,"ColorCurves",function(){return Da.a}),i.d(t,"EffectFallbacks",function(){return ni.c}),i.d(t,"EffectCreationOptions",function(){return ni.b}),i.d(t,"Effect",function(){return ni.a}),i.d(t,"FresnelParameters",function(){return La}),i.d(t,"ImageProcessingConfigurationDefines",function(){return Gi.b}),i.d(t,"ImageProcessingConfiguration",function(){return Gi.a}),i.d(t,"Material",function(){return No.a}),i.d(t,"MaterialDefines",function(){return Or.a}),i.d(t,"MaterialHelper",function(){return Mr.a}),i.d(t,"MultiMaterial",function(){return ua.a}),i.d(t,"PushMaterial",function(){return Ir.a}),i.d(t,"ShaderMaterial",function(){return Ba.a}),i.d(t,"StandardMaterialDefines",function(){return zi.b}),i.d(t,"StandardMaterial",function(){return zi.a}),i.d(t,"BaseTexture",function(){return yr.a}),i.d(t,"CubeTexture",function(){return Cr}),i.d(t,"DynamicTexture",function(){return ji}),i.d(t,"EquiRectangularCubeTexture",function(){return Va}),i.d(t,"HDRCubeTexture",function(){return fa}),i.d(t,"InternalTexture",function(){return et.a}),i.d(t,"MirrorTexture",function(){return Rr}),i.d(t,"MultiRenderTarget",function(){return Xa}),i.d(t,"RawTexture",function(){return tt}),i.d(t,"RenderTargetTexture",function(){return Oi}),i.d(t,"Texture",function(){return $e.a}),i.d(t,"UniformBuffer",function(){return xi.a}),i.d(t,"MaterialFlags",function(){return Dr.a}),i.d(t,"EffectRenderer",function(){return Qs}),i.d(t,"EffectWrapper",function(){return qs}),i.d(t,"BackgroundMaterial",function(){return Vr}),i.d(t,"PBRMaterialDefines",function(){return uo}),i.d(t,"PBRBaseMaterial",function(){return ho}),i.d(t,"PBRBaseSimpleMaterial",function(){return wa}),i.d(t,"PBRMaterial",function(){return fo}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return Fa}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return Na}),i.d(t,"ColorGradingTexture",function(){return Ua}),i.d(t,"RawCubeTexture",function(){return is}),i.d(t,"RawTexture3D",function(){return ns}),i.d(t,"RefractionTexture",function(){return rs}),i.d(t,"VideoTexture",function(){return Mo}),i.d(t,"HtmlElementTexture",function(){return os}),i.d(t,"NodeMaterialBlockTargets",function(){return es}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return ts}),i.d(t,"NodeMaterialConnectionPoint",function(){return as}),i.d(t,"NodeMaterialBlock",function(){return cs}),i.d(t,"NodeMaterialDefines",function(){return vs}),i.d(t,"NodeMaterial",function(){return ys}),i.d(t,"NodeMaterialWellKnownValues",function(){return ps}),i.d(t,"_DDSTextureLoader",function(){return Eo}),i.d(t,"_ENVTextureLoader",function(){return So}),i.d(t,"_KTXTextureLoader",function(){return xo}),i.d(t,"_TGATextureLoader",function(){return Ga}),i.d(t,"_BasisTextureLoader",function(){return Ha}),i.d(t,"CustomProceduralTexture",function(){return Za}),i.d(t,"NoiseProceduralTexture",function(){return $a}),i.d(t,"ProceduralTexture",function(){return Qa}),i.d(t,"ProceduralTextureSceneComponent",function(){return Ya}),i.d(t,"MultiplyBlock",function(){return Os}),i.d(t,"AddBlock",function(){return Is}),i.d(t,"ScaleBlock",function(){return Ds}),i.d(t,"ClampBlock",function(){return Ls}),i.d(t,"CrossBlock",function(){return ws}),i.d(t,"DotBlock",function(){return Fs}),i.d(t,"TransformBlock",function(){return hs}),i.d(t,"RemapBlock",function(){return Ns}),i.d(t,"NormalizeBlock",function(){return Us}),i.d(t,"TrigonometryBlockOperations",function(){return Bs}),i.d(t,"TrigonometryBlock",function(){return Vs}),i.d(t,"ColorMergerBlock",function(){return ks}),i.d(t,"VectorMergerBlock",function(){return Gs}),i.d(t,"ColorSplitterBlock",function(){return zs}),i.d(t,"VectorSplitterBlock",function(){return js}),i.d(t,"LerpBlock",function(){return Ws}),i.d(t,"DivideBlock",function(){return Hs}),i.d(t,"SubtractBlock",function(){return Xs}),i.d(t,"StepBlock",function(){return Ys}),i.d(t,"NodeMaterialOptimizer",function(){return Ks}),i.d(t,"VertexOutputBlock",function(){return ds}),i.d(t,"BonesBlock",function(){return bs}),i.d(t,"InstancesBlock",function(){return Ts}),i.d(t,"MorphTargetsBlock",function(){return Es}),i.d(t,"FragmentOutputBlock",function(){return ms}),i.d(t,"AlphaTestBlock",function(){return As}),i.d(t,"FresnelBlock",function(){return Ps}),i.d(t,"ImageProcessingBlock",function(){return Ss}),i.d(t,"FogBlock",function(){return Rs}),i.d(t,"LightBlock",function(){return xs}),i.d(t,"TextureBlock",function(){return Cs}),i.d(t,"ReflectionTextureBlock",function(){return Ms}),i.d(t,"InputBlock",function(){return gs}),i.d(t,"AnimatedInputBlockTypes",function(){return _s}),i.d(t,"Scalar",function(){return w.a}),i.d(t,"Space",function(){return Z.b}),i.d(t,"Axis",function(){return Z.a}),i.d(t,"Color3",function(){return s.a}),i.d(t,"Color4",function(){return s.b}),i.d(t,"TmpColors",function(){return s.c}),i.d(t,"ToGammaSpace",function(){return re.b}),i.d(t,"ToLinearSpace",function(){return re.c}),i.d(t,"Epsilon",function(){return re.a}),i.d(t,"Frustum",function(){return Di.a}),i.d(t,"Orientation",function(){return ee}),i.d(t,"BezierCurve",function(){return oe}),i.d(t,"Angle",function(){return ae}),i.d(t,"Arc2",function(){return se}),i.d(t,"Path2",function(){return ce}),i.d(t,"Path3D",function(){return le}),i.d(t,"Curve3",function(){return ue}),i.d(t,"Plane",function(){return xn.a}),i.d(t,"Size",function(){return U.a}),i.d(t,"Vector2",function(){return a.d}),i.d(t,"Vector3",function(){return a.e}),i.d(t,"Vector4",function(){return a.f}),i.d(t,"Quaternion",function(){return a.b}),i.d(t,"Matrix",function(){return a.a}),i.d(t,"TmpVectors",function(){return a.c}),i.d(t,"Viewport",function(){return wi.a}),i.d(t,"SphericalHarmonics",function(){return po.a}),i.d(t,"SphericalPolynomial",function(){return po.b}),i.d(t,"PositionNormalVertex",function(){return Oo}),i.d(t,"PositionNormalTextureVertex",function(){return Io}),i.d(t,"AbstractMesh",function(){return Ye.a}),i.d(t,"Buffer",function(){return Yi.a}),i.d(t,"VertexBuffer",function(){return Yi.b}),i.d(t,"CSG",function(){return lc}),i.d(t,"Geometry",function(){return la.a}),i.d(t,"GroundMesh",function(){return Ki}),i.d(t,"TrailMesh",function(){return uc}),i.d(t,"InstancedMesh",function(){return hc.a}),i.d(t,"LinesMesh",function(){return dc.b}),i.d(t,"InstancedLinesMesh",function(){return dc.a}),i.d(t,"_CreationDataStorage",function(){return Se.b}),i.d(t,"_InstancesBatch",function(){return Se.c}),i.d(t,"Mesh",function(){return Se.a}),i.d(t,"VertexData",function(){return Xi.a}),i.d(t,"MeshBuilder",function(){return xc}),i.d(t,"SimplificationSettings",function(){return Cc}),i.d(t,"SimplificationQueue",function(){return Mc}),i.d(t,"SimplificationType",function(){return Sc}),i.d(t,"SimplicationQueueSceneComponent",function(){return Fc}),i.d(t,"Polygon",function(){return vc}),i.d(t,"PolygonMeshBuilder",function(){return yc}),i.d(t,"BaseSubMesh",function(){return nc.a}),i.d(t,"SubMesh",function(){return nc.b}),i.d(t,"MeshLODLevel",function(){return Nc.a}),i.d(t,"TransformNode",function(){return ar.a}),i.d(t,"BoxBuilder",function(){return Zn.a}),i.d(t,"SphereBuilder",function(){return tr.a}),i.d(t,"CylinderBuilder",function(){return Ji.a}),i.d(t,"TorusBuilder",function(){return Zi}),i.d(t,"LinesBuilder",function(){return ir.a}),i.d(t,"PlaneBuilder",function(){return sr.a}),i.d(t,"GroundBuilder",function(){return Qi}),i.d(t,"DataBuffer",function(){return Bc.a}),i.d(t,"WebGLDataBuffer",function(){return Uc.a}),i.d(t,"DracoCompression",function(){return ic}),i.d(t,"TiledBoxBuilder",function(){return pc}),i.d(t,"DiscBuilder",function(){return fc}),i.d(t,"RibbonBuilder",function(){return Ea}),i.d(t,"HemisphereBuilder",function(){return mr}),i.d(t,"TorusKnotBuilder",function(){return _c}),i.d(t,"PolygonBuilder",function(){return bc}),i.d(t,"ShapeBuilder",function(){return Aa}),i.d(t,"LatheBuilder",function(){return Tc}),i.d(t,"TiledPlaneBuilder",function(){return Ec}),i.d(t,"TubeBuilder",function(){return Ac}),i.d(t,"PolyhedronBuilder",function(){return ur}),i.d(t,"IcoSphereBuilder",function(){return Pc}),i.d(t,"DecalBuilder",function(){return Rc}),i.d(t,"MorphTarget",function(){return pa}),i.d(t,"MorphTargetManager",function(){return _a}),i.d(t,"RecastJSPlugin",function(){return Vc}),i.d(t,"RecastJSCrowd",function(){return kc}),i.d(t,"Node",function(){return B.a}),i.d(t,"Database",function(){return zc}),i.d(t,"BaseParticleSystem",function(){return Zc}),i.d(t,"GPUParticleSystem",function(){return dl}),i.d(t,"Particle",function(){return il}),i.d(t,"ParticleHelper",function(){return pl}),i.d(t,"ParticleSystem",function(){return al}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return 42}),i.d(t,"ParticleSystemSet",function(){return fl}),i.d(t,"SolidParticle",function(){return _l}),i.d(t,"ModelShape",function(){return ml}),i.d(t,"DepthSortedParticle",function(){return gl}),i.d(t,"SolidParticleSystem",function(){return yl}),i.d(t,"SubEmitterType",function(){return Gc}),i.d(t,"SubEmitter",function(){return nl}),i.d(t,"BoxParticleEmitter",function(){return jc}),i.d(t,"ConeParticleEmitter",function(){return Wc}),i.d(t,"CylinderParticleEmitter",function(){return Hc}),i.d(t,"CylinderDirectedParticleEmitter",function(){return Xc}),i.d(t,"HemisphericParticleEmitter",function(){return Yc}),i.d(t,"PointParticleEmitter",function(){return Kc}),i.d(t,"SphereParticleEmitter",function(){return Qc}),i.d(t,"SphereDirectedParticleEmitter",function(){return qc}),i.d(t,"PhysicsEngine",function(){return va}),i.d(t,"PhysicsEngineSceneComponent",function(){return El}),i.d(t,"PhysicsHelper",function(){return Al}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return Cl}),i.d(t,"PhysicsUpdraftEventOptions",function(){return Ml}),i.d(t,"PhysicsVortexEventOptions",function(){return Ol}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return bl}),i.d(t,"PhysicsUpdraftMode",function(){return Tl}),i.d(t,"PhysicsImpostor",function(){return ma.a}),i.d(t,"PhysicsJoint",function(){return ga.e}),i.d(t,"DistanceJoint",function(){return ga.a}),i.d(t,"MotorEnabledJoint",function(){return ga.d}),i.d(t,"HingeJoint",function(){return ga.c}),i.d(t,"Hinge2Joint",function(){return ga.b}),i.d(t,"CannonJSPlugin",function(){return ba}),i.d(t,"AmmoJSPlugin",function(){return Pa}),i.d(t,"OimoJSPlugin",function(){return Ta}),i.d(t,"AnaglyphPostProcess",function(){return hi}),i.d(t,"BlackAndWhitePostProcess",function(){return Dl}),i.d(t,"BloomEffect",function(){return Ul}),i.d(t,"BloomMergePostProcess",function(){return Bl}),i.d(t,"BlurPostProcess",function(){return Sr}),i.d(t,"ChromaticAberrationPostProcess",function(){return kl}),i.d(t,"CircleOfConfusionPostProcess",function(){return zl}),i.d(t,"ColorCorrectionPostProcess",function(){return Wl}),i.d(t,"ConvolutionPostProcess",function(){return Xl}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return Yl}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return Ql}),i.d(t,"DepthOfFieldEffect",function(){return Jl}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return ql}),i.d(t,"DepthOfFieldMergePostProcess",function(){return Zl}),i.d(t,"DisplayPassPostProcess",function(){return eu}),i.d(t,"ExtractHighlightsPostProcess",function(){return Fl}),i.d(t,"FilterPostProcess",function(){return iu}),i.d(t,"FxaaPostProcess",function(){return ou}),i.d(t,"GrainPostProcess",function(){return su}),i.d(t,"HighlightsPostProcess",function(){return lu}),i.d(t,"ImageProcessingPostProcess",function(){return Hi}),i.d(t,"MotionBlurPostProcess",function(){return _u}),i.d(t,"PassPostProcess",function(){return ci}),i.d(t,"PassCubePostProcess",function(){return li}),i.d(t,"PostProcess",function(){return oi}),i.d(t,"PostProcessManager",function(){return Ci.a}),i.d(t,"RefractionPostProcess",function(){return gu}),i.d(t,"SharpenPostProcess",function(){return yu}),i.d(t,"StereoscopicInterlacePostProcess",function(){return gi}),i.d(t,"TonemappingOperator",function(){return Fu}),i.d(t,"TonemapPostProcess",function(){return Nu}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return Gu}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return Si}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return Li}),i.d(t,"PostProcessRenderEffect",function(){return Ll}),i.d(t,"PostProcessRenderPipeline",function(){return bu}),i.d(t,"PostProcessRenderPipelineManager",function(){return Tu}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return Eu}),i.d(t,"DefaultRenderingPipeline",function(){return Au}),i.d(t,"LensRenderingPipeline",function(){return Ru}),i.d(t,"SSAO2RenderingPipeline",function(){return Mu}),i.d(t,"SSAORenderingPipeline",function(){return Iu}),i.d(t,"StandardRenderingPipeline",function(){return Lu}),i.d(t,"ReflectionProbe",function(){return Sa}),i.d(t,"BoundingBoxRenderer",function(){return zu}),i.d(t,"DepthRenderer",function(){return Wu}),i.d(t,"DepthRendererSceneComponent",function(){return Hu}),i.d(t,"EdgesRenderer",function(){return Qu}),i.d(t,"LineEdgesRenderer",function(){return qu}),i.d(t,"GeometryBufferRenderer",function(){return du}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return fu}),i.d(t,"OutlineRenderer",function(){return $u}),i.d(t,"RenderingGroup",function(){return eh.a}),i.d(t,"RenderingGroupInfo",function(){return Mi.a}),i.d(t,"RenderingManager",function(){return Mi.b}),i.d(t,"UtilityLayerRenderer",function(){return $n.a}),i.d(t,"Scene",function(){return K.a}),i.d(t,"SceneComponentConstants",function(){return Fe.a}),i.d(t,"Stage",function(){return Fe.b}),i.d(t,"Sprite",function(){return th}),i.d(t,"SpriteManager",function(){return ah}),i.d(t,"SpritePackedManager",function(){return sh}),i.d(t,"SpriteSceneComponent",function(){return ih}),i.d(t,"_AlphaState",function(){return ch.a}),i.d(t,"_DepthCullingState",function(){return ch.b}),i.d(t,"_StencilState",function(){return ch.c}),i.d(t,"AndOrNotEvaluator",function(){return lh.a}),i.d(t,"AssetTaskState",function(){return oh}),i.d(t,"AbstractAssetTask",function(){return hh}),i.d(t,"AssetsProgressEvent",function(){return dh}),i.d(t,"MeshAssetTask",function(){return fh}),i.d(t,"TextFileAssetTask",function(){return ph}),i.d(t,"BinaryFileAssetTask",function(){return _h}),i.d(t,"ImageAssetTask",function(){return mh}),i.d(t,"TextureAssetTask",function(){return gh}),i.d(t,"CubeTextureAssetTask",function(){return vh}),i.d(t,"HDRCubeTextureAssetTask",function(){return yh}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return bh}),i.d(t,"AssetsManager",function(){return Th}),i.d(t,"DDSTools",function(){return To}),i.d(t,"expandToProperty",function(){return F.b}),i.d(t,"serialize",function(){return F.c}),i.d(t,"serializeAsTexture",function(){return F.m}),i.d(t,"serializeAsColor3",function(){return F.e}),i.d(t,"serializeAsFresnelParameters",function(){return F.h}),i.d(t,"serializeAsVector2",function(){return F.n}),i.d(t,"serializeAsVector3",function(){return F.o}),i.d(t,"serializeAsMeshReference",function(){return F.k}),i.d(t,"serializeAsColorCurves",function(){return F.g}),i.d(t,"serializeAsColor4",function(){return F.f}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return F.i}),i.d(t,"serializeAsQuaternion",function(){return F.l}),i.d(t,"serializeAsMatrix",function(){return F.j}),i.d(t,"serializeAsCameraReference",function(){return F.d}),i.d(t,"SerializationHelper",function(){return F.a}),i.d(t,"Deferred",function(){return Eh}),i.d(t,"EnvironmentTextureTools",function(){return Po}),i.d(t,"MeshExploder",function(){return Ah}),i.d(t,"FilesInput",function(){return Ph}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return _o.a}),i.d(t,"KhronosTextureContainer",function(){return Ro}),i.d(t,"EventState",function(){return o.a}),i.d(t,"Observer",function(){return o.d}),i.d(t,"MultiObserver",function(){return o.b}),i.d(t,"Observable",function(){return o.c}),i.d(t,"PerformanceMonitor",function(){return Sh.a}),i.d(t,"RollingAverage",function(){return Sh.b}),i.d(t,"PromisePolyfill",function(){return Rh.a}),i.d(t,"SceneOptimization",function(){return xh}),i.d(t,"TextureOptimization",function(){return Ch}),i.d(t,"HardwareScalingOptimization",function(){return Mh}),i.d(t,"ShadowsOptimization",function(){return Oh}),i.d(t,"PostProcessesOptimization",function(){return Ih}),i.d(t,"LensFlaresOptimization",function(){return Dh}),i.d(t,"CustomOptimization",function(){return Lh}),i.d(t,"ParticlesOptimization",function(){return wh}),i.d(t,"RenderTargetsOptimization",function(){return Fh}),i.d(t,"MergeMeshesOptimization",function(){return Nh}),i.d(t,"SceneOptimizerOptions",function(){return Bh}),i.d(t,"SceneOptimizer",function(){return Uh}),i.d(t,"SceneSerializer",function(){return zh}),i.d(t,"SmartArray",function(){return ii.a}),i.d(t,"SmartArrayNoDuplicate",function(){return ii.b}),i.d(t,"StringDictionary",function(){return Ct.a}),i.d(t,"Tags",function(){return jh.a}),i.d(t,"TextureTools",function(){return Wh}),i.d(t,"TGATools",function(){return ka}),i.d(t,"Tools",function(){return Ie.b}),i.d(t,"className",function(){return Ie.c}),i.d(t,"AsyncLoop",function(){return Ie.a}),i.d(t,"VideoRecorder",function(){return Hh}),i.d(t,"JoystickAxis",function(){return xt}),i.d(t,"VirtualJoystick",function(){return Mt}),i.d(t,"WorkerPool",function(){return Zs}),i.d(t,"Logger",function(){return m.a}),i.d(t,"_TypeStore",function(){return c.a}),i.d(t,"FilesInputStore",function(){return _n.a}),i.d(t,"DeepCopier",function(){return M.a}),i.d(t,"PivotTools",function(){return Qe.a}),i.d(t,"PrecisionDate",function(){return Q.a}),i.d(t,"ScreenshotTools",function(){return Xh}),i.d(t,"WebRequest",function(){return qa.a}),i.d(t,"InspectableType",function(){return uh}),i.d(t,"BRDFTextureTools",function(){return jr}),i.d(t,"ColorGradient",function(){return Jc}),i.d(t,"Color3Gradient",function(){return $c}),i.d(t,"FactorGradient",function(){return el}),i.d(t,"GradientHelper",function(){return tl}),i.d(t,"PerfCounter",function(){return Lo.a}),i.d(t,"RetryStrategy",function(){return Yh.a}),i.d(t,"LoadFileError",function(){return Kh.a}),i.d(t,"HDRTools",function(){return da}),i.d(t,"PanoramaToCubeMapTools",function(){return ha})},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(37),r=function(){function e(){}return e.SetImmediate=function(e){n.a.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},e}()},function(e,t,i){"use strict";var n="fogFragmentDeclaration",r="#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";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";i(6).a.IncludesShadersStore.fogFragment=n},function(e,t,i){"use strict";var n="fogVertexDeclaration",r="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.Eval=function(t,i){return"true"===(t=t.match(/\([^\(\)]*\)/g)?t.replace(/\([^\(\)]*\)/g,function(t){return t=t.slice(1,t.length-1),e._HandleParenthesisContent(t,i)}):e._HandleParenthesisContent(t,i))||"false"!==t&&e.Eval(t,i)},e._HandleParenthesisContent=function(t,i){var n;i=i||function(e){return"true"===e};var r=t.split("||");for(var o in r)if(r.hasOwnProperty(o)){var a=e._SimplifyNegation(r[o].trim()),s=a.split("&&");if(s.length>1)for(var c=0;c=e||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},e}()},function(e,t,i){"use strict";var n;i.d(t,"a",function(){return a}),function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(n||(n={}));var r=function(){this.count=0,this.target=0,this.results=[]},o=function(){function e(e){var t=this;if(this._state=n.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e(function(e){t._resolve(e)},function(e){t._reject(e)})}catch(e){this._reject(e)}}return Object.defineProperty(e.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}),e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.then=function(t,i){var r=this,o=new e;return o._onFulfilled=t,o._onRejected=i,this._children.push(o),o._parent=this,this._state!==n.Pending&&setTimeout(function(){if(r._state===n.Fulfilled||r._rejectWasConsumed){var e=o._resolve(r._result);if(null!=e)if(void 0!==e._state){var t=e;o._children.push(t),t._parent=o,o=t}else o._result=e}else o._reject(r._reason)}),o},e.prototype._moveChildren=function(e){var t,i=this;if((t=this._children).push.apply(t,e.splice(0,e.length)),this._children.forEach(function(e){e._parent=i}),this._state===n.Fulfilled)for(var r=0,o=this._children;r=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}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return Object.defineProperty(e.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!0,configurable:!0}),e.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},e.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},e.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._collider=null,this._oldPositionForCollisions=new n.e(0,0,0),this._diffPositionForCollisions=new n.e(0,0,0)}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(32),r=i(0),o=i(3),a=function(){function e(e,t,i,r,o){void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),this.index=e,this._opaqueSubMeshes=new n.a(256),this._transparentSubMeshes=new n.a(256),this._alphaTestSubMeshes=new n.a(256),this._depthOnlySubMeshes=new n.a(256),this._particleSystems=new n.a(256),this._spriteManagers=new n.a(256),this._edgesRenderers=new n.a(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=r,this.transparentSortCompareFn=o}return Object.defineProperty(e.prototype,"opaqueSortCompareFn",{set:function(t){this._opaqueSortCompareFn=t,this._renderOpaque=t?this.renderOpaqueSorted:e.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alphaTestSortCompareFn",{set:function(t){this._alphaTestSortCompareFn=t,this._renderAlphaTest=t?this.renderAlphaTestSorted:e.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"transparentSortCompareFn",{set:function(t){this._transparentSortCompareFn=t||e.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!0,configurable:!0}),e.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var a=r.getStencilBuffer();if(r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(this._renderTransparent(this._transparentSubMeshes),r.setAlphaMode(o.a.ALPHA_DISABLE)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var s=0;si._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.push(t._edgesRenderer))},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i\nvoid main(void) {\n#include\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}";n.a.ShadersStore[r]=o},function(e,t,i){"use strict";var n=i(6),r=(i(72),i(111),i(73),i(74),i(75),i(103),"colorVertexShader"),o="\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\nuniform mat4 viewProjection;\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\n#include\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}";n.a.ShadersStore[r]=o},function(e,t,i){"use strict";(function(e){i.d(t,"b",function(){return u}),i.d(t,"a",function(){return h});var n=i(1),r=i(8),o=i(11),a=i(105),s=i(29),c=i(3),l=i(92),u=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4},h=function(t){function i(i){void 0===i&&(i=new u);var n=t.call(this,null)||this;void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),n._options=i,n._caps=new o.c,n._caps.maxTexturesImageUnits=16,n._caps.maxVertexTextureImageUnits=16,n._caps.maxTextureSize=512,n._caps.maxCubemapTextureSize=512,n._caps.maxRenderTextureSize=512,n._caps.maxVertexAttribs=16,n._caps.maxVaryingVectors=16,n._caps.maxFragmentUniformVectors=16,n._caps.maxVertexUniformVectors=16,n._caps.standardDerivatives=!1,n._caps.astc=null,n._caps.s3tc=null,n._caps.pvrtc=null,n._caps.etc1=null,n._caps.etc2=null,n._caps.textureAnisotropicFilterExtension=null,n._caps.maxAnisotropy=0,n._caps.uintIndices=!1,n._caps.fragmentDepthSupported=!1,n._caps.highPrecisionShaderSupported=!0,n._caps.colorBufferFloat=!1,n._caps.textureFloat=!1,n._caps.textureFloatLinearFiltering=!1,n._caps.textureFloatRender=!1,n._caps.textureHalfFloat=!1,n._caps.textureHalfFloatLinearFiltering=!1,n._caps.textureHalfFloatRender=!1,n._caps.textureLOD=!1,n._caps.drawBuffersExtension=!1,n._caps.depthTextureExtension=!1,n._caps.vertexArrayObject=!1,n._caps.instancedArrays=!1,r.a.Log("Babylon.js v"+o.b.Version+" - Null engine");var a="undefined"!=typeof self?self:void 0!==e?e:window;return"undefined"==typeof URL&&(a.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(a.Blob=function(){}),n}return n.d(i,t),i.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},i.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},i.prototype.getHardwareScalingLevel=function(){return 1},i.prototype.createVertexBuffer=function(e){var t=new l.a;return t.references=1,t},i.prototype.createIndexBuffer=function(e){var t=new l.a;return t.references=1,t},i.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1)},i.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},i.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},i.prototype.setViewport=function(e,t,i){this._cachedViewport=e},i.prototype.createShaderProgram=function(e,t,i,n,r){return{__SPECTOR_rebuildProgram:null}},i.prototype.getUniforms=function(e,t){return[]},i.prototype.getAttributes=function(e,t){return[]},i.prototype.bindSamplers=function(e){this._currentEffect=null},i.prototype.enableEffect=function(e){this._currentEffect=e,e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e)},i.prototype.setState=function(e,t,i,n){void 0===t&&(t=0),void 0===n&&(n=!1)},i.prototype.setIntArray=function(e,t){},i.prototype.setIntArray2=function(e,t){},i.prototype.setIntArray3=function(e,t){},i.prototype.setIntArray4=function(e,t){},i.prototype.setFloatArray=function(e,t){},i.prototype.setFloatArray2=function(e,t){},i.prototype.setFloatArray3=function(e,t){},i.prototype.setFloatArray4=function(e,t){},i.prototype.setArray=function(e,t){},i.prototype.setArray2=function(e,t){},i.prototype.setArray3=function(e,t){},i.prototype.setArray4=function(e,t){},i.prototype.setMatrices=function(e,t){},i.prototype.setMatrix3x3=function(e,t){},i.prototype.setMatrix2x2=function(e,t){},i.prototype.setFloat=function(e,t){},i.prototype.setFloat2=function(e,t,i){},i.prototype.setFloat3=function(e,t,i,n){},i.prototype.setBool=function(e,t){},i.prototype.setFloat4=function(e,t,i,n,r){},i.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this._alphaState.alphaBlend=e!==c.a.ALPHA_DISABLE,t||this.setDepthWrite(e===c.a.ALPHA_DISABLE),this._alphaMode=e)},i.prototype.bindBuffers=function(e,t,i){},i.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilState.reset(),this._depthCullingState.reset(),this._alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},i.prototype.draw=function(e,t,i,n){},i.prototype.drawElementsType=function(e,t,i,n){},i.prototype.drawArraysType=function(e,t,i,n){},i.prototype._createTexture=function(){return{}},i.prototype._releaseTexture=function(e){},i.prototype.createTexture=function(e,t,i,n,r,o,a,l,u,h){void 0===r&&(r=c.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null);var d=new s.a(this,s.a.DATASOURCE_URL),f=String(e);return d.url=f,d.generateMipMaps=!t,d.samplingMode=r,d.invertY=i,d.baseWidth=this._options.textureSize,d.baseHeight=this._options.textureSize,d.width=this._options.textureSize,d.height=this._options.textureSize,h&&(d.format=h),d.isReady=!0,o&&o(),this._internalTexturesCache.push(d),d},i.prototype.createRenderTargetTexture=function(e,t){var i=new a.a;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,i.generateStencilBuffer=i.generateDepthBuffer&&t.generateStencilBuffer,i.type=void 0===t.type?c.a.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?c.a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=c.a.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=c.a.TEXTURE_TRILINEAR_SAMPLINGMODE);var n=new s.a(this,s.a.DATASOURCE_RENDERTARGET),r=e.width||e,o=e.height||e;return n._depthStencilBuffer={},n._framebuffer={},n.baseWidth=r,n.baseHeight=o,n.width=r,n.height=o,n.isReady=!0,n.samples=1,n.generateMipMaps=!!i.generateMipMaps,n.samplingMode=i.samplingMode,n.type=i.type,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(n),n},i.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},i.prototype.bindFramebuffer=function(e,t,i,n,r){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer,this._cachedViewport&&!r&&this.setViewport(this._cachedViewport,i,n)},i.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&(e._MSAAFramebuffer&&(this._currentFramebuffer=e._framebuffer),i()),this._currentFramebuffer=null},i.prototype.createDynamicVertexBuffer=function(e){var t=new l.a;return t.references=1,t.capacity=1,t},i.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===n&&(n=!1)},i.prototype.areAllEffectsReady=function(){return!0},i.prototype.getError=function(){return 0},i.prototype._getUnpackAlignement=function(){return 1},i.prototype._unpackFlipY=function(e){},i.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},i.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},i.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},i.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},i.prototype._releaseBuffer=function(e){return e.references--,0===e.references},i.prototype.releaseEffects=function(){},i.prototype.displayLoadingUI=function(){},i.prototype.hideLoadingUI=function(){},i.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0)},i.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i}(o.b)}).call(this,i(137))},function(e,t,i){"use strict";i.r(t),function(e){i.d(t,"Debug",function(){return l});var n=i(112),r=i(87);i.d(t,"AbstractScene",function(){return n.AbstractScene}),i.d(t,"KeepAssets",function(){return n.KeepAssets}),i.d(t,"AssetContainer",function(){return n.AssetContainer}),i.d(t,"Node",function(){return n.Node}),i.d(t,"Scene",function(){return n.Scene}),i.d(t,"SceneComponentConstants",function(){return n.SceneComponentConstants}),i.d(t,"Stage",function(){return n.Stage}),i.d(t,"AbstractActionManager",function(){return n.AbstractActionManager}),i.d(t,"Action",function(){return n.Action}),i.d(t,"ActionEvent",function(){return n.ActionEvent}),i.d(t,"ActionManager",function(){return n.ActionManager}),i.d(t,"Condition",function(){return n.Condition}),i.d(t,"ValueCondition",function(){return n.ValueCondition}),i.d(t,"PredicateCondition",function(){return n.PredicateCondition}),i.d(t,"StateCondition",function(){return n.StateCondition}),i.d(t,"SwitchBooleanAction",function(){return n.SwitchBooleanAction}),i.d(t,"SetStateAction",function(){return n.SetStateAction}),i.d(t,"SetValueAction",function(){return n.SetValueAction}),i.d(t,"IncrementValueAction",function(){return n.IncrementValueAction}),i.d(t,"PlayAnimationAction",function(){return n.PlayAnimationAction}),i.d(t,"StopAnimationAction",function(){return n.StopAnimationAction}),i.d(t,"DoNothingAction",function(){return n.DoNothingAction}),i.d(t,"CombineAction",function(){return n.CombineAction}),i.d(t,"ExecuteCodeAction",function(){return n.ExecuteCodeAction}),i.d(t,"SetParentAction",function(){return n.SetParentAction}),i.d(t,"PlaySoundAction",function(){return n.PlaySoundAction}),i.d(t,"StopSoundAction",function(){return n.StopSoundAction}),i.d(t,"InterpolateValueAction",function(){return n.InterpolateValueAction}),i.d(t,"Animatable",function(){return n.Animatable}),i.d(t,"_IAnimationState",function(){return n._IAnimationState}),i.d(t,"Animation",function(){return n.Animation}),i.d(t,"TargetedAnimation",function(){return n.TargetedAnimation}),i.d(t,"AnimationGroup",function(){return n.AnimationGroup}),i.d(t,"AnimationPropertiesOverride",function(){return n.AnimationPropertiesOverride}),i.d(t,"EasingFunction",function(){return n.EasingFunction}),i.d(t,"CircleEase",function(){return n.CircleEase}),i.d(t,"BackEase",function(){return n.BackEase}),i.d(t,"BounceEase",function(){return n.BounceEase}),i.d(t,"CubicEase",function(){return n.CubicEase}),i.d(t,"ElasticEase",function(){return n.ElasticEase}),i.d(t,"ExponentialEase",function(){return n.ExponentialEase}),i.d(t,"PowerEase",function(){return n.PowerEase}),i.d(t,"QuadraticEase",function(){return n.QuadraticEase}),i.d(t,"QuarticEase",function(){return n.QuarticEase}),i.d(t,"QuinticEase",function(){return n.QuinticEase}),i.d(t,"SineEase",function(){return n.SineEase}),i.d(t,"BezierCurveEase",function(){return n.BezierCurveEase}),i.d(t,"RuntimeAnimation",function(){return n.RuntimeAnimation}),i.d(t,"AnimationEvent",function(){return n.AnimationEvent}),i.d(t,"AnimationKeyInterpolation",function(){return n.AnimationKeyInterpolation}),i.d(t,"AnimationRange",function(){return n.AnimationRange}),i.d(t,"Analyser",function(){return n.Analyser}),i.d(t,"AudioEngine",function(){return n.AudioEngine}),i.d(t,"AudioSceneComponent",function(){return n.AudioSceneComponent}),i.d(t,"Sound",function(){return n.Sound}),i.d(t,"SoundTrack",function(){return n.SoundTrack}),i.d(t,"WeightedSound",function(){return n.WeightedSound}),i.d(t,"Bone",function(){return n.Bone}),i.d(t,"BoneIKController",function(){return n.BoneIKController}),i.d(t,"BoneLookController",function(){return n.BoneLookController}),i.d(t,"Skeleton",function(){return n.Skeleton}),i.d(t,"CameraInputTypes",function(){return n.CameraInputTypes}),i.d(t,"CameraInputsManager",function(){return n.CameraInputsManager}),i.d(t,"Camera",function(){return n.Camera}),i.d(t,"TargetCamera",function(){return n.TargetCamera}),i.d(t,"FreeCamera",function(){return n.FreeCamera}),i.d(t,"FreeCameraInputsManager",function(){return n.FreeCameraInputsManager}),i.d(t,"TouchCamera",function(){return n.TouchCamera}),i.d(t,"ArcRotateCamera",function(){return n.ArcRotateCamera}),i.d(t,"ArcRotateCameraInputsManager",function(){return n.ArcRotateCameraInputsManager}),i.d(t,"DeviceOrientationCamera",function(){return n.DeviceOrientationCamera}),i.d(t,"FlyCamera",function(){return n.FlyCamera}),i.d(t,"FlyCameraInputsManager",function(){return n.FlyCameraInputsManager}),i.d(t,"FollowCamera",function(){return n.FollowCamera}),i.d(t,"ArcFollowCamera",function(){return n.ArcFollowCamera}),i.d(t,"FollowCameraInputsManager",function(){return n.FollowCameraInputsManager}),i.d(t,"GamepadCamera",function(){return n.GamepadCamera}),i.d(t,"UniversalCamera",function(){return n.UniversalCamera}),i.d(t,"VirtualJoysticksCamera",function(){return n.VirtualJoysticksCamera}),i.d(t,"Collider",function(){return n.Collider}),i.d(t,"DefaultCollisionCoordinator",function(){return n.DefaultCollisionCoordinator}),i.d(t,"PickingInfo",function(){return n.PickingInfo}),i.d(t,"IntersectionInfo",function(){return n.IntersectionInfo}),i.d(t,"_MeshCollisionData",function(){return n._MeshCollisionData}),i.d(t,"BoundingBox",function(){return n.BoundingBox}),i.d(t,"BoundingInfo",function(){return n.BoundingInfo}),i.d(t,"BoundingSphere",function(){return n.BoundingSphere}),i.d(t,"Ray",function(){return n.Ray}),i.d(t,"AxesViewer",function(){return n.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return n.BoneAxesViewer}),i.d(t,"DebugLayer",function(){return n.DebugLayer}),i.d(t,"PhysicsViewer",function(){return n.PhysicsViewer}),i.d(t,"RayHelper",function(){return n.RayHelper}),i.d(t,"SkeletonViewer",function(){return n.SkeletonViewer}),i.d(t,"Constants",function(){return n.Constants}),i.d(t,"InstancingAttributeInfo",function(){return n.InstancingAttributeInfo}),i.d(t,"DepthTextureCreationOptions",function(){return n.DepthTextureCreationOptions}),i.d(t,"EngineCapabilities",function(){return n.EngineCapabilities}),i.d(t,"Engine",function(){return n.Engine}),i.d(t,"EngineStore",function(){return n.EngineStore}),i.d(t,"NullEngineOptions",function(){return n.NullEngineOptions}),i.d(t,"NullEngine",function(){return n.NullEngine}),i.d(t,"WebGLPipelineContext",function(){return n.WebGLPipelineContext}),i.d(t,"WebGL2ShaderProcessor",function(){return n.WebGL2ShaderProcessor}),i.d(t,"KeyboardEventTypes",function(){return n.KeyboardEventTypes}),i.d(t,"KeyboardInfo",function(){return n.KeyboardInfo}),i.d(t,"KeyboardInfoPre",function(){return n.KeyboardInfoPre}),i.d(t,"PointerEventTypes",function(){return n.PointerEventTypes}),i.d(t,"PointerInfoBase",function(){return n.PointerInfoBase}),i.d(t,"PointerInfoPre",function(){return n.PointerInfoPre}),i.d(t,"PointerInfo",function(){return n.PointerInfo}),i.d(t,"ClipboardEventTypes",function(){return n.ClipboardEventTypes}),i.d(t,"ClipboardInfo",function(){return n.ClipboardInfo}),i.d(t,"StickValues",function(){return n.StickValues}),i.d(t,"Gamepad",function(){return n.Gamepad}),i.d(t,"GenericPad",function(){return n.GenericPad}),i.d(t,"GamepadManager",function(){return n.GamepadManager}),i.d(t,"GamepadSystemSceneComponent",function(){return n.GamepadSystemSceneComponent}),i.d(t,"Xbox360Button",function(){return n.Xbox360Button}),i.d(t,"Xbox360Dpad",function(){return n.Xbox360Dpad}),i.d(t,"Xbox360Pad",function(){return n.Xbox360Pad}),i.d(t,"DualShockButton",function(){return n.DualShockButton}),i.d(t,"DualShockDpad",function(){return n.DualShockDpad}),i.d(t,"DualShockPad",function(){return n.DualShockPad}),i.d(t,"AxisDragGizmo",function(){return n.AxisDragGizmo}),i.d(t,"AxisScaleGizmo",function(){return n.AxisScaleGizmo}),i.d(t,"BoundingBoxGizmo",function(){return n.BoundingBoxGizmo}),i.d(t,"Gizmo",function(){return n.Gizmo}),i.d(t,"GizmoManager",function(){return n.GizmoManager}),i.d(t,"PlaneRotationGizmo",function(){return n.PlaneRotationGizmo}),i.d(t,"PositionGizmo",function(){return n.PositionGizmo}),i.d(t,"RotationGizmo",function(){return n.RotationGizmo}),i.d(t,"ScaleGizmo",function(){return n.ScaleGizmo}),i.d(t,"LightGizmo",function(){return n.LightGizmo}),i.d(t,"PlaneDragGizmo",function(){return n.PlaneDragGizmo}),i.d(t,"EnvironmentHelper",function(){return n.EnvironmentHelper}),i.d(t,"PhotoDome",function(){return n.PhotoDome}),i.d(t,"_forceSceneHelpersToBundle",function(){return n._forceSceneHelpersToBundle}),i.d(t,"VideoDome",function(){return n.VideoDome}),i.d(t,"EngineInstrumentation",function(){return n.EngineInstrumentation}),i.d(t,"SceneInstrumentation",function(){return n.SceneInstrumentation}),i.d(t,"_TimeToken",function(){return n._TimeToken}),i.d(t,"EffectLayer",function(){return n.EffectLayer}),i.d(t,"EffectLayerSceneComponent",function(){return n.EffectLayerSceneComponent}),i.d(t,"GlowLayer",function(){return n.GlowLayer}),i.d(t,"HighlightLayer",function(){return n.HighlightLayer}),i.d(t,"Layer",function(){return n.Layer}),i.d(t,"LayerSceneComponent",function(){return n.LayerSceneComponent}),i.d(t,"LensFlare",function(){return n.LensFlare}),i.d(t,"LensFlareSystem",function(){return n.LensFlareSystem}),i.d(t,"LensFlareSystemSceneComponent",function(){return n.LensFlareSystemSceneComponent}),i.d(t,"Light",function(){return n.Light}),i.d(t,"ShadowLight",function(){return n.ShadowLight}),i.d(t,"DirectionalLight",function(){return n.DirectionalLight}),i.d(t,"HemisphericLight",function(){return n.HemisphericLight}),i.d(t,"PointLight",function(){return n.PointLight}),i.d(t,"SpotLight",function(){return n.SpotLight}),i.d(t,"DefaultLoadingScreen",function(){return n.DefaultLoadingScreen}),i.d(t,"SceneLoaderProgressEvent",function(){return n.SceneLoaderProgressEvent}),i.d(t,"SceneLoader",function(){return n.SceneLoader}),i.d(t,"SceneLoaderFlags",function(){return n.SceneLoaderFlags}),i.d(t,"ColorCurves",function(){return n.ColorCurves}),i.d(t,"EffectFallbacks",function(){return n.EffectFallbacks}),i.d(t,"EffectCreationOptions",function(){return n.EffectCreationOptions}),i.d(t,"Effect",function(){return n.Effect}),i.d(t,"FresnelParameters",function(){return n.FresnelParameters}),i.d(t,"ImageProcessingConfigurationDefines",function(){return n.ImageProcessingConfigurationDefines}),i.d(t,"ImageProcessingConfiguration",function(){return n.ImageProcessingConfiguration}),i.d(t,"Material",function(){return n.Material}),i.d(t,"MaterialDefines",function(){return n.MaterialDefines}),i.d(t,"MaterialHelper",function(){return n.MaterialHelper}),i.d(t,"MultiMaterial",function(){return n.MultiMaterial}),i.d(t,"PushMaterial",function(){return n.PushMaterial}),i.d(t,"ShaderMaterial",function(){return n.ShaderMaterial}),i.d(t,"StandardMaterialDefines",function(){return n.StandardMaterialDefines}),i.d(t,"StandardMaterial",function(){return n.StandardMaterial}),i.d(t,"BaseTexture",function(){return n.BaseTexture}),i.d(t,"CubeTexture",function(){return n.CubeTexture}),i.d(t,"DynamicTexture",function(){return n.DynamicTexture}),i.d(t,"EquiRectangularCubeTexture",function(){return n.EquiRectangularCubeTexture}),i.d(t,"HDRCubeTexture",function(){return n.HDRCubeTexture}),i.d(t,"InternalTexture",function(){return n.InternalTexture}),i.d(t,"MirrorTexture",function(){return n.MirrorTexture}),i.d(t,"MultiRenderTarget",function(){return n.MultiRenderTarget}),i.d(t,"RawTexture",function(){return n.RawTexture}),i.d(t,"RenderTargetTexture",function(){return n.RenderTargetTexture}),i.d(t,"Texture",function(){return n.Texture}),i.d(t,"UniformBuffer",function(){return n.UniformBuffer}),i.d(t,"MaterialFlags",function(){return n.MaterialFlags}),i.d(t,"EffectRenderer",function(){return n.EffectRenderer}),i.d(t,"EffectWrapper",function(){return n.EffectWrapper}),i.d(t,"Scalar",function(){return n.Scalar}),i.d(t,"Space",function(){return n.Space}),i.d(t,"Axis",function(){return n.Axis}),i.d(t,"Color3",function(){return n.Color3}),i.d(t,"Color4",function(){return n.Color4}),i.d(t,"TmpColors",function(){return n.TmpColors}),i.d(t,"ToGammaSpace",function(){return n.ToGammaSpace}),i.d(t,"ToLinearSpace",function(){return n.ToLinearSpace}),i.d(t,"Epsilon",function(){return n.Epsilon}),i.d(t,"Frustum",function(){return n.Frustum}),i.d(t,"Orientation",function(){return n.Orientation}),i.d(t,"BezierCurve",function(){return n.BezierCurve}),i.d(t,"Angle",function(){return n.Angle}),i.d(t,"Arc2",function(){return n.Arc2}),i.d(t,"Path2",function(){return n.Path2}),i.d(t,"Path3D",function(){return n.Path3D}),i.d(t,"Curve3",function(){return n.Curve3}),i.d(t,"Plane",function(){return n.Plane}),i.d(t,"Size",function(){return n.Size}),i.d(t,"Vector2",function(){return n.Vector2}),i.d(t,"Vector3",function(){return n.Vector3}),i.d(t,"Vector4",function(){return n.Vector4}),i.d(t,"Quaternion",function(){return n.Quaternion}),i.d(t,"Matrix",function(){return n.Matrix}),i.d(t,"TmpVectors",function(){return n.TmpVectors}),i.d(t,"Viewport",function(){return n.Viewport}),i.d(t,"SphericalHarmonics",function(){return n.SphericalHarmonics}),i.d(t,"SphericalPolynomial",function(){return n.SphericalPolynomial}),i.d(t,"AbstractMesh",function(){return n.AbstractMesh}),i.d(t,"Buffer",function(){return n.Buffer}),i.d(t,"VertexBuffer",function(){return n.VertexBuffer}),i.d(t,"CSG",function(){return n.CSG}),i.d(t,"Geometry",function(){return n.Geometry}),i.d(t,"GroundMesh",function(){return n.GroundMesh}),i.d(t,"TrailMesh",function(){return n.TrailMesh}),i.d(t,"InstancedMesh",function(){return n.InstancedMesh}),i.d(t,"LinesMesh",function(){return n.LinesMesh}),i.d(t,"InstancedLinesMesh",function(){return n.InstancedLinesMesh}),i.d(t,"_CreationDataStorage",function(){return n._CreationDataStorage}),i.d(t,"_InstancesBatch",function(){return n._InstancesBatch}),i.d(t,"Mesh",function(){return n.Mesh}),i.d(t,"VertexData",function(){return n.VertexData}),i.d(t,"MeshBuilder",function(){return n.MeshBuilder}),i.d(t,"SimplificationSettings",function(){return n.SimplificationSettings}),i.d(t,"SimplificationQueue",function(){return n.SimplificationQueue}),i.d(t,"SimplificationType",function(){return n.SimplificationType}),i.d(t,"SimplicationQueueSceneComponent",function(){return n.SimplicationQueueSceneComponent}),i.d(t,"Polygon",function(){return n.Polygon}),i.d(t,"PolygonMeshBuilder",function(){return n.PolygonMeshBuilder}),i.d(t,"BaseSubMesh",function(){return n.BaseSubMesh}),i.d(t,"SubMesh",function(){return n.SubMesh}),i.d(t,"MeshLODLevel",function(){return n.MeshLODLevel}),i.d(t,"TransformNode",function(){return n.TransformNode}),i.d(t,"BoxBuilder",function(){return n.BoxBuilder}),i.d(t,"SphereBuilder",function(){return n.SphereBuilder}),i.d(t,"CylinderBuilder",function(){return n.CylinderBuilder}),i.d(t,"TorusBuilder",function(){return n.TorusBuilder}),i.d(t,"LinesBuilder",function(){return n.LinesBuilder}),i.d(t,"PlaneBuilder",function(){return n.PlaneBuilder}),i.d(t,"GroundBuilder",function(){return n.GroundBuilder}),i.d(t,"DataBuffer",function(){return n.DataBuffer}),i.d(t,"WebGLDataBuffer",function(){return n.WebGLDataBuffer}),i.d(t,"MorphTarget",function(){return n.MorphTarget}),i.d(t,"MorphTargetManager",function(){return n.MorphTargetManager}),i.d(t,"Database",function(){return n.Database}),i.d(t,"BaseParticleSystem",function(){return n.BaseParticleSystem}),i.d(t,"GPUParticleSystem",function(){return n.GPUParticleSystem}),i.d(t,"Particle",function(){return n.Particle}),i.d(t,"ParticleHelper",function(){return n.ParticleHelper}),i.d(t,"ParticleSystem",function(){return n.ParticleSystem}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return n._IDoNeedToBeInTheBuild}),i.d(t,"ParticleSystemSet",function(){return n.ParticleSystemSet}),i.d(t,"SolidParticle",function(){return n.SolidParticle}),i.d(t,"ModelShape",function(){return n.ModelShape}),i.d(t,"DepthSortedParticle",function(){return n.DepthSortedParticle}),i.d(t,"SolidParticleSystem",function(){return n.SolidParticleSystem}),i.d(t,"SubEmitterType",function(){return n.SubEmitterType}),i.d(t,"SubEmitter",function(){return n.SubEmitter}),i.d(t,"PhysicsEngine",function(){return n.PhysicsEngine}),i.d(t,"PhysicsEngineSceneComponent",function(){return n.PhysicsEngineSceneComponent}),i.d(t,"PhysicsHelper",function(){return n.PhysicsHelper}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return n.PhysicsRadialExplosionEventOptions}),i.d(t,"PhysicsUpdraftEventOptions",function(){return n.PhysicsUpdraftEventOptions}),i.d(t,"PhysicsVortexEventOptions",function(){return n.PhysicsVortexEventOptions}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return n.PhysicsRadialImpulseFalloff}),i.d(t,"PhysicsUpdraftMode",function(){return n.PhysicsUpdraftMode}),i.d(t,"PhysicsImpostor",function(){return n.PhysicsImpostor}),i.d(t,"PhysicsJoint",function(){return n.PhysicsJoint}),i.d(t,"DistanceJoint",function(){return n.DistanceJoint}),i.d(t,"MotorEnabledJoint",function(){return n.MotorEnabledJoint}),i.d(t,"HingeJoint",function(){return n.HingeJoint}),i.d(t,"Hinge2Joint",function(){return n.Hinge2Joint}),i.d(t,"AnaglyphPostProcess",function(){return n.AnaglyphPostProcess}),i.d(t,"BlackAndWhitePostProcess",function(){return n.BlackAndWhitePostProcess}),i.d(t,"BloomEffect",function(){return n.BloomEffect}),i.d(t,"BloomMergePostProcess",function(){return n.BloomMergePostProcess}),i.d(t,"BlurPostProcess",function(){return n.BlurPostProcess}),i.d(t,"ChromaticAberrationPostProcess",function(){return n.ChromaticAberrationPostProcess}),i.d(t,"CircleOfConfusionPostProcess",function(){return n.CircleOfConfusionPostProcess}),i.d(t,"ColorCorrectionPostProcess",function(){return n.ColorCorrectionPostProcess}),i.d(t,"ConvolutionPostProcess",function(){return n.ConvolutionPostProcess}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return n.DepthOfFieldBlurPostProcess}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return n.DepthOfFieldEffectBlurLevel}),i.d(t,"DepthOfFieldEffect",function(){return n.DepthOfFieldEffect}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return n.DepthOfFieldMergePostProcessOptions}),i.d(t,"DepthOfFieldMergePostProcess",function(){return n.DepthOfFieldMergePostProcess}),i.d(t,"DisplayPassPostProcess",function(){return n.DisplayPassPostProcess}),i.d(t,"ExtractHighlightsPostProcess",function(){return n.ExtractHighlightsPostProcess}),i.d(t,"FilterPostProcess",function(){return n.FilterPostProcess}),i.d(t,"FxaaPostProcess",function(){return n.FxaaPostProcess}),i.d(t,"GrainPostProcess",function(){return n.GrainPostProcess}),i.d(t,"HighlightsPostProcess",function(){return n.HighlightsPostProcess}),i.d(t,"ImageProcessingPostProcess",function(){return n.ImageProcessingPostProcess}),i.d(t,"MotionBlurPostProcess",function(){return n.MotionBlurPostProcess}),i.d(t,"PassPostProcess",function(){return n.PassPostProcess}),i.d(t,"PassCubePostProcess",function(){return n.PassCubePostProcess}),i.d(t,"PostProcess",function(){return n.PostProcess}),i.d(t,"PostProcessManager",function(){return n.PostProcessManager}),i.d(t,"RefractionPostProcess",function(){return n.RefractionPostProcess}),i.d(t,"SharpenPostProcess",function(){return n.SharpenPostProcess}),i.d(t,"StereoscopicInterlacePostProcess",function(){return n.StereoscopicInterlacePostProcess}),i.d(t,"TonemappingOperator",function(){return n.TonemappingOperator}),i.d(t,"TonemapPostProcess",function(){return n.TonemapPostProcess}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return n.VolumetricLightScatteringPostProcess}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return n.VRDistortionCorrectionPostProcess}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return n.VRMultiviewToSingleviewPostProcess}),i.d(t,"ReflectionProbe",function(){return n.ReflectionProbe}),i.d(t,"BoundingBoxRenderer",function(){return n.BoundingBoxRenderer}),i.d(t,"DepthRenderer",function(){return n.DepthRenderer}),i.d(t,"DepthRendererSceneComponent",function(){return n.DepthRendererSceneComponent}),i.d(t,"EdgesRenderer",function(){return n.EdgesRenderer}),i.d(t,"LineEdgesRenderer",function(){return n.LineEdgesRenderer}),i.d(t,"GeometryBufferRenderer",function(){return n.GeometryBufferRenderer}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return n.GeometryBufferRendererSceneComponent}),i.d(t,"OutlineRenderer",function(){return n.OutlineRenderer}),i.d(t,"RenderingGroup",function(){return n.RenderingGroup}),i.d(t,"RenderingGroupInfo",function(){return n.RenderingGroupInfo}),i.d(t,"RenderingManager",function(){return n.RenderingManager}),i.d(t,"UtilityLayerRenderer",function(){return n.UtilityLayerRenderer}),i.d(t,"Sprite",function(){return n.Sprite}),i.d(t,"SpriteManager",function(){return n.SpriteManager}),i.d(t,"SpritePackedManager",function(){return n.SpritePackedManager}),i.d(t,"SpriteSceneComponent",function(){return n.SpriteSceneComponent}),i.d(t,"_AlphaState",function(){return n._AlphaState}),i.d(t,"_DepthCullingState",function(){return n._DepthCullingState}),i.d(t,"_StencilState",function(){return n._StencilState}),i.d(t,"AndOrNotEvaluator",function(){return n.AndOrNotEvaluator}),i.d(t,"AssetTaskState",function(){return n.AssetTaskState}),i.d(t,"AbstractAssetTask",function(){return n.AbstractAssetTask}),i.d(t,"AssetsProgressEvent",function(){return n.AssetsProgressEvent}),i.d(t,"MeshAssetTask",function(){return n.MeshAssetTask}),i.d(t,"TextFileAssetTask",function(){return n.TextFileAssetTask}),i.d(t,"BinaryFileAssetTask",function(){return n.BinaryFileAssetTask}),i.d(t,"ImageAssetTask",function(){return n.ImageAssetTask}),i.d(t,"TextureAssetTask",function(){return n.TextureAssetTask}),i.d(t,"CubeTextureAssetTask",function(){return n.CubeTextureAssetTask}),i.d(t,"HDRCubeTextureAssetTask",function(){return n.HDRCubeTextureAssetTask}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return n.EquiRectangularCubeTextureAssetTask}),i.d(t,"AssetsManager",function(){return n.AssetsManager}),i.d(t,"DDSTools",function(){return n.DDSTools}),i.d(t,"expandToProperty",function(){return n.expandToProperty}),i.d(t,"serialize",function(){return n.serialize}),i.d(t,"serializeAsTexture",function(){return n.serializeAsTexture}),i.d(t,"serializeAsColor3",function(){return n.serializeAsColor3}),i.d(t,"serializeAsFresnelParameters",function(){return n.serializeAsFresnelParameters}),i.d(t,"serializeAsVector2",function(){return n.serializeAsVector2}),i.d(t,"serializeAsVector3",function(){return n.serializeAsVector3}),i.d(t,"serializeAsMeshReference",function(){return n.serializeAsMeshReference}),i.d(t,"serializeAsColorCurves",function(){return n.serializeAsColorCurves}),i.d(t,"serializeAsColor4",function(){return n.serializeAsColor4}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return n.serializeAsImageProcessingConfiguration}),i.d(t,"serializeAsQuaternion",function(){return n.serializeAsQuaternion}),i.d(t,"serializeAsMatrix",function(){return n.serializeAsMatrix}),i.d(t,"serializeAsCameraReference",function(){return n.serializeAsCameraReference}),i.d(t,"SerializationHelper",function(){return n.SerializationHelper}),i.d(t,"Deferred",function(){return n.Deferred}),i.d(t,"EnvironmentTextureTools",function(){return n.EnvironmentTextureTools}),i.d(t,"MeshExploder",function(){return n.MeshExploder}),i.d(t,"FilesInput",function(){return n.FilesInput}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return n.CubeMapToSphericalPolynomialTools}),i.d(t,"KhronosTextureContainer",function(){return n.KhronosTextureContainer}),i.d(t,"EventState",function(){return n.EventState}),i.d(t,"Observer",function(){return n.Observer}),i.d(t,"MultiObserver",function(){return n.MultiObserver}),i.d(t,"Observable",function(){return n.Observable}),i.d(t,"PerformanceMonitor",function(){return n.PerformanceMonitor}),i.d(t,"RollingAverage",function(){return n.RollingAverage}),i.d(t,"PromisePolyfill",function(){return n.PromisePolyfill}),i.d(t,"SceneOptimization",function(){return n.SceneOptimization}),i.d(t,"TextureOptimization",function(){return n.TextureOptimization}),i.d(t,"HardwareScalingOptimization",function(){return n.HardwareScalingOptimization}),i.d(t,"ShadowsOptimization",function(){return n.ShadowsOptimization}),i.d(t,"PostProcessesOptimization",function(){return n.PostProcessesOptimization}),i.d(t,"LensFlaresOptimization",function(){return n.LensFlaresOptimization}),i.d(t,"CustomOptimization",function(){return n.CustomOptimization}),i.d(t,"ParticlesOptimization",function(){return n.ParticlesOptimization}),i.d(t,"RenderTargetsOptimization",function(){return n.RenderTargetsOptimization}),i.d(t,"MergeMeshesOptimization",function(){return n.MergeMeshesOptimization}),i.d(t,"SceneOptimizerOptions",function(){return n.SceneOptimizerOptions}),i.d(t,"SceneOptimizer",function(){return n.SceneOptimizer}),i.d(t,"SceneSerializer",function(){return n.SceneSerializer}),i.d(t,"SmartArray",function(){return n.SmartArray}),i.d(t,"SmartArrayNoDuplicate",function(){return n.SmartArrayNoDuplicate}),i.d(t,"StringDictionary",function(){return n.StringDictionary}),i.d(t,"Tags",function(){return n.Tags}),i.d(t,"TextureTools",function(){return n.TextureTools}),i.d(t,"TGATools",function(){return n.TGATools}),i.d(t,"Tools",function(){return n.Tools}),i.d(t,"className",function(){return n.className}),i.d(t,"AsyncLoop",function(){return n.AsyncLoop}),i.d(t,"VideoRecorder",function(){return n.VideoRecorder}),i.d(t,"JoystickAxis",function(){return n.JoystickAxis}),i.d(t,"VirtualJoystick",function(){return n.VirtualJoystick}),i.d(t,"WorkerPool",function(){return n.WorkerPool}),i.d(t,"Logger",function(){return n.Logger}),i.d(t,"_TypeStore",function(){return n._TypeStore}),i.d(t,"FilesInputStore",function(){return n.FilesInputStore}),i.d(t,"DeepCopier",function(){return n.DeepCopier}),i.d(t,"PivotTools",function(){return n.PivotTools}),i.d(t,"PrecisionDate",function(){return n.PrecisionDate}),i.d(t,"ScreenshotTools",function(){return n.ScreenshotTools}),i.d(t,"WebRequest",function(){return n.WebRequest}),i.d(t,"InspectableType",function(){return n.InspectableType}),i.d(t,"BRDFTextureTools",function(){return n.BRDFTextureTools}),i.d(t,"ColorGradient",function(){return n.ColorGradient}),i.d(t,"Color3Gradient",function(){return n.Color3Gradient}),i.d(t,"FactorGradient",function(){return n.FactorGradient}),i.d(t,"GradientHelper",function(){return n.GradientHelper}),i.d(t,"PerfCounter",function(){return n.PerfCounter}),i.d(t,"RetryStrategy",function(){return n.RetryStrategy}),i.d(t,"LoadFileError",function(){return n.LoadFileError}),i.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),i.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),i.d(t,"FramingBehavior",function(){return n.FramingBehavior}),i.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior}),i.d(t,"FadeInOutBehavior",function(){return n.FadeInOutBehavior}),i.d(t,"MultiPointerScaleBehavior",function(){return n.MultiPointerScaleBehavior}),i.d(t,"PointerDragBehavior",function(){return n.PointerDragBehavior}),i.d(t,"SixDofDragBehavior",function(){return n.SixDofDragBehavior}),i.d(t,"ArcRotateCameraGamepadInput",function(){return n.ArcRotateCameraGamepadInput}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return n.ArcRotateCameraKeyboardMoveInput}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return n.ArcRotateCameraMouseWheelInput}),i.d(t,"ArcRotateCameraPointersInput",function(){return n.ArcRotateCameraPointersInput}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return n.ArcRotateCameraVRDeviceOrientationInput}),i.d(t,"FlyCameraKeyboardInput",function(){return n.FlyCameraKeyboardInput}),i.d(t,"FlyCameraMouseInput",function(){return n.FlyCameraMouseInput}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return n.FollowCameraKeyboardMoveInput}),i.d(t,"FollowCameraMouseWheelInput",function(){return n.FollowCameraMouseWheelInput}),i.d(t,"FollowCameraPointersInput",function(){return n.FollowCameraPointersInput}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return n.FreeCameraDeviceOrientationInput}),i.d(t,"FreeCameraGamepadInput",function(){return n.FreeCameraGamepadInput}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return n.FreeCameraKeyboardMoveInput}),i.d(t,"FreeCameraMouseInput",function(){return n.FreeCameraMouseInput}),i.d(t,"FreeCameraTouchInput",function(){return n.FreeCameraTouchInput}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return n.FreeCameraVirtualJoystickInput}),i.d(t,"AnaglyphArcRotateCamera",function(){return n.AnaglyphArcRotateCamera}),i.d(t,"AnaglyphFreeCamera",function(){return n.AnaglyphFreeCamera}),i.d(t,"AnaglyphGamepadCamera",function(){return n.AnaglyphGamepadCamera}),i.d(t,"AnaglyphUniversalCamera",function(){return n.AnaglyphUniversalCamera}),i.d(t,"StereoscopicArcRotateCamera",function(){return n.StereoscopicArcRotateCamera}),i.d(t,"StereoscopicFreeCamera",function(){return n.StereoscopicFreeCamera}),i.d(t,"StereoscopicGamepadCamera",function(){return n.StereoscopicGamepadCamera}),i.d(t,"StereoscopicUniversalCamera",function(){return n.StereoscopicUniversalCamera}),i.d(t,"VRCameraMetrics",function(){return n.VRCameraMetrics}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return n.VRDeviceOrientationArcRotateCamera}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return n.VRDeviceOrientationFreeCamera}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return n.VRDeviceOrientationGamepadCamera}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return n.OnAfterEnteringVRObservableEvent}),i.d(t,"VRExperienceHelper",function(){return n.VRExperienceHelper}),i.d(t,"WebVRFreeCamera",function(){return n.WebVRFreeCamera}),i.d(t,"WebXRCamera",function(){return n.WebXRCamera}),i.d(t,"WebXREnterExitUIButton",function(){return n.WebXREnterExitUIButton}),i.d(t,"WebXREnterExitUIOptions",function(){return n.WebXREnterExitUIOptions}),i.d(t,"WebXREnterExitUI",function(){return n.WebXREnterExitUI}),i.d(t,"WebXRState",function(){return n.WebXRState}),i.d(t,"WebXRExperienceHelper",function(){return n.WebXRExperienceHelper}),i.d(t,"WebXRInput",function(){return n.WebXRInput}),i.d(t,"WebXRControllerTeleportation",function(){return n.WebXRControllerTeleportation}),i.d(t,"WebXRControllerPointerSelection",function(){return n.WebXRControllerPointerSelection}),i.d(t,"WebXRControllerModelLoader",function(){return n.WebXRControllerModelLoader}),i.d(t,"WebXRController",function(){return n.WebXRController}),i.d(t,"WebXRManagedOutputCanvas",function(){return n.WebXRManagedOutputCanvas}),i.d(t,"WebXRSessionManager",function(){return n.WebXRSessionManager}),i.d(t,"Octree",function(){return n.Octree}),i.d(t,"OctreeBlock",function(){return n.OctreeBlock}),i.d(t,"OctreeSceneComponent",function(){return n.OctreeSceneComponent}),i.d(t,"_OcclusionDataStorage",function(){return n._OcclusionDataStorage}),i.d(t,"_forceTransformFeedbackToBundle",function(){return n._forceTransformFeedbackToBundle}),i.d(t,"DaydreamController",function(){return n.DaydreamController}),i.d(t,"GearVRController",function(){return n.GearVRController}),i.d(t,"GenericController",function(){return n.GenericController}),i.d(t,"OculusTouchController",function(){return n.OculusTouchController}),i.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),i.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),i.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),i.d(t,"ViveController",function(){return n.ViveController}),i.d(t,"WebVRController",function(){return n.WebVRController}),i.d(t,"WindowsMotionController",function(){return n.WindowsMotionController}),i.d(t,"ShadowGenerator",function(){return n.ShadowGenerator}),i.d(t,"ShadowGeneratorSceneComponent",function(){return n.ShadowGeneratorSceneComponent}),i.d(t,"_BabylonLoaderRegistered",function(){return n._BabylonLoaderRegistered}),i.d(t,"BackgroundMaterial",function(){return n.BackgroundMaterial}),i.d(t,"PBRMaterialDefines",function(){return n.PBRMaterialDefines}),i.d(t,"PBRBaseMaterial",function(){return n.PBRBaseMaterial}),i.d(t,"PBRBaseSimpleMaterial",function(){return n.PBRBaseSimpleMaterial}),i.d(t,"PBRMaterial",function(){return n.PBRMaterial}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return n.PBRMetallicRoughnessMaterial}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return n.PBRSpecularGlossinessMaterial}),i.d(t,"ColorGradingTexture",function(){return n.ColorGradingTexture}),i.d(t,"RawCubeTexture",function(){return n.RawCubeTexture}),i.d(t,"RawTexture3D",function(){return n.RawTexture3D}),i.d(t,"RefractionTexture",function(){return n.RefractionTexture}),i.d(t,"VideoTexture",function(){return n.VideoTexture}),i.d(t,"HtmlElementTexture",function(){return n.HtmlElementTexture}),i.d(t,"NodeMaterialBlockTargets",function(){return n.NodeMaterialBlockTargets}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return n.NodeMaterialBlockConnectionPointTypes}),i.d(t,"NodeMaterialConnectionPoint",function(){return n.NodeMaterialConnectionPoint}),i.d(t,"NodeMaterialBlock",function(){return n.NodeMaterialBlock}),i.d(t,"NodeMaterialDefines",function(){return n.NodeMaterialDefines}),i.d(t,"NodeMaterial",function(){return n.NodeMaterial}),i.d(t,"NodeMaterialWellKnownValues",function(){return n.NodeMaterialWellKnownValues}),i.d(t,"PositionNormalVertex",function(){return n.PositionNormalVertex}),i.d(t,"PositionNormalTextureVertex",function(){return n.PositionNormalTextureVertex}),i.d(t,"DracoCompression",function(){return n.DracoCompression}),i.d(t,"TiledBoxBuilder",function(){return n.TiledBoxBuilder}),i.d(t,"DiscBuilder",function(){return n.DiscBuilder}),i.d(t,"RibbonBuilder",function(){return n.RibbonBuilder}),i.d(t,"HemisphereBuilder",function(){return n.HemisphereBuilder}),i.d(t,"TorusKnotBuilder",function(){return n.TorusKnotBuilder}),i.d(t,"PolygonBuilder",function(){return n.PolygonBuilder}),i.d(t,"ShapeBuilder",function(){return n.ShapeBuilder}),i.d(t,"LatheBuilder",function(){return n.LatheBuilder}),i.d(t,"TiledPlaneBuilder",function(){return n.TiledPlaneBuilder}),i.d(t,"TubeBuilder",function(){return n.TubeBuilder}),i.d(t,"PolyhedronBuilder",function(){return n.PolyhedronBuilder}),i.d(t,"IcoSphereBuilder",function(){return n.IcoSphereBuilder}),i.d(t,"DecalBuilder",function(){return n.DecalBuilder}),i.d(t,"RecastJSPlugin",function(){return n.RecastJSPlugin}),i.d(t,"RecastJSCrowd",function(){return n.RecastJSCrowd}),i.d(t,"BoxParticleEmitter",function(){return n.BoxParticleEmitter}),i.d(t,"ConeParticleEmitter",function(){return n.ConeParticleEmitter}),i.d(t,"CylinderParticleEmitter",function(){return n.CylinderParticleEmitter}),i.d(t,"CylinderDirectedParticleEmitter",function(){return n.CylinderDirectedParticleEmitter}),i.d(t,"HemisphericParticleEmitter",function(){return n.HemisphericParticleEmitter}),i.d(t,"PointParticleEmitter",function(){return n.PointParticleEmitter}),i.d(t,"SphereParticleEmitter",function(){return n.SphereParticleEmitter}),i.d(t,"SphereDirectedParticleEmitter",function(){return n.SphereDirectedParticleEmitter}),i.d(t,"CannonJSPlugin",function(){return n.CannonJSPlugin}),i.d(t,"AmmoJSPlugin",function(){return n.AmmoJSPlugin}),i.d(t,"OimoJSPlugin",function(){return n.OimoJSPlugin}),i.d(t,"PostProcessRenderEffect",function(){return n.PostProcessRenderEffect}),i.d(t,"PostProcessRenderPipeline",function(){return n.PostProcessRenderPipeline}),i.d(t,"PostProcessRenderPipelineManager",function(){return n.PostProcessRenderPipelineManager}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return n.PostProcessRenderPipelineManagerSceneComponent}),i.d(t,"HDRTools",function(){return n.HDRTools}),i.d(t,"PanoramaToCubeMapTools",function(){return n.PanoramaToCubeMapTools}),i.d(t,"_DDSTextureLoader",function(){return n._DDSTextureLoader}),i.d(t,"_ENVTextureLoader",function(){return n._ENVTextureLoader}),i.d(t,"_KTXTextureLoader",function(){return n._KTXTextureLoader}),i.d(t,"_TGATextureLoader",function(){return n._TGATextureLoader}),i.d(t,"_BasisTextureLoader",function(){return n._BasisTextureLoader}),i.d(t,"CustomProceduralTexture",function(){return n.CustomProceduralTexture}),i.d(t,"NoiseProceduralTexture",function(){return n.NoiseProceduralTexture}),i.d(t,"ProceduralTexture",function(){return n.ProceduralTexture}),i.d(t,"ProceduralTextureSceneComponent",function(){return n.ProceduralTextureSceneComponent}),i.d(t,"MultiplyBlock",function(){return n.MultiplyBlock}),i.d(t,"AddBlock",function(){return n.AddBlock}),i.d(t,"ScaleBlock",function(){return n.ScaleBlock}),i.d(t,"ClampBlock",function(){return n.ClampBlock}),i.d(t,"CrossBlock",function(){return n.CrossBlock}),i.d(t,"DotBlock",function(){return n.DotBlock}),i.d(t,"TransformBlock",function(){return n.TransformBlock}),i.d(t,"RemapBlock",function(){return n.RemapBlock}),i.d(t,"NormalizeBlock",function(){return n.NormalizeBlock}),i.d(t,"TrigonometryBlockOperations",function(){return n.TrigonometryBlockOperations}),i.d(t,"TrigonometryBlock",function(){return n.TrigonometryBlock}),i.d(t,"ColorMergerBlock",function(){return n.ColorMergerBlock}),i.d(t,"VectorMergerBlock",function(){return n.VectorMergerBlock}),i.d(t,"ColorSplitterBlock",function(){return n.ColorSplitterBlock}),i.d(t,"VectorSplitterBlock",function(){return n.VectorSplitterBlock}),i.d(t,"LerpBlock",function(){return n.LerpBlock}),i.d(t,"DivideBlock",function(){return n.DivideBlock}),i.d(t,"SubtractBlock",function(){return n.SubtractBlock}),i.d(t,"StepBlock",function(){return n.StepBlock}),i.d(t,"NodeMaterialOptimizer",function(){return n.NodeMaterialOptimizer}),i.d(t,"DefaultRenderingPipeline",function(){return n.DefaultRenderingPipeline}),i.d(t,"LensRenderingPipeline",function(){return n.LensRenderingPipeline}),i.d(t,"SSAO2RenderingPipeline",function(){return n.SSAO2RenderingPipeline}),i.d(t,"SSAORenderingPipeline",function(){return n.SSAORenderingPipeline}),i.d(t,"StandardRenderingPipeline",function(){return n.StandardRenderingPipeline}),i.d(t,"VertexOutputBlock",function(){return n.VertexOutputBlock}),i.d(t,"BonesBlock",function(){return n.BonesBlock}),i.d(t,"InstancesBlock",function(){return n.InstancesBlock}),i.d(t,"MorphTargetsBlock",function(){return n.MorphTargetsBlock}),i.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),i.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),i.d(t,"FresnelBlock",function(){return n.FresnelBlock}),i.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),i.d(t,"FogBlock",function(){return n.FogBlock}),i.d(t,"LightBlock",function(){return n.LightBlock}),i.d(t,"TextureBlock",function(){return n.TextureBlock}),i.d(t,"ReflectionTextureBlock",function(){return n.ReflectionTextureBlock}),i.d(t,"InputBlock",function(){return n.InputBlock}),i.d(t,"AnimatedInputBlockTypes",function(){return n.AnimatedInputBlockTypes});var o=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==o){o.BABYLON=a,o.BABYLON=o.BABYLON||{};var a=o.BABYLON;a.Debug=a.Debug||{};var s=[];for(var c in r)a.Debug[c]=r[c],s.push(c);for(var c in n)a[c]=n[c]}var l={AxesViewer:r.AxesViewer,BoneAxesViewer:r.BoneAxesViewer,PhysicsViewer:r.PhysicsViewer,SkeletonViewer:r.SkeletonViewer}}.call(this,i(137))}])}); \ No newline at end of file +var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function r(e,t){function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var o=function(){return(o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a}function s(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new i(function(t){t(e.value)}).then(a,s)}c((n=n.apply(e,t||[])).next())})}function c(e,t){var i,n,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(r=2&o[0]?n.return:o[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,o[1])).done)return r;switch(n=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"morphTargetManager",{get:function(){return this._internalMeshDataInfo._morphTargetManager},set:function(e){this._internalMeshDataInfo._morphTargetManager!==e&&(this._internalMeshDataInfo._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"source",{get:function(){return this._internalMeshDataInfo._source},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),t.prototype.instantiateHierarychy=function(e){void 0===e&&(e=null);var t=this.createInstance("instance of "+(this.name||this.id));t.parent=e||this.parent,t.position=this.position.clone(),t.scaling=this.scaling.clone(),this.rotationQuaternion?t.rotationQuaternion=this.rotationQuaternion.clone():t.rotation=this.rotation.clone();for(var i=0,n=this.getChildTransformNodes(!0);i0},enumerable:!0,configurable:!0}),t.prototype.getLODLevels=function(){return this._internalMeshDataInfo._LODLevels},t.prototype._sortLODLevels=function(){this._internalMeshDataInfo._LODLevels.sort(function(e,t){return e.distancet.distance?-1:0})},t.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return E.a.Warn("You cannot use a mesh as LOD level twice"),this;var i=new R.a(e,t);return this._internalMeshDataInfo._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},t.prototype.getLODLevelAtDistance=function(e){for(var t=this._internalMeshDataInfo,i=0;ir)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,n._LODLevels[n._LODLevels.length-1].mesh),this;for(var o=0;o0;this.computeWorldMatrix();var a=this.material||r.defaultMaterial;if(a)if(a._storeEffectOnSubMeshes)for(var s=0,c=this.subMeshes;s0){var i=this.getIndices();if(!i)return null;var n=i.length,r=!1;if(e)r=!0;else for(var o=0,a=this.subMeshes;o=n){r=!0;break}if(s.verticesStart+s.verticesCount>=t){r=!0;break}}if(!r)return this.subMeshes[0]}return this.releaseSubMeshes(),new _.b(0,0,t,0,this.getTotalIndices(),this)},t.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,n=0;i%3!=0;)i++;this.releaseSubMeshes();for(var r=0;r=t);r++)_.b.CreateFromIndices(0,n,Math.min(i,t-n),this),n+=i;this.synchronizeInstances()}},t.prototype.setVerticesData=function(e,t,i,n){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,n);else{var r=new d.a;r.set(t,e);var o=this.getScene();new f.a(f.a.RandomId(),o,r,i,this)}return this},t.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},t.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=f.a.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},t.prototype.updateVerticesData=function(e,t,i,n){return this._geometry?(n?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i),this):this},t.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(h.b.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(h.b.PositionKind,i,!1,!1),t){var n=this.getIndices(),r=this.getVerticesData(h.b.NormalKind);if(!r)return this;d.a.ComputeNormals(i,n,r),this.updateVerticesData(h.b.NormalKind,r,!1,!1)}return this},t.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;var e=this._geometry,t=this._geometry.copy(f.a.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},t.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var n=new d.a;n.indices=e;var r=this.getScene();new f.a(f.a.RandomId(),r,n,i,this)}return this},t.prototype.updateIndices=function(e,t,i){return void 0===i&&(i=!1),this._geometry?(this._geometry.updateIndices(e,t,i),this):this},t.prototype.toLeftHanded=function(){return this._geometry?(this._geometry.toLeftHanded(),this):this},t.prototype._bind=function(e,t,i){if(!this._geometry)return this;var n,r=this.getScene().getEngine();if(this._unIndexed)n=null;else switch(i){case g.a.PointFillMode:n=null;break;case g.a.WireFrameFillMode:n=e._getLinesIndexBuffer(this.getIndices(),r);break;default:case g.a.TriangleFillMode:n=this._geometry.getIndexBuffer()}return this._geometry._bind(t,n),this},t.prototype._draw=function(e,t,i){if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._internalMeshDataInfo._onBeforeDrawObservable&&this._internalMeshDataInfo._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene().getEngine();return this._unIndexed||t==g.a.PointFillMode?n.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==g.a.WireFrameFillMode?n.drawElementsType(t,0,e._linesIndexCount,i):n.drawElementsType(t,e.indexStart,e.indexCount,i),this},t.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},t.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},t.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},t.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},t.prototype._getInstancesRenderList=function(e){if(this._instanceDataStorage.isFrozen&&this._instanceDataStorage.previousBatch)return this._instanceDataStorage.previousBatch;var t=this.getScene(),i=t._isInIntermediateRendering(),n=i?this._internalAbstractMeshDataInfo._onlyForInstancesIntermediate:this._internalAbstractMeshDataInfo._onlyForInstances,r=this._instanceDataStorage.batchCache;if(r.mustReturn=!1,r.renderSelf[e]=!n&&this.isEnabled()&&this.isVisible,r.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances){var o=this._instanceDataStorage.visibleInstances,a=t.getRenderId(),s=i?o.intermediateDefaultRenderId:o.defaultRenderId;r.visibleInstances[e]=o[a],!r.visibleInstances[e]&&s&&(r.visibleInstances[e]=o[s])}return r.hardwareInstancedRendering[e]=this._instanceDataStorage.hardwareInstancedRendering&&null!==r.visibleInstances[e]&&void 0!==r.visibleInstances[e],this._instanceDataStorage.previousBatch=r,r},t.prototype._renderWithInstances=function(e,t,i,n,r){var o=i.visibleInstances[e._id];if(!o)return this;for(var a=this._instanceDataStorage,s=a.instancesBufferSize,c=a.instancesBuffer,l=16*(o.length+1)*4;a.instancesBufferSizeu&&n++,0!==_&&f++,d+=_,u=_}if(c[f]++,f>o&&(o=f),0===d)r++;else{var m=1/d,g=0;for(p=0;p.001&&a++}}var v=this.skeleton.bones.length,y=this.getVerticesData(h.b.MatricesIndicesKind),b=this.getVerticesData(h.b.MatricesIndicesExtraKind),T=0;for(l=0;l=v||E<0)&&T++}return{skinned:!0,valid:0===r&&0===a&&0===T,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+r+"\nNot Sorted = "+n+"\nNot Normalized = "+a+"\nWeightCounts = ["+c+"]\nNumber of bones = "+v+"\nBad Bone Indices = "+T}},t.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===b.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=b.a.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},t.prototype._queueLoad=function(e){var t=this;e._addPendingData(this);var i=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return o.b.LoadFile(this.delayLoadingFile,function(i){i instanceof ArrayBuffer?t._delayLoadingFunction(i,t):t._delayLoadingFunction(JSON.parse(i),t),t.instances.forEach(function(e){e.refreshBoundingInfo(),e._syncSubMeshes()}),t.delayLoadState=b.a.DELAYLOADSTATE_LOADED,e._removePendingData(t)},function(){},e.offlineProvider,i),this},t.prototype.isInFrustum=function(t){return this.delayLoadState!==b.a.DELAYLOADSTATE_LOADING&&(!!e.prototype.isInFrustum.call(this,t)&&(this._checkDelayState(),!0))},t.prototype.setMaterialByID=function(e){var t,i=this.getScene().materials;for(t=i.length-1;t>-1;t--)if(i[t].id===e)return this.material=i[t],this;var n=this.getScene().multiMaterials;for(t=n.length-1;t>-1;t--)if(n[t].id===e)return this.material=n[t],this;return this},t.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},t.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(h.b.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,n=this.getVerticesData(h.b.PositionKind),r=new Array;for(i=0;i-1&&(r.morphTargetManager=i.getMorphTargetManagerById(e.morphTargetManagerId)),e.skeletonId>-1&&(r.skeleton=i.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var o=0;o4,u=l?this.getVerticesData(h.b.MatricesIndicesExtraKind):null,d=l?this.getVerticesData(h.b.MatricesWeightsExtraKind):null,f=e.getTransformMatrices(this),p=c.e.Zero(),_=new c.a,m=new c.a,g=0,v=0;v0&&(c.a.FromFloat32ArrayToRefScaled(f,Math.floor(16*o[g+s]),y,m),_.addToSelf(m));if(l)for(s=0;s<4;s++)(y=d[g+s])>0&&(c.a.FromFloat32ArrayToRefScaled(f,Math.floor(16*u[g+s]),y,m),_.addToSelf(m));c.e.TransformCoordinatesFromFloatsToRef(t._sourcePositions[v],t._sourcePositions[v+1],t._sourcePositions[v+2],_,p),p.toArray(n,v),c.e.TransformNormalFromFloatsToRef(t._sourceNormals[v],t._sourceNormals[v+1],t._sourceNormals[v+2],_,p),p.toArray(r,v),_.reset()}return this.updateVerticesData(h.b.PositionKind,n),this.updateVerticesData(h.b.NormalKind,r),this},t.MinMax=function(e){var t=null,i=null;return e.forEach(function(e){var n=e.getBoundingInfo().boundingBox;t&&i?(t.minimizeInPlace(n.minimumWorld),i.maximizeInPlace(n.maximumWorld)):(t=n.minimumWorld,i=n.maximumWorld)}),t&&i?{min:t,max:i}:{min:c.e.Zero(),max:c.e.Zero()}},t.Center=function(e){var i=e instanceof Array?t.MinMax(e):e;return c.e.Center(i.min,i.max)},t.MergeMeshes=function(e,i,n,r,o,a){var s;if(void 0===i&&(i=!0),!n){var c=0;for(s=0;s65536)return E.a.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}if(a){var l,u,h=null;o=!1}var f,p=new Array,m=new Array,g=null,y=new Array,b=null;for(s=0;s":i=n>r;break;case"<":i=n=":i=n>=r;break;case"==":i=n===r}return i},t}(f),v=i(50),y=function(){function e(){}return e.Process=function(e,t,i){var n=this;this._ProcessIncludes(e,t,function(e){var r=n._ProcessShaderConversion(e,t);i(r)})},e._ProcessPrecision=function(e,t){var i=t.shouldUseHighPrecisionShader;return-1===e.indexOf("precision highp float")?e=i?"precision highp float;\n"+e:"precision mediump float;\n"+e:i||(e=e.replace("precision highp float","precision mediump float")),e},e._ExtractOperation=function(e){var t=/defined\((.+)\)/.exec(e);if(t&&t.length)return new p(t[1].trim(),"!"===e[0]);for(var i="",n=0,r=0,o=["==",">=","<=","<",">"];r-1));r++);if(-1===n)return new p(e);var a=e.substring(0,n).trim(),s=e.substring(n+i.length).trim();return new g(a,i,s)},e._BuildSubExpression=function(e){var t=e.indexOf("||");if(-1===t){var i=e.indexOf("&&");if(i>-1){var n=new m,r=e.substring(0,i).trim(),o=e.substring(i+2).trim();return n.leftOperand=this._BuildSubExpression(r),n.rightOperand=this._BuildSubExpression(o),n}return this._ExtractOperation(e)}var a=new _;r=e.substring(0,t).trim(),o=e.substring(t+2).trim();return a.leftOperand=this._BuildSubExpression(r),a.rightOperand=this._BuildSubExpression(o),a},e._BuildExpression=function(e,t){var i=new d,n=e.substring(0,t),r=e.substring(t).trim();return i.testExpression="#ifdef"===n?new p(r):"#ifndef"===n?new p(r,!0):this._BuildSubExpression(r),i},e._MoveCursorWithinIf=function(e,t,i){for(var n=e.currentLine;this._MoveCursor(e,i);){var r=(n=e.currentLine).substring(0,5).toLowerCase();if("#else"===r){var o=new c;return t.children.push(o),void this._MoveCursor(e,o)}if("#elif"===r){var a=this._BuildExpression(n,5);t.children.push(a),i=a}}},e._MoveCursor=function(e,t){for(;e.canRead;){e.lineIndex++;var i=e.currentLine,n=/(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/.exec(i);if(n&&n.length){switch(n[0]){case"#ifdef":var r=new h;t.children.push(r);var o=this._BuildExpression(i,6);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#else":case"#elif":return!0;case"#endif":return!1;case"#ifndef":r=new h;t.children.push(r);o=this._BuildExpression(i,7);r.children.push(o),this._MoveCursorWithinIf(e,r,o);break;case"#if":r=new h,o=this._BuildExpression(i,3);t.children.push(r),r.children.push(o),this._MoveCursorWithinIf(e,r,o)}}else{var a=new c;if(a.line=i,t.children.push(a),"#"===i[0]&&"d"===i[1]){var s=i.replace(";","").split(" ");a.additionalDefineKey=s[1],3===s.length&&(a.additionalDefineValue=s[2])}}}return!1},e._EvaluatePreProcessors=function(e,t,i){var n=new c,r=new l;return r.lineIndex=-1,r.lines=e.split("\n"),this._MoveCursor(r,n),n.process(t,i)},e._PreparePreProcessors=function(e){for(var t={},i=0,n=e.defines;i1?r[1]:""}return t.GL_ES="true",t.__VERSION__=e.version,t[e.platformName]="true",t},e._ProcessShaderConversion=function(e,t){var i=this._ProcessPrecision(e,t);if(!t.processor)return i;if(-1!==i.indexOf("#version 3"))return i.replace("#version 300 es","");var n=t.defines,r=this._PreparePreProcessors(t);return t.processor.preProcessor&&(i=t.processor.preProcessor(i,n,t.isFragment)),i=this._EvaluatePreProcessors(i,r,t),t.processor.postProcessor&&(i=t.processor.postProcessor(i,n,t.isFragment)),i},e._ProcessIncludes=function(e,t,i){for(var n=this,r=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,o=r.exec(e),a=new String(e);null!=o;){var s=o[1];if(-1!==s.indexOf("__decl__")&&(s=s.replace(/__decl__/,""),t.supportsUniformBuffers&&(s=(s=s.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),s+="Declaration"),!t.includesShadersStore[s]){var c=t.shadersRepository+"ShadersInclude/"+s+".fx";return void v.a.LoadFile(c,function(e){t.includesShadersStore[s]=e,n._ProcessIncludes(a,t,i)})}var l=t.includesShadersStore[s];if(o[2])for(var u=o[3].split(","),h=0;hthis._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,ethis._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"hasMoreFallbacks",{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.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),n=0;n0&&(r.computeBonesUsingShaders=!1)}}else{var s=this._defines[this._currentRank];if(s)for(n=0;n=2?"WEBGL2":"WEBGL1"};this._loadVertexShader(d,function(e){p._loadFragmentShader(f,function(i){y.Process(e,g,function(e){g.isFragment=!0,y.Process(i,g,function(i){p._useFinalCode(e,i,t)})})})})}return Object.defineProperty(e.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new n.c),this._onBindObservable},enumerable:!0,configurable:!0}),e.prototype._useFinalCode=function(e,t,i){if(i){var n=i.vertexElement||i.vertex||i.spectorName||i,r=i.fragmentElement||i.fragment||i.spectorName||i;this._vertexSourceCode="#define SHADER_NAME vertex:"+n+"\n"+e,this._fragmentSourceCode="#define SHADER_NAME fragment:"+r+"\n"+t}else this._vertexSourceCode=e,this._fragmentSourceCode=t;this._prepareEffect()},Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),e.prototype.isReady=function(){try{return this._isReadyInternal()}catch(e){return!1}},e.prototype._isReadyInternal=function(){return!!this._isReady||!!this._pipelineContext&&this._pipelineContext.isReady},e.prototype.getEngine=function(){return this._engine},e.prototype.getPipelineContext=function(){return this._pipelineContext},e.prototype.getAttributesNames=function(){return this._attributesNames},e.prototype.getAttributeLocation=function(e){return this._attributes[e]},e.prototype.getAttributeLocationByName=function(e){var t=this._attributesNames.indexOf(e);return this._attributes[t]},e.prototype.getAttributesCount=function(){return this._attributes.length},e.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},e.prototype.getUniform=function(e){return this._uniforms[e]},e.prototype.getSamplers=function(){return this._samplerList},e.prototype.getCompilationError=function(){return this._compilationError},e.prototype.executeWhenCompiled=function(e){var t=this;this.isReady()?e(this):(this.onCompileObservable.add(function(t){e(t)}),this._pipelineContext&&!this._pipelineContext.isAsync||setTimeout(function(){t._checkIsReady()},16))},e.prototype._checkIsReady=function(){var e=this;try{if(this._isReadyInternal())return}catch(e){return void this._processCompilationErrors(e)}setTimeout(function(){e._checkIsReady()},16)},e.prototype._loadVertexShader=function(t,i){var n;if(o.a.IsWindowObjectExist()&&t instanceof HTMLElement)return void i(o.a.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+"VertexShader"]?i(e.ShadersStore[t+"VertexShader"]):(n="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(n+".vertex.fx",i)):i(window.atob(t.substr(7))):i(t.substr(7))},e.prototype._loadFragmentShader=function(t,i){var n;if(o.a.IsWindowObjectExist()&&t instanceof HTMLElement)return void i(o.a.GetDOMTextContent(t));"source:"!==t.substr(0,7)?"base64:"!==t.substr(0,7)?e.ShadersStore[t+"PixelShader"]?i(e.ShadersStore[t+"PixelShader"]):e.ShadersStore[t+"FragmentShader"]?i(e.ShadersStore[t+"FragmentShader"]):(n="."===t[0]||"/"===t[0]||t.indexOf("http")>-1?t:e.ShadersRepository+t,this._engine._loadFile(n+".fragment.fx",i)):i(window.atob(t.substr(7))):i(t.substr(7))},e.prototype._dumpShadersSource=function(e,t,i){var n=(this._engine.webGLVersion>1?"#version 300 es\n#define WEBGL2 \n":"")+(i?i+"\n":"");t=n+t;var r=2,o=/\n/gm,s="\n1\t"+(e=n+e).replace(o,function(){return"\n"+r+++"\t"});r=2;var c="\n1\t"+t.replace(o,function(){return"\n"+r+++"\t"});this.name.vertexElement?(a.a.Error("Vertex shader: "+this.name.vertexElement+s),a.a.Error("Fragment shader: "+this.name.fragmentElement+c)):this.name.vertex?(a.a.Error("Vertex shader: "+this.name.vertex+s),a.a.Error("Fragment shader: "+this.name.fragment+c)):(a.a.Error("Vertex shader: "+this.name+s),a.a.Error("Fragment shader: "+this.name+c))},e.prototype._rebuildProgram=function(e,t,i,n){var o=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){n&&n(t)},this.onCompiled=function(){for(var e=o.getEngine().scenes,t=0;t0},e.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},e.prototype.clone=function(){var t=new e;return t._observers=this._observers.slice(0),t},e.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t
";e._AddLogEntry(n)},e._WarnDisabled=function(e){},e._WarnEnabled=function(t){var i=e._FormatMessage(t);console.warn("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},e._ErrorDisabled=function(e){},e._ErrorEnabled=function(t){e.errorsCount++;var i=e._FormatMessage(t);console.error("BJS - "+i);var n="
"+i+"

";e._AddLogEntry(n)},Object.defineProperty(e,"LogCache",{get:function(){return e._LogCache},enumerable:!0,configurable:!0}),e.ClearLogCache=function(){e._LogCache="",e.errorsCount=0},Object.defineProperty(e,"LogLevels",{set:function(t){(t&e.MessageLogLevel)===e.MessageLogLevel?e.Log=e._LogEnabled:e.Log=e._LogDisabled,(t&e.WarningLogLevel)===e.WarningLogLevel?e.Warn=e._WarnEnabled:e.Warn=e._WarnDisabled,(t&e.ErrorLogLevel)===e.ErrorLogLevel?e.Error=e._ErrorEnabled:e.Error=e._ErrorDisabled},enumerable:!0,configurable:!0}),e.NoneLogLevel=0,e.MessageLogLevel=1,e.WarningLogLevel=2,e.ErrorLogLevel=4,e.AllLogLevel=7,e._LogCache="",e.errorsCount=0,e.Log=e._LogEnabled,e.Warn=e._WarnEnabled,e.Error=e._ErrorEnabled,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return p});var n=i(1),r=i(2),o=i(7),a=i(0),s=i(49),c=i(3),l=i(13),u=i(21),h=i(113),d=i(109),f=i(56),p=function(e){function t(i,n,r,a,s,l,u,d,f,p){void 0===r&&(r=!1),void 0===a&&(a=!0),void 0===s&&(s=t.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null),void 0===u&&(u=null),void 0===d&&(d=null),void 0===f&&(f=!1);var _=e.call(this,n&&"Scene"===n.getClassName()?n:null)||this;_.url=null,_.uOffset=0,_.vOffset=0,_.uScale=1,_.vScale=1,_.uAng=0,_.vAng=0,_.wAng=0,_.uRotationCenter=.5,_.vRotationCenter=.5,_.wRotationCenter=.5,_.inspectableCustomProperties=null,_._noMipmap=!1,_._invertY=!1,_._rowGenerationMatrix=null,_._cachedTextureMatrix=null,_._projectionModeMatrix=null,_._t0=null,_._t1=null,_._t2=null,_._cachedUOffset=-1,_._cachedVOffset=-1,_._cachedUScale=0,_._cachedVScale=0,_._cachedUAng=-1,_._cachedVAng=-1,_._cachedWAng=-1,_._cachedProjectionMatrixId=-1,_._cachedCoordinatesMode=-1,_._initialSamplingMode=t.BILINEAR_SAMPLINGMODE,_._buffer=null,_._deleteBuffer=!1,_._format=null,_._delayedOnLoad=null,_._delayedOnError=null,_.onLoadObservable=new o.c,_._isBlocking=!0,_.name=i||"",_.url=i,_._noMipmap=r,_._invertY=a,_._initialSamplingMode=s,_._buffer=d,_._deleteBuffer=f,p&&(_._format=p);var m=_.getScene(),g=n&&n.getCaps?n:m?m.getEngine():null;if(!g)return _;g.onBeforeTextureInitObservable.notifyObservers(_);var v=function(){_._texture&&(_._texture._invertVScale&&(_.vScale*=-1,_.vOffset+=1),null!==_._texture._cachedWrapU&&(_.wrapU=_._texture._cachedWrapU,_._texture._cachedWrapU=null),null!==_._texture._cachedWrapV&&(_.wrapV=_._texture._cachedWrapV,_._texture._cachedWrapV=null),null!==_._texture._cachedWrapR&&(_.wrapR=_._texture._cachedWrapR,_._texture._cachedWrapR=null)),_.onLoadObservable.hasObservers()&&_.onLoadObservable.notifyObservers(_),l&&l(),!_.isBlocking&&m&&m.resetCachedMaterial()};return _.url?(_._texture=_._getFromCache(_.url,r,s,a),_._texture?_._texture.isReady?h.a.SetImmediate(function(){return v()}):_._texture.onLoadedObservable.add(v):m&&m.useDelayedTextureLoading?(_.delayLoadState=c.a.DELAYLOADSTATE_NOTLOADED,_._delayedOnLoad=v,_._delayedOnError=u):(_._texture=g.createTexture(_.url,r,a,m,s,v,u,_._buffer,void 0,_._format),f&&delete _._buffer),_):(_._delayedOnLoad=v,_._delayedOnError=u,_)}return n.d(t,e),Object.defineProperty(t.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"samplingMode",{get:function(){return this._texture?this._texture.samplingMode:this._initialSamplingMode},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"invertY",{get:function(){return this._invertY},enumerable:!0,configurable:!0}),t.prototype.updateURL=function(e,t,i){void 0===t&&(t=null),this.url&&(this.releaseInternalTexture(),this.getScene().markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag)),this.name=e,this.url=e,this._buffer=t,this.delayLoadState=c.a.DELAYLOADSTATE_NOTLOADED,i&&(this._delayedOnLoad=i),this.delayLoad()},t.prototype.delayLoad=function(){if(this.delayLoadState===c.a.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=c.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this.samplingMode,this._invertY),this._texture?this._delayedOnLoad&&(this._texture.isReady?h.a.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this.samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)}},t.prototype._prepareRowForTextureGeneration=function(e,t,i,n){e*=this.uScale,t*=this.vScale,e-=this.uRotationCenter*this.uScale,t-=this.vRotationCenter*this.vScale,i-=this.wRotationCenter,a.e.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,n),n.x+=this.uRotationCenter*this.uScale+this.uOffset,n.y+=this.vRotationCenter*this.vScale+this.vOffset,n.z+=this.wRotationCenter},t.prototype.getTextureMatrix=function(){var e=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=a.a.Zero(),this._rowGenerationMatrix=new a.a,this._t0=a.e.Zero(),this._t1=a.e.Zero(),this._t2=a.e.Zero()),a.a.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),a.a.FromValuesToRef(this._t1.x,this._t1.y,this._t1.z,0,this._t2.x,this._t2.y,this._t2.z,0,this._t0.x,this._t0.y,this._t0.z,0,0,0,0,1,this._cachedTextureMatrix);var t=this.getScene();return t?(t.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag,function(t){return t.hasTexture(e)}),this._cachedTextureMatrix):this._cachedTextureMatrix},t.prototype.getReflectionTextureMatrix=function(){var e=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!==t.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===i.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=a.a.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=a.a.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case t.PLANAR_MODE:a.a.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 t.PROJECTION_MODE:a.a.FromValuesToRef(.5,0,0,0,0,-.5,0,0,0,0,0,0,.5,.5,1,1,this._projectionModeMatrix);var n=i.getProjectionMatrix();this._cachedProjectionMatrixId=n.updateFlag,n.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:a.a.IdentityToRef(this._cachedTextureMatrix)}return i.markAllMaterialsAsDirty(c.a.MATERIAL_TextureDirtyFlag,function(t){return-1!==t.getActiveTextures().indexOf(e)}),this._cachedTextureMatrix},t.prototype.clone=function(){var e=this;return r.a.Clone(function(){return new t(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e.samplingMode,void 0,void 0,e._texture?e._texture._buffer:void 0)},this)},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t?("string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)&&(t.base64String=this._buffer,t.name=t.name.replace("data:","")),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t):null},t.prototype.getClassName=function(){return"Texture"},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},t.Parse=function(e,i,n){if(e.customType){var o=d.a.Instantiate(e.customType).Parse(e,i,n);return e.samplingMode&&o.updateSamplingMode&&o._samplingMode&&o._samplingMode!==e.samplingMode&&o.updateSamplingMode(e.samplingMode),o}if(e.isCube&&!e.isRenderTarget)return t._CubeTextureParser(e,i,n);if(!e.name&&!e.isRenderTarget)return null;var a=r.a.Parse(function(){var r,o=!0;if(e.noMipmap&&(o=!1),e.mirrorPlane){var a=t._CreateMirror(e.name,e.renderTargetSize,i,o);return a._waitingRenderList=e.renderList,a.mirrorPlane=f.a.FromArray(e.mirrorPlane),a}if(e.isRenderTarget){var s=null;if(e.isCube){if(i.reflectionProbes)for(var c=0;c=0&&o<=1?(s=r,c=a):o>=1&&o<=2?(s=a,c=r):o>=2&&o<=3?(c=r,l=a):o>=3&&o<=4?(c=a,l=r):o>=4&&o<=5?(s=a,l=r):o>=5&&o<=6&&(s=r,l=a);var u=i-r;n.set(s+u,c+u,l+u)},e.FromHexString=function(t){if("#"!==t.substring(0,1)||7!==t.length)return new e(0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16);return e.FromInts(i,n,r)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2])},e.FromInts=function(t,i,n){return new e(t/255,i/255,n/255)},e.Lerp=function(t,i,n){var r=new e(0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i},e.Red=function(){return new e(1,0,0)},e.Green=function(){return new e(0,1,0)},e.Blue=function(){return new e(0,0,1)},e.Black=function(){return new e(0,0,0)},Object.defineProperty(e,"BlackReadOnly",{get:function(){return e._BlackReadOnly},enumerable:!0,configurable:!0}),e.White=function(){return new e(1,1,1)},e.Purple=function(){return new e(.5,0,.5)},e.Magenta=function(){return new e(1,0,1)},e.Yellow=function(){return new e(1,1,0)},e.Gray=function(){return new e(.5,.5,.5)},e.Teal=function(){return new e(0,1,1)},e.Random=function(){return new e(Math.random(),Math.random(),Math.random())},e._BlackReadOnly=e.Black(),e}(),c=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this.r=e,this.g=t,this.b=i,this.a=n}return e.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},e.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},e.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},e.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a},e.prototype.add=function(t){return new e(this.r+t.r,this.g+t.g,this.b+t.b,this.a+t.a)},e.prototype.subtract=function(t){return new e(this.r-t.r,this.g-t.g,this.b-t.b,this.a-t.a)},e.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},e.prototype.scale=function(t){return new e(this.r*t,this.g*t,this.b*t,this.a*t)},e.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},e.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},e.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=n.a.Clamp(this.r,e,t),i.g=n.a.Clamp(this.g,e,t),i.b=n.a.Clamp(this.b,e,t),i.a=n.a.Clamp(this.a,e,t),this},e.prototype.multiply=function(t){return new e(this.r*t.r,this.g*t.g,this.b*t.b,this.a*t.a)},e.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},e.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},e.prototype.getClassName=function(){return"Color4"},e.prototype.getHashCode=function(){var e=255*this.r|0;return e=397*(e=397*(e=397*e^(255*this.g|0))^(255*this.b|0))^(255*this.a|0)},e.prototype.clone=function(){return new e(this.r,this.g,this.b,this.a)},e.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},e.prototype.copyFromFloats=function(e,t,i,n){return this.r=e,this.g=t,this.b=i,this.a=n,this},e.prototype.set=function(e,t,i,n){return this.copyFromFloats(e,t,i,n)},e.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0,r=255*this.a|0;return"#"+n.a.ToHex(e)+n.a.ToHex(t)+n.a.ToHex(i)+n.a.ToHex(r)},e.prototype.toLinearSpace=function(){var t=new e;return this.toLinearSpaceToRef(t),t},e.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,r.c),e.g=Math.pow(this.g,r.c),e.b=Math.pow(this.b,r.c),e.a=this.a,this},e.prototype.toGammaSpace=function(){var t=new e;return this.toGammaSpaceToRef(t),t},e.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,r.b),e.g=Math.pow(this.g,r.b),e.b=Math.pow(this.b,r.b),e.a=this.a,this},e.FromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length)return new e(0,0,0,0);var i=parseInt(t.substring(1,3),16),n=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16),o=parseInt(t.substring(7,9),16);return e.FromInts(i,n,r,o)},e.Lerp=function(t,i,n){var r=new e(0,0,0,0);return e.LerpToRef(t,i,n,r),r},e.LerpToRef=function(e,t,i,n){n.r=e.r+(t.r-e.r)*i,n.g=e.g+(t.g-e.g)*i,n.b=e.b+(t.b-e.b)*i,n.a=e.a+(t.a-e.a)*i},e.FromColor3=function(t,i){return void 0===i&&(i=1),new e(t.r,t.g,t.b,i)},e.FromArray=function(t,i){return void 0===i&&(i=0),new e(t[i],t[i+1],t[i+2],t[i+3])},e.FromInts=function(t,i,n,r){return new e(t/255,i/255,n/255,r/255)},e.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],n=0;n0)if(parseInt(A[A.length-1])>=E)continue}for(var P=0,S=g;P1&&(this._shaderProcessor=new v.a),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 v"+e.Version+" - "+this.description),this.enableOfflineSupport=void 0!==e.OfflineProviderFactory}}return Object.defineProperty(e,"Instances",{get:function(){return f.a.Instances},enumerable:!0,configurable:!0}),Object.defineProperty(e,"LastCreatedEngine",{get:function(){return f.a.LastCreatedEngine},enumerable:!0,configurable:!0}),Object.defineProperty(e,"LastCreatedScene",{get:function(){return f.a.LastCreatedScene},enumerable:!0,configurable:!0}),e.MarkAllMaterialsAsDirty=function(t,i){for(var n=0;n1&&!this.disableUniformBuffers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_shouldUseHighPrecisionShader",{get:function(){return this._caps.highPrecisionShaderSupported&&this._highPrecisionShadersAllowed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"texturesSupported",{get:function(){return this._texturesSupported},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,e.TEXTUREFORMAT_RGBA,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,e.TEXTUREFORMAT_RGBA,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var t=new Uint8Array(4),i=[t,t,t,t,t,t];this._emptyCubeTexture=this.createRawCubeTexture(i,1,e.TEXTUREFORMAT_RGBA,e.TEXTURETYPE_UNSIGNED_INT,!1,!1,e.TEXTURE_NEAREST_SAMPLINGMODE)}return this._emptyCubeTexture},enumerable:!0,configurable:!0}),e.prototype.initWebVR=function(){throw _.a.WarnImport("WebVRCamera")},e.prototype._prepareVRComponent=function(){},e.prototype._connectVREvents=function(e,t){},e.prototype._submitVRFrame=function(){},e.prototype.disableVR=function(){},e.prototype.isVRPresenting=function(){return!1},e.prototype._requestVRFrame=function(){},e.prototype._disableTouchAction=function(){this._renderingCanvas&&(this._renderingCanvas.setAttribute("touch-action","none"),this._renderingCanvas.style.touchAction="none",this._renderingCanvas.style.msTouchAction="none")},e.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e1||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=!1,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._caps.multiview=this._gl.getExtension("OVR_multiview2"),this._webGLVersion>1)this._caps.drawBuffersExtension=!0,this._caps.maxMSAASamples=this._gl.getParameter(this._gl.MAX_SAMPLES);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 i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=t["COLOR_ATTACHMENT"+i+"_WEBGL"]}else this._caps.drawBuffersExtension=!1}if(this._caps.parallelShaderCompile=this._gl.getExtension("KHR_parallel_shader_compile"),this._webGLVersion>1)this._caps.depthTextureExtension=!0;else{var n=this._gl.getExtension("WEBGL_depth_texture");null!=n&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=n.UNSIGNED_INT_24_8_WEBGL)}if(this.disableVertexArrayObjects)this._caps.vertexArrayObject=!1;else if(this._webGLVersion>1)this._caps.vertexArrayObject=!0;else{var r=this._gl.getExtension("OES_vertex_array_object");null!=r?(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=r.createVertexArrayOES.bind(r),this._gl.bindVertexArray=r.bindVertexArrayOES.bind(r),this._gl.deleteVertexArray=r.deleteVertexArrayOES.bind(r)):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 a=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT),s=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);a&&s&&(this._caps.highPrecisionShaderSupported=0!==a.precision&&0!==s.precision)}this.setDepthBuffer(!0),this.setDepthFunctionToLessOrEqual(),this.setDepthWrite(!0),this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var c=0;c=0&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},e.prototype._renderLoop=function(){if(!this._contextWasLost){var t=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(t=!1),t){this.beginFrame();for(var i=0;i0?this.customAnimationFrameRequester?(this.customAnimationFrameRequester.requestID=e.QueueNewFrame(this.customAnimationFrameRequester.renderFunction||this._bindedRenderFunction,this.customAnimationFrameRequester),this._frameHandler=this.customAnimationFrameRequester.requestID):this.isVRPresenting()?this._requestVRFrame():this._frameHandler=e.QueueNewFrame(this._bindedRenderFunction,this.getHostWindow()):this._renderingQueueLaunched=!1},e.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.QueueNewFrame(this._bindedRenderFunction,this.getHostWindow())))},e.prototype.switchFullscreen=function(e){this.isFullscreen?this.exitFullscreen():this.enterFullscreen(e)},e.prototype.enterFullscreen=function(t){this.isFullscreen||(this._pointerLockRequested=t,this._renderingCanvas&&e._RequestFullscreen(this._renderingCanvas))},e.prototype.exitFullscreen=function(){this.isFullscreen&&e._ExitFullscreen()},e.prototype.enterPointerlock=function(){this._renderingCanvas&&e._RequestPointerlock(this._renderingCanvas)},e.prototype.exitPointerlock=function(){e._ExitPointerlock()},e.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1),this.applyStates();var r=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),r|=this._gl.COLOR_BUFFER_BIT),i&&(this._gl.clearDepth(1),r|=this._gl.DEPTH_BUFFER_BIT),n&&(this._gl.clearStencil(0),r|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(r)},e.prototype.scissorClear=function(e,t,i,n,r){this.enableScissor(e,t,i,n),this.clear(r,!0,!0,!0),this.disableScissor()},e.prototype.enableScissor=function(e,t,i,n){var r=this._gl;r.enable(r.SCISSOR_TEST),r.scissor(e,t,i,n)},e.prototype.disableScissor=function(){var e=this._gl;e.disable(e.SCISSOR_TEST)},e.prototype._viewport=function(e,t,i,n){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&n===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=n,this._gl.viewport(e,t,i,n))},e.prototype.setViewport=function(e,t,i){var n=t||this.getRenderWidth(),r=i||this.getRenderHeight(),o=e.x||0,a=e.y||0;this._cachedViewport=e,this._viewport(o*n,a*r,n*e.width,r*e.height)},e.prototype.setDirectViewport=function(e,t,i,n){var r=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,n),r},e.prototype.beginFrame=function(){this.onBeginFrameObservable.notifyObservers(this),this._measureFps()},e.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._submitVRFrame(),this.onEndFrameObservable.notifyObservers(this)},e.prototype.resize=function(){if(!this.isVRPresenting()){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)}},e.prototype.setSize=function(e,t){if(this._renderingCanvas&&(e|=0,t|=0,this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)){this._renderingCanvas.width=e,this._renderingCanvas.height=t;for(var i=0;i65535){o=!0;break}i=o?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=o,r},e.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},e.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e?e.underlyingResource:null)},e.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e?e.underlyingResource:null)},e.prototype.bindUniformBlock=function(e,t,i){var n=e.program,r=this._gl.getUniformBlockIndex(n,t);this._gl.uniformBlockBinding(n,r,i)},e.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},e.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e?e.underlyingResource:null),this._currentBoundBuffer[t]=e)},e.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},e.prototype._vertexAttribPointer=function(e,t,i,n,r,o,a){var s=this._currentBufferPointers[t],c=!1;s.active?(s.buffer!==e&&(s.buffer=e,c=!0),s.size!==i&&(s.size=i,c=!0),s.type!==n&&(s.type=n,c=!0),s.normalized!==r&&(s.normalized=r,c=!0),s.stride!==o&&(s.stride=o,c=!0),s.offset!==a&&(s.offset=a,c=!0)):(c=!0,s.active=!0,s.index=t,s.size=i,s.type=n,s.normalized=r,s.stride=o,s.offset=a,s.buffer=e),(c||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,n,r,o,a))},e.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},e.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var n=0;n=0){var o=e[i[n]];if(!o)continue;this._gl.enableVertexAttribArray(r),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[r]=!0);var a=o.getBuffer();a&&(this._vertexAttribPointer(a,r,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(r,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(r),this._currentInstanceBuffers.push(a))))}}},e.prototype.recordVertexArrayObject=function(e,t,i){var n=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(n),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),n},e.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)},e.prototype.bindBuffersDirectly=function(e,t,i,n,r){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==r){this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=r;var o=r.getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var a=0,s=0;s=0&&(this._gl.enableVertexAttribArray(c),this._vertexAttribArraysEnabled[c]=!0,this._vertexAttribPointer(e,c,i[s],this._gl.FLOAT,!1,n,a)),a+=4*i[s]}}this._bindIndexBufferWithCache(t)},e.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},e.prototype.bindBuffers=function(e,t,i){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i)),this._bindIndexBufferWithCache(t)},e.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t1?"#version 300 es\n#define WEBGL2 \n":"",s=this._compileShader(t,"vertex",n,a),c=this._compileShader(i,"fragment",n,a),l=this._createShaderProgram(e,s,c,r,o);return this.onAfterShaderCompilationObservable.notifyObservers(this),l},e.prototype.createPipelineContext=function(){var e=new m.a;return e.engine=this,this._caps.parallelShaderCompile&&(e.isParallelCompiled=!0),e},e.prototype._createShaderProgram=function(e,t,i,n,r){void 0===r&&(r=null);var o=n.createProgram();if(e.program=o,!o)throw new Error("Unable to create program");if(n.attachShader(o,t),n.attachShader(o,i),this.webGLVersion>1&&r){var a=this.createTransformFeedback();this.bindTransformFeedback(a),this.setTranformFeedbackVaryings(o,r),e.transformFeedback=a}return n.linkProgram(o),this.webGLVersion>1&&r&&this.bindTransformFeedback(null),e.context=n,e.vertexShader=t,e.fragmentShader=i,e.isParallelCompiled||this._finalizePipelineContext(e),o},e.prototype._finalizePipelineContext=function(e){var t=e.context,i=e.vertexShader,n=e.fragmentShader,r=e.program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var o,a;if(!this._gl.getShaderParameter(i,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(i))throw new Error("VERTEX SHADER "+o);if(!this._gl.getShaderParameter(n,this._gl.COMPILE_STATUS))if(o=this._gl.getShaderInfoLog(n))throw new Error("FRAGMENT SHADER "+o);if(a=t.getProgramInfoLog(r))throw new Error(a)}if(this.validateShaderPrograms&&(t.validateProgram(r),!t.getProgramParameter(r,t.VALIDATE_STATUS)&&(a=t.getProgramInfoLog(r))))throw new Error(a);t.deleteShader(i),t.deleteShader(n),e.vertexShader=void 0,e.fragmentShader=void 0,e.onCompiled&&(e.onCompiled(),e.onCompiled=void 0)},e.prototype._preparePipelineContext=function(e,t,i,n,r,o,a){var s=e;s.program=n?this.createRawShaderProgram(s,t,i,void 0,a):this.createShaderProgram(s,t,i,o,void 0,a),s.program.__SPECTOR_rebuildProgram=r},e.prototype._isRenderingStateCompiled=function(e){var t=e;return!!this._gl.getProgramParameter(t.program,this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)&&(this._finalizePipelineContext(t),!0)},e.prototype._executeWhenRenderingStateIsCompiled=function(e,t){var i=e;i.isParallelCompiled?i.onCompiled=t:t()},e.prototype.getUniforms=function(e,t){for(var i=new Array,n=e,r=0;r-1?m.substring(E).toLowerCase():""),P=null,S=0,R=e._TextureLoaders;Su||t.height>u||null===e._RescalePostProcessFactory)return _._prepareWorkingCanvas(),!(!_._workingCanvas||!_._workingContext)&&(_._workingCanvas.width=i,_._workingCanvas.height=n,_._workingContext.drawImage(t,0,0,t.width,t.height,0,0,i,n),a.texImage2D(a.TEXTURE_2D,0,l,l,a.UNSIGNED_BYTE,_._workingCanvas),T.width=i,T.height=n,!1);var d=new c.a(_,c.a.DATASOURCE_TEMP);return _._bindTextureDirectly(a.TEXTURE_2D,d,!0),a.texImage2D(a.TEXTURE_2D,0,l,l,a.UNSIGNED_BYTE,t),_._rescaleTexture(d,T,r,l,function(){_._releaseTexture(d),_._bindTextureDirectly(a.TEXTURE_2D,T,!0),o()}),!0},o)};!g||y?l instanceof HTMLImageElement?I(l):b.a.LoadImage(m,I,M,r?r.offlineProvider:null):"string"==typeof l||l instanceof ArrayBuffer||l instanceof Blob?b.a.LoadImage(l,I,M,r?r.offlineProvider:null):I(l)}return T},e.prototype._rescaleTexture=function(t,i,n,r,o){var a=this;this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,this._gl.LINEAR),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE);var s=this.createRenderTargetTexture({width:i.width,height:i.height},{generateMipMaps:!1,type:e.TEXTURETYPE_UNSIGNED_INT,samplingMode:e.TEXTURE_BILINEAR_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1});!this._rescalePostProcess&&e._RescalePostProcessFactory&&(this._rescalePostProcess=e._RescalePostProcessFactory(this)),this._rescalePostProcess.getEffect().executeWhenCompiled(function(){a._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)};var e=n;e||(e=a.scenes[a.scenes.length-1]),e.postProcessManager.directRender([a._rescalePostProcess],s,!0),a._bindTextureDirectly(a._gl.TEXTURE_2D,i,!0),a._gl.copyTexImage2D(a._gl.TEXTURE_2D,0,r,0,0,i.width,i.height,0),a.unBindFramebuffer(s),a._releaseTexture(s),o&&o()})},e.prototype.createRawTexture=function(t,i,n,r,o,a,s,c,l){throw void 0===c&&(c=null),void 0===l&&(l=e.TEXTURETYPE_UNSIGNED_INT),_.a.WarnImport("Engine.RawTexture")},e.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},e.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},e.prototype.createDynamicTexture=function(t,i,n,r){var o=new c.a(this,c.a.DATASOURCE_DYNAMIC);return o.baseWidth=t,o.baseHeight=i,n&&(t=this.needPOTTextures?e.GetExponentOfTwo(t,this._caps.maxTextureSize):t,i=this.needPOTTextures?e.GetExponentOfTwo(i,this._caps.maxTextureSize):i),o.width=t,o.height=i,o.isReady=!1,o.generateMipMaps=n,o.samplingMode=r,this.updateTextureSamplingMode(r,o),this._internalTexturesCache.push(o),o},e.prototype.updateTextureSamplingMode=function(e,t){var i=this._getSamplingParameters(e,t.generateMipMaps);t.isCube?(this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):t.is3D?(this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_3D,null)):(this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t.samplingMode=e},e.prototype.updateDynamicTexture=function(e,t,i,n,r,o){if(void 0===n&&(n=!1),void 0===o&&(o=!1),e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0,o),this._unpackFlipY(i),n&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var a=r?this._getInternalFormat(r):this._gl.RGBA;this._gl.texImage2D(this._gl.TEXTURE_2D,0,a,a,this._gl.UNSIGNED_BYTE,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),n&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}},e.prototype.updateVideoTexture=function(e,t,i){if(e&&!e._isDisabled){var n=this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0);this._unpackFlipY(!i);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 r=e._workingCanvas.getContext("2d");if(!r)throw new Error("Unable to get 2d context");e._workingContext=r,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),n||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}catch(t){e._isDisabled=!0}}},e.prototype.updateTextureComparisonFunction=function(t,i){if(1!==this.webGLVersion){var n=this._gl;t.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,t,!0),0===i?(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_FUNC,e.LEQUAL),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_MODE,n.NONE)):(n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_FUNC,i),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0),0===i?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_FUNC,e.LEQUAL),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_MODE,n.NONE)):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_FUNC,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t._comparisonFunction=i}else d.a.Error("WebGL 1 does not support texture comparison.")},e.prototype._setupDepthStencilTexture=function(t,i,n,r,o){var a=i.width||i,s=i.height||i;t.baseWidth=a,t.baseHeight=s,t.width=a,t.height=s,t.isReady=!0,t.samples=1,t.generateMipMaps=!1,t._generateDepthBuffer=!0,t._generateStencilBuffer=n,t.samplingMode=r?e.TEXTURE_BILINEAR_SAMPLINGMODE:e.TEXTURE_NEAREST_SAMPLINGMODE,t.type=e.TEXTURETYPE_UNSIGNED_INT,t._comparisonFunction=o;var c=this._gl,l=t.isCube?c.TEXTURE_CUBE_MAP:c.TEXTURE_2D,u=this._getSamplingParameters(t.samplingMode,!1);c.texParameteri(l,c.TEXTURE_MAG_FILTER,u.mag),c.texParameteri(l,c.TEXTURE_MIN_FILTER,u.min),c.texParameteri(l,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(l,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),0===o?(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,e.LEQUAL),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.NONE)):(c.texParameteri(l,c.TEXTURE_COMPARE_FUNC,o),c.texParameteri(l,c.TEXTURE_COMPARE_MODE,c.COMPARE_REF_TO_TEXTURE))},e.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},e.prototype._createDepthStencilTexture=function(e,t){var i=new c.a(this,c.a.DATASOURCE_DEPTHTEXTURE);if(!this._caps.depthTextureExtension)return d.a.Error("Depth texture is not supported by your browser or hardware."),i;var r=n.a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),o=this._gl;return this._bindTextureDirectly(o.TEXTURE_2D,i,!0),this._setupDepthStencilTexture(i,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction),this.webGLVersion>1?r.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):r.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},e.prototype.setFrameBufferDepthStencilTexture=function(e){var t=e.getInternalTexture();if(t&&t._framebuffer&&e.depthStencilTexture){var i=this._gl,n=e.depthStencilTexture;this._bindUnboundFramebuffer(t._framebuffer),n.isCube?n._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,n._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,n._webGLTexture,0):n._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,n._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,n._webGLTexture,0),this._bindUnboundFramebuffer(null)}},e.prototype.createRenderTargetTexture=function(t,i){var n=new p.a;void 0!==i&&"object"==typeof i?(n.generateMipMaps=i.generateMipMaps,n.generateDepthBuffer=void 0===i.generateDepthBuffer||i.generateDepthBuffer,n.generateStencilBuffer=n.generateDepthBuffer&&i.generateStencilBuffer,n.type=void 0===i.type?e.TEXTURETYPE_UNSIGNED_INT:i.type,n.samplingMode=void 0===i.samplingMode?e.TEXTURE_TRILINEAR_SAMPLINGMODE:i.samplingMode,n.format=void 0===i.format?e.TEXTUREFORMAT_RGBA:i.format):(n.generateMipMaps=i,n.generateDepthBuffer=!0,n.generateStencilBuffer=!1,n.type=e.TEXTURETYPE_UNSIGNED_INT,n.samplingMode=e.TEXTURE_TRILINEAR_SAMPLINGMODE,n.format=e.TEXTUREFORMAT_RGBA),(n.type!==e.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(n.type!==e.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(n.samplingMode=e.TEXTURE_NEAREST_SAMPLINGMODE);var r=this._gl,o=new c.a(this,c.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(r.TEXTURE_2D,o,!0);var a=t.width||t,s=t.height||t,l=this._getSamplingParameters(n.samplingMode,!!n.generateMipMaps);n.type!==e.TEXTURETYPE_FLOAT||this._caps.textureFloat||(n.type=e.TEXTURETYPE_UNSIGNED_INT,d.a.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,l.mag),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,l.min),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(n.type,n.format),a,s,0,this._getInternalFormat(n.format),this._getWebGLTextureType(n.type),null);var u=this._currentFramebuffer,h=r.createFramebuffer();return this._bindUnboundFramebuffer(h),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,o._webGLTexture,0),o._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!n.generateStencilBuffer,n.generateDepthBuffer,a,s),n.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null),r.bindRenderbuffer(r.RENDERBUFFER,null),this._bindUnboundFramebuffer(u),o._framebuffer=h,o.baseWidth=a,o.baseHeight=s,o.width=a,o.height=s,o.isReady=!0,o.samples=1,o.generateMipMaps=!!n.generateMipMaps,o.samplingMode=n.samplingMode,o.type=n.type,o.format=n.format,o._generateDepthBuffer=n.generateDepthBuffer,o._generateStencilBuffer=!!n.generateStencilBuffer,this._internalTexturesCache.push(o),o},e.prototype._setupFramebufferDepthAttachments=function(e,t,i,n,r){void 0===r&&(r=1);var o=null,a=this._gl;return e?(o=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,o),r>1?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.DEPTH24_STENCIL8,i,n):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,i,n),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,o)):t&&(o=a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,o),r>1?a.renderbufferStorageMultisample(a.RENDERBUFFER,r,a.DEPTH_COMPONENT16,i,n):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_COMPONENT16,i,n),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.RENDERBUFFER,o)),o},e.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,this.getCaps().maxMSAASamples),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),t>1){var n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=n,this._bindUnboundFramebuffer(e._MSAAFramebuffer);var r=i.createRenderbuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,r),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,r),e._MSAARenderBuffer=r}else this._bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),i.bindRenderbuffer(i.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),t},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var s=this._gl,c=s.TEXTURE_2D;e.isCube&&(c=s.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(c,a,t,i,n,0,r)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,n,r,o){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=!1);var a=this._gl,s=this._getWebGLTextureType(e.type),c=this._getInternalFormat(e.format),l=void 0===r?this._getRGBABufferInternalSizedFormat(e.type,c):this._getInternalFormat(r);this._unpackFlipY(e.invertY);var u=a.TEXTURE_2D;e.isCube&&(u=a.TEXTURE_CUBE_MAP_POSITIVE_X+i);var h=Math.round(Math.log(e.width)*Math.LOG2E),d=Math.round(Math.log(e.height)*Math.LOG2E),f=o?e.width:Math.pow(2,Math.max(h-n,0)),p=o?e.height:Math.pow(2,Math.max(d-n,0));a.texImage2D(u,n,l,f,p,0,c,s,t)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,n),this._bindTextureDirectly(o,null,!0)},e.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0);var r=this._gl,o=this._getWebGLTextureType(e.type),a=this._getInternalFormat(e.format),s=this._getRGBABufferInternalSizedFormat(e.type,a),c=e.isCube?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D;this._bindTextureDirectly(c,e,!0),this._unpackFlipY(e.invertY);var l=r.TEXTURE_2D;e.isCube&&(l=r.TEXTURE_CUBE_MAP_POSITIVE_X+i),r.texImage2D(l,n,s,a,o,t),this._bindTextureDirectly(c,null,!0)},e.prototype._setCubeMapTextureParams=function(e){var t=this._gl;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,null)},e.prototype.createRawCubeTexture=function(e,t,i,n,r,o,a,s){throw void 0===s&&(s=null),_.a.WarnImport("Engine.RawTexture")},e.prototype.createRawTexture3D=function(t,i,n,r,o,a,s,c,l,u){throw void 0===l&&(l=null),void 0===u&&(u=e.TEXTURETYPE_UNSIGNED_INT),_.a.WarnImport("Engine.RawTexture")},e.prototype._prepareWebGLTextureContinuation=function(e,t,i,n,r){var o=this._gl;if(o){var a=this._getSamplingParameters(r,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,a.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,a.min),i||n||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},e.prototype._prepareWebGLTexture=function(t,i,n,r,o,a,s,c,l){var u=this;void 0===l&&(l=e.TEXTURE_TRILINEAR_SAMPLINGMODE);var h=this.getCaps().maxTextureSize,d=Math.min(h,this.needPOTTextures?e.GetExponentOfTwo(n,h):n),f=Math.min(h,this.needPOTTextures?e.GetExponentOfTwo(r,h):r),p=this._gl;p&&(t._webGLTexture?(this._bindTextureDirectly(p.TEXTURE_2D,t,!0),this._unpackFlipY(void 0===o||!!o),t.baseWidth=n,t.baseHeight=r,t.width=d,t.height=f,t.isReady=!0,c(d,f,function(){u._prepareWebGLTextureContinuation(t,i,a,s,l)})||this._prepareWebGLTextureContinuation(t,i,a,s,l)):i&&i._removePendingData(t))},e.prototype._convertRGBtoRGBATextureData=function(t,i,n,r){var o;o=r===e.TEXTURETYPE_FLOAT?new Float32Array(i*n*4):new Uint32Array(i*n*4);for(var a=0;a-1;return i&&o&&(this._activeChannel=t._associatedChannel),this._boundTexturesCache[this._activeChannel]!==t||n?(this._activateCurrentTexture(),t&&t.isMultiview?this._gl.bindTexture(e,t?t._colorTextureArray:null):this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t,t&&(t._associatedChannel=this._activeChannel)):i&&(r=!0,this._activateCurrentTexture()),o&&!i&&this._bindSamplerUniformToChannel(t._associatedChannel,this._activeChannel),r},e.prototype._bindTexture=function(e,t){void 0!==e&&(t&&(t._associatedChannel=e),this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,t))},e.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},e.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},e.prototype.unbindAllTextures=function(){for(var e=0;e1&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)},e.prototype.setTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},e.prototype.setDepthStencilTexture=function(e,t,i){void 0!==e&&(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0):this._setTexture(e,null))},e.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},e.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},e.prototype._setTexture=function(t,i,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),!i)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(i.video)this._activeChannel=t,i.update();else if(i.delayLoadState===e.DELAYLOADSTATE_NOTLOADED)return i.delayLoad(),!1;var o;o=r?i.depthStencilTexture:i.isReady()?i.getInternalTexture():i.isCube?this.emptyCubeTexture:i.is3D?this.emptyTexture3D:this.emptyTexture,!n&&o&&(o._associatedChannel=t);var a=!0;if(this._boundTexturesCache[t]===o&&(n||this._bindSamplerUniformToChannel(o._associatedChannel,t),a=!1),this._activeChannel=t,o&&o.isMultiview)a&&this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY,o,n);else if(o&&o.is3D)a&&this._bindTextureDirectly(this._gl.TEXTURE_3D,o,n),o&&o._cachedWrapU!==i.wrapU&&(o._cachedWrapU=i.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(i.wrapU),o)),o&&o._cachedWrapV!==i.wrapV&&(o._cachedWrapV=i.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i.wrapV),o)),o&&o._cachedWrapR!==i.wrapR&&(o._cachedWrapR=i.wrapR,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(i.wrapR),o)),this._setAnisotropicLevel(this._gl.TEXTURE_3D,i);else if(o&&o.isCube){if(a&&this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,o,n),o._cachedCoordinatesMode!==i.coordinatesMode){o._cachedCoordinatesMode=i.coordinatesMode;var s=i.coordinatesMode!==e.TEXTURE_CUBIC_MODE&&i.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,s,o),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_T,s)}this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP,i)}else a&&this._bindTextureDirectly(this._gl.TEXTURE_2D,o,n),o&&o._cachedWrapU!==i.wrapU&&(o._cachedWrapU=i.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(i.wrapU),o)),o&&o._cachedWrapV!==i.wrapV&&(o._cachedWrapV=i.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(i.wrapV),o)),this._setAnisotropicLevel(this._gl.TEXTURE_2D,i);return!0},e.prototype.setTextureArray=function(e,t,i){if(void 0!==e&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var n=0;n=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||(this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1)}},e.prototype.releaseEffects=function(){for(var e in this._compiledEffects){var t=this._compiledEffects[e].getPipelineContext();this._deletePipelineContext(t)}this._compiledEffects={}},e.prototype.dispose=function(){for(this.hideLoadingUI(),this.stopRenderLoop(),this.onNewSceneAddedObservable.clear();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();1===e.Instances.length&&e.audioEngine&&e.audioEngine.dispose(),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.disableVR(),h.a.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),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));var t=e.Instances.indexOf(this);t>=0&&e.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(),s.a.ResetCache();for(var i=0,n=this._activeRequests;i-1?a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+n,e._webGLTexture,r):a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,e._webGLTexture,r);var c=void 0!==e.type?this._getWebGLTextureType(e.type):a.UNSIGNED_BYTE;switch(c){case a.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),c=a.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),c=a.FLOAT}return a.readPixels(0,0,t,i,a.RGBA,c,o),a.bindFramebuffer(a.FRAMEBUFFER,this._currentFramebuffer),o},e.prototype._canRenderToFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(e.TEXTURETYPE_FLOAT)},e.prototype._canRenderToHalfFloatFramebuffer=function(){return this._webGLVersion>1?this._caps.colorBufferFloat:this._canRenderToFramebuffer(e.TEXTURETYPE_HALF_FLOAT)},e.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),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 r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var a=t.RGBA,s=t.UNSIGNED_BYTE,c=new Uint8Array(4);t.readPixels(0,0,1,1,a,s,c),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(n),t.deleteFramebuffer(r),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},e.prototype._getWebGLTextureType=function(t){if(1===this._webGLVersion){switch(t){case e.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case e.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case e.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5}return this._gl.UNSIGNED_BYTE}switch(t){case e.TEXTURETYPE_BYTE:return this._gl.BYTE;case e.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case e.TEXTURETYPE_SHORT:return this._gl.SHORT;case e.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case e.TEXTURETYPE_INT:return this._gl.INT;case e.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case e.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case e.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case e.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},e.prototype._getInternalFormat=function(t){var i=this._gl.RGBA;switch(t){case e.TEXTUREFORMAT_ALPHA:i=this._gl.ALPHA;break;case e.TEXTUREFORMAT_LUMINANCE:i=this._gl.LUMINANCE;break;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:i=this._gl.LUMINANCE_ALPHA;break;case e.TEXTUREFORMAT_RED:i=this._gl.RED;break;case e.TEXTUREFORMAT_RG:i=this._gl.RG;break;case e.TEXTUREFORMAT_RGB:i=this._gl.RGB;break;case e.TEXTUREFORMAT_RGBA:i=this._gl.RGBA}if(this._webGLVersion>1)switch(t){case e.TEXTUREFORMAT_RED_INTEGER:i=this._gl.RED_INTEGER;break;case e.TEXTUREFORMAT_RG_INTEGER:i=this._gl.RG_INTEGER;break;case e.TEXTUREFORMAT_RGB_INTEGER:i=this._gl.RGB_INTEGER;break;case e.TEXTUREFORMAT_RGBA_INTEGER:i=this._gl.RGBA_INTEGER}return i},e.prototype._getRGBABufferInternalSizedFormat=function(t,i){if(1===this._webGLVersion){if(void 0!==i)switch(i){case e.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case e.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA}return this._gl.RGBA}switch(t){case e.TEXTURETYPE_BYTE:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case e.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case e.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case e.TEXTURETYPE_UNSIGNED_BYTE:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R8;case e.TEXTUREFORMAT_RG:return this._gl.RG8;case e.TEXTUREFORMAT_RGB:return this._gl.RGB8;case e.TEXTUREFORMAT_RGBA:return this._gl.RGBA8;case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;case e.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case e.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case e.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA;default:return this._gl.RGBA8}case e.TEXTURETYPE_SHORT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case e.TEXTURETYPE_UNSIGNED_SHORT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case e.TEXTURETYPE_INT:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case e.TEXTURETYPE_UNSIGNED_INTEGER:switch(i){case e.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case e.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case e.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case e.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case e.TEXTURETYPE_FLOAT:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R32F;case e.TEXTUREFORMAT_RG:return this._gl.RG32F;case e.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case e.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case e.TEXTURETYPE_HALF_FLOAT:switch(i){case e.TEXTUREFORMAT_RED:return this._gl.R16F;case e.TEXTUREFORMAT_RG:return this._gl.RG16F;case e.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case e.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(i){case e.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case e.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},e.prototype._getRGBAMultiSampleBufferFormat=function(t){return t===e.TEXTURETYPE_FLOAT?this._gl.RGBA32F:t===e.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},e.prototype._loadFile=function(e,t,i,n,r,o){var a=this,s=b.a.LoadFile(e,t,i,n,r,o);return this._activeRequests.push(s),s.onCompleteObservable.add(function(e){a._activeRequests.splice(a._activeRequests.indexOf(e),1)}),s},e.prototype._loadFileAsync=function(e,t,i){var n=this;return new Promise(function(r,o){n._loadFile(e,function(e){r(e)},void 0,t,i,function(e,t){o(t)})})},e.isSupported=function(){try{var e=document.createElement("canvas");return null!=(e.getContext("webgl")||e.getContext("experimental-webgl"))&&!!window.WebGLRenderingContext}catch(e){return!1}},e.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},e.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},e.NearestPOT=function(t){var i=e.CeilingPOT(t),n=e.FloorPOT(t);return i-t>t-n?n:i},e.GetExponentOfTwo=function(t,i,n){var r;switch(void 0===n&&(n=u.a.SCALEMODE_NEAREST),n){case u.a.SCALEMODE_FLOOR:r=e.FloorPOT(t);break;case u.a.SCALEMODE_NEAREST:r=e.NearestPOT(t);break;case u.a.SCALEMODE_CEILING:default:r=e.CeilingPOT(t)}return Math.min(r,i)},e.QueueNewFrame=function(e,t){return h.a.IsWindowObjectExist()?(t||(t=window),t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16)):setTimeout(e,16)},e._RequestPointerlock=function(e){e.requestPointerLock=e.requestPointerLock||e.msRequestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock&&e.requestPointerLock()},e._ExitPointerlock=function(){var e=document;document.exitPointerLock=document.exitPointerLock||e.msExitPointerLock||e.mozExitPointerLock||e.webkitExitPointerLock,document.exitPointerLock&&document.exitPointerLock()},e._RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},e._ExitFullscreen=function(){var e=document;document.exitFullscreen?document.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitCancelFullScreen?e.webkitCancelFullScreen():e.msCancelFullScreen&&e.msCancelFullScreen()},e.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:"Chrome/72.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/73.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Chrome/74.+?Mobile",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/71",capture:null,captureConstraint:null,targets:["vao"]},{key:"Mac OS.+Chrome/72",capture:null,captureConstraint:null,targets:["vao"]}],e._TextureLoaders=[],e.ALPHA_DISABLE=u.a.ALPHA_DISABLE,e.ALPHA_ADD=u.a.ALPHA_ADD,e.ALPHA_COMBINE=u.a.ALPHA_COMBINE,e.ALPHA_SUBTRACT=u.a.ALPHA_SUBTRACT,e.ALPHA_MULTIPLY=u.a.ALPHA_MULTIPLY,e.ALPHA_MAXIMIZED=u.a.ALPHA_MAXIMIZED,e.ALPHA_ONEONE=u.a.ALPHA_ONEONE,e.ALPHA_PREMULTIPLIED=u.a.ALPHA_PREMULTIPLIED,e.ALPHA_PREMULTIPLIED_PORTERDUFF=u.a.ALPHA_PREMULTIPLIED_PORTERDUFF,e.ALPHA_INTERPOLATE=u.a.ALPHA_INTERPOLATE,e.ALPHA_SCREENMODE=u.a.ALPHA_SCREENMODE,e.DELAYLOADSTATE_NONE=u.a.DELAYLOADSTATE_NONE,e.DELAYLOADSTATE_LOADED=u.a.DELAYLOADSTATE_LOADED,e.DELAYLOADSTATE_LOADING=u.a.DELAYLOADSTATE_LOADING,e.DELAYLOADSTATE_NOTLOADED=u.a.DELAYLOADSTATE_NOTLOADED,e.NEVER=u.a.NEVER,e.ALWAYS=u.a.ALWAYS,e.LESS=u.a.LESS,e.EQUAL=u.a.EQUAL,e.LEQUAL=u.a.LEQUAL,e.GREATER=u.a.GREATER,e.GEQUAL=u.a.GEQUAL,e.NOTEQUAL=u.a.NOTEQUAL,e.KEEP=u.a.KEEP,e.REPLACE=u.a.REPLACE,e.INCR=u.a.INCR,e.DECR=u.a.DECR,e.INVERT=u.a.INVERT,e.INCR_WRAP=u.a.INCR_WRAP,e.DECR_WRAP=u.a.DECR_WRAP,e.TEXTURE_CLAMP_ADDRESSMODE=u.a.TEXTURE_CLAMP_ADDRESSMODE,e.TEXTURE_WRAP_ADDRESSMODE=u.a.TEXTURE_WRAP_ADDRESSMODE,e.TEXTURE_MIRROR_ADDRESSMODE=u.a.TEXTURE_MIRROR_ADDRESSMODE,e.TEXTUREFORMAT_ALPHA=u.a.TEXTUREFORMAT_ALPHA,e.TEXTUREFORMAT_LUMINANCE=u.a.TEXTUREFORMAT_LUMINANCE,e.TEXTUREFORMAT_LUMINANCE_ALPHA=u.a.TEXTUREFORMAT_LUMINANCE_ALPHA,e.TEXTUREFORMAT_RGB=u.a.TEXTUREFORMAT_RGB,e.TEXTUREFORMAT_RGBA=u.a.TEXTUREFORMAT_RGBA,e.TEXTUREFORMAT_RED=u.a.TEXTUREFORMAT_RED,e.TEXTUREFORMAT_R=u.a.TEXTUREFORMAT_R,e.TEXTUREFORMAT_RG=u.a.TEXTUREFORMAT_RG,e.TEXTUREFORMAT_RED_INTEGER=u.a.TEXTUREFORMAT_RED_INTEGER,e.TEXTUREFORMAT_R_INTEGER=u.a.TEXTUREFORMAT_R_INTEGER,e.TEXTUREFORMAT_RG_INTEGER=u.a.TEXTUREFORMAT_RG_INTEGER,e.TEXTUREFORMAT_RGB_INTEGER=u.a.TEXTUREFORMAT_RGB_INTEGER,e.TEXTUREFORMAT_RGBA_INTEGER=u.a.TEXTUREFORMAT_RGBA_INTEGER,e.TEXTURETYPE_UNSIGNED_BYTE=u.a.TEXTURETYPE_UNSIGNED_BYTE,e.TEXTURETYPE_UNSIGNED_INT=u.a.TEXTURETYPE_UNSIGNED_INT,e.TEXTURETYPE_FLOAT=u.a.TEXTURETYPE_FLOAT,e.TEXTURETYPE_HALF_FLOAT=u.a.TEXTURETYPE_HALF_FLOAT,e.TEXTURETYPE_BYTE=u.a.TEXTURETYPE_BYTE,e.TEXTURETYPE_SHORT=u.a.TEXTURETYPE_SHORT,e.TEXTURETYPE_UNSIGNED_SHORT=u.a.TEXTURETYPE_UNSIGNED_SHORT,e.TEXTURETYPE_INT=u.a.TEXTURETYPE_INT,e.TEXTURETYPE_UNSIGNED_INTEGER=u.a.TEXTURETYPE_UNSIGNED_INTEGER,e.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=u.a.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4,e.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1,e.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=u.a.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,e.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=u.a.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV,e.TEXTURETYPE_UNSIGNED_INT_24_8=u.a.TEXTURETYPE_UNSIGNED_INT_24_8,e.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=u.a.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV,e.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=u.a.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV,e.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=u.a.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV,e.TEXTURE_NEAREST_SAMPLINGMODE=u.a.TEXTURE_NEAREST_SAMPLINGMODE,e.TEXTURE_BILINEAR_SAMPLINGMODE=u.a.TEXTURE_BILINEAR_SAMPLINGMODE,e.TEXTURE_TRILINEAR_SAMPLINGMODE=u.a.TEXTURE_TRILINEAR_SAMPLINGMODE,e.TEXTURE_NEAREST_NEAREST_MIPLINEAR=u.a.TEXTURE_NEAREST_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR_MIPNEAREST=u.a.TEXTURE_LINEAR_LINEAR_MIPNEAREST,e.TEXTURE_LINEAR_LINEAR_MIPLINEAR=u.a.TEXTURE_LINEAR_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_NEAREST_MIPNEAREST=u.a.TEXTURE_NEAREST_NEAREST_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPNEAREST=u.a.TEXTURE_NEAREST_LINEAR_MIPNEAREST,e.TEXTURE_NEAREST_LINEAR_MIPLINEAR=u.a.TEXTURE_NEAREST_LINEAR_MIPLINEAR,e.TEXTURE_NEAREST_LINEAR=u.a.TEXTURE_NEAREST_LINEAR,e.TEXTURE_NEAREST_NEAREST=u.a.TEXTURE_NEAREST_NEAREST,e.TEXTURE_LINEAR_NEAREST_MIPNEAREST=u.a.TEXTURE_LINEAR_NEAREST_MIPNEAREST,e.TEXTURE_LINEAR_NEAREST_MIPLINEAR=u.a.TEXTURE_LINEAR_NEAREST_MIPLINEAR,e.TEXTURE_LINEAR_LINEAR=u.a.TEXTURE_LINEAR_LINEAR,e.TEXTURE_LINEAR_NEAREST=u.a.TEXTURE_LINEAR_NEAREST,e.TEXTURE_EXPLICIT_MODE=u.a.TEXTURE_EXPLICIT_MODE,e.TEXTURE_SPHERICAL_MODE=u.a.TEXTURE_SPHERICAL_MODE,e.TEXTURE_PLANAR_MODE=u.a.TEXTURE_PLANAR_MODE,e.TEXTURE_CUBIC_MODE=u.a.TEXTURE_CUBIC_MODE,e.TEXTURE_PROJECTION_MODE=u.a.TEXTURE_PROJECTION_MODE,e.TEXTURE_SKYBOX_MODE=u.a.TEXTURE_SKYBOX_MODE,e.TEXTURE_INVCUBIC_MODE=u.a.TEXTURE_INVCUBIC_MODE,e.TEXTURE_EQUIRECTANGULAR_MODE=u.a.TEXTURE_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,e.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=u.a.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,e.SCALEMODE_FLOOR=u.a.SCALEMODE_FLOOR,e.SCALEMODE_NEAREST=u.a.SCALEMODE_NEAREST,e.SCALEMODE_CEILING=u.a.SCALEMODE_CEILING,e.CollisionsEpsilon=.001,e._RescalePostProcessFactory=null,e}()},function(e,t,i){"use strict";i.d(t,"b",function(){return m}),i.d(t,"c",function(){return g}),i.d(t,"a",function(){return v});var n=i(7),r=i(37),o=i(8),a=i(36),s=i(53),c=i(21),l=i(66),u=i(23),h=i(50),d=i(120),f=i(113),p=i(109),_=i(128),m=function(){function e(){}return Object.defineProperty(e,"BaseUrl",{get:function(){return h.a.BaseUrl},set:function(e){h.a.BaseUrl=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultRetryStrategy",{get:function(){return h.a.DefaultRetryStrategy},set:function(e){h.a.DefaultRetryStrategy=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"UseFallbackTexture",{get:function(){return u.a.UseFallbackTexture},set:function(e){u.a.UseFallbackTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"RegisteredExternalClasses",{get:function(){return p.a.RegisteredExternalClasses},set:function(e){p.a.RegisteredExternalClasses=e},enumerable:!0,configurable:!0}),Object.defineProperty(e,"fallbackTexture",{get:function(){return u.a.FallbackTexture},set:function(e){u.a.FallbackTexture=e},enumerable:!0,configurable:!0}),e.FetchToRef=function(e,t,i,n,r,o){var a=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*n%n|0)*i);o.r=r[a]/255,o.g=r[a+1]/255,o.b=r[a+2]/255,o.a=r[a+3]/255},e.Mix=function(e,t,i){return e*(1-i)+t*i},e.Instantiate=function(e){return p.a.Instantiate(e)},e.Slice=function(e,t,i){return e.slice?e.slice(t,i):Array.prototype.slice.call(e,t,i)},e.SetImmediate=function(e){f.a.SetImmediate(e)},e.IsExponentOfTwo=function(e){var t=1;do{t*=2}while(t>2,o=(3&t)<<4|(i=u>4,a=(15&i)<<2|(n=u>6,s=63&n,isNaN(i)?a=s=64:isNaN(n)&&(s=64),l+=c.charAt(r)+c.charAt(o)+c.charAt(a)+c.charAt(s);return"data:image/png;base64,"+l},e.MakeArray=function(e,t){return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},e.GetPointerPrefix=function(){var e="pointer";return!r.a.IsWindowObjectExist()||window.PointerEvent||navigator.pointerEnabled||(e="mouse"),e},e.SetCorsBehavior=function(e,t){h.a.SetCorsBehavior(e,t)},e.CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},Object.defineProperty(e,"PreprocessUrl",{get:function(){return h.a.PreprocessUrl},set:function(e){h.a.PreprocessUrl=e},enumerable:!0,configurable:!0}),e.LoadImage=function(e,t,i,n){return h.a.LoadImage(e,t,i,n)},e.LoadFile=function(e,t,i,n,r,o){return h.a.LoadFile(e,t,i,n,r,o)},e.LoadFileAsync=function(e){return new Promise(function(t,i){h.a.LoadFile(e,function(e){t(e)},void 0,void 0,!0,function(e,t){i(t)})})},e.LoadScript=function(e,t,i,n){if(r.a.IsWindowObjectExist()){var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("src",e),n&&(a.id=n),a.onload=function(){t&&t()},a.onerror=function(t){i&&i("Unable to load script '"+e+"'",t)},o.appendChild(a)}},e.LoadScriptAsync=function(e,t){return new Promise(function(i,n){if(r.a.IsWindowObjectExist()){var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.setAttribute("type","text/javascript"),a.setAttribute("src",e),t&&(a.id=t),a.onload=function(){i(!0)},a.onerror=function(e){i(!1)},o.appendChild(a)}else i(!1)})},e.ReadFileAsDataURL=function(e,t,i){var r=new FileReader,o={onCompleteObservable:new n.c,abort:function(){return r.abort()}};return r.onloadend=function(e){o.onCompleteObservable.notifyObservers(o)},r.onload=function(e){t(e.target.result)},r.onprogress=i,r.readAsDataURL(e),o},e.ReadFile=function(e,t,i,n){return h.a.ReadFile(e,t,i,n)},e.FileAsURL=function(e){var t=new Blob([e]);return(window.URL||window.webkitURL).createObjectURL(t)},e.Format=function(e,t){return void 0===t&&(t=2),e.toFixed(t)},e.DeepCopy=function(e,t,i,n){a.a.DeepCopy(e,t,i,n)},e.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},e.RegisterTopRootEvents=function(e,t){for(var i=0;i=t)break;if(n(a),o&&o()){e.breakLoop();break}}e.executeNext()},a)},r)},e}();u.a.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",d.a.Apply()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.GetClass=function(e){return this.RegisteredTypes&&this.RegisteredTypes[e]?this.RegisteredTypes[e]:null},e.RegisteredTypes={},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(0),r=i(4),o=i(21),a=i(10),s=function(){function e(){}return e.prototype.set=function(e,t){switch(t){case r.b.PositionKind:this.positions=e;break;case r.b.NormalKind:this.normals=e;break;case r.b.TangentKind:this.tangents=e;break;case r.b.UVKind:this.uvs=e;break;case r.b.UV2Kind:this.uvs2=e;break;case r.b.UV3Kind:this.uvs3=e;break;case r.b.UV4Kind:this.uvs4=e;break;case r.b.UV5Kind:this.uvs5=e;break;case r.b.UV6Kind:this.uvs6=e;break;case r.b.ColorKind:this.colors=e;break;case r.b.MatricesIndicesKind:this.matricesIndices=e;break;case r.b.MatricesWeightsKind:this.matricesWeights=e;break;case r.b.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case r.b.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},e.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},e.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},e.prototype.updateMesh=function(e){return this._update(e),this},e.prototype.updateGeometry=function(e){return this._update(e),this},e.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(r.b.PositionKind,this.positions,t),this.normals&&e.setVerticesData(r.b.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(r.b.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(r.b.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(r.b.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(r.b.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(r.b.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(r.b.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(r.b.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(r.b.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(r.b.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(r.b.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(r.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(r.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},e.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(r.b.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(r.b.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(r.b.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(r.b.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(r.b.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(r.b.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(r.b.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(r.b.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(r.b.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(r.b.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(r.b.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(r.b.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(r.b.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(r.b.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},e.prototype.transform=function(e){var t,i=e.m[0]*e.m[5]*e.m[10]<0,r=n.e.Zero();if(this.positions){var o=n.e.Zero();for(t=0;tr.bbSize.y?r.bbSize.x:r.bbSize.y;$=$>r.bbSize.z?$:r.bbSize.z,L=r.subDiv.X*O/r.bbSize.x,w=r.subDiv.Y*O/r.bbSize.y,F=r.subDiv.Z*O/r.bbSize.z,N=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0}for(o=0;o0,t.NUM_MORPH_INFLUENCERS=i.numInfluencers):(t.MORPHTARGETS_UV=!1,t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)},e.PrepareDefinesForAttributes=function(e,t,i,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;if(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(a.b.NormalKind),t._needNormals&&e.isVerticesDataPresent(a.b.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(a.b.UVKind),t.UV2=e.isVerticesDataPresent(a.b.UV2Kind)):(t.UV1=!1,t.UV2=!1),i){var s=e.useVertexColors&&e.isVerticesDataPresent(a.b.ColorKind);t.VERTEXCOLOR=s,t.VERTEXALPHA=e.hasVertexAlpha&&s&&o}return n&&this.PrepareDefinesForBones(e,t),r&&this.PrepareDefinesForMorphTargets(e,t),!0},e.PrepareDefinesForMultiview=function(e,t){if(e.activeCamera){var i=t.MULTIVIEW;t.MULTIVIEW=null!==e.activeCamera.outputRenderTarget&&e.activeCamera.outputRenderTarget.getViewCount()>1,t.MULTIVIEW!=i&&t.markAsUnprocessed()}},e.PrepareDefinesForLight=function(e,t,i,n,r,o,a){switch(a.needNormals=!0,void 0===r["LIGHT"+n]&&(a.needRebuild=!0),r["LIGHT"+n]=!0,r["SPOTLIGHT"+n]=!1,r["HEMILIGHT"+n]=!1,r["POINTLIGHT"+n]=!1,r["DIRLIGHT"+n]=!1,i.prepareLightSpecificDefines(r,n),r["LIGHT_FALLOFF_PHYSICAL"+n]=!1,r["LIGHT_FALLOFF_GLTF"+n]=!1,r["LIGHT_FALLOFF_STANDARD"+n]=!1,i.falloffType){case s.a.FALLOFF_GLTF:r["LIGHT_FALLOFF_GLTF"+n]=!0;break;case s.a.FALLOFF_PHYSICAL:r["LIGHT_FALLOFF_PHYSICAL"+n]=!0;break;case s.a.FALLOFF_STANDARD:r["LIGHT_FALLOFF_STANDARD"+n]=!0}if(o&&!i.specular.equalsFloats(0,0,0)&&(a.specularEnabled=!0),r["SHADOW"+n]=!1,r["SHADOWPCF"+n]=!1,r["SHADOWPCSS"+n]=!1,r["SHADOWPOISSON"+n]=!1,r["SHADOWESM"+n]=!1,r["SHADOWCUBE"+n]=!1,r["SHADOWLOWQUALITY"+n]=!1,r["SHADOWMEDIUMQUALITY"+n]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&i.shadowEnabled){var c=i.getShadowGenerator();if(c){var l=c.getShadowMap();l&&l.renderList&&l.renderList.length>0&&(a.shadowEnabled=!0,c.prepareDefines(r,n))}}i.lightmapMode!=s.a.LIGHTMAP_DEFAULT?(a.lightmapMode=!0,r["LIGHTMAPEXCLUDED"+n]=!0,r["LIGHTMAPNOSPECULAR"+n]=i.lightmapMode==s.a.LIGHTMAP_SHADOWSONLY):(r["LIGHTMAPEXCLUDED"+n]=!1,r["LIGHTMAPNOSPECULAR"+n]=!1)},e.PrepareDefinesForLights=function(e,t,i,n,r,o){if(void 0===r&&(r=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var a=0,s={needNormals:!1,needRebuild:!1,lightmapMode:!1,shadowEnabled:!1,specularEnabled:!1};if(e.lightsEnabled&&!o)for(var c=0,l=t.lightSources;c0&&(r=n+o,t.addFallback(r,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(n,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(n,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(n,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(n,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(n,"SHADOWESM"+o));return r++},e.PrepareAttributesForMorphTargetsInfluencers=function(e,t,i){this._TmpMorphInfluencers.NUM_MORPH_INFLUENCERS=i,this.PrepareAttributesForMorphTargets(e,t,this._TmpMorphInfluencers)},e.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(r>0&&o.a.LastCreatedEngine)for(var s=o.a.LastCreatedEngine.getCaps().maxVertexAttribs,c=t.morphTargetManager,l=c&&c.supportsNormals&&i.NORMAL,u=c&&c.supportsTangents&&i.TANGENT,h=c&&c.supportsUVs&&i.UV1,d=0;ds&&n.a.Error("Cannot add more vertex attributes for mesh "+t.name)},e.PrepareAttributesForBones=function(e,t,i,n){i.NUM_BONE_INFLUENCERS>0&&(n.addCPUSkinningFallback(0,t),e.push(a.b.MatricesIndicesKind),e.push(a.b.MatricesWeightsKind),i.NUM_BONE_INFLUENCERS>4&&(e.push(a.b.MatricesIndicesExtraKind),e.push(a.b.MatricesWeightsExtraKind)))},e.PrepareAttributesForInstances=function(e,t){t.INSTANCES&&this.PushAttributesForInstances(e)},e.PushAttributesForInstances=function(e){e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3")},e.BindLightShadow=function(e,t,i,n){if(e.shadowEnabled&&t.receiveShadows){var r=e.getShadowGenerator();r&&r.bindShadowLight(i,n)}},e.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},e.BindLight=function(t,i,n,r,o,a,s){void 0===s&&(s=!1);var l=i.toString(),u=t.getScaledIntensity();t._uniformBuffer.bindToEffect(o,"Light"+l),e.BindLightProperties(t,o,i),t.diffuse.scaleToRef(u,c.c.Color3[0]),t._uniformBuffer.updateColor4("vLightDiffuse",c.c.Color3[0],s?t.radius:t.range,l),a&&(t.specular.scaleToRef(u,c.c.Color3[1]),t._uniformBuffer.updateColor3("vLightSpecular",c.c.Color3[1],l)),n.shadowsEnabled&&this.BindLightShadow(t,r,l,o),t._uniformBuffer.update()},e.BindLights=function(e,t,i,n,r,o){void 0===r&&(r=4),void 0===o&&(o=!1);for(var a=Math.min(t.lightSources.length,r),s=0;s-1){var n=i.getTransformMatrixTexture(e);t.setTexture("boneSampler",n),t.setFloat("boneTextureWidth",4*(i.bones.length+1))}else{var r=i.getTransformMatrices(e);r&&t.setMatrices("mBones",r)}}},e.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},e.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},e.BindClipPlane=function(e,t){if(t.clipPlane){var i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}},e._TmpMorphInfluencers={NUM_MORPH_INFLUENCERS:0},e._tempFogColor=c.a.Black(),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var n=e-t;return-i<=n&&n<=i},e.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},e.Sign=function(e){return 0===(e=+e)||isNaN(e)?e:e>0?1:-1},e.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,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,i){return(e-t)/(i-t)},e.Denormalize=function(e,t,i){return e*(i-t)+t},e.DeltaAngle=function(t,i){var n=e.Repeat(i-t,360);return n>180&&(n-=360),n},e.PingPong=function(t,i){var n=e.Repeat(t,2*i);return i-Math.abs(n-i)},e.SmoothStep=function(t,i,n){var r=e.Clamp(n);return i*(r=-2*r*r*r+3*r*r)+t*(1-r)},e.MoveTowards=function(t,i,n){return Math.abs(i-t)<=n?i:t+e.Sign(i-t)*n},e.MoveTowardsAngle=function(t,i,n){var r=e.DeltaAngle(t,i),o=0;return-n180&&(r-=360),t+r*e.Clamp(n)},e.InverseLerp=function(t,i,n){return t!=i?e.Clamp((n-t)/(i-t)):0},e.Hermite=function(e,t,i,n,r){var o=r*r,a=r*o;return e*(2*a-3*o+1)+i*(-2*a+3*o)+t*(a-2*o+r)+n*(a-o)},e.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},e.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},e.PercentToRange=function(e,t,i){return(i-t)*e+t},e.NormalizeRadians=function(t){return t-=e.TwoPi*Math.floor((t+Math.PI)/e.TwoPi)},e.TwoPi=2*Math.PI,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(1),r=function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,e.STEP_BEFORECAMERADRAW_LAYER=1,e.STEP_BEFORERENDERTARGETDRAW_LAYER=0,e.STEP_BEFORERENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_AFTERRENDERTARGETDRAW_LAYER=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,e.STEP_AFTERCAMERADRAW_LAYER=3,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e}(),o=function(e){function t(t){return e.apply(this,t)||this}return n.d(t,e),t.Create=function(){return Object.create(t.prototype)},t.prototype.registerStep=function(e,t,i){var n=0;for(Number.MAX_VALUE;ne.LongPressDelay&&!n._isPointerSwiping()&&(n._startingPointerTime=0,o.processTrigger(A.a.ACTION_OnLongPressTrigger,y.a.CreateNew(t.pickedMesh,i)))},e.LongPressDelay)}}else for(var a=0,s=r._pointerDownStage;ae.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>e.DragMovementThreshold},e.prototype.simulatePointerUp=function(e,t,i){var n=new PointerEvent("pointerup",t),r=new I;i?r.doubleClick=!0:r.singleClick=!0,this._checkPrePointerObservable(e,n,C.a.POINTERUP)||this._processPointerUp(e,n,r)},e.prototype._processPointerUp=function(e,t,i){var n=this._scene;if(e&&e&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(n.onPointerPick&&n.onPointerPick(t,e),i.singleClick&&!i.ignore&&n.onPointerObservable.hasObservers())){var r=C.a.POINTERPICK,o=new C.b(r,t,e);this._setRayOnPointerInfo(o),n.onPointerObservable.notifyObservers(o,r)}var a=e.pickedMesh._getActionManagerForTrigger();if(a&&!i.ignore){a.processTrigger(A.a.ACTION_OnPickUpTrigger,y.a.CreateNew(e.pickedMesh,t)),!i.hasSwiped&&i.singleClick&&a.processTrigger(A.a.ACTION_OnPickTrigger,y.a.CreateNew(e.pickedMesh,t));var s=e.pickedMesh._getActionManagerForTrigger(A.a.ACTION_OnDoublePickTrigger);i.doubleClick&&s&&s.processTrigger(A.a.ACTION_OnDoublePickTrigger,y.a.CreateNew(e.pickedMesh,t))}}else if(!i.ignore)for(var c=0,l=n._pointerUpStage;ce.DoubleClickDelay&&!o._doubleClickOccured||t!==o._previousButtonPressed)&&(o._doubleClickOccured=!1,i.singleClick=!0,i.ignore=!1,n(i,o._currentPickResult))},this._initClickEvent=function(t,i,n,r){var a=new I;o._currentPickResult=null;var s=null,c=t.hasSpecificMask(C.a.POINTERPICK)||i.hasSpecificMask(C.a.POINTERPICK)||t.hasSpecificMask(C.a.POINTERTAP)||i.hasSpecificMask(C.a.POINTERTAP)||t.hasSpecificMask(C.a.POINTERDOUBLETAP)||i.hasSpecificMask(C.a.POINTERDOUBLETAP);!c&&M.a&&(s=o._initActionManager(s,a))&&(c=s.hasPickTriggers);var l=!1;if(c){var u=n.button;if(a.hasSwiped=o._isPointerSwiping(),!a.hasSwiped){var h=!e.ExclusiveDoubleClickMode;h||(h=!t.hasSpecificMask(C.a.POINTERDOUBLETAP)&&!i.hasSpecificMask(C.a.POINTERDOUBLETAP))&&!M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(s=o._initActionManager(s,a))&&(h=!s.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),h?(Date.now()-o._previousStartingPointerTime>e.DoubleClickDelay||u!==o._previousButtonPressed)&&(a.singleClick=!0,r(a,o._currentPickResult),l=!0):(o._previousDelayedSimpleClickTimeout=o._delayedSimpleClickTimeout,o._delayedSimpleClickTimeout=window.setTimeout(o._delayedSimpleClick.bind(o,u,a,r),e.DoubleClickDelay));var d=t.hasSpecificMask(C.a.POINTERDOUBLETAP)||i.hasSpecificMask(C.a.POINTERDOUBLETAP);!d&&M.a.HasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)&&(s=o._initActionManager(s,a))&&(d=s.hasSpecificTrigger(A.a.ACTION_OnDoublePickTrigger)),d&&(u===o._previousButtonPressed&&Date.now()-o._previousStartingPointerTime0){for(var e=0,t=this._transientComponents;e0)return!1;for(e=0;e0,r=0,o=this._isReadyForMeshStage;r0)for(var a=0,s=this.activeCameras;a0},enumerable:!0,configurable:!0}),t.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout(function(){t._checkIsReady()},150))},t.prototype.whenReadyAsync=function(){var e=this;return new Promise(function(t){e.executeWhenReady(function(){t()})})},t.prototype._checkIsReady=function(){var e=this;return this._registerTransientComponents(),this.isReady()?(this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):this._isDisposed?(this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1)):void(this._executeWhenReadyTimeoutId=setTimeout(function(){e._checkIsReady()},150))},Object.defineProperty(t.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!0,configurable:!0}),t.prototype.resetLastAnimationTimeFrame=function(){this._animationTimeLast=o.a.Now},t.prototype.getViewMatrix=function(){return this._viewMatrix},t.prototype.getProjectionMatrix=function(){return this._projectionMatrix},t.prototype.getTransformMatrix=function(){return this._transformMatrix},t.prototype.setTransformMatrix=function(e,t,i,n){this._viewUpdateFlag===e.updateFlag&&this._projectionUpdateFlag===t.updateFlag||(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?F.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=F.a.GetPlanes(this._transformMatrix),this._multiviewSceneUbo&&this._multiviewSceneUbo.useUbo?this._updateMultiviewUbo(i,n):this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update()))},t.prototype.getSceneUniformBuffer=function(){return this._multiviewSceneUbo?this._multiviewSceneUbo:this._sceneUbo},t.prototype.getUniqueId=function(){return N.a.UniqueId},t.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this.meshes.push(e),e._resyncLightSources(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(function(e){i.addMesh(e)})},t.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var n=this.meshes.indexOf(e);return-1!==n&&(this.meshes[n]=this.meshes[this.meshes.length-1],this.meshes.pop()),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach(function(e){i.removeMesh(e)}),n},t.prototype.addTransformNode=function(e){e._indexInSceneTransformNodesArray=this.transformNodes.length,this.transformNodes.push(e),this.onNewTransformNodeAddedObservable.notifyObservers(e)},t.prototype.removeTransformNode=function(e){var t=e._indexInSceneTransformNodesArray;if(-1!==t){if(t!==this.transformNodes.length-1){var i=this.transformNodes[this.transformNodes.length-1];this.transformNodes[t]=i,i._indexInSceneTransformNodesArray=t}e._indexInSceneTransformNodesArray=-1,this.transformNodes.pop()}return this.onTransformNodeRemovedObservable.notifyObservers(e),t},t.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&(this.skeletons.splice(t,1),this.onSkeletonRemovedObservable.notifyObservers(e)),t},t.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},t.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,n=this.meshes;i0?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},t.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},t.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},t.prototype.stopAnimation=function(e,t,i){},t.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},t.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),t},t.prototype.removeMaterial=function(e){var t=e._indexInSceneMaterialArray;if(-1!==t&&t=0;t--)if(this.materials[t].id===e)return this.materials[t];return null},t.prototype.getMaterialByName=function(e){for(var t=0;t=0;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},t.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},t.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var i=this.getTransformNodeByID(e);if(i)return i;var n=this.getLightByID(e);if(n)return n;var r=this.getCameraByID(e);if(r)return r;var o=this.getBoneByID(e);return o||null},t.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getTransformNodeByName(e);if(i)return i;var n=this.getLightByName(e);if(n)return n;var r=this.getCameraByName(e);if(r)return r;var o=this.getBoneByName(e);return o||null},t.prototype.getMeshByName=function(e){for(var t=0;t=0;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},t.prototype.getSkeletonByUniqueId=function(e){for(var t=0;t0&&0!=(a.layerMask&this.activeCamera.layerMask)&&(a.alwaysSelectAsActiveMesh||a.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(a),this.activeCamera._activeMeshes.push(a),s!==a&&s._activate(this._renderId,!1),a._activate(this._renderId,!1)&&(a.isAnInstance||(s._internalAbstractMeshDataInfo._onlyForInstances=!1),s._internalAbstractMeshDataInfo._isActive=!0,this._activeMesh(a,s)),a._postActivate()))}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var c=0;c0)for(var r=this.getActiveSubMeshCandidates(t),o=r.length,a=0;a1)this.activeCamera.outputRenderTarget._bindFrameBuffer();else{var e=this.activeCamera.outputRenderTarget.getInternalTexture();e?this.getEngine().bindFramebuffer(e):S.a.Error("Camera contains invalid customDefaultRenderTarget")}}else this.getEngine().restoreDefaultFramebuffer()},t.prototype._renderForCamera=function(e,t){if(!e||!e._skipRendering){var i=this._engine;if(this._activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.getEngine().getCaps().multiview&&e.outputRenderTarget&&e.outputRenderTarget.getViewCount()>1?this.setTransformMatrix(e._rigCameras[0].getViewMatrix(),e._rigCameras[0].getProjectionMatrix(),e._rigCameras[1].getViewMatrix(),e._rigCameras[1].getProjectionMatrix()):this.updateTransformMatrix(),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var n=0;n0&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&t.customRenderTargets.length>0&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var a=0,s=this._gatherActiveCameraRenderTargetsStage;a0){r.b.StartPerformanceCounter("Render targets",this._renderTargets.length>0);for(var l=0;l0),this._renderId++}for(var d=0,f=this._cameraDrawRenderTargetStage;d1&&this.getEngine().getCaps().multiview)return this._renderForCamera(e),void this.onAfterRenderCameraObservable.notifyObservers(e);if(e._useMultiviewToSingleView)this._renderMultiviewToSingleView(e);else for(var t=0;t-1&&(n.trigger===A.a.ACTION_OnIntersectionExitTrigger&&n._executeCurrent(y.a.CreateNew(t,void 0,o)),t.actionManager.hasSpecificTrigger(A.a.ACTION_OnIntersectionExitTrigger,function(e){var t=e instanceof d.a?e:e.mesh;return o===t})&&n.trigger!==A.a.ACTION_OnIntersectionExitTrigger||t._intersectionsInProgress.splice(s,1))}}}},t.prototype._advancePhysicsEngineStep=function(e){},t.prototype._animate=function(){},t.prototype.animate=function(){if(this._engine.isDeterministicLockStep()){var e=Math.max(t.MinDeltaTime,Math.min(this._engine.getDeltaTime(),t.MaxDeltaTime))+this._timeAccumulator,i=this.getDeterministicFrameTime(),n=0,r=this._engine.getLockstepMaxSteps(),o=Math.floor(e/60);o=Math.min(o,r);do{this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=.06*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._advancePhysicsEngineStep(i),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,n++,e-=i}while(e>0&&n0)for(var o=0;o0),this._intermediateRendering=!0;for(var u=0;u0),this._intermediateRendering=!1,this._renderId++}this.activeCamera=l,this._bindFrameBuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this);for(var d=0,p=this._beforeClearStage;d0)for(o=0;o0&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[o]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var g=0,v=this._afterRenderStage;g-1&&this._engine.scenes.splice(r,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.clearCachedVertexData=function(){for(var e=0;e-1?(u.a.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._postProcesses.indexOf(e))},t.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._cascadePostProcessesToRigCams()},t.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()?this._worldMatrix:(this.getViewMatrix(),this._worldMatrix)},t.prototype._getViewMatrix=function(){return c.a.Identity()},t.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()?this._computedViewMatrix:(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childUpdateId++,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.parent&&this.parent.onViewMatrixChangedObservable&&this.parent.onViewMatrixChangedObservable.notifyObservers(this.parent),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix),this._computedViewMatrix)},t.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},t.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},t.prototype.getProjectionMatrix=function(e){if(this._doNotComputeProjectionMatrix||!e&&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===t.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?c.a.PerspectiveFovRHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED):c.a.PerspectiveFovLHToRef(this.fov,i.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===t.FOVMODE_VERTICAL_FIXED);else{var r=i.getRenderWidth()/2,o=i.getRenderHeight()/2;n.useRightHandedSystem?c.a.OrthoOffCenterRHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-o,this.orthoTop||o,this.minZ,this.maxZ,this._projectionMatrix):c.a.OrthoOffCenterLHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-o,this.orthoTop||o,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},t.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},t.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?p.a.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=p.a.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},t.prototype.isInFrustum=function(e,t){if(void 0===t&&(t=!1),this._updateFrustumPlanes(),t&&this.rigCameras.length>0){var i=!1;return this.rigCameras.forEach(function(t){t._updateFrustumPlanes(),i=i||e.isInFrustum(t._frustumPlanes)}),i}return e.isInFrustum(this._frustumPlanes)},t.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},t.prototype.getForwardRay=function(e,t,i){throw void 0===e&&(e=100),d.a.WarnImport("Ray")},t.prototype.dispose=function(i,n){for(void 0===n&&(n=!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 r=this._rigCameras.pop();r&&r.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==t.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var o=this._postProcesses.length;--o>=0;){var a=this._postProcesses[o];a&&a.dispose(this)}for(o=this.customRenderTargets.length;--o>=0;)this.customRenderTargets[o].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),e.prototype.dispose.call(this,i,n)},Object.defineProperty(t.prototype,"isLeftCamera",{get:function(){return this._isLeftCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRightCamera",{get:function(){return this._isRightCamera},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!0,configurable:!0}),t.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},t.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},t.prototype.setCameraRigMode=function(e,i){if(this.cameraRigMode!==e){for(;this._rigCameras.length>0;){var n=this._rigCameras.pop();n&&n.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=i.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=a.b.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==t.RIG_MODE_NONE){var r=this.createRigCamera(this.name+"_L",0);r&&(r._isLeftCamera=!0);var o=this.createRigCamera(this.name+"_R",1);o&&(o._isRightCamera=!0),r&&o&&(this._rigCameras.push(r),this._rigCameras.push(o))}switch(this.cameraRigMode){case t.RIG_MODE_STEREOSCOPIC_ANAGLYPH:t._setStereoscopicAnaglyphRigMode(this);break;case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case t.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case t.RIG_MODE_STEREOSCOPIC_OVERUNDER:t._setStereoscopicRigMode(this);break;case t.RIG_MODE_VR:t._setVRRigMode(this,i);break;case t.RIG_MODE_WEBVR:t._setWebVRRigMode(this,i)}this._cascadePostProcessesToRigCams(),this.update()}},t._setStereoscopicRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicRigMode before using stereoscopic rig mode"},t._setStereoscopicAnaglyphRigMode=function(e){throw"Import Cameras/RigModes/stereoscopicAnaglyphRigMode before using stereoscopic anaglyph rig mode"},t._setVRRigMode=function(e,t){throw"Import Cameras/RigModes/vrRigMode before using VR rig mode"},t._setWebVRRigMode=function(e,t){throw"Import Cameras/RigModes/WebVRRigMode before using Web VR rig mode"},t.prototype._getVRProjectionMatrix=function(){return c.a.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},t.prototype._updateCameraRotationMatrix=function(){},t.prototype._updateWebVRCameraRotationMatrix=function(){},t.prototype._getWebVRProjectionMatrix=function(){return c.a.Identity()},t.prototype._getWebVRViewMatrix=function(){return c.a.Identity()},t.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=a.b.ToRadians(t/.0637))},t.prototype.createRigCamera=function(e,t){return null},t.prototype._updateRigCameras=function(){for(var e=0;es.b.CollisionsEpsilon&&r.position.addInPlace(r._meshCollisionData._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},r.getScene().addMesh(r),r._resyncLightSources(),r}return n.d(t,e),Object.defineProperty(t,"BILLBOARDMODE_NONE",{get:function(){return u.a.BILLBOARDMODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_X",{get:function(){return u.a.BILLBOARDMODE_X},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Y",{get:function(){return u.a.BILLBOARDMODE_Y},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_Z",{get:function(){return u.a.BILLBOARDMODE_Z},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_ALL",{get:function(){return u.a.BILLBOARDMODE_ALL},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BILLBOARDMODE_USE_POSITION",{get:function(){return u.a.BILLBOARDMODE_USE_POSITION},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"facetNb",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetNb},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partitioningSubdivisions",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningSubdivisions=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"partitioningBBoxRatio",{get:function(){return this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio},set:function(e){this._internalAbstractMeshDataInfo._facetData.partitioningBBoxRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mustDepthSortFacets",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSort},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSort=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"facetDepthSortFrom",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom},set:function(e){this._internalAbstractMeshDataInfo._facetData.facetDepthSortFrom=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isFacetDataEnabled",{get:function(){return this._internalAbstractMeshDataInfo._facetData.facetDataEnabled},enumerable:!0,configurable:!0}),t.prototype._updateNonUniformScalingState=function(t){return!!e.prototype._updateNonUniformScalingState.call(this,t)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(t.prototype,"onCollide",{set:function(e){this._meshCollisionData._onCollideObserver&&this.onCollideObservable.remove(this._meshCollisionData._onCollideObserver),this._meshCollisionData._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onCollisionPositionChange",{set:function(e){this._meshCollisionData._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._meshCollisionData._onCollisionPositionChangeObserver),this._meshCollisionData._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"visibility",{get:function(){return this._internalAbstractMeshDataInfo._visibility},set:function(e){this._internalAbstractMeshDataInfo._visibility!==e&&(this._internalAbstractMeshDataInfo._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material&&this._material.meshMap&&(this._material.meshMap[this.uniqueId]=void 0),this._material=e,e&&e.meshMap&&(e.meshMap[this.uniqueId]=this),this.onMaterialChangedObservable.hasObservers&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"receiveShadows",{get:function(){return this._internalAbstractMeshDataInfo._receiveShadows},set:function(e){this._internalAbstractMeshDataInfo._receiveShadows!==e&&(this._internalAbstractMeshDataInfo._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasVertexAlpha",{get:function(){return this._internalAbstractMeshDataInfo._hasVertexAlpha},set:function(e){this._internalAbstractMeshDataInfo._hasVertexAlpha!==e&&(this._internalAbstractMeshDataInfo._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useVertexColors",{get:function(){return this._internalAbstractMeshDataInfo._useVertexColors},set:function(e){this._internalAbstractMeshDataInfo._useVertexColors!==e&&(this._internalAbstractMeshDataInfo._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"computeBonesUsingShaders",{get:function(){return this._internalAbstractMeshDataInfo._computeBonesUsingShaders},set:function(e){this._internalAbstractMeshDataInfo._computeBonesUsingShaders!==e&&(this._internalAbstractMeshDataInfo._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numBoneInfluencers",{get:function(){return this._internalAbstractMeshDataInfo._numBoneInfluencers},set:function(e){this._internalAbstractMeshDataInfo._numBoneInfluencers!==e&&(this._internalAbstractMeshDataInfo._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"applyFog",{get:function(){return this._internalAbstractMeshDataInfo._applyFog},set:function(e){this._internalAbstractMeshDataInfo._applyFog!==e&&(this._internalAbstractMeshDataInfo._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layerMask",{get:function(){return this._internalAbstractMeshDataInfo._layerMask},set:function(e){e!==this._internalAbstractMeshDataInfo._layerMask&&(this._internalAbstractMeshDataInfo._layerMask=e,this._resyncLightSources())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._meshCollisionData._collisionMask},set:function(e){this._meshCollisionData._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collisionGroup",{get:function(){return this._meshCollisionData._collisionGroup},set:function(e){this._meshCollisionData._collisionGroup=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lightSources",{get:function(){return this._lightSources},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_positions",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"skeleton",{get:function(){return this._internalAbstractMeshDataInfo._skeleton},set:function(e){var t=this._internalAbstractMeshDataInfo._skeleton;t&&t.needInitialSkinMatrix&&t._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._internalAbstractMeshDataInfo._skeleton=e,this._internalAbstractMeshDataInfo._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"AbstractMesh"},t.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+("InstancedMesh"!==this.getClassName()?"YES":"NO");t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0);var i=this._internalAbstractMeshDataInfo._skeleton;return i&&(t+=", skeleton: "+i.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingData.freezeWorldMatrix?"YES":"NO")),t},t.prototype._getEffectiveParent=function(){return this._masterMesh&&this.billboardMode!==u.a.BILLBOARDMODE_NONE?this._masterMesh:e.prototype._getEffectiveParent.call(this)},t.prototype._getActionManagerForTrigger=function(e,t){if(void 0===t&&(t=!0),this.actionManager&&(t||this.actionManager.isRecursive)){if(!e)return this.actionManager;if(this.actionManager.hasSpecificTrigger(e))return this.actionManager}return this.parent?this.parent._getActionManagerForTrigger(e,!1):null},t.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e4,s=o?this.getVerticesData(c.b.MatricesIndicesExtraKind):null,l=o?this.getVerticesData(c.b.MatricesWeightsExtraKind):null;this.skeleton.prepare();for(var u=this.skeleton.getTransformMatrices(this),h=a.c.Vector3[0],d=a.c.Matrix[0],f=a.c.Matrix[1],p=0,_=0;_0&&(a.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*i[p+m]),g,f),d.addToSelf(f));if(o)for(m=0;m<4;m++)(g=l[p+m])>0&&(a.a.FromFloat32ArrayToRefScaled(u,Math.floor(16*s[p+m]),g,f),d.addToSelf(f));a.e.TransformCoordinatesFromFloatsToRef(t[_],t[_+1],t[_+2],d,h),h.toArray(t,_),this._positions&&this._positions[_/3].copyFrom(h)}}}return t},t.prototype._updateBoundingInfo=function(){var e=this._effectiveMesh;return this._boundingInfo?this._boundingInfo.update(e.worldMatrixFromCache):this._boundingInfo=new d.a(this.absolutePosition,this.absolutePosition,e.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(e.worldMatrixFromCache),this},t.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i1||!n.IsGlobal)&&n.updateBoundingInfo(e)}return this},t.prototype._afterComputeWorldMatrix=function(){this.doNotSyncBoundingInfo||this._updateBoundingInfo()},Object.defineProperty(t.prototype,"_effectiveMesh",{get:function(){return this.skeleton&&this.skeleton.overrideMesh||this},enumerable:!0,configurable:!0}),t.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},t.prototype.intersectsMesh=function(e,t,i){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(i)for(var n=0,r=this.getChildMeshes();n1&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},t.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=a.c.Matrix[0],i=a.c.Matrix[1];return a.a.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},t.prototype._generatePointsArray=function(){return!1},t.prototype.intersects=function(e,t,i){var n=new h.a,r="InstancedLinesMesh"===this.getClassName()||"LinesMesh"===this.getClassName()?this.intersectionThreshold:0,o=this._boundingInfo;if(!(this.subMeshes&&o&&e.intersectsSphere(o.boundingSphere,r)&&e.intersectsBox(o.boundingBox,r)))return n;if(!this._generatePointsArray())return n;for(var s=null,c=this._scene.getIntersectingSubMeshCandidates(this,e),l=c.length,u=0;u1)||d.canIntersects(e)){var f=d.intersects(e,this._positions,this.getIndices(),t,i);if(f&&(t||!s||f.distance65535){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var u=this.getScene().activeCamera;e.facetDepthSortFrom=u?u.position:a.e.Zero()}e.depthSortedFacets=[];for(var h=0;hv.a?r.maximum.x-r.minimum.x:v.a,e.bbSize.y=r.maximum.y-r.minimum.y>v.a?r.maximum.y-r.minimum.y:v.a,e.bbSize.z=r.maximum.z-r.minimum.z>v.a?r.maximum.z-r.minimum.z:v.a;var f=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(f=f>e.bbSize.z?f:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/f),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/f),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/f),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=r,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),a.e.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,l.a.ComputeNormals(t,i,n,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var p=e.depthSortedIndices.length/3|0;for(h=0;hr.subDiv.max||a<0||a>r.subDiv.max||s<0||s>r.subDiv.max?null:r.facetPartitioning[o+r.subDiv.max*a+r.subDiv.max*r.subDiv.max*s]},t.prototype.getClosestFacetAtCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var s=this.getWorldMatrix(),c=a.c.Matrix[5];s.invertToRef(c);var l=a.c.Vector3[8];a.e.TransformCoordinatesFromFloatsToRef(e,t,i,c,l);var u=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,n,r,o);return n&&a.e.TransformCoordinatesFromFloatsToRef(n.x,n.y,n.z,s,n),u},t.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=!0);var a=null,s=0,c=0,l=0,u=0,h=0,d=0,f=0,p=0,_=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,y,b,T=Number.MAX_VALUE,E=T,A=0;A=0||r&&!o&&u<=0)&&(u=y.x*b.x+y.y*b.y+y.z*b.z,h=-(y.x*e+y.y*t+y.z*i-u)/(y.x*y.x+y.y*y.y+y.z*y.z),(E=(s=(d=e+y.x*h)-e)*s+(c=(f=t+y.y*h)-t)*c+(l=(p=i+y.z*h)-i)*l)100&&(this.soft=!0),this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=o.b.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new o.b),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this.soft&&(this._options.mass=this._options.mass>0?this._options.mass:1,this._options.pressure=void 0===i.pressure?200:i.pressure,this._options.stiffness=void 0===i.stiffness?1:i.stiffness,this._options.velocityIterations=void 0===i.velocityIterations?20:i.velocityIterations,this._options.positionIterations=void 0===i.positionIterations?20:i.positionIterations,this._options.fixedPoints=void 0===i.fixedPoints?0:i.fixedPoints,this._options.margin=void 0===i.margin?0:i.margin,this._options.damping=void 0===i.damping?0:i.damping,this._options.path=void 0===i.path?null:i.path,this._options.shape=void 0===i.shape?null:i.shape),this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&n.a.Warn("You must affect impostors to children before affecting impostor to parent.")):n.a.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):n.a.Error("No object was provided. A physics object is obligatory")}return Object.defineProperty(e.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"friction",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restitution",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pressure",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.setBodyPressure?e.getBodyPressure(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPressure&&t.setBodyPressure(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stiffness",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyStiffness?e.getBodyStiffness(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyStiffness&&t.setBodyStiffness(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"velocityIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyVelocityIterations?e.getBodyVelocityIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyVelocityIterations&&t.setBodyVelocityIterations(this,e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"positionIterations",{get:function(){if(!this._physicsEngine)return 0;var e=this._physicsEngine.getPhysicsPlugin();return e.getBodyPositionIterations?e.getBodyPositionIterations(this):0},set:function(e){if(this._physicsEngine){var t=this._physicsEngine.getPhysicsPlugin();t.setBodyPositionIterations&&t.setBodyPositionIterations(this,e)}},enumerable:!0,configurable:!0}),e.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},e.prototype._getPhysicsParent=function(){return this.object.parent instanceof a.a?this.object.parent.physicsImpostor:null},e.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&!this._parent},e.prototype.setScalingUpdated=function(){this.forceUpdate()},e.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(e.prototype,"physicsBody",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!0,configurable:!0}),e.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},e.prototype.getObjectExtendSize=function(){if(this.object.getBoundingInfo){var t=this.object.rotationQuaternion;this.object.rotationQuaternion=e.IDENTITY_QUATERNION,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);var i=this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2);return this.object.rotationQuaternion=t,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),i}return e.DEFAULT_OBJECT_SIZE},e.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},e.prototype.getParam=function(e){return this._options[e]},e.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},e.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},e.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):o.e.Zero()},e.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},e.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):o.e.Zero()},e.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},e.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},e.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},e.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);t>-1?this._onBeforePhysicsStepCallbacks.splice(t,1):n.a.Warn("Function to remove was not found")},e.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},e.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);t>-1?this._onAfterPhysicsStepCallbacks.splice(t,1):n.a.Warn("Function to remove was not found")},e.prototype.registerOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})},e.prototype.unregisterOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e],r=-1;this._onPhysicsCollideCallbacks.some(function(e,n){if(e.callback===t&&e.otherImpostors.length===i.length){var o=e.otherImpostors.every(function(e){return i.indexOf(e)>-1});return o&&(r=n),o}return!1})?this._onPhysicsCollideCallbacks.splice(r,1):n.a.Warn("Function to remove was not found")},e.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):o.b.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},e.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},e.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},e.prototype.createJoint=function(e,t,i){var n=new c.e(t,i);return this.addJoint(e,n),this},e.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},e.prototype.addAnchor=function(e,t,i,n,r){if(!this._physicsEngine)return this;var o=this._physicsEngine.getPhysicsPlugin();return o.appendAnchor?(this._physicsEngine&&o.appendAnchor(this,e,t,i,n,r),this):this},e.prototype.addHook=function(e,t,i,n){if(!this._physicsEngine)return this;var r=this._physicsEngine.getPhysicsPlugin();return r.appendAnchor?(this._physicsEngine&&r.appendHook(this,e,t,i,n),this):this},e.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},e.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},e.prototype.clone=function(t){return t?new e(t,this.type,this._options,this._scene):null},e.prototype.dispose=function(){var e=this;this._physicsEngine&&(this._joints.forEach(function(t){e._physicsEngine&&e._physicsEngine.removeJoint(e,t.otherImpostor,t.joint)}),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},e.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},e.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new o.b),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},e.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},e.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},e.prototype.syncBoneWithImpostor=function(t,i,n,r,o){var a=e._tmpVecs[0],s=this.object;if(s.rotationQuaternion)if(o){var c=e._tmpQuat;s.rotationQuaternion.multiplyToRef(o,c),t.setRotationQuaternion(c,l.b.WORLD,i)}else t.setRotationQuaternion(s.rotationQuaternion,l.b.WORLD,i);a.x=0,a.y=0,a.z=0,n&&(a.x=n.x,a.y=n.y,a.z=n.z,t.getDirectionToRef(a,i,a),null==r&&(r=n.length()),a.x*=r,a.y*=r,a.z*=r),t.getParent()?(a.addInPlace(s.getAbsolutePosition()),t.setAbsolutePosition(a,i)):(i.setAbsolutePosition(s.getAbsolutePosition()),i.position.x-=a.x,i.position.y-=a.y,i.position.z-=a.z)},e.prototype.syncImpostorWithBone=function(t,i,n,r,o,a){var s=this.object;if(s.rotationQuaternion)if(o){var c=e._tmpQuat;t.getRotationQuaternionToRef(l.b.WORLD,i,c),c.multiplyToRef(o,s.rotationQuaternion)}else t.getRotationQuaternionToRef(l.b.WORLD,i,s.rotationQuaternion);var u=e._tmpVecs[0],h=e._tmpVecs[1];a||((a=e._tmpVecs[2]).x=0,a.y=1,a.z=0),t.getDirectionToRef(a,i,h),t.getAbsolutePositionToRef(i,u),null==r&&n&&(r=n.length()),null!=r&&(u.x+=h.x*r,u.y+=h.y*r,u.z+=h.z*r),s.setAbsolutePosition(u)},e.DEFAULT_OBJECT_SIZE=new o.e(1,1,1),e.IDENTITY_QUATERNION=o.b.Identity(),e._tmpVecs=r.a.BuildArray(3,o.e.Zero),e._tmpQuat=o.b.Identity(),e.NoImpostor=0,e.SphereImpostor=1,e.BoxImpostor=2,e.PlaneImpostor=3,e.MeshImpostor=4,e.CapsuleImpostor=6,e.CylinderImpostor=7,e.ParticleImpostor=8,e.HeightmapImpostor=9,e.ConvexHullImpostor=10,e.RopeImpostor=101,e.ClothImpostor=102,e.SoftbodyImpostor=103,e}()},function(e,t,i){"use strict";var n=i(1),r=i(2),o=i(32),a=i(18),s=i(0),c=i(10),l=i(4),u=i(35),h=i(6),d=i(68),f=i(78),p=i(15),_=i(9),m=i(13),g=i(20),v="uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\nuniform float visibility;\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#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\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";h.a.IncludesShadersStore.defaultFragmentDeclaration=v;var y="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;\nvec2 vTangentSpaceParams;\nfloat pointSize;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nfloat visibility;\nvec4 vDiffuseColor;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};\n";h.a.IncludesShadersStore.defaultUboDeclaration=y;i(63),i(97),i(98),i(138),i(130);var b="#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";h.a.IncludesShadersStore.fresnelFunction=b;i(131),i(99),i(100),i(139),i(110),i(101),i(114),i(102),i(140),i(141),i(132),i(133),i(115);var T="#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\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include\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\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\n#endif\n#include\n#include\n#include\n#include\n#include\n#include\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include\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\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a\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[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\n#include\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\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n";h.a.ShadersStore.defaultPixelShader=T;var E="\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 REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n";h.a.IncludesShadersStore.defaultVertexDeclaration=E;i(72),i(73),i(142),i(111),i(116),i(88),i(89),i(90),i(74),i(75),i(143),i(103),i(134),i(135);h.a.IncludesShadersStore.pointCloudVertex="#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";i(136);var A="#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\n#include\n\n#include\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\n#include\n#include\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include\n#include[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\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#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(positionUpdated,1.0)).xyz;\n#else\nvPositionUVW=positionUpdated;\n#endif\n#endif\n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n#ifdef MULTIVIEW\nif (gl_ViewID_OVR == 0u) {\ngl_Position=viewProjection*worldPos;\n} else {\ngl_Position=viewProjectionR*worldPos;\n}\n#else\ngl_Position=viewProjection*worldPos;\n#endif\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 uvUpdated=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uvUpdated;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,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(uvUpdated,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include\n#include\n#include\n#include[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include\n#include\n#define CUSTOM_VERTEX_MAIN_END\n}\n";h.a.ShadersStore.defaultVertexShader=A;var P=i(3);i.d(t,"b",function(){return S}),i.d(t,"a",function(){return R});var S=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.CLIPPLANE2=!1,t.CLIPPLANE3=!1,t.CLIPPLANE4=!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.BONETEXTURE=!1,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_SKYBOX_TRANSFORMED=!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.MORPHTARGETS_UV=!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.TONEMAPPING_ACES=!1,t.CONTRAST=!1,t.COLORCURVES=!1,t.COLORGRADING=!1,t.COLORGRADING3D=!1,t.SAMPLER3DGREENDEPTH=!1,t.SAMPLER3DBGRMAP=!1,t.IMAGEPROCESSINGPOSTPROCESS=!1,t.MULTIVIEW=!1,t.IS_REFLECTION_LINEAR=!1,t.IS_REFRACTION_LINEAR=!1,t.EXPOSURE=!1,t.rebuild(),t}return n.d(t,e),t.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t0,o.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,o.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===_.a.INVCUBIC_MODE,o.REFLECTIONMAP_3D=this._reflectionTexture.isCube,this._reflectionTexture.coordinatesMode){case _.a.EXPLICIT_MODE:o.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case _.a.PLANAR_MODE:o.setReflectionMode("REFLECTIONMAP_PLANAR");break;case _.a.PROJECTION_MODE:o.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case _.a.SKYBOX_MODE:o.setReflectionMode("REFLECTIONMAP_SKYBOX"),o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!this._reflectionTexture.getReflectionTextureMatrix().isIdentity();break;case _.a.SPHERICAL_MODE:o.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case _.a.EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case _.a.FIXED_EQUIRECTANGULAR_MODE:o.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case _.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case _.a.CUBIC_MODE:case _.a.INVCUBIC_MODE:default:o.setReflectionMode("REFLECTIONMAP_CUBIC")}o.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else o.REFLECTION=!1;if(this._emissiveTexture&&t.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._emissiveTexture,o,"EMISSIVE")}else o.EMISSIVE=!1;if(this._lightmapTexture&&t.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._lightmapTexture,o,"LIGHTMAP"),o.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap}else o.LIGHTMAP=!1;if(this._specularTexture&&t.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;p.a.PrepareDefinesForMergedUV(this._specularTexture,o,"SPECULAR"),o.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else o.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&t.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;p.a.PrepareDefinesForMergedUV(this._bumpTexture,o,"BUMP"),o.PARALLAX=this._useParallax,o.PARALLAXOCCLUSION=this._useParallaxOcclusion,o.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else o.BUMP=!1;if(this._refractionTexture&&t.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;o._needUVs=!0,o.REFRACTION=!0,o.REFRACTIONMAP_3D=this._refractionTexture.isCube}else o.REFRACTION=!1;o.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else o.DIFFUSE=!1,o.AMBIENT=!1,o.OPACITY=!1,o.REFLECTION=!1,o.EMISSIVE=!1,o.LIGHTMAP=!1,o.BUMP=!1,o.REFRACTION=!1;o.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),o.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,o.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,o.SPECULAROVERALPHA=this._useSpecularOverAlpha,o.PREMULTIPLYALPHA=this.alphaMode===P.a.ALPHA_PREMULTIPLIED||this.alphaMode===P.a.ALPHA_PREMULTIPLIED_PORTERDUFF}if(o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(o._areFresnelDirty&&(t.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(o.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,o.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,o.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,o.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,o.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,o.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,o._needNormals=!0,o.FRESNEL=!0):o.FRESNEL=!1),p.a.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),p.a.PrepareDefinesForAttributes(e,o,!0,!0,!0),p.a.PrepareDefinesForFrameBoundValues(r,a,o,n),o.isDirty){o.markAsProcessed();var s=new h.c;o.REFLECTION&&s.addFallback(0,"REFLECTION"),o.SPECULAR&&s.addFallback(0,"SPECULAR"),o.BUMP&&s.addFallback(0,"BUMP"),o.PARALLAX&&s.addFallback(1,"PARALLAX"),o.PARALLAXOCCLUSION&&s.addFallback(0,"PARALLAXOCCLUSION"),o.SPECULAROVERALPHA&&s.addFallback(0,"SPECULAROVERALPHA"),o.FOG&&s.addFallback(1,"FOG"),o.POINTSIZE&&s.addFallback(0,"POINTSIZE"),o.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),p.a.HandleFallbacksForShadows(o,s,this._maxSimultaneousLights),o.SPECULARTERM&&s.addFallback(0,"SPECULARTERM"),o.DIFFUSEFRESNEL&&s.addFallback(1,"DIFFUSEFRESNEL"),o.OPACITYFRESNEL&&s.addFallback(2,"OPACITYFRESNEL"),o.REFLECTIONFRESNEL&&s.addFallback(3,"REFLECTIONFRESNEL"),o.EMISSIVEFRESNEL&&s.addFallback(4,"EMISSIVEFRESNEL"),o.FRESNEL&&s.addFallback(4,"FRESNEL"),o.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");var c=[l.b.PositionKind];o.NORMAL&&c.push(l.b.NormalKind),o.UV1&&c.push(l.b.UVKind),o.UV2&&c.push(l.b.UV2Kind),o.VERTEXCOLOR&&c.push(l.b.ColorKind),p.a.PrepareAttributesForBones(c,e,o,s),p.a.PrepareAttributesForInstances(c,o),p.a.PrepareAttributesForMorphTargets(c,e,o);var d="default",f=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","visibility","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff","boneTextureWidth"],m=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler","boneSampler"],g=["Material","Scene"];u.a&&(u.a.PrepareUniforms(f,o),u.a.PrepareSamplers(m,o)),p.a.PrepareUniformsAndSamplersList({uniformsNames:f,uniformBuffersNames:g,samplers:m,defines:o,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(d=this.customShaderNameResolve(d,f,g,m,o));var v=o.toString(),y=i.effect,b=r.getEngine().createEffect(d,{attributes:c,uniformsNames:f,uniformBuffersNames:g,samplers:m,defines:v,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:o.NUM_MORPH_INFLUENCERS}},a);b&&(this.allowShaderHotSwapping&&y&&!b.isReady()?(b=y,o.markAsUnprocessed()):(r.resetCachedMaterial(),i.setEffect(b,o),this.buildUniformLayout()))}return!(!i.effect||!i.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("diffuseLeftColor",4),e.addUniform("diffuseRightColor",4),e.addUniform("opacityParts",4),e.addUniform("reflectionLeftColor",4),e.addUniform("reflectionRightColor",4),e.addUniform("refractionLeftColor",4),e.addUniform("refractionRightColor",4),e.addUniform("emissiveLeftColor",4),e.addUniform("emissiveRightColor",4),e.addUniform("vDiffuseInfos",2),e.addUniform("vAmbientInfos",2),e.addUniform("vOpacityInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vSpecularInfos",2),e.addUniform("vBumpInfos",3),e.addUniform("diffuseMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("reflectionMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("specularMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("pointSize",1),e.addUniform("refractionMatrix",16),e.addUniform("vRefractionInfos",4),e.addUniform("vSpecularColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),e.addUniform("vDiffuseColor",4),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var s=n.effect;if(s){this._activeEffect=s,o.INSTANCES||this.bindOnlyWorldMatrix(e),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var l=this._mustRebind(r,s,i.visibility);p.a.BindBonesParameters(i,s);var u=this._uniformBuffer;if(l){if(u.bindToEffect(s,"Material"),this.bindViewProjection(s),!u.useUbo||!this.isFrozen||!u.isSync){if(t.FresnelEnabled&&o.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(u.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),u.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&u.updateColor4("opacityParts",new c.a(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(u.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),u.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(u.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),u.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(u.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),u.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&t.DiffuseTextureEnabled&&(u.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),p.a.BindTextureMatrix(this._diffuseTexture,u,"diffuse"),this._diffuseTexture.hasAlpha&&s.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&t.AmbientTextureEnabled&&(u.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),p.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&t.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),p.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),this._reflectionTexture&&t.ReflectionTextureEnabled&&(u.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),u.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var h=this._reflectionTexture;u.updateVector3("vReflectionPosition",h.boundingBoxPosition),u.updateVector3("vReflectionSize",h.boundingBoxSize)}if(this._emissiveTexture&&t.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),p.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&t.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),p.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),this._specularTexture&&t.SpecularTextureEnabled&&(u.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),p.a.BindTextureMatrix(this._specularTexture,u,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),p.a.BindTextureMatrix(this._bumpTexture,u,"bump"),r._mirroredCameraPosition?u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&t.RefractionTextureEnabled){var d=1;this._refractionTexture.isCube||(u.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(d=this._refractionTexture.depth)),u.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,d,this.invertRefractionY?-1:1)}}this.pointsCloud&&u.updateFloat("pointSize",this.pointSize),o.SPECULARTERM&&u.updateColor4("vSpecularColor",this.specularColor,this.specularPower),u.updateColor3("vEmissiveColor",t.EmissiveTextureEnabled?this.emissiveColor:c.a.BlackReadOnly),u.updateFloat("visibility",i.visibility),u.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha)}if(r.texturesEnabled&&(this._diffuseTexture&&t.DiffuseTextureEnabled&&s.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&t.AmbientTextureEnabled&&s.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&t.OpacityTextureEnabled&&s.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&t.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?s.setTexture("reflectionCubeSampler",this._reflectionTexture):s.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&t.EmissiveTextureEnabled&&s.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&t.LightmapTextureEnabled&&s.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&t.SpecularTextureEnabled&&s.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&t.BumpTextureEnabled&&s.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&t.RefractionTextureEnabled)){d=1;this._refractionTexture.isCube?s.setTexture("refractionCubeSampler",this._refractionTexture):s.setTexture("refraction2DSampler",this._refractionTexture)}p.a.BindClipPlane(s,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),p.a.BindEyePosition(s,r),s.setColor3("vAmbientColor",this._globalAmbientColor)}!l&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&p.a.BindLights(r,i,s,o,this._maxSimultaneousLights),(r.fogEnabled&&i.applyFog&&r.fogMode!==a.a.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(s),p.a.BindFogParameters(r,i,s),o.NUM_MORPH_INFLUENCERS&&p.a.BindMorphTargetParameters(i,s),p.a.BindLogDepth(o,s,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),u.update(),this._afterBind(i,this._activeEffect)}}},t.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},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._diffuseTexture&&t.push(this._diffuseTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._specularTexture&&t.push(this._specularTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this._refractionTexture&&t.push(this._refractionTexture),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._diffuseTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._emissiveTexture===t||(this._specularTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||this._refractionTexture===t))))))))},t.prototype.dispose=function(t,i){i&&(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),e.prototype.dispose.call(this,t,i)},t.prototype.clone=function(e){var i=this,n=r.a.Clone(function(){return new t(e,i.getScene())},this);return n.name=e,n.id=e,n},t.prototype.serialize=function(){return r.a.Serialize(this)},t.Parse=function(e,i,n){return r.a.Parse(function(){return new t(e.name,i)},e,i,n)},Object.defineProperty(t,"DiffuseTextureEnabled",{get:function(){return g.a.DiffuseTextureEnabled},set:function(e){g.a.DiffuseTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"AmbientTextureEnabled",{get:function(){return g.a.AmbientTextureEnabled},set:function(e){g.a.AmbientTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"OpacityTextureEnabled",{get:function(){return g.a.OpacityTextureEnabled},set:function(e){g.a.OpacityTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ReflectionTextureEnabled",{get:function(){return g.a.ReflectionTextureEnabled},set:function(e){g.a.ReflectionTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"EmissiveTextureEnabled",{get:function(){return g.a.EmissiveTextureEnabled},set:function(e){g.a.EmissiveTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"SpecularTextureEnabled",{get:function(){return g.a.SpecularTextureEnabled},set:function(e){g.a.SpecularTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"BumpTextureEnabled",{get:function(){return g.a.BumpTextureEnabled},set:function(e){g.a.BumpTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"LightmapTextureEnabled",{get:function(){return g.a.LightmapTextureEnabled},set:function(e){g.a.LightmapTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"RefractionTextureEnabled",{get:function(){return g.a.RefractionTextureEnabled},set:function(e){g.a.RefractionTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"ColorGradingTextureEnabled",{get:function(){return g.a.ColorGradingTextureEnabled},set:function(e){g.a.ColorGradingTextureEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t,"FresnelEnabled",{get:function(){return g.a.FresnelEnabled},set:function(e){g.a.FresnelEnabled=e},enumerable:!0,configurable:!0}),n.c([Object(r.m)("diffuseTexture")],t.prototype,"_diffuseTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"diffuseTexture",void 0),n.c([Object(r.m)("ambientTexture")],t.prototype,"_ambientTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),n.c([Object(r.m)("opacityTexture")],t.prototype,"_opacityTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),n.c([Object(r.m)("reflectionTexture")],t.prototype,"_reflectionTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),n.c([Object(r.m)("emissiveTexture")],t.prototype,"_emissiveTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),n.c([Object(r.m)("specularTexture")],t.prototype,"_specularTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularTexture",void 0),n.c([Object(r.m)("bumpTexture")],t.prototype,"_bumpTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),n.c([Object(r.m)("lightmapTexture")],t.prototype,"_lightmapTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"lightmapTexture",void 0),n.c([Object(r.m)("refractionTexture")],t.prototype,"_refractionTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"refractionTexture",void 0),n.c([Object(r.e)("ambient")],t.prototype,"ambientColor",void 0),n.c([Object(r.e)("diffuse")],t.prototype,"diffuseColor",void 0),n.c([Object(r.e)("specular")],t.prototype,"specularColor",void 0),n.c([Object(r.e)("emissive")],t.prototype,"emissiveColor",void 0),n.c([Object(r.c)()],t.prototype,"specularPower",void 0),n.c([Object(r.c)("useAlphaFromDiffuseTexture")],t.prototype,"_useAlphaFromDiffuseTexture",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFromDiffuseTexture",void 0),n.c([Object(r.c)("useEmissiveAsIllumination")],t.prototype,"_useEmissiveAsIllumination",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useEmissiveAsIllumination",void 0),n.c([Object(r.c)("linkEmissiveWithDiffuse")],t.prototype,"_linkEmissiveWithDiffuse",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"linkEmissiveWithDiffuse",void 0),n.c([Object(r.c)("useSpecularOverAlpha")],t.prototype,"_useSpecularOverAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),n.c([Object(r.c)("useReflectionOverAlpha")],t.prototype,"_useReflectionOverAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useReflectionOverAlpha",void 0),n.c([Object(r.c)("disableLighting")],t.prototype,"_disableLighting",void 0),n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),n.c([Object(r.c)("useObjectSpaceNormalMap")],t.prototype,"_useObjectSpaceNormalMap",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),n.c([Object(r.c)("useParallax")],t.prototype,"_useParallax",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),n.c([Object(r.c)("useParallaxOcclusion")],t.prototype,"_useParallaxOcclusion",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),n.c([Object(r.c)()],t.prototype,"parallaxScaleBias",void 0),n.c([Object(r.c)("roughness")],t.prototype,"_roughness",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),n.c([Object(r.c)()],t.prototype,"indexOfRefraction",void 0),n.c([Object(r.c)()],t.prototype,"invertRefractionY",void 0),n.c([Object(r.c)()],t.prototype,"alphaCutOff",void 0),n.c([Object(r.c)("useLightmapAsShadowmap")],t.prototype,"_useLightmapAsShadowmap",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),n.c([Object(r.h)("diffuseFresnelParameters")],t.prototype,"_diffuseFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"diffuseFresnelParameters",void 0),n.c([Object(r.h)("opacityFresnelParameters")],t.prototype,"_opacityFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelAndMiscDirty")],t.prototype,"opacityFresnelParameters",void 0),n.c([Object(r.h)("reflectionFresnelParameters")],t.prototype,"_reflectionFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"reflectionFresnelParameters",void 0),n.c([Object(r.h)("refractionFresnelParameters")],t.prototype,"_refractionFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"refractionFresnelParameters",void 0),n.c([Object(r.h)("emissiveFresnelParameters")],t.prototype,"_emissiveFresnelParameters",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"emissiveFresnelParameters",void 0),n.c([Object(r.c)("useReflectionFresnelFromSpecular")],t.prototype,"_useReflectionFresnelFromSpecular",void 0),n.c([Object(r.b)("_markAllSubMeshesAsFresnelDirty")],t.prototype,"useReflectionFresnelFromSpecular",void 0),n.c([Object(r.c)("useGlossinessFromSpecularMapAlpha")],t.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useGlossinessFromSpecularMapAlpha",void 0),n.c([Object(r.c)("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),n.c([Object(r.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),n.c([Object(r.c)("invertNormalMapX")],t.prototype,"_invertNormalMapX",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),n.c([Object(r.c)("invertNormalMapY")],t.prototype,"_invertNormalMapY",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),n.c([Object(r.c)("twoSidedLighting")],t.prototype,"_twoSidedLighting",void 0),n.c([Object(r.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),n.c([Object(r.c)()],t.prototype,"useLogarithmicDepth",null),t}(f.a);m.a.RegisteredTypes["BABYLON.StandardMaterial"]=R,a.a.DefaultMaterialFactory=function(e){return new R("default material",e)}},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o});var n=i(1),r=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;tthis.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t=this.length?-1:t},e.prototype.contains=function(e){return-1!==this.indexOf(e)},e._GlobalId=0,e}(),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._duplicateId=0,t}return n.d(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;t0)if("object"==typeof a[0])for(var c=0;cl.x)return!1}else if(r=1/this.direction.x,o=(c.x-this.origin.x)*r,(a=(l.x-this.origin.x)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.yl.y)return!1}else if(r=1/this.direction.y,o=(c.y-this.origin.y)*r,(a=(l.y-this.origin.y)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.zl.z)return!1}else if(r=1/this.direction.z,o=(c.z-this.origin.z)*r,(a=(l.z-this.origin.z)*r)===-1/0&&(a=1/0),o>a&&(s=o,o=a,a=s),(u=Math.max(o,u))>(h=Math.min(a,h)))return!1;return!0},e.prototype.intersectsBox=function(e,t){return void 0===t&&(t=0),this.intersectsBoxMinMax(e.minimum,e.maximum,t)},e.prototype.intersectsSphere=function(e,t){void 0===t&&(t=0);var i=e.center.x-this.origin.x,n=e.center.y-this.origin.y,r=e.center.z-this.origin.z,o=i*i+n*n+r*r,a=e.radius+t,s=a*a;if(o<=s)return!0;var c=i*this.direction.x+n*this.direction.y+r*this.direction.z;return!(c<0)&&o-c*c<=s},e.prototype.intersectsTriangle=function(t,i,n){var o=e.TmpVector3[0],s=e.TmpVector3[1],c=e.TmpVector3[2],l=e.TmpVector3[3],u=e.TmpVector3[4];i.subtractToRef(t,o),n.subtractToRef(t,s),r.e.CrossToRef(this.direction,s,c);var h=r.e.Dot(o,c);if(0===h)return null;var d=1/h;this.origin.subtractToRef(t,l);var f=r.e.Dot(l,c)*d;if(f<0||f>1)return null;r.e.CrossToRef(l,o,u);var p=r.e.Dot(this.direction,u)*d;if(p<0||f+p>1)return null;var _=r.e.Dot(s,u)*d;return _>this.length?null:new a.a(1-f-p,f,_)},e.prototype.intersectsPlane=function(e){var t,i=r.e.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var n=r.e.Dot(e.normal,this.origin);return(t=(-e.d-n)/i)<0?t<-9.99999997475243e-7?null:0:t},e.prototype.intersectsAxis=function(e,t){switch(void 0===t&&(t=0),e){case"y":return(i=(this.origin.y-t)/this.direction.y)>0?null:new r.e(this.origin.x+this.direction.x*-i,t,this.origin.z+this.direction.z*-i);case"x":return(i=(this.origin.x-t)/this.direction.x)>0?null:new r.e(t,this.origin.y+this.direction.y*-i,this.origin.z+this.direction.z*-i);case"z":var i;return(i=(this.origin.z-t)/this.direction.z)>0?null:new r.e(this.origin.x+this.direction.x*-i,this.origin.y+this.direction.y*-i,t);default:return null}},e.prototype.intersectsMesh=function(t,i){var n=r.c.Matrix[0];return t.getWorldMatrix().invertToRef(n),this._tmpRay?e.TransformToRef(this,n,this._tmpRay):this._tmpRay=e.Transform(this,n),t.intersects(this._tmpRay,i)},e.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var n=0;nt.distance?1:0},e.prototype.intersectionSegment=function(t,i,n){var o=this.origin,a=r.c.Vector3[0],s=r.c.Vector3[1],c=r.c.Vector3[2],l=r.c.Vector3[3];i.subtractToRef(t,a),this.direction.scaleToRef(e.rayl,c),o.addToRef(c,s),t.subtractToRef(o,l);var u,h,d,f,p=r.e.Dot(a,a),_=r.e.Dot(a,c),m=r.e.Dot(c,c),g=r.e.Dot(a,l),v=r.e.Dot(c,l),y=p*m-_*_,b=y,T=y;yb&&(h=b,f=v+_,T=m)),f<0?(f=0,-g<0?h=0:-g>p?h=b:(h=-g,b=p)):f>T&&(f=T,-g+_<0?h=0:-g+_>p?h=b:(h=-g+_,b=p)),u=Math.abs(h)0&&d<=this.length&&P.lengthSquared()=r.distance))&&(r=l,i)))break}return r||new o.a},s.a.prototype._internalMultiPick=function(e,t,i){if(!o.a)return null;for(var n=new Array,r=0;r0)):!i._pointerCaptures[c.pointerId]&&a.distance>s.distance&&(i.mainSceneTrackerPredicate&&i.mainSceneTrackerPredicate(s.pickedMesh)?(i._notifyObservers(t,s,c),t.skipOnPointerObservable=!0):i._lastPointerEvents[c.pointerId]&&(i.onPointerOutObservable.notifyObservers(c.pointerId),delete i._lastPointerEvents[c.pointerId])),t.type===o.a.POINTERUP&&i._pointerCaptures[c.pointerId]&&(i._pointerCaptures[c.pointerId]=!1))}}}}),this._originalPointerObserver&&e.onPrePointerObservable.makeObserverTopPriority(this._originalPointerObserver)),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterCameraRenderObservable.add(function(e){i.shouldRender&&e==i.getRenderCamera()&&i.render()}),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add(function(){i.dispose()}),this._updateCamera()}return e.prototype.getRenderCamera=function(){return this._renderCamera?this._renderCamera:this.originalScene.activeCameras.length>1?this.originalScene.activeCameras[this.originalScene.activeCameras.length-1]:this.originalScene.activeCamera},e.prototype.setRenderCamera=function(e){this._renderCamera=e},e.prototype._getSharedGizmoLight=function(){return this._sharedGizmoLight||(this._sharedGizmoLight=new s.a("shared gizmo light",new c.e(0,1,0),this.utilityLayerScene),this._sharedGizmoLight.intensity=2,this._sharedGizmoLight.groundColor=l.a.Gray()),this._sharedGizmoLight},Object.defineProperty(e,"DefaultUtilityLayer",{get:function(){return null==e._DefaultUtilityLayer&&(e._DefaultUtilityLayer=new e(a.a.LastCreatedScene),e._DefaultUtilityLayer.originalScene.onDisposeObservable.addOnce(function(){e._DefaultUtilityLayer=null})),e._DefaultUtilityLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultKeepDepthUtilityLayer",{get:function(){return null==e._DefaultKeepDepthUtilityLayer&&(e._DefaultKeepDepthUtilityLayer=new e(a.a.LastCreatedScene),e._DefaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce(function(){e._DefaultKeepDepthUtilityLayer=null})),e._DefaultKeepDepthUtilityLayer},enumerable:!0,configurable:!0}),e.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new o.b(e.type,e.event,t)),this._lastPointerEvents[i.pointerId]=!0)},e.prototype.render=function(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){var e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}},e.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterCameraRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},e.prototype._updateCamera=function(){this.utilityLayerScene.cameraToUseForPointers=this.getRenderCamera(),this.utilityLayerScene.activeCamera=this.getRenderCamera()},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(1),r=i(2),o=i(0),a=i(10),s=i(27),c=i(76),l=i(13),u=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.diffuse=new a.a(1,1,1),r.specular=new a.a(1,1,1),r.falloffType=t.FALLOFF_DEFAULT,r.intensity=1,r._range=Number.MAX_VALUE,r._inverseSquaredRange=0,r._photometricScale=1,r._intensityMode=t.INTENSITYMODE_AUTOMATIC,r._radius=1e-5,r.renderPriority=0,r._shadowEnabled=!0,r._excludeWithLayerMask=0,r._includeOnlyWithLayerMask=0,r._lightmapMode=0,r._excludedMeshesIds=new Array,r._includedOnlyMeshesIds=new Array,r._isLight=!0,r.getScene().addLight(r),r._uniformBuffer=new c.a(r.getScene().getEngine()),r._buildUniformLayout(),r.includedOnlyMeshes=new Array,r.excludedMeshes=new Array,r._resyncMeshes(),r}return n.d(t,e),Object.defineProperty(t.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"Light"},t.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i0&&-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)))},t.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var n=0,r=this.getScene().meshes;n0&&(e.excludedMeshesIds=[],this.excludedMeshes.forEach(function(t){e.excludedMeshesIds.push(t.id)})),this.includedOnlyMeshes.length>0&&(e.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach(function(t){e.includedOnlyMeshesIds.push(t.id)})),r.a.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},t.GetConstructorFromName=function(e,t,i){var n=s.a.Construct("Light_Type_"+e,t,i);return n||null},t.Parse=function(e,i){var n=t.GetConstructorFromName(e.type,e.name,i);if(!n)return null;var o=r.a.Parse(n,e,i);if(e.excludedMeshesIds&&(o._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(o._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(o._waitingParentId=e.parentId),void 0!==e.falloffType&&(o.falloffType=e.falloffType),void 0!==e.lightmapMode&&(o.lightmapMode=e.lightmapMode),e.animations){for(var a=0;a0&&(t.push(s-1),t.push(s)),s++}var d=new o.a;return d.indices=t,d.positions=i,r&&(d.colors=a),d},o.a.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,a=e.gapSize||1,s=e.dashNb||200,c=e.points,l=new Array,u=new Array,h=n.e.Zero(),d=0,f=0,p=0,_=0,m=0;for(m=0;ml.max||l.min>c.max)},d=function(){function e(e,t,i){this._isLocked=!1,this.boundingBox=new a.a(e,t,i),this.boundingSphere=new s.a(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.boundingBox.reConstruct(e,t,i),this.boundingSphere.reConstruct(e,t,i)},Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(t,i){var n=e.TmpVector3[0].copyFrom(t).subtractInPlace(i),r=e.TmpVector3[1].copyFrom(t).addInPlace(i);return this.boundingBox.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this.boundingSphere.reConstruct(n,r,this.boundingBox.getWorldMatrix()),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=o.a.MESHES_CULLINGSTRATEGY_STANDARD),!(t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION&&t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY||!this.boundingSphere.isCenterInFrustum(e))||!!this.boundingSphere.isInFrustum(e)&&(!(t!==o.a.MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY&&t!==o.a.MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY)||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var t=this.boundingBox;return t.maximumWorld.subtractToRef(t.minimumWorld,e.TmpVector3[0]).length()},enumerable:!0,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},e.prototype.intersects=function(e,t){if(!s.a.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!a.a.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,n=e.boundingBox;return!!h(i.directions[0],i,n)&&(!!h(i.directions[1],i,n)&&(!!h(i.directions[2],i,n)&&(!!h(n.directions[0],i,n)&&(!!h(n.directions[1],i,n)&&(!!h(n.directions[2],i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[1]),i,n)&&(!!h(r.e.Cross(i.directions[0],n.directions[2]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[1]),i,n)&&(!!h(r.e.Cross(i.directions[1],n.directions[2]),i,n)&&(!!h(r.e.Cross(i.directions[2],n.directions[0]),i,n)&&(!!h(r.e.Cross(i.directions[2],n.directions[1]),i,n)&&!!h(r.e.Cross(i.directions[2],n.directions[2]),i,n))))))))))))))},e.TmpVector3=n.a.BuildArray(2,r.e.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(53),r=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,i){e.Enabled&&(this._current+=t,i&&this._fetchResult())},e.prototype.beginMonitoring=function(){e.Enabled&&(this._startMonitoringTime=n.a.Now)},e.prototype.endMonitoring=function(t){if(void 0===t&&(t=!0),e.Enabled){t&&this.fetchNewFrame();var i=n.a.Now;this._current=i-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=n.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}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(5),o=i(14);o.a.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,a=e.diameterZ||e.diameter||1,s=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,c=e.slice&&e.slice<=0?1:e.slice||1,l=0===e.sideOrientation?0:e.sideOrientation||o.a.DEFAULTSIDE,u=new n.e(i/2,r/2,a/2),h=2+t,d=2*h,f=[],p=[],_=[],m=[],g=0;g<=h;g++){for(var v=g/h,y=v*Math.PI*c,b=0;b<=d;b++){var T=b/d,E=T*Math.PI*2*s,A=n.a.RotationZ(-y),P=n.a.RotationY(E),S=n.e.TransformCoordinates(n.e.Up(),A),R=n.e.TransformCoordinates(S,P),x=R.multiply(u),C=R.divide(u).normalize();p.push(x.x,x.y,x.z),_.push(C.x,C.y,C.z),m.push(T,v)}if(g>0)for(var M=p.length/3,O=M-2*(d+1);O+d+2=0&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),void 0!==this._texture&&(this.releaseInternalTexture(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear())}},e.prototype.serialize=function(){if(!this.name)return null;var e=r.a.Serialize(this);return r.a.AppendSerializedAnimations(this,e),e},e.WhenAllReady=function(e,t){var i=e.length;if(0!==i)for(var n,r,o=function(){if((n=e[a]).isReady())0==--i&&t();else{r=n.onLoadObservable;var o=function(){r.removeCallback(o),0==--i&&t()};r.add(o)}},a=0;a=200&&e.status<300||0===e.status&&(!o.a.IsWindowObjectExist()||h.IsFileURL()))return void t(l?e.response:e.responseText,e.responseURL);var i=h.DefaultRetryStrategy;if(i){var _=i(f,e,c);if(-1!==_)return e.removeEventListener("loadend",d),e=new n.a,void(a=setTimeout(function(){return s(c+1)},_))}var g=new r.a("Error status: "+e.status+" "+e.statusText+" - Unable to load "+f,e);if(!u)throw g;u(e,g)}};e.addEventListener("readystatechange",m),e.send()};s(0)};if(c&&c.enableSceneOffline){var g=function(e){e&&e.status>400?u&&u(e):p||m()};c.open(function(){p||c&&c.loadFile(e,function(e){p||t(e),_.onCompleteObservable.notifyObservers(_)},i?function(e){p||i(e)}:void 0,g,l)},g)}else m();return _},e.IsFileURL=function(){return"file:"===location.protocol},e.DefaultRetryStrategy=c.a.ExponentialBackoff(),e.BaseUrl="",e.CorsBehavior="anonymous",e.PreprocessUrl=function(e){return e},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){function e(){}return e._RemoveAndStorePivotPoint=function(t){t&&0===e._PivotCached&&(t.getPivotPointToRef(e._OldPivotPoint),e._OldPivotPoint.equalsToFloats(0,0,0)||(t.setPivotMatrix(n.a.IdentityReadOnly),e._OldPivotPoint.subtractToRef(t.getPivotPoint(),e._PivotTranslation),e._PivotTmpVector.copyFromFloats(1,1,1),e._PivotTmpVector.subtractInPlace(t.scaling),e._PivotTmpVector.multiplyInPlace(e._PivotTranslation),t.position.addInPlace(e._PivotTmpVector))),e._PivotCached++},e._RestorePivotPoint=function(t){t&&!e._OldPivotPoint.equalsToFloats(0,0,0)&&1===e._PivotCached&&(t.setPivotPoint(e._OldPivotPoint),e._PivotTmpVector.copyFromFloats(1,1,1),e._PivotTmpVector.subtractInPlace(t.scaling),e._PivotTmpVector.multiplyInPlace(e._PivotTranslation),t.position.subtractInPlace(e._PivotTmpVector)),this._PivotCached--},e._PivotCached=0,e._OldPivotPoint=new n.e,e._PivotTranslation=new n.e,e._PivotTmpVector=new n.e,e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(0),r=i(5),o=i(43),a=function(){function e(e){var t=this;void 0===e&&(e=o.a.DefaultUtilityLayer),this.gizmoLayer=e,this._attachedMesh=null,this.scaleRatio=1,this._customMeshSet=!1,this.updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this.updateScale=!0,this._interactionsEnabled=!0,this._tempVector=new n.e,this._rootMesh=new r.a("gizmoRootNode",e.utilityLayerScene),this._rootMesh.rotationQuaternion=n.b.Identity(),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add(function(){t._update()})}return Object.defineProperty(e.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){this._attachedMesh=e,this._rootMesh.setEnabled(!!e),this._attachedMeshChanged(e)},enumerable:!0,configurable:!0}),e.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach(function(e){e.dispose()}),e.parent=this._rootMesh,this._customMeshSet=!0},e.prototype._attachedMeshChanged=function(e){},e.prototype._update=function(){if(this.attachedMesh){var e=this.attachedMesh._effectiveMesh||this.attachedMesh;if(this.updateGizmoPositionToMatchAttachedMesh&&this._rootMesh.position.copyFrom(e.absolutePosition),this.updateGizmoRotationToMatchAttachedMesh?e.getWorldMatrix().decompose(void 0,this._rootMesh.rotationQuaternion):this._rootMesh.rotationQuaternion.set(0,0,0,1),this.updateScale){var t=this.gizmoLayer.utilityLayerScene.activeCamera,i=t.globalPosition;t.devicePosition&&(i=t.devicePosition),this._rootMesh.position.subtractToRef(i,this._tempVector);var n=this._tempVector.length()*this.scaleRatio;this._rootMesh.scaling.set(n,n,n),e._getWorldMatrixDeterminant()<0&&(this._rootMesh.scaling.y*=-1)}else this._rootMesh.scaling.setAll(this.scaleRatio)}},e.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(37),r=function(){function e(){}return Object.defineProperty(e,"Now",{get:function(){return n.a.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!0,configurable:!0}),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(0),r=i(4),o=function(){function e(){this._pickingUnavailable=!1,this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshId=0,this.pickedSprite=null,this.originMesh=null,this.ray=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.b.NormalKind))return null;var i,o=this.pickedMesh.getIndices();if(!o)return null;if(t){var a=this.pickedMesh.getVerticesData(r.b.NormalKind),s=n.e.FromArray(a,3*o[3*this.faceId]),c=n.e.FromArray(a,3*o[3*this.faceId+1]),l=n.e.FromArray(a,3*o[3*this.faceId+2]);s=s.scale(this.bu),c=c.scale(this.bv),l=l.scale(1-this.bu-this.bv),i=new n.e(s.x+c.x+l.x,s.y+c.y+l.y,s.z+c.z+l.z)}else{var u=this.pickedMesh.getVerticesData(r.b.PositionKind),h=n.e.FromArray(u,3*o[3*this.faceId]),d=n.e.FromArray(u,3*o[3*this.faceId+1]),f=n.e.FromArray(u,3*o[3*this.faceId+2]),p=h.subtract(d),_=f.subtract(d);i=n.e.Cross(p,_)}if(e){var m=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(n.c.Matrix[0].copyFrom(m),(m=n.c.Matrix[0]).setTranslationFromFloats(0,0,0),m.invert(),m.transposeToRef(n.c.Matrix[1]),m=n.c.Matrix[1]),i=n.e.TransformNormal(i,m)}return i.normalize(),i},e.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(r.b.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(r.b.UVKind);if(!t)return null;var i=n.d.FromArray(t,2*e[3*this.faceId]),o=n.d.FromArray(t,2*e[3*this.faceId+1]),a=n.d.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(this.bu),o=o.scale(this.bv),a=a.scale(1-this.bu-this.bv),new n.d(i.x+o.x+a.x,i.y+o.y+a.y)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return l}),i.d(t,"b",function(){return u});var n=i(1),r=i(4),o=i(96),a=i(46),s=i(3),c=i(106),l=function(){function e(){this._materialDefines=null,this._materialEffect=null}return Object.defineProperty(e.prototype,"effect",{get:function(){return this._materialEffect},enumerable:!0,configurable:!0}),e.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},e}(),u=function(e){function t(t,i,n,r,o,a,s,c){void 0===c&&(c=!0);var l=e.call(this)||this;return l.materialIndex=t,l.verticesStart=i,l.verticesCount=n,l.indexStart=r,l.indexCount=o,l._linesIndexCount=0,l._linesIndexBuffer=null,l._lastColliderWorldVertices=null,l._lastColliderTransformMatrix=null,l._renderId=0,l._alphaIndex=0,l._distanceToCamera=0,l._currentMaterial=null,l._mesh=a,l._renderingMesh=s||a,a.subMeshes.push(l),l._trianglePlanes=[],l._id=a.subMeshes.length-1,c&&(l.refreshBoundingInfo(),a.computeWorldMatrix(!0)),l}return n.d(t,e),t.AddToMesh=function(e,i,n,r,o,a,s,c){return void 0===c&&(c=!0),new t(e,i,n,r,o,a,s,c)},Object.defineProperty(t.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!0,configurable:!0}),t.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},t.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},t.prototype.getMesh=function(){return this._mesh},t.prototype.getRenderingMesh=function(){return this._renderingMesh},t.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(e.getSubMaterial){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},t.prototype.refreshBoundingInfo=function(e){if(void 0===e&&(e=null),this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;if(e||(e=this._renderingMesh.getVerticesData(r.b.PositionKind)),!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var n=this._renderingMesh.getBoundingInfo();t={minimum:n.minimum.clone(),maximum:n.maximum.clone()}}else t=Object(c.b)(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo?this._boundingInfo.reConstruct(t.minimum,t.maximum):this._boundingInfo=new a.a(t.minimum,t.maximum),this},t.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},t.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t.update(e),this},t.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},t.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},t.prototype.render=function(e){return this._renderingMesh.render(this,e),this},t.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],n=this.indexStart;ns&&(s=u)}return new t(e,a,s-a+1,i,n,r,o)},t}(l)},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){function e(e,t,i,r){this.normal=new n.e(e,t,i),this.d=r}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^(0|this.d)},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 i=e._TmpMatrix;n.a.TransposeToRef(t,i);var r=i.m,o=this.normal.x,a=this.normal.y,s=this.normal.z,c=this.d;return new e(o*r[0]+a*r[1]+s*r[2]+c*r[3],o*r[4]+a*r[5]+s*r[6]+c*r[7],o*r[8]+a*r[9]+s*r[10]+c*r[11],o*r[12]+a*r[13]+s*r[14]+c*r[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,i){var n,r=t.x-e.x,o=t.y-e.y,a=t.z-e.z,s=i.x-e.x,c=i.y-e.y,l=i.z-e.z,u=o*l-a*c,h=a*s-r*l,d=r*c-o*s,f=Math.sqrt(u*u+h*h+d*d);return n=0!==f?1/f:0,this.normal.x=u*n,this.normal.y=h*n,this.normal.z=d*n,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.e.Dot(this.normal,e)<=t},e.prototype.signedDistanceTo=function(e){return n.e.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,i,n){var r=new e(0,0,0,0);return r.copyFromPoints(t,i,n),r},e.FromPositionAndNormal=function(t,i){var n=new e(0,0,0,0);return i.normalize(),n.normal=i,n.d=-(i.x*t.x+i.y*t.y+i.z*t.z),n},e.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var r=-(t.x*e.x+t.y*e.y+t.z*e.z);return n.e.Dot(i,t)+r},e._TmpMatrix=n.a.Identity(),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.toGlobal=function(t,i){return new e(this.x*t,this.y*i,this.width*t,this.height*i)},e.prototype.toGlobalToRef=function(e,t,i){return i.x=this.x*e,i.y=this.y*t,i.width=this.width*e,i.height=this.height*t,this},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(5),r=i(18),o=i(7),a=i(0),s=i(19),c=i(38),l=i(51),u=(i(82),function(){function e(e){this._useAlternatePickedPointAboveMaxDragAngleDragSpeed=-1.1,this.maxDragAngle=0,this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerID=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new o.c,this.onDragStartObservable=new o.c,this.onDragEndObservable=new o.c,this.moveAttached=!0,this.enabled=!0,this.startAndReleaseDragOnPointerEvents=!0,this.detachCameraControls=!0,this.useObjectOrienationForDragging=!0,this.validateDrag=function(e){return!0},this._tmpVector=new a.e(0,0,0),this._alternatePickedPoint=new a.e(0,0,0),this._worldDragAxis=new a.e(0,0,0),this._targetPosition=new a.e(0,0,0),this._attachedElement=null,this._startDragRay=new c.a(new a.e,new a.e),this._lastPointerRay={},this._dragDelta=new a.e,this._pointA=new a.e(0,0,0),this._pointB=new a.e(0,0,0),this._pointC=new a.e(0,0,0),this._lineA=new a.e(0,0,0),this._lineB=new a.e(0,0,0),this._localAxis=new a.e(0,0,0),this._lookAt=new a.e(0,0,0),this._options=e||{};var t=0;if(this._options.dragAxis&&t++,this._options.dragPlaneNormal&&t++,t>1)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(e.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._scene=t.getScene(),this.attachedNode=t,e._planeScene||(this._debugMode?e._planeScene=this._scene:(e._planeScene=new r.a(this._scene.getEngine(),{virtual:!0}),e._planeScene.detachControl(),this._scene.onDisposeObservable.addOnce(function(){e._planeScene.dispose(),e._planeScene=null}))),this._dragPlane=n.a.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,e._planeScene,!1,n.a.DOUBLESIDE),this.lastDragPosition=new a.e(0,0,0);this._pointerObserver=this._scene.onPointerObservable.add(function(t,n){var r;if(i.enabled)if(t.type==s.a.POINTERDOWN)i.startAndReleaseDragOnPointerEvents&&!i.dragging&&t.pickInfo&&t.pickInfo.hit&&t.pickInfo.pickedMesh&&t.pickInfo.pickedPoint&&t.pickInfo.ray&&(r=t.pickInfo.pickedMesh,i.attachedNode==r||r.isDescendantOf(i.attachedNode))&&i._startDrag(t.event.pointerId,t.pickInfo.ray,t.pickInfo.pickedPoint);else if(t.type==s.a.POINTERUP)i.startAndReleaseDragOnPointerEvents&&i.currentDraggingPointerID==t.event.pointerId&&i.releaseDrag();else if(t.type==s.a.POINTERMOVE){var o=t.event.pointerId;i.currentDraggingPointerID===e._AnyMouseID&&o!==e._AnyMouseID&&"mouse"==t.event.pointerType&&(i._lastPointerRay[i.currentDraggingPointerID]&&(i._lastPointerRay[o]=i._lastPointerRay[i.currentDraggingPointerID],delete i._lastPointerRay[i.currentDraggingPointerID]),i.currentDraggingPointerID=o),i._lastPointerRay[o]||(i._lastPointerRay[o]=new c.a(new a.e,new a.e)),t.pickInfo&&t.pickInfo.ray&&(i._lastPointerRay[o].origin.copyFrom(t.pickInfo.ray.origin),i._lastPointerRay[o].direction.copyFrom(t.pickInfo.ray.direction),i.currentDraggingPointerID==o&&i.dragging&&i._moveDrag(t.pickInfo.ray))}}),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add(function(){i._moving&&i.moveAttached&&(l.a._RemoveAndStorePivotPoint(i.attachedNode),i._targetPosition.subtractToRef(i.attachedNode.absolutePosition,i._tmpVector),i._tmpVector.scaleInPlace(i.dragDeltaRatio),i.attachedNode.getAbsolutePosition().addToRef(i._tmpVector,i._tmpVector),i.validateDrag(i._tmpVector)&&i.attachedNode.setAbsolutePosition(i._tmpVector),l.a._RestorePivotPoint(i.attachedNode))})},e.prototype.releaseDrag=function(){this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID}),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&this._scene.activeCamera.attachControl(this._attachedElement,!0)},e.prototype.startDrag=function(t,i,n){void 0===t&&(t=e._AnyMouseID),this._startDrag(t,i,n);var r=this._lastPointerRay[t];t===e._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},e.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this.attachedNode){l.a._RemoveAndStorePivotPoint(this.attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this.attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var n=this._pickWithRayOnDragPlane(this._startDragRay);n&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(n),this.onDragStartObservable.notifyObservers({dragPlanePoint:n,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this.attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&this._scene.activeCamera.inputs&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedElement?(this._attachedElement=this._scene.activeCamera.inputs.attachedElement,this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement)):this._attachedElement=null)),l.a._RestorePivotPoint(this.attachedNode)}},e.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis):this._worldDragAxis.copyFrom(this._options.dragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=a.e.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(t)}},e.prototype._pickWithRayOnDragPlane=function(t){var i=this;if(!t)return null;var n=Math.acos(a.e.Dot(this._dragPlane.forward,t.direction));if(n>Math.PI/2&&(n=Math.PI-n),this.maxDragAngle>0&&n>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(t.direction),this.attachedNode.absolutePosition.subtractToRef(t.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed*a.e.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=a.e.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this.attachedNode.absolutePosition),this._alternatePickedPoint}return null}var o=e._planeScene.pickWithRay(t,function(e){return e==i._dragPlane});return o&&o.hit&&o.pickedMesh&&o.pickedPoint?o.pickedPoint:null},e.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragAxis,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),this._pointA.addToRef(this._localAxis,this._pointB),e.origin.subtractToRef(this._pointA,this._pointC),this._pointA.addToRef(this._pointC.normalize(),this._pointC),this._pointB.subtractToRef(this._pointA,this._lineA),this._pointC.subtractToRef(this._pointA,this._lineB),a.e.CrossToRef(this._lineA,this._lineB,this._lookAt),a.e.CrossToRef(this._lineA,this._lookAt,this._lookAt),this._lookAt.normalize(),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrienationForDragging?a.e.TransformCoordinatesToRef(this._options.dragPlaneNormal,this.attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.addToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.position.copyFrom(this.attachedNode.absolutePosition),this._dragPlane.computeWorldMatrix(!0)},e.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver),this.releaseDrag()},e._AnyMouseID=-2,e}())},function(e,t,i){"use strict";i.d(t,"a",function(){return r}),i.d(t,"b",function(){return o}),i.d(t,"c",function(){return a});var n=i(1),r=function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e}(),o=function(e,t){this.type=e,this.event=t},a=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.type=t,n.event=i,n.skipOnPointerObservable=!1,n}return n.d(t,e),t}(o)},function(e,t,i){"use strict";i.d(t,"a",function(){return s});var n=i(0),r=i(10),o=i(5),a=i(14);a.a.CreateBox=function(e){var t,i=[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],o=[0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0],s=[],c=e.width||e.size||1,l=e.height||e.size||1,u=e.depth||e.size||1,h=e.wrap||!1,d=void 0===e.topBaseAt?1:e.topBaseAt,f=void 0===e.bottomBaseAt?0:e.bottomBaseAt,p=[2,0,3,1][d=(d+4)%4],_=[2,0,1,3][f=(f+4)%4],m=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,-1,-1,-1,1];if(h){i=[2,3,0,2,0,1,4,5,6,4,6,7,9,10,11,9,11,8,12,14,15,12,13,14],m=[-1,1,1,1,1,1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1,1,1,1,-1,1,-1,-1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1];for(var g=[[1,1,1],[-1,1,1],[-1,1,-1],[1,1,-1]],v=[[-1,-1,1],[1,-1,1],[1,-1,-1],[-1,-1,-1]],y=[17,18,19,16],b=[22,23,20,21];p>0;)g.unshift(g.pop()),y.unshift(y.pop()),p--;for(;_>0;)v.unshift(v.pop()),b.unshift(b.pop()),_--;g=g.flat(),v=v.flat(),m=m.concat(g).concat(v),i.push(y[0],y[2],y[3],y[0],y[1],y[2]),i.push(b[0],b[2],b[3],b[0],b[1],b[2])}var T=[c/2,l/2,u/2];t=m.reduce(function(e,t,i){return e.concat(t*T[i%3])},[]);for(var E=0===e.sideOrientation?0:e.sideOrientation||a.a.DEFAULTSIDE,A=e.faceUV||new Array(6),P=e.faceColors,S=[],R=0;R<6;R++)void 0===A[R]&&(A[R]=new n.f(0,0,1,1)),P&&void 0===P[R]&&(P[R]=new r.b(1,1,1,1));for(var x=0;x<6;x++)if(s.push(A[x].z,A[x].w),s.push(A[x].x,A[x].w),s.push(A[x].x,A[x].y),s.push(A[x].z,A[x].y),P)for(var C=0;C<4;C++)S.push(P[x].r,P[x].g,P[x].b,P[x].a);a.a._ComputeSides(E,t,i,o,s,e.frontUVs,e.backUVs);var M=new a.a;if(M.indices=i,M.positions=t,M.normals=o,M.uvs=s,P){var O=E===a.a.DOUBLESIDE?S.concat(S):S;M.colors=O}return M},o.a.CreateBox=function(e,t,i,n,r){void 0===i&&(i=null);var o={size:t,sideOrientation:r,updatable:n};return s.CreateBox(e,o,i)};var s=function(){function e(){}return e.CreateBox=function(e,t,i){void 0===i&&(i=null);var n=new o.a(e,i);return t.sideOrientation=o.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,a.a.CreateBox(t).applyToMesh(n,t.updatable),n},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return l});var n=i(0),r=i(10),o=i(5),a=i(14),s=i(18),c=i(22);a.a.CreateCylinder=function(e){var t=e.height||2,i=0===e.diameterTop?0:e.diameterTop||e.diameter||1,s=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1;i=i||1e-5,s=s||1e-5;var l,u=e.tessellation||24,h=e.subdivisions||1,d=!!e.hasRings,f=!!e.enclose,p=0===e.cap?0:e.cap||o.a.CAP_ALL,_=e.arc&&(e.arc<=0||e.arc>1)?1:e.arc||1,m=0===e.sideOrientation?0:e.sideOrientation||a.a.DEFAULTSIDE,g=e.faceUV||new Array(3),v=e.faceColors,y=2+(1+(1!==_&&f?2:0))*(d?h:1);for(l=0;l0&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager(),e.synchronizeInstances()},e.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t0){for(var t=0;t0){for(t=0;t0){for(t=0;t0){var u=new Float32Array(t,l.positionsAttrDesc.offset,l.positionsAttrDesc.count);i.setVerticesData(a.b.PositionKind,u,!1)}if(l.normalsAttrDesc&&l.normalsAttrDesc.count>0){var h=new Float32Array(t,l.normalsAttrDesc.offset,l.normalsAttrDesc.count);i.setVerticesData(a.b.NormalKind,h,!1)}if(l.tangetsAttrDesc&&l.tangetsAttrDesc.count>0){var d=new Float32Array(t,l.tangetsAttrDesc.offset,l.tangetsAttrDesc.count);i.setVerticesData(a.b.TangentKind,d,!1)}if(l.uvsAttrDesc&&l.uvsAttrDesc.count>0){var f=new Float32Array(t,l.uvsAttrDesc.offset,l.uvsAttrDesc.count);i.setVerticesData(a.b.UVKind,f,!1)}if(l.uvs2AttrDesc&&l.uvs2AttrDesc.count>0){var p=new Float32Array(t,l.uvs2AttrDesc.offset,l.uvs2AttrDesc.count);i.setVerticesData(a.b.UV2Kind,p,!1)}if(l.uvs3AttrDesc&&l.uvs3AttrDesc.count>0){var _=new Float32Array(t,l.uvs3AttrDesc.offset,l.uvs3AttrDesc.count);i.setVerticesData(a.b.UV3Kind,_,!1)}if(l.uvs4AttrDesc&&l.uvs4AttrDesc.count>0){var m=new Float32Array(t,l.uvs4AttrDesc.offset,l.uvs4AttrDesc.count);i.setVerticesData(a.b.UV4Kind,m,!1)}if(l.uvs5AttrDesc&&l.uvs5AttrDesc.count>0){var g=new Float32Array(t,l.uvs5AttrDesc.offset,l.uvs5AttrDesc.count);i.setVerticesData(a.b.UV5Kind,g,!1)}if(l.uvs6AttrDesc&&l.uvs6AttrDesc.count>0){var v=new Float32Array(t,l.uvs6AttrDesc.offset,l.uvs6AttrDesc.count);i.setVerticesData(a.b.UV6Kind,v,!1)}if(l.colorsAttrDesc&&l.colorsAttrDesc.count>0){var y=new Float32Array(t,l.colorsAttrDesc.offset,l.colorsAttrDesc.count);i.setVerticesData(a.b.ColorKind,y,!1,l.colorsAttrDesc.stride)}if(l.matricesIndicesAttrDesc&&l.matricesIndicesAttrDesc.count>0){for(var b=new Int32Array(t,l.matricesIndicesAttrDesc.offset,l.matricesIndicesAttrDesc.count),T=[],E=0;E>8),T.push((16711680&A)>>16),T.push(A>>24)}i.setVerticesData(a.b.MatricesIndicesKind,T,!1)}if(l.matricesWeightsAttrDesc&&l.matricesWeightsAttrDesc.count>0){var P=new Float32Array(t,l.matricesWeightsAttrDesc.offset,l.matricesWeightsAttrDesc.count);i.setVerticesData(a.b.MatricesWeightsKind,P,!1)}if(l.indicesAttrDesc&&l.indicesAttrDesc.count>0){var S=new Int32Array(t,l.indicesAttrDesc.offset,l.indicesAttrDesc.count);i.setIndices(S,null)}if(l.subMeshesAttrDesc&&l.subMeshesAttrDesc.count>0){var R=new Int32Array(t,l.subMeshesAttrDesc.offset,5*l.subMeshesAttrDesc.count);i.subMeshes=[];for(E=0;E>8),T.push((16711680&D)>>16),T.push(D>>24)}i.setVerticesData(a.b.MatricesIndicesKind,T,t.matricesIndices._updatable)}if(t.matricesIndicesExtra)if(t.matricesIndicesExtra._isExpanded)delete t.matricesIndices._isExpanded,i.setVerticesData(a.b.MatricesIndicesExtraKind,t.matricesIndicesExtra,t.matricesIndicesExtra._updatable);else{for(T=[],E=0;E>8),T.push((16711680&D)>>16),T.push(D>>24)}i.setVerticesData(a.b.MatricesIndicesExtraKind,T,t.matricesIndicesExtra._updatable)}t.matricesWeights&&(e._CleanMatricesWeights(t,i),i.setVerticesData(a.b.MatricesWeightsKind,t.matricesWeights,t.matricesWeights._updatable)),t.matricesWeightsExtra&&i.setVerticesData(a.b.MatricesWeightsExtraKind,t.matricesWeightsExtra,t.matricesWeights._updatable),i.setIndices(t.indices,null)}if(t.subMeshes){i.subMeshes=[];for(var L=0;L-1){var n=t.getScene().getLastSkeletonByID(e.skeletonId);if(n){i=n.bones.length;for(var r=t.getVerticesData(a.b.MatricesIndicesKind),o=t.getVerticesData(a.b.MatricesIndicesExtraKind),s=e.matricesWeights,l=e.matricesWeightsExtra,u=e.numBoneInfluencer,h=s.length,d=0;du-1)&&(p=u-1),f>.001){var g=1/f;for(_=0;_<4;_++)s[d+_]*=g;if(l)for(_=0;_<4;_++)l[d+_]*=g}else p>=4?(l[d+p-4]=1-f,o[d+p-4]=i):(s[d+p]=1-f,r[d+p]=i)}t.setVerticesData(a.b.MatricesIndicesKind,r),e.matricesWeightsExtra&&t.setVerticesData(a.b.MatricesIndicesExtraKind,o)}}}},e.Parse=function(t,i,r){if(i.getGeometryByID(t.id))return null;var s=new e(t.id,i,void 0,t.updatable);return d.a&&d.a.AddTagsTo(s,t.tags),t.delayLoadingFile?(s.delayLoadState=u.a.DELAYLOADSTATE_NOTLOADED,s.delayLoadingFile=r+t.delayLoadingFile,s._boundingInfo=new l.a(n.e.FromArray(t.boundingBoxMinimum),n.e.FromArray(t.boundingBoxMaximum)),s._delayInfo=[],t.hasUVs&&s._delayInfo.push(a.b.UVKind),t.hasUVs2&&s._delayInfo.push(a.b.UV2Kind),t.hasUVs3&&s._delayInfo.push(a.b.UV3Kind),t.hasUVs4&&s._delayInfo.push(a.b.UV4Kind),t.hasUVs5&&s._delayInfo.push(a.b.UV5Kind),t.hasUVs6&&s._delayInfo.push(a.b.UV6Kind),t.hasColors&&s._delayInfo.push(a.b.ColorKind),t.hasMatricesIndices&&s._delayInfo.push(a.b.MatricesIndicesKind),t.hasMatricesWeights&&s._delayInfo.push(a.b.MatricesWeightsKind),s._delayLoadingFunction=o.a.ImportVertexData):o.a.ImportVertexData(t,s),i.pushGeometry(s,!0),s},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){this._xhr=new XMLHttpRequest}return e.prototype._injectCustomRequestHeaders=function(){for(var t in e.CustomRequestHeaders){var i=e.CustomRequestHeaders[t];i&&this._xhr.setRequestHeader(t,i)}},Object.defineProperty(e.prototype,"onprogress",{get:function(){return this._xhr.onprogress},set:function(e){this._xhr.onprogress=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"readyState",{get:function(){return this._xhr.readyState},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._xhr.status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){return this._xhr.statusText},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"response",{get:function(){return this._xhr.response},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseURL",{get:function(){return this._xhr.responseURL},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseText",{get:function(){return this._xhr.responseText},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"responseType",{get:function(){return this._xhr.responseType},set:function(e){this._xhr.responseType=e},enumerable:!0,configurable:!0}),e.prototype.addEventListener=function(e,t,i){this._xhr.addEventListener(e,t,i)},e.prototype.removeEventListener=function(e,t,i){this._xhr.removeEventListener(e,t,i)},e.prototype.abort=function(){this._xhr.abort()},e.prototype.send=function(t){e.CustomRequestHeaders&&this._injectCustomRequestHeaders(),this._xhr.send(t)},e.prototype.open=function(t,i){for(var n=0,r=e.CustomRequestModifiers;nl.snapDistance){var t=Math.floor(Math.abs(f)/l.snapDistance);f%=l.snapDistance,m.normalizeToRef(p),p.scaleInPlace(l.snapDistance*t),l.attachedMesh.position.addInPlace(p),_.snapDistance=l.snapDistance*t,l.onSnapObservable.notifyObservers(_)}}),l._pointerObserver=a.utilityLayerScene.onPointerObservable.add(function(e){if(!l._customMeshSet){var t=e.pickInfo&&-1!=l._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?l._hoverMaterial:l._coloredMaterial;l._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var v=a._getSharedGizmoLight();return v.includedOnlyMeshes=v.includedOnlyMeshes.concat(l._rootMesh.getChildMeshes(!1)),l}return n.d(t,e),t._CreateArrow=function(e,t){var i=new a.a("arrow",e),n=s.a.CreateCylinder("cylinder",{diameterTop:0,height:.075,diameterBottom:.0375,tessellation:96},e),r=s.a.CreateCylinder("cylinder",{diameterTop:.005,height:.275,diameterBottom:.005,tessellation:96},e);return r.material=t,n.parent=i,r.parent=i,n.material=t,n.rotation.x=Math.PI/2,n.position.z+=.3,r.position.z+=.1375,r.rotation.x=Math.PI/2,i},t._CreateArrowInstance=function(e,t){for(var i=new a.a("arrow",e),n=0,r=t.getChildMeshes();n=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},t.prototype.getActiveTextures=function(){var t;return(t=e.prototype.getActiveTextures.call(this)).concat.apply(t,this.subMaterials.map(function(e){return e?e.getActiveTextures():[]}))},t.prototype.getClassName=function(){return"MultiMaterial"},t.prototype.isReadyForSubMesh=function(e,t,i){for(var n=0;n=0&&r.multiMaterials.splice(o,1),e.prototype.dispose.call(this,t,i)}},t.ParseMultiMaterial=function(e,i){var n=new t(e.name,i);n.id=e.id,o.a&&o.a.AddTagsTo(n,e.tags);for(var r=0;r=n.a.ACTION_OnPickTrigger&&i<=n.a.ACTION_OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),e.HasSpecificTrigger=function(t){for(var i in e.Triggers){if(e.Triggers.hasOwnProperty(i))if(parseInt(i)===t)return!0}return!1},e.Triggers={},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(5),r=i(14);r.a.CreatePlane=function(e){var t=[],i=[],n=[],o=[],a=e.width||e.size||1,s=e.height||e.size||1,c=0===e.sideOrientation?0:e.sideOrientation||r.a.DEFAULTSIDE,l=a/2,u=s/2;i.push(-l,-u,0),n.push(0,0,-1),o.push(0,0),i.push(l,-u,0),n.push(0,0,-1),o.push(1,0),i.push(l,u,0),n.push(0,0,-1),o.push(1,1),i.push(-l,u,0),n.push(0,0,-1),o.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),r.a._ComputeSides(c,i,t,n,o,e.frontUVs,e.backUVs);var h=new r.a;return h.indices=t,h.positions=i,h.normals=n,h.uvs=o,h},n.a.CreatePlane=function(e,t,i,n,r){var a={size:t,width:t,height:t,sideOrientation:r,updatable:n};return o.CreatePlane(e,a,i)};var o=function(){function e(){}return e.CreatePlane=function(e,t,i){void 0===i&&(i=null);var o=new n.a(e,i);return t.sideOrientation=n.a._GetDefaultSideOrientation(t.sideOrientation),o._originalBuilderSideOrientation=t.sideOrientation,r.a.CreatePlane(t).applyToMesh(o,t.updatable),t.sourcePlane&&(o.translate(t.sourcePlane.normal,-t.sourcePlane.d),o.setDirection(t.sourcePlane.normal.scale(-1))),o},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return u});var n=i(0),r=i(16),o=i(71),a=i(3),s=i(28),c=i(10),l=function(e,t,i,n){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=n},u=function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i,n=e.getSize().width,r=e.readPixels(0),o=e.readPixels(1);e.isRenderTarget?(t=e.readPixels(3),i=e.readPixels(2)):(t=e.readPixels(2),i=e.readPixels(3));var s=e.readPixels(4),c=e.readPixels(5),l=e.gammaSpace,u=a.a.TEXTUREFORMAT_RGBA,h=a.a.TEXTURETYPE_UNSIGNED_INT;e.textureType&&e.textureType!==a.a.TEXTURETYPE_UNSIGNED_INT&&(h=a.a.TEXTURETYPE_FLOAT);var d={size:n,right:r,left:o,up:t,down:i,front:s,back:c,format:u,type:h,gammaSpace:l};return this.ConvertCubeMapToSphericalPolynomial(d)},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new o.a,i=0,n=2/e.size,l=n,u=.5*n-1,h=0;h<6;h++)for(var d=this.FileFaces[h],f=e[d.name],p=u,_=e.format===a.a.TEXTUREFORMAT_RGBA?4:3,m=0;m-1&&this._debugMeshMeshes.splice(o,1),this._numMeshes--,this._numMeshes>0?(this._meshes[n]=this._meshes[this._numMeshes],this._impostors[n]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},e.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new r.a("",e),this._debugMaterial.wireframe=!0,this._debugMaterial.emissiveColor=a.a.White(),this._debugMaterial.disableLighting=!0),this._debugMaterial},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=g.a.CreateBox("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.rotationQuaternion=n.b.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),this._debugBoxMesh.setEnabled(!1)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=v.a.CreateSphere("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.rotationQuaternion=n.b.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),this._debugSphereMesh.setEnabled(!1)),this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugCylinderMesh=function(e){return this._debugCylinderMesh||(this._debugCylinderMesh=E.a.CreateCylinder("physicsBodyCylinderViewMesh",{diameterTop:1,diameterBottom:1,height:1},e),this._debugCylinderMesh.rotationQuaternion=n.b.Identity(),this._debugCylinderMesh.material=this._getDebugMaterial(e),this._debugCylinderMesh.setEnabled(!1)),this._debugCylinderMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugMeshMesh=function(e,t){var i=new m.a(e.name,t,null,e);return i.position=n.e.Zero(),i.setParent(e),i.material=this._getDebugMaterial(t),this._debugMeshMeshes.push(i),i},e.prototype._getDebugMesh=function(e,t){var i=this;if(!this._utilityLayer)return null;if(t&&t.parent&&t.parent.physicsImpostor)return null;var n=null,r=this._utilityLayer.utilityLayerScene;switch(e.type){case b.a.BoxImpostor:n=this._getDebugBoxMesh(r),e.getBoxSizeToRef(n.scaling);break;case b.a.SphereImpostor:n=this._getDebugSphereMesh(r);var o=e.getRadius();n.scaling.x=2*o,n.scaling.y=2*o,n.scaling.z=2*o;break;case b.a.MeshImpostor:t&&(n=this._getDebugMeshMesh(t,r));break;case b.a.NoImpostor:if(t)t.getChildMeshes().filter(function(e){return e.physicsImpostor?1:0}).forEach(function(e){i._getDebugBoxMesh(r).parent=e});break;case b.a.CylinderImpostor:n=this._getDebugCylinderMesh(r);var a=e.object.getBoundingInfo();n.scaling.x=a.boundingBox.maximum.x-a.boundingBox.minimum.x,n.scaling.y=a.boundingBox.maximum.y-a.boundingBox.minimum.y,n.scaling.z=a.boundingBox.maximum.z-a.boundingBox.minimum.z}return n},e.prototype.dispose=function(){for(var e=this._numMeshes,t=0;t=0;s--){var c=e[s],l=c.getParent();if(l){var u=this._debugLines[r];u||(u=[n.e.Zero(),n.e.Zero()],this._debugLines[r]=u),c.getAbsolutePositionToRef(o,u[0]),l.getAbsolutePositionToRef(o,u[1]),u[0].subtractInPlace(a),u[1].subtractInPlace(a),r++}}},e.prototype.update=function(){if(this._utilityLayer){this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms();var e=this.mesh._effectiveMesh;void 0===this.skeleton.bones[0].length?this._getLinesForBonesNoLength(this.skeleton.bones,e.getWorldMatrix()):this._getLinesForBonesWithLength(this.skeleton.bones,e.getWorldMatrix());var t=this._utilityLayer.utilityLayerScene;this._debugMesh?P.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},t):(this._debugMesh=P.a.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:null},t),this._debugMesh.renderingGroupId=this.renderingGroupId),this._debugMesh.position.copyFrom(this.mesh.position),this._debugMesh.color=this.color}},e.prototype.dispose=function(){this.isEnabled=!1,this._debugMesh&&(this.isEnabled=!1,this._debugMesh.dispose(),this._debugMesh=null),this._utilityLayer&&(this._utilityLayer.dispose(),this._utilityLayer=null)},e}();i.d(t,"AxesViewer",function(){return s}),i.d(t,"BoneAxesViewer",function(){return u}),i.d(t,"DebugLayer",function(){return _}),i.d(t,"PhysicsViewer",function(){return A}),i.d(t,"RayHelper",function(){return S}),i.d(t,"SkeletonViewer",function(){return R})},function(e,t,i){"use strict";var n="morphTargetsVertexGlobalDeclaration",r="#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="morphTargetsVertexDeclaration",r="#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#ifdef MORPHTARGETS_UV\nattribute vec2 uv_{X};\n#endif\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="morphTargetsVertex",r="#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#ifdef MORPHTARGETS_UV\nuvUpdated+=(uv_{X}-uv)*morphTargetInfluences[{X}];\n#endif\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";i.d(t,"a",function(){return f});var n=i(1),r=i(2),o=i(0),a=i(4),s=i(9),c=i(15),l=i(6),u=i(25),h=i(13),d=i(10),f=function(e){function t(t,i,r,a){void 0===a&&(a={});var s=e.call(this,t,i)||this;return s._textures={},s._textureArrays={},s._floats={},s._ints={},s._floatsArrays={},s._colors3={},s._colors3Arrays={},s._colors4={},s._colors4Arrays={},s._vectors2={},s._vectors3={},s._vectors4={},s._matrices={},s._matrices3x3={},s._matrices2x2={},s._vectors2Arrays={},s._vectors3Arrays={},s._vectors4Arrays={},s._cachedWorldViewMatrix=new o.a,s._cachedWorldViewProjectionMatrix=new o.a,s._shaderPath=r,s._options=n.a({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},a),s}return n.d(t,e),Object.defineProperty(t.prototype,"options",{get:function(){return this._options},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"ShaderMaterial"},t.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},t.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},t.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},t.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},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.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},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setColor4Array=function(e,t){return this._checkUniform(e),this._colors4Arrays[e]=t.reduce(function(e,t){return t.toArray(e,e.length),e},[]),this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},t.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},t.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},t.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},t.prototype.setArray4=function(e,t){return this._checkUniform(e),this._vectors4Arrays[e]=t,this},t.prototype._checkCache=function(e,t){return!e||(this._effect&&this._effect.defines.indexOf("#define INSTANCES"),!1)},t.prototype.isReadyForSubMesh=function(e,t,i){return this.isReady(e,i)},t.prototype.isReady=function(e,t){var i=this.getScene(),n=i.getEngine();if(!this.checkReadyOnEveryCall&&this._renderId===i.getRenderId()&&this._checkCache(e,t))return!0;for(var r=[],o=[],s=new l.c,u=0;u4&&(o.push(a.b.MatricesIndicesExtraKind),o.push(a.b.MatricesWeightsExtraKind));var h=e.skeleton;r.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),s.addCPUSkinningFallback(0,e),h.isUsingTextureForMatrices?(r.push("#define BONETEXTURE"),-1===this._options.uniforms.indexOf("boneTextureWidth")&&this._options.uniforms.push("boneTextureWidth"),-1===this._options.samplers.indexOf("boneSampler")&&this._options.samplers.push("boneSampler")):(r.push("#define BonesPerMesh "+(h.bones.length+1)),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones"))}else r.push("#define NUM_BONE_INFLUENCERS 0");for(var d in this._textures)if(!this._textures[d].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&r.push("#define ALPHATEST");var f=this._effect,p=r.join("\n");return this._effect=n.createEffect(this._shaderPath,{attributes:o,uniformsNames:this._options.uniforms,uniformBuffersNames:this._options.uniformBuffers,samplers:this._options.samplers,defines:p,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError},n),!!this._effect.isReady()&&(f!==this._effect&&i.resetCachedMaterial(),this._renderId=i.getRenderId(),!0)},t.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")&&(e.multiplyToRef(t.getTransformMatrix(),this._cachedWorldViewProjectionMatrix),this._effect.setMatrix("worldViewProjection",this._cachedWorldViewProjectionMatrix)))},t.prototype.bind=function(e,t){if(this.bindOnlyWorldMatrix(e),this._effect&&this.getScene().getCachedMaterial()!==this){var i;for(i in-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()),c.a.BindBonesParameters(t,this._effect),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._colors4Arrays)this._effect.setArray4(i,this._colors4Arrays[i]);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]);for(i in this._vectors4Arrays)this._effect.setArray4(i,this._vectors4Arrays[i])}this._afterBind(t)},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);for(var i in this._textures)t.push(this._textures[i]);for(var i in this._textureArrays)for(var n=this._textureArrays[i],r=0;ru-n)&&(!(c-hh-r)&&!(l-dd-a))},e.prototype.intersectsSphere=function(t){return e.IntersectsSphere(this.minimumWorld,this.maximumWorld,t.centerWorld,t.radiusWorld)},e.prototype.intersectsMinMax=function(e,t){var i=this.minimumWorld,n=this.maximumWorld,r=i.x,o=i.y,a=i.z,s=n.x,c=n.y,l=n.z,u=e.x,h=e.y,d=e.z,f=t.x,p=t.y,_=t.z;return!(sf)&&(!(cp)&&!(l_))},e.Intersects=function(e,t){return e.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.IntersectsSphere=function(t,i,n,o){var a=e.TmpVector3[0];return r.e.ClampToRef(n,t,i,a),r.e.DistanceSquared(n,a)<=o*o},e.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;++i)for(var n=t[i],r=0;r<8;++r)if(n.dotCoordinate(e[r])<0)return!1;return!0},e.IsInFrustum=function(e,t){for(var i=0;i<6;++i){for(var n=!0,r=t[i],o=0;o<8;++o)if(r.dotCoordinate(e[o])>=0){n=!1;break}if(n)return!1}return!0},e.TmpVector3=n.a.BuildArray(3,r.e.Zero),e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return o});var n=i(39),r=i(0),o=function(){function e(e,t,i){this.center=r.e.Zero(),this.centerWorld=r.e.Zero(),this.minimum=r.e.Zero(),this.maximum=r.e.Zero(),this.reConstruct(e,t,i)}return e.prototype.reConstruct=function(e,t,i){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var n=r.e.Distance(e,t);t.addToRef(e,this.center).scaleInPlace(.5),this.radius=.5*n,this._update(i||r.a.IdentityReadOnly)},e.prototype.scale=function(t){var i=this.radius*t,n=e.TmpVector3,r=n[0].setAll(i),o=this.center.subtractToRef(r,n[1]),a=this.center.addToRef(r,n[2]);return this.reConstruct(o,a,this._worldMatrix),this},e.prototype.getWorldMatrix=function(){return this._worldMatrix},e.prototype._update=function(t){if(t.isIdentity())this.centerWorld.copyFrom(this.center),this.radiusWorld=this.radius;else{r.e.TransformCoordinatesToRef(this.center,t,this.centerWorld);var i=e.TmpVector3[0];r.e.TransformNormalFromFloatsToRef(1,1,1,t,i),this.radiusWorld=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(i.z))*this.radius}},e.prototype.isInFrustum=function(e){for(var t=this.centerWorld,i=this.radiusWorld,n=0;n<6;n++)if(e[n].dotCoordinate(t)<=-i)return!1;return!0},e.prototype.isCenterInFrustum=function(e){for(var t=this.centerWorld,i=0;i<6;i++)if(e[i].dotCoordinate(t)<0)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=r.e.DistanceSquared(this.centerWorld,e);return!(this.radiusWorld*this.radiusWorldthis.value;case t.IsLesser:return this._effectiveTarget[this._property]-1&&this._scene.actionManagers.splice(e,1)},t.prototype.getScene=function(){return this._scene},t.prototype.hasSpecificTriggers=function(e){for(var t=0;t-1)return!0}return!1},t.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i=t.OnPickTrigger&&i.trigger<=t.OnPointerOutTrigger)return!0}return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasPickTriggers",{get:function(){for(var e=0;e=t.OnPickTrigger&&i.trigger<=t.OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),t.prototype.registerAction=function(e){return e.trigger===t.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(m.a.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),t.Triggers[e.trigger]?t.Triggers[e.trigger]++:t.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},t.prototype.unregisterAction=function(e){var i=this.actions.indexOf(e);return-1!==i&&(this.actions.splice(i,1),t.Triggers[e.trigger]-=1,0===t.Triggers[e.trigger]&&delete t.Triggers[e.trigger],delete e._actionManager,!0)},t.prototype.processTrigger=function(e,i){for(var n=0;n0;if(2===e.type?h.push(r):h.push(i),m){for(var g=new Array,v=0;v0){var _=p.properties[0].value,m=null===p.properties[0].targetType?_:n.getMeshByName(_);m._meshId&&(m.mesh=n.getMeshByID(m._meshId)),h={trigger:t[p.name],parameter:m}}else h=t[p.name];for(var g=0;g=0;o--)this._keys[o].frame>=n&&this._keys[o].frame<=r&&this._keys.splice(o,1);this._ranges[e]=null}},e.prototype.getRange=function(e){return this._ranges[e]},e.prototype.getKeys=function(){return this._keys},e.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t0)return i.highLimitValue.clone?i.highLimitValue.clone():i.highLimitValue;var n=this._keys;if(1===n.length)return this._getKeyValue(n[0].value);var r=i.key;if(n[r].frame>=t)for(;r-1>=0&&n[r].frame>=t;)r--;for(var o=r;o=t){i.key=o;var s=n[o],c=this._getKeyValue(s.value);if(s.interpolation===L.STEP)return c;var l=this._getKeyValue(a.value),u=void 0!==s.outTangent&&void 0!==a.inTangent,h=a.frame-s.frame,d=(t-s.frame)/h,f=this.getEasingFunction();switch(null!=f&&(d=f.ease(d)),this.dataType){case e.ANIMATIONTYPE_FLOAT:var p=u?this.floatInterpolateFunctionWithTangents(c,s.outTangent*h,l,a.inTangent*h,d):this.floatInterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return p;case e.ANIMATIONLOOPMODE_RELATIVE:return i.offsetValue*i.repeatCount+p}break;case e.ANIMATIONTYPE_QUATERNION:var _=u?this.quaternionInterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.quaternionInterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return _;case e.ANIMATIONLOOPMODE_RELATIVE:return _.addInPlace(i.offsetValue.scale(i.repeatCount))}return _;case e.ANIMATIONTYPE_VECTOR3:var m=u?this.vector3InterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.vector3InterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return m;case e.ANIMATIONLOOPMODE_RELATIVE:return m.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_VECTOR2:var g=u?this.vector2InterpolateFunctionWithTangents(c,s.outTangent.scale(h),l,a.inTangent.scale(h),d):this.vector2InterpolateFunction(c,l,d);switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return g;case e.ANIMATIONLOOPMODE_RELATIVE:return g.add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_SIZE:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(c,l,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(c,l,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_COLOR3:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(c,l,d);case e.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(c,l,d).add(i.offsetValue.scale(i.repeatCount))}case e.ANIMATIONTYPE_MATRIX:switch(i.loopMode){case e.ANIMATIONLOOPMODE_CYCLE:case e.ANIMATIONLOOPMODE_CONSTANT:if(e.AllowMatricesInterpolation)return this.matrixInterpolateFunction(c,l,d,i.workValue);case e.ANIMATIONLOOPMODE_RELATIVE:return c}}break}}return this._getKeyValue(n[n.length-1].value)},e.prototype.matrixInterpolateFunction=function(t,i,n,r){return e.AllowMatrixDecomposeForInterpolation?r?(a.a.DecomposeLerpToRef(t,i,n,r),r):a.a.DecomposeLerp(t,i,n):r?(a.a.LerpToRef(t,i,n,r),r):a.a.Lerp(t,i,n)},e.prototype.clone=function(){var t=new e(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed,this._keys&&t.setKeys(this._keys),this._ranges)for(var i in t._ranges={},this._ranges){var n=this._ranges[i];n&&(t._ranges[i]=n.clone())}return t},e.prototype.setKeys=function(e){this._keys=e.slice(0)},e.prototype.serialize=function(){var t={};t.name=this.name,t.property=this.targetProperty,t.framePerSecond=this.framePerSecond,t.dataType=this.dataType,t.loopBehavior=this.loopMode,t.enableBlending=this.enableBlending,t.blendingSpeed=this.blendingSpeed;var i=this.dataType;t.keys=[];for(var n=this.getKeys(),r=0;r=1&&(l=h.values[1]),h.values.length>=2&&(u=h.values[2]);break;case e.ANIMATIONTYPE_QUATERNION:if(i=a.b.FromArray(h.values),h.values.length>=8){var d=a.b.FromArray(h.values.slice(4,8));d.equals(a.b.Zero())||(l=d)}if(h.values.length>=12){var f=a.b.FromArray(h.values.slice(8,12));f.equals(a.b.Zero())||(u=f)}break;case e.ANIMATIONTYPE_MATRIX:i=a.a.FromArray(h.values);break;case e.ANIMATIONTYPE_COLOR3:i=s.a.FromArray(h.values);break;case e.ANIMATIONTYPE_VECTOR3:default:i=a.e.FromArray(h.values)}var p={};p.frame=h.frame,p.value=i,null!=l&&(p.inTangent=l),null!=u&&(p.outTangent=u),c.push(p)}if(r.setKeys(c),t.ranges)for(n=0;n0&&h.forEach(function(e){r._events.push(e._clone())}),this._enableBlending=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending}return Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._currentActiveTarget},enumerable:!0,configurable:!0}),e.prototype._preparePath=function(e,t){void 0===t&&(t=0);var i=this._animation.targetPropertyPath;if(i.length>1){for(var n=e[i[0]],r=1;r-1&&this._animation.runtimeAnimations.splice(e,1)},e.prototype.setValue=function(e,t){if(this._targetIsArray)for(var i=0;it[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._events;if(i.length)for(var n=0;nthis._maxFrame)&&(t=this._minFrame),(ithis._maxFrame)&&(i=this._maxFrame);var l,u,h=i-t,d=e*(a.framePerSecond*r)/1e3+this._ratioOffset,f=0;if(this._previousDelay=e,this._previousRatio=d,!n&&i>=t&&d>=h)c=!1,f=a._getKeyValue(this._maxValue);else if(!n&&t>=i&&d<=h)c=!1,f=a._getKeyValue(this._minValue);else if(this._animationState.loopMode!==k.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){this._animationState.repeatCount=0,this._animationState.loopMode=k.ANIMATIONLOOPMODE_CYCLE;var _=a._interpolate(t,this._animationState),m=a._interpolate(i,this._animationState);switch(this._animationState.loopMode=this._getCorrectLoopMode(),a.dataType){case k.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=m-_;break;case k.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=m.subtract(_);break;case k.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=m.subtract(_);case k.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=m.subtract(_)}this._highLimitsCache[p]=m}f=this._highLimitsCache[p],l=this._offsetsCache[p]}if(void 0===l)switch(a.dataType){case k.ANIMATIONTYPE_FLOAT:l=0;break;case k.ANIMATIONTYPE_QUATERNION:l=z;break;case k.ANIMATIONTYPE_VECTOR3:l=j;break;case k.ANIMATIONTYPE_VECTOR2:l=W;break;case k.ANIMATIONTYPE_SIZE:l=H;break;case k.ANIMATIONTYPE_COLOR3:l=X}if(this._host&&this._host.syncRoot){var g=this._host.syncRoot;u=t+(i-t)*((g.masterFrame-g.fromFrame)/(g.toFrame-g.fromFrame))}else u=c&&0!==h?t+d%h:i;var v=this._events;if((h>0&&this.currentFrame>u||h<0&&this.currentFrame>0,this._animationState.highLimitValue=f,this._animationState.offsetValue=l;var b=a._interpolate(u,this._animationState);if(this.setValue(b,o),v.length)for(y=0;y0&&u>=v[y].frame&&v[y].frame>=t||h<0&&u<=v[y].frame&&v[y].frame<=t){var T=v[y];T.isDone||(T.onlyOnce&&(v.splice(y,1),y--),T.isDone=!0,T.action(u))}return c||(this._stopped=!0),c},e}(),K=i(18),Q=i(53),q=i(39),Z=i(22),J=function(e){function t(t,i,n,r,o,s,c){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=null);var l=e.call(this,t,i.getScene(),!1)||this;return l.name=t,l.children=new Array,l.animations=new Array,l._index=null,l._absoluteTransform=new a.a,l._invertedAbsoluteTransform=new a.a,l._scalingDeterminant=1,l._worldTransform=new a.a,l._needToDecompose=!0,l._needToCompose=!1,l._linkedTransformNode=null,l._waitingTransformNodeId=null,l._skeleton=i,l._localMatrix=r?r.clone():a.a.Identity(),l._restPose=o||l._localMatrix.clone(),l._baseMatrix=s||l._localMatrix.clone(),l._index=c,i.bones.push(l),l.setParent(n,!1),(s||r)&&l._updateDifferenceMatrix(),l}return h.d(t,e),Object.defineProperty(t.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"Bone"},t.prototype.getSkeleton=function(){return this._skeleton},t.prototype.getParent=function(){return this._parent},t.prototype.getChildren=function(){return this.children},t.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this._parent!==e){if(this._parent){var i=this._parent.children.indexOf(this);-1!==i&&this._parent.children.splice(i,1)}this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}},t.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},t.prototype.getBaseMatrix=function(){return this._baseMatrix},t.prototype.getRestPose=function(){return this._restPose},t.prototype.getWorldMatrix=function(){return this._worldTransform},t.prototype.returnToRest=function(){this.updateMatrix(this._restPose.clone())},t.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},t.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},t.prototype.linkTransformNode=function(e){this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode--,this._linkedTransformNode=e,this._linkedTransformNode&&this._skeleton._numBonesWithLinkedTransformNode++},t.prototype.getTransformNode=function(){return this._linkedTransformNode},Object.defineProperty(t.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!0,configurable:!0}),t.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=a.e.Zero(),this._localRotation=a.b.Zero(),this._localPosition=a.e.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},t.prototype._compose=function(){this._needToCompose&&(this._localScaling?(this._needToCompose=!1,a.a.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix)):this._needToCompose=!1)},t.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?(this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose()):this.markAsDirty()},t.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e||(e=this._baseMatrix),this._parent?e.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i-1&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=this,n=0;n-1){for(var n=(o=this._runtimeAnimations).length-1;n>=0;n--){var r=o[n];e&&r.animation.name!=e||(t&&!t(r.target)||(r.dispose(),o.splice(n,1)))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{if((n=this._scene._activeAnimatables.indexOf(this))>-1){this._scene._activeAnimatables.splice(n,1);var o=this._runtimeAnimations;for(n=0;n0)return;this._animationTimeLast=t}var i=this.useConstantAnimationDeltaTime?16:(t-this._animationTimeLast)*this.animationTimeScale;this._animationTime+=i;var n=this._animationTime;this._animationTimeLast=t;for(var r=0;ri&&r>0&&(r*=-1),s&&this.stopAnimation(e,void 0,c),a||(a=new $(this,e,t,i,n,r,o,void 0,l));var u=!c||c(e);if(e.animations&&u&&a.appendAnimations(e,e.animations),e.getAnimatables)for(var h=e.getAnimatables(),d=0;d=l&&a.frame<=u&&(n?(c=a.value.clone(),_?(s=c.getTranslation(),c.setTranslation(s.scaleInPlace(m))):g&&r?(s=c.getTranslation(),c.setTranslation(s.multiplyInPlace(r))):c=a.value):c=a.value,v.push({frame:a.frame+i,value:c}));return this.animations[0].createRange(t,l+i,u+i),!0};var ee,te=function(){function e(){}return e.prototype.serialize=function(){var e={};return e.animation=this.animation.serialize(),e.targetId=this.target.id,e},e}(),ie=function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this._loopAnimation=!1,this.onAnimationEndObservable=new o.c,this.onAnimationLoopObservable=new o.c,this.onAnimationGroupEndObservable=new o.c,this.onAnimationGroupPauseObservable=new o.c,this.onAnimationGroupPlayObservable=new o.c,this._scene=t||C.a.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.animationGroups.push(this)}return Object.defineProperty(e.prototype,"from",{get:function(){return this._from},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"to",{get:function(){return this._to},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._isStarted&&!this._isPaused},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;tn[0].frame&&(this._from=n[0].frame),this._toe){var a={frame:e,value:r.value,inTangent:r.inTangent,outTangent:r.outTangent,interpolation:r.interpolation};n.splice(0,0,a)}if(o.framen&&this._speedRatio>0&&(this._speedRatio=-t);return this._isStarted=!0,this._isPaused=!1,this.onAnimationGroupPlayObservable.notifyObservers(this),this},e.prototype.pause=function(){if(!this._isStarted)return this;this._isPaused=!0;for(var e=0;e-1&&this._scene.animationGroups.splice(e,1),this.onAnimationEndObservable.clear(),this.onAnimationGroupEndObservable.clear(),this.onAnimationGroupPauseObservable.clear(),this.onAnimationGroupPlayObservable.clear(),this.onAnimationLoopObservable.clear()},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);t>-1&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.prototype.clone=function(t,i){for(var n=new e(t||this.name,this._scene),r=0,o=this._targetedAnimations;r180&&(l-=360),l-c<-180&&(l+=360),u-l>180&&(u-=360),u-l<-180&&(u+=360),this.orientation=l-c<0?ee.CW:ee.CCW,this.angle=ae.FromDegrees(this.orientation===ee.CW?c-u:u-c)},ce=function(){function e(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new a.d(e,t))}return e.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new a.d(e,t),n=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(n).length(),this},e.prototype.addArcTo=function(e,t,i,n,r){if(void 0===r&&(r=36),this.closed)return this;var o=this._points[this._points.length-1],s=new a.d(e,t),c=new a.d(i,n),l=new se(o,s,c),u=l.angle.radians()/r;l.orientation===ee.CW&&(u*=-1);for(var h=l.startAngle.radians()+u,d=0;d1)return a.d.Zero();for(var t=e*this.length(),i=0,n=0;n=i&&t<=c){var l=s.normalize(),u=t-i;return new a.d(o.x+l.x*u,o.y+l.y*u)}i=c}return a.d.Zero()},e.StartingAt=function(t,i){return new e(t,i)},e}(),le=function(){function e(e,t,i){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 n=0;nt+1;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t){var i,n,r=e.length();(0===r&&(r=1),null==t)?(n=w.a.WithinEpsilon(Math.abs(e.y)/r,1,re.a)?w.a.WithinEpsilon(Math.abs(e.x)/r,1,re.a)?w.a.WithinEpsilon(Math.abs(e.z)/r,1,re.a)?a.e.Zero():new a.e(0,0,1):new a.e(1,0,0):new a.e(0,-1,0),i=a.e.Cross(e,n)):(i=a.e.Cross(e,t),a.e.CrossToRef(i,e,i));return i.normalize(),i},e}(),ue=function(){function e(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return e.CreateQuadraticBezier=function(t,i,n,r){r=r>2?r:3;for(var o=new Array,s=function(e,t,i,n){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*n},c=0;c<=r;c++)o.push(new a.e(s(c/r,t.x,i.x,n.x),s(c/r,t.y,i.y,n.y),s(c/r,t.z,i.z,n.z)));return new e(o)},e.CreateCubicBezier=function(t,i,n,r,o){o=o>3?o:4;for(var s=new Array,c=function(e,t,i,n,r){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*n+e*e*e*r},l=0;l<=o;l++)s.push(new a.e(c(l/o,t.x,i.x,n.x,r.x),c(l/o,t.y,i.y,n.y,r.y),c(l/o,t.z,i.z,n.z,r.z)));return new e(s)},e.CreateHermiteSpline=function(t,i,n,r,o){for(var s=new Array,c=1/o,l=0;l<=o;l++)s.push(a.e.Hermite(t,i,n,r,l*c));return new e(s)},e.CreateCatmullRomSpline=function(t,i,n){var r=new Array,o=1/i,s=0;if(n){for(var c=t.length,l=0;l=.5?.5*(1-this.easeInCore(2*(1-t)))+.5:.5*this.easeInCore(2*t)},e.EASINGMODE_EASEIN=0,e.EASINGMODE_EASEOUT=1,e.EASINGMODE_EASEINOUT=2,e}(),de=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t}(he),fe=function(e){function t(t){void 0===t&&(t=1);var i=e.call(this)||this;return i.amplitude=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},t}(he),pe=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=2);var n=e.call(this)||this;return n.bounces=t,n.bounciness=i,n}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var n=Math.pow(i,t),r=1-i,o=(1-n)/r+.5*n,a=e*o,s=Math.log(-a*(1-i)+1)/Math.log(i),c=Math.floor(s),l=c+1,u=(1-Math.pow(i,c))/(r*o),h=.5*(u+(1-Math.pow(i,l))/(r*o)),d=e-h,f=h-u;return-Math.pow(1/i,t-c)/(f*f)*(d-f)*(d+f)},t}(he),_e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e},t}(he),me=function(e){function t(t,i){void 0===t&&(t=3),void 0===i&&(i=3);var n=e.call(this)||this;return n.oscillations=t,n.springiness=i,n}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},t}(he),ge=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.exponent=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},t}(he),ve=function(e){function t(t){void 0===t&&(t=2);var i=e.call(this)||this;return i.power=t,i}return h.d(t,e),t.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},t}(he),ye=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e},t}(he),be=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t}(he),Te=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t}(he),Ee=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t}(he),Ae=function(e){function t(t,i,n,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1);var o=e.call(this)||this;return o.x1=t,o.y1=i,o.x2=n,o.y2=r,o}return h.d(t,e),t.prototype.easeInCore=function(e){return oe.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},t}(he),Pe=function(){function e(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}return e.prototype._clone=function(){return new e(this.frame,this.action,this.onlyOnce)},e}(),Se=i(5),Re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t}(n.a),xe=function(e){function t(t){var i=e.call(this)||this;return i.scene=t,i.sounds=[],i.effectLayers=[],i.layers=[],i.lensFlareSystems=[],i.proceduralTextures=[],i.reflectionProbes=[],i}return h.d(t,e),t.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.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.actionManagers.forEach(function(t){e.scene.addActionManager(t)}),this.textures.forEach(function(t){e.scene.addTexture(t)}),this.reflectionProbes.forEach(function(t){e.scene.addReflectionProbe(t)}),this.environmentTexture&&(this.scene.environmentTexture=this.environmentTexture);for(var t=0,i=this.scene._serializableComponents;t0&&(h=!0,this._soundLoaded(i));break;case"String":u.push(i);case"Array":0===u.length&&(u=i);for(var d=0;d0&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect(),this.isPlaying=!1;else if(Ce.b.audioEngine.audioContext&&this._soundSource){var i=e?Ce.b.audioEngine.audioContext.currentTime+e:Ce.b.audioEngine.audioContext.currentTime;this._soundSource.stop(i),this._soundSource.onended=function(){t.isPlaying=!1},this.isPaused||(this._startOffset=0)}},e.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():Ce.b.audioEngine.audioContext&&(this.stop(0),this._startOffset+=Ce.b.audioEngine.audioContext.currentTime-this._startTime))},e.prototype.setVolume=function(e,t){Ce.b.audioEngine.canUseWebAudio&&this._soundGain&&(t&&Ce.b.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(Ce.b.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,Ce.b.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,Ce.b.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},e.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},e.prototype.getVolume=function(){return this._volume},e.prototype.attachToMesh=function(e){var t=this;this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedTransformNode=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play(0,this._offset,this._length))),this._onRegisterAfterWorldMatrixUpdate(this._connectedTransformNode),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},this._connectedTransformNode.registerAfterWorldMatrixUpdate(this._registerFunc)},e.prototype.detachFromMesh=function(){this._connectedTransformNode&&this._registerFunc&&(this._connectedTransformNode.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedTransformNode=null)},e.prototype._onRegisterAfterWorldMatrixUpdate=function(e){if(e.getBoundingInfo){var t=e;if(this._positionInEmitterSpace)t.worldMatrixFromCache.invertToRef(a.c.Matrix[0]),this.setPosition(a.c.Matrix[0].getTranslation());else{var i=t.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}Ce.b.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()}},e.prototype.clone=function(){var t=this;if(this._streaming)return null;var i=function(){t._isReadyToPlay?(r._audioBuffer=t.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play(0,t._offset,t._length)):window.setTimeout(i,300)},n={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new e(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,n);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),i(),r},e.prototype.getAudioBuffer=function(){return this._audioBuffer},e.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId};return this.spatialSound&&(this._connectedTransformNode&&(e.connectedMeshId=this._connectedTransformNode.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},e.Parse=function(t,i,n,r){var o,s=t.name;o=t.url?n+t.url:n+s;var c,l={autoplay:t.autoplay,loop:t.loop,volume:t.volume,spatialSound:t.spatialSound,maxDistance:t.maxDistance,rolloffFactor:t.rolloffFactor,refDistance:t.refDistance,distanceModel:t.distanceModel,playbackRate:t.playbackRate};if(r){var u=function(){r._isReadyToPlay?(c._audioBuffer=r.getAudioBuffer(),c._isReadyToPlay=!0,c.autoplay&&c.play(0,c._offset,c._length)):window.setTimeout(u,300)};c=new e(s,new ArrayBuffer(0),i,null,l),u()}else c=new e(s,o,i,function(){i._removePendingData(c)},l),i._addPendingData(c);if(t.position){var h=a.e.FromArray(t.position);c.setPosition(h)}if(t.isDirectional&&(c.setDirectionalCone(t.coneInnerAngle||360,t.coneOuterAngle||360,t.coneOuterGain||0),t.localDirectionToMesh)){var d=a.e.FromArray(t.localDirectionToMesh);c.setLocalDirectionToMesh(d)}if(t.connectedMeshId){var f=i.getMeshByID(t.connectedMeshId);f&&c.attachToMesh(f)}return c},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("AudioSceneComponent")},e}(),we=function(){function e(e,t){void 0===t&&(t={}),this.id=-1,this._isMainTrack=!1,this._isInitialized=!1,this._scene=e,this.soundCollection=new Array,this._options=t,!this._isMainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}return e.prototype._initializeSoundTrackAudioGraph=function(){Ce.b.audioEngine.canUseWebAudio&&Ce.b.audioEngine.audioContext&&(this._outputAudioNode=Ce.b.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(Ce.b.audioEngine.masterGain),this._options&&(this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._options.mainTrack&&(this._isMainTrack=this._options.mainTrack)),this._isInitialized=!0)},e.prototype.dispose=function(){if(Ce.b.audioEngine&&Ce.b.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},e.prototype.AddSound=function(e){this._isInitialized||this._initializeSoundTrackAudioGraph(),Ce.b.audioEngine.canUseWebAudio&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.RemoveSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].RemoveSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},e.prototype.RemoveSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},e.prototype.setVolume=function(e){Ce.b.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){if(Ce.b.audioEngine.canUseWebAudio)for(var e=0;e0?e.activeCameras[0]:e.activeCamera){t.audioContext.listener.setPosition(n.globalPosition.x,n.globalPosition.y,n.globalPosition.z),n.rigCameras&&n.rigCameras.length>0&&(n=n.rigCameras[0]);var r=a.a.Invert(n.getViewMatrix()),o=a.e.TransformNormal(new a.e(0,0,-1),r);o.normalize(),isNaN(o.x)||isNaN(o.y)||isNaN(o.z)||t.audioContext.listener.setOrientation(o.x,o.y,o.z,0,1,0)}else t.audioContext.listener.setPosition(0,0,0)}var s;for(s=0;s0?1/r:0,c=0;c0},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();this._onPrePointerObservableObserver=i.onPrePointerObservable.add(function(e){e.type!==Ue.a.POINTERDOWN?e.type===Ue.a.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0}),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){var e=Q.a.Now,i=0;null!=t._lastFrameTime&&(i=e-t._lastFrameTime),t._lastFrameTime=e,t._applyUserInteraction();var n=e-t._lastInteractionTime-t._idleRotationWaitTime,r=Math.max(Math.min(n/t._idleRotationSpinupTime,1),0);t._cameraRotationSpeed=t._idleRotationSpeed*r,t._attachedCamera&&(t._attachedCamera.alpha-=t._cameraRotationSpeed*(i/1e3))})},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=Q.a.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e}(),ke=function(){function e(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(e.prototype,"name",{get:function(){return"Bouncing"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var t=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var i=this._attachedCamera;i&&(e?this._onMeshTargetChangedObserver=i.onMeshTargetChangedObservable.add(function(e){if(e){e.computeWorldMatrix(!0);var i=e.getBoundingInfo().diagonalLength;t.lowerRadiusTransitionRange=.05*i,t.upperRadiusTransitionRange=.05*i}}):this._onMeshTargetChangedObserver&&i.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add(function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))})},e.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},e.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&(this._attachedCamera.radius===e&&!this._radiusIsAnimating)},e.prototype._applyBoundRadiusAnimation=function(t){var i=this;if(this._attachedCamera){this._radiusBounceTransition||(e.EasingFunction.setEasingMode(e.EasingMode),this._radiusBounceTransition=k.CreateAnimation("radius",k.ANIMATIONTYPE_FLOAT,60,e.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var n=k.TransitionTo("radius",this._attachedCamera.radius+t,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,function(){return i._clearAnimationLocks()});n&&this._animatables.push(n)}},e.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},e.EasingFunction=new fe(.3),e.EasingMode=he.EASINGMODE_EASEOUT,e}(),Ge=function(){function e(){this._mode=e.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"Framing"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(t){var i=this;this._attachedCamera=t;var n=this._attachedCamera.getScene();e.EasingFunction.setEasingMode(e.EasingMode),this._onPrePointerObservableObserver=n.onPrePointerObservable.add(function(e){e.type!==Ue.a.POINTERDOWN?e.type===Ue.a.POINTERUP&&(i._isPointerDown=!1):i._isPointerDown=!0}),this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add(function(e){e&&i.zoomOnMesh(e)}),this._onAfterCheckInputsObserver=t.onAfterCheckInputsObservable.add(function(){i._applyUserInteraction(),i._maintainCameraAboveGround()})},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},e.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(n.minimumWorld,n.maximumWorld,t,i)},e.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var n=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(n.min,n.max,t,i)},e.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var n=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new a.e(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;ol.upperRadiusLimit?l.upperRadiusLimit:c),c):0},e.prototype._maintainCameraAboveGround=function(){var t=this;if(!(this._elevationReturnTime<0)){var i=Q.a.Now-this._lastInteractionTime,n=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&i>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=k.CreateAnimation("beta",k.ANIMATIONTYPE_FLOAT,60,e.EasingFunction));var o=k.TransitionTo("beta",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,function(){t._clearAnimationLocks(),t.stopAllAnimations()});o&&this._animatables.push(o)}}},e.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return a.d.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),n=i*t;return new a.d(n,i)},e.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},e.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=Q.a.Now,this.stopAllAnimations(),this._clearAnimationLocks())},e.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(e.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!0,configurable:!0}),e.EasingFunction=new ge,e.EasingMode=he.EASINGMODE_EASEINOUT,e.IgnoreBoundsSizeMode=0,e.FitFrustumSidesMode=1,e}(),ze=function(e,t,i,n){void 0===t&&(t=new a.e),void 0===i&&(i=0),void 0===n&&(n=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=n},je=function(){function e(e){this.ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new ze(a.e.Up()),new ze(a.e.Down()),new ze(a.e.Left()),new ze(a.e.Right()),new ze(a.e.Forward()),new ze(a.e.Forward().scaleInPlace(-1))],this._tmpMatrix=new a.a,this._tmpVector=new a.e,this._zeroVector=a.e.Zero(),this._lookAtTmpMatrix=new a.a}return e.prototype.init=function(){},e.prototype._closestFace=function(e){var t=this;return this._faceVectors.forEach(function(i){t._target.rotationQuaternion||(t._target.rotationQuaternion=a.b.RotationYawPitchRoll(t._target.rotation.y,t._target.rotation.x,t._target.rotation.z)),t._target.rotationQuaternion.toRotationMatrix(t._tmpMatrix),a.e.TransformCoordinatesToRef(i.direction,t._tmpMatrix,i.rotatedDirection),i.diff=a.e.GetAngleBetweenVectors(i.rotatedDirection,e,a.e.Cross(i.rotatedDirection,e))}),this._faceVectors.reduce(function(e,t){return e.ignore?t:t.ignore?e:e.diff1)return e._setAllVisibility(e._ownerNode,1),void(e._hoverValue=e.fadeInTime+e.delay);if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return void(e._hoverValue=0);setTimeout(e._update,e._millisecondsPerFrame)}}}return Object.defineProperty(e.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},e.prototype.detach=function(){this._ownerNode=null},e.prototype.fadeIn=function(e){this._hovered=e,this._update()},e.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach(function(e){i._setAllVisibility(e,t)})},e}(),He=i(58),Xe=function(){function e(){this._startDistance=0,this._initialScale=new a.e(0,0,0),this._targetScale=new a.e(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new He.a({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new He.a({}),this._dragBehaviorB.moveAttached=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},e.prototype.attach=function(e){var t=this;this._ownerNode=e,this._dragBehaviorA.onDragStartObservable.add(function(i){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerID==t._dragBehaviorB.currentDraggingPointerID?t._dragBehaviorA.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))}),this._dragBehaviorB.onDragStartObservable.add(function(i){t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging&&(t._dragBehaviorA.currentDraggingPointerID==t._dragBehaviorB.currentDraggingPointerID?t._dragBehaviorB.releaseDrag():(t._initialScale.copyFrom(e.scaling),t._startDistance=t._getCurrentDistance()))}),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(e){e.onDragObservable.add(function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var e=t._getCurrentDistance()/t._startDistance;t._initialScale.scaleToRef(e,t._targetScale)}})}),e.addBehavior(this._dragBehaviorA),e.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add(function(){if(t._dragBehaviorA.dragging&&t._dragBehaviorB.dragging){var i=t._targetScale.subtract(e.scaling).scaleInPlace(.1);i.length()>.01&&e.scaling.addInPlace(i)}})},e.prototype.detach=function(){var e=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach(function(t){t.onDragStartObservable.clear(),t.onDragObservable.clear(),e._ownerNode.removeBehavior(t)})},e}(),Ye=i(26),Ke=i(24),Qe=i(51),qe=function(){function e(){this._sceneRenderObserver=null,this._targetPosition=new a.e(0,0,0),this._moving=!1,this._startingOrientation=new a.b,this.zDragFactor=3,this.rotateDraggedObject=!0,this.dragging=!1,this.dragDeltaRatio=.2,this.currentDraggingPointerID=-1,this.detachCameraControls=!0,this.onDragStartObservable=new o.c,this.onDragEndObservable=new o.c}return Object.defineProperty(e.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},Object.defineProperty(e.prototype,"_pointerCamera",{get:function(){return this._scene.cameraToUseForPointers?this._scene.cameraToUseForPointers:this._scene.activeCamera},enumerable:!0,configurable:!0}),e.prototype.attach=function(t){var i=this;this._ownerNode=t,this._scene=this._ownerNode.getScene(),e._virtualScene||(e._virtualScene=new K.a(this._scene.getEngine()),e._virtualScene.detachControl(),this._scene.getEngine().scenes.pop());var n=null,r=new a.e(0,0,0);this._virtualOriginMesh=new Ye.a("",e._virtualScene),this._virtualOriginMesh.rotationQuaternion=new a.b,this._virtualDragMesh=new Ye.a("",e._virtualScene),this._virtualDragMesh.rotationQuaternion=new a.b;var o=null;this._pointerObserver=this._scene.onPointerObservable.add(function(e,t){if(e.type==Ue.a.POINTERDOWN){if(!i.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.ray&&(h=e.pickInfo.pickedMesh,i._ownerNode==h||h.isDescendantOf(i._ownerNode))){i._pointerCamera&&i._pointerCamera.cameraRigMode==Ke.a.RIG_MODE_NONE&&e.pickInfo.ray.origin.copyFrom(i._pointerCamera.globalPosition),n=i._ownerNode,Qe.a._RemoveAndStorePivotPoint(n),r.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),i._virtualOriginMesh.removeChild(i._virtualDragMesh),n.computeWorldMatrix(),i._virtualDragMesh.position.copyFrom(n.absolutePosition),n.rotationQuaternion||(n.rotationQuaternion=a.b.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z));var s=n.parent;n.setParent(null),i._virtualDragMesh.rotationQuaternion.copyFrom(n.rotationQuaternion),n.setParent(s),i._virtualOriginMesh.addChild(i._virtualDragMesh),i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition),i.dragging=!0,i.currentDraggingPointerID=e.event.pointerId,i.detachCameraControls&&i._pointerCamera&&!i._pointerCamera.leftCamera&&(i._pointerCamera.inputs.attachedElement?(o=i._pointerCamera.inputs.attachedElement,i._pointerCamera.detachControl(i._pointerCamera.inputs.attachedElement)):o=null),Qe.a._RestorePivotPoint(n),i.onDragStartObservable.notifyObservers({})}}else if(e.type==Ue.a.POINTERUP)i.currentDraggingPointerID==e.event.pointerId&&(i.dragging=!1,i._moving=!1,i.currentDraggingPointerID=-1,n=null,i._virtualOriginMesh.removeChild(i._virtualDragMesh),i.detachCameraControls&&o&&i._pointerCamera&&!i._pointerCamera.leftCamera&&i._pointerCamera.attachControl(o,!0),i.onDragEndObservable.notifyObservers({}));else if(e.type==Ue.a.POINTERMOVE&&i.currentDraggingPointerID==e.event.pointerId&&i.dragging&&e.pickInfo&&e.pickInfo.ray&&n){var c=i.zDragFactor;i._pointerCamera&&i._pointerCamera.cameraRigMode==Ke.a.RIG_MODE_NONE&&(e.pickInfo.ray.origin.copyFrom(i._pointerCamera.globalPosition),c=0);var l=e.pickInfo.ray.origin.subtract(r);r.copyFrom(e.pickInfo.ray.origin);var u=-a.e.Dot(l,e.pickInfo.ray.direction);i._virtualOriginMesh.addChild(i._virtualDragMesh),i._virtualDragMesh.position.z-=i._virtualDragMesh.position.z<1?u*i.zDragFactor:u*c*i._virtualDragMesh.position.z,i._virtualDragMesh.position.z<0&&(i._virtualDragMesh.position.z=0),i._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),i._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.add(e.pickInfo.ray.direction)),i._virtualOriginMesh.removeChild(i._virtualDragMesh),i._targetPosition.copyFrom(i._virtualDragMesh.absolutePosition),n.parent&&a.e.TransformCoordinatesToRef(i._targetPosition,a.a.Invert(n.parent.getWorldMatrix()),i._targetPosition),i._moving||i._startingOrientation.copyFrom(i._virtualDragMesh.rotationQuaternion),i._moving=!0}var h});var s=new a.b;this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add(function(){if(i.dragging&&i._moving&&n){if(Qe.a._RemoveAndStorePivotPoint(n),n.position.addInPlace(i._targetPosition.subtract(n.position).scale(i.dragDeltaRatio)),i.rotateDraggedObject){s.copyFrom(i._startingOrientation),s.x=-s.x,s.y=-s.y,s.z=-s.z,i._virtualDragMesh.rotationQuaternion.multiplyToRef(s,s),a.b.RotationYawPitchRollToRef(s.toEulerAngles("xyz").y,0,0,s),s.multiplyToRef(i._startingOrientation,s);var e=n.parent;(!e||e.scaling&&!e.scaling.isNonUniformWithinEpsilon(.001))&&(n.setParent(null),a.b.SlerpToRef(n.rotationQuaternion,s,i.dragDeltaRatio,n.rotationQuaternion),n.setParent(e))}Qe.a._RestorePivotPoint(n)}})},e.prototype.detach=function(){this._scene&&this._scene.onPointerObservable.remove(this._pointerObserver),this._ownerNode&&this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),this._virtualOriginMesh&&this._virtualOriginMesh.dispose(),this._virtualDragMesh&&this._virtualDragMesh.dispose(),this.onDragEndObservable.clear(),this.onDragStartObservable.clear()},e}(),Ze=function(){function e(e,t,i){if(this.targetPosition=a.e.Zero(),this.poleTargetPosition=a.e.Zero(),this.poleTargetLocalOffset=a.e.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=a.b.Identity(),this._bone1Mat=a.a.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=a.e.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),this._bone1){this.mesh=e;var n=t.getPosition();if(t.getAbsoluteTransform().determinant()>0&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,n.x>n.y&&n.x>n.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length){var r=this._bone1.getScale(),o=this._bone2.getScale();this._bone1Length=this._bone1.length*r.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*o.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);var s=this._bone2.children[0].getAbsolutePosition(e),c=this._bone2.getAbsolutePosition(e),l=this._bone1.getAbsolutePosition(e);this._bone1Length=a.e.Distance(s,c),this._bone2Length=a.e.Distance(c,l)}this._bone1.getRotationMatrixToRef(Z.b.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}}return Object.defineProperty(e.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!0,configurable:!0}),e.prototype._setMaxAngle=function(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))},e.prototype.update=function(){var t=this._bone1;if(t){var i=this.targetPosition,n=this.poleTargetPosition,r=e._tmpMats[0],o=e._tmpMats[1];this.targetMesh&&i.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,n):this.poleTargetMesh&&a.e.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),n);var s=e._tmpVecs[0],c=e._tmpVecs[1],l=e._tmpVecs[2],u=e._tmpVecs[3],h=e._tmpVecs[4],d=e._tmpQuat;t.getAbsolutePositionToRef(this.mesh,s),n.subtractToRef(s,h),0==h.x&&0==h.y&&0==h.z?h.y=1:h.normalize(),i.subtractToRef(s,u),u.normalize(),a.e.CrossToRef(u,h,c),c.normalize(),a.e.CrossToRef(u,c,l),l.normalize(),a.a.FromXYZAxesToRef(l,u,c,r);var f=this._bone1Length,p=this._bone2Length,_=a.e.Distance(s,i);this._maxReach>0&&(_=Math.min(this._maxReach,_));var m=(p*p+_*_-f*f)/(2*p*_),g=(_*_+f*f-p*p)/(2*_*f);m>1&&(m=1),g>1&&(g=1),m<-1&&(m=-1),g<-1&&(g=-1);var v=Math.acos(m),y=Math.acos(g),b=-v-y;if(this._rightHandedSystem)a.a.RotationYawPitchRollToRef(0,0,this._adjustRoll,o),o.multiplyToRef(r,r),a.a.RotationAxisToRef(this._bendAxis,y,o),o.multiplyToRef(r,r);else{var T=e._tmpVecs[5];T.copyFrom(this._bendAxis),T.x*=-1,a.a.RotationAxisToRef(T,-y,o),o.multiplyToRef(r,r)}this.poleAngle&&(a.a.RotationAxisToRef(u,this.poleAngle,o),r.multiplyToRef(o,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||a.b.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),a.b.FromRotationMatrixToRef(r,d),a.b.SlerpToRef(this._bone1Quat,d,this.slerpAmount,this._bone1Quat),b=this._bone2Ang*(1-this.slerpAmount)+b*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,Z.b.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,Z.b.WORLD,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1)),this._bone2.setAxisAngle(this._bendAxis,b,Z.b.LOCAL),this._bone2Ang=b}},e._tmpVecs=[a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero(),a.e.Zero()],e._tmpQuat=a.b.Identity(),e._tmpMats=[a.a.Identity(),a.a.Identity()],e}(),Je=function(){function e(e,t,i,n){if(this.upAxis=a.e.Up(),this.upAxisSpace=Z.b.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=a.b.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=a.e.Forward(),this.mesh=e,this.bone=t,this.target=i,n&&(n.adjustYaw&&(this.adjustYaw=n.adjustYaw),n.adjustPitch&&(this.adjustPitch=n.adjustPitch),n.adjustRoll&&(this.adjustRoll=n.adjustRoll),null!=n.maxYaw?this.maxYaw=n.maxYaw:this.maxYaw=Math.PI,null!=n.minYaw?this.minYaw=n.minYaw:this.minYaw=-Math.PI,null!=n.maxPitch?this.maxPitch=n.maxPitch:this.maxPitch=Math.PI,null!=n.minPitch?this.minPitch=n.minPitch:this.minPitch=-Math.PI,null!=n.slerpAmount&&(this.slerpAmount=n.slerpAmount),null!=n.upAxis&&(this.upAxis=n.upAxis),null!=n.upAxisSpace&&(this.upAxisSpace=n.upAxisSpace),null!=n.yawAxis||null!=n.pitchAxis)){var r=Z.a.Y,o=Z.a.X;null!=n.yawAxis&&(r=n.yawAxis.clone()).normalize(),null!=n.pitchAxis&&(o=n.pitchAxis.clone()).normalize();var s=a.e.Cross(o,r);this._transformYawPitch=a.a.Identity(),a.a.FromXYZAxesToRef(o,r,s,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=Z.b.BONE||(this.upAxisSpace=Z.b.LOCAL)}return Object.defineProperty(e.prototype,"minYaw",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxYaw",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),e.prototype.update=function(){if(this.slerpAmount<1&&!this._firstFrameSkipped)this._firstFrameSkipped=!0;else{var t=this.bone,i=e._tmpVecs[0];t.getAbsolutePositionToRef(this.mesh,i);var n=this.target,r=e._tmpMats[0],o=e._tmpMats[1],s=this.mesh,c=t.getParent(),l=e._tmpVecs[1];l.copyFrom(this.upAxis),this.upAxisSpace==Z.b.BONE&&c?(this._transformYawPitch&&a.e.TransformCoordinatesToRef(l,this._transformYawPitchInv,l),c.getDirectionToRef(l,this.mesh,l)):this.upAxisSpace==Z.b.LOCAL&&(s.getDirectionToRef(l,l),1==s.scaling.x&&1==s.scaling.y&&1==s.scaling.z||l.normalize());var u=!1,h=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(u=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(h=!0),u||h){var d=e._tmpMats[2],f=e._tmpMats[3];if(this.upAxisSpace==Z.b.BONE&&1==l.y&&c)c.getRotationMatrixToRef(Z.b.WORLD,this.mesh,d);else if(this.upAxisSpace!=Z.b.LOCAL||1!=l.y||c){(_=e._tmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&a.e.TransformCoordinatesToRef(_,this._transformYawPitchInv,_),c?c.getDirectionToRef(_,this.mesh,_):s.getDirectionToRef(_,_);var p=a.e.Cross(l,_);p.normalize();var _=a.e.Cross(p,l);a.a.FromXYZAxesToRef(p,l,_,d)}else d.copyFrom(s.getWorldMatrix());d.invertToRef(f);var m=null;if(h){var g=e._tmpVecs[3];n.subtractToRef(i,g),a.e.TransformCoordinatesToRef(g,f,g),m=Math.sqrt(g.x*g.x+g.z*g.z);var v=Math.atan2(g.y,m),y=v;v>this._maxPitch?(g.y=this._maxPitchTan*m,y=this._maxPitch):vthis._maxYaw||bMath.PI?this._isAngleBetween(b,this._maxYaw,this._midYawConstraint)?(g.z=this._maxYawCos*m,g.x=this._maxYawSin*m,T=this._maxYaw):this._isAngleBetween(b,this._midYawConstraint,this._minYaw)&&(g.z=this._minYawCos*m,g.x=this._minYawSin*m,T=this._minYaw):b>this._maxYaw?(g.z=this._maxYawCos*m,g.x=this._maxYawSin*m,T=this._maxYaw):bMath.PI){var E=e._tmpVecs[8];E.copyFrom(Z.a.Z),this._transformYawPitch&&a.e.TransformCoordinatesToRef(E,this._transformYawPitchInv,E);var A=e._tmpMats[4];this._boneQuat.toRotationMatrix(A),this.mesh.getWorldMatrix().multiplyToRef(A,A),a.e.TransformCoordinatesToRef(E,A,E),a.e.TransformCoordinatesToRef(E,f,E);var P=Math.atan2(E.x,E.z);if(this._getAngleBetween(P,b)>this._getAngleBetween(P,this._midYawConstraint)){null==m&&(m=Math.sqrt(g.x*g.x+g.z*g.z));var S=this._getAngleBetween(P,this._maxYaw);this._getAngleBetween(P,this._minYaw)Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},e.prototype._getAngleBetween=function(e,t){var i=0;return(i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI&&(i=2*Math.PI-i),i},e.prototype._isAngleBetween=function(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(e>t&&ei&&e>v,b=0;b<6;b++){var T=g[v][b];m&&(T=d._convertRGBtoRGBATextureData(T,y,y,r)),f.texImage2D(b,v,_,y,y,0,u,l,T)}d._bindTextureDirectly(f.TEXTURE_CUBE_MAP,null)}else d.updateRawCubeTexture(p,o,n,r,h);p.isReady=!0,t._removePendingData(p),c&&c()}}(e)},void 0,t.offlineProvider,!0,function(e,i){t._removePendingData(p),l&&e&&l(e.status+" "+e.statusText,i)}),p},Ce.b.prototype.createRawTexture3D=function(e,t,i,n,r,o,a,s,c,l){void 0===c&&(c=null),void 0===l&&(l=Ce.b.TEXTURETYPE_UNSIGNED_INT);var u=new et.a(this,et.a.DATASOURCE_RAW3D);u.baseWidth=t,u.baseHeight=i,u.baseDepth=n,u.width=t,u.height=i,u.depth=n,u.format=r,u.type=l,u.generateMipMaps=o,u.samplingMode=s,u.is3D=!0,this._doNotHandleContextLost||(u._bufferView=e),this.updateRawTexture3D(u,e,r,a,c,l),this._bindTextureDirectly(this._gl.TEXTURE_3D,u,!0);var h=this._getSamplingParameters(s,o);return this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,h.mag),this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,h.min),o&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._internalTexturesCache.push(u),u},Ce.b.prototype.updateRawTexture3D=function(e,t,i,n,r,o){void 0===r&&(r=null),void 0===o&&(o=Ce.b.TEXTURETYPE_UNSIGNED_INT);var a=this._getWebGLTextureType(o),s=this._getInternalFormat(i),c=this._getRGBABufferInternalSizedFormat(o,i);this._bindTextureDirectly(this._gl.TEXTURE_3D,e,!0),this._unpackFlipY(void 0===n||!!n),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=n,e._compression=r),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),r&&t?this._gl.compressedTexImage3D(this._gl.TEXTURE_3D,0,this.getCaps().s3tc[r],e.width,e.height,e.depth,0,t):this._gl.texImage3D(this._gl.TEXTURE_3D,0,c,e.width,e.height,e.depth,0,s,a,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),e.isReady=!0};var tt=function(e){function t(t,i,n,r,o,a,s,c,l){void 0===a&&(a=!0),void 0===s&&(s=!1),void 0===c&&(c=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===l&&(l=g.a.TEXTURETYPE_UNSIGNED_INT);var u=e.call(this,null,o,!a,s)||this;return u.format=r,u._engine=o.getEngine(),u._texture=o.getEngine().createRawTexture(t,i,n,r,a,s,c,null,l),u.wrapU=$e.a.CLAMP_ADDRESSMODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,u}return h.d(t,e),t.prototype.update=function(e){this._engine.updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,null,this._texture.type)},t.CreateLuminanceTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_LUMINANCE,r,o,a,s)},t.CreateLuminanceAlphaTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_LUMINANCE_ALPHA,r,o,a,s)},t.CreateAlphaTexture=function(e,i,n,r,o,a,s){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),new t(e,i,n,g.a.TEXTUREFORMAT_ALPHA,r,o,a,s)},t.CreateRGBTexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,g.a.TEXTUREFORMAT_RGB,r,o,a,s,c)},t.CreateRGBATexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=g.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),new t(e,i,n,g.a.TEXTUREFORMAT_RGBA,r,o,a,s,c)},t.CreateRTexture=function(e,i,n,r,o,a,s,c){return void 0===o&&(o=!0),void 0===a&&(a=!1),void 0===s&&(s=$e.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=g.a.TEXTURETYPE_FLOAT),new t(e,i,n,g.a.TEXTUREFORMAT_R,r,o,a,s,c)},t}($e.a),it=function(){function e(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this.overrideMesh=null,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=a.a.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this._canUseTextureForBones=!1,this._uniqueId=0,this._numBonesWithLinkedTransformNode=0,this._hasWaitingData=null,this.doNotSerialize=!1,this._useTextureToStoreBoneMatrices=!0,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new o.c,this.bones=[],this._scene=i||C.a.LastCreatedScene,this._uniqueId=this._scene.getUniqueId(),this._scene.addSkeleton(this),this._isDirty=!0;var n=this._scene.getEngine().getCaps();this._canUseTextureForBones=n.textureFloat&&n.maxVertexTextureImageUnits>0}return Object.defineProperty(e.prototype,"useTextureToStoreBoneMatrices",{get:function(){return this._useTextureToStoreBoneMatrices},set:function(e){this._useTextureToStoreBoneMatrices=e,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isUsingTextureForMatrices",{get:function(){return this.useTextureToStoreBoneMatrices&&this._canUseTextureForBones},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"Skeleton"},e.prototype.getChildren=function(){return this.bones.filter(function(e){return!e.getParent()})},e.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},e.prototype.getTransformMatrixTexture=function(e){return this.needInitialSkinMatrix&&e._transformMatrixTexture?e._transformMatrixTexture:this._transformMatrixTexture},e.prototype.getScene=function(){return this._scene},e.prototype.toString=function(e){var t="Name: "+this.name+", nBones: "+this.bones.length;if(t+=", nAnimationRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var n in this._ranges)i&&(t+=", ",i=!1),t+=n;t+="}"}return t},e.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t-1&&this._meshesWithPoseMatrix.splice(t,1)},e.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i0)for(var e=0,t=this.bones;e0&&(r.animation=i.animations[0].serialize()),e.ranges=[],this._ranges){var a=this._ranges[o];if(a){var s={};s.name=o,s.from=a.from,s.to=a.to,e.ranges.push(s)}}}return e},e.Parse=function(t,i){var n,r=new e(t.name,t.id,i);for(t.dimensionsAtRest&&(r.dimensionsAtRest=a.e.FromArray(t.dimensionsAtRest)),r.needInitialSkinMatrix=t.needInitialSkinMatrix,n=0;n-1&&(s=r.bones[o.parentBoneIndex]);var c=o.rest?a.a.FromArray(o.rest):null,l=new J(o.name,r,s,a.a.FromArray(o.matrix),c);void 0!==o.id&&null!==o.id&&(l.id=o.id),o.length&&(l.length=o.length),o.metadata&&(l.metadata=o.metadata),o.animation&&l.animations.push(k.Parse(o.animation)),void 0!==o.linkedTransformNodeId&&null!==o.linkedTransformNodeId&&(r._hasWaitingData=!0,l._waitingTransformNodeId=o.linkedTransformNodeId)}if(t.ranges)for(n=0;n0&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},e.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i=2&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),this.browserGamepad.axes.length>=4&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}return Object.defineProperty(e.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!0,configurable:!0}),e.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},e.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(e.prototype,"leftStick",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightStick",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!0,configurable:!0}),e.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},e.prototype.dispose=function(){},e.GAMEPAD=0,e.GENERIC=1,e.XBOX=2,e.POSE_ENABLED=3,e.DUALSHOCK=4,e}(),st=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.onButtonDownObservable=new o.c,r.onButtonUpObservable=new o.c,r.type=at.GENERIC,r._buttons=new Array(n.buttons.length),r}return h.d(t,e),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t.005&&(e.inertialAlphaOffset+=i)}if(0!=t.y){var n=t.y/this.gamepadRotationSensibility;0!=n&&Math.abs(n)>.005&&(e.inertialBetaOffset+=n)}}var r=this.gamepad.leftStick;if(r&&0!=r.y){var o=r.y/this.gamepadMoveSensibility;0!=o&&Math.abs(o)>.005&&(this.camera.inertialRadiusOffset-=o)}}},e.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},h.c([Object(F.c)()],e.prototype,"gamepadRotationSensibility",void 0),h.c([Object(F.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();nt.ArcRotateCameraGamepadInput=ct;var lt=i(59),ut=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;r.metaKey||(e.type===lt.a.KEYDOWN?(i._ctrlPressed=r.ctrlKey,i._altPressed=r.altKey,(-1!==i.keysUp.indexOf(r.keyCode)||-1!==i.keysDown.indexOf(r.keyCode)||-1!==i.keysLeft.indexOf(r.keyCode)||-1!==i.keysRight.indexOf(r.keyCode)||-1!==i.keysReset.indexOf(r.keyCode))&&(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),r.preventDefault&&(t||r.preventDefault()))):-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)&&-1===i.keysReset.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),r.preventDefault&&(t||r.preventDefault())))}))},e.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=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t0?i/(1+this.wheelDeltaPercentage):i*(1+this.wheelDeltaPercentage)},e.prototype.attachControl=function(e,t){var i=this;this._wheel=function(e,n){if(e.type===Ue.a.POINTERWHEEL){var r=e.event,o=0,a=r;if(a.wheelDelta)if(i.wheelDeltaPercentage){if((o=i.computeDeltaFromMouseWheelLegacyEvent(a,i.camera.radius))>0){for(var s=i.camera.radius,c=i.camera.inertialRadiusOffset+o,l=0;l<20&&Math.abs(c)>.001;l++)s-=c,c*=i.camera.inertia;s=w.a.Clamp(s,0,Number.MAX_VALUE),o=i.computeDeltaFromMouseWheelLegacyEvent(a,s)}}else o=a.wheelDelta/(40*i.wheelPrecision);else o=-(r.deltaY||r.detail)/i.wheelPrecision;o&&(i.camera.inertialRadiusOffset+=o),r.preventDefault&&(t||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Ue.a.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},h.c([Object(F.c)()],e.prototype,"wheelPrecision",void 0),h.c([Object(F.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();nt.ArcRotateCameraMouseWheelInput=ht;var dt=function(){function e(){this.buttons=[0,1,2]}return e.prototype.attachControl=function(e,t){var i=this,n=this.camera.getEngine(),r=0,o=null;this.pointA=null,this.pointB=null,this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0,this._pointerInput=function(a,s){var c=a.event,l="touch"===c.pointerType;if(!n.isInVRExclusivePointerMode&&(a.type===Ue.a.POINTERMOVE||-1!==i.buttons.indexOf(c.button))){var u=c.srcElement||c.target;if(i._altKey=c.altKey,i._ctrlKey=c.ctrlKey,i._metaKey=c.metaKey,i._shiftKey=c.shiftKey,i._buttonsPressed=c.buttons,n.isPointerLock){var h=c.movementX||c.mozMovementX||c.webkitMovementX||c.msMovementX||0,d=c.movementY||c.mozMovementY||c.webkitMovementY||c.msMovementY||0;i.onTouch(null,h,d),i.pointA=null,i.pointB=null}else if(a.type===Ue.a.POINTERDOWN&&u){try{u.setPointerCapture(c.pointerId)}catch(e){}null===i.pointA?i.pointA={x:c.clientX,y:c.clientY,pointerId:c.pointerId,type:c.pointerType}:null===i.pointB&&(i.pointB={x:c.clientX,y:c.clientY,pointerId:c.pointerId,type:c.pointerType}),i.onButtonDown(c),t||(c.preventDefault(),e.focus())}else if(a.type===Ue.a.POINTERDOUBLETAP)i.onDoubleTap(c.pointerType);else if(a.type===Ue.a.POINTERUP&&u){try{u.releasePointerCapture(c.pointerId)}catch(e){}l||(i.pointB=null),n._badOS?i.pointA=i.pointB=null:i.pointB&&i.pointA&&i.pointA.pointerId==c.pointerId?(i.pointA=i.pointB,i.pointB=null):i.pointA&&i.pointB&&i.pointB.pointerId==c.pointerId?i.pointB=null:i.pointA=i.pointB=null,(0!==r||o)&&(i.onMultiTouch(i.pointA,i.pointB,r,0,o,null),r=0,o=null),i.onButtonUp(c),t||c.preventDefault()}else if(a.type===Ue.a.POINTERMOVE)if(t||c.preventDefault(),i.pointA&&null===i.pointB){h=c.clientX-i.pointA.x,d=c.clientY-i.pointA.y;i.onTouch(i.pointA,h,d),i.pointA.x=c.clientX,i.pointA.y=c.clientY}else if(i.pointA&&i.pointB){var f=i.pointA.pointerId===c.pointerId?i.pointA:i.pointB;f.x=c.clientX,f.y=c.clientY;var p=i.pointA.x-i.pointB.x,_=i.pointA.y-i.pointB.y,m=p*p+_*_,g={x:(i.pointA.x+i.pointB.x)/2,y:(i.pointA.y+i.pointB.y)/2,pointerId:c.pointerId,type:a.type};i.onMultiTouch(i.pointA,i.pointB,r,m,o,g),o=g,r=m}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,Ue.a.POINTERDOWN|Ue.a.POINTERUP|Ue.a.POINTERMOVE),this._onLostFocus=function(){i.pointA=i.pointB=null,r=0,o=null,i.onLostFocus()},e.addEventListener("contextmenu",this.onContextMenu.bind(this),!1),Ie.b.RegisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(),[{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){this._onLostFocus&&Ie.b.UnregisterTopRootEvents(this.camera.getScene().getEngine().getHostWindow(),[{name:"blur",handler:this._onLostFocus}]),e&&this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this.onContextMenu&&e.removeEventListener("contextmenu",this.onContextMenu),this._onLostFocus=null),this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._buttonsPressed=0},e.prototype.getClassName=function(){return"BaseCameraPointersInput"},e.prototype.getSimpleName=function(){return"pointers"},e.prototype.onDoubleTap=function(e){},e.prototype.onTouch=function(e,t,i){},e.prototype.onMultiTouch=function(e,t,i,n,r,o){},e.prototype.onContextMenu=function(e){e.preventDefault()},e.prototype.onButtonDown=function(e){},e.prototype.onButtonUp=function(e){},e.prototype.onLostFocus=function(){},h.c([Object(F.c)()],e.prototype,"buttons",void 0),e}(),ft=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.buttons=[0,1,2],t.angularSensibilityX=1e3,t.angularSensibilityY=1e3,t.pinchPrecision=12,t.pinchDeltaPercentage=0,t.panningSensibility=1e3,t.multiTouchPanning=!0,t.multiTouchPanAndZoom=!0,t.pinchInwards=!0,t._isPanClick=!1,t._twoFingerActivityCount=0,t._isPinching=!1,t}return h.d(t,e),t.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},t.prototype.onTouch=function(e,t,i){0!==this.panningSensibility&&(this._ctrlKey&&this.camera._useCtrlForPanning||this._isPanClick)?(this.camera.inertialPanningX+=-t/this.panningSensibility,this.camera.inertialPanningY+=i/this.panningSensibility):(this.camera.inertialAlphaOffset-=t/this.angularSensibilityX,this.camera.inertialBetaOffset-=i/this.angularSensibilityY)},t.prototype.onDoubleTap=function(e){this.camera.useInputToRestoreState&&this.camera.restoreState()},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var a=this.pinchInwards?1:-1;if(this.multiTouchPanAndZoom){if(this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),0!==this.panningSensibility&&r&&o){var s=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility}}else{this._twoFingerActivityCount++;var l=Math.sqrt(i),u=Math.sqrt(n);if(this._isPinching||this._twoFingerActivityCount<20&&Math.abs(u-l)>this.camera.pinchToPanMaxDistance)this.pinchDeltaPercentage?this.camera.inertialRadiusOffset+=.001*(n-i)*this.camera.radius*this.pinchDeltaPercentage:this.camera.inertialRadiusOffset+=(n-i)/(this.pinchPrecision*a*(this.angularSensibilityX+this.angularSensibilityY)/2),this._isPinching=!0;else if(0!==this.panningSensibility&&this.multiTouchPanning&&o&&r){s=o.x-r.x,c=o.y-r.y;this.camera.inertialPanningX+=-s/this.panningSensibility,this.camera.inertialPanningY+=c/this.panningSensibility}}}},t.prototype.onButtonDown=function(e){this._isPanClick=e.button===this.camera._panningMouseButton},t.prototype.onButtonUp=function(e){this._twoFingerActivityCount=0,this._isPinching=!1},t.prototype.onLostFocus=function(){this._isPanClick=!1,this._twoFingerActivityCount=0,this._isPinching=!1},h.c([Object(F.c)()],t.prototype,"buttons",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityX",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityY",void 0),h.c([Object(F.c)()],t.prototype,"pinchPrecision",void 0),h.c([Object(F.c)()],t.prototype,"pinchDeltaPercentage",void 0),h.c([Object(F.c)()],t.prototype,"panningSensibility",void 0),h.c([Object(F.c)()],t.prototype,"multiTouchPanning",void 0),h.c([Object(F.c)()],t.prototype,"multiTouchPanAndZoom",void 0),t}(dt);nt.ArcRotateCameraPointersInput=ft;var pt=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addMouseWheel=function(){return this.add(new ht),this},t.prototype.addPointers=function(){return this.add(new ft),this},t.prototype.addKeyboard=function(){return this.add(new ut),this},t}(rt);pt.prototype.addVRDeviceOrientation=function(){return this.add(new _t),this};var _t=function(){function e(){this.alphaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}return e.prototype.attachControl=function(e,t){this.camera.attachControl(e,t),this.camera.getScene().getEngine().getHostWindow().addEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=(0|+e.alpha)*this.alphaCorrection),null!==e.gamma&&(this._gamma=(0|+e.gamma)*this.gammaCorrection),this._dirty=!0},e.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},e.prototype.detachControl=function(e){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"VRDeviceOrientation"},e}();nt.ArcRotateCameraVRDeviceOrientationInput=_t;var mt=function(){function e(){this.keysForward=[87],this.keysBackward=[83],this.keysUp=[69],this.keysDown=[81],this.keysRight=[68],this.keysLeft=[65],this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;e.type===lt.a.KEYDOWN?-1===i.keysForward.indexOf(r.keyCode)&&-1===i.keysBackward.indexOf(r.keyCode)&&-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),t||r.preventDefault()):-1===i.keysForward.indexOf(r.keyCode)&&-1===i.keysBackward.indexOf(r.keyCode)&&-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),t||r.preventDefault())}))},e.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=[]},e.prototype.getClassName=function(){return"FlyCameraKeyboardInput"},e.prototype._onLostFocus=function(e){this._keys=[]},e.prototype.getSimpleName=function(){return"keyboard"},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t=0&&i._keys.splice(n,1),r.preventDefault&&(t||r.preventDefault())))}))},e.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=[]},e.prototype.checkInputs=function(){var e=this;this._onKeyboardObserver&&this._keys.forEach(function(t){-1!==e.keysHeightOffsetIncr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset+=e.heightSensibility:-1!==e.keysHeightOffsetDecr.indexOf(t)&&e._modifierHeightOffset()?e.camera.heightOffset-=e.heightSensibility:-1!==e.keysRotationOffsetIncr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset+=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRotationOffsetDecr.indexOf(t)&&e._modifierRotationOffset()?(e.camera.rotationOffset-=e.rotationSensibility,e.camera.rotationOffset%=360):-1!==e.keysRadiusIncr.indexOf(t)&&e._modifierRadius()?e.camera.radius+=e.radiusSensibility:-1!==e.keysRadiusDecr.indexOf(t)&&e._modifierRadius()&&(e.camera.radius-=e.radiusSensibility)})},e.prototype.getClassName=function(){return"FollowCameraKeyboardMoveInput"},e.prototype.getSimpleName=function(){return"keyboard"},e.prototype._modifierHeightOffset=function(){return this.keysHeightOffsetModifierAlt===this._altPressed&&this.keysHeightOffsetModifierCtrl===this._ctrlPressed&&this.keysHeightOffsetModifierShift===this._shiftPressed},e.prototype._modifierRotationOffset=function(){return this.keysRotationOffsetModifierAlt===this._altPressed&&this.keysRotationOffsetModifierCtrl===this._ctrlPressed&&this.keysRotationOffsetModifierShift===this._shiftPressed},e.prototype._modifierRadius=function(){return this.keysRadiusModifierAlt===this._altPressed&&this.keysRadiusModifierCtrl===this._ctrlPressed&&this.keysRadiusModifierShift===this._shiftPressed},h.c([Object(F.c)()],e.prototype,"keysHeightOffsetIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysHeightOffsetModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysRotationOffsetModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusIncr",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusDecr",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierAlt",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierCtrl",void 0),h.c([Object(F.c)()],e.prototype,"keysRadiusModifierShift",void 0),h.c([Object(F.c)()],e.prototype,"heightSensibility",void 0),h.c([Object(F.c)()],e.prototype,"rotationSensibility",void 0),h.c([Object(F.c)()],e.prototype,"radiusSensibility",void 0),e}();nt.FollowCameraKeyboardMoveInput=vt;var yt=function(){function e(){this.axisControlRadius=!0,this.axisControlHeight=!1,this.axisControlRotation=!1,this.wheelPrecision=3,this.wheelDeltaPercentage=0}return e.prototype.attachControl=function(e,t){var i=this;this._wheel=function(e,n){if(e.type===Ue.a.POINTERWHEEL){var r=e.event,o=0,a=Math.max(-1,Math.min(1,r.deltaY||r.wheelDelta||-r.detail));i.wheelDeltaPercentage?(console.assert(i.axisControlRadius+i.axisControlHeight+i.axisControlRotation<=1,"wheelDeltaPercentage only usable when mouse wheel controlls ONE axis. Currently enabled: axisControlRadius: "+i.axisControlRadius+", axisControlHeightOffset: "+i.axisControlHeight+", axisControlRotationOffset: "+i.axisControlRotation),i.axisControlRadius?o=.01*a*i.wheelDeltaPercentage*i.camera.radius:i.axisControlHeight?o=.01*a*i.wheelDeltaPercentage*i.camera.heightOffset:i.axisControlRotation&&(o=.01*a*i.wheelDeltaPercentage*i.camera.rotationOffset)):o=a*i.wheelPrecision,o&&(i.axisControlRadius?i.camera.radius+=o:i.axisControlHeight?i.camera.heightOffset-=o:i.axisControlRotation&&(i.camera.rotationOffset-=o)),r.preventDefault&&(t||r.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,Ue.a.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},h.c([Object(F.c)()],e.prototype,"axisControlRadius",void 0),h.c([Object(F.c)()],e.prototype,"axisControlHeight",void 0),h.c([Object(F.c)()],e.prototype,"axisControlRotation",void 0),h.c([Object(F.c)()],e.prototype,"wheelPrecision",void 0),h.c([Object(F.c)()],e.prototype,"wheelDeltaPercentage",void 0),e}();nt.FollowCameraMouseWheelInput=yt;var bt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.angularSensibilityX=1,t.angularSensibilityY=1,t.pinchPrecision=1e4,t.pinchDeltaPercentage=0,t.axisXControlRadius=!1,t.axisXControlHeight=!1,t.axisXControlRotation=!0,t.axisYControlRadius=!1,t.axisYControlHeight=!0,t.axisYControlRotation=!1,t.axisPinchControlRadius=!0,t.axisPinchControlHeight=!1,t.axisPinchControlRotation=!1,t.warningEnable=!0,t._warningCounter=0,t}return h.d(t,e),t.prototype.getClassName=function(){return"FollowCameraPointersInput"},t.prototype.onTouch=function(e,t,i){this._warning(),this.axisXControlRotation?this.camera.rotationOffset+=t/this.angularSensibilityX:this.axisYControlRotation&&(this.camera.rotationOffset+=i/this.angularSensibilityX),this.axisXControlHeight?this.camera.heightOffset+=t/this.angularSensibilityY:this.axisYControlHeight&&(this.camera.heightOffset+=i/this.angularSensibilityY),this.axisXControlRadius?this.camera.radius-=t/this.angularSensibilityY:this.axisYControlRadius&&(this.camera.radius-=i/this.angularSensibilityY)},t.prototype.onMultiTouch=function(e,t,i,n,r,o){if(!(0===i&&null===r||0===n&&null===o)){var a=(n-i)/(this.pinchPrecision*(this.angularSensibilityX+this.angularSensibilityY)/2);this.pinchDeltaPercentage?(a*=.01*this.pinchDeltaPercentage,this.axisPinchControlRotation&&(this.camera.rotationOffset+=a*this.camera.rotationOffset),this.axisPinchControlHeight&&(this.camera.heightOffset+=a*this.camera.heightOffset),this.axisPinchControlRadius&&(this.camera.radius-=a*this.camera.radius)):(this.axisPinchControlRotation&&(this.camera.rotationOffset+=a),this.axisPinchControlHeight&&(this.camera.heightOffset+=a),this.axisPinchControlRadius&&(this.camera.radius-=a))}},t.prototype._warning=function(){if(this.warningEnable&&this._warningCounter++%100==0){var e="It probably only makes sense to control ONE camera property with each pointer axis. Set 'warningEnable = false' if you are sure. Currently enabled: ";console.assert(this.axisXControlRotation+this.axisXControlHeight+this.axisXControlRadius<=1,e+"axisXControlRotation: "+this.axisXControlRotation+", axisXControlHeight: "+this.axisXControlHeight+", axisXControlRadius: "+this.axisXControlRadius),console.assert(this.axisYControlRotation+this.axisYControlHeight+this.axisYControlRadius<=1,e+"axisYControlRotation: "+this.axisYControlRotation+", axisYControlHeight: "+this.axisYControlHeight+", axisYControlRadius: "+this.axisYControlRadius),console.assert(this.axisPinchControlRotation+this.axisPinchControlHeight+this.axisPinchControlRadius<=1,e+"axisPinchControlRotation: "+this.axisPinchControlRotation+", axisPinchControlHeight: "+this.axisPinchControlHeight+", axisPinchControlRadius: "+this.axisPinchControlRadius)}},h.c([Object(F.c)()],t.prototype,"angularSensibilityX",void 0),h.c([Object(F.c)()],t.prototype,"angularSensibilityY",void 0),h.c([Object(F.c)()],t.prototype,"pinchPrecision",void 0),h.c([Object(F.c)()],t.prototype,"pinchDeltaPercentage",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisXControlRotation",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisYControlRotation",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlRadius",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlHeight",void 0),h.c([Object(F.c)()],t.prototype,"axisPinchControlRotation",void 0),t}(dt);nt.FollowCameraPointersInput=bt;var Tt=function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this._keys=new Array}return e.prototype.attachControl=function(e,t){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(e){var n,r=e.event;r.metaKey||(e.type===lt.a.KEYDOWN?-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||(-1===(n=i._keys.indexOf(r.keyCode))&&i._keys.push(r.keyCode),t||r.preventDefault()):-1===i.keysUp.indexOf(r.keyCode)&&-1===i.keysDown.indexOf(r.keyCode)&&-1===i.keysLeft.indexOf(r.keyCode)&&-1===i.keysRight.indexOf(r.keyCode)||((n=i._keys.indexOf(r.keyCode))>=0&&i._keys.splice(n,1),t||r.preventDefault()))}))},e.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=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t1)e.cameraRotation.x+=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new a.e(0,0,t*this._offsetY/this.touchMoveSensibility);a.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(a.e.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},h.c([Object(F.c)()],e.prototype,"touchAngularSensibility",void 0),h.c([Object(F.c)()],e.prototype,"touchMoveSensibility",void 0),e}();nt.FreeCameraTouchInput=At;var Pt=function(e){function t(t){var i=e.call(this,t)||this;return i._mouseInput=null,i}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new Tt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this._mouseInput||(this._mouseInput=new Et(e),this.add(this._mouseInput)),this},t.prototype.removeMouse=function(){return this._mouseInput&&this.remove(this._mouseInput),this},t.prototype.addTouch=function(){return this.add(new At),this},t.prototype.clear=function(){e.prototype.clear.call(this),this._mouseInput=null},t}(rt);Pt.prototype.addDeviceOrientation=function(){return this._deviceOrientationInput||(this._deviceOrientationInput=new St,this.add(this._deviceOrientationInput)),this};var St=function(){function e(){var e=this;this._screenOrientationAngle=0,this._screenQuaternion=new a.b,this._alpha=0,this._beta=0,this._gamma=0,this._onDeviceOrientationChangedObservable=new o.c,this._orientationChanged=function(){e._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,e._screenOrientationAngle=-Ie.b.ToRadians(e._screenOrientationAngle/2),e._screenQuaternion.copyFromFloats(0,Math.sin(e._screenOrientationAngle),0,Math.cos(e._screenOrientationAngle))},this._deviceOrientation=function(t){e._alpha=null!==t.alpha?t.alpha:0,e._beta=null!==t.beta?t.beta:0,e._gamma=null!==t.gamma?t.gamma:0,null!==t.alpha&&e._onDeviceOrientationChangedObservable.notifyObservers()},this._constantTranform=new a.b(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return e.WaitForOrientationChangeAsync=function(e){return new Promise(function(t,i){var n=!1,r=function(){window.removeEventListener("deviceorientation",r),n=!0,t()};e&&setTimeout(function(){n||(window.removeEventListener("deviceorientation",r),i("WaitForOrientationChangeAsync timed out"))},e),window.addEventListener("deviceorientation",r)})},Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},set:function(e){var t=this;this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new a.b),this._camera&&this._camera.onDisposeObservable.add(function(){t._onDeviceOrientationChangedObservable.clear()})},enumerable:!0,configurable:!0}),e.prototype.attachControl=function(e,t){var i=this.camera.getScene().getEngine().getHostWindow();i.addEventListener("orientationchange",this._orientationChanged),i.addEventListener("deviceorientation",this._deviceOrientation),this._orientationChanged()},e.prototype.detachControl=function(e){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation),this._alpha=0},e.prototype.checkInputs=function(){this._alpha&&(a.b.RotationYawPitchRollToRef(Ie.b.ToRadians(this._alpha),Ie.b.ToRadians(this._beta),-Ie.b.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},e.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"deviceOrientation"},e}();nt.FreeCameraDeviceOrientationInput=St;var Rt=function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this._cameraTransform=a.a.Identity(),this._deltaTransform=a.e.Zero(),this._vector3=a.e.Zero(),this._vector2=a.d.Zero()}return e.prototype.attachControl=function(e,t){var i=this,n=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=n.onGamepadConnectedObservable.add(function(e){e.type!==at.POSE_ENABLED&&(i.gamepad&&e.type!==at.XBOX||(i.gamepad=e))}),this._onGamepadDisconnectedObserver=n.onGamepadDisconnectedObservable.add(function(e){i.gamepad===e&&(i.gamepad=null)}),this.gamepad=n.getGamepadByType(at.XBOX)},e.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad&&this.gamepad.leftStick){var e=this.camera,t=this.gamepad.leftStick,i=t.x/this.gamepadMoveSensibility,n=t.y/this.gamepadMoveSensibility;t.x=Math.abs(i)>.005?0+i:0,t.y=Math.abs(n)>.005?0+n:0;var r=this.gamepad.rightStick;if(r){var o=r.x/this.gamepadAngularSensibility,s=r.y/this.gamepadAngularSensibility;r.x=Math.abs(o)>.001?0+o:0,r.y=Math.abs(s)>.001?0+s:0}else r={x:0,y:0};e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):a.a.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);var c=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*c,0,-t.y*c),a.e.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(r.y,r.x),e.cameraRotation.addInPlace(this._vector2)}},e.prototype.getClassName=function(){return"FreeCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},h.c([Object(F.c)()],e.prototype,"gamepadAngularSensibility",void 0),h.c([Object(F.c)()],e.prototype,"gamepadMoveSensibility",void 0),e}();nt.FreeCameraGamepadInput=Rt;var xt,Ct=i(70);!function(e){e[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z"}(xt||(xt={}));var Mt=function(){function e(t){var i=this;if(this._leftJoystick=!!t,e._globalJoystickIndex++,this._axisTargetedByLeftAndRight=xt.X,this._axisTargetedByUpAndDown=xt.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new Ct.a,this.deltaPosition=a.e.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(t){e.vjCanvasWidth=window.innerWidth,e.vjCanvasHeight=window.innerHeight,e.Canvas&&(e.Canvas.width=e.vjCanvasWidth,e.Canvas.height=e.vjCanvasHeight),e.halfWidth=e.vjCanvasWidth/2},!e.Canvas){window.addEventListener("resize",this._onResize,!1),e.Canvas=document.createElement("canvas"),e.vjCanvasWidth=window.innerWidth,e.vjCanvasHeight=window.innerHeight,e.Canvas.width=window.innerWidth,e.Canvas.height=window.innerHeight,e.Canvas.style.width="100%",e.Canvas.style.height="100%",e.Canvas.style.position="absolute",e.Canvas.style.backgroundColor="transparent",e.Canvas.style.top="0px",e.Canvas.style.left="0px",e.Canvas.style.zIndex="5",e.Canvas.style.msTouchAction="none",e.Canvas.setAttribute("touch-action","none");var n=e.Canvas.getContext("2d");if(!n)throw new Error("Unable to create canvas for virtual joystick");e.vjCanvasContext=n,e.vjCanvasContext.strokeStyle="#ffffff",e.vjCanvasContext.lineWidth=2,document.body.appendChild(e.Canvas)}e.halfWidth=e.Canvas.width/2,this.pressed=!1,this._joystickColor="cyan",this._joystickPointerID=-1,this._joystickPointerPos=new a.d(0,0),this._joystickPreviousPointerPos=new a.d(0,0),this._joystickPointerStartPos=new a.d(0,0),this._deltaJoystickVector=new a.d(0,0),this._onPointerDownHandlerRef=function(e){i._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){i._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){i._onPointerUp(e)},e.Canvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),e.Canvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),e.Canvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),e.Canvas.addEventListener("contextmenu",function(e){e.preventDefault()},!1),requestAnimationFrame(function(){i._drawVirtualJoystick()})}return e.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},e.prototype._onPointerDown=function(t){t.preventDefault(),(!0===this._leftJoystick?t.clientXe.halfWidth)&&this._joystickPointerID<0?(this._joystickPointerID=t.pointerId,this._joystickPointerStartPos.x=t.clientX,this._joystickPointerStartPos.y=t.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone(),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(t.pointerId.toString(),t)):e._globalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(t.pointerId.toString(),{x:t.clientX,y:t.clientY,prevX:t.clientX,prevY:t.clientY}))},e.prototype._onPointerMove=function(e){if(this._joystickPointerID==e.pointerId){this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY,this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos);var t=(this.reverseLeftRight?-1:1)*this._deltaJoystickVector.x/this._inversedSensibility;switch(this._axisTargetedByLeftAndRight){case xt.X:this.deltaPosition.x=Math.min(1,Math.max(-1,t));break;case xt.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,t));break;case xt.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,t))}var i=(this.reverseUpDown?1:-1)*this._deltaJoystickVector.y/this._inversedSensibility;switch(this._axisTargetedByUpAndDown){case xt.X:this.deltaPosition.x=Math.min(1,Math.max(-1,i));break;case xt.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,i));break;case xt.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,i))}}else{var n=this._touches.get(e.pointerId.toString());n&&(n.x=e.clientX,n.y=e.clientY)}},e.prototype._onPointerUp=function(t){if(this._joystickPointerID==t.pointerId)e.vjCanvasContext.clearRect(this._joystickPointerStartPos.x-64,this._joystickPointerStartPos.y-64,128,128),e.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x-42,this._joystickPreviousPointerPos.y-42,84,84),this._joystickPointerID=-1,this.pressed=!1;else{var i=this._touches.get(t.pointerId.toString());i&&e.vjCanvasContext.clearRect(i.prevX-44,i.prevY-44,88,88)}this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this._touches.remove(t.pointerId.toString())},e.prototype.setJoystickColor=function(e){this._joystickColor=e},e.prototype.setActionOnTouch=function(e){this._action=e},e.prototype.setAxisForLeftRight=function(e){switch(e){case xt.X:case xt.Y:case xt.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=xt.X}},e.prototype.setAxisForUpDown=function(e){switch(e){case xt.X:case xt.Y:case xt.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=xt.Y}},e.prototype._drawVirtualJoystick=function(){var t=this;this.pressed&&this._touches.forEach(function(i,n){n.pointerId===t._joystickPointerID?(e.vjCanvasContext.clearRect(t._joystickPointerStartPos.x-64,t._joystickPointerStartPos.y-64,128,128),e.vjCanvasContext.clearRect(t._joystickPreviousPointerPos.x-42,t._joystickPreviousPointerPos.y-42,84,84),e.vjCanvasContext.beginPath(),e.vjCanvasContext.lineWidth=6,e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.arc(t._joystickPointerStartPos.x,t._joystickPointerStartPos.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.lineWidth=2,e.vjCanvasContext.arc(t._joystickPointerStartPos.x,t._joystickPointerStartPos.y,60,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle=t._joystickColor,e.vjCanvasContext.arc(t._joystickPointerPos.x,t._joystickPointerPos.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),t._joystickPreviousPointerPos=t._joystickPointerPos.clone()):(e.vjCanvasContext.clearRect(n.prevX-44,n.prevY-44,88,88),e.vjCanvasContext.beginPath(),e.vjCanvasContext.fillStyle="white",e.vjCanvasContext.beginPath(),e.vjCanvasContext.strokeStyle="red",e.vjCanvasContext.lineWidth=6,e.vjCanvasContext.arc(n.x,n.y,40,0,2*Math.PI,!0),e.vjCanvasContext.stroke(),e.vjCanvasContext.closePath(),n.prevX=n.x,n.prevY=n.y)}),requestAnimationFrame(function(){t._drawVirtualJoystick()})},e.prototype.releaseCanvas=function(){e.Canvas&&(e.Canvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),e.Canvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),e.Canvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),e.Canvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(e.Canvas),e.Canvas=null)},e._globalJoystickIndex=0,e}();Pt.prototype.addVirtualJoystick=function(){return this.add(new Ot),this};var Ot=function(){function e(){}return e.prototype.getLeftJoystick=function(){return this._leftjoystick},e.prototype.getRightJoystick=function(){return this._rightjoystick},e.prototype.checkInputs=function(){if(this._leftjoystick){var e=this.camera,t=50*e._computeLocalCameraSpeed(),i=a.a.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),n=a.e.TransformCoordinates(new a.e(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i);e.cameraDirection=e.cameraDirection.add(n),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9))}},e.prototype.attachControl=function(e,t){this._leftjoystick=new Mt(!0),this._leftjoystick.setAxisForUpDown(xt.Z),this._leftjoystick.setAxisForLeftRight(xt.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new Mt(!1),this._rightjoystick.setAxisForUpDown(xt.X),this._rightjoystick.setAxisForLeftRight(xt.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")},e.prototype.detachControl=function(e){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()},e.prototype.getClassName=function(){return"FreeCameraVirtualJoystickInput"},e.prototype.getSimpleName=function(){return"virtualJoystick"},e}();nt.FreeCameraVirtualJoystickInput=Ot;var It=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.cameraDirection=new a.e(0,0,0),o.cameraRotation=new a.d(0,0),o.updateUpVectorFromRotation=!1,o._tmpQuaternion=new a.b,o.rotation=new a.e(0,0,0),o.speed=2,o.noRotationConstraint=!1,o.lockedTarget=null,o._currentTarget=a.e.Zero(),o._initialFocalDistance=1,o._viewMatrix=a.a.Zero(),o._camMatrix=a.a.Zero(),o._cameraTransformMatrix=a.a.Zero(),o._cameraRotationMatrix=a.a.Zero(),o._referencePoint=new a.e(0,0,1),o._transformedReferencePoint=a.e.Zero(),o._globalCurrentTarget=a.e.Zero(),o._globalCurrentUpVector=a.e.Zero(),o._defaultUp=a.e.Up(),o._cachedRotationZ=0,o._cachedQuaternionRotationZ=0,o}return h.d(t,e),t.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},t.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},t.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.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)},t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache.lockedTarget=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new a.b(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this);var i=this._getLockedTargetPosition();i?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(i):this._cache.lockedTarget=i.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},t.prototype._isSynchronizedViewMatrix=function(){if(!e.prototype._isSynchronizedViewMatrix.call(this))return!1;var t=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(t):!t)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},t.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},t.prototype.setTarget=function(e){this.upVector.normalize(),this._initialFocalDistance=e.subtract(this.position).length(),this.position.z===e.z&&(this.position.z+=re.a),a.a.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);t.x>=0?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.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&&a.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},t.prototype.getTarget=function(){return this._currentTarget},t.prototype._decideIfNeedsToMove=function(){return Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(a.c.Matrix[0]),a.e.TransformNormalToRef(this.cameraDirection,a.c.Matrix[0],a.c.Vector3[0]),void this.position.addInPlace(a.c.Vector3[0]);this.position.addInPlace(this.cameraDirection)},t.prototype._checkInputs=function(){var t=this._decideIfNeedsToMove(),i=Math.abs(this.cameraRotation.x)>0||Math.abs(this.cameraRotation.y)>0;if(t&&this._updatePosition(),i){if(this.rotation.x+=this.cameraRotation.x,this.rotation.y+=this.cameraRotation.y,this.rotationQuaternion)this.rotation.lengthSquared()&&a.b.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion);if(!this.noRotationConstraint){this.rotation.x>1.570796&&(this.rotation.x=1.570796),this.rotation.x<-1.570796&&(this.rotation.x=-1.570796)}}t&&(Math.abs(this.cameraDirection.x)Ce.b.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new Pt(o),o.inputs.addKeyboard().addMouse(),o}return h.d(t,e),Object.defineProperty(t.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(t.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(t.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(t.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(t.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}),t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new a.e(0,0,0),this.cameraRotation=new a.d(0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?a.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=a.e.Zero(),this._transformedDirection=a.e.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FreeCamera"},h.c([Object(F.o)()],t.prototype,"ellipsoid",void 0),h.c([Object(F.o)()],t.prototype,"ellipsoidOffset",void 0),h.c([Object(F.c)()],t.prototype,"checkCollisions",void 0),h.c([Object(F.c)()],t.prototype,"applyGravity",void 0),t}(It);B.a.AddNodeConstructor("TouchCamera",function(e,t){return function(){return new Lt(e,a.e.Zero(),t)}});var Lt=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addTouch(),r._setupInputs(),r}return h.d(t,e),Object.defineProperty(t.prototype,"touchAngularSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"touchMoveSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"TouchCamera"},t.prototype._setupInputs=function(){var e=this.inputs.attached.mouse;e&&(e.touchEnabled=!1)},t}(Dt);B.a.AddNodeConstructor("ArcRotateCamera",function(e,t){return function(){return new wt(e,0,0,1,a.e.Zero(),t)}});var wt=function(e){function t(t,i,n,r,s,c,l){void 0===l&&(l=!0);var u=e.call(this,t,a.e.Zero(),c,l)||this;return u._upVector=a.e.Up(),u.inertialAlphaOffset=0,u.inertialBetaOffset=0,u.inertialRadiusOffset=0,u.lowerAlphaLimit=null,u.upperAlphaLimit=null,u.lowerBetaLimit=.01,u.upperBetaLimit=Math.PI-.01,u.lowerRadiusLimit=null,u.upperRadiusLimit=null,u.inertialPanningX=0,u.inertialPanningY=0,u.pinchToPanMaxDistance=20,u.panningDistanceLimit=null,u.panningOriginTarget=a.e.Zero(),u.panningInertia=.9,u.zoomOnFactor=1,u.targetScreenOffset=a.d.Zero(),u.allowUpsideDown=!0,u.useInputToRestoreState=!0,u._viewMatrix=new a.a,u.panningAxis=new a.e(1,1,0),u.onMeshTargetChangedObservable=new o.c,u.checkCollisions=!1,u.collisionRadius=new a.e(.5,.5,.5),u._previousPosition=a.e.Zero(),u._collisionVelocity=a.e.Zero(),u._newPosition=a.e.Zero(),u._computationVector=a.e.Zero(),u._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),i?(u.setPosition(t),u.onCollide&&u.onCollide(i)):u._previousPosition.copyFrom(u._position);var n=Math.cos(u.alpha),r=Math.sin(u.alpha),o=Math.cos(u.beta),a=Math.sin(u.beta);0===a&&(a=1e-4);var s=u._getTargetPosition();u._computationVector.copyFromFloats(u.radius*n*a,u.radius*o,u.radius*r*a),s.addToRef(u._computationVector,u._newPosition),u._position.copyFrom(u._newPosition);var c=u.upVector;u.allowUpsideDown&&u.beta<0&&(c=(c=c.clone()).negate()),u._computeViewMatrix(u._position,s,c),u._viewMatrix.addAtIndex(12,u.targetScreenOffset.x),u._viewMatrix.addAtIndex(13,u.targetScreenOffset.y),u._collisionTriggered=!1},u._target=a.e.Zero(),s&&u.setTarget(s),u.alpha=i,u.beta=n,u.radius=r,u.getViewMatrix(),u.inputs=new pt(u),u.inputs.addKeyboard().addMouseWheel().addPointers(),u}return h.d(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this._position},set:function(e){this.setPosition(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"upVector",{get:function(){return this._upVector},set:function(e){this._upToYMatrix||(this._YToUpMatrix=new a.a,this._upToYMatrix=new a.a,this._upVector=a.e.Zero()),e.normalize(),this._upVector.copyFrom(e),this.setMatUp()},enumerable:!0,configurable:!0}),t.prototype.setMatUp=function(){a.a.RotationAlignToRef(a.e.UpReadOnly,this._upVector,this._YToUpMatrix),a.a.RotationAlignToRef(this._upVector,a.e.UpReadOnly,this._upToYMatrix)},Object.defineProperty(t.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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}),Object.defineProperty(t.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new ke,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new Ge,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new Ve,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!0,configurable:!0}),t.prototype._initCache=function(){e.prototype._initCache.call(this),this._cache._target=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=a.d.Zero()},t.prototype._updateCache=function(t){t||e.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},t.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.absolutePosition;this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}var t=this._getLockedTargetPosition();return t||this._target},t.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),this._storedTargetScreenOffset=this.targetScreenOffset.clone(),e.prototype.storeState.call(this)},t.prototype._restoreStateValues=function(){return!!e.prototype._restoreStateValues.call(this)&&(this.setTarget(this._storedTarget.clone()),this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.targetScreenOffset=this._storedTargetScreenOffset.clone(),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,this.inertialPanningY=0,!0)},t.prototype._isSynchronizedViewMatrix=function(){return!!e.prototype._isSynchronizedViewMatrix.call(this)&&(this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset))},t.prototype.attachControl=function(e,t,i,n){var r=this;void 0===i&&(i=!0),void 0===n&&(n=2),this._useCtrlForPanning=i,this._panningMouseButton=n,this.inputs.attachElement(e,t),this._reset=function(){r.inertialAlphaOffset=0,r.inertialBetaOffset=0,r.inertialRadiusOffset=0,r.inertialPanningX=0,r.inertialPanningY=0}},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},t.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var t=this.inertialAlphaOffset;this.beta<=0&&(t*=-1),this.getScene().useRightHandedSystem&&(t*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(t*=-1),this.alpha+=t,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)Math.PI&&(this.beta=this.beta-2*Math.PI):this.betathis.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alphathis.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit,this.inertialRadiusOffset=0)},t.prototype.rebuildAnglesAndRadius=function(){this._position.subtractToRef(this._getTargetPosition(),this._computationVector),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||a.e.TransformCoordinatesToRef(this._computationVector,this._upToYMatrix,this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4),0===this._computationVector.x&&0===this._computationVector.z?this.alpha=Math.PI/2:this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha),this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},t.prototype.setPosition=function(e){this._position.equals(e)||(this._position.copyFrom(e),this.rebuildAnglesAndRadius())},t.prototype.setTarget=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,e.computeWorldMatrix(),this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var n=e,r=this._getTargetPosition();if(r&&!i&&r.equals(n))return;this._targetHost=null,this._target=n,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}this.rebuildAnglesAndRadius()},t.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),n=Math.sin(this.beta);0===n&&(n=1e-4);var r=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*n,this.radius*i,this.radius*t*n),0===this._upVector.x&&1===this._upVector.y&&0===this._upVector.z||a.e.TransformCoordinatesToRef(this._computationVector,this._YToUpMatrix,this._computationVector),r.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions){var o=this.getScene().collisionCoordinator;this._collider||(this._collider=o.createCollider()),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this._position,this._collisionVelocity),this._collisionTriggered=!0,o.getNewPosition(this._position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)}else{this._position.copyFrom(this._newPosition);var s=this.upVector;this.allowUpsideDown&&n<0&&(s=s.negate()),this._computeViewMatrix(this._position,r,s),this._viewMatrix.addAtIndex(12,this.targetScreenOffset.x),this._viewMatrix.addAtIndex(13,this.targetScreenOffset.y)}return this._currentTarget=r,this._viewMatrix},t.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=Se.a.MinMax(e),n=a.e.Distance(i.min,i.max);this.radius=n*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:n},t)},t.prototype.focusOn=function(e,t){var i,n;if(void 0===t&&(t=!1),void 0===e.min){var r=e||this.getScene().meshes;i=Se.a.MinMax(r),n=a.e.Distance(i.min,i.max)}else{i=e,n=e.distance}this._target=Se.a.Center(i),t||(this.maxZ=2*n)},t.prototype.createRigCamera=function(e,i){var n=0;switch(this.cameraRigMode){case Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ke.a.RIG_MODE_VR:n=this._cameraRigParams.stereoHalfAngle*(0===i?1:-1);break;case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:n=this._cameraRigParams.stereoHalfAngle*(0===i?-1:1)}var r=new t(e,this.alpha+n,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r},t.prototype._updateRigCameras=function(){var t=this._rigCameras[0],i=this._rigCameras[1];switch(t.beta=i.beta=this.beta,this.cameraRigMode){case Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER:case Ke.a.RIG_MODE_VR:t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,i.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}e.prototype._updateRigCameras.call(this)},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"ArcRotateCamera"},h.c([Object(F.c)()],t.prototype,"alpha",void 0),h.c([Object(F.c)()],t.prototype,"beta",void 0),h.c([Object(F.c)()],t.prototype,"radius",void 0),h.c([Object(F.o)("target")],t.prototype,"_target",void 0),h.c([Object(F.o)("upVector")],t.prototype,"_upVector",void 0),h.c([Object(F.c)()],t.prototype,"inertialAlphaOffset",void 0),h.c([Object(F.c)()],t.prototype,"inertialBetaOffset",void 0),h.c([Object(F.c)()],t.prototype,"inertialRadiusOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerAlphaLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperAlphaLimit",void 0),h.c([Object(F.c)()],t.prototype,"lowerBetaLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperBetaLimit",void 0),h.c([Object(F.c)()],t.prototype,"lowerRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"inertialPanningX",void 0),h.c([Object(F.c)()],t.prototype,"inertialPanningY",void 0),h.c([Object(F.c)()],t.prototype,"pinchToPanMaxDistance",void 0),h.c([Object(F.c)()],t.prototype,"panningDistanceLimit",void 0),h.c([Object(F.o)()],t.prototype,"panningOriginTarget",void 0),h.c([Object(F.c)()],t.prototype,"panningInertia",void 0),h.c([Object(F.c)()],t.prototype,"zoomOnFactor",void 0),h.c([Object(F.c)()],t.prototype,"targetScreenOffset",void 0),h.c([Object(F.c)()],t.prototype,"allowUpsideDown",void 0),h.c([Object(F.c)()],t.prototype,"useInputToRestoreState",void 0),t}(It);B.a.AddNodeConstructor("DeviceOrientationCamera",function(e,t){return function(){return new Ft(e,a.e.Zero(),t)}});var Ft=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r._tmpDragQuaternion=new a.b,r._disablePointerInputWhenUsingDeviceOrientation=!0,r._dragFactor=0,r._quaternionCache=new a.b,r.inputs.addDeviceOrientation(),r.inputs._deviceOrientationInput&&r.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(function(){r._disablePointerInputWhenUsingDeviceOrientation&&r.inputs._mouseInput&&(r.inputs._mouseInput._allowCameraRotation=!1,r.inputs._mouseInput.onPointerMovedObservable.add(function(e){0!=r._dragFactor&&(r._initialQuaternion||(r._initialQuaternion=new a.b),a.b.FromEulerAnglesToRef(0,e.offsetX*r._dragFactor,0,r._tmpDragQuaternion),r._initialQuaternion.multiplyToRef(r._tmpDragQuaternion,r._initialQuaternion))}))}),r}return h.d(t,e),Object.defineProperty(t.prototype,"disablePointerInputWhenUsingDeviceOrientation",{get:function(){return this._disablePointerInputWhenUsingDeviceOrientation},set:function(e){this._disablePointerInputWhenUsingDeviceOrientation=e},enumerable:!0,configurable:!0}),t.prototype.enableHorizontalDragging=function(e){void 0===e&&(e=1/300),this._dragFactor=e},t.prototype.getClassName=function(){return"DeviceOrientationCamera"},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},t.prototype.resetToCurrentRotation=function(e){var t=this;void 0===e&&(e=Z.a.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new a.b),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach(function(i){e[i]?t._initialQuaternion[i]*=-1:t._initialQuaternion[i]=0}),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},t}(Dt),Nt=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new mt),this},t.prototype.addMouse=function(e){return void 0===e&&(e=!0),this.add(new gt(e)),this},t}(rt),Bt=function(e){function t(t,i,n,r){void 0===r&&(r=!0);var o=e.call(this,t,i,n,r)||this;return o.ellipsoid=new a.e(1,1,1),o.ellipsoidOffset=new a.e(0,0,0),o.checkCollisions=!1,o.applyGravity=!1,o.cameraDirection=a.e.Zero(),o._trackRoll=0,o.rollCorrect=100,o.bankedTurn=!1,o.bankedTurnLimit=Math.PI/2,o.bankedTurnMultiplier=1,o._needMoveForGravity=!1,o._oldPosition=a.e.Zero(),o._diffPosition=a.e.Zero(),o._newPosition=a.e.Zero(),o._collisionMask=-1,o._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null);var n;n=t,o._newPosition.copyFrom(n),o._newPosition.subtractToRef(o._oldPosition,o._diffPosition),o._diffPosition.length()>Ce.b.CollisionsEpsilon&&(o.position.addInPlace(o._diffPosition),o.onCollide&&i&&o.onCollide(i))},o.inputs=new Nt(o),o.inputs.addKeyboard().addMouse(),o}return h.d(t,e),Object.defineProperty(t.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(t.prototype,"keysForward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysForward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysForward=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keysBackward",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysBackward:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysBackward=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.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(t.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(t.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(t.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}),t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new a.e(0,0,0)},Object.defineProperty(t.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),t.prototype._collideWithWorld=function(e){(this.parent?a.e.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset);var t=this.getScene().collisionCoordinator;this._collider||(this._collider=t.createCollider()),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var i=e;this.applyGravity&&(i=e.add(this.getScene().gravity)),t.getNewPosition(this._oldPosition,i,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},t.prototype._checkInputs=function(){this._localDirection||(this._localDirection=a.e.Zero(),this._transformedDirection=a.e.Zero()),this.inputs.checkInputs(),e.prototype._checkInputs.call(this)},t.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||Math.abs(this.cameraDirection.x)>0||Math.abs(this.cameraDirection.y)>0||Math.abs(this.cameraDirection.z)>0},t.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):e.prototype._updatePosition.call(this)},t.prototype.restoreRoll=function(e){var t=this._trackRoll,i=t-this.rotation.z;Math.abs(i)>=.001&&(this.rotation.z+=i/e,Math.abs(t-this.rotation.z)<=.001&&(this.rotation.z=t))},t.prototype.dispose=function(){this.inputs.clear(),e.prototype.dispose.call(this)},t.prototype.getClassName=function(){return"FlyCamera"},h.c([Object(F.o)()],t.prototype,"ellipsoid",void 0),h.c([Object(F.o)()],t.prototype,"ellipsoidOffset",void 0),h.c([Object(F.c)()],t.prototype,"checkCollisions",void 0),h.c([Object(F.c)()],t.prototype,"applyGravity",void 0),t}(It),Ut=function(e){function t(t){return e.call(this,t)||this}return h.d(t,e),t.prototype.addKeyboard=function(){return this.add(new vt),this},t.prototype.addMouseWheel=function(){return this.add(new yt),this},t.prototype.addPointers=function(){return this.add(new bt),this},t.prototype.addVRDeviceOrientation=function(){return console.warn("DeviceOrientation support not yet implemented for FollowCamera."),this},t}(rt);B.a.AddNodeConstructor("FollowCamera",function(e,t){return function(){return new kt(e,a.e.Zero(),t)}}),B.a.AddNodeConstructor("ArcFollowCamera",function(e,t){return function(){return new Gt(e,0,0,1,null,t)}});var Vt,kt=function(e){function t(t,i,n,r){void 0===r&&(r=null);var o=e.call(this,t,i,n)||this;return o.radius=12,o.lowerRadiusLimit=null,o.upperRadiusLimit=null,o.rotationOffset=0,o.lowerRotationOffsetLimit=null,o.upperRotationOffsetLimit=null,o.heightOffset=4,o.lowerHeightOffsetLimit=null,o.upperHeightOffsetLimit=null,o.cameraAcceleration=.05,o.maxCameraSpeed=20,o.lockedTarget=r,o.inputs=new Ut(o),o.inputs.addKeyboard().addMouseWheel().addPointers(),o}return h.d(t,e),t.prototype._follow=function(e){if(e){var t;if(e.rotationQuaternion){var i=new a.a;e.rotationQuaternion.toRotationMatrix(i),t=Math.atan2(i.m[8],i.m[10])}else t=e.rotation.y;var n=Ie.b.ToRadians(this.rotationOffset)+t,r=e.getAbsolutePosition(),o=r.x+Math.sin(n)*this.radius,s=r.z+Math.cos(n)*this.radius,c=o-this.position.x,l=r.y+this.heightOffset-this.position.y,u=s-this.position.z,h=c*this.cameraAcceleration*2,d=l*this.cameraAcceleration,f=u*this.cameraAcceleration*2;(h>this.maxCameraSpeed||h<-this.maxCameraSpeed)&&(h=h<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),(f>this.maxCameraSpeed||f<-this.maxCameraSpeed)&&(f=f<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new a.e(this.position.x+h,this.position.y+d,this.position.z+f),this.setTarget(r)}},t.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t),this._reset=function(){}},t.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},t.prototype._checkInputs=function(){this.inputs.checkInputs(),this._checkLimits(),e.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},t.prototype._checkLimits=function(){null!==this.lowerRadiusLimit&&this.radiusthis.upperRadiusLimit&&(this.radius=this.upperRadiusLimit),null!==this.lowerHeightOffsetLimit&&this.heightOffsetthis.upperHeightOffsetLimit&&(this.heightOffset=this.upperHeightOffsetLimit),null!==this.lowerRotationOffsetLimit&&this.rotationOffsetthis.upperRotationOffsetLimit&&(this.rotationOffset=this.upperRotationOffsetLimit)},t.prototype.getClassName=function(){return"FollowCamera"},h.c([Object(F.c)()],t.prototype,"radius",void 0),h.c([Object(F.c)()],t.prototype,"lowerRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRadiusLimit",void 0),h.c([Object(F.c)()],t.prototype,"rotationOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerRotationOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperRotationOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"heightOffset",void 0),h.c([Object(F.c)()],t.prototype,"lowerHeightOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"upperHeightOffsetLimit",void 0),h.c([Object(F.c)()],t.prototype,"cameraAcceleration",void 0),h.c([Object(F.c)()],t.prototype,"maxCameraSpeed",void 0),h.c([Object(F.k)("lockedTargetId")],t.prototype,"lockedTarget",void 0),t}(It),Gt=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,a.e.Zero(),s)||this;return c.alpha=i,c.beta=n,c.radius=r,c.target=o,c._cartesianCoordinates=a.e.Zero(),c._follow(),c}return h.d(t,e),t.prototype._follow=function(){if(this.target){this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);var e=this.target.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}},t.prototype._checkInputs=function(){e.prototype._checkInputs.call(this),this._follow()},t.prototype.getClassName=function(){return"ArcFollowCamera"},t}(It),zt=i(37),jt=i(38);!function(e){e[e.VIVE=0]="VIVE",e[e.OCULUS=1]="OCULUS",e[e.WINDOWS=2]="WINDOWS",e[e.GEAR_VR=3]="GEAR_VR",e[e.DAYDREAM=4]="DAYDREAM",e[e.GENERIC=5]="GENERIC"}(Vt||(Vt={}));var Wt,Ht,Xt=function(){function e(){}return e.InitiateController=function(e){for(var t=0,i=this._ControllerFactories;tthis._maxRotationDistFromHeadset){var n=i-(i<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset);this._draggedRoomRotation+=n;var r=Math.sin(-n),o=Math.cos(-n);this._calculatedPosition.x=this._calculatedPosition.x*o-this._calculatedPosition.z*r,this._calculatedPosition.z=this._calculatedPosition.x*r+this._calculatedPosition.z*o}}a.e.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),a.b.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion))}},t.prototype.updateFromDevice=function(e){if(!this.isXR&&e){this.rawPose=e,e.position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position));var t=this.rawPose;e.orientation&&t.orientation&&4===t.orientation.length&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation))}},t.prototype.attachToMesh=function(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new a.b),!this.isXR&&(this._updatePoseAndMesh(),this._pointingPoseNode)){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;t.reverse().forEach(function(e){e.computeWorldMatrix(!0)})}this._meshAttachedObservable.notifyObservers(e)},t.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},t.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),t.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new jt.a(a.e.Zero(),new a.e(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),n=new a.e(0,0,-1),r=a.e.TransformNormal(n,t),o=a.e.Normalize(r);return new jt.a(i,o,e)},t.POINTING_POSE="POINTING_POSE",t}(at);!function(e){e[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.Start=4]="Start",e[e.Back=5]="Back",e[e.LB=6]="LB",e[e.RB=7]="RB",e[e.LeftStick=8]="LeftStick",e[e.RightStick=9]="RightStick"}(Wt||(Wt={})),function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(Ht||(Ht={}));var Kt,Qt,qt=function(e){function t(t,i,n,r){void 0===r&&(r=!1);var a=e.call(this,t,i,n,0,1,2,3)||this;return a._leftTrigger=0,a._rightTrigger=0,a.onButtonDownObservable=new o.c,a.onButtonUpObservable=new o.c,a.onPadDownObservable=new o.c,a.onPadUpObservable=new o.c,a._buttonA=0,a._buttonB=0,a._buttonX=0,a._buttonY=0,a._buttonBack=0,a._buttonStart=0,a._buttonLB=0,a._buttonRB=0,a._buttonLeftStick=0,a._buttonRightStick=0,a._dPadUp=0,a._dPadDown=0,a._dPadLeft=0,a._dPadRight=0,a._isXboxOnePad=!1,a.type=at.XBOX,a._isXboxOnePad=r,a}return h.d(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!0,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,Wt.A)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,Wt.B)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,Wt.X)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,Wt.Y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,Wt.Start)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,Wt.Back)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLB",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,Wt.LB)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRB",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,Wt.RB)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Wt.LeftStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Wt.RightStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Ht.Up)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Ht.Down)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Ht.Left)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Ht.Right)},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this._isXboxOnePad,this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(at);!function(e){e[e.Cross=0]="Cross",e[e.Circle=1]="Circle",e[e.Square=2]="Square",e[e.Triangle=3]="Triangle",e[e.Options=4]="Options",e[e.Share=5]="Share",e[e.L1=6]="L1",e[e.R1=7]="R1",e[e.LeftStick=8]="LeftStick",e[e.RightStick=9]="RightStick"}(Kt||(Kt={})),function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(Qt||(Qt={}));var Zt=function(e){function t(t,i,n){var r=e.call(this,t.replace("STANDARD GAMEPAD","SONY PLAYSTATION DUALSHOCK"),i,n,0,1,2,3)||this;return r._leftTrigger=0,r._rightTrigger=0,r.onButtonDownObservable=new o.c,r.onButtonUpObservable=new o.c,r.onPadDownObservable=new o.c,r.onPadUpObservable=new o.c,r._buttonCross=0,r._buttonCircle=0,r._buttonSquare=0,r._buttonTriangle=0,r._buttonShare=0,r._buttonOptions=0,r._buttonL1=0,r._buttonR1=0,r._buttonLeftStick=0,r._buttonRightStick=0,r._dPadUp=0,r._dPadDown=0,r._dPadLeft=0,r._dPadRight=0,r.type=at.DUALSHOCK,r}return h.d(t,e),t.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},t.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(t.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!0,configurable:!0}),t.prototype.onbuttondown=function(e){this._onbuttondown=e},t.prototype.onbuttonup=function(e){this._onbuttonup=e},t.prototype.ondpaddown=function(e){this._ondpaddown=e},t.prototype.ondpadup=function(e){this._ondpadup=e},t.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},t.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(t.prototype,"buttonCross",{get:function(){return this._buttonCross},set:function(e){this._buttonCross=this._setButtonValue(e,this._buttonCross,Kt.Cross)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonCircle",{get:function(){return this._buttonCircle},set:function(e){this._buttonCircle=this._setButtonValue(e,this._buttonCircle,Kt.Circle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonSquare",{get:function(){return this._buttonSquare},set:function(e){this._buttonSquare=this._setButtonValue(e,this._buttonSquare,Kt.Square)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonTriangle",{get:function(){return this._buttonTriangle},set:function(e){this._buttonTriangle=this._setButtonValue(e,this._buttonTriangle,Kt.Triangle)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonOptions",{get:function(){return this._buttonOptions},set:function(e){this._buttonOptions=this._setButtonValue(e,this._buttonOptions,Kt.Options)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonShare",{get:function(){return this._buttonShare},set:function(e){this._buttonShare=this._setButtonValue(e,this._buttonShare,Kt.Share)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonL1",{get:function(){return this._buttonL1},set:function(e){this._buttonL1=this._setButtonValue(e,this._buttonL1,Kt.L1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonR1",{get:function(){return this._buttonR1},set:function(e){this._buttonR1=this._setButtonValue(e,this._buttonR1,Kt.R1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,Kt.LeftStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,Kt.RightStick)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,Qt.Up)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,Qt.Down)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,Qt.Left)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,Qt.Right)},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this),this.buttonCross=this.browserGamepad.buttons[0].value,this.buttonCircle=this.browserGamepad.buttons[1].value,this.buttonSquare=this.browserGamepad.buttons[2].value,this.buttonTriangle=this.browserGamepad.buttons[3].value,this.buttonL1=this.browserGamepad.buttons[4].value,this.buttonR1=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonShare=this.browserGamepad.buttons[8].value,this.buttonOptions=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},t}(at),Jt=function(){function e(e){var t=this;if(this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new o.c,zt.a.IsWindowObjectExist()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator.getGamepads||navigator.webkitGetGamepads||navigator.msGetGamepads||navigator.webkitGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new o.c(function(e){for(var i in t._babylonGamepads){var n=t._babylonGamepads[i];n&&n._isConnected&&t.onGamepadConnectedObservable.notifyObserver(e,n)}}),this._onGamepadConnectedEvent=function(e){var i,n=e.gamepad;n.index in t._babylonGamepads&&t._babylonGamepads[n.index].isConnected||(t._babylonGamepads[n.index]?((i=t._babylonGamepads[n.index]).browserGamepad=n,i._isConnected=!0):i=t._addNewGamepad(n),t.onGamepadConnectedObservable.notifyObservers(i),t._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var i=e.gamepad;for(var n in t._babylonGamepads)if(t._babylonGamepads[n].index===i.index){var r=t._babylonGamepads[n];r._isConnected=!1,t.onGamepadDisconnectedObservable.notifyObservers(r);break}},this._gamepadSupport)if(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported){var i=this._scene?this._scene.getEngine().getHostWindow():window;i.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),i.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)}else this._startMonitoringGamepads()}return Object.defineProperty(e.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!0,configurable:!0}),e.prototype.getGamepadByType=function(e){void 0===e&&(e=at.XBOX);for(var t=0,i=this._babylonGamepads;t0){for(var p=0;p0)for(var e=0;e0){var n=this._camera._getFirstPostProcess();n&&n.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e}(),ai="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}";ni.a.ShadersStore.passPixelShader=ai;var si="\nvarying vec2 vUV;\nuniform samplerCube textureSampler;\nvoid main(void)\n{\nvec2 uv=vUV*2.0-1.0;\n#ifdef POSITIVEX\ngl_FragColor=textureCube(textureSampler,vec3(1.001,uv.y,uv.x));\n#endif\n#ifdef NEGATIVEX\ngl_FragColor=textureCube(textureSampler,vec3(-1.001,uv.y,uv.x));\n#endif\n#ifdef POSITIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,1.001,uv.x));\n#endif\n#ifdef NEGATIVEY\ngl_FragColor=textureCube(textureSampler,vec3(uv.y,-1.001,uv.x));\n#endif\n#ifdef POSITIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,1.001));\n#endif\n#ifdef NEGATIVEZ\ngl_FragColor=textureCube(textureSampler,vec3(uv,-1.001));\n#endif\n}";ni.a.ShadersStore.passCubePixelShader=si;var ci=function(e){function t(t,i,n,r,o,a,s,c){return void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1),e.call(this,t,"pass",null,null,i,n,r,o,a,void 0,s,void 0,null,c)||this}return h.d(t,e),t}(oi),li=function(e){function t(t,i,n,r,o,a,s,c){void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"passCube",null,null,i,n,r,o,a,"#define POSITIVEX",s,void 0,null,c)||this;return l._face=0,l}return h.d(t,e),Object.defineProperty(t.prototype,"face",{get:function(){return this._face},set:function(e){if(!(e<0||e>5))switch(this._face=e,this._face){case 0:this.updateEffect("#define POSITIVEX");break;case 1:this.updateEffect("#define NEGATIVEX");break;case 2:this.updateEffect("#define POSITIVEY");break;case 3:this.updateEffect("#define NEGATIVEY");break;case 4:this.updateEffect("#define POSITIVEZ");break;case 5:this.updateEffect("#define NEGATIVEZ")}},enumerable:!0,configurable:!0}),t}(oi);Ce.b._RescalePostProcessFactory=function(e){return new ci("rescale",1,null,Ce.b.TEXTURE_BILINEAR_SAMPLINGMODE,e,!1,Ce.b.TEXTURETYPE_UNSIGNED_INT)};var ui="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}";ni.a.ShadersStore.anaglyphPixelShader=ui;var hi=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,"anaglyph",null,["leftSampler"],i,n[1],r,o,a)||this;return s._passedProcess=n[0]._rigPostProcess,s.onApplyObservable.add(function(e){e.setTextureFromPostProcess("leftSampler",s._passedProcess)}),s}return h.d(t,e),t}(oi);Ke.a._setStereoscopicAnaglyphRigMode=function(e){e._rigCameras[0]._rigPostProcess=new ci(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new hi(e.name+"_anaglyph",1,e._rigCameras)},B.a.AddNodeConstructor("AnaglyphArcRotateCamera",function(e,t,i){return function(){return new di(e,0,0,1,a.e.Zero(),i.interaxial_distance,t)}});var di=function(e){function t(t,i,n,r,o,a,s){var c=e.call(this,t,i,n,r,o,s)||this;return c.interaxialDistance=a,c.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:a}),c}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},t}(wt);B.a.AddNodeConstructor("AnaglyphFreeCamera",function(e,t,i){return function(){return new fi(e,a.e.Zero(),i.interaxial_distance,t)}});var fi=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphFreeCamera"},t}(Dt);B.a.AddNodeConstructor("AnaglyphGamepadCamera",function(e,t,i){return function(){return new pi(e,a.e.Zero(),i.interaxial_distance,t)}});var pi=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},t}(ti);B.a.AddNodeConstructor("AnaglyphUniversalCamera",function(e,t,i){return function(){return new _i(e,a.e.Zero(),i.interaxial_distance,t)}});var _i=function(e){function t(t,i,n,r){var o=e.call(this,t,i,r)||this;return o.interaxialDistance=n,o.setCameraRigMode(Ke.a.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:n}),o}return h.d(t,e),t.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},t}(ei),mi="const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}";ni.a.ShadersStore.stereoscopicInterlacePixelShader=mi;var gi=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,"stereoscopicInterlace",["stepSize"],["camASampler"],1,i[1],r,o,s,n?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return c._passedProcess=i[0]._rigPostProcess,c._stepSize=new a.d(1/c.width,1/c.height),c.onSizeChangedObservable.add(function(){c._stepSize=new a.d(1/c.width,1/c.height)}),c.onApplyObservable.add(function(e){e.setTextureFromPostProcess("camASampler",c._passedProcess),e.setFloat2("stepSize",c._stepSize.x,c._stepSize.y)}),c}return h.d(t,e),t}(oi);Ke.a._setStereoscopicRigMode=function(e){var t=e.cameraRigMode===Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||e.cameraRigMode===Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;e._rigCameras[0]._rigPostProcess=new ci(e.name+"_passthru",1,e._rigCameras[0]),e._rigCameras[1]._rigPostProcess=new gi(e.name+"_stereoInterlace",e._rigCameras,t)},B.a.AddNodeConstructor("StereoscopicArcRotateCamera",function(e,t,i){return function(){return new vi(e,0,0,1,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var vi=function(e){function t(t,i,n,r,o,a,s,c){var l=e.call(this,t,i,n,r,o,c)||this;return l.interaxialDistance=a,l.isStereoscopicSideBySide=s,l.setCameraRigMode(s?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:a}),l}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},t}(wt);B.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new yi(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var yi=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicFreeCamera"},t}(Dt);B.a.AddNodeConstructor("StereoscopicGamepadCamera",function(e,t,i){return function(){return new bi(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var bi=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},t}(ti);B.a.AddNodeConstructor("StereoscopicFreeCamera",function(e,t,i){return function(){return new Ti(e,a.e.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}});var Ti=function(e){function t(t,i,n,r,o){var a=e.call(this,t,i,o)||this;return a.interaxialDistance=n,a.isStereoscopicSideBySide=r,a.setCameraRigMode(r?Ke.a.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:Ke.a.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:n}),a}return h.d(t,e),t.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},t}(ei);B.a.AddNodeConstructor("VirtualJoysticksCamera",function(e,t){return function(){return new Ei(e,a.e.Zero(),t)}});var Ei=function(e){function t(t,i,n){var r=e.call(this,t,i,n)||this;return r.inputs.addVirtualJoystick(),r}return h.d(t,e),t.prototype.getClassName=function(){return"VirtualJoysticksCamera"},t}(Dt),Ai=function(){function e(){this.compensateDistortion=!0,this.multiviewEnabled=!1}return Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return this.hResolution/(2*this.vResolution)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatioFov",{get:function(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return a.a.Translation(e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return a.a.Translation(-e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftPreViewMatrix",{get:function(){return a.a.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightPreViewMatrix",{get:function(){return a.a.Translation(-.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),e.GetDefault=function(){var t=new e;return t.hResolution=1280,t.vResolution=800,t.hScreenSize=.149759993,t.vScreenSize=.0935999975,t.vScreenCenter=.0467999987,t.eyeToScreenDistance=.0410000011,t.lensSeparationDistance=.063500002,t.interpupillaryDistance=.064000003,t.distortionK=[1,.219999999,.239999995,0],t.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],t.postProcessScaleFactor=1.714605507808412,t.lensCenterOffset=.151976421,t},e}(),Pi="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn;\nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}";ni.a.ShadersStore.vrDistortionCorrectionPixelShader=Pi;var Si=function(e){function t(t,i,n,r){var o=e.call(this,t,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,r.postProcessScaleFactor,i,$e.a.BILINEAR_SAMPLINGMODE)||this;return o._isRightEye=n,o._distortionFactors=r.distortionK,o._postProcessScaleFactor=r.postProcessScaleFactor,o._lensCenterOffset=r.lensCenterOffset,o.adaptScaleToCurrentViewport=!0,o.onSizeChangedObservable.add(function(){o._scaleIn=new a.d(2,2/o.aspectRatio),o._scaleFactor=new a.d(1/o._postProcessScaleFactor*.5,1/o._postProcessScaleFactor*.5*o.aspectRatio),o._lensCenter=new a.d(o._isRightEye?.5-.5*o._lensCenterOffset:.5+.5*o._lensCenterOffset,.5)}),o.onApplyObservable.add(function(e){e.setFloat2("LensCenter",o._lensCenter.x,o._lensCenter.y),e.setFloat2("Scale",o._scaleFactor.x,o._scaleFactor.y),e.setFloat2("ScaleIn",o._scaleIn.x,o._scaleIn.y),e.setFloat4("HmdWarpParam",o._distortionFactors[0],o._distortionFactors[1],o._distortionFactors[2],o._distortionFactors[3])}),o}return h.d(t,e),t}(oi),Ri="precision mediump sampler2DArray;\nvarying vec2 vUV;\nuniform sampler2DArray multiviewSampler;\nuniform int imageIndex;\nvoid main(void)\n{\ngl_FragColor=texture(multiviewSampler,vec3(vUV,imageIndex));\n}";ni.a.ShadersStore.vrMultiviewToSingleviewPixelShader=Ri;var xi=i(76),Ci=i(95),Mi=i(104);Ce.b.prototype.createRenderTargetCubeTexture=function(e,t){var i=h.a({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:Ce.b.TEXTURETYPE_UNSIGNED_INT,samplingMode:Ce.b.TEXTURE_TRILINEAR_SAMPLINGMODE,format:Ce.b.TEXTUREFORMAT_RGBA},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type!==Ce.b.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==Ce.b.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=Ce.b.TEXTURE_NEAREST_SAMPLINGMODE);var n=this._gl,r=new et.a(this,et.a.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,r,!0);var o=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type!==Ce.b.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=Ce.b.TEXTURETYPE_UNSIGNED_INT,m.a.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MAG_FILTER,o.mag),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_MIN_FILTER,o.min),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_CUBE_MAP,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);for(var a=0;a<6;a++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+a,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var s=n.createFramebuffer();return this._bindUnboundFramebuffer(s),r._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&n.generateMipmap(n.TEXTURE_CUBE_MAP),this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null),n.bindRenderbuffer(n.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),r._framebuffer=s,r.width=e,r.height=e,r.isReady=!0,r.isCube=!0,r.samples=1,r.generateMipMaps=i.generateMipMaps,r.samplingMode=i.samplingMode,r.type=i.type,r.format=i.format,r._generateDepthBuffer=i.generateDepthBuffer,r._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(r),r};var Oi=function(e){function t(t,i,n,r,s,c,l,u,h,d,f,p,_){void 0===s&&(s=!0),void 0===c&&(c=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=!1),void 0===u&&(u=$e.a.TRILINEAR_SAMPLINGMODE),void 0===h&&(h=!0),void 0===d&&(d=!1),void 0===f&&(f=!1),void 0===p&&(p=g.a.TEXTUREFORMAT_RGBA),void 0===_&&(_=!1);var m=e.call(this,null,n,!r)||this;return m.isCube=l,m.renderParticles=!0,m.renderSprites=!1,m.coordinatesMode=$e.a.PROJECTION_MODE,m.ignoreCameraViewport=!1,m.onBeforeBindObservable=new o.c,m.onAfterUnbindObservable=new o.c,m.onBeforeRenderObservable=new o.c,m.onAfterRenderObservable=new o.c,m.onClearObservable=new o.c,m.onResizeObservable=new o.c,m._currentRefreshId=-1,m._refreshRate=1,m._samples=1,m.boundingBoxPosition=a.e.Zero(),(n=m.getScene())?(m.renderList=new Array,m._engine=n.getEngine(),m.name=t,m.isRenderTarget=!0,m._initialSizeParameter=i,m._processSizeParameter(i),m._resizeObserver=m.getScene().getEngine().onResizeObservable.add(function(){}),m._generateMipMaps=!!r,m._doNotChangeAspectRatio=s,m._renderingManager=new Mi.b(n),m._renderingManager._useSceneAutoClearSetup=!0,f?m:(m._renderTargetOptions={generateMipMaps:r,type:c,format:p,samplingMode:u,generateDepthBuffer:h,generateStencilBuffer:d},u===$e.a.NEAREST_SAMPLINGMODE&&(m.wrapU=$e.a.CLAMP_ADDRESSMODE,m.wrapV=$e.a.CLAMP_ADDRESSMODE),_||(l?(m._texture=n.getEngine().createRenderTargetCubeTexture(m.getRenderSize(),m._renderTargetOptions),m.coordinatesMode=$e.a.INVCUBIC_MODE,m._textureMatrix=a.a.Identity()):m._texture=n.getEngine().createRenderTargetTexture(m._size,m._renderTargetOptions)),m)):m}return h.d(t,e),Object.defineProperty(t.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!0,configurable:!0}),t.prototype._hookArray=function(e){var t=this,i=e.push;e.push=function(){for(var n=[],r=0;r0&&(this._postProcesses[0].autoClear=!1))}},t.prototype._shouldRender=function(){return-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},t.prototype.getRenderSize=function(){return this.getRenderWidth()},t.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},t.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.scale=function(e){var t=this.getRenderSize()*e;this.resize(t)},t.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:e.prototype.getReflectionTextureMatrix.call(this)},t.prototype.resize=function(e){var t=this.isCube;this.releaseInternalTexture();var i=this.getScene();i&&(this._processSizeParameter(e),this._texture=t?i.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):i.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions),this.onResizeObservable.hasObservers()&&this.onResizeObservable.notifyObservers(this))},t.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),s=this.getScene()){var i,n=s.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var r=0;r=0&&this._renderingManager.dispatchParticles(v))}if(this.isCube)for(var b=0;b<6;b++)this.renderToTarget(b,u,e,t),s.incrementRenderId(),s.resetCachedMaterial();else this.renderToTarget(0,u,e,t);this.onAfterUnbindObservable.notifyObservers(this),s.activeCamera&&((s.getEngine().scenes.length>1||this.activeCamera&&this.activeCamera!==s.activeCamera)&&s.setTransformMatrix(s.activeCamera.getViewMatrix(),s.activeCamera.getProjectionMatrix(!0)),n.setViewport(s.activeCamera.viewport)),s.resetCachedMaterial()}},t.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,n=Ce.b.NearestPOT(i+16384/(128+i));return Math.min(Ce.b.FloorPOT(e),n)},t.prototype._bindFrameBuffer=function(e){void 0===e&&(e=0);var t=this.getScene();if(t){var i=t.getEngine();this._texture&&i.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,this.depthStencilTexture?this.depthStencilTexture:void 0)}},t.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,function(){i.onAfterRenderObservable.notifyObservers(t)})},t.prototype.renderToTarget=function(e,t,i,n){var r=this.getScene();if(r){var o=r.getEngine();if(this._texture){this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):i&&r.postProcessManager._prepareFrame(this._texture)||this._bindFrameBuffer(e),this.onBeforeRenderObservable.notifyObservers(e),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(o):o.clear(this.clearColor||r.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||r.updateTransformMatrix(!0);for(var a=0,s=r._beforeRenderTargetDrawStage;a=0&&t.customRenderTargets.splice(i,1);for(var n=0,r=t.cameras;n=0&&o.customRenderTargets.splice(i,1)}this.depthStencilTexture&&this.getScene().getEngine()._releaseTexture(this.depthStencilTexture),e.prototype.dispose.call(this)}},t.prototype._rebuild=function(){this.refreshRate===t.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=t.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},t.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},t.prototype.getViewCount=function(){return 1},t.REFRESHRATE_RENDER_ONCE=0,t.REFRESHRATE_RENDER_ONEVERYFRAME=1,t.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,t}($e.a);$e.a._CreateRenderTargetTexture=function(e,t,i,n){return new Oi(e,t,i,n)};var Ii=function(e){function t(t,i){void 0===i&&(i=512);var n=e.call(this,"multiview rtt",i,t,!1,!0,et.a.DATASOURCE_UNKNOWN,!1,void 0,!1,!1,!0,void 0,!0)||this,r=t.getEngine().createMultiviewRenderTargetTexture(n.getRenderWidth(),n.getRenderHeight());return r.isMultiview=!0,n._texture=r,n}return h.d(t,e),t.prototype._bindFrameBuffer=function(e){void 0===e&&(e=0),this._texture&&this.getScene().getEngine().bindMultiviewFramebuffer(this._texture)},t.prototype.getViewCount=function(){return 2},t}(Oi),Di=i(79);Ce.b.prototype.createMultiviewRenderTargetTexture=function(e,t){var i=this._gl;if(!this.getCaps().multiview)throw"Multiview is not supported";var n=new et.a(this,et.a.DATASOURCE_UNKNOWN,!0);return n.width=e,n.height=t,n._framebuffer=i.createFramebuffer(),n._colorTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._colorTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.RGBA8,e,t,2),n._depthStencilTextureArray=i.createTexture(),i.bindTexture(i.TEXTURE_2D_ARRAY,n._depthStencilTextureArray),i.texStorage3D(i.TEXTURE_2D_ARRAY,1,i.DEPTH32F_STENCIL8,e,t,2),n.isReady=!0,n},Ce.b.prototype.bindMultiviewFramebuffer=function(e){var t=this._gl,i=this.getCaps().multiview;if(this.bindFramebuffer(e,void 0,void 0,void 0,!0),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,e._framebuffer),!e._colorTextureArray||!e._depthStencilTextureArray)throw"Invalid multiview frame buffer";i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,e._colorTextureArray,0,0,2),i.framebufferTextureMultiviewOVR(t.DRAW_FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,e._depthStencilTextureArray,0,0,2)},Ke.a.prototype._useMultiviewToSingleView=!1,Ke.a.prototype._multiviewTexture=null,Ke.a.prototype._resizeOrCreateMultiviewTexture=function(e,t){this._multiviewTexture?this._multiviewTexture.getRenderWidth()==e&&this._multiviewTexture.getRenderHeight()==t||(this._multiviewTexture.dispose(),this._multiviewTexture=new Ii(this.getScene(),{width:e,height:t})):this._multiviewTexture=new Ii(this.getScene(),{width:e,height:t})},K.a.prototype._transformMatrixR=a.a.Zero(),K.a.prototype._multiviewSceneUbo=null,K.a.prototype._createMultiviewUbo=function(){this._multiviewSceneUbo=new xi.a(this.getEngine(),void 0,!0),this._multiviewSceneUbo.addUniform("viewProjection",16),this._multiviewSceneUbo.addUniform("viewProjectionR",16),this._multiviewSceneUbo.addUniform("view",16)},K.a.prototype._updateMultiviewUbo=function(e,t){e&&t&&e.multiplyToRef(t,this._transformMatrixR),e&&t&&(e.multiplyToRef(t,a.c.Matrix[0]),Di.a.GetRightPlaneToRef(a.c.Matrix[0],this._frustumPlanes[3])),this._multiviewSceneUbo&&(this._multiviewSceneUbo.updateMatrix("viewProjection",this.getTransformMatrix()),this._multiviewSceneUbo.updateMatrix("viewProjectionR",this._transformMatrixR),this._multiviewSceneUbo.updateMatrix("view",this._viewMatrix),this._multiviewSceneUbo.update())},K.a.prototype._renderMultiviewToSingleView=function(e){e._resizeOrCreateMultiviewTexture(e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.width>0?e._rigPostProcess.width/2:this.getEngine().getRenderWidth(!0)/2,e._rigPostProcess&&e._rigPostProcess&&e._rigPostProcess.height>0?e._rigPostProcess.height:this.getEngine().getRenderHeight(!0)),this._multiviewSceneUbo||this._createMultiviewUbo(),e.outputRenderTarget=e._multiviewTexture,this._renderForCamera(e),e.outputRenderTarget=null;for(var t=0;t=2&&e.onControllersAttachedObservable.notifyObservers(e.controllers)}}})},t}(Dt),ki=function(e){function t(t){var i=e.call(this,t)||this;return i.onTriggerStateChangedObservable=new o.c,i.onMainButtonStateChangedObservable=new o.c,i.onSecondaryButtonStateChangedObservable=new o.c,i.onPadStateChangedObservable=new o.c,i.onPadValuesChangedObservable=new o.c,i.pad={x:0,y:0},i._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},i._buttons=new Array(t.buttons.length),i.hand=t.hand,i}return h.d(t,e),t.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(t.prototype,"defaultModel",{get:function(){return this._defaultModel},enumerable:!0,configurable:!0}),t.prototype.update=function(){e.prototype.update.call(this);for(var t=0;t\n#include\n#include\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\n\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}");ni.a.ShadersStore.imageProcessingPixelShader=Wi;var Hi=function(e){function t(t,i,n,r,o,a,s,c){void 0===n&&(n=null),void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT);var l=e.call(this,t,"imageProcessing",[],[],i,n,r,o,a,null,s,"postprocess",null,!0)||this;return l._fromLinearSpace=!0,l._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1},c?(c.applyByPostProcess=!0,l._attachImageProcessingConfiguration(c,!0),l.fromLinearSpace=!1):(l._attachImageProcessingConfiguration(null,!0),l.imageProcessingConfiguration.applyByPostProcess=!0),l.onApply=function(e){l.imageProcessingConfiguration.bind(e,l.aspectRatio)},l}return h.d(t,e),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){e.applyByPostProcess=!0,this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),t.prototype._attachImageProcessingConfiguration=function(e,t){var i=this;if(void 0===t&&(t=!1),e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{var n=null,r=this.getEngine(),o=this.getCamera();if(o)n=o.getScene();else if(r&&r.scenes){var a=r.scenes;n=a[a.length-1]}else n=C.a.LastCreatedScene;this._imageProcessingConfiguration=n.imageProcessingConfiguration}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(function(){i._updateParameters()})),t||this._updateParameters()}},Object.defineProperty(t.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"toneMappingType",{get:function(){return this._imageProcessingConfiguration.toneMappingType},set:function(e){this._imageProcessingConfiguration.toneMappingType=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCentreX},set:function(e){this.imageProcessingConfiguration.vignetteCentreX=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCentreY},set:function(e){this.imageProcessingConfiguration.vignetteCentreY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"ImageProcessingPostProcess"},t.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e="";for(var t in this._defines)this._defines[t]&&(e+="#define "+t+";\r\n");var i=["textureSampler"],n=["scale"];Gi.a&&(Gi.a.PrepareSamplers(i,this._defines),Gi.a.PrepareUniforms(n,this._defines)),this.updateEffect(e,n,i)},t.prototype.dispose=function(t){e.prototype.dispose.call(this,t),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},h.c([Object(F.c)()],t.prototype,"_fromLinearSpace",void 0),t}(oi),Xi=i(14),Yi=i(4);Se.a._GroundMeshParser=function(e,t){return Ki.Parse(e,t)};var Ki=function(e){function t(t,i){var n=e.call(this,t,i)||this;return n.generateOctree=!1,n}return h.d(t,e),t.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(t.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!0,configurable:!0}),t.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e);this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)},t.prototype.getHeightAtCoordinates=function(e,t){var i=this.getWorldMatrix(),n=a.c.Matrix[5];i.invertToRef(n);var r=a.c.Vector3[8];if(a.e.TransformCoordinatesFromFloatsToRef(e,0,t,n,r),e=r.x,t=r.z,ethis._maxX||tthis._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),s=-(o.x*e+o.z*t+o.w)/o.y;return a.e.TransformCoordinatesFromFloatsToRef(0,s,0,i,r),r.y},t.prototype.getNormalAtCoordinates=function(e,t){var i=new a.e(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},t.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var n=this.getWorldMatrix(),r=a.c.Matrix[5];n.invertToRef(r);var o=a.c.Vector3[8];if(a.e.TransformCoordinatesFromFloatsToRef(e,0,t,r,o),e=o.x,t=o.z,ethis._maxX||tthis._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var s=this._getFacetAt(e,t);return a.e.TransformNormalFromFloatsToRef(s.x,s.y,s.z,n,i),this},t.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},t.prototype._getFacetAt=function(e,t){var i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),n=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),r=this._heightQuads[n*this._subdivisionsX+i];return te.maxHeight){h=!0;var d=e.maxHeight;e.maxHeight=e.minHeight,e.minHeight=d}for(t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var f=new a.e(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),p=4*(((f.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(f.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),_=e.buffer[p]/255,m=e.buffer[p+1]/255,g=e.buffer[p+2]/255,v=e.buffer[p+3]/255;h&&(_=1-_,m=1-m,g=1-g);var y=_*l.r+m*l.g+g*l.b;f.y=v>=u?e.minHeight+(e.maxHeight-e.minHeight)*y:e.minHeight-re.a,r.push(f.x,f.y,f.z),o.push(0,0,0),c.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t=e.minHeight,S=r[3*T+1]>=e.minHeight,R=r[3*E+1]>=e.minHeight;P&&S&&R&&(n.push(b),n.push(T),n.push(E)),r[3*A+1]>=e.minHeight&&P&&R&&(n.push(A),n.push(b),n.push(E))}Xi.a.ComputeNormals(r,n,o);var x=new Xi.a;return x.indices=n,x.positions=r,x.normals=o,x.uvs=c,x},Se.a.CreateGround=function(e,t,i,n,r,o){var a={width:t,height:i,subdivisions:n,updatable:o};return Qi.CreateGround(e,a,r)},Se.a.CreateTiledGround=function(e,t,i,n,r,o,a,s,c){var l={xmin:t,zmin:i,xmax:n,zmax:r,subdivisions:o,precision:a,updatable:c};return Qi.CreateTiledGround(e,l,s)},Se.a.CreateGroundFromHeightMap=function(e,t,i,n,r,o,a,s,c,l,u){var h={width:i,height:n,subdivisions:r,minHeight:o,maxHeight:a,updatable:c,onReady:l,alphaFilter:u};return Qi.CreateGroundFromHeightMap(e,t,h,s)};var Qi=function(){function e(){}return e.CreateGround=function(e,t,i){var n=new Ki(e,i);return n._setReady(!1),n._subdivisionsX=t.subdivisionsX||t.subdivisions||1,n._subdivisionsY=t.subdivisionsY||t.subdivisions||1,n._width=t.width||1,n._height=t.height||1,n._maxX=n._width/2,n._maxZ=n._height/2,n._minX=-n._maxX,n._minZ=-n._maxZ,Xi.a.CreateGround(t).applyToMesh(n,t.updatable),n._setReady(!0),n},e.CreateTiledGround=function(e,t,i){void 0===i&&(i=null);var n=new Se.a(e,i);return Xi.a.CreateTiledGround(t).applyToMesh(n,t.updatable),n},e.CreateGroundFromHeightMap=function(e,t,i,n){void 0===n&&(n=null);var r=i.width||10,o=i.height||10,a=i.subdivisions||1,c=i.minHeight||0,l=i.maxHeight||1,u=i.colorFilter||new s.a(.3,.59,.11),h=i.alphaFilter||0,d=i.updatable,f=i.onReady;n=n||C.a.LastCreatedScene;var p=new Ki(e,n);p._subdivisionsX=a,p._subdivisionsY=a,p._width=r,p._height=o,p._maxX=p._width/2,p._maxZ=p._height/2,p._minX=-p._maxX,p._minZ=-p._maxZ,p._setReady(!1);return Ie.b.LoadImage(t,function(e){var t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");if(!n.isDisposed){var s=e.width,_=e.height;t.width=s,t.height=_,i.drawImage(e,0,0);var m=i.getImageData(0,0,s,_).data;Xi.a.CreateGroundFromHeightMap({width:r,height:o,subdivisions:a,minHeight:c,maxHeight:l,colorFilter:u,buffer:m,bufferWidth:s,bufferHeight:_,alphaFilter:h}).applyToMesh(p,d),f&&f(p),p._setReady(!0)}},function(){},n.offlineProvider),p},e}();Xi.a.CreateTorus=function(e){for(var t=[],i=[],n=[],r=[],o=e.diameter||1,s=e.thickness||.5,c=e.tessellation||16,l=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,u=c+1,h=0;h<=c;h++)for(var d=h/c,f=h*Math.PI*2/c-Math.PI/2,p=a.a.Translation(o/2,0,0).multiply(a.a.RotationY(f)),_=0;_<=c;_++){var m=1-_/c,g=_*Math.PI*2/c+Math.PI,v=Math.cos(g),y=Math.sin(g),b=new a.e(v,y,0),T=b.scale(s/2),E=new a.d(d,m);T=a.e.TransformCoordinates(T,p),b=a.e.TransformNormal(b,p),i.push(T.x,T.y,T.z),n.push(b.x,b.y,b.z),r.push(E.x,E.y);var A=(h+1)%u,P=(_+1)%u;t.push(h*u+_),t.push(h*u+P),t.push(A*u+_),t.push(h*u+P),t.push(A*u+P),t.push(A*u+_)}Xi.a._ComputeSides(l,i,t,n,r,e.frontUVs,e.backUVs);var S=new Xi.a;return S.indices=t,S.positions=i,S.normals=n,S.uvs=r,S},Se.a.CreateTorus=function(e,t,i,n,r,o,a){var s={diameter:t,thickness:i,tessellation:n,sideOrientation:a,updatable:o};return Zi.CreateTorus(e,s,r)};var qi,Zi=function(){function e(){}return e.CreateTorus=function(e,t,i){var n=new Se.a(e,i);return t.sideOrientation=Se.a._GetDefaultSideOrientation(t.sideOrientation),n._originalBuilderSideOrientation=t.sideOrientation,Xi.a.CreateTorus(t).applyToMesh(n,t.updatable),n},e}(),Ji=i(61),$i=function(){function e(t,i){if(void 0===i&&(i=null),this.scene=t,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=e._idCounter++,i)this._gazeTracker=i.clone("gazeTracker");else{this._gazeTracker=Se.a.CreateTorus("gazeTracker",.0035,.0025,20,t,!1),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var n=new zi.a("targetMat",t);n.specularColor=s.a.Black(),n.emissiveColor=new s.a(.7,.7,.7),n.backFaceCulling=!1,this._gazeTracker.material=n}}return e.prototype._getForwardRay=function(e){return new jt.a(a.e.Zero(),new a.e(0,0,e))},e.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},e.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},e.prototype._activatePointer=function(){this._activePointer=!0},e.prototype._deactivatePointer=function(){this._activePointer=!1},e.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},e.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},e._idCounter=0,e}(),en=function(e){function t(t,i,n){var r=e.call(this,i,n)||this;r.webVRController=t,r._laserPointer=Se.a.CreateCylinder("laserPointer",1,.004,2e-4,20,1,i,!1);var o=new zi.a("laserPointerMat",i);if(o.emissiveColor=new s.a(.7,.7,.7),o.alpha=.6,r._laserPointer.material=o,r._laserPointer.rotation.x=Math.PI/2,r._laserPointer.position.z=-.5,r._laserPointer.isVisible=!1,r._laserPointer.isPickable=!1,!t.mesh){var a=new Se.a("preloadControllerMesh",i),c=new Se.a(Yt.POINTING_POSE,i);c.rotation.x=-.7,a.addChild(c),t.attachToMesh(a)}return r._setLaserPointerParent(t.mesh),r._meshAttachedObserver=t._meshAttachedObservable.add(function(e){r._setLaserPointerParent(e)}),r}return h.d(t,e),t.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},t.prototype._activatePointer=function(){e.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},t.prototype._deactivatePointer=function(){e.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},t.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},t.prototype._setLaserPointerParent=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach(function(e){t(e)})};t(e);var i=e.getChildren(void 0,!1),n=e;this.webVRController._pointingPoseNode=null;for(var r=0;r=0){n=i[r],this.webVRController._pointingPoseNode=n;break}this._laserPointer.parent=n},t.prototype._updatePointerDistance=function(e){void 0===e&&(e=100),this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},t}($i),tn=function(e){function t(t,i){var n=e.call(this,i)||this;return n.getCamera=t,n}return h.d(t,e),t.prototype._getForwardRay=function(e){var t=this.getCamera();return t?t.getForwardRay(e):new jt.a(a.e.Zero(),a.e.Forward())},t}($i),nn=function(){},rn=function(){function e(e,t){var i=this;if(void 0===t&&(t={}),this.webVROptions=t,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.enableGazeEvenWhenNoPointerLock=!1,this.exitVROnDoubleTap=!0,this.onEnteringVRObservable=new o.c,this.onAfterEnteringVRObservable=new o.c,this.onExitingVRObservable=new o.c,this.onControllerMeshLoadedObservable=new o.c,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._rotationAllowed=!0,this._teleportBackwardsVector=new a.e(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new a.e(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this.onNewMeshSelected=new o.c,this.onMeshSelectedWithController=new o.c,this.onNewMeshPicked=new o.c,this.onBeforeCameraTeleport=new o.c,this.onAfterCameraTeleport=new o.c,this.onSelectedMeshUnselected=new o.c,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this.updateGazeTrackerColor=!0,this.requestPointerLockOnFullScreen=!0,this._onResize=function(){i.moveButtonToBottomRight(),i._fullscreenVRpresenting&&i._webVRready&&i.exitVR()},this._onFullscreenChange=function(){var e=document;void 0!==e.fullscreen?i._fullscreenVRpresenting=document.fullscreen:void 0!==e.mozFullScreen?i._fullscreenVRpresenting=e.mozFullScreen:void 0!==e.webkitIsFullScreen?i._fullscreenVRpresenting=e.webkitIsFullScreen:void 0!==e.msIsFullScreen?i._fullscreenVRpresenting=e.msIsFullScreen:void 0!==document.msFullscreenElement&&(i._fullscreenVRpresenting=document.msFullscreenElement),!i._fullscreenVRpresenting&&i._canvas&&(i.exitVR(),!i._useCustomVRButton&&i._btnVR&&(i._btnVR.style.top=i._canvas.offsetTop+i._canvas.offsetHeight-70+"px",i._btnVR.style.left=i._canvas.offsetLeft+i._canvas.offsetWidth-100+"px"))},this._cachedAngularSensibility={angularSensibilityX:null,angularSensibilityY:null,angularSensibility:null},this.beforeRender=function(){i._leftController&&i._leftController._activePointer&&i._castRayAndSelectObject(i._leftController),i._rightController&&i._rightController._activePointer&&i._castRayAndSelectObject(i._rightController),i._noControllerIsActive&&(i._scene.getEngine().isPointerLock||i.enableGazeEvenWhenNoPointerLock)?i._castRayAndSelectObject(i._cameraGazer):i._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){if(e.type!==at.POSE_ENABLED)e.leftStick&&e.onleftstickchanged(function(e){i._teleportationInitialized&&i.teleportationEnabled&&(!i._leftController&&!i._rightController||i._leftController&&!i._leftController._activePointer&&i._rightController&&!i._rightController._activePointer)&&(i._checkTeleportWithRay(e,i._cameraGazer),i._checkTeleportBackwards(e,i._cameraGazer))}),e.rightStick&&e.onrightstickchanged(function(e){i._teleportationInitialized&&i._checkRotate(e,i._cameraGazer)}),e.type===at.XBOX&&(e.onbuttondown(function(e){i._interactionsEnabled&&e===Wt.A&&i._cameraGazer._selectionPointerDown()}),e.onbuttonup(function(e){i._interactionsEnabled&&e===Wt.A&&i._cameraGazer._selectionPointerUp()}));else{var t=e,n=new en(t,i._scene,i._cameraGazer._gazeTracker);"right"===t.hand||i._leftController&&i._leftController.webVRController!=t?i._rightController=n:i._leftController=n,i._tryEnableInteractionOnController(n)}},this._tryEnableInteractionOnController=function(e){i._interactionsRequested&&!e._interactionsEnabled&&i._enableInteractionOnController(e),i._teleportationRequested&&!e._teleportationEnabled&&i._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof ki&&("left"===e.hand&&null!=i._leftController&&(i._leftController.dispose(),i._leftController=null),"right"===e.hand&&null!=i._rightController&&(i._rightController.dispose(),i._rightController=null))},this._workingVector=a.e.Zero(),this._workingQuaternion=a.b.Identity(),this._workingMatrix=a.a.Identity(),this._scene=e,this._canvas=e.getEngine().getRenderingCanvas(),void 0===t.createFallbackVRDeviceOrientationFreeCamera&&(t.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===t.createDeviceOrientationCamera&&(t.createDeviceOrientationCamera=!0),void 0===t.laserToggle&&(t.laserToggle=!0),void 0===t.defaultHeight&&(t.defaultHeight=1.7),t.useCustomVRButton&&(this._useCustomVRButton=!0,t.customVRButton&&(this._btnVR=t.customVRButton)),t.rayLength&&(this._rayLength=t.rayLength),this._defaultHeight=t.defaultHeight,t.positionScale&&(this._rayLength*=t.positionScale,this._defaultHeight*=t.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new a.e(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new Ft("deviceOrientationVRHelper",this._position.clone(),e),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof It&&this._scene.activeCamera.rotation)){var n=this._scene.activeCamera;n.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(n.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(a.b.RotationYawPitchRoll(n.rotation.y,n.rotation.x,n.rotation.z)),this._deviceOrientationCamera.rotation=n.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas)}else this._existingCamera=this._scene.activeCamera;if(t.createFallbackVRDeviceOrientationFreeCamera&&(t.useMultiview&&(t.vrDeviceOrientationCameraMetrics||(t.vrDeviceOrientationCameraMetrics=Ai.GetDefault()),t.vrDeviceOrientationCameraMetrics.multiviewEnabled=!0),this._vrDeviceOrientationCamera=new Ni("VRDeviceOrientationVRHelper",this._position,this._scene,!0,t.vrDeviceOrientationCameraMetrics),this._vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._webVRCamera=new Vi("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new tn(function(){return i.currentVRCamera},e),!this._useCustomVRButton){this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR";".babylonVRicon.vrdisplaypresenting { display: none; }";var r=document.createElement("style");r.appendChild(document.createTextNode(".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }.babylonVRicon.vrdisplaypresenting { display: none; }")),document.getElementsByTagName("head")[0].appendChild(r),this.moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",function(){i.isInVRMode?i.exitVR():i.enterVR()});var s=this._scene.getEngine().getHostWindow();s.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",this._onFullscreenChange,!1),document.onmsfullscreenchange=this._onFullscreenChange,t.createFallbackVRDeviceOrientationFreeCamera?this.displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add(function(e){e.vrDisplay&&i.displayVRButton()}),this._onKeyDown=function(e){27===e.keyCode&&i.isInVRMode&&i.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add(function(){i.isInVRMode&&i.exitVROnDoubleTap&&(i.exitVR(),i._fullscreenVRpresenting&&i._scene.getEngine().exitFullscreen())},Ue.a.POINTERDOUBLETAP,!1),this._onVRDisplayChanged=function(e){return i.onVRDisplayChanged(e)},this._onVrDisplayPresentChange=function(){return i.onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){i._webVRrequesting=!0,i.updateButtonVisibility()},this._onVRRequestPresentComplete=function(){i._webVRrequesting=!1,i.updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),s.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),e.onDisposeObservable.add(function(){i.dispose()}),this._webVRCamera.onControllerMeshLoadedObservable.add(function(e){return i._onDefaultMeshLoaded(e)}),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this.updateButtonVisibility(),this._circleEase=new de,this._circleEase.setEasingMode(he.EASINGMODE_EASEINOUT),e.onPointerObservable.add(function(t){i._interactionsEnabled&&e.activeCamera===i.vrDeviceOrientationCamera&&"mouse"===t.event.pointerType&&(t.type===Ue.a.POINTERDOWN?i._cameraGazer._selectionPointerDown():t.type===Ue.a.POINTERUP&&i._cameraGazer._selectionPointerUp())}),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes})}return Object.defineProperty(e.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onControllerMeshLoaded",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gazeTrackerMesh",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftControllerGazeTrackerMesh",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightControllerGazeTrackerMesh",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){this._displayGaze=e,e||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){this._displayLaserPointer=e,e?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentVRCamera",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"webVRCamera",{get:function(){return this._webVRCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vrButton",{get:function(){return this._btnVR},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!0,configurable:!0}),e.prototype._onDefaultMeshLoaded=function(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){m.a.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}},Object.defineProperty(e.prototype,"isInVRMode",{get:function(){return this._webVRpresenting||this._fullscreenVRpresenting},enumerable:!0,configurable:!0}),e.prototype.onVrDisplayPresentChange=function(){var e=this._scene.getEngine().getVRDevice();if(e){var t=this._webVRpresenting;this._webVRpresenting=e.isPresenting,t&&!this._webVRpresenting&&this.exitVR()}else m.a.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");this.updateButtonVisibility()},e.prototype.onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this.updateButtonVisibility()},e.prototype.moveButtonToBottomRight=function(){if(this._canvas&&!this._useCustomVRButton&&this._btnVR){var e=this._canvas.getBoundingClientRect();this._btnVR.style.top=e.top+e.height-70+"px",this._btnVR.style.left=e.left+e.width-100+"px"}},e.prototype.displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||!this._btnVR||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},e.prototype.updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode?this._btnVR.className+=" vrdisplaypresenting":(this._webVRready&&(this._btnVR.className+=" vrdisplayready"),this._webVRsupported&&(this._btnVR.className+=" vrdisplaysupported"),this._webVRrequesting&&(this._btnVR.className+=" vrdisplayrequesting")))},e.prototype.enterVR=function(){var e=this;if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){m.a.Warn("Error in your custom logic onEnteringVR: "+e)}if(this._scene.activeCamera){if(this._position=this._scene.activeCamera.position.clone(),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.rotation=a.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles(),this.vrDeviceOrientationCamera.angularSensibility=2e3),this.webVRCamera){var t=this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y,i=a.b.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y-t,n=this.webVRCamera.rotationQuaternion.toEulerAngles().y;this.webVRCamera.rotationQuaternion=a.b.FromEulerAngles(0,n+i,0)}this._existingCamera=this._scene.activeCamera,this._existingCamera.angularSensibilityX&&(this._cachedAngularSensibility.angularSensibilityX=this._existingCamera.angularSensibilityX,this._existingCamera.angularSensibilityX=Number.MAX_VALUE),this._existingCamera.angularSensibilityY&&(this._cachedAngularSensibility.angularSensibilityY=this._existingCamera.angularSensibilityY,this._existingCamera.angularSensibilityY=Number.MAX_VALUE),this._existingCamera.angularSensibility&&(this._cachedAngularSensibility.angularSensibility=this._existingCamera.angularSensibility,this._existingCamera.angularSensibility=Number.MAX_VALUE)}this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._scene.getEngine().onVRRequestPresentComplete.addOnce(function(t){e.onAfterEnteringVRObservable.notifyObservers({success:t})}),this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().enterFullscreen(this.requestPointerLockOnFullScreen),this.updateButtonVisibility(),this._vrDeviceOrientationCamera.onViewMatrixChangedObservable.addOnce(function(){e.onAfterEnteringVRObservable.notifyObservers({success:!0})})),this._scene.activeCamera&&this._canvas&&this._scene.activeCamera.attachControl(this._canvas),this._interactionsEnabled&&this._scene.registerBeforeRender(this.beforeRender),this._displayLaserPointer&&[this._leftController,this._rightController].forEach(function(e){e&&e._activatePointer()}),this._hasEnteredVR=!0)},e.prototype.exitVR=function(){if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){m.a.Warn("Error in your custom logic onExitingVR: "+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this.vrDeviceOrientationCamera&&(this.vrDeviceOrientationCamera.angularSensibility=Number.MAX_VALUE),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas),this._cachedAngularSensibility.angularSensibilityX&&(this._deviceOrientationCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._deviceOrientationCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._deviceOrientationCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera,this._cachedAngularSensibility.angularSensibilityX&&(this._existingCamera.angularSensibilityX=this._cachedAngularSensibility.angularSensibilityX,this._cachedAngularSensibility.angularSensibilityX=null),this._cachedAngularSensibility.angularSensibilityY&&(this._existingCamera.angularSensibilityY=this._cachedAngularSensibility.angularSensibilityY,this._cachedAngularSensibility.angularSensibilityY=null),this._cachedAngularSensibility.angularSensibility&&(this._existingCamera.angularSensibility=this._cachedAngularSensibility.angularSensibility,this._cachedAngularSensibility.angularSensibility=null)),this.updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this.beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),[this._leftController,this._rightController].forEach(function(e){e&&e._deactivatePointer()}),this._hasEnteredVR=!1;var e=this._scene.getEngine();e._onVrDisplayPresentChange&&e._onVrDisplayPresentChange()}},Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!0,configurable:!0}),e.prototype.enableInteractions=function(){var e=this;this._interactionsEnabled||(this._interactionsRequested=!0,this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(t){return t.isVisible&&(t.isPickable||t.name===e._floorMeshName)},this.meshSelectionPredicate=function(){return!0},this._raySelectionPredicate=function(t){return!!(e._isTeleportationFloor(t)||-1===t.name.indexOf("gazeTracker")&&-1===t.name.indexOf("teleportationTarget")&&-1===t.name.indexOf("torusTeleportation"))&&e.raySelectionPredicate(t)},this._interactionsEnabled=!0)},Object.defineProperty(e.prototype,"_noControllerIsActive",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!0,configurable:!0}),e.prototype._isTeleportationFloor=function(e){for(var t=0;t-1||this._floorMeshesCollection.push(e))},e.prototype.removeFloorMesh=function(e){if(this._floorMeshesCollection){var t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}},e.prototype.enableTeleportation=function(e){if(void 0===e&&(e={}),!this._teleportationInitialized){this._teleportationRequested=!0,this.enableInteractions(),e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);var t=new Gi.a;t.vignetteColor=new s.b(0,0,0,0),t.vignetteEnabled=!0,this._postProcessMove=new Hi("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,t),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},e.prototype._enableInteractionOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled=!0,this.isInVRMode&&this._displayLaserPointer&&e._activatePointer(),this.webVROptions.laserToggle&&e.webVRController.onMainButtonStateChangedObservable.add(function(i){t._displayLaserPointer&&1===i.value&&(e._activePointer?e._deactivatePointer():e._activatePointer(),t.displayGaze&&(e._gazeTracker.isVisible=e._activePointer))}),e.webVRController.onTriggerStateChangedObservable.add(function(i){var n=e;t._noControllerIsActive&&(n=t._cameraGazer),n._pointerDownOnMeshAsked?i.valuet._padSensibilityUp&&n._selectionPointerDown()}))},e.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.xthis._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},e.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var i=a.b.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),n=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,n=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,a.b.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),a.e.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var r=new jt.a(n,this._workingVector),o=this._scene.pickWithRay(r,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},e.prototype._enableTeleportationOnController=function(e){var t=this;e.webVRController.mesh&&(e._interactionsEnabled||this._enableInteractionOnController(e),e._interactionsEnabled=!0,e._teleportationEnabled=!0,e.webVRController.controllerType===Vt.VIVE&&(e._dpadPressed=!1,e.webVRController.onPadStateChangedObservable.add(function(t){e._dpadPressed=t.pressed,e._dpadPressed||(e._rotationLeftAsked=!1,e._rotationRightAsked=!1,e._teleportationBackRequestInitiated=!1)})),e.webVRController.onPadValuesChangedObservable.add(function(i){t.teleportationEnabled&&(t._checkTeleportBackwards(i,e),t._checkTeleportWithRay(i,e)),t._checkRotate(i,e)}))},e.prototype._createTeleportationCircles=function(){this._teleportationTarget=Se.a.CreateGround("teleportationTarget",2,2,2,this._scene),this._teleportationTarget.isPickable=!1;var e=new ji("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var i=new zi.a("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var n=Se.a.CreateTorus("torusTeleportation",.75,.1,25,this._scene,!1);n.isPickable=!1,n.parent=this._teleportationTarget;var r=new k("animationInnerCircle","position.y",30,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),r.setKeys(o);var a=new Ee;a.setEasingMode(he.EASINGMODE_EASEINOUT),r.setEasingFunction(a),n.animations=[],n.animations.push(r),this._scene.beginAnimation(n,0,60,!0),this._hideTeleportationTarget()},e.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},e.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},e.prototype._rotateCamera=function(e){var t=this;if(this.currentVRCamera instanceof Dt){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var i=a.b.FromRotationMatrix(a.a.RotationY(Math.PI/4*this._rotationAngle)),n=new k("animationRotation","rotationQuaternion",90,k.ANIMATIONTYPE_QUATERNION,k.ANIMATIONLOOPMODE_CONSTANT),r=[];r.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),r.push({frame:6,value:i}),n.setKeys(r),n.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(n),this._postProcessMove.animations=[];var o=new k("animationPP","vignetteWeight",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:3,value:4}),s.push({frame:6,value:0}),o.setKeys(s),o.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(o);var c=new k("animationPP2","vignetteStretch",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:3,value:10}),l.push({frame:6,value:0}),c.setKeys(l),c.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(c),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,function(){t._webVRCamera.detachPostProcess(t._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}},e.prototype._moveTeleportationSelectorTo=function(e,t,i){if(e.pickedPoint){t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint));var n=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i);if(n){var r=a.e.Cross(Z.a.Y,n),o=a.e.Cross(n,r);a.e.RotationFromAxisToRef(o,n,r,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}},e.prototype.teleportCamera=function(e){var t=this;if(this.currentVRCamera instanceof Dt){this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),e.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(e),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this.currentVRCamera.animations=[];var i=new k("animationCameraTeleportation","position",90,k.ANIMATIONTYPE_VECTOR3,k.ANIMATIONLOOPMODE_CONSTANT),n=[{frame:0,value:this.currentVRCamera.position},{frame:11,value:this._workingVector}];i.setKeys(n),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[];var r=new k("animationPP","vignetteWeight",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),o=[];o.push({frame:0,value:0}),o.push({frame:5,value:8}),o.push({frame:11,value:0}),r.setKeys(o),this._postProcessMove.animations.push(r);var a=new k("animationPP2","vignetteStretch",90,k.ANIMATIONTYPE_FLOAT,k.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:5,value:10}),s.push({frame:11,value:0}),a.setKeys(s),this._postProcessMove.animations.push(a),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,11,!1,1,function(){t._webVRCamera.detachPostProcess(t._postProcessMove)}),this._scene.beginAnimation(this.currentVRCamera,0,11,!1,1,function(){t.onAfterCameraTeleport.notifyObservers(t._workingVector)}),this._hideTeleportationTarget()}},e.prototype._convertNormalToDirectionOfRay=function(e,t){e&&(Math.acos(a.e.Dot(e,t.direction))e;){var i=this.rigCameras.pop();i&&i.dispose()}},t.prototype._updateForDualEyeDebugging=function(e){void 0===e&&(e=.01),this._updateNumberOfRigCameras(2),this.rigCameras[0].viewport=new wi.a(0,0,.5,1),this.rigCameras[0].position.x=-e/2,this.rigCameras[0].outputRenderTarget=null,this.rigCameras[1].viewport=new wi.a(.5,0,.5,1),this.rigCameras[1].position.x=e/2,this.rigCameras[1].outputRenderTarget=null},t.prototype.updateFromXRSessionManager=function(e){var i=this;if(!e.currentFrame||!e.currentFrame.getViewerPose)return!1;var n=e.currentFrame.getViewerPose(e.referenceSpace);return!!(n&&n.transform&&n.transform.matrix)&&(a.a.FromFloat32ArrayToRefScaled(n.transform.matrix,0,1,t._TmpMatrix),this._scene.useRightHandedSystem||t._TmpMatrix.toggleModelMatrixHandInPlace(),t._TmpMatrix.getTranslationToRef(this.position),t._TmpMatrix.getRotationMatrixToRef(t._TmpMatrix),a.b.FromRotationMatrixToRef(t._TmpMatrix,this.rotationQuaternion),this.computeWorldMatrix(),this._updateNumberOfRigCameras(n.views.length),n.views.forEach(function(t,n){if(a.a.FromFloat32ArrayToRefScaled(t.transform.matrix,0,1,i.rigCameras[n]._computedViewMatrix),a.a.FromFloat32ArrayToRefScaled(t.projectionMatrix,0,1,i.rigCameras[n]._projectionMatrix),i._scene.useRightHandedSystem||(i.rigCameras[n]._computedViewMatrix.toggleModelMatrixHandInPlace(),i.rigCameras[n]._projectionMatrix.toggleProjectionMatrixHandInPlace()),e.session.renderState.baseLayer){var r=e.session.renderState.baseLayer.getViewport(t),o=e.session.renderState.baseLayer.framebufferWidth,s=e.session.renderState.baseLayer.framebufferHeight;i.rigCameras[n].viewport.width=r.width/o,i.rigCameras[n].viewport.height=r.height/s,i.rigCameras[n].viewport.x=r.x/o,i.rigCameras[n].viewport.y=r.y/s}i.rigCameras[n].outputRenderTarget=e._sessionRenderTargetTexture}),!0)},t._TmpMatrix=new a.a,t}(Dt),an=function(){function e(e){this.scene=e,this.onXRFrameObservable=new o.c,this.onXRSessionEnded=new o.c,this._sessionRenderTargetTexture=null,this.baseLayer=null}return e.prototype.initializeAsync=function(){return m.a.Warn("The WebXR APIs are still under development and are subject to change in the future."),this._xrNavigator=navigator,this._xrNavigator.xr?Promise.resolve():Promise.reject("webXR not supported by this browser")},e.prototype.initializeSessionAsync=function(e){var t=this;return this._xrNavigator.xr.requestSession(e).then(function(e){t.session=e,t.session.addEventListener("end",function(){t._sessionRenderTargetTexture=null,t.scene.getEngine().restoreDefaultFramebuffer(),t.scene.getEngine().customAnimationFrameRequester=null,t.onXRSessionEnded.notifyObservers(null),t.scene.getEngine()._renderLoop()},{once:!0})})},e.prototype.setReferenceSpaceAsync=function(e){var t=this;return this.session.requestReferenceSpace(e).then(function(e){t.referenceSpace=e})},e.prototype.updateRenderStateAsync=function(e){return e.baseLayer&&(this.baseLayer=e.baseLayer),this.session.updateRenderState(e)},e.prototype.startRenderingToXRAsync=function(){var t=this;return this.scene.getEngine().customAnimationFrameRequester={requestAnimationFrame:this.session.requestAnimationFrame.bind(this.session),renderFunction:function(e,i){t.currentFrame=i,t.onXRFrameObservable.notifyObservers(null),t.scene.getEngine()._renderLoop()}},this._sessionRenderTargetTexture=e._CreateRenderTargetTextureFromSession(this.session,this.scene,this.baseLayer),window.cancelAnimationFrame(this.scene.getEngine()._frameHandler),this.scene.getEngine()._renderLoop(),Promise.resolve()},e.prototype.exitXRAsync=function(){return this.session&&this.session.end(),new Promise(function(){})},e.prototype.supportsSessionAsync=function(e){return navigator.xr&&navigator.xr.supportsSession?navigator.xr.supportsSession(e).then(function(){return Promise.resolve(!0)}).catch(function(e){return m.a.Warn(e),Promise.resolve(!1)}):Promise.resolve(!1)},e._CreateRenderTargetTextureFromSession=function(e,t,i){if(!i)throw"no layer";var n=new et.a(t.getEngine(),et.a.DATASOURCE_UNKNOWN,!0);n.width=i.framebufferWidth,n.height=i.framebufferHeight,n._framebuffer=i.framebuffer;var r=new Oi("XR renderTargetTexture",{width:n.width,height:n.height},t,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,!0);return r._texture=n,r},e.prototype.dispose=function(){this.onXRFrameObservable.clear(),this.onXRSessionEnded.clear()},e}();!function(e){e[e.ENTERING_XR=0]="ENTERING_XR",e[e.EXITING_XR=1]="EXITING_XR",e[e.IN_XR=2]="IN_XR",e[e.NOT_IN_XR=3]="NOT_IN_XR"}(qi||(qi={}));var sn=function(){function e(e){var t=this;this.scene=e,this.state=qi.NOT_IN_XR,this.onStateChangedObservable=new o.c,this._nonVRCamera=null,this._originalSceneAutoClear=!0,this._supported=!1,this.camera=new on("",e),this.sessionManager=new an(e),this.container=new Ye.a("WebXR Container",e),this.camera.parent=this.container,e.onDisposeObservable.add(function(){t.exitXRAsync()})}return e.prototype._setState=function(e){this.state=e,this.onStateChangedObservable.notifyObservers(this.state)},e.CreateAsync=function(t){var i=new e(t);return i.sessionManager.initializeAsync().then(function(){return i._supported=!0,i}).catch(function(){return i})},e.prototype.exitXRAsync=function(){return this._setState(qi.EXITING_XR),this.sessionManager.exitXRAsync()},e.prototype.enterXRAsync=function(e,t,i){var n=this;if(!this._supported)throw"XR session not supported by this browser";return this._setState(qi.ENTERING_XR),this.sessionManager.initializeSessionAsync(e).then(function(){return n.sessionManager.setReferenceSpaceAsync(t)}).then(function(){return i.initializeXRLayerAsync(n.sessionManager.session)}).then(function(){return n.sessionManager.updateRenderStateAsync({depthFar:n.camera.maxZ,depthNear:n.camera.minZ,baseLayer:i.xrLayer})}).then(function(){return n.sessionManager.startRenderingToXRAsync()}).then(function(){n._originalSceneAutoClear=n.scene.autoClear,n._nonVRCamera=n.scene.activeCamera,n.scene.autoClear=!1,n.scene.activeCamera=n.camera,n.sessionManager.onXRFrameObservable.add(function(){n.camera.updateFromXRSessionManager(n.sessionManager)}),n.sessionManager.onXRSessionEnded.addOnce(function(){n.camera.rigCameras.forEach(function(e){e.outputRenderTarget=null}),n.scene.autoClear=n._originalSceneAutoClear,n.scene.activeCamera=n._nonVRCamera,n._setState(qi.NOT_IN_XR)}),n.sessionManager.onXRFrameObservable.addOnce(function(){n._setState(qi.IN_XR)})}).catch(function(e){console.log(e),console.log(e.message)})},e.prototype.setPositionOfCameraUsingContainer=function(t){this.camera.globalPosition.subtractToRef(t,e._TmpVector),this.container.position.subtractInPlace(e._TmpVector)},e.prototype.rotateCameraByQuaternionUsingContainer=function(e){this.container.rotationQuaternion||(this.container.rotationQuaternion=a.b.FromEulerVector(this.container.rotation)),this.container.rotationQuaternion.multiplyInPlace(e),this.container.position.rotateByQuaternionAroundPointToRef(e,this.camera.globalPosition,this.container.position)},e.prototype.dispose=function(){this.camera.dispose(),this.container.dispose(),this.onStateChangedObservable.clear(),this.sessionManager.dispose()},e._TmpVector=new a.e,e}(),cn=function(){function e(e,t,i){this.element=e,this.sessionMode=t,this.referenceSpaceType=i}return e.prototype.update=function(e){},e}(),ln=function(){},un=function(){function e(e,t){var i=this;if(this.scene=e,this._buttons=[],this._activeButton=null,this.activeButtonChangedObservable=new o.c,this._overlay=document.createElement("div"),this._overlay.style.cssText="z-index:11;position: absolute; right: 20px;bottom: 50px;",t.customButtons)this._buttons=t.customButtons;else{var n=document.createElement("button");n.style.cssText="color: #868686; border-color: #868686; border-style: solid; margin-left: 10px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-repeat:no-repeat; background-position: center; outline: none;",n.innerText="HMD",this._buttons.push(new cn(n,"immersive-vr","local-floor")),this._buttons[this._buttons.length-1].update=function(e){this.element.style.display=null===e||e===this?"":"none",this.element.innerText=e===this?"EXIT":"HMD"},this._updateButtons(null)}var r=e.getEngine().getRenderingCanvas();r&&r.parentNode&&(r.parentNode.appendChild(this._overlay),e.onDisposeObservable.addOnce(function(){i.dispose()}))}return e.CreateAsync=function(t,i,n){var r=this,o=new e(t,n),a=o._buttons.map(function(e){return i.sessionManager.supportsSessionAsync(e.sessionMode)});return i.onStateChangedObservable.add(function(e){e==qi.NOT_IN_XR&&o._updateButtons(null)}),Promise.all(a).then(function(e){return e.forEach(function(e,t){e&&(o._overlay.appendChild(o._buttons[t].element),o._buttons[t].element.onclick=function(){return h.b(r,void 0,void 0,function(){return h.e(this,function(e){switch(e.label){case 0:return i.state!=qi.IN_XR?[3,2]:(o._updateButtons(null),[4,i.exitXRAsync()]);case 1:return e.sent(),[2];case 2:return i.state!=qi.NOT_IN_XR?[3,4]:(o._updateButtons(o._buttons[t]),n.webXRManagedOutputCanvas?[4,i.enterXRAsync(o._buttons[t].sessionMode,o._buttons[t].referenceSpaceType,n.webXRManagedOutputCanvas)]:[3,4]);case 3:e.sent(),e.label=4;case 4:return[2]}})})})}),o})},e.prototype._updateButtons=function(e){var t=this;this._activeButton=e,this._buttons.forEach(function(e){e.update(t._activeButton)}),this.activeButtonChangedObservable.notifyObservers(this._activeButton)},e.prototype.dispose=function(){var e=this.scene.getEngine().getRenderingCanvas();e&&e.parentNode&&e.parentNode.contains(this._overlay)&&e.parentNode.removeChild(this._overlay),this.activeButtonChangedObservable.clear()},e}(),hn=function(){function e(e,t,i){void 0===i&&(i=null),this.scene=e,this.inputSource=t,this.parentContainer=i,this.onDisposeObservable=new o.c,this._tmpMatrix=new a.a,this._tmpQuaternion=new a.b,this._tmpVector=new a.e,this.pointer=new Ye.a("controllerPointer",e),i&&i.addChild(this.pointer),this.inputSource.gripSpace&&(this.grip=new Ye.a("controllerGrip",this.scene),this.parentContainer&&this.parentContainer.addChild(this.grip))}return e.prototype.updateFromXRFrame=function(e,t){var i=e.getPose(this.inputSource.targetRaySpace,t);if(i&&(a.a.FromFloat32ArrayToRefScaled(i.transform.matrix,0,1,this._tmpMatrix),this.pointer.getScene().useRightHandedSystem||this._tmpMatrix.toggleModelMatrixHandInPlace(),this.pointer.rotationQuaternion||(this.pointer.rotationQuaternion=new a.b),this._tmpMatrix.decompose(this.pointer.scaling,this.pointer.rotationQuaternion,this.pointer.position)),this.inputSource.gripSpace&&this.grip){var n=e.getPose(this.inputSource.gripSpace,t);n&&(a.a.FromFloat32ArrayToRefScaled(n.transform.matrix,0,1,this._tmpMatrix),this.grip.getScene().useRightHandedSystem||this._tmpMatrix.toggleModelMatrixHandInPlace(),this.grip.rotationQuaternion||(this.grip.rotationQuaternion=new a.b),this._tmpMatrix.decompose(this.grip.scaling,this.grip.rotationQuaternion,this.grip.position))}},e.prototype.getWorldPointerRayToRef=function(e){this.pointer.computeWorldMatrix(!0).decompose(void 0,this._tmpQuaternion,void 0),this._tmpVector.set(0,0,1),this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion,this._tmpVector),e.origin=this.pointer.absolutePosition,e.direction.copyFrom(this._tmpVector),e.length=1e3},e.prototype.dispose=function(){this.grip&&this.grip.dispose(),this.pointer.dispose(),this.onDisposeObservable.notifyObservers({})},e}(),dn=function(){function e(e){var t=this;this.baseExperience=e,this.controllers=[],this.onControllerAddedObservable=new o.c,this.onControllerRemovedObservable=new o.c,this._onInputSourcesChange=function(e){t._addAndRemoveControllers(e.added,e.removed)},this._stateObserver=e.onStateChangedObservable.add(function(e){e===qi.NOT_IN_XR&&t._addAndRemoveControllers([],t.controllers.map(function(e){return e.inputSource}))}),this._frameObserver=e.sessionManager.onXRFrameObservable.add(function(){e.sessionManager.currentFrame&&(0==t.controllers.length&&e.sessionManager.session.inputSources&&(t._addAndRemoveControllers(e.sessionManager.session.inputSources,[]),e.sessionManager.session.addEventListener("inputsourceschange",t._onInputSourcesChange)),t.controllers.forEach(function(t){t.updateFromXRFrame(e.sessionManager.currentFrame,e.sessionManager.referenceSpace)}))})}return e.prototype._addAndRemoveControllers=function(e,t){for(var i=this,n=this.controllers.map(function(e){return e.inputSource}),r=0,o=e;r.7)s=!0;else{if(s){var h,d=e.baseExperience.camera.computeWorldMatrix(),f=new a.b;d.decompose(void 0,f,i._tmpRay.origin),i._tmpVector.set(0,0,-1),i._tmpVector.rotateByQuaternionToRef(f,i._tmpVector),i._tmpVector.y=0,i._tmpVector.normalize(),i._tmpVector.y=-1.5,i._tmpVector.normalize(),i._tmpRay.direction.copyFrom(i._tmpVector),(h=r.pickWithRay(i._tmpRay,function(e){return-1!==t.indexOf(e)}))&&h.pickedPoint&&(i._tmpVector.copyFrom(h.pickedPoint),i._tmpVector.y+=e.baseExperience.camera.position.y,e.baseExperience.setPositionOfCameraUsingContainer(i._tmpVector))}s=!1}void 0!==n.inputSource.gamepad.axes[0]&&(n.inputSource.gamepad.axes[0]<-.7?c=!0:(c&&e.baseExperience.rotateCameraByQuaternionUsingContainer(a.b.FromEulerAngles(0,-Math.PI/4,0)),c=!1),n.inputSource.gamepad.axes[0]>.7?l=!0:(l&&e.baseExperience.rotateCameraByQuaternionUsingContainer(a.b.FromEulerAngles(0,Math.PI/4,0)),l=!1))}});n.onDisposeObservable.addOnce(function(){u.dispose(),h.dispose(),f.dispose(),p.dispose(),r.onBeforeRenderObservable.remove(v)})})},pn=function(){function e(t){var i=this;this._tmpRay=new jt.a(new a.e,new a.e),t.onControllerAddedObservable.add(function(t){var n,r,o,c=t.pointer.getScene(),l=!1;o=e._idCounter++,(n=Se.a.CreateCylinder("laserPointer",1,2e-4,.004,20,1,c,!1)).parent=t.pointer;var u=new zi.a("laserPointerMat",c);u.emissiveColor=new s.a(.7,.7,.7),u.alpha=.6,n.material=u,n.rotation.x=Math.PI/2,i._updatePointerDistance(n,1),n.isPickable=!1,(r=Se.a.CreateTorus("gazeTracker",.0105,.0075,20,c,!1)).bakeCurrentTransformIntoVertices(),r.isPickable=!1,r.isVisible=!1;var h=new zi.a("targetMat",c);h.specularColor=s.a.Black(),h.emissiveColor=new s.a(.7,.7,.7),h.backFaceCulling=!1,r.material=h;var d=c.onBeforeRenderObservable.add(function(){t.getWorldPointerRayToRef(i._tmpRay);var e=c.pickWithRay(i._tmpRay);if(e&&(t.inputSource.gamepad&&t.inputSource.gamepad.buttons[0]&&t.inputSource.gamepad.buttons[0].value>.7?(l||c.simulatePointerDown(e,{pointerId:o}),l=!0):(l&&c.simulatePointerUp(e,{pointerId:o}),l=!1),c.simulatePointerMove(e,{pointerId:o})),e&&e.pickedPoint&&e.hit){i._updatePointerDistance(n,e.distance),r.position.copyFrom(e.pickedPoint),r.scaling.x=Math.sqrt(e.distance),r.scaling.y=Math.sqrt(e.distance),r.scaling.z=Math.sqrt(e.distance);var s=i._convertNormalToDirectionOfRay(e.getNormal(),i._tmpRay);if(r.position.copyFrom(e.pickedPoint),s){var u=a.e.Cross(Z.a.Y,s),h=a.e.Cross(s,u);a.e.RotationFromAxisToRef(h,s,u,r.rotation),r.position.addInPlace(s.scale(.002))}r.isVisible=!0}else r.isVisible=!1});t.onDisposeObservable.addOnce(function(){n.dispose(),r.dispose(),c.onBeforeRenderObservable.remove(d)})})}return e.prototype._convertNormalToDirectionOfRay=function(e,t){e&&(Math.acos(a.e.Dot(e,t.direction))s){var c=s;s=a,a=c}return a>0&&a0&&s=0))},e.prototype._canDoCollision=function(e,t,i,n){var r=a.e.Distance(this._basePointWorld,e),o=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(r>this._velocityWorldLength+o+t)&&!!function(e,t,i,n){return!(e.x>i.x+n||i.x-n>t.x||e.y>i.y+n||i.y-n>t.y||e.z>i.z+n||i.z-n>t.z)}(i,n,this._basePointWorld,this._velocityWorldLength+o)},e.prototype._testTriangle=function(e,t,i,n,r,o,s){var c,l=!1;t||(t=[]),t[e]||(t[e]=new xn.a(0,0,0,0),t[e].copyFromPoints(i,n,r));var u=t[e];if(o||u.isFrontFacingTo(this._normalizedVelocity,0)){var h=u.signedDistanceTo(this._basePoint),d=a.e.Dot(u.normal,this._velocity);if(0==d){if(Math.abs(h)>=1)return;l=!0,c=0}else{var f=(1-h)/d;if((c=(-1-h)/d)>f){var p=f;f=c,c=p}if(c>1||f<0)return;c<0&&(c=0),c>1&&(c=1)}this._collisionPoint.copyFromFloats(0,0,0);var _=!1,m=1;if(l||(this._basePoint.subtractToRef(u.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(c,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,n,r,u.normal)&&(_=!0,m=c,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!_){var g=this._velocity.lengthSquared(),v=g;this._basePoint.subtractToRef(i,this._tempVector);var y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,T=Cn(v,y,b,m);T.found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(n,this._tempVector),y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(T=Cn(v,y,b,m)).found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(n)),this._basePoint.subtractToRef(r,this._tempVector),y=2*a.e.Dot(this._velocity,this._tempVector),b=this._tempVector.lengthSquared()-1,(T=Cn(v,y,b,m)).found&&(m=T.root,_=!0,this._collisionPoint.copyFrom(r)),n.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex);var E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex);if(v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found){var S=(A*T.root-P)/E;S>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),i.addToRef(this._edge,this._collisionPoint))}r.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex),v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found&&(S=(A*T.root-P)/E)>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),n.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),E=this._edge.lengthSquared(),A=a.e.Dot(this._edge,this._velocity),P=a.e.Dot(this._edge,this._baseToVertex),v=E*-g+A*A,y=E*(2*a.e.Dot(this._velocity,this._baseToVertex))-2*A*P,b=E*(1-this._baseToVertex.lengthSquared())+P*P,(T=Cn(v,y,b,m)).found&&(S=(A*T.root-P)/E)>=0&&S<=1&&(m=T.root,_=!0,this._edge.scaleInPlace(S),r.addToRef(this._edge,this._collisionPoint))}if(_){var R=m*this._velocity.length();(!this.collisionFound||R=n)r.copyFrom(e);else{var s=o?o.collisionMask:i.collisionMask;i._initialize(e,t,a);for(var c=0;cthis.capacity&&this._depth-1&&this.entries.splice(i,1)}},e.prototype.addEntries=function(e){for(var t=0;te.occlusionRetryCount))return!1;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==Ye.a.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var n=this.getScene();if(n.getBoundingBoxRenderer){var r=n.getBoundingBoxRenderer();this._occlusionQuery||(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery),r.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0}return e.isOccluded};Ce.b.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},Ce.b.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},Ce.b.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},Ce.b.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},Ce.b.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},Ce.b.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},Ce.b.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e?e.underlyingResource:null)};var Wn=i(122),Hn=i(123),Xn=function(){function e(){}return e.COPY=1,e.CUT=2,e.PASTE=3,e}(),Yn=function(){function e(e,t){this.type=e,this.event=t}return e.GetTypeFromCharacter=function(e){switch(e){case 67:return Xn.COPY;case 86:return Xn.PASTE;case 88:return Xn.CUT;default:return-1}},e}(),Kn=function(e){function t(t){var i=e.call(this,t)||this;return i.controllerType=Vt.DAYDREAM,i}return h.d(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;vn.ImportMesh("",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,function(e){n._defaultModel=e[1],n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)})},t.prototype._handleButtonChange=function(e,t,i){if(0===e){var n=this.onTriggerStateChangedObservable;n&&n.notifyObservers(t)}else m.a.Warn("Unrecognized Daydream button index: "+e)},t.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",t.MODEL_FILENAME="generic.babylon",t.GAMEPAD_ID_PREFIX="Daydream",t}(ki);Xt._ControllerFactories.push({canCreate:function(e){return 0===e.id.indexOf(Kn.GAMEPAD_ID_PREFIX)},create:function(e){return new Kn(e)}});var Qn=function(e){function t(t){var i=e.call(this,t)||this;return i._buttonIndexToObservableNameMap=["onPadStateChangedObservable","onTriggerStateChangedObservable"],i.controllerType=Vt.GEAR_VR,i._calculatedPosition=new a.e("left"==i.hand?-.15:.15,-.5,.25),i._disableTrackPosition(i._calculatedPosition),i}return h.d(t,e),t.prototype.initControllerMesh=function(e,i){var n=this;vn.ImportMesh("",t.MODEL_BASE_URL,t.MODEL_FILENAME,e,function(t){var r=new Se.a("",e);t[1].parent=r,t[1].position.z=-.15,n._defaultModel=r,n.attachToMesh(n._defaultModel),i&&i(n._defaultModel)})},t.prototype._handleButtonChange=function(e,t,i){if(ec.snapDistance?(r=Math.floor(Math.abs(h)/c.snapDistance),h<0&&(r*=-1),h%=c.snapDistance,d.scaleToRef(c.snapDistance*r,d),n=!0):d.scaleInPlace(0)),c.attachedMesh.scaling.addInPlace(d),n&&(f.snapDistance=c.snapDistance*r,c.onSnapObservable.notifyObservers(f))}}),c._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!c._customMeshSet){var t=e.pickInfo&&-1!=c._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?c._hoverMaterial:c._coloredMaterial;c._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var p=n._getSharedGizmoLight();return p.includedOnlyMeshes=p.includedOnlyMeshes.concat(c._rootMesh.getChildMeshes()),c}return h.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),this._arrow&&this._arrow.dispose(),[this._coloredMaterial,this._hoverMaterial].forEach(function(e){e&&e.dispose()}),e.prototype.dispose.call(this)},t.prototype.setCustomMesh=function(t,i){var n=this;void 0===i&&(i=!1),e.prototype.setCustomMesh.call(this,t),i&&(this._rootMesh.getChildMeshes().forEach(function(e){e.material=n._coloredMaterial,e.color&&(e.color=n._coloredMaterial.diffuseColor)}),this._customMeshSet=!1)},t}(Jn.a),tr=i(48),ir=i(45),nr=function(e){function t(t,i){void 0===t&&(t=s.a.Gray()),void 0===i&&(i=$n.a.DefaultKeepDepthUtilityLayer);var n=e.call(this,i)||this;n._boundingDimensions=new a.e(1,1,1),n._renderObserver=null,n._pointerObserver=null,n._scaleDragSpeed=.2,n._tmpQuaternion=new a.b,n._tmpVector=new a.e(0,0,0),n._tmpRotationMatrix=new a.a,n.ignoreChildren=!1,n.includeChildPredicate=null,n.rotationSphereSize=.1,n.scaleBoxSize=.1,n.fixedDragMeshScreenSize=!1,n.fixedDragMeshScreenSizeDistanceFactor=10,n.onDragStartObservable=new o.c,n.onScaleBoxDragObservable=new o.c,n.onScaleBoxDragEndObservable=new o.c,n.onRotationSphereDragObservable=new o.c,n.onRotationSphereDragEndObservable=new o.c,n.scalePivot=null,n._existingMeshScale=new a.e,n._dragMesh=null,n.pointerDragBehavior=new He.a,n.updateScale=!1,n._anchorMesh=new Ye.a("anchor",i.utilityLayerScene),n.coloredMaterial=new zi.a("",i.utilityLayerScene),n.coloredMaterial.disableLighting=!0,n.hoverColoredMaterial=new zi.a("",i.utilityLayerScene),n.hoverColoredMaterial.disableLighting=!0,n._lineBoundingBox=new Ye.a("",i.utilityLayerScene),n._lineBoundingBox.rotationQuaternion=new a.b;var r=[];r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(n._boundingDimensions.x,0,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,0),new a.e(0,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,0,0),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,0,0),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,n._boundingDimensions.y,0),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,n._boundingDimensions.y,0),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(0,0,n._boundingDimensions.z),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(0,n._boundingDimensions.y,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,0,n._boundingDimensions.z)]},i.utilityLayerScene)),r.push(ir.a.CreateLines("lines",{points:[new a.e(n._boundingDimensions.x,n._boundingDimensions.y,n._boundingDimensions.z),new a.e(n._boundingDimensions.x,n._boundingDimensions.y,0)]},i.utilityLayerScene)),r.forEach(function(e){e.color=t,e.position.addInPlace(new a.e(-n._boundingDimensions.x/2,-n._boundingDimensions.y/2,-n._boundingDimensions.z/2)),e.isPickable=!1,n._lineBoundingBox.addChild(e)}),n._rootMesh.addChild(n._lineBoundingBox),n.setColor(t),n._rotateSpheresParent=new Ye.a("",i.utilityLayerScene),n._rotateSpheresParent.rotationQuaternion=new a.b;for(var c=function(e){var t=tr.a.CreateSphere("",{diameter:1},i.utilityLayerScene);t.rotationQuaternion=new a.b,t.material=l.coloredMaterial,(f=new He.a({})).moveAttached=!1,f.updateDragPlane=!1,t.addBehavior(f);var r=new a.e(1,0,0),o=0;f.onDragStartObservable.add(function(){r.copyFrom(t.forward),o=0}),f.onDragObservable.add(function(t){if(n.onRotationSphereDragObservable.notifyObservers({}),n.attachedMesh){var i=n.attachedMesh.parent;if(i&&i.scaling&&i.scaling.isNonUniformWithinEpsilon(.001))return void m.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Qe.a._RemoveAndStorePivotPoint(n.attachedMesh);var s=r,c=t.dragPlaneNormal.scale(a.e.Dot(t.dragPlaneNormal,s)),l=s.subtract(c).normalizeToNew(),u=a.e.Dot(l,t.delta)<0?Math.abs(t.delta.length()):-Math.abs(t.delta.length());u=u/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),n.attachedMesh.rotationQuaternion||(n.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(n.attachedMesh.rotation.y,n.attachedMesh.rotation.x,n.attachedMesh.rotation.z)),n._anchorMesh.rotationQuaternion||(n._anchorMesh.rotationQuaternion=a.b.RotationYawPitchRoll(n._anchorMesh.rotation.y,n._anchorMesh.rotation.x,n._anchorMesh.rotation.z)),o+=u,Math.abs(o)<=2*Math.PI&&(e>=8?a.b.RotationYawPitchRollToRef(0,0,u,n._tmpQuaternion):e>=4?a.b.RotationYawPitchRollToRef(u,0,0,n._tmpQuaternion):a.b.RotationYawPitchRollToRef(0,u,0,n._tmpQuaternion),n._anchorMesh.addChild(n.attachedMesh),n._anchorMesh.rotationQuaternion.multiplyToRef(n._tmpQuaternion,n._anchorMesh.rotationQuaternion),n._anchorMesh.removeChild(n.attachedMesh),n.attachedMesh.setParent(i)),n.updateBoundingBox(),Qe.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),f.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(t)}),f.onDragEndObservable.add(function(){n.onRotationSphereDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),l._rotateSpheresParent.addChild(t)},l=this,u=0;u<12;u++)c(u);n._rootMesh.addChild(n._rotateSpheresParent),n._scaleBoxesParent=new Ye.a("",i.utilityLayerScene),n._scaleBoxesParent.rotationQuaternion=new a.b;for(var h=0;h<2;h++)for(var d=0;d<2;d++)for(var f,p=function(){var e=Zn.a.CreateBox("",{size:1},i.utilityLayerScene);e.material=_.coloredMaterial;var t=new a.e(0==h?-1:1,0==d?-1:1,0==g?-1:1);(f=new He.a({dragAxis:t})).moveAttached=!1,e.addBehavior(f),f.onDragObservable.add(function(t){if(n.onScaleBoxDragObservable.notifyObservers({}),n.attachedMesh){var i=n.attachedMesh.parent;if(i&&i.scaling&&i.scaling.isNonUniformWithinEpsilon(.001))return void m.a.Warn("BoundingBoxGizmo controls are not supported on child meshes with non-uniform parent scaling");Qe.a._RemoveAndStorePivotPoint(n.attachedMesh);var r=t.dragDistance/n._boundingDimensions.length()*n._anchorMesh.scaling.length(),o=new a.e(r,r,r);o.scaleInPlace(n._scaleDragSpeed),n.updateBoundingBox(),n.scalePivot?(n.attachedMesh.getWorldMatrix().getRotationMatrixToRef(n._tmpRotationMatrix),n._boundingDimensions.scaleToRef(.5,n._tmpVector),a.e.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector),n._boundingDimensions.multiplyToRef(n.scalePivot,n._tmpVector),a.e.TransformCoordinatesToRef(n._tmpVector,n._tmpRotationMatrix,n._tmpVector),n._anchorMesh.position.addInPlace(n._tmpVector)):(e.absolutePosition.subtractToRef(n._anchorMesh.position,n._tmpVector),n._anchorMesh.position.subtractInPlace(n._tmpVector)),n._anchorMesh.addChild(n.attachedMesh),n._anchorMesh.scaling.addInPlace(o),(n._anchorMesh.scaling.x<0||n._anchorMesh.scaling.y<0||n._anchorMesh.scaling.z<0)&&n._anchorMesh.scaling.subtractInPlace(o),n._anchorMesh.removeChild(n.attachedMesh),n.attachedMesh.setParent(i),Qe.a._RestorePivotPoint(n.attachedMesh)}n._updateDummy()}),f.onDragStartObservable.add(function(){n.onDragStartObservable.notifyObservers({}),n._selectNode(e)}),f.onDragEndObservable.add(function(){n.onScaleBoxDragEndObservable.notifyObservers({}),n._selectNode(null),n._updateDummy()}),_._scaleBoxesParent.addChild(e)},_=this,g=0;g<2;g++)p();n._rootMesh.addChild(n._scaleBoxesParent);var v=new Array;return n._pointerObserver=i.utilityLayerScene.onPointerObservable.add(function(e){v[e.event.pointerId]?e.pickInfo&&e.pickInfo.pickedMesh!=v[e.event.pointerId]&&(v[e.event.pointerId].material=n.coloredMaterial,delete v[e.event.pointerId]):n._rotateSpheresParent.getChildMeshes().concat(n._scaleBoxesParent.getChildMeshes()).forEach(function(t){e.pickInfo&&e.pickInfo.pickedMesh==t&&(v[e.event.pointerId]=t,t.material=n.hoverColoredMaterial)})}),n._renderObserver=n.gizmoLayer.originalScene.onBeforeRenderObservable.add(function(){n.attachedMesh&&!n._existingMeshScale.equals(n.attachedMesh.scaling)?n.updateBoundingBox():n.fixedDragMeshScreenSize&&(n._updateRotationSpheres(),n._updateScaleBoxes()),n._dragMesh&&n.attachedMesh&&n.pointerDragBehavior.dragging&&(n._lineBoundingBox.position.rotateByQuaternionToRef(n._rootMesh.rotationQuaternion,n._tmpVector),n.attachedMesh.setAbsolutePosition(n._dragMesh.position.add(n._tmpVector.scale(-1))))}),n.updateBoundingBox(),n}return h.d(t,e),t.prototype.setColor=function(e){this.coloredMaterial.emissiveColor=e,this.hoverColoredMaterial.emissiveColor=e.clone().add(new s.a(.3,.3,.3)),this._lineBoundingBox.getChildren().forEach(function(t){t.color&&(t.color=e)})},t.prototype._attachedMeshChanged=function(e){var t=this;if(e){Qe.a._RemoveAndStorePivotPoint(e);var i=e.parent;this._anchorMesh.addChild(e),this._anchorMesh.removeChild(e),e.setParent(i),Qe.a._RestorePivotPoint(e),this.updateBoundingBox(),e.getChildMeshes(!1).forEach(function(e){e.markAsDirty("scaling")}),this.gizmoLayer.utilityLayerScene.onAfterRenderObservable.addOnce(function(){t._updateDummy()})}},t.prototype._selectNode=function(e){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach(function(t){t.isVisible=!e||t==e})},t.prototype.updateBoundingBox=function(){if(this.attachedMesh){Qe.a._RemoveAndStorePivotPoint(this.attachedMesh);var e=this.attachedMesh.parent;this.attachedMesh.setParent(null);var t=null;this.attachedMesh.skeleton&&(t=this.attachedMesh.skeleton.overrideMesh,this.attachedMesh.skeleton.overrideMesh=null),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=a.b.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var i=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate);i.max.subtractToRef(i.min,this._boundingDimensions),this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions),this._lineBoundingBox.position.set((i.max.x+i.min.x)/2,(i.max.y+i.min.y)/2,(i.max.z+i.min.z)/2),this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position),this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position),this._lineBoundingBox.computeWorldMatrix(),this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector),this.attachedMesh.setParent(e),this.attachedMesh.skeleton&&(this.attachedMesh.skeleton.overrideMesh=t)}this._updateRotationSpheres(),this._updateScaleBoxes(),this.attachedMesh&&(this._existingMeshScale.copyFrom(this.attachedMesh.scaling),Qe.a._RestorePivotPoint(this.attachedMesh))},t.prototype._updateRotationSpheres=function(){for(var e=this._rotateSpheresParent.getChildMeshes(),t=0;t<3;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r=4*t+2*i+n;if(0==t&&(e[r].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Right()).normalizeToNew().add(e[r].position))),1==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y/2,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Up()).normalizeToNew().add(e[r].position))),2==t&&(e[r].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*n,this._boundingDimensions.z/2),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),e[r].lookAt(a.e.Cross(e[r].position.normalizeToNew(),a.e.Forward()).normalizeToNew().add(e[r].position))),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var o=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(o,o,o)}else e[r].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}},t.prototype._updateScaleBoxes=function(){for(var e=this._scaleBoxesParent.getChildMeshes(),t=0;t<2;t++)for(var i=0;i<2;i++)for(var n=0;n<2;n++){var r=4*t+2*i+n;if(e[r])if(e[r].position.set(this._boundingDimensions.x*t,this._boundingDimensions.y*i,this._boundingDimensions.z*n),e[r].position.addInPlace(new a.e(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize&&this.gizmoLayer.utilityLayerScene.activeCamera){e[r].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var o=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;e[r].scaling.set(o,o,o)}else e[r].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize)}},t.prototype.setEnabledRotationAxis=function(e){this._rotateSpheresParent.getChildMeshes().forEach(function(t,i){i<4?t.setEnabled(-1!=e.indexOf("x")):i<8?t.setEnabled(-1!=e.indexOf("y")):t.setEnabled(-1!=e.indexOf("z"))})},t.prototype.setEnabledScaling=function(e){this._scaleBoxesParent.getChildMeshes().forEach(function(t,i){t.setEnabled(e)})},t.prototype._updateDummy=function(){this._dragMesh&&(this._dragMesh.position.copyFrom(this._lineBoundingBox.getAbsolutePosition()),this._dragMesh.scaling.copyFrom(this._lineBoundingBox.scaling),this._dragMesh.rotationQuaternion.copyFrom(this._rootMesh.rotationQuaternion))},t.prototype.enableDragBehavior=function(){this._dragMesh=Se.a.CreateBox("dummy",1,this.gizmoLayer.utilityLayerScene),this._dragMesh.visibility=0,this._dragMesh.rotationQuaternion=new a.b,this.pointerDragBehavior.useObjectOrienationForDragging=!1,this._dragMesh.addBehavior(this.pointerDragBehavior)},t.prototype.dispose=function(){this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),this._lineBoundingBox.dispose(),this._rotateSpheresParent.dispose(),this._scaleBoxesParent.dispose(),this._dragMesh&&this._dragMesh.dispose(),e.prototype.dispose.call(this)},t.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach(function(e){t(e)})};t(e),e.rotationQuaternion||(e.rotationQuaternion=a.b.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),n=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var r=Zn.a.CreateBox("box",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,r.scaling),0===r.scaling.y&&(r.scaling.y=re.a),0===r.scaling.x&&(r.scaling.x=re.a),0===r.scaling.z&&(r.scaling.z=re.a),r.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(r),e.rotationQuaternion.copyFrom(n),e.position.copyFrom(i),e.removeChild(r),r.addChild(e),r.visibility=0,r},t.prototype.setCustomMesh=function(e){m.a.Error("Custom meshes are not supported on this gizmo")},t}(Jn.a),rr=function(e){function t(t,i,n,r,c,l){void 0===i&&(i=s.a.Gray()),void 0===n&&(n=$n.a.DefaultUtilityLayer),void 0===r&&(r=32),void 0===c&&(c=null),void 0===l&&(l=!1);var u=e.call(this,n)||this;u._pointerObserver=null,u.snapDistance=0,u.onSnapObservable=new o.c,u._isEnabled=!0,u._parent=null,u._parent=c;var h=new zi.a("",n.utilityLayerScene);h.diffuseColor=i,h.specularColor=i.subtract(new s.a(.1,.1,.1));var d=new zi.a("",n.utilityLayerScene);d.diffuseColor=i.add(new s.a(.3,.3,.3));var f=new Ye.a("",n.utilityLayerScene),p=Se.a.CreateTorus("",.6,.03,r,n.utilityLayerScene);p.visibility=0;var _=Se.a.CreateTorus("",.6,.005,r,n.utilityLayerScene);_.material=h,_.rotation.x=Math.PI/2,p.rotation.x=Math.PI/2,f.addChild(_),f.addChild(p),f.lookAt(u._rootMesh.position.add(t)),u._rootMesh.addChild(f),f.scaling.scaleInPlace(1/3),u.dragBehavior=new He.a({dragPlaneNormal:t}),u.dragBehavior.moveAttached=!1,u.dragBehavior.maxDragAngle=9*Math.PI/20,u.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,u._rootMesh.addBehavior(u.dragBehavior);var m=new a.e;u.dragBehavior.onDragStartObservable.add(function(e){u.attachedMesh&&m.copyFrom(e.dragPlanePoint)});var g=new a.a,v=new a.e,y=new a.e,b={snapDistance:0},T=0,E=new a.a,A=new a.e,P=new a.b;u.dragBehavior.onDragObservable.add(function(e){if(u.attachedMesh){u.attachedMesh.rotationQuaternion&&!l||(u.attachedMesh.rotationQuaternion=a.b.RotationYawPitchRoll(u.attachedMesh.rotation.y,u.attachedMesh.rotation.x,u.attachedMesh.rotation.z));var i=u.attachedMesh.parent;i&&u.attachedMesh.setParent(null);var r=e.dragPlanePoint.subtract(u.attachedMesh.absolutePosition).normalize(),o=m.subtract(u.attachedMesh.absolutePosition).normalize(),s=a.e.Cross(r,o),c=a.e.Dot(r,o),h=Math.atan2(s.length(),c);if(v.copyFrom(t),y.copyFrom(t),u.updateGizmoRotationToMatchAttachedMesh&&(u.attachedMesh.rotationQuaternion.toRotationMatrix(g),y=a.e.TransformCoordinates(v,g)),n.utilityLayerScene.activeCamera){var d=n.utilityLayerScene.activeCamera.position.subtract(u.attachedMesh.position);a.e.Dot(d,y)>0&&(v.scaleInPlace(-1),y.scaleInPlace(-1))}a.e.Dot(y,s)>0&&(h=-h);var f=!1;if(0!=u.snapDistance)if(T+=h,Math.abs(T)>u.snapDistance){var p=Math.floor(Math.abs(T)/u.snapDistance);T<0&&(p*=-1),T%=u.snapDistance,h=u.snapDistance*p,f=!0}else h=0;E.reset(),u.attachedMesh.parent&&(u.attachedMesh.parent.computeWorldMatrix().invertToRef(E),E.getRotationMatrixToRef(E),a.e.TransformCoordinatesToRef(v,E,v));var _=Math.sin(h/2);P.set(v.x*_,v.y*_,v.z*_,Math.cos(h/2)),E.determinant()>0&&(P.toEulerAnglesToRef(A),a.b.RotationYawPitchRollToRef(A.y,-A.x,-A.z,P)),u.updateGizmoRotationToMatchAttachedMesh?u.attachedMesh.rotationQuaternion.multiplyToRef(P,u.attachedMesh.rotationQuaternion):P.multiplyToRef(u.attachedMesh.rotationQuaternion,u.attachedMesh.rotationQuaternion),l&&(u.attachedMesh.rotationQuaternion.toEulerAnglesToRef(A),u.attachedMesh.rotationQuaternion=null,u.attachedMesh.rotation.copyFrom(A)),m.copyFrom(e.dragPlanePoint),f&&(b.snapDistance=h,u.onSnapObservable.notifyObservers(b)),i&&u.attachedMesh.setParent(i)}}),u._pointerObserver=n.utilityLayerScene.onPointerObservable.add(function(e){if(!u._customMeshSet){var t=e.pickInfo&&-1!=u._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?d:h;u._rootMesh.getChildMeshes().forEach(function(e){e.material=t,e.color&&(e.color=t.diffuseColor)})}});var S=n._getSharedGizmoLight();return S.includedOnlyMeshes=S.includedOnlyMeshes.concat(u._rootMesh.getChildMeshes(!1)),u}return h.d(t,e),t.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e,e?this._parent&&(this.attachedMesh=this._parent.attachedMesh):this.attachedMesh=null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),e.prototype.dispose.call(this)},t}(Jn.a),or=function(e){function t(t,i,n){void 0===t&&(t=$n.a.DefaultUtilityLayer),void 0===i&&(i=32),void 0===n&&(n=!1);var r=e.call(this,t)||this;return r.onDragStartObservable=new o.c,r.onDragEndObservable=new o.c,r.xGizmo=new rr(new a.e(1,0,0),s.a.Red().scale(.5),t,i,r,n),r.yGizmo=new rr(new a.e(0,1,0),s.a.Green().scale(.5),t,i,r,n),r.zGizmo=new rr(new a.e(0,0,1),s.a.Blue().scale(.5),t,i,r,n),[r.xGizmo,r.yGizmo,r.zGizmo].forEach(function(e){e.dragBehavior.onDragStartObservable.add(function(){r.onDragStartObservable.notifyObservers({})}),e.dragBehavior.onDragEndObservable.add(function(){r.onDragEndObservable.notifyObservers({})})}),r.attachedMesh=null,r}return h.d(t,e),Object.defineProperty(t.prototype,"attachedMesh",{get:function(){return this._meshAttached},set:function(e){this._meshAttached=e,[this.xGizmo,this.yGizmo,this.zGizmo].forEach(function(t){t.isEnabled?t.attachedMesh=e:t.attachedMesh=null})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},t.prototype.setCustomMesh=function(e){m.a.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)")},t}(Jn.a),ar=i(41),sr=i(82),cr=function(e){function t(i,n,r,c){void 0===n&&(n=s.a.Gray()),void 0===r&&(r=$n.a.DefaultUtilityLayer),void 0===c&&(c=null);var l=e.call(this,r)||this;l._pointerObserver=null,l.snapDistance=0,l.onSnapObservable=new o.c,l._isEnabled=!1,l._parent=null,l._parent=c,l._coloredMaterial=new zi.a("",r.utilityLayerScene),l._coloredMaterial.diffuseColor=n,l._coloredMaterial.specularColor=n.subtract(new s.a(.1,.1,.1)),l._hoverMaterial=new zi.a("",r.utilityLayerScene),l._hoverMaterial.diffuseColor=n.add(new s.a(.3,.3,.3)),l._plane=t._CreatePlane(r.utilityLayerScene,l._coloredMaterial),l._plane.lookAt(l._rootMesh.position.add(i)),l._plane.scaling.scaleInPlace(1/3),l._plane.parent=l._rootMesh;var u=0,h=new a.e,d={snapDistance:0};l.dragBehavior=new He.a({dragPlaneNormal:i}),l.dragBehavior.moveAttached=!1,l._rootMesh.addBehavior(l.dragBehavior);var f=new a.e,p=new a.a;l.dragBehavior.onDragObservable.add(function(e){if(l.attachedMesh)if(l.attachedMesh.parent?(l.attachedMesh.parent.computeWorldMatrix().invertToRef(p),p.setTranslationFromFloats(0,0,0),a.e.TransformCoordinatesToRef(e.delta,p,f)):f.copyFrom(e.delta),0==l.snapDistance)l.attachedMesh.position.addInPlace(f);else if(u+=e.dragDistance,Math.abs(u)>l.snapDistance){var t=Math.floor(Math.abs(u)/l.snapDistance);u%=l.snapDistance,f.normalizeToRef(h),h.scaleInPlace(l.snapDistance*t),l.attachedMesh.position.addInPlace(h),d.snapDistance=l.snapDistance*t,l.onSnapObservable.notifyObservers(d)}}),l._pointerObserver=r.utilityLayerScene.onPointerObservable.add(function(e){if(!l._customMeshSet){var t=e.pickInfo&&-1!=l._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?l._hoverMaterial:l._coloredMaterial;l._rootMesh.getChildMeshes().forEach(function(e){e.material=t})}});var _=r._getSharedGizmoLight();return _.includedOnlyMeshes=_.includedOnlyMeshes.concat(l._rootMesh.getChildMeshes(!1)),l}return h.d(t,e),t._CreatePlane=function(e,t){var i=new ar.a("plane",e),n=sr.a.CreatePlane("dragPlane",{width:.1375,height:.1375,sideOrientation:2},e);return n.material=t,n.parent=i,n.material=t,i},t._CreateArrowInstance=function(e,t){for(var i=new ar.a("arrow",e),n=0,r=t.getChildMeshes();n=t.length)?0:e.type||0,h=e.size,d=e.sizeX||h||1,f=e.sizeY||h||1,p=e.sizeZ||h||1,_=e.custom||t[u],m=_.face.length,g=e.faceUV||new Array(m),v=e.faceColors,y=void 0===e.flat||e.flat,b=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,T=new Array,E=new Array,A=new Array,P=new Array,S=new Array,R=0,x=0,C=new Array,M=0,O=0;if(y)for(O=0;O0?this._setDefaultFixedFrustumShadowProjectionMatrix(e):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},t.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e){var t=this.getScene().activeCamera;t&&a.a.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:t.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:t.maxZ,e)},t.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var r=a.e.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=0;othis._orthoRight&&(this._orthoRight=r.x),r.y>this._orthoTop&&(this._orthoTop=r.y)}}var u=this._orthoRight-this._orthoLeft,h=this._orthoTop-this._orthoBottom;this.getScene().useRightHandedSystem?a.a.OrthoOffCenterRHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-h*this.shadowOrthoScale,this._orthoTop+h*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e):a.a.OrthoOffCenterLHToRef(this._orthoLeft-u*this.shadowOrthoScale,this._orthoRight+u*this.shadowOrthoScale,this._orthoBottom-h*this.shadowOrthoScale,this._orthoTop+h*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:n.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:n.maxZ,e)}},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?(this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightData",-this.transformedDirection.x,-this.transformedDirection.y,-this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t),this):(this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightData",-this.direction.x,-this.direction.y,-this.direction.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this)},t.prototype.getDepthMinZ=function(e){return 1},t.prototype.getDepthMaxZ=function(e){return 1},t.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},h.c([Object(F.c)()],t.prototype,"shadowFrustumSize",null),h.c([Object(F.c)()],t.prototype,"shadowOrthoScale",null),h.c([Object(F.c)()],t.prototype,"autoUpdateExtends",void 0),t}(pr);Se.a.CreateHemisphere=function(e,t,i,n){var r={segments:t,diameter:i};return mr.CreateHemisphere(e,r,n)};var mr=function(){function e(){}return e.CreateHemisphere=function(e,t,i){t.diameter||(t.diameter=1),t.segments||(t.segments=16);var n=tr.a.CreateSphere("",{slice:.5,diameter:t.diameter,segments:t.segments},i),r=Se.a.CreateDisc("",t.diameter/2,3*t.segments+(4-t.segments),i);r.rotation.x=-Math.PI/2,r.parent=n;var o=Se.a.MergeMeshes([r,n],!0);return o.name=e,o},e}();B.a.AddNodeConstructor("Light_Type_2",function(e,t){return function(){return new gr(e,a.e.Zero(),a.e.Zero(),0,0,t)}});var gr=function(e){function t(t,i,n,r,o,s){var c=e.call(this,t,s)||this;return c._innerAngle=0,c._projectionTextureMatrix=a.a.Zero(),c._projectionTextureLightNear=1e-6,c._projectionTextureLightFar=1e3,c._projectionTextureUpDirection=a.e.Up(),c._projectionTextureViewLightDirty=!0,c._projectionTextureProjectionLightDirty=!0,c._projectionTextureDirty=!0,c._projectionTextureViewTargetVector=a.e.Zero(),c._projectionTextureViewLightMatrix=a.a.Zero(),c._projectionTextureProjectionLightMatrix=a.a.Zero(),c._projectionTextureScalingMatrix=a.a.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),c.position=i,c.direction=n,c.angle=r,c.exponent=o,c}return h.d(t,e),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){var t=this;if(this._projectionTexture!==e&&(this._projectionTexture=e,this._projectionTextureDirty=!0,this._projectionTexture&&!this._projectionTexture.isReady())){var i=this._projectionTexture;i.onLoadObservable&&i.onLoadObservable.addOnce(function(){t._markMeshesAsLightDirty()})}},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"SpotLight"},t.prototype.getTypeID=function(){return fr.a.LIGHTTYPEID_SPOTLIGHT},t.prototype._setDirection=function(t){e.prototype._setDirection.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setPosition=function(t){e.prototype._setPosition.call(this,t),this._projectionTextureViewLightDirty=!0},t.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var n=this.getScene().activeCamera;if(n){this._shadowAngleScale=this._shadowAngleScale||1;var r=this._shadowAngleScale*this._angle;a.a.PerspectiveFovLHToRef(r,1,this.getDepthMinZ(n),this.getDepthMaxZ(n),e)}},t.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),a.a.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},t.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),n=-i*t,r=1/Math.tan(this._angle/2);a.a.FromValuesToRef(r/1,0,0,0,0,r,0,0,0,0,i,1,0,0,n,0,this._projectionTextureProjectionLightMatrix)},t.prototype._computeProjectionTextureMatrix=function(){this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},t.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},t.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},t.prototype.transferToEffect=function(e,t){var i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=a.e.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=a.e.Normalize(this.direction)),this.getScene().useRightHandedSystem?this._uniformBuffer.updateFloat4("vLightDirection",-i.x,-i.y,-i.z,this._cosHalfAngle,t):this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},t.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!(!this.projectionTexture||!this.projectionTexture.isReady())},h.c([Object(F.c)()],t.prototype,"angle",null),h.c([Object(F.c)()],t.prototype,"innerAngle",null),h.c([Object(F.c)()],t.prototype,"shadowAngleScale",null),h.c([Object(F.c)()],t.prototype,"exponent",void 0),h.c([Object(F.c)()],t.prototype,"projectionTextureLightNear",null),h.c([Object(F.c)()],t.prototype,"projectionTextureLightFar",null),h.c([Object(F.c)()],t.prototype,"projectionTextureUpDirection",null),h.c([Object(F.m)("projectedLightTexture")],t.prototype,"_projectionTexture",void 0),t}(pr),vr=function(e){function t(t){var i=e.call(this,t)||this;return i.cachedPosition=new a.e,i.cachedForward=new a.e(0,0,1),i._light=null,i.attachedMesh=new Ye.a("",i.gizmoLayer.utilityLayerScene),i._material=new zi.a("light",i.gizmoLayer.originalScene),i._material.diffuseColor=new s.a(.5,.5,.5),i._material.specularColor=new s.a(.1,.1,.1),i}return h.d(t,e),Object.defineProperty(t.prototype,"light",{get:function(){return this._light},set:function(e){var i=this;if(this._light=e,e){this._lightMesh&&this._lightMesh.dispose(),e instanceof Ui.a?this._lightMesh=t._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene):this._lightMesh=e instanceof _r?t._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene):e instanceof gr?t._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene):t._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene),this._lightMesh.getChildMeshes(!1).forEach(function(e){e.material=i._material}),this._lightMesh.parent=this._rootMesh;var n=this.gizmoLayer._getSharedGizmoLight();n.includedOnlyMeshes=n.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(!1)),this._lightMesh.rotationQuaternion=new a.b,this.attachedMesh.reservedDataStore||(this.attachedMesh.reservedDataStore={}),this.attachedMesh.reservedDataStore.lightGizmo=this,e.position&&this.attachedMesh.position.copyFrom(e.position),e.direction&&this.attachedMesh.setDirection(e.direction),this._update()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"material",{get:function(){return this._material},enumerable:!0,configurable:!0}),t.prototype._update=function(){e.prototype._update.call(this),this._light&&(this._light.position&&(this.attachedMesh.position.equals(this.cachedPosition)?this.attachedMesh.position.copyFrom(this._light.position):(this._light.position.copyFrom(this.attachedMesh.position),this.cachedPosition.copyFrom(this.attachedMesh.position))),this._light.direction&&(a.e.DistanceSquared(this.attachedMesh.forward,this.cachedForward)>1e-4?(this._light.direction.copyFrom(this.attachedMesh.forward),this.cachedForward.copyFrom(this.attachedMesh.forward)):a.e.DistanceSquared(this.attachedMesh.forward,this._light.direction)>1e-4&&(this.attachedMesh.setDirection(this._light.direction),this.cachedForward.copyFrom(this._lightMesh.forward))),this._light.isEnabled()?this._material.diffuseColor.set(this._light.diffuse.r/3,this._light.diffuse.g/3,this._light.diffuse.b/3):this._material.diffuseColor.set(0,0,0))},t.prototype.dispose=function(){this._material.dispose(),e.prototype.dispose.call(this)},t._CreateHemisphericLightMesh=function(e){var i=new Se.a("hemisphereLight",e),n=mr.CreateHemisphere(i.name,{segments:10,diameter:1},e);n.position.z=-.15,n.rotation.x=Math.PI/2,n.parent=i;var r=this._createLightLines(3,e);return r.parent=i,r.position.z,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreatePointLightMesh=function(e){var i=new Se.a("pointLight",e),n=tr.a.CreateSphere(i.name,{segments:10,diameter:1},e);return n.rotation.x=Math.PI/2,n.parent=i,this._createLightLines(5,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateSpotLightMesh=function(e){var i=new Se.a("spotLight",e);tr.a.CreateSphere(i.name,{segments:10,diameter:1},e).parent=i;var n=mr.CreateHemisphere(i.name,{segments:10,diameter:2},e);return n.parent=i,n.rotation.x=-Math.PI/2,this._createLightLines(2,e).parent=i,i.scaling.scaleInPlace(t._Scale),i.rotation.x=Math.PI/2,i},t._CreateDirectionalLightMesh=function(e){var i=new Se.a("directionalLight",e),n=new Se.a(i.name,e);n.parent=i,tr.a.CreateSphere(i.name,{diameter:1.2,segments:10},e).parent=n;var r=Se.a.CreateCylinder(i.name,6,.3,.3,6,1,e);r.parent=n,(o=r.clone(i.name)).scaling.y=.5,o.position.x+=1.25,(a=r.clone(i.name)).scaling.y=.5,a.position.x+=-1.25;var o,a,s=Se.a.CreateCylinder(i.name,1,0,.6,6,1,e);return s.position.y+=3,s.parent=n,(o=s.clone(i.name)).position.y=1.5,o.position.x+=1.25,(a=s.clone(i.name)).position.y=1.5,a.position.x+=-1.25,n.scaling.scaleInPlace(t._Scale),n.rotation.z=Math.PI/2,n.rotation.y=Math.PI/2,i},t._Scale=.007,t._createLightLines=function(e,t){var i=new Se.a("root",t);i.rotation.x=Math.PI/2;var n=new Se.a("linePivot",t);n.parent=i;var r=Se.a.CreateCylinder("line",2,.2,.3,6,1,t);if(r.position.y=r.scaling.y/2+1.2,r.parent=n,e<2)return n;for(var o=0;o<4;o++){(a=n.clone("lineParentClone")).rotation.z=Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}if(e<3)return i;for(o=0;o<4;o++){(a=n.clone("linePivotClone")).rotation.z=Math.PI/2,a.rotation.y=Math.PI/2*o}if(e<4)return i;for(o=0;o<4;o++){var a;(a=n.clone("linePivotClone")).rotation.z=Math.PI+Math.PI/4,a.rotation.y=Math.PI/2+Math.PI/2*o,a.getChildMeshes()[0].scaling.y=.5,a.getChildMeshes()[0].scaling.x=a.getChildMeshes()[0].scaling.z=.8,a.getChildMeshes()[0].position.y=a.getChildMeshes()[0].scaling.y/2+1.2}return e<5?i:((a=n.clone("linePivotClone")).rotation.z=Math.PI,i)},t}(Jn.a),yr=i(49);ni.a.IncludesShadersStore.kernelBlurVaryingDeclaration="varying vec2 sampleCoord{X};";var br="vec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\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}";ni.a.IncludesShadersStore.packingFunctions=br;var Tr="#ifdef DOF\nfactor=sampleCoC(sampleCoord{X});\ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif";ni.a.IncludesShadersStore.kernelBlurFragment=Tr;var Er="#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif";ni.a.IncludesShadersStore.kernelBlurFragment2=Er;var Ar="\nuniform sampler2D textureSampler;\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(const in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g;\nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth;\n}\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r;\nreturn coc;\n}\n#endif\n#include[0..varyingCount]\n#ifdef PACKEDFLOAT\n#include\n#endif\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT\nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT;\nfloat factor=0.0;\n\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include[0..varyingCount]\n#include[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}";ni.a.ShadersStore.kernelBlurPixelShader=Ar;ni.a.IncludesShadersStore.kernelBlurVertex="sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};";var Pr="\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nsampleCenter=(position*madd+madd);\n#include[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.kernelBlurVertexShader=Pr;var Sr=function(e){function t(t,i,n,r,o,a,s,c,l,u,h){void 0===a&&(a=$e.a.BILINEAR_SAMPLINGMODE),void 0===l&&(l=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u=""),void 0===h&&(h=!1);var d=e.call(this,t,"kernelBlur",["delta","direction","cameraMinMaxZ"],["circleOfConfusionSampler"],r,o,a,s,c,null,l,"kernelBlur",{varyingCount:0,depCount:0},!0)||this;return d.direction=i,d.blockCompilation=h,d._packedFloat=!1,d._staticDefines="",d._staticDefines=u,d.onApplyObservable.add(function(e){d._outputTexture?e.setFloat2("delta",1/d._outputTexture.width*d.direction.x,1/d._outputTexture.height*d.direction.y):e.setFloat2("delta",1/d.width*d.direction.x,1/d.height*d.direction.y)}),d.kernel=n,d}return h.d(t,e),Object.defineProperty(t.prototype,"kernel",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),t.prototype.updateEffect=function(e,t,i,n,r,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._updateParameters(r,o)},t.prototype._updateParameters=function(t,i){for(var n=this._kernel,r=(n-1)/2,o=[],a=[],s=0,c=0;c0)return Math.max(r,3)}return Math.max(t,3)},t.prototype._gaussianWeight=function(e){var t=-e*e/(1/3*2*(1/3));return 1/(Math.sqrt(2*Math.PI)*(1/3))*Math.exp(t)},t.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,"")},t}(oi),Rr=function(e){function t(t,i,n,r,o,s,c){void 0===o&&(o=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=$e.a.BILINEAR_SAMPLINGMODE),void 0===c&&(c=!0);var l=e.call(this,t,i,n,r,!0,o,!1,s,c)||this;return l.scene=n,l.mirrorPlane=new xn.a(0,1,0,1),l._transformMatrix=a.a.Zero(),l._mirrorMatrix=a.a.Zero(),l._adaptiveBlurKernel=0,l._blurKernelX=0,l._blurKernelY=0,l._blurRatio=1,l.ignoreCameraViewport=!0,l._updateGammaSpace(),l._imageProcessingConfigChangeObserver=n.imageProcessingConfiguration.onUpdateParameters.add(function(){l._updateGammaSpace}),l.onBeforeRenderObservable.add(function(){a.a.ReflectionToRef(l.mirrorPlane,l._mirrorMatrix),l._savedViewMatrix=n.getViewMatrix(),l._mirrorMatrix.multiplyToRef(l._savedViewMatrix,l._transformMatrix),n.setTransformMatrix(l._transformMatrix,n.getProjectionMatrix()),n.clipPlane=l.mirrorPlane,n.getEngine().cullBackFaces=!1,n._mirroredCameraPosition=a.e.TransformCoordinates(n.activeCamera.globalPosition,l._mirrorMatrix)}),l.onAfterRenderObservable.add(function(){n.setTransformMatrix(l._savedViewMatrix,n.getProjectionMatrix()),n.getEngine().cullBackFaces=!0,n._mirroredCameraPosition=null,n.clipPlane=null}),l}return h.d(t,e),Object.defineProperty(t.prototype,"blurRatio",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"adaptiveBlurKernel",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernel",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernelX",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"blurKernelY",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),t.prototype._autoComputeBlurKernel=function(){var e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth(),i=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*i},t.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},t.prototype._updateGammaSpace=function(){this.gammaSpace=!this.scene.imageProcessingConfiguration.isEnabled||!this.scene.imageProcessingConfiguration.applyByPostProcess},t.prototype._preparePostProcesses=function(){if(this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY){var e=this.getScene().getEngine(),t=e.getCaps().textureFloatRender?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_HALF_FLOAT;this._blurX=new Sr("horizontal blur",new a.d(1,0),this._blurKernelX,this._blurRatio,null,$e.a.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._texture:this._blurX.alwaysForcePOT=!0,this._blurY=new Sr("vertical blur",new a.d(0,1),this._blurKernelY,this._blurRatio,null,$e.a.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)}else this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null)},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=this.getSize(),n=new t(this.name,i.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return n.hasAlpha=this.hasAlpha,n.level=this.level,n.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(n.renderList=this.renderList.slice(0)),n},t.prototype.serialize=function(){if(!this.name)return null;var t=e.prototype.serialize.call(this);return t.mirrorPlane=this.mirrorPlane.asArray(),t},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver)},t}(Oi);$e.a._CreateMirror=function(e,t,i,n){return new Rr(e,t,i,n)};var xr=i(50);Ce.b.prototype._createDepthStencilCubeTexture=function(e,t){var i=new et.a(this,et.a.DATASOURCE_UNKNOWN);if(i.isCube=!0,1===this.webGLVersion)return m.a.Error("Depth cube texture is not supported by WebGL 1."),i;var n=h.a({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),r=this._gl;this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,i,!0),this._setupDepthStencilTexture(i,e,n.generateStencil,n.bilinearFiltering,n.comparisonFunction);for(var o=0;o<6;o++)n.generateStencil?r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r.DEPTH24_STENCIL8,e,e,0,r.DEPTH_STENCIL,r.UNSIGNED_INT_24_8,null):r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,r.DEPTH_COMPONENT24,e,e,0,r.DEPTH_COMPONENT,r.UNSIGNED_INT,null);return this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,null),i},Ce.b.prototype._partialLoadFile=function(e,t,i,n,r){void 0===r&&(r=null);this._loadFile(e,function(e){i[t]=e,i._internalCount++,6===i._internalCount&&n(i)},void 0,void 0,!0,function(e,t){r&&e&&r(e.status+" "+e.statusText,t)})},Ce.b.prototype._cascadeLoadFiles=function(e,t,i,n){void 0===n&&(n=null);var r=[];r._internalCount=0;for(var o=0;o<6;o++)this._partialLoadFile(i[o],o,r,t,n)},Ce.b.prototype._cascadeLoadImgs=function(e,t,i,n){void 0===n&&(n=null);var r=[];r._internalCount=0;for(var o=0;o<6;o++)this._partialLoadImg(i[o],o,r,e,t,n)},Ce.b.prototype._partialLoadImg=function(e,t,i,n,r,o){var a;void 0===o&&(o=null);a=xr.a.LoadImage(e,function(){i[t]=a,i._internalCount++,n&&n._removePendingData(a),6===i._internalCount&&r(i)},function(e,t){n&&n._removePendingData(a),o&&o(e,t)},n?n.offlineProvider:null),n&&n._addPendingData(a)},Ce.b.prototype.createCubeTexture=function(e,t,i,n,r,o,a,s,c,l,u,h,d){var f=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=!1),void 0===l&&(l=0),void 0===u&&(u=0),void 0===h&&(h=null),void 0===d&&(d=[]);var p=this._gl,_=h||new et.a(this,et.a.DATASOURCE_CUBE);_.isCube=!0,_.url=e,_.generateMipMaps=!n,_._lodGenerationScale=l,_._lodGenerationOffset=u,this._doNotHandleContextLost||(_._extension=s,_._files=i);for(var g=e.lastIndexOf("."),v=s||(g>-1?e.substring(g).toLowerCase():""),y=null,b=0,T=Ce.b._TextureLoaders;b-1?t.substring(m).toLowerCase():""),y=".dds"===v,b=".env"===v;if(b?(_.gammaSpace=!1,_._prefiltered=!1):(_._prefiltered=u,u&&(_.gammaSpace=!1)),_._texture=_._getFromCache(t,r),!o&&(b||y||n||(n=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),o=[],n))for(var T=0;T0,o.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,o.LODINREFLECTIONALPHA=s.lodLevelInAlpha,o.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,o.REFLECTIONBGR=this.switchToBGR,s.coordinatesMode===$e.a.INVCUBIC_MODE&&(o.INVERTCUBICMAP=!0),o.REFLECTIONMAP_3D=s.isCube,s.coordinatesMode){case $e.a.EXPLICIT_MODE:o.REFLECTIONMAP_EXPLICIT=!0;break;case $e.a.PLANAR_MODE:o.REFLECTIONMAP_PLANAR=!0;break;case $e.a.PROJECTION_MODE:o.REFLECTIONMAP_PROJECTION=!0;break;case $e.a.SKYBOX_MODE:o.REFLECTIONMAP_SKYBOX=!0,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!s.getReflectionTextureMatrix().isIdentity();break;case $e.a.SPHERICAL_MODE:o.REFLECTIONMAP_SPHERICAL=!0;break;case $e.a.EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case $e.a.CUBIC_MODE:case $e.a.INVCUBIC_MODE:default:o.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(o.REFLECTIONFRESNEL=!0,o.REFLECTIONFALLOFF=this.reflectionFalloffDistance>0,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1)}else o.REFLECTION=!1,o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1,o.REFLECTIONBLUR=!1,o.REFLECTIONMAP_3D=!1,o.REFLECTIONMAP_SPHERICAL=!1,o.REFLECTIONMAP_PLANAR=!1,o.REFLECTIONMAP_CUBIC=!1,o.REFLECTIONMAP_PROJECTION=!1,o.REFLECTIONMAP_SKYBOX=!1,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,o.REFLECTIONMAP_EXPLICIT=!1,o.REFLECTIONMAP_EQUIRECTANGULAR=!1,o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,o.INVERTCUBICMAP=!1,o.REFLECTIONMAP_OPPOSITEZ=!1,o.LODINREFLECTIONALPHA=!1,o.GAMMAREFLECTION=!1,o.RGBDREFLECTION=!1}o.PREMULTIPLYALPHA=this.alphaMode===g.a.ALPHA_PREMULTIPLIED||this.alphaMode===g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,o.USERGBCOLOR=this._useRGBColor,o.NOISE=this._enableNoise}if(o._areLightsDirty&&(o.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel)),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o)}if(Mr.a.PrepareDefinesForMisc(e,r,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),Mr.a.PrepareDefinesForFrameBoundValues(r,a,o,i),Mr.a.PrepareDefinesForAttributes(e,o,!1,!0,!1)&&e&&(r.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(Yi.b.NormalKind)||(e.createNormals(!0),m.a.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var c=new ni.c;o.FOG&&c.addFallback(0,"FOG"),o.POINTSIZE&&c.addFallback(1,"POINTSIZE"),o.MULTIVIEW&&c.addFallback(0,"MULTIVIEW"),Mr.a.HandleFallbacksForShadows(o,c,this._maxSimultaneousLights);var l=[Yi.b.PositionKind];o.NORMAL&&l.push(Yi.b.NormalKind),o.UV1&&l.push(Yi.b.UVKind),o.UV2&&l.push(Yi.b.UV2Kind),Mr.a.PrepareAttributesForBones(l,e,o,c),Mr.a.PrepareAttributesForInstances(l,o);var u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"],h=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],d=["Material","Scene"];Gi.a&&(Gi.a.PrepareUniforms(u,o),Gi.a.PrepareSamplers(h,o)),Mr.a.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var f=o.toString();t.setEffect(r.getEngine().createEffect("background",{attributes:l,uniformsNames:u,uniformBuffersNames:d,samplers:h,defines:f,fallbacks:c,onCompiled:function(e){n.onCompiled&&n.onCompiled(e),n.bindSceneUniformBuffer(e,r.getSceneUniformBuffer())},onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},t.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},t.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()},t.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),e.prototype.unbind.call(this)},t.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},t.prototype.bindForSubMesh=function(e,t,i){var n=this.getScene(),r=i._materialDefines;if(r){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),Mr.a.BindBonesParameters(t,this._activeEffect);var a=this._mustRebind(n,o,t.visibility);if(a){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o);var s=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(n.texturesEnabled&&(this._diffuseTexture&&Dr.a.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),Mr.a.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),s&&Dr.a.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",s.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",s.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",s.getSize().width,s.lodGenerationScale,s.lodGenerationOffset))),this.shadowLevel>0&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),r.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),n.texturesEnabled&&(this._diffuseTexture&&Dr.a.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),s&&Dr.a.ReflectionTextureEnabled&&(r.REFLECTIONBLUR&&r.TEXTURELODSUPPORT?this._uniformBuffer.setTexture("reflectionSampler",s):r.REFLECTIONBLUR?(this._uniformBuffer.setTexture("reflectionSampler",s._lodTextureMid||s),this._uniformBuffer.setTexture("reflectionSamplerLow",s._lodTextureLow||s),this._uniformBuffer.setTexture("reflectionSamplerHigh",s._lodTextureHigh||s)):this._uniformBuffer.setTexture("reflectionSampler",s),r.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),Mr.a.BindClipPlane(this._activeEffect,n),Mr.a.BindEyePosition(o,n)}!a&&this.isFrozen||(n.lightsEnabled&&Mr.a.BindLights(n,t,this._activeEffect,r,this._maxSimultaneousLights,!1),this.bindView(o),Mr.a.BindFogParameters(n,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._reflectionTexture===t||this._diffuseTexture===t)},t.prototype.dispose=function(t,i){void 0===t&&(t=!1),void 0===i&&(i=!1),i&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t)},t.prototype.clone=function(e){var i=this;return F.a.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=F.a.Serialize(this);return e.customType="BABYLON.BackgroundMaterial",e},t.prototype.getClassName=function(){return"BackgroundMaterial"},t.Parse=function(e,i,n){return F.a.Parse(function(){return new t(e.name,i)},e,i,n)},t.StandardReflectance0=.05,t.StandardReflectance90=.5,h.c([Object(F.e)()],t.prototype,"_primaryColor",void 0),h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColor",void 0),h.c([Object(F.e)()],t.prototype,"__perceptualColor",void 0),h.c([Object(F.c)()],t.prototype,"_primaryColorShadowLevel",void 0),h.c([Object(F.c)()],t.prototype,"_primaryColorHighlightLevel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"primaryColorHighlightLevel",null),h.c([Object(F.m)()],t.prototype,"_reflectionTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionBlur",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionBlur",void 0),h.c([Object(F.m)()],t.prototype,"_diffuseTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"diffuseTexture",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLights",void 0),h.c([Object(F.c)()],t.prototype,"_shadowLevel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"shadowLevel",void 0),h.c([Object(F.o)()],t.prototype,"_sceneCenter",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"sceneCenter",void 0),h.c([Object(F.c)()],t.prototype,"_opacityFresnel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"opacityFresnel",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionFresnel",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFresnel",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionFalloffDistance",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionFalloffDistance",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionAmount",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionAmount",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionReflectance0",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance0",void 0),h.c([Object(F.c)()],t.prototype,"_reflectionReflectance90",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionReflectance90",void 0),h.c([Object(F.c)()],t.prototype,"_useRGBColor",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRGBColor",void 0),h.c([Object(F.c)()],t.prototype,"_enableNoise",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableNoise",void 0),h.c([Object(F.c)()],t.prototype,"_maxSimultaneousLights",void 0),h.c([Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"maxSimultaneousLights",void 0),h.c([Object(F.i)()],t.prototype,"_imageProcessingConfiguration",void 0),t}(Ir.a);c.a.RegisteredTypes["BABYLON.BackgroundMaterial"]=Vr;var kr=function(){function e(t,i){var n=this;this._errorHandler=function(e,t){n.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=h.a({},e._getDefaultOptions(),t),this._scene=i,this.onErrorObservable=new o.c,this._setupBackground(),this._setupImageProcessing()}return e._getDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._groundTextureCDNUrl,groundColor:new s.a(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:g.a.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._skyboxTextureCDNUrl,skyboxColor:new s.a(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:a.e.Zero(),setupImageProcessing:!0,environmentTexture:this._environmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(e.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skybox",{get:function(){return this._skybox},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ground",{get:function(){return this._ground},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!0,configurable:!0}),e.prototype.updateOptions=function(e){var t=h.a({},this._options,e);this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()},e.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new s.b(e.r,e.g,e.b,1))},e.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},e.prototype._setupEnvironmentTexture=function(){if(!this._scene.environmentTexture)if(this._options.environmentTexture instanceof yr.a)this._scene.environmentTexture=this._options.environmentTexture;else{var e=Cr.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},e.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new Se.a("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},e.prototype._getSceneSize=function(){var e=this,t=this._options.groundSize,i=this._options.skyboxSize,n=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:t,skyboxSize:i,rootPosition:n};var r=this._scene.getWorldExtends(function(t){return t!==e._ground&&t!==e._rootMesh&&t!==e._skybox}),o=r.max.subtract(r.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof wt&&this._scene.activeCamera.upperRadiusLimit&&(i=t=2*this._scene.activeCamera.upperRadiusLimit);var a=o.length();a>t&&(i=t=2*a),t*=1.1,i*=1.5,(n=r.min.add(o.scale(.5))).y=r.min.y-this._options.groundYBias}return{groundSize:t,skyboxSize:i,rootPosition:n}},e.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=Se.a.CreatePlane("BackgroundPlane",e.groundSize,this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add(function(){t._ground=null})),this._ground.receiveShadows=this._options.enableGroundShadow},e.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new Vr("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},e.prototype._setupGroundDiffuseTexture=function(){if(this._groundMaterial&&!this._groundTexture)if(this._options.groundTexture instanceof yr.a)this._groundMaterial.diffuseTexture=this._options.groundTexture;else{var e=new $e.a(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler);e.gammaSpace=!1,e.hasAlpha=!0,this._groundMaterial.diffuseTexture=e}},e.prototype._setupGroundMirrorTexture=function(e){var t=$e.a.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new Rr("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,$e.a.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new xn.a(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.gammaSpace=!1,this._groundMirror.renderList))for(var i=0;i\nvoid main(void)\n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}";ni.a.ShadersStore.rgbdDecodePixelShader=zr;var jr=function(){function e(){}return e._ExpandDefaultBRDFTexture=function(e){var t=e.getEngine(),i=t.getCaps(),n=!1;if(i.textureHalfFloatRender&&i.textureHalfFloatLinearFiltering?(n=!0,e.type=g.a.TEXTURETYPE_HALF_FLOAT):i.textureFloatRender&&i.textureFloatLinearFiltering&&(n=!0,e.type=g.a.TEXTURETYPE_FLOAT),n){e.isReady=!1;var r=new oi("rgbdDecode","rgbdDecode",null,null,1,null,g.a.TEXTURE_TRILINEAR_SAMPLINGMODE,t,!1,void 0,e.type,void 0,null,!1);e._isRGBD=!1,e.invertY=!1;var o=t.createRenderTargetTexture(e.width,{generateDepthBuffer:!1,generateMipMaps:!1,generateStencilBuffer:!1,samplingMode:g.a.TEXTURE_BILINEAR_SAMPLINGMODE,type:e.type,format:g.a.TEXTUREFORMAT_RGBA});r.getEffect().executeWhenCompiled(function(){r.onApply=function(t){t._bindTexture("textureSampler",e),t.setFloat2("scale",1,1)},t.scenes[0].postProcessManager.directRender([r],o,!0),t.restoreDefaultFramebuffer(),t._releaseTexture(e),t._releaseFramebufferObjects(o),r&&r.dispose(),o._swapAndDie(e),e.isReady=!0})}},e.GetEnvironmentBRDFTexture=function(e){var t=this;if(!e.environmentBRDFTexture){var i=e.useDelayedTextureLoading;e.useDelayedTextureLoading=!1;var n=$e.a.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture",e,!0,!1,$e.a.BILINEAR_SAMPLINGMODE);n._texture._isRGBD=!0,n.wrapU=$e.a.CLAMP_ADDRESSMODE,n.wrapV=$e.a.CLAMP_ADDRESSMODE,e.environmentBRDFTexture=n,e.useDelayedTextureLoading=i,n.onLoadObservable.addOnce(function(){t._ExpandDefaultBRDFTexture(n._texture)})}return e.environmentBRDFTexture},e._environmentBRDFBase64Texture="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR42u29yY5tWXIlZnbuiSaTbZFUkZRKrCKhElASQA0EoQABgn6hJvoXzfUP+gP9hWb6Bg00IgRoQJaKqUxmZmTEe8/v0uB2u7Fm2T7HIyIrnz88uPvt3f2a2WrMbOvf/u3PvvzP/sUf/N6//i8vf/lv/3v5H//d//Sb//Uq/5u8yf8hV/m/5Cp/L1f5hVzlG7nKJ7mKyJuIXN/hPwqXI/g++zq6rPI5u8z+WqfLre+zy7PrVv9L8brsMiGvk8XLmM/sdfHXal4e3ad6GXPdyu2ij8u/+uv/5cuf/OSLfdtEfvUr+dnf/d0X//t3H/7bf/hP//N/928h/0Yg/4VA/kogfyGQP5Wr/IFAvhbIlwK5CGQTPP+9z5uPeePJSW+yo2+s/GtN30Rnv1E+f5zxof9R/lSXv/nr//mrr3+i+5dfyX7ZZQP07Tffys//8R/l/9TtX7790T/7r/8G8pdy+/8XAvnnAvkzgfwzgfyxQP5AIL8vkJ8K5KsmMVzu1U7p5PA5AXxOAJ8TwPf7sX/51ZeXfcemqnp9w/W77/S7X/6T/vzf/7383RWCX3/z05/9i3/13/0PX//eX/2FyP8tIv+PiPy9iPy/IvIzEfm5iPxCRH4lIt/c/393//9BRD6KyKf7f488fP74/PH544dJAF9cLl98IZfLBZtuqterXr/7Dt9982v95S9+Lv+gF/3i7Spv/8lf/vnf/vGf/dF/JfKnIvLnIvLvReQ/NEngn0TklyLy6/v/34jIt00iGJOBlxAsdvv54/PH5493SQCXy9t2ueh2ueimKorrFbjq9eNH+fDtb+TXv/ol/vHyhX4Fxfbx7euPf/Lnf/PfiPyeiPyhiPxxkwB+fk8AvxzQgJcIrGTwFsiAEXH4/PH54/PHUgLY7whgu2C7bLqpQgHB2xvePn6SDx8+6G9+84384vKF/IPu8iVU9Y/+7C/+jWxffiHytYj8VER+X0T+oEEBvxqQwCMJeIngo5EI3goIwVMIPn98/vj8ESaAbbtu2ybbvl8u2ybbdtluSECA65u8ffqIDx8+6G++/VZ/efkV/sO261dQXP7wT/7kX8vl8qXIFyLylbySwe/dE0CLAr65B/9vGn0gQwRMMqgmhM/J4fPH548eAezbZd/lsm3YtssNAYiqiogAAkCvb5/k46cP8u2HD/rrb7+R/2/b9Wu9yJe//8d/9Ney6S5yEZFdRL68/38khG/uKOCnAwoYkcCoEXwkEgGDDq7CeQfyOTl8/vhd1QCum26ybZtu2yabbrKpQvXue1yvuF6v+vbpTT5+/CDffviAX1++1V9sO77WXb/66R/+4V/dgkbllQi+aBLBV/dE8LWRALwkYCWCNyMZXElkwLTMeMkga/P4/PH547ccAVwuctkvdxSw6bbdtYDbTfSZBN7e8PHTR/3u4wf55vKd/nL7DX6mu3791U9//5+/gkNFZGuSgZUQvnKowKgLWLTAQgRtEniTuEfwaELw0MJvf3LQzynud+53uG+X6y3gN9kul+2y6XVT1U27JCDAFVc8ksAn/e7jR/nN5YP+avtWfq6Xy9f7Vz/9w1dgRYngiyYhfNkkgzYBWHTg44AEMmqQUYQKOmDaiCIa8TmsfmzB+DnZDQjgcpGLbti2y3bZHjRAdRMVvb/dcYU8kcDbPQlsH/CrbddfbF98+RPZfvLFnAQeieCRDC5DMvju/vmD4JkEvjRQgKULeGggowdHkAHTYxihg89vu88I5UeGAPSOAFTlrgPopiqbKPSmCKreUoAAkCcSePukHz590m8vH+WbD9/JP335k6/+tA86KxFchv8jMvhiogE4JQm8XhfKqOAqx5qRPyeGzx8/cgSwbXcUoLJtim27C4Oi93+4v6VxQwKAvl2v+Hj9pB8+fZJvt4/yzfbF9lPdv/wJnsE2BogmyeCRED40tGFvksIXiSbgiYSRRpDNDZ6BDI6ghM+J4fPHeyKAO+zX7cb9t4tedMMNAQju5V+f1uAtBSiu1zsduMrHy5t8ePsk3376KN98sX/xE5FPAnm7/782o0DiUINXMkCXCB7/P94/e87AWUmARQWVvgMuKej9t1RLBp+Tw+ePgwngsutFFdu26WXbbl+rSvdfbnqAiuA23QcBgCugV1zl7e1NPm5v+LC96XfbJ/1W9y++fgXjA3bDYXV+MuhRwSPwL3JLMFYC+HS/LU8HYrGwIhwyNOF12SvgM4SgztdifP85MXz+KGsA2C6X7aJ6bXSAOwrY5OYIqGy3d5uq4P5GhABXuV6veLvRAf10fZMPb2/y3b7vX7+g+9v98/WOBq7GG7RNAlYy+Dgkhhb+Xxp0sE8IAC4SGAP/TbgVJK/PoJPBnAiwPKxsXfbbnRg+i3s/JAK4Q/4b9NfLtomBAqCickMBjy7BuywAUVyv8na94tMjCVzf9KNcLl/0SeA6oAEYb1i9g+FtSALb/bKL8/+t+wxXFMyswqiHoK4ToIgKqslgpg1qUC0QoYbvJZg/B/q5v4szHmPX7YEAsD0CX25OwEUVm9xag1+agKg+nxQArnKjAtDr9U0+Xd/k4/UqH7bL5YsewrcBBiMJZPRAp6TwQgWfjM9vgRbgUYGL8AvLWH2gqhesCokeUmCSwPsnhs8fP2YNYMO2XeSmAWxy2VQaXeDmDIhApf33rD4PTUCuV+DtCn27XuXT5ir8VmCJ2G5BpBM8/r/dEcJb8/0lEQMtJHA5TAlqNuLRhJChhEpSqFabH3di+G1AGj+W1/dyAR4IYJNNnuLf6+tWC9CHHiAtFhAIFLjK2/Uqn65X+SS67aK+3QeTDoy/IG2ogQ7fb/dAtz5vBgrYGqrwNtCHsVfgIvwK07OTQBURVNCBFpKCOjqCHn5L/67TgTN+fpySAC56nwSUi256kXsSuFGAVyLoUIDo8/Pz7fdoErr/v17lk162HbgHvFpIYDfoAJJfW4sGPjkU4VNAF8ZEcLmLhdc7kljdY1y1Dq9yLiI4IiRqcLujb138KIPn80ejATwRwIbtBvn1cqv+2J78/5EI5N4cJA8qIPcmwRsKAHDF9WYP6mV7VmrgLuTpxYTcMEW0LAmoQxFsuvAI8tv/a/C5fV2ZMMiKg++FCM7RDPRu8ebWY7VG6VJi+Bzk35MI2LsAckMAgwvQ0gC5DQjd3ABg2HQLAPpEAlZ1Bu7VV7MGHDFRAbo3VKsTbAY9sPWC/uvx86gBbDK3D1eEQS8pbAeSgSwmhepnJb6uBv/o/PzHLzxWA/X7TH77De5j6AGQi6o0CUGfCOD2X7cXAlCFQABtEsGLDtxuOyQB2UTQBKZe5GUPXgkUYCUAbZJRhBDeuq8xBf+bgwbehDm+BFQi2IJksOocvA8ysIMfxluVcRsY/eB3JzH8GFDAXQO48X/dcIf9jyDHptIigDsFkEe066tBSETQUYF7ElDdYEBytN4+rk9UcBPfrKaZqFHWcw3i4J8/X4ev2//bSXqAhwTay6OEIPLD2Ipt8OtAGzxkwLw9WVFRjTc/qC6H3+YK/b1oAA0KuOizHfieCLaHHiAb5NYTIC9EMEbZrVEQt1xwhVy1UfBh8PUOquMizwaap3tQXfY5B//tea/NZdfhsvbz+PURQTDSGWB87VX/7WSd4KxjUqrIgE0IUkoKGnhIvwvawpGf6eECXJ7tv4qbA7DJgwpsKthEmmYgfaAAffYF3HLxo0vwNjJ0SwRWMG4db4eh1gPNm18vQ+us/0eGmxDemu/fnM/X4evq/8342ksGHgLY5LyT/zg0wM8lcMjgGFXwqIOVFJBQw99eCvF9oZL9Mfl3QwAvIXDsBRC9R+fz8x0FPBLB0xJEpwUobrfAkARgIAF41h3wQgP6QAmX5E/7eI43IxGwwf/moIkRyWRJQIPgt9CA9b39nzt4bYUWjAlCjWDPgv8IEjgLJfzuaAsrv9VdVG4OwOXW/fdoA35qAdL0BDwvf6AAUVHd8LIEu94A3K+Q+2YxaB84MOH62P//qoo38fCRDERE2zf0JfmDa+MieElAjcDPKz+mRKCOtdgGtXaBjgNJ4H2owSpNeAW/rRH4CaHSpMwnBYYycjgSJwfie9CR6mPu20Uv8kABF206AvXlBMiIBPSlB9wjBW1fwEuSb94296VCqgMaGCt/G1BbExi3IG+r3a3J6P48Gv/J0YmEYoiGY7V/SxwFCwGoE/xa0AJ0CEiV9QPCJb1OJ5F1VTjEY2/MO9AEJvj1BJTQpqLfTlGwjABuzT962e4IoKnyrdh3+/6mzDVJ4PHOxj0JqGKoy20+wBMN6D1gLWi9NQHfVP5MEEPzjGYy8BMAOnTAJgEr8HUIejRo5xrA5xkR5AngmiSHs+zDDAmMgWzTg55GSJEmHE8IvWPAoYTfhWak/Wn/bQ0CGLSAjv83SUEfKp5q24LXuQICpzrjrgWoza8xVE00CQCORdhMJuTUT/rjuls0gO4Iby8BIEgK6gS7BsGuTtDrScH/fR68biUHNVGBnxjeNyHEvQe/ve3LZQqgG3rof6cEclsNflG9J4KtaQ8WHcVBHS1BtHE4QP9OBMS98mpbKTeDW7dJwRsnHpMBTFJpV4I+b0kY/NqInVFSyBLANbnMSgBM8F+Fqfxq/h657/Up+GaBnwV9hRqc9bZ/vA6vu+T9E8KPJWns94UfTeCj2QXwCHS9dNL8Xf3Ho/rfewSeFODGDV69AU0y6NFAE1DP3qK++rdB7/1HRxf86gT376zOr99T/h/ioBiXWQkgQgVeIrCC/WomhDmQK+hASI2ARQZKooHMLdCJwGEBBXC3+uERwg+VOHZ9ioAt9H80AI06wGgJ3nQA3BoCut6AhxYwgcPOFnxuFnrphk+NIKIGrWPQtgz3b0i7Y6D5rs1GKqTop0nQX52vmQC4BkjA+r4a7Kx9WLENGeegkhSETBCrNXIMdi/444Rw1n6E96ry7OPuj8UfLxtQ78NA2iSBbg7gIiIbdDLsb5agPhLC3RkYKv8NDbS2YGsatNRAG2oQwf9ZIOydgy1MAzBkAw8UwEEIDzSAqdPQ6za0PkeJAMH3Z0wXniUSZoHvBXU2mcjQgv56TedIKglCpIoQfgwCIjOytd8WgN0bfxoR8Fn9Gx0Aj5Zgq0lIZbsH/ibSJoFnS+C98g9ooHEELI3gliy25yONIiE6pb0NfBlyNEYyENoodkKwgl6I6s8kARgJ4ZoEfuYWHLEJa0LhSBXm7kImGeSfVdoJ1DO2G7WXsehAptupSOoyrCSF904k+6vt98X/ZcM98Hsd4JYIXhQAIg3/f9AAUYhsLQKAtkHVBnzjCKhOoYl2ym+iBtvzDzQ2DLXJ4PUmbJHAVnBQX4jkxfvHhNDqAdHXGQJgv0aSDGItgOseHIU+K9hXnIJzkoGlEKzNHagTdJ6VWEUH4iCKH4fd2AwDPaYBm4Wgng4gQ9V/CoGiuNmD04AQtNGMGzSAAQ2I2pzfogY9LRh7BrbOh4+D30sAencljFu2CUFrwY8UAWRfWwGvVOVfbx2uIILM0pwDv082dUTw8hYs8L+uIWiHGpWgClnAa1lMPJogovvvbePPs/q3Xr++kgCsfgB5oQF9WYKPJqEn6G+OE3i5AqouF59FQOmahQC8rlPLj38kg1c2f30vw+XaoIX24/pMGIgSBoZqoH3wo0sIIGlA9PWcCPrAtpPB8eBf6x1o6cHra+2+tpIFP4PgBfxZtZUJfo4qxELT948D9ucK8Mt9+ccjIQw6QJcEbrD/1g340ATuDgDkFfx6twSf1f9xvuBECYxq/7ythQQGm+5JDx6Brw4CkMGT3wgscCUoQ4sU2t6DR2ciBjTgtcpenQoZVX9NuL4Owc+dVaDursYVkVALX+shjSBKBuvCYDUZjE5BdNkxdHAUBexyHwB6NP7Iyw7sxUDViwge1t+mz8B/LAvVx/c3PeBBCToB8IUGOgqA3iV4yUg6UAOxaUFHDx6CYS8SorMOue0CCJGAf5YfRhoAI+A1CvwxqNkAY5yAIx2EQmkFfeWOXi+nEdSQQA0ZHMEItiagJArQxDXIrj8nCfQi4HZPAttrIahso9oPQ/2/JwV5JQU8zw+7I4D7/sBn4EO6rjw0FR+i3Z9fHtahzsFvJgM0X+tmVH5vaYiNDGAigewAz+gyNLThnjCURQFR1b9d3lZvnVqmj9mEPDKIUIC4KCCjBXywS4N+otp/Hk3QVthOkwEKlV9PQwXjT7s/zwF4Qf9toAAzFdjuaEB6S7D1//U5FIQu2MevO0rQQH8ZmoXE6B/IkgE60XCjVoq8gt2iCG0S8L5GdxkM1cGsfsCMArSCAnrr7dzAZxCEEpepvB8tqHJ/q+bmJGGts/AcAXFOMMeTwC7Pw0B6CtCtA2vWgonqBQJFSwH0JQK29OB2kvgj2HHXAoyeAIsCQO0kMNECAhFMqCBf8mElAkyBbX1tJQP2RJ/ha0gpAfS9l+/5n00CkrQpq0MZbOdAuxmMvHswog62jZj7BnYQe19b14kxNq2D/ehX/p68HEcF+x3yP7z/V/A/q/5DA3i5A/dzA5pdgbKp3v3/wQF4Bb70WkCTHGRAA6+KL0bFl6FJaFw0ImZwm6igSwbbwPn9RMBWf3sN2JgA/BVh/Rg0kQBgePf6HglAHLFQwqQQOwDjbdVxNZjR4iM6Qa3WxwvNxh0JFb3g/WzFQQS8b/ttKcDWoABtUMAd8j9hf0MB2uDXhzX4CHj03L9DBU3Qjz0C0l4mLSLQPicOOwZoVCB6P6dA7nDbGkVuxcNr8PU2JQO4wX5trEqmccZaHU4q8oCDFOpzAnOwqyMIMktNNNAHouDGxO37DgArQZzlmp/14W1QlqHTMaIIx7SCx0+5yza7AKJ3IXBrNAHVDcMZAU/BT/vgv/ULPOA+XiLggAREDF2g0ci6xNDRglegd7P7TWWH5oJfayliEg7bScQRBVgI4Ookg/F6rvpLWP29swREqA3CaG8/FpKqS8DTAV4TiBqIqtxfzaQRLys5I0XEFIFrPbZRQb+16Fgi2LvJv8EFUPW1gGfQv1T/F/d/HBnccP7rAwnIIyHI4ArgWeGbU4eHy6Tx/EeTZIb5bo/BsMBjmjBE08f/RB0PHYBd9eVRAGY7cHRwiBf8WeCPHY1bgBTa9xKTELzEkQX9CPtl0gJiqsAmCT7I8xbjivh3JGFI+D2nBcSJQJ8agDX+O9iBL7UfG4bzAkcaICrbtYHz1ycSmGmAjJfL3CMgT3tQpmrfB7gxSzC1DnvdhQMieG47u75+kTouKNkM8c/+vq/Q7ZYjO/hhVvRq8F/9gGfhP8aqE9EIdR6LTwJ1h0BItyDqB8iFwuNqASscRnYioxOg9ApvnYA35f8e9Ohbfe8J4rknoFkO0lmA2gmAG0YK0DkB4ieEjiLoMD8wBzom27ANZkzIoU8EMHk/uo1mzeVoEoRWKn8L/62EYAX/lsB7D/LXg74uAMr9oGivJ0CNJCGD6i9DhZdQF+gtOp4S+NODRzsDVbhdgv4BqTMNyIL9SCKwL9/FGPp5oQKxIf8A/UX6r231H7YIqLML0Ae2GtrADOvRQH5b/MPE9dt9BGLNG8jVTAQvIaK5TtvvvWQgDvyXIClUA78S9Nfg7VtIBlO7cbsEYkQDMot+ygQ7QwmOawTHnAM2XUSnJvPIYRYMmYPS+sv3J+cfP3d04JYIXsF/EwMbBKB9Q9AY+BiSwFj9mzrSXmcJhFPVHySTbgHJCPvRQ/z7G/SVUETsg0ZF+i3CRoCjhf7y1A9mOiDD7TwdwEoEXjLwAv+avLE2B7Jnb+OqDpBoAchoQJskxKnss0vu7Q2YhcDv4ySeLOg9GsCKiUIihP7yfW7zbTsBh0TQfN0iAWn9f72Z56/Ax9P7j5OAH/Qvv3/QxKfk0DgDuP+R3USg3bzBC7bO/QT9Eeh9QvDPG7glBQzJwK740lAFFgFk8P88CqDGAa223YckWYhr+c0BPdwetl2ocnsfzePAWcVnnAIp6gDVhDLyfV4nqFEDPxHsbWD3k4BDkN+pARqKMLYBPzYEvxp9xmCHQQdgWH/9EtH2TIFpu3AH/cdGydv1j0TQbRrq+D/mLcX3ZACZ15bF378CG0My6Kq/zoGOQwhASDFwFbxyNGBuSxbCEhQ/uEPe/6gAERWQObCVVfjPpQX+rexxYhYFxIkgpgX7Y/vPs+Pvxf9vwt8kAs7i32t3QCP+3SPaTwIytQXP38u0PESm+YER+o9B3vr8mETAUfDrEkPI80ck0FZ0dXh9U+HRbhey0cAc2H7A4y4egoD6y8JfkBiigLdFP8v2W00E8deT2IeAKujZ/QAVKpAtKI20gLWksHedfgPcb+0+NEHefd9vB9rayi8h7J91gBbaw20MsnWAF5xHkyDUCOoXp+yrOwwxcKj0aL6fFppaaKDv6OpHR5sgx5BAlK/+fYhuP1D196o8e7lFBaKqv5YIMnFQpd0FGVR35RJCnCDaABaXBtgbiSwtICMtalKC+1JQ6bx/PLcDPQL91QFodQNKpwOgF/9eqcBxBBqRcKAAVk+ArQOMx1RYGgB6naDhlK+uQQwJYx4meQbxtNnYQwMjt/d4f3M9ZE4UOld1LAh99fbfzOxiEkKFCkTJIUIMUeVnJ/9sDt8/e1NEJOi9oVHDGYhgnSLss9DX2IAqw1zALUncKcDr0FB5NP+0cBQNrEezDiyiADPkt9qGpwoPdL0AGPx/NOKeyf3b9WJNdfcFv6bKd2cLMJVfJ6Y3B6wB9WFUfWWEwKMfGiQL+3bz9XGQz2EHKhF41GCtZyDi/gUCsNhYoAr3UNJ58YidHKqnMb/6AB5J4N73/4L+t7mAkeeP3P+1LNSB/l0SkMEd8DcEuUlguEw6t2AU/PCE/q++Akw6QFf1u6SBrj1ZnnhG50AfkoGIdf7gJv1KcSfgzWWkQ9U33Z3tHXYASKJ9e/YhU90rvD+q9Ej69/wxYJVs506Eg/r3DkMDzEdDBRGgcZay49XihLA30P+l8N+hf1f57/0AoxbQbwYaan/rBMirE9Dk+sBzTkC8JNDEUlv5McB8PP19Y01Gayep+hC/2zvQ/2HGLAurowsNGlA1cnqGGzeH5weiYLZm7h3QQC4O2tXdhvMMk1ZS5ebpgI8eMrPvPGkwaxayk8Yc6PMOBPEdC1XZ+2UfbfOPtxLMQQAG9BcZFoF0gp/RKjxe7+oAw9T7ZPWhgedodgz0gf5KBtrtIZhQAZpAV1Bi36w6t98qVfH7hqGI318lLCjLCUFlxRHwqYEH9a2qb4XjWvDT7kBwfbZA5P0+PNuRuW1yf4yNQH3zzwv6b70QOJ0G9OT/dhoYRUGT15uQH/71MjQLtQlxfDuiCXrtM+SkA+icQdH6sU/xz7Ze7FlubV4TpoTQ2osdpaEjtqADmEU7OkBEFoLeC3IWFFeswJXKXzkboNL+wzcFHU8hTGKIboO7CLi1/P+5F+gydQhuvRbwEgxvtACmANikhLTbj0gCYk8KdlYgmj+4Ymaod7TwahwadICuX0Cm2fE5iNHPK0x/CDV66Kyg1MnqjNFBnhBoLQCgUULfaVe5nq/6EQWY67bXCszUb+7232fVPz51iGB12owK9peyP1T4raMFF/OEYJP792mgXYfZ04GHMAhBkCSmSj+dKqRPgVFGHbpLEGMiGFeQWfSgrY52VxaeDUPSNJI0P7NoisG729HHl78z6hxfs9rV3m4JjgM/lsui2qmThjCfDFSb+I9vwUqG5wwL55U7C+6ot8B+7N2o6r3q37T9trfpjgmTvv7PSQATLLeRAOZhIJHBQfDQQJPBdUwEbVW3+L08EcEE/9G4ANrCeWcnPKRHDupbNynMx5AA9IRYLmrc/YLSiD5EaEBS/s/TgnU9ILcH19n+CpHwegLejx7Mn/d25fdN+e9U/1vgb7bqf08MOtf8EXxaoh+GY8L6gDfhvs4i6HQ7seYI2sv1GchdMsBIG3xlvxcCRzdgCPTn+6q/TW00VE8Q9FaFv+R2VlOM1vm/hhjhDCdgNflVKME5B47I9xT8z0YgPAJ8myb/LqHy36j/Mwqw9AALxuO1JVjiuQAYLcFzIhiEPe05fk8tRjGw7yWQbsfuLAT2VqOId1osnr0F49VM8INACPHDoBz4B5mqqSnUgyh3ArjXxfQH5BbgUS8gP7aU+w0zHD9GGD0CGHf+P1p/DeivlhU4BbxR9a2kYFR58YaDZCUR2P0DMmgED2eg77puegy6PgDphEB0CwlG/i9d+/Hs34pBEQrBn0W51mqGnJAk3ACCHeiqkQ1XFQA5AlKH7Lk8yJKWY3/nym14h2C3JvxeMwD9ZVMz0BPMi1n1RbKl1cYhIVblF3G0ATsRiCMUvoK9//OgcwYMoe+ZKOLlC6/Xk50br9NFz9fanqA8UIYSpCwlBO4kHc4WLLBfBHVaKwKgLQjmP4Un61Vq+3s7Bsyi0WztmLjJwJwFeE0I2vD/1Q6MVwefxfUf32skCPbCnxQqf+QMPEUDHZ7vGeyj020JgkPXXwsldA7SYR1RE3h94NvNtugswcgxXEkIcBPCGZ1rmrgDC0A4K88nm2fn/eTnpQtWyZfybRoK8Dro4zYDIMGsf7saTBzvX0SMbkAD6o9CYbsfMK38cJKD9l2FJt9/VGs0h5Gib33pxMKWNsigFUh3G2un+/N1WUglI/EEx8fq27vUNnwsiOoKecL7kQS8VnWAGCFUgn6dBtQhv40CmIYggwK0uwDHRGAuBXVdfwzHUjZzATLMAoyJ4FmBhzaWBlrHld9CCWpPHRqofBqMReMGTJ78q9rDes1Tv7/0m0v0AFHXNR6P6g30SHivin7V1BOhh3iWPwvps/yE836L2XiwnUT8x2iHgfqhnwn667QHEE8oLQjEvtEW7GYBZDrDVkwNIO4G5GiBDf9fGoFM6n+vbEtzXwP6u9AduaWnGYSLAlVdl/AU+ikrSeEIKgwdaZ4AACAASURBVKj4/wtgHcHtdO2nWKcBkPfxcvnNQvsj2Me9f02r76T8q0IBn9OLKfz1HX8yVXQYGoAB/2UeBQ5/5kCL6+H/OGGoRnLSwdd3oH8r7KkGTbgIxEwVWvnF8KOpHnyzfF9Jod5Px+IF1h8owyitDw/XEgRb5bPqbt1uvn7qBIQ16vtS/u+DP3cR7CH0WWJgd5mTJKYgNzoGjQrfvu99NDBC+bnyW1x/qhTatv2OaMKgJWPvv5kwnMgxHYGFRtJW8VMl3uP+MgoqSZyWFKr7+KIDw1d6+IiOgZI4+d5iYL3imzbgyO+tph9t2oSBxOM3ugHtPoFZ1LM0hF4kXNEBssvVgPdjdXZWK7uKvyS3q1Xb1WQwtVDqSUggq+Vw3t56JA2cz7PXOwGNW1ecwxPhfe3QEUsDsFaAz8jg0nf+iZMAHNg/XSazDuC18Iq1HBRrOsAQ8NLB+16g614jmuSgs3bROxE55D+WDDQNA4ivdMJ9M1b309UqknaDU8ObV9/PwmMPATvTMAxpABLBzugUtV9bLdhNDQA+7B9tQJ06/7QNDHGSwtgZOCIA47InIoDdROQGtt0U1HI3GaoUnCnC/rzBMQJteN17+VaAzYNA7e+PFqHQUyXPUYB7iQYa5ZFjq1Zqpx8Uqu/XT7+6BWC1Xaj0GlBIwMoHu7UzcI/6/Acb8KIq+hzmGWmAYnADrIpvKP7TZeLaf0LAeQkGgebbq9FToI44p654F47tekKkI0L5PQNZPsDwPBpy/ni+wKMN76Vav4+2cFZFf8+JwAraMt0DFB7beA/u4Zz/a+RXx0M/ct4/jwaNAS8G17eSwmta0Fhx0VRxJkHMivso+onMXr+YwdWKbgioy1jp4x4AzIKg5lEA7wvHEYCRmdx11TAuT6lDLVl4KvXkAET9P4RT8H2u+lg9EPQIpw+/NpJ7RwE8HaDv/Mu4f3OdNkq/EfAiEiOANjEALvcWL9gfFV4NZbgbQc6qPky4Pm35QZxtH1f4j+P/jXuaYPcWwIEH/fmEPBoAO4m4LGxV3txOQqDU+dXgey+UwSzuqP++uImO/u/6ogCb7wTc1n61sL+vZi87rxnrNas+giTg6QLzaUCjIp6JfhwtGI7AjBBB9JjDY4ePYVR6ZPgN4owVv6Q2N5hhVHwNeYrM+w6dN6K1sMHZm/Ce7bHe3dzKr1xw1w4JrSQMZtgnoQHlr18fzunAszD4qurNUg/TDqzx/lfCaO6t4tACMUQ6P6htWjDPC1hCoZ8kpODzJ70MUR9AODcgwyqyPhmE+wfHYB/hvSqt6qeXUShhXH+d9SR8DzrDaZZdpSp/HxqLMQuATgDU/qDPRgOIeT8cvz/h/XC6BtE7ACLOWPE0KIS4UUjmZaJ2grBphiWgT41BUVWZfP3AnEIT6OrfoF122l2rMycBoU5i/OXoUZ4/aglsXwLzHNU++FVF3qikOj5HXm2PBitT1WuvJRAB+6O//W0/PY8vQH5IrAsMs/WuVmAdHBrQgrbOxJShXwRSsu08h8JMBpo0+aDTALwV4tbswgzHrftG/dJKIAQb5h9KCssWIMeto+GYqG12/HWGjx8kzqNJaa0noMWOr2KwW01AMwJoNvhMQda2/RKQP/3ecABM3g9uD6BY68Ntz9+nDOMb5iV+hIE+dP/Zs/wwJhJ9mgBnohBuStABUXjugF3hkXF9ZZJAjefKdHZCc389LoStKvIl7QIEb1d9RyciQgFDI9Cjyccc/23Aam7/PZJBhgDgin5CtQvbCzX8ip9YgIFtOAt+w0owp/hOiCWgEGbVHuYjRigPGR/YOnEoqPDoV5z5YqB3mRq2ox5ICmSSgAP1Ne+XV2NE+/vuFbCTRADxtS70VRBCjgBk2OyDUQiUgfl77b7DwaHm2rAZ7osRSOOUoHgKfNBSLI767+oDYrfwZvqChSpGfj3pFwZFsCJg2jeIQQBUiyI4WgD68ww4qO8khuWkkIuDrxWv2nv+UTBpJYiPd0KemTA8qqFiuUF1jWS3BoG6pADJq751JqBI0wvAVPyMQvjcX1zbELltKK+zBiXRFiRxG+b7q3M9xuLdzR8g0gCGNzSM5gNYfqGO9CBT8OHct6oB3KsSDBisUnwsFuISQaRHxDSv0vptt2oeLHMERfRn/FG/Cx01EpgIQG8LP+/i37PKw53xn6sYCM4/JwSRrCnIeB1ZkLsawDhaPKv/njU3wnZ/dBdGE8+YTHSG8+ofGgIjsC19YnwdM/KAnTSsqj6ig7uGgIPw3nYFzhhIIvriAxFP9CQd4HSlnzgxONIdrE7A8ZDPx9fjib8ifgegNIliRgdx95+E1T7+3nQVNNhEzDgGA3T2rEDLduwtPpuuouPcs8swwXFjdTaMKt+jA5gUAQPcf95KJQxYU0cYxEDvsBSmYuukp7AwnqniC9Afa5z8vboI68ImT0t26CvwBzSggkj447r9IojvCn7U92J/Hw0QSdwZKNNjxPCfSxRqnATkdwpOwh88oc4J8KTSm/wdbZjrc+4iFP8YO0/5JJDCfaijK5xVXevqfg6zGRrQf83chvX4aRfAE//6vv5+6490U4ADdO7QgM/5bcHP/n4OtCQhBEFeDWSvos8DPq8/IwzLzjpa8/U6MMSkBklDm8e0mn3QIY7XG1Om8wzN48y7HwhOK3P0/ZwUQHHv4psbdoVeb9VlAjChBCdtDDpOKTh9ZfcagOYq31RFjN4/gwBYzp8lAwYNwBELhZoxECeZxMlAzWGdCRV0fQWGHo8+8Kx+AAxnCIzowAxy9KvNepWfsfp4RR9kUrD88CPVTuXRybhqqTHcnxEGndsgub1Gdug8yz9fHt3Hpl57x/mfCOC29FOSQ7/noAZR5W3Ob24UMpuPYAYiQrQgk1gnFoUIKr4vKFpV15pHUJO3Y5rfH3UFHU4bGkU+NKJ9f2hJyOMxDBDpjAgwiYqvk5TqNl9EH2Arb6fA3yaA4cBtPWewhkEcIQJBlGzYp6zRmr1v+e3Fv27xpzvyI44NGDkCIi7CGNV9Dw0M8NtHC2vUwHINumCGNG8erxOwtQINsW88Tlwdoc+F85nI559ngEDpt2F/Uu3hiXYrkN/pBFS26hYDAkFgErMK67y9mGBA3L5ore5izf8b3n805MOq/t7XU4WHv1DUF/5gugCSOAIW/59uMwl6CHWAib8bvfxWl9/rBGEMTTwDfG+ezEYG4yk6FvRPuPwE+wvc39IRjENWM+/cm5b0W4Pf4WuKUnw/vD6eDbB1ETs5vl77Dhnm/51g6wPWwQAqxnivgQaeS3gy/u/1H4hpTPrIgHAN0mSgXUX13YP5PMIuQAfBr/f70cdeE+QoCX3i8nFMLcAjInBoAIYqt1LhC1WdtvmSab28AYffaeivCB+ohdYQgfUa/WS4ToMsNLHLc9nnvPZLwn1/EefPVf+U/xvnCVSEQEkEQEnEQJO7S7RvYDxNeNYKrG7DKMhtsQ8cMmhgPKKKj+F7CiHYFR5KIIPxOmg5IVAtu3ACQSPh7CzUQOgAej5CWEkIe3vgxz0ROGO//qYfz/dnLT+ZxDr4QW0eNCJBorCFOVC312Ec2TiY5Bk0cAaQmiA1VH1MOwDHQ0kHdEDDf+2UTWhS4Z8diQMicLx8MLBfverLcP/jQzF0P8EJj5+NGK9RCz755S6F/f1+X/gxeP+Wsedv+vF8/54aSPJYFjIQd624MDz/UDLQnr8HU3ztKHRf8Qeno1vyAQJBaLcMtTV3cvgP56COCqd/QP9xLgBkH4BxO13n4hNUDtACC6G1S3zqooZ6Ba4lp/zcAFb7iERKQwQcF39IFJjdXECGADw0IE4gg674pYAnk4HoHPx54tD5daO5vxrugSkMjgiiqc7TVKAT6AT8R4ckbHEQCYR/IZBxJgA+XZjsR7vaoRpIxWqeqfXuGC2CxwudicwePEB1kNkaZCuwyF0DuKv/4sz9mzP/Qxdg3BDkBTMC8Q+loD6UGBzx0Kz6eAX/KArOQTlPHFoI4vVtf4rNuLrca9edRn4xBP7k8w+9AgZCgBfEUZWfEs8iFNZ3UO7TqmkjCO/rWdgco/yIqHcQWaC2EGTzgz5y/iXQAvyx3riyxxV/JeBriaGB9OrTA5g9/eokM+37GszqfA/UZk9iW5UnCtBqBl3XoNN6Ag/+zy6A5evPAp+TIFDn15gQw9rjrOzFX0s2JBVAxa/nP1a6AsNWYGjPNGPLTQgBsNUFvOA3Ht9o/rGDN0tWOCcxJGp+f7++kkP7PxcGv1+GjkaLt/fawpwwerQxBJNW4b+PJsYEgiAYYdEAGIlDNaAbRkIgK3ut0jKByp+8yz23X6GttmBmjwDvChgiYLP5V/zhH6/110sGcKo5CkggCngxnIPoPja0j2B+1BRkiYJiviaLJqghDI63G2nAgAxMCuDdnoD0wIQm+urMB3VuAwbBrFGgGgnhAFqg9+ujKsLxB3qGCQNEEtPinIQlAj4WgIw7/iXc9V/x/yUWFs2KH504bAh4aYWf4TrTLGTy9YbftyLeVOWNfYNyt/ji29mQnqMAltU3ioTtbX343yv/1u0YPUBz6zB702tQucnX0gWaFh6DgPdmhXaapGotw0SFz1qDiTMdd8h45HfcqCPRUhA3+NmKz1l9teCPaMd4urGaewRitNBDdahR5c3AfQmDCFT9vmtQEwqAYXX4XI2n23Z9B/Yb1FL+LWox6wHGbZSo6FR1LzyG+3hriSZvWT6jfXhl2cmQZJDrAbuYAqAHo1GA/EOgD8eGcU7A8eDvH4fQBuAhBL/Zp/vamPTrRENDGLTV/7E1WEPLDlP/PwzU4YhusIMUgfIPAr6Dhv5R4y2r8ldFwiFoYHnmr8TAHbhRQSZOctH598ZYhqt6wP7q/ouqe77RJxvzFYaji/z4vna4v5cUMDXqDAJ5ytktqtBDckyjvJg04hl16LB0xFfyMfD77PZjErGQRRjYIfSvoAXntks0ok8MsUC4KARWnYPlJBeIgLeFrUgDOHYCag0/XNAbWgRwQuLAsaQwIhC1g7+jCNKuT38JfnYSyTi+QQEwwHeT4/dWHYxJPxfOj5oAnRQqgU3YgGZSOaDyK3n/qkDYBKptzR3oD6B4fyRKjp2AzSl80YR/3P+/1vBjX18Jbu+YsrMRgbqPP8zrDLTAaupphfeZtyPs9BPztpLSBZjowF3woYRwBwOWaqbev15b7X4RWsiqYiY6ZkFEIoUwUA2OrkeEQE8HYNyD/rl3m88jCGgO/nPW3xy8x4Q/HBcM1dYg5q8N+B/SBSYhtD0EY1PRGLDoKIBHF3yLz4H/gSYQJRETgqeB2d4vC8L2NVnQn4PoVJJAcP0inahAfdXVI8CFszjRagCTtRdV7Sr895NBpRKXIT64RMFw/iw5eChhEvmmyUIH+k+Qu3cLzOAN6ILlFvgWnx3YWFDz0f38ze9GlfP6UQ3ojEY0gtqRIEbA5/WgQFhsEuIeL75uTzvqHktAWfj/OD6sQXssROcGiRgFn0QVkld7OznMDT7CJKzhMIqxW9B+LCOQdH4uyxIcE49VTSeLj0wKjzcp2oDXQA8YoDEGBLMW0BJw+eAxXejPV/IXd59/tp5rVyYXDw5BlRetSpQAcvgfOwVM8ObzBq/AQ2wX4lwkQV3vNhYFfn2LFgaoDU1ogqsfqGkJYmrj9Tr22KQwBLzbLuzDeA9yzyJjVRfwegWq0H+FThDPA6ZhZwX2M2Kh4waovCzAWJTzD/qY00c+6PM8coz08VNqglzx54LfHuTJK7z2rwX35ABLg1DzsZ7Qv7l/f2yXDlbf4C/irg0MJ0aCuD0wP74MrxfdFlX7tq+vtRdCpvt599EG9Yz3V+P+Oj/n4zLruZHcJ7oMt/MNp9eD6HEeFb6/TMfbWo85Pb79HJo8t3371/PuIAZqMvjPC34nVV6ZB4hEuA7AzA5cfU0y2n6ux89D/35/n2/vWY5Bf0qwf3tPLISO1Tap9qzFB6eap/beqI94NCCbGwgqOItY3CGl446CaQ8i2Q9g0AvmgJOnBoAA0gu17tsKtKS7D4udgCYERy2QIceCX/P7mBW+g/7D9S6Mn50CS0eAoQPDcBjopIA5+EcxEjLweRjXq0UbLIjcBxsGx2IZvlf0ATjz/6qypAmY7bhrk4ahsIis6ccXKHdueAfUgk+RWPCLh42c6zEeKyJpRTdRAOqBbl/Wq/uT+q+Fx3FoTIuCzc6+hN8j4veGjuAnhSE5gKnco3A3XwYlq2sq+lmP4yEOpqEoG0M+mGDYuYT0pKCFHgLHKt3T7T9p8GcWH+n1UwGa8X6kQt2x4CeqPexegT6o/Z4Cr313PHdgrsS2ZReLfpKIf+IMFnmVmwxQ9AhithYT73+p2s+JIVfrjwiHnpAZrSsr9CMstQXP1+1+510N/q8E/YoekMN9OMFvi5LvkRDsy9rgFCOoPdpgaQIWBZjf5KCSQszZJ1ivTvLokpen6tsJAVND0NFqb6GUGg2Im4Dyx9Pn7/0dm4pADAslJzTv+dKNrAPQ0wyySm7bj1RQgbAXsRa4R+mBJzpaQmHLmy0BLoL+Nh2ZRca8uUc6P37k97n451fvTieAE8BdZ2ItqFEK6oOJIYPsiU4woo140Oh+H/UC++gatHYcOFT+2y3AYvD1rM/fpxdUcsAi70c0OxAEP45X/hymE9XeoC0zfYhbcqfbhs09HpwnKMDR6g0mmYyKth/UcLl9ITGQ8N1S6s+gA1HvQCc2pluPvN2Br8SyZyfyxPP/VhCi1L1HWX2CQCuAE8TIq/sBYdANZmTIwqq0sb0HIzhhugBeUpBZLFyA8y+EErsBUYDZHYN9QAAooQwOws+uQlhdESSSqk5Qsh8LSYI6LDS1AbmOvLlRBqQIeITvM36+TP63VfE5hFClCTr9zEyVFwS3STQBy66DMHB+PJWIrfgGnYBx2dTboPa2X49GaBVlePA7CFx4iaGi4ns0aLVjMGvtPTDtmO4XEE8E5Kb/8qYai+NHl60LgAICcUCoJPVeiYG6Pxw/X9VFNVbFn9FNPzXoIRDTyzcpREYB5Fm1EQQn3KRi9wKApR8Tz48SwxnV3qM0q7ZhpdKvr0zfY+gO4oQf+EGPFYW/Xf5hwWsUgxiBbShGoGIx+D2eH1h2EeR3UQMH4zMaUKr4033nzkSkfQADelFbLOQCalxdxvN8mInhPas9bxtGJw29Fx3Y8429MAS0fL33Oeo7qFZeiToCC3B/VSNYuU0fgDnkhxGgMFdxiYEY7MYel+OHPH30IMeVFK1C79l+QdXVpFqHlMAXEf3EYDyfkkGdNvJ8f3RAXU0jpgM7jMNA5yCrtfzOicKG/M9bgEkEjqqPPDEcDfqVwGZv6zcO9avDfOhf4OmLFd9OLBHHdxp51HvOBlnAoQksYjASA1xnIhPsapTCPjbsGB2YevpPpgM73EYeSYIftgPgte6CWesVBB9QEgfnWYMgoeC8ql69bWoRIqYHvSIv/u26bj/jdqZ9KSGk74JRo6QS9PuTiSHm6Z62kLUGH0UO4rwWrhtRETkR4iKRdI8giJ2D2nUCMjsA0TXiVDb98NAf/rCMlajA9wesWHZrAe1dlwRyVI2jx4KkyUHSx7YDe6YD4tOC6XW01puEdAJwaEJzf1uATHi6ZlSCpBQscsh6C1xRcWEG4bCFeKcAVhVlDu54JQIkTT21hptIT/Afk0kMcS9BKfjBJozcDXCrtgbWXxbMAw3INQIxtQJPAGwXmYaBbYh4SCsuKwLOAQ5awKskCMmRg8P3xwlBfbosQaDqyZqBkyQe1CLQACoTgN4qbyHsPwkTiF2pYaj6MAXBmUosQHnUEYCsBL3MW39SNKMJ5PfoBsT33DVJCEbFnBCMOkHfvj6Xq8uw+dgRIhGgAiUqf5QgKDFyhe8nnYrlqn9sG1GoAfirubygX4H+8IM1CmQrMFAJ5ExzKIp54nPoVU2Auh6eBShDlTV4u5c4HE/fVvjFrsII0Ik6QX+Iq68jB19ziLoKC27FYe0gC+j1RSS+BgB7AvAM3m8HLdy5fV60C8RMVuhD1ieQB32MCCq0QPJuvuw5IHF/geMKwOPdpmsxBwVEfGEOgeincJqNmuSFIPhPq/xM81CWIIi+gCFBqDX3QPYd2OcCRo6GZBoA3AM+00aesAOQ7/2Pe/vBCXoguD4OBD1WfPwClzcui12AuH+gC0gEwW72KfjBCQRBr05D0IQc7N8PzOCMehPWK384MPVDJQim7yDdoiRTItzzFV/ZOX9sYFetP0fsQzb6O7wOoFjxk89YoQXv+BmSN+yYHYO+BsDRAXHhuJXsEFbdIEGZQWUkNVNzGA9NZUVBIQL7jASR0AclE4Pb7JN3BO72mG92+o8UG3nybj+mASh0FsLKn9GPxDrEcS2Au35BzHO1BksriIJdpqWjKR1wlpR4fN977rZqI+XbYjYDgVDpcYQalOYKMiuQbB3G6Pu/HlMbi9a0EMkksXtjvvXTfgMKAEZRN/i/O7yD8Da2S2Bdh3ICWfp8yuMkYl5a4df4vVWt4UF0yyqEnaT6swYyWB8/j111Y1ERS9oB0SLMtBGDEBD1PEHwtdjUEAHnqmoHU4wCDAoAS+lHwtu9eQLUAgmxVvAuMB9cELMV3m8EUtcBYYI9nkNIEEJYrQeUHfnzzRyC39j8CgSkir/E0P2odnAmAqDnDIhqrtV9BDNS2POjv/0pwKr6z1h/PMz3uf9ykFYq9TtoAXSwpz0HljdvBCVAPY6t7osv6gFhMpkX13rcfXQMIpuTsfTibkfOPRAC2meLRipI4mDPwMD5x+v3+Ey+qEfACwoUEkKQSMZxYJDz9R68PyP43yvo2aYf881rNQbZgRU/jp80QnW/hdXqJxMvCFxXQSNHpE8QiF4XI+wFfQcw7VL2Md7RRajsKgh2D+6SLAKPF356+/7yXYBTUgFy/38StUjFHweD+iiHh8/LV/i/TSvGk4L5x7F6AsIKbgb4C0YjgdGRIToGUx7cgS3JKP8pRcgak95BJGQbjaJdBYQ1qHYnYHL8F45QgHx2gLMQ2cDxBD/4SeR0LSDi5XzPQNjM4ySE/HGG6g+ugltLNSARn281BPtNO72eJLjdX4ITSEgpQvJYFEUg24f1qAYQNQdxx6Q/RcB85j9f+03zf2QV33IDPHegNgPABTfqFR8cZK9TA7/ll0EQbUUHW8Gr1d+MSadia+LRHwhunv87yWoJ3h/pRDwJAbDNQQFd2P2mH4kP/wDT/ZeN3CK3+ZjvgVpw4r20AMafb58j4N1UMknuj6iCx883PU9g2VHVH5JX2eEcPghSgRBCKPzK0Q3fknwPN0Hk0CyC0zBkz//7duEetgFjVtypASDI4CsknYJgYDhqsBxxy29+eyxrAZX75EEf8f+CkOcijMDDHx4ASYGGu8WHgPwpHJc0qOG8FgFTuVk0cRZVePFwHEIUEu8xSHoL5qWg4I7/HgOKXe2dcnu2SSdCGIDTA+AcxY1zYL6Q6AAFu+/1GvjKPSeEoJV3NiM4Dz9C6oWkEav+NWjPWXNOIkKgNTi2I8LeBgaZHJxqrC4oNXoB9pzzMws/OW3ghSyQJgjbygOVEDhoj4nHLld8HPD6UUMFVLIgKrTL7cFoBRLQgEdXIseZ2/HhFPKbk4d5tYWwwR0nIFQSD2P5gQhs6meVfB+Bkyz2fOIvX/zxqsSODuAGIOLtPNnmIPCrv6Kqvgz3q4tCwNl9lWYfnsdHj2HTgQw5IBHwULmfSu1jEV3gDFSxTBmqSEVqiYK2IkWcRiAkwV/cyW9YhqHXDw9dkNQAcO6HFNJT7oChfrPUYc3KY17zAd+evAwF2w5SCKLV4EuCEKsKfjBVWHu9Q9Arh4CoBqEMWYBsNX7YgKP/69uC3M7/mOOz232QT+ox4iCyJGEFP4oBHd+GVvXBwX35nqp7qeIbV6L6tdZub3ueJ+gBIKgC6S5gOQFxDoGr+Bv2nzqbknd7ph/EmXzO0o+kZdc/wqvQkAOUffVMzKtYgx5Vob1/+HAfCdzHSiXHenX35/2JTr3KZ9Ruj2lYiMhLIFoNyMq9hFroeYMTE0bSLbhb4l3YlFPa6hMd2jk8dmrDgdQCnC4/+ANFlYTB6ATlx2GDGXP1rvL+SnWHw+cJes5/rRWt4H2pw9GklD4uSMpwasIQiaYR92gIyFX5S8dtRZt/nCAH48VXW3hRE/HKOsGquj8EM85Q9cfeAV4XwNGAlmIFIwPYrfLKuxV476RRetzcdeAsRSZhiHizCKEIOHn3EMOWy5X4uIJnXX6sFiBFLaBm/THOQAkVJK9j6TKwiSDTBWpwHkSPQJX7U959uAkoaTUuug6oQCBz1Zlxm0OJSIoIw04M+7zCGuYiznCfHww9AN6Ir+HXA7lfn2oBSJ2FOOh8SzINfmcAyITq8JX/sOMPx6A9LeYtVfwgCBZhdu25OB9/XmWWNPUEPD5dUuJ68wd1AqD2+w1PI9KxE9BW5t3z/igdYGWiL7L+wPv9jgVY8f0ZcbCKCuLAHN+c5wa69Zpr0J9t2KnpAGzyiAIPiFalJ8/xXrrA6Y+/8NoDnWCPNwFJzf5DpVkHte8hx76P+HU1+HEytEeSEIzAsu5r6wPJGu6oLz8VrKofXLce+ywIHhNa/Dmw8LrptWXZ4NKZm4pr/QQ7Qk8ehMrPtAF7PQCD309QgRgRZMKgAbFREAfBBXNalbHA9cEHMo4IgIUuPjjBWEUFEQpYTkhVO43eRiynJw9Jjj8TOUIlJExK+0wA4gWgQvcFBHAc7P4/u78/Ff4CC5ATB3P3oUwFClYgcALcxzp/B9Ez4DUV8RjBbsCBrMH4dLNwIDaCGhA6o3pXksdBvYBsktrXDgNJKAFy1Z+ZGIy5NXgXoBT8a3ZgVSPIUAMV6DjLxhsV8wX4n4ibbONObHNyCr8Z4FinNFjg8ziiF5zSV8A99u7Zdf5OisvVaAAAG3VJREFU/kIPAJLWX3hUIFD6o7MD4WkHIMXBk4IftSrPNBJVk0OoC7ice8HGS8XBKDoz/YFBLaQi392lGpCMJfhD9xVkx5Xbj73P9V4m1j0v73x9FjDDPlYvATkgFAVWcdNvJBamliOjAwRV0EpeRymAe717kMYRyy/j5FwFBX0fP7Dyx8gq8wn2ZXi8GfGYR+lFcGJSxa3Y84WgzBHetlU4cvKY44Ps4iP9fsgsPGEhQTAcHqwwGCj61SoPexKwasXFqtxq8qhD9SixoBBYcJEDNzmIoi3J7QkoJActVHocTVpPBCDhElAvMDK1PT/Sq3DwB/ygmyB9GNhYDH4so4Foy48kkPtZfZEv1PQTxYpyX0EI3Bu+/5krcN8fgwVdwWu2JNVNWAk+PcOOPMNdGFyAZ5Aj6gicgzNfwuHZg0HrLxBWfjSRl88fVCo/apX/IBrIvf65ZxtEoK9Bec4KZIPLe76osQns46NwW0pUPCPAyMc4A/KXOwZzFLGbAqD5xhhbgBcWfoJBAlarcCSQgdQJ+Movnih4gjZQTw51rz588y/ZgxVUEAQ8soCfX8OR26JwujCLGFAMsOjnwGrlPuQw9D/PPv8BYVR7pG/eeFtQpsLzR2KFI8SwKj9KlX++HeLOPuSBKrKeHBi7L4b+Kx184+ptAp4Trcscv69oARVYzWgaK01H1X0K3zNSmARKtxXYHvwJuT+8gLGGWgpHcWOmBeljFB2Ckg6wiAYOqfxEK3GMCAj6kIiTWdCBCXhkjUKMgJcLk271N9uLSbtvvK0S69OXAvoA5z94VsFubbmZvx4QAnXgBnJxENyQjy38wef81uPhxMpPJIQzr5ckuUTKe0wZyN57iFTWga8GvCwlh5UqvYgmaNV9XSxEVWs40kkosFwA70RgNOu8mLZfR6wDiwRa35y7j08NksqPQhcfkRBK/J8R75Iz+9C8gJpqzwiIeZII3QnYOkJWbVEI5jNuA+o2BwK82ifwnpSgHwaC+GNAdmW2VXfC+vPu6wR6lBj84C9WfvivZyUhZMJlJhjSukDlFJ3g4AvGJfC1iEpQJ/CaEd7G9wds7p71+odruKrHip/C7RdsxeVjzIxhoNkFGOW/+sk/YVAGtltfzZAIfzix8gcHhZCXpcGN2u69qWqD9OlRFAy7x2fQBhHUiETB+DocqvArYt98f+AEAXApsEmEcNLC0t2uPHCqPQIXwHYDfI4/9+8LMpchqr5HK39MJSrBXwnutNqjovjHFdq+fcHLp7YLR4mGgduW5hFpAXUoL4cTTuW5HJSkB5PC0S7A+8c+837DyoM1J9iv/po/o3BunlDqPjOSO/YbLFd+FGy9sxKFeT8b+nLNPrkAyD53FtT27yUS32yqUaEGTMBiASGcZ0FmK8nWxbvjC1q6WQC4VdWdAcBY8eFoAzIrC0b7Wt8wlPcIdE1FhUWeKU1Igv8Q/0dl4k/NnYSxdlDon8diUDeuQB4c8XVzcahRgyyZmNC+LAgeCfSVALde8/t1DCYawNoePGT83wlOpFUdOZKwxn89OsMEf0X8CxJCBN/dwKbFwkSMgx0ACJJDJD4iC1JEYh6XcEqVHpx4+J4I4UiAl26r5x64sttvSlAn3LBuQCz6edU8C+J5epBrC4YP52EFDgHrCw1B0eU9bOaTgh3wmYvQV3Oqqcf53XnVNXUBELX1xtSgFrirlII5d3HFulxBCNEfZx0h7K2f34XwdHpuYQcguN189Ow/nPXclaUcqMH5leCXjKOjbv3F0a7i2ZaRHmBe5zwnhA9S736ZC8AH8LHkg/T5znYgmES1dtuzGo92qwHIquiWX+4KgVLd8utv9Ml1BQNhEJW/FOgweiTguCUoQHkEwYhjfQIgm8eAzPKzHqAG5xGiiPyxeGRRaYetUpDVpHVC1T9bHGyaknb/TQTnuG7rDYwYCUT7/cMjtILzA+Go/FPw581F/mWeTkDuBsBCAK8ki+A29nMzPn4Rzjv6QV7xWW4fzQFUxb9jQQ1qc28kMi4mDl1NBr4usIsz5ltZqNm7AeJXfuTHd7nioLEyPBISU+8/tP1AC4Il/n+YGmjg2NiBRdl6yCw//zG5ph7bqaBuz8B4VMU/TqSsNPbwCeZA1cdxyG9SgKzRZPL+GXFOiH1/SFZ9wX8M3zUgvH8a4rMBjZj/h1W9MrwTiN6MlsCKiI4gycBzgV/xUaQGjGDHwHiYi0VIzeEAasCpNuL76AC7BIEl7i4AIxnAfoMxk35eJbZ68wWEUChs8IPz/EEE9BkUoNA4RCWSLJkY1h0Y/dG9bVCtUVPe7QRhtStXG4nOECDfUxc4Uw/Ik8JkA9o9+a83IrfHH11EdFUWc4phNgVFWkPsIHBnCvCCYBSgqEN9qtoXuwHhByYoJJA7BxIkkRwpDGgAHo+vQ3ZGOwCFJCJKUAx4MBpFZWvReeLgtBBkDDQu2OJxXa7SE/P4ZiUPHABjY1DsFIhPAaygWewiXK72hHjow/k8gCL6gKES8qcDZ7A+EhYlWCPGCX1wXIwzkQEKt8cP6iqkC0FEhFj/ZYtvXCtwuBLcDT5wXN+9H6ZEIkTwV/x/s78fXFX3siWHEKrC3tw7EFZ31Ll7ttknQyEMGgAqCaVe1bGk8r8nFWCQQR0h7CY0dsU/mIeIuA1AGCo02Q0YVXxub36sG1Qgfo0CBBUXxap+ECFEycQVyViBEBFPt14TK9rZHB9EwMG7DPXOv0OVHkdtx7OSCXfb3av4CFZGTwQBwT7/hKPHE4PzpJ4L4+FM9r1n8B+B+9R9I4Fu9brYUZgCunZWNxdQgIs8mASBQ4F8hJpEiaf4GPihk8FdAxin/kybjZjTj+mAQy6ihZ9whDvHAWB6BKrBXQr+5SBfqPaINwiz12UIwoTmbPACZY/fshBBBKNlW8ZCHwH/cVKSOZMm4Mxk4OwE9JeB+EFkn1IzcPQoiSB4vGgNeJSoik1A7m0TCmE/HrggB+/1M12C1Z18ACGoIeH1pH2IhAqFWgBq+kDFEWAvA3X8tpW0cnSD5WAOriOHhnYraF1eLTkS8P/QsHUBdtMPnOrMaANJE9AZiaKWII5Ue/8PTHn/UcCSTgIF2xN4zdmAQYIAKeBFl6FiO0aKfq5jcImHfPwTxcEdRmD3LcFoAva1Hdjm9UgGggI9YOoPkOBYLsT8HlG3nucMDGkOOJ8CkNOELdSO7D5qqAeJYBb2GpABgRi2gxLITgrOQ9C937HgB+0i7MeRx3gfPWCXLtgbLJAu/gCFBPzRX8eADJqCvA3FViC/BlOQC4LZyrBq8BdQAOUKoKjqR7v7EFfVFMojPgEoSlJesNIePyLHwW9NRgq7E6HvUN8A0yj0wyWDHRZ3J2A1jHdMyu3hCGwSDwdRir7h9VP7AKLgPoMCgKziOFLtrUm8aIFHlgxYfz8WBYUU55iAXauo+evJaIK/NTgRJM9sUcZRzcCnMdNKMJc7usnAyrpxHYkTRHK+n1HxS01LheAHqRWwKIDqLvQC0+PupHZgBawfVGsiniTVHwZHRqbUI/D4Cd+ftgyLAR1ehkIiqaKFw7MJEwUIuK5zsu4svoFYCFKgBJZACBuppOId2RDkPZas8H9kULcA9a0KTCQDGtpnzT+RMJiOGseHl4BQ1C29AWUXIIf/OIwwqoNEK3SCuA7FRiBrE9B4/PcrGJ1OQNj83F4Xbol/TgVHfMiIZLAdcaVkgh8sLrd+liNQH/FqsNTfj15m1J0X+ffZuq/gTY7QnvIfJz6UzBJLs83ItQpt3RfZz5iuGfNPajpngUm0R8DoA5jDlzsOTAwZjzsC3Jjxg7H914PjlcskGdghgx9HG4OOQH34uwQyzz61/0qiYNQjXxECuWYbGM/DrjtPH/Mw/K+gBLLSA+cEfPr4MroArzcDuybbr8Zc72i2UnzeHnTgzD4Ug78SzIvCoARVOQxaFFR3TzWnkkHUVFShEuqKxZnKz4p4YYcf8ZhYhuu8wFgSHcuuwCJagI4bgchJQK/qe9c/RT6nGcg6KGREJpb+MI0EY/b0jcsni3AJBeCQNsBOFVYoApcM2Aom4VFgIRdHpeIG8D3YaxBD+qCiQ+rBOSVnci8hzkAG1t/pgHA4uwDzmu8xFKkkkIqCfkIRs204r/hiDgutoAAcowBMZ9+KS0CcXVBOHCvJw2jMQSJyeoeExF2DuTuRcuWAo9sefyUQ6/oBaIjPtiRH1KvQKvygAHb171d+vc4GRMDPoxN/kL5pwlVh1mBQ1quQJAJ5j0TgOAis+h8d3mnC8xTKE34+8sDNjyVXE6nFMN+H39TQDmocHScENvN74LoGScGU4f7g6IG3n3C3qnG6JBS+Z5tHOOzRYQx+u7MZmAl0OSsRLAS/VIKfRAWU92+12aaVPksGDBWQuCMvgNy2M2Mt8EwqbjosZAec5xLEAmXmcFTHiOWARWglpNpjdEtBQRxJJU5VL5/7F1X86XntXgUK4q+KggsUoIIK8oA+kgy4+zLaACqQGTVOX6MBWdehL6BxHn+tlyBMDGAqufd7WOX5WTJwKYDfXJJP2GXDPk7Tj5Ed7BOG7DMFaBRAJgI/+H2Ngeb2SKb0zkoGlQBHkefDr7xMA5HZeJPtKIzyApI9gmnPgf1c3mulfhe0gFekDCdNFnrOwi4Gs6eTACNjB+Uegcgojog4V25P8bctRYY6RL8AJklE9ACFAGZdBEahd4d4CmghFhbzcwaXYH5qTlS6DY+KfNH5Avzjo2JJ0poDkSCMxLn73H/eB+ifvgvyIFCWAji7BWC8hd0qj0FziMdrS70BlVbgamIgcmotGZDNPwm0L9l5iHv7WRoAFx57ScFS2r2iwot8oKu8l+TOCOg2mZ2nFdjTgOFQENzKkJ8OjEnsE8f6AzyXwT6MNF3RDRnuj0Lwo6wTlBMDIyqaz6G+RiLJMg/KUrQV/rh9uH0tWduwoxmky0kSMQ+rnXxZsGadgnxfgk1pCnsIsGYltvfdzTOBIclIsN8MLAGcz5gBwj94AE8DuC9Molip/JGwB57nRyJiyD3pyk6q5ij+3TzRLohcqyqCEQBTepF15+WVmW8SEr5jMUUkx3oMIsrH3ndwAQganKzyMpOJNxMQooGBYwcByw7axIhgPRGEr6GSGJhkAELoQ1YRg+dPeD5IIRDIqq5PA2Jh0Rq0YcS8XBi0ghGRFpCtWTdum5+yLOsQf2EuYY8AfnbQZDgCjHxBSKwTGpt8QCIDVH3/4H5OwEvldhliINwAFLsEyyIfGKV+vm3eEehVqKTdNxtDiPoLHCRiuwTJxCECxMDqDjTvZ63KaPKvRgV2i/F3ohm88V8LN8hgJcXD5pVGIPPNn9EBqSQC0I4AMxBUcQNCkarkFgSn/oCs9GCVep4eUG5BRAOcQOCWlGSc3If0IFqRfURQGRrKewPKEJ9sLnIowKCcw+f48N6UHjqYtgInaCCkBbPSj8VEkCr2g8U43wY1xX/BNkwreQrzg+oaJghOCGTU8RBxuIp6VFOGoEXgEsBLIgV6gBgxoLSI5CgiYNT+GBHsU01GthrceiMUtv9KgAYktgVNeGrBbtiOQVi9x8WjiAW7UNUnm4Vet7WtsFgDCDYEwQ/EVL1PnQf/xCDLTowTh4c4HPRDoQaiwhKIAae4B7xgCBydI/CDPOrevK0FR4p6w3VfoXgQiB3T1N8Y1PCD0X19JqcHGfzB5WkQE4p/kdeXBcEVUXEIFqSij82lMyrWq/7c+LFHA7z5/dwOHHg8s/Y8C2CmhbmALtare+4UWLfb25BmXABKABTniC8gRAP2yvDAiUAsElnrxFzITQa/sAFecAOY7zPV/8jMQHSbWAiUPGkQNABhw85xrSCv+mMSzFR8+7mjw01A8f4F8S/td4jnDHYxpT8/OEyV3gz2+GTfdAeAszswfJNGlQhEIjB0Bls0BKn4Iw7WKu9f1gmSagmvqleEwJwnZwjO7npz1HdCJ1hS/mlBcRXyF3i/M7NxqJFoeH27z7nnJaBmpUZKHsTbGUc1ALEoIGsGYl9ixS50gjAT/VhB8IzvGTrBVfWEz1MzAkRFTtecW731VdjNQPukVdhdn0Y8d/a7WYH6i/TBPBzUFwAlHwtGHOQISrgb1AMUgDETTA3+THAdeRJhg59V/Ektofa9I8wxVICkC7QQSAd2O3cftzPzdMK6aA4iZI4ILfYRbb9RgqICt2AxVnYZ4kkBvHOBxT/zN9ybHx/f5Ql2fkGCX6ANm6F8WCfqAS+Eq5AGcHJd2IFHagTMHAAj+mWBnDXuc81CjhsAi5dL2K8QCYI1aJ/PJtSSxEFXASv7C2I3ZB9/a0j/7nDn/j1pHsz9Jr8fNpxPBUAUUYD4wz5GBlmyAiORjtAIGDFwzSUwqiNZ1d1tPiB7/Q9VeI9KeJU16/knkEeQJEALjY4rkp74fCZiMDSA/PgvT/aT2gYgp5E/P29AKBQAo6TRth5T4VesQFb0i4K7RA2MZpgyFXCEQHCOixuYMPgy2L7+45ezSSKt2oUkURlpXkEMOLSiXPuDQZjk63N5bmzOSxQdLHX7AhwUEA0BAeQPJIQzkAuFlOK/GtyLdiGDKEBdllQ7YouxV2Xdwza9So4Kp5Z0yAgUhTlJgFzSFrznIHYIwKcCu2/L3LsCg6UI1b1/CA+ApIV5/32HqOIjdQusE4azip5Wc1b0q/QGIAlaWEJbXP3r/L+AEipw/+BtkQVY9fIM2i/ZhgVEgJO6DZ1ksVtlYdoQAPhVO0oKmYBmnAYco4DRCRB3TwCziptaE0auER9/VzRqKNOEYINOQg2m1l9GpGNQAhh1v6UmxNQh2M4+LmlUzll0OTjYQOaGlZAEMCrdhmBphaMBwBADrSQQc3//He8KgFETT7p6BHnjj2X9EXsDjrgBS6ihoAmcSQVYmE4JgYWFpp1waAQRoqDzxDhU+HxSnZHz/9JEY6Y5MJA+cwoWrt99+U3Mc/9g/NQTFaigAEtwB1yBzwzucZSX7RZEILhR1d5GDCsBLVUdIQvsldZfEJt5i/MHx2hGJZFkVVyK242iFeh58oBUFqIQbkfp2DV2X0CkAYgv1sU+P+I/HmBu8nErugdRnUWhfp+A/ddlbEH3uQlBsNobUEMHasK1HOYn8BEEvCUaiuigXRIKj+sGOPA4KAWz9/s7WxcgB4+a6/fI2osEwv4yOENAiPf+wQhbc/5f0gGisWuQaRFmGoIqguARWsBQgTTocDLMT5OJUQnhqdCEig+/EShKSEgTVV0MBMnz04BcshPnLk/+OaV0/dwKzB4QUt1NB6uTDfGOP+cNm9mEsBAFiM7AQh9AKVEU75vy68jeOxrUC4mDEuYO0oLqoSdHaEF2eXYYSm0V+oEOwpLmYFOF3Z4CmAeBTIGueiIw2xoKPzDBJVBXQ5g5O8/twwA+QguIjJt3+g0NQEcDfUXgO5gsqlTBLkQLdl86K3CWneitQ8sg/5oWAUJP2C3V3RoEyji5n4b9lB4t9pz2CA+cAFn1Z9I/uzYsU/ELtEBOCHYQQqGcFejV+yeuRJX31zsKV5IGjway9z6PLDxKwNEPsBuOEiqw57jGgOtZ1Y++T50AuMFl7hPIbhskiOwsATtRoc7rS7dXrpcgrMCGJca6ELJo+Y0be0BW5ZKGcFz4y8W9BduwcDnK9iO5fagsKpp9ANnvDPxeP8THNyIVFo1AMas8Qk5v2Ytm0LCCYAXqn+wQsPTBh/5Bcnne14Os3uCQt28vsK1WUESJFviBgAW//3u9PLxusXchcCR2WsNzv/ImvgZzzkUByDUAIrjTvmSHAowpJBQE4SUlxMxnARlQbIqkArVAJ6pBBvELCCKlkyCDAP45BYfEPfcUpfMch3Vn4bheYK4E66BxAxHSVd5INgEPgU/NBCDfNQ8Ho1CoINAPQAW/QT8OCIZlNFCB84XhoDChFByHGjx35v9BLgyhmojqHYb5QYXnuAecvua0hZe6BV9f7v4ibvgvamrmAc1TmaEir0LQ9h97eYAYVoM/nWA60i8Q3Ifezha9BqaaL3zvqd6IAuwwLSCCuCLuJWch4h30giPtyiAphKEBcCu9BV5wwzkMxID8rhMwdwMhcSFgrBT3RUTQboAUg3+p+Qe1IGarOioVnazmefV3lHpwA0AcLWCahUiXwePHWJsP+GH1gnp/we5KfOhJAbsj0H/BIEb04TbrTPsAyb2LLu93KwfCvn5PLAwrOXAa72eEQRo1CNdw5IprsAZ3hApy9zlcITG2vpCihsRSYxNS+J4vdBZ6B52eqRcQ/QXmSjAWSfa/5GA5qEg4iJFtm624AqXLrSA2gx8p1Mdqcghv41S0lSp/xAYs9gakQc4Ie2RTUYwYgt748mV+FU1Xgp14eW3XYZ6cdqGTNHwHICTwEeTPl0jEZwIgP9gDEaogeg5IHWCF+1eoAhvEKPB/EAeTRsM/pSAP5wjWEUMM1/NJRhwJbpJSgK7S7zF3EOsI5jBQBK9DV80Z8Y0COzvmWzJXgDl40KEC6cqvqgi4OB5cpgLFYK/1CvDiItXqC6/S87wfAUfPtxqfGNzlYaOjlf1IsHPPvffHgDAoEeEST4ZLZUd/RSo91/BjXY5ggWgQ4In3fyj4mUqPrInHOCLKO3wUwRsfyXpt1nEIRLrqcWeTuk7bigsbid1zD4iDRQtnIdQsyIXnFCn1I9D7ADgxEhOvR5AJosoUbu1FkJyYCi9OhQERoIx+4AX/YqUXQhtYEwKN4Cy1HntLMmtaAQpqfrT/UCoLSxeswjA5UWPPi0mjajUWxMTdVusNvt/ChMdmILK5IRMFu90BMEzFYHdg2GAgeYVHMMJIBTA7EFTx/5fpgTFXz9w/en0ZjD8kCDoKPNGwlB01BmoWQbh+AxR689mBponGJOr9OwmMu3dtJ/ylW1Tik4ElUPmR9RqII+pVhD9ychABMQ51gOIZg+/G+5mGIzLB1JJC5WhzYjhJ7IWmLDpA8jzsAafUPkB2WnFBF4iSxkq1ty7f25rv/+EQLOxs2oUdTSA9HIR9swdBlCcFe9owPC3XWDDC0ISVzsEVbSCF/sWdA5Fu4HJqankp2SeQCYYrImNalfmhpVxYrGkUS4LeSUjg8dD7+D7w/ybIfy7vlB9/HJ978zr7/45Qgajzj+4EjIK/ULHPRAOlKr/aG0AFcqCyu0GcW45Igh6JMJmhA49/U+cEssHNJhtXDC1MOya3j/sAiAGcrEtqtgjBD6wEzSDc7D8o6C8rIqAZyPk+NQoNLAZ1hR64Yl1FBY648smUYKnSg1Xwk/0DyRyArByMUobyByhCcPnOaPyoegREFS4jNfYAw+IHCjdC1J2WDZBke/OyN85J24WiXwDYPoJyYuCD238ulvuzwt6KgHf0shWKsqCFFGjB/w8HU8eeTED9wAAAAABJRU5ErkJggg==",e}(),Wr=function(){function e(t){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.roughness=0,this._indexOfRefraction=e._DefaultIndexOfRefraction,this.indexOfRefraction=e._DefaultIndexOfRefraction,this._texture=null,this.texture=null,this._bumpTexture=null,this.bumpTexture=null,this._isTintEnabled=!1,this.isTintEnabled=!1,this.tintColor=s.a.White(),this.tintColorAtDistance=1,this.tintThickness=1,this._tintTexture=null,this.tintTexture=null,this._internalMarkAllSubMeshesAsTexturesDirty=t}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t,i,n){if(e._areTexturesDirty&&t.texturesEnabled){if(this._texture&&Dr.a.ClearCoatTextureEnabled&&!this._texture.isReadyOrNotBlocking())return!1;if(i.getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.ClearCoatBumpTextureEnabled&&!n&&!this._bumpTexture.isReady())return!1;if(this._isTintEnabled&&this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&!this._tintTexture.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(t,i){this._isEnabled?(t.CLEARCOAT=!0,t._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Dr.a.ClearCoatTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,t,"CLEARCOAT_TEXTURE"):t.CLEARCOAT_TEXTURE=!1,this._bumpTexture&&Dr.a.ClearCoatBumpTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._bumpTexture,t,"CLEARCOAT_BUMP"):t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_DEFAULTIOR=this._indexOfRefraction===e._DefaultIndexOfRefraction,this._isTintEnabled?(t.CLEARCOAT_TINT=!0,this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._tintTexture,t,"CLEARCOAT_TINT_TEXTURE"):t.CLEARCOAT_TINT_TEXTURE=!1):(t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1))):(t.CLEARCOAT=!1,t.CLEARCOAT_TEXTURE=!1,t.CLEARCOAT_BUMP=!1,t.CLEARCOAT_TINT=!1,t.CLEARCOAT_TINT_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i,n,r,o,a){if(!e.useUbo||!r||!e.isSync){this._texture&&Dr.a.ClearCoatTextureEnabled&&(e.updateFloat2("vClearCoatInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"clearCoat")),this._bumpTexture&&i.getCaps().standardDerivatives&&Dr.a.ClearCoatTextureEnabled&&!n&&(e.updateFloat2("vClearCoatBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level),Mr.a.BindTextureMatrix(this._bumpTexture,e,"clearCoatBump"),t._mirroredCameraPosition?e.updateFloat2("vClearCoatTangentSpaceParams",o?1:-1,a?1:-1):e.updateFloat2("vClearCoatTangentSpaceParams",o?-1:1,a?-1:1)),this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&(e.updateFloat2("vClearCoatTintInfos",this._tintTexture.coordinatesIndex,this._tintTexture.level),Mr.a.BindTextureMatrix(this._tintTexture,e,"clearCoatTint")),e.updateFloat2("vClearCoatParams",this.intensity,this.roughness);var s=1-this._indexOfRefraction,c=1+this._indexOfRefraction,l=Math.pow(-s/c,2),u=1/this._indexOfRefraction;e.updateFloat4("vClearCoatRefractionParams",l,u,s,c),this._isTintEnabled&&(e.updateFloat4("vClearCoatTintParams",this.tintColor.r,this.tintColor.g,this.tintColor.b,Math.max(1e-5,this.tintThickness)),e.updateFloat("clearCoatColorAtDistance",Math.max(1e-5,this.tintColorAtDistance)))}t.texturesEnabled&&(this._texture&&Dr.a.ClearCoatTextureEnabled&&e.setTexture("clearCoatSampler",this._texture),this._bumpTexture&&i.getCaps().standardDerivatives&&Dr.a.ClearCoatBumpTextureEnabled&&!n&&e.setTexture("clearCoatBumpSampler",this._bumpTexture),this._isTintEnabled&&this._tintTexture&&Dr.a.ClearCoatTintTextureEnabled&&e.setTexture("clearCoatTintSampler",this._tintTexture))},e.prototype.hasTexture=function(e){return this._texture===e||(this._bumpTexture===e||this._tintTexture===e)},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture),this._bumpTexture&&e.push(this._bumpTexture),this._tintTexture&&e.push(this._tintTexture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture),this._bumpTexture&&this._bumpTexture.animations&&this._bumpTexture.animations.length>0&&e.push(this._bumpTexture),this._tintTexture&&this._tintTexture.animations&&this._tintTexture.animations.length>0&&e.push(this._tintTexture)},e.prototype.dispose=function(e){e&&(this._texture&&this._texture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._tintTexture&&this._tintTexture.dispose())},e.prototype.getClassName=function(){return"PBRClearCoatConfiguration"},e.AddFallbacks=function(e,t,i){return e.CLEARCOAT_BUMP&&t.addFallback(i++,"CLEARCOAT_BUMP"),e.CLEARCOAT_TINT&&t.addFallback(i++,"CLEARCOAT_TINT"),e.CLEARCOAT&&t.addFallback(i++,"CLEARCOAT"),i},e.AddUniforms=function(e){e.push("vClearCoatTangentSpaceParams","vClearCoatParams","vClearCoatRefractionParams","vClearCoatTintParams","clearCoatColorAtDistance","clearCoatMatrix","clearCoatBumpMatrix","clearCoatTintMatrix","vClearCoatInfos","vClearCoatBumpInfos","vClearCoatTintInfos")},e.AddSamplers=function(e){e.push("clearCoatSampler","clearCoatBumpSampler","clearCoatTintSampler")},e.PrepareUniformBuffer=function(e){e.addUniform("vClearCoatParams",2),e.addUniform("vClearCoatRefractionParams",4),e.addUniform("vClearCoatInfos",2),e.addUniform("clearCoatMatrix",16),e.addUniform("vClearCoatBumpInfos",2),e.addUniform("vClearCoatTangentSpaceParams",2),e.addUniform("clearCoatBumpMatrix",16),e.addUniform("vClearCoatTintParams",4),e.addUniform("clearCoatColorAtDistance",1),e.addUniform("vClearCoatTintInfos",2),e.addUniform("clearCoatTintMatrix",16)},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},e._DefaultIndexOfRefraction=1.5,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.c)()],e.prototype,"roughness",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"bumpTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTintEnabled",void 0),h.c([Object(F.e)()],e.prototype,"tintColor",void 0),h.c([Object(F.c)()],e.prototype,"tintColorAtDistance",void 0),h.c([Object(F.c)()],e.prototype,"tintThickness",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"tintTexture",void 0),e}(),Hr=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this.intensity=1,this.direction=new a.d(1,0),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Dr.a.AnisotropicTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t,i){this._isEnabled?(e.ANISOTROPIC=this._isEnabled,this._isEnabled&&!t.isVerticesDataPresent(Yi.b.TangentKind)&&(e._needUVs=!0,e.MAINUV1=!0),e._areTexturesDirty&&i.texturesEnabled&&(this._texture&&Dr.a.AnisotropicTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,e,"ANISOTROPIC_TEXTURE"):e.ANISOTROPIC_TEXTURE=!1)):(e.ANISOTROPIC=!1,e.ANISOTROPIC_TEXTURE=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Dr.a.AnisotropicTextureEnabled&&(e.updateFloat2("vAnisotropyInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"anisotropy")),e.updateFloat3("vAnisotropy",this.direction.x,this.direction.y,this.intensity)),t.texturesEnabled&&this._texture&&Dr.a.AnisotropicTextureEnabled&&e.setTexture("anisotropySampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRAnisotropicConfiguration"},e.AddFallbacks=function(e,t,i){return e.ANISOTROPIC&&t.addFallback(i++,"ANISOTROPIC"),i},e.AddUniforms=function(e){e.push("vAnisotropy","vAnisotropyInfos","anisotropyMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vAnisotropy",3),e.addUniform("vAnisotropyInfos",2),e.addUniform("anisotropyMatrix",16)},e.AddSamplers=function(e){e.push("anisotropySampler")},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.n)()],e.prototype,"direction",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Xr=function(){function e(t){this._useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this.useEnergyConservation=e.DEFAULT_USE_ENERGY_CONSERVATION,this._useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this.useSmithVisibilityHeightCorrelated=e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED,this._useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this.useSphericalHarmonics=e.DEFAULT_USE_SPHERICAL_HARMONICS,this._internalMarkAllSubMeshesAsMiscDirty=t}return e.prototype._markAllSubMeshesAsMiscDirty=function(){this._internalMarkAllSubMeshesAsMiscDirty()},e.prototype.prepareDefines=function(e){e.BRDF_V_HEIGHT_CORRELATED=this._useSmithVisibilityHeightCorrelated,e.MS_BRDF_ENERGY_CONSERVATION=this._useEnergyConservation&&this._useSmithVisibilityHeightCorrelated,e.SPHERICAL_HARMONICS=this._useSphericalHarmonics},e.prototype.getClassName=function(){return"PBRBRDFConfiguration"},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},e.DEFAULT_USE_ENERGY_CONSERVATION=!0,e.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED=!0,e.DEFAULT_USE_SPHERICAL_HARMONICS=!0,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useEnergyConservation",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSmithVisibilityHeightCorrelated",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],e.prototype,"useSphericalHarmonics",void 0),e}(),Yr=function(){function e(e){this._isEnabled=!1,this.isEnabled=!1,this._linkSheenWithAlbedo=!1,this.linkSheenWithAlbedo=!1,this.intensity=1,this.color=s.a.White(),this._texture=null,this.texture=null,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){return!(e._areTexturesDirty&&t.texturesEnabled&&this._texture&&Dr.a.SheenTextureEnabled&&!this._texture.isReadyOrNotBlocking())},e.prototype.prepareDefines=function(e,t){this._isEnabled?(e.SHEEN=this._isEnabled,e.SHEEN_LINKWITHALBEDO=this._linkSheenWithAlbedo,e._areTexturesDirty&&t.texturesEnabled&&(this._texture&&Dr.a.SheenTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._texture,e,"SHEEN_TEXTURE"):e.SHEEN_TEXTURE=!1)):(e.SHEEN=!1,e.SHEEN_TEXTURE=!1,e.SHEEN_LINKWITHALBEDO=!1)},e.prototype.bindForSubMesh=function(e,t,i){e.useUbo&&i&&e.isSync||(this._texture&&Dr.a.SheenTextureEnabled&&(e.updateFloat2("vSheenInfos",this._texture.coordinatesIndex,this._texture.level),Mr.a.BindTextureMatrix(this._texture,e,"sheen")),e.updateFloat4("vSheenColor",this.color.r,this.color.g,this.color.b,this.intensity)),t.texturesEnabled&&this._texture&&Dr.a.SheenTextureEnabled&&e.setTexture("sheenSampler",this._texture)},e.prototype.hasTexture=function(e){return this._texture===e},e.prototype.getActiveTextures=function(e){this._texture&&e.push(this._texture)},e.prototype.getAnimatables=function(e){this._texture&&this._texture.animations&&this._texture.animations.length>0&&e.push(this._texture)},e.prototype.dispose=function(e){e&&this._texture&&this._texture.dispose()},e.prototype.getClassName=function(){return"PBRSheenConfiguration"},e.AddFallbacks=function(e,t,i){return e.SHEEN&&t.addFallback(i++,"SHEEN"),i},e.AddUniforms=function(e){e.push("vSheenColor","vSheenInfos","sheenMatrix")},e.PrepareUniformBuffer=function(e){e.addUniform("vSheenColor",4),e.addUniform("vSheenInfos",2),e.addUniform("sheenMatrix",16)},e.AddSamplers=function(e){e.push("sheenSampler")},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isEnabled",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkSheenWithAlbedo",void 0),h.c([Object(F.c)()],e.prototype,"intensity",void 0),h.c([Object(F.e)()],e.prototype,"color",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"texture",void 0),e}(),Kr=function(){function e(e){this._isRefractionEnabled=!1,this.isRefractionEnabled=!1,this._isTranslucencyEnabled=!1,this.isTranslucencyEnabled=!1,this._isScatteringEnabled=!1,this.refractionIntensity=1,this.translucencyIntensity=1,this.scatteringIntensity=1,this._thicknessTexture=null,this.thicknessTexture=null,this._refractionTexture=null,this.refractionTexture=null,this._indexOfRefraction=1,this.indexOfRefraction=1,this._invertRefractionY=!1,this.invertRefractionY=!1,this._linkRefractionWithTransparency=!1,this.linkRefractionWithTransparency=!1,this.minimumThickness=0,this.maximumThickness=1,this.tintColor=s.a.White(),this.tintColorAtDistance=1,this.diffusionDistance=s.a.White(),this._useMaskFromThicknessTexture=!1,this.useMaskFromThicknessTexture=!1,this._internalMarkAllSubMeshesAsTexturesDirty=e}return e.prototype._markAllSubMeshesAsTexturesDirty=function(){this._internalMarkAllSubMeshesAsTexturesDirty()},e.prototype.isReadyForSubMesh=function(e,t){if(e._areTexturesDirty&&t.texturesEnabled){if(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&!this._thicknessTexture.isReadyOrNotBlocking())return!1;var i=this._getRefractionTexture(t);if(i&&Dr.a.RefractionTextureEnabled&&!i.isReadyOrNotBlocking())return!1}return!0},e.prototype.prepareDefines=function(e,t){if(e._areTexturesDirty&&(e.SUBSURFACE=!1,e.SS_TRANSLUCENCY=this._isTranslucencyEnabled,e.SS_SCATERRING=this._isScatteringEnabled,e.SS_THICKNESSANDMASK_TEXTURE=!1,e.SS_MASK_FROM_THICKNESS_TEXTURE=!1,e.SS_REFRACTION=!1,e.SS_REFRACTIONMAP_3D=!1,e.SS_GAMMAREFRACTION=!1,e.SS_RGBDREFRACTION=!1,e.SS_LINEARSPECULARREFRACTION=!1,e.SS_REFRACTIONMAP_OPPOSITEZ=!1,e.SS_LODINREFRACTIONALPHA=!1,e.SS_LINKREFRACTIONTOTRANSPARENCY=!1,(this._isRefractionEnabled||this._isTranslucencyEnabled||this._isScatteringEnabled)&&(e.SUBSURFACE=!0,e._areTexturesDirty&&t.texturesEnabled&&this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&Mr.a.PrepareDefinesForMergedUV(this._thicknessTexture,e,"SS_THICKNESSANDMASK_TEXTURE"),e.SS_MASK_FROM_THICKNESS_TEXTURE=this._useMaskFromThicknessTexture),this._isRefractionEnabled&&t.texturesEnabled)){var i=this._getRefractionTexture(t);i&&Dr.a.RefractionTextureEnabled&&(e.SS_REFRACTION=!0,e.SS_REFRACTIONMAP_3D=i.isCube,e.SS_GAMMAREFRACTION=i.gammaSpace,e.SS_RGBDREFRACTION=i.isRGBD,e.SS_LINEARSPECULARREFRACTION=i.linearSpecularLOD,e.SS_REFRACTIONMAP_OPPOSITEZ=i.invertZ,e.SS_LODINREFRACTIONALPHA=i.lodLevelInAlpha,e.SS_LINKREFRACTIONTOTRANSPARENCY=this._linkRefractionWithTransparency)}},e.prototype.bindForSubMesh=function(e,t,i,n,r){var o=this._getRefractionTexture(t);if(!e.useUbo||!n||!e.isSync){if(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&(e.updateFloat2("vThicknessInfos",this._thicknessTexture.coordinatesIndex,this._thicknessTexture.level),Mr.a.BindTextureMatrix(this._thicknessTexture,e,"thickness")),e.updateFloat2("vThicknessParam",this.minimumThickness,this.maximumThickness-this.minimumThickness),o&&Dr.a.RefractionTextureEnabled){e.updateMatrix("refractionMatrix",o.getReflectionTextureMatrix());var a=1;o.isCube||o.depth&&(a=o.depth),e.updateFloat4("vRefractionInfos",o.level,1/this._indexOfRefraction,a,this._invertRefractionY?-1:1),e.updateFloat3("vRefractionMicrosurfaceInfos",o.getSize().width,o.lodGenerationScale,o.lodGenerationOffset)}e.updateColor3("vDiffusionDistance",this.diffusionDistance),e.updateFloat4("vTintColor",this.tintColor.r,this.tintColor.g,this.tintColor.b,this.tintColorAtDistance),e.updateFloat3("vSubSurfaceIntensity",this.refractionIntensity,this.translucencyIntensity,this.scatteringIntensity)}t.texturesEnabled&&(this._thicknessTexture&&Dr.a.ThicknessTextureEnabled&&e.setTexture("thicknessSampler",this._thicknessTexture),o&&Dr.a.RefractionTextureEnabled&&(r?e.setTexture("refractionSampler",o):(e.setTexture("refractionSampler",o._lodTextureMid||o),e.setTexture("refractionSamplerLow",o._lodTextureLow||o),e.setTexture("refractionSamplerHigh",o._lodTextureHigh||o))))},e.prototype.unbind=function(e){return!(!this._refractionTexture||!this._refractionTexture.isRenderTarget)&&(e.setTexture("refractionSampler",null),!0)},e.prototype._getRefractionTexture=function(e){return this._refractionTexture?this._refractionTexture:this._isRefractionEnabled?e.environmentTexture:null},Object.defineProperty(e.prototype,"disableAlphaBlending",{get:function(){return this.isRefractionEnabled&&this._linkRefractionWithTransparency},enumerable:!0,configurable:!0}),e.prototype.fillRenderTargetTextures=function(e){Dr.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget&&e.push(this._refractionTexture)},e.prototype.hasTexture=function(e){return this._thicknessTexture===e||this._refractionTexture===e},e.prototype.hasRenderTargetTextures=function(){return!!(Dr.a.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},e.prototype.getActiveTextures=function(e){this._thicknessTexture&&e.push(this._thicknessTexture),this._refractionTexture&&e.push(this._refractionTexture)},e.prototype.getAnimatables=function(e){this._thicknessTexture&&this._thicknessTexture.animations&&this._thicknessTexture.animations.length>0&&e.push(this._thicknessTexture),this._refractionTexture&&this._refractionTexture.animations&&this._refractionTexture.animations.length>0&&e.push(this._refractionTexture)},e.prototype.dispose=function(e){e&&(this._thicknessTexture&&this._thicknessTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose())},e.prototype.getClassName=function(){return"PBRSubSurfaceConfiguration"},e.AddFallbacks=function(e,t,i){return e.SS_SCATERRING&&t.addFallback(i++,"SS_SCATERRING"),e.SS_TRANSLUCENCY&&t.addFallback(i++,"SS_TRANSLUCENCY"),i},e.AddUniforms=function(e){e.push("vDiffusionDistance","vTintColor","vSubSurfaceIntensity","vRefractionMicrosurfaceInfos","vRefractionInfos","vThicknessInfos","vThicknessParam","refractionMatrix","thicknessMatrix")},e.AddSamplers=function(e){e.push("thicknessSampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh")},e.PrepareUniformBuffer=function(e){e.addUniform("vRefractionMicrosurfaceInfos",3),e.addUniform("vRefractionInfos",4),e.addUniform("refractionMatrix",16),e.addUniform("vThicknessInfos",2),e.addUniform("thicknessMatrix",16),e.addUniform("vThicknessParam",2),e.addUniform("vDiffusionDistance",3),e.addUniform("vTintColor",4),e.addUniform("vSubSurfaceIntensity",3)},e.prototype.copyTo=function(e){F.a.Clone(function(){return e},this)},e.prototype.serialize=function(){return F.a.Serialize(this)},e.prototype.parse=function(e,t,i){var n=this;F.a.Parse(function(){return n},e,t,i)},h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isRefractionEnabled",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"isTranslucencyEnabled",void 0),h.c([Object(F.c)()],e.prototype,"refractionIntensity",void 0),h.c([Object(F.c)()],e.prototype,"translucencyIntensity",void 0),h.c([Object(F.c)()],e.prototype,"scatteringIntensity",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"thicknessTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"refractionTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"indexOfRefraction",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertRefractionY",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"linkRefractionWithTransparency",void 0),h.c([Object(F.c)()],e.prototype,"minimumThickness",void 0),h.c([Object(F.c)()],e.prototype,"maximumThickness",void 0),h.c([Object(F.e)()],e.prototype,"tintColor",void 0),h.c([Object(F.c)()],e.prototype,"tintColorAtDistance",void 0),h.c([Object(F.e)()],e.prototype,"diffusionDistance",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useMaskFromThicknessTexture",void 0),e}(),Qr="uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\n\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\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 REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(SS_REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\n#endif\n#endif\n\n#ifdef CLEARCOAT\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\n#ifdef CLEARCOAT_TEXTURE\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\n#endif\n#ifdef CLEARCOAT_BUMP\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\n#endif\n#ifdef CLEARCOAT_TINT\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\n#ifdef CLEARCOAT_TINT_TEXTURE\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\n#endif\n#endif\n#endif\n\n#ifdef ANISOTROPIC\nuniform vec3 vAnisotropy;\n#ifdef ANISOTROPIC_TEXTURE\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\n#endif\n#endif\n\n#ifdef SHEEN\nuniform vec4 vSheenColor;\n#ifdef SHEEN_TEXTURE\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\n#endif\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;;\n#endif\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n#endif";ni.a.IncludesShadersStore.pbrFragmentDeclaration=Qr;var qr="layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec2 vAlbedoInfos;\nuniform vec4 vAmbientInfos;\nuniform vec2 vOpacityInfos;\nuniform vec2 vEmissiveInfos;\nuniform vec2 vLightmapInfos;\nuniform vec3 vReflectivityInfos;\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform vec2 vReflectionInfos;\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize;\nuniform vec3 vBumpInfos;\nuniform mat4 albedoMatrix;\nuniform mat4 ambientMatrix;\nuniform mat4 opacityMatrix;\nuniform mat4 emissiveMatrix;\nuniform mat4 lightmapMatrix;\nuniform mat4 reflectivityMatrix;\nuniform mat4 microSurfaceSamplerMatrix;\nuniform mat4 bumpMatrix;\nuniform vec2 vTangentSpaceParams;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float pointSize;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float visibility;\nuniform vec2 vClearCoatParams;\nuniform vec4 vClearCoatRefractionParams;\nuniform vec2 vClearCoatInfos;\nuniform mat4 clearCoatMatrix;\nuniform vec2 vClearCoatBumpInfos;\nuniform vec2 vClearCoatTangentSpaceParams;\nuniform mat4 clearCoatBumpMatrix;\nuniform vec4 vClearCoatTintParams;\nuniform float clearCoatColorAtDistance;\nuniform vec2 vClearCoatTintInfos;\nuniform mat4 clearCoatTintMatrix;\nuniform vec3 vAnisotropy;\nuniform vec2 vAnisotropyInfos;\nuniform mat4 anisotropyMatrix;\nuniform vec4 vSheenColor;\nuniform vec2 vSheenInfos;\nuniform mat4 sheenMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec2 vThicknessInfos;\nuniform mat4 thicknessMatrix;\nuniform vec2 vThicknessParam;\nuniform vec3 vDiffusionDistance;\nuniform vec4 vTintColor;\nuniform vec3 vSubSurfaceIntensity;\n};\nuniform Scene {\nmat4 viewProjection;\n#ifdef MULTIVIEW\nmat4 viewProjectionR;\n#endif\nmat4 view;\n};";ni.a.IncludesShadersStore.pbrUboDeclaration=qr;var Zr="uniform vec4 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vCameraInfos;\n\nvarying vec3 vPositionW;\n#if DEBUGMODE>0\nuniform vec2 vDebugMode;\nvarying vec4 vClipSpacePosition;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif";ni.a.IncludesShadersStore.pbrFragmentExtraDeclaration=Zr;var Jr="#ifdef ALBEDO\n#if ALBEDODIRECTUV == 1\n#define vAlbedoUV vMainUV1\n#elif ALBEDODIRECTUV == 2\n#define vAlbedoUV vMainUV2\n#else\nvarying vec2 vAlbedoUV;\n#endif\nuniform sampler2D albedoSampler;\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 REFLECTIVITY\n#if REFLECTIVITYDIRECTUV == 1\n#define vReflectivityUV vMainUV1\n#elif REFLECTIVITYDIRECTUV == 2\n#define vReflectivityUV vMainUV2\n#else\nvarying vec2 vReflectivityUV;\n#endif\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef MICROSURFACEMAP\n#if MICROSURFACEMAPDIRECTUV == 1\n#define vMicroSurfaceSamplerUV vMainUV1\n#elif MICROSURFACEMAPDIRECTUV == 2\n#define vMicroSurfaceSamplerUV vMainUV2\n#else\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\nuniform sampler2D microSurfaceSampler;\n#endif\n#ifdef CLEARCOAT\n#ifdef CLEARCOAT_TEXTURE\n#if CLEARCOAT_TEXTUREDIRECTUV == 1\n#define vClearCoatUV vMainUV1\n#elif CLEARCOAT_TEXTUREDIRECTUV == 2\n#define vClearCoatUV vMainUV2\n#else\nvarying vec2 vClearCoatUV;\n#endif\nuniform sampler2D clearCoatSampler;\n#endif\n#ifdef CLEARCOAT_BUMP\n#if CLEARCOAT_BUMPDIRECTUV == 1\n#define vClearCoatBumpUV vMainUV1\n#elif CLEARCOAT_BUMPDIRECTUV == 2\n#define vClearCoatBumpUV vMainUV2\n#else\nvarying vec2 vClearCoatBumpUV;\n#endif\nuniform sampler2D clearCoatBumpSampler;\n#endif\n#ifdef CLEARCOAT_TINT_TEXTURE\n#if CLEARCOAT_TINT_TEXTUREDIRECTUV == 1\n#define vClearCoatTintUV vMainUV1\n#elif CLEARCOAT_TINT_TEXTUREDIRECTUV == 2\n#define vClearCoatTintUV vMainUV2\n#else\nvarying vec2 vClearCoatTintUV;\n#endif\nuniform sampler2D clearCoatTintSampler;\n#endif\n#endif\n#ifdef SHEEN\n#ifdef SHEEN_TEXTURE\n#if SHEEN_TEXTUREDIRECTUV == 1\n#define vSheenUV vMainUV1\n#elif SHEEN_TEXTUREDIRECTUV == 2\n#define vSheenUV vMainUV2\n#else\nvarying vec2 vSheenUV;\n#endif\nuniform sampler2D sheenSampler;\n#endif\n#endif\n#ifdef ANISOTROPIC\n#ifdef ANISOTROPIC_TEXTURE\n#if ANISOTROPIC_TEXTUREDIRECTUV == 1\n#define vAnisotropyUV vMainUV1\n#elif ANISOTROPIC_TEXTUREDIRECTUV == 2\n#define vAnisotropyUV vMainUV2\n#else\nvarying vec2 vAnisotropyUV;\n#endif\nuniform sampler2D anisotropySampler;\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform samplerCube irradianceSampler;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform sampler2D reflectionSamplerLow;\nuniform sampler2D reflectionSamplerHigh;\n#endif\n#ifdef USEIRRADIANCEMAP\nuniform sampler2D irradianceSampler;\n#endif\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#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifdef SUBSURFACE\n#ifdef SS_REFRACTION\n#ifdef SS_REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#endif\n#endif\n#ifdef SS_THICKNESSANDMASK_TEXTURE\n#if SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 1\n#define vThicknessUV vMainUV1\n#elif SS_THICKNESSANDMASK_TEXTUREDIRECTUV == 2\n#define vThicknessUV vMainUV2\n#else\nvarying vec2 vThicknessUV;\n#endif\nuniform sampler2D thicknessSampler;\n#endif\n#endif";ni.a.IncludesShadersStore.pbrFragmentSamplersDeclaration=Jr;i(101);var $r="\n#define RECIPROCAL_PI2 0.15915494\n#define RECIPROCAL_PI 0.31830988618\n\n#define MINIMUMVARIANCE 0.0005\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nreturn square(roughness)+MINIMUMVARIANCE;\n}\nfloat fresnelGrazingReflectance(float reflectance0) {\n\n\nfloat reflectance90=saturate(reflectance0*25.0);\nreturn reflectance90;\n}\nvec2 getAARoughnessFactors(vec3 normalVector) {\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalVector.xyz);\nvec3 nDfdy=dFdy(normalVector.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\n\nfloat geometricRoughnessFactor=pow(saturate(slopeSquare),0.333);\n\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\n\ngeometricAlphaGFactor*=0.75;\nreturn vec2(geometricRoughnessFactor,geometricAlphaGFactor);\n#else\nreturn vec2(0.);\n#endif\n}\n#ifdef ANISOTROPIC\n\n\nvec2 getAnisotropicRoughness(float alphaG,float anisotropy) {\nfloat alphaT=max(alphaG*(1.0+anisotropy),MINIMUMVARIANCE);\nfloat alphaB=max(alphaG*(1.0-anisotropy),MINIMUMVARIANCE);\nreturn vec2(alphaT,alphaB);\n}\n\n\nvec3 getAnisotropicBentNormals(const vec3 T,const vec3 B,const vec3 N,const vec3 V,float anisotropy) {\nvec3 anisotropicFrameDirection=anisotropy>=0.0 ? B : T;\nvec3 anisotropicFrameTangent=cross(normalize(anisotropicFrameDirection),V);\nvec3 anisotropicFrameNormal=cross(anisotropicFrameTangent,anisotropicFrameDirection);\nvec3 anisotropicNormal=normalize(mix(N,anisotropicFrameNormal,abs(anisotropy)));\nreturn anisotropicNormal;\n\n}\n#endif\n#if defined(CLEARCOAT) || defined(SS_REFRACTION)\n\n\n\nvec3 cocaLambert(vec3 alpha,float distance) {\nreturn exp(-alpha*distance);\n}\n\nvec3 cocaLambert(float NdotVRefract,float NdotLRefract,vec3 alpha,float thickness) {\nreturn cocaLambert(alpha,(thickness*((NdotLRefract+NdotVRefract)/(NdotLRefract*NdotVRefract))));\n}\n\nvec3 computeColorAtDistanceInMedia(vec3 color,float distance) {\nreturn -log(color)/distance;\n}\nvec3 computeClearCoatAbsorption(float NdotVRefract,float NdotLRefract,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 clearCoatAbsorption=mix(vec3(1.0),\ncocaLambert(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness),\nclearCoatIntensity);\nreturn clearCoatAbsorption;\n}\n#endif\n\n\n\n\n#ifdef MICROSURFACEAUTOMATIC\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n#endif";ni.a.IncludesShadersStore.pbrHelperFunctions=$r;var eo="#ifdef USESPHERICALFROMREFLECTIONMAP\n#ifdef SPHERICAL_HARMONICS\nuniform vec3 vSphericalL00;\nuniform vec3 vSphericalL1_1;\nuniform vec3 vSphericalL10;\nuniform vec3 vSphericalL11;\nuniform vec3 vSphericalL2_2;\nuniform vec3 vSphericalL2_1;\nuniform vec3 vSphericalL20;\nuniform vec3 vSphericalL21;\nuniform vec3 vSphericalL22;\n\n\n\n\n\n\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\nreturn vSphericalL00\n+vSphericalL1_1*(normal.y)\n+vSphericalL10*(normal.z)\n+vSphericalL11*(normal.x)\n+vSphericalL2_2*(normal.y*normal.x)\n+vSphericalL2_1*(normal.y*normal.z)\n+vSphericalL20*((3.0*normal.z*normal.z)-1.0)\n+vSphericalL21*(normal.z*normal.x)\n+vSphericalL22*(normal.x*normal.x-(normal.y*normal.y));\n}\n#else\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\n\nvec3 computeEnvironmentIrradiance(vec3 normal) {\n\n\n\n\n\n\n\n\n\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz*Nz+C1;\nvec3 t2=a2*Ny+t1;\nvec3 t3=b3*Nx+t2;\nreturn t3;\n}\n#endif\n#endif";ni.a.IncludesShadersStore.harmonicsFunctions=eo;var to="\nstruct preLightingInfo\n{\n\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat lightDistance;\n\nfloat attenuation;\n\nvec3 L;\nvec3 H;\nfloat NdotV;\nfloat NdotLUnclamped;\nfloat NdotL;\nfloat VdotH;\nfloat roughness;\n};\npreLightingInfo computePointAndSpotPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\n\nresult.lightDistance=sqrt(result.lightDistanceSquared);\n\nresult.L=normalize(result.lightOffset);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeDirectionalPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\nresult.lightDistance=length(-lightData.xyz);\n\nresult.L=normalize(-lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\nresult.NdotLUnclamped=dot(N,result.L);\nresult.NdotL=saturateEps(result.NdotLUnclamped);\nreturn result;\n}\npreLightingInfo computeHemisphericPreLightingInfo(vec4 lightData,vec3 V,vec3 N) {\npreLightingInfo result;\n\n\nresult.NdotL=dot(N,lightData.xyz)*0.5+0.5;\nresult.NdotL=saturateEps(result.NdotL);\nresult.NdotLUnclamped=result.NdotL;\n#ifdef SPECULARTERM\nresult.L=normalize(lightData.xyz);\nresult.H=normalize(V+result.L);\nresult.VdotH=saturate(dot(V,result.H));\n#endif\nreturn result;\n}";ni.a.IncludesShadersStore.pbrDirectLightingSetupFunctions=to;var io="float computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/maxEps(lightDistanceSquared);\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nfloat lightDistanceFalloff=1.0/maxEps(lightDistanceSquared);\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=saturate(1.0-factor*factor);\nattenuation*=attenuation;\n\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=maxEps(dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977;\n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\n\n\n\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=saturate(cd*lightAngleScale+lightAngleOffset);\n\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}";ni.a.IncludesShadersStore.pbrDirectLightingFalloffFunctions=io;var no="\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\n\n\n\n#ifdef MS_BRDF_ENERGY_CONSERVATION\n\n\nvec3 getEnergyConservationFactor(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\nreturn 1.0+specularEnvironmentR0*(1.0/environmentBrdf.y-1.0);\n}\n#endif\n#ifdef ENVIRONMENTBRDF\nvec3 getBRDFLookup(float NdotV,float perceptualRoughness,sampler2D brdfSampler) {\n\nvec2 UV=vec2(NdotV,perceptualRoughness);\n\nvec4 brdfLookup=texture2D(brdfSampler,UV);\n#ifdef ENVIRONMENTBRDF_RGBD\nbrdfLookup.rgb=fromRGBD(brdfLookup.rgba);\n#endif\nreturn brdfLookup.rgb;\n}\nvec3 getReflectanceFromBRDFLookup(const vec3 specularEnvironmentR0,const vec3 environmentBrdf) {\n#ifdef BRDF_V_HEIGHT_CORRELATED\nvec3 reflectance=mix(environmentBrdf.xxx,environmentBrdf.yyy,specularEnvironmentR0);\n#else\nvec3 reflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#endif\nreturn reflectance;\n}\n#endif\n#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)\nvec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow5(saturate(1.0-VdotN));\n}\n#endif\n#if defined(SHEEN) && defined(REFLECTION)\n\nvec3 getSheenReflectanceFromBRDFLookup(const vec3 reflectance0,const vec3 environmentBrdf) {\nvec3 sheenEnvironmentReflectance=reflectance0*environmentBrdf.b;\nreturn sheenEnvironmentReflectance;\n}\n#endif\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\nfloat fresnelSchlickGGX(float VdotH,float reflectance0,float reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow5(1.0-VdotH);\n}\n#ifdef CLEARCOAT\n\n\n\n\n\nvec3 getR0RemappedForClearCoat(vec3 f0) {\n#ifdef CLEARCOAT_DEFAULTIOR\n#ifdef MOBILE\nreturn saturate(f0*(f0*0.526868+0.529324)-0.0482256);\n#else\nreturn saturate(f0*(f0*(0.941892-0.263008*f0)+0.346479)-0.0285998);\n#endif\n#else\nvec3 s=sqrt(f0);\nvec3 t=(vClearCoatRefractionParams.z+vClearCoatRefractionParams.w*s)/(vClearCoatRefractionParams.w+vClearCoatRefractionParams.z*s);\nreturn t*t;\n#endif\n}\n#endif\n\n\n\n\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\n#ifdef SHEEN\n\nfloat normalDistributionFunction_CharlieSheen(float NdotH,float alphaG)\n{\nfloat invR=1./alphaG;\nfloat cos2h=NdotH*NdotH;\nfloat sin2h=1.-cos2h;\nreturn (2.+invR)*pow(sin2h,invR*.5)/(2.*PI);\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat normalDistributionFunction_BurleyGGX_Anisotropic(float NdotH,float TdotH,float BdotH,const vec2 alphaTB) {\nfloat a2=alphaTB.x*alphaTB.y;\nvec3 v=vec3(alphaTB.y*TdotH,alphaTB.x*BdotH,a2*NdotH);\nfloat v2=dot(v,v);\nfloat w2=a2/v2;\nreturn a2*w2*w2*RECIPROCAL_PI;\n}\n#endif\n\n\n\n\n#ifdef BRDF_V_HEIGHT_CORRELATED\n\n\n\nfloat smithVisibility_GGXCorrelated(float NdotL,float NdotV,float alphaG) {\n#ifdef MOBILE\n\nfloat GGXV=NdotL*(NdotV*(1.0-alphaG)+alphaG);\nfloat GGXL=NdotV*(NdotL*(1.0-alphaG)+alphaG);\nreturn 0.5/(GGXV+GGXL);\n#else\nfloat a2=alphaG*alphaG;\nfloat GGXV=NdotL*sqrt(NdotV*(NdotV-a2*NdotV)+a2);\nfloat GGXL=NdotV*sqrt(NdotL*(NdotL-a2*NdotL)+a2);\nreturn 0.5/(GGXV+GGXL);\n#endif\n}\n#else\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfloat smithVisibilityG1_TrowbridgeReitzGGXFast(float dot,float alphaG)\n{\n#ifdef MOBILE\n\nreturn 1.0/(dot+alphaG+(1.0-alphaG)*dot ));\n#else\nfloat alphaSquared=alphaG*alphaG;\nreturn 1.0/(dot+sqrt(alphaSquared+(1.0-alphaSquared)*dot*dot));\n#endif\n}\nfloat smithVisibility_TrowbridgeReitzGGXFast(float NdotL,float NdotV,float alphaG)\n{\nfloat visibility=smithVisibilityG1_TrowbridgeReitzGGXFast(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGXFast(NdotV,alphaG);\n\nreturn visibility;\n}\n#endif\n#ifdef ANISOTROPIC\n\n\nfloat smithVisibility_GGXCorrelated_Anisotropic(float NdotL,float NdotV,float TdotV,float BdotV,float TdotL,float BdotL,const vec2 alphaTB) {\nfloat lambdaV=NdotL*length(vec3(alphaTB.x*TdotV,alphaTB.y*BdotV,NdotV));\nfloat lambdaL=NdotV*length(vec3(alphaTB.x*TdotL,alphaTB.y*BdotL,NdotL));\nfloat v=0.5/(lambdaV+lambdaL);\nreturn v;\n}\n#endif\n#ifdef CLEARCOAT\nfloat visibility_Kelemen(float VdotH) {\n\n\n\nreturn 0.25/(VdotH*VdotH);\n}\n#endif\n#ifdef SHEEN\n\n\n\nfloat visibility_Ashikhmin(float NdotL,float NdotV)\n{\nreturn 1./(4.*(NdotL+NdotV-NdotL*NdotV));\n}\n#endif\n\n\n\n\n\n\n\nfloat diffuseBRDF_Burley(float NdotL,float NdotV,float VdotH,float roughness) {\n\n\nfloat diffuseFresnelNV=pow5(saturateEps(1.0-NdotL));\nfloat diffuseFresnelNL=pow5(saturateEps(1.0-NdotV));\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel/PI;\n}\n#ifdef SS_TRANSLUCENCY\n\n\nvec3 transmittanceBRDF_Burley(const vec3 tintColor,const vec3 diffusionDistance,float thickness) {\nvec3 S=1./maxEps(diffusionDistance);\nvec3 temp=exp((-0.333333333*thickness)*S);\nreturn tintColor.rgb*0.25*(temp*temp*temp+3.0*temp);\n}\n\n\nfloat computeWrappedDiffuseNdotL(float NdotL,float w) {\nfloat t=1.0+w;\nfloat invt2=1.0/square(t);\nreturn saturate((NdotL+w)*invt2);\n}\n#endif\n";ni.a.IncludesShadersStore.pbrBRDFFunctions=no;var ro="#define CLEARCOATREFLECTANCE90 1.0\n\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef CLEARCOAT\n\n\nvec4 clearCoat;\n#endif\n#ifdef SHEEN\nvec3 sheen;\n#endif\n};\n\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance) {\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=saturate(lightRoughness+roughness);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nvec3 computeHemisphericDiffuseLighting(preLightingInfo info,vec3 lightColor,vec3 groundColor) {\nreturn mix(groundColor,lightColor,info.NdotL);\n}\nvec3 computeDiffuseLighting(preLightingInfo info,vec3 lightColor) {\nfloat diffuseTerm=diffuseBRDF_Burley(info.NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*info.attenuation*info.NdotL*lightColor;\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 toLinearSpace(textureColor);\n}\n#ifdef SS_TRANSLUCENCY\nvec3 computeDiffuseAndTransmittedLighting(preLightingInfo info,vec3 lightColor,vec3 transmittance) {\nfloat NdotL=absEps(info.NdotLUnclamped);\n\nfloat wrapNdotL=computeWrappedDiffuseNdotL(NdotL,0.02);\n\nfloat trAdapt=step(0.,info.NdotLUnclamped);\nvec3 transmittanceNdotL=mix(transmittance*wrapNdotL,vec3(wrapNdotL),trAdapt);\nfloat diffuseTerm=diffuseBRDF_Burley(NdotL,info.NdotV,info.VdotH,info.roughness);\nreturn diffuseTerm*transmittanceNdotL*info.attenuation*lightColor;\n}\n#endif\n#ifdef SPECULARTERM\nvec3 computeSpecularLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\n#ifdef BRDF_V_HEIGHT_CORRELATED\nfloat visibility=smithVisibility_GGXCorrelated(info.NdotL,info.NdotV,alphaG);\n#else\nfloat visibility=smithVisibility_TrowbridgeReitzGGXFast(info.NdotL,info.NdotV,alphaG);\n#endif\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef ANISOTROPIC\nvec3 computeAnisotropicSpecularLighting(preLightingInfo info,vec3 V,vec3 N,vec3 T,vec3 B,float anisotropy,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat TdotH=dot(T,info.H);\nfloat BdotH=dot(B,info.H);\nfloat TdotV=dot(T,V);\nfloat BdotV=dot(B,V);\nfloat TdotL=dot(T,info.L);\nfloat BdotL=dot(B,info.L);\nfloat alphaG=convertRoughnessToAverageSlope(info.roughness);\nvec2 alphaTB=getAnisotropicRoughness(alphaG,anisotropy);\nalphaTB=max(alphaTB,square(geometricRoughnessFactor));\nvec3 fresnel=fresnelSchlickGGX(info.VdotH,reflectance0,reflectance90);\nfloat distribution=normalDistributionFunction_BurleyGGX_Anisotropic(NdotH,TdotH,BdotH,alphaTB);\nfloat visibility=smithVisibility_GGXCorrelated_Anisotropic(info.NdotL,info.NdotV,TdotV,BdotV,TdotL,BdotL,alphaTB);\nvec3 specTerm=fresnel*distribution*visibility;\nreturn specTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n#ifdef CLEARCOAT\nvec4 computeClearCoatLighting(preLightingInfo info,vec3 Ncc,float geometricRoughnessFactor,float clearCoatIntensity,vec3 lightColor) {\nfloat NccdotL=saturateEps(dot(Ncc,info.L));\nfloat NccdotH=saturateEps(dot(Ncc,info.H));\nfloat clearCoatRoughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(clearCoatRoughness);\nfloat fresnel=fresnelSchlickGGX(info.VdotH,vClearCoatRefractionParams.x,CLEARCOATREFLECTANCE90);\nfresnel*=clearCoatIntensity;\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NccdotH,alphaG);\nfloat visibility=visibility_Kelemen(info.VdotH);\nfloat clearCoatTerm=fresnel*distribution*visibility;\nreturn vec4(\nclearCoatTerm*info.attenuation*NccdotL*lightColor,\n1.0-fresnel\n);\n}\nvec3 computeClearCoatLightingAbsorption(float NdotVRefract,vec3 L,vec3 Ncc,vec3 clearCoatColor,float clearCoatThickness,float clearCoatIntensity) {\nvec3 LRefract=-refract(L,Ncc,vClearCoatRefractionParams.y);\nfloat NdotLRefract=saturateEps(dot(Ncc,LRefract));\nvec3 absorption=computeClearCoatAbsorption(NdotVRefract,NdotLRefract,clearCoatColor,clearCoatThickness,clearCoatIntensity);\nreturn absorption;\n}\n#endif\n#ifdef SHEEN\nvec3 computeSheenLighting(preLightingInfo info,vec3 N,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,vec3 lightColor) {\nfloat NdotH=saturateEps(dot(N,info.H));\nfloat roughness=max(info.roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n\n\nvec3 fresnel=reflectance0;\nfloat distribution=normalDistributionFunction_CharlieSheen(NdotH,alphaG);\nfloat visibility=visibility_Ashikhmin(info.NdotL,info.NdotV);\nvec3 sheenTerm=fresnel*distribution*visibility;\nreturn sheenTerm*info.attenuation*info.NdotL*lightColor;\n}\n#endif\n";ni.a.IncludesShadersStore.pbrDirectLightingFunctions=ro;var oo="#if defined(REFLECTION) || defined(SS_REFRACTION)\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float microsurfaceAverageSlope) {\nfloat microsurfaceAverageSlopeTexels=cubeMapDimensionPixels*microsurfaceAverageSlope;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat getLinearLodFromRoughness(float cubeMapDimensionPixels,float roughness) {\nfloat lod=log2(cubeMapDimensionPixels)*roughness;\nreturn lod;\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(RADIANCEOCCLUSION)\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn saturate(square(temp)-1.0+ambientOcclusion);\n}\n#endif\n#if defined(ENVIRONMENTBRDF) && defined(HORIZONOCCLUSION)\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=saturate(1.0+1.1*dot(reflection,normal));\nreturn square(temp);\n}\n#endif\n\n\n\n\n#if defined(LODINREFLECTIONALPHA) || defined(SS_LODINREFRACTIONALPHA)\n\n\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\n\n\n\n\n\n\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nreturn getLodFromAlphaG(cubeMapDimensionPixels,microsurfaceAverageSlope);\n}\n#endif";ni.a.IncludesShadersStore.pbrIBLFunctions=oo;i(139),i(140),i(141),i(133);var ao="#if DEBUGMODE>0\nif (vClipSpacePosition.x/vClipSpacePosition.w=1)&&e.prototype.needAlphaBlendingForMesh.call(this,t)},t.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||!this.subSurface.disableAlphaBlending&&(null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&(null==this._transparencyMode||this._transparencyMode===t.PBRMATERIAL_ALPHATEST))},t.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==t.PBRMATERIAL_OPAQUE},t.prototype.getAlphaTestTexture=function(){return this._albedoTexture},t.prototype.isReadyForSubMesh=function(e,t,i){if(t.effect&&this.isFrozen&&this._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new uo);var n=t._materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&n._renderId===this.getScene().getRenderId())return!0;var r=this.getScene(),o=r.getEngine();if(n._areTexturesDirty&&r.texturesEnabled){if(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&Dr.a.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&Dr.a.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var a=this._getReflectionTexture();if(a&&Dr.a.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;if(a.irradianceTexture&&!a.irradianceTexture.isReadyOrNotBlocking())return!1}if(this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(Dr.a.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;if(this._environmentBRDFTexture&&Dr.a.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(!(this.subSurface.isReadyForSubMesh(n,r)&&this.clearCoat.isReadyForSubMesh(n,r,o,this._disableBumpMap)&&this.sheen.isReadyForSubMesh(n,r)&&this.anisotropy.isReadyForSubMesh(n,r)))return!1;if(n._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(Yi.b.NormalKind)||(e.createNormals(!0),m.a.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var s=t.effect,c=this._prepareEffect(e,n,this.onCompiled,this.onError,i);return c&&(this.allowShaderHotSwapping&&s&&!c.isReady()?(c=s,n.markAsUnprocessed()):(r.resetCachedMaterial(),t.setEffect(c,n),this.buildUniformLayout())),!(!t.effect||!t.effect.isReady())&&(n._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},t.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},t.prototype._prepareEffect=function(e,t,i,n,r,o){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),this._prepareDefines(e,t,r,o),!t.isDirty)return null;t.markAsProcessed();var a=this.getScene().getEngine(),s=new ni.c,c=0;t.USESPHERICALINVERTEX&&s.addFallback(c++,"USESPHERICALINVERTEX"),t.FOG&&s.addFallback(c,"FOG"),t.SPECULARAA&&s.addFallback(c,"SPECULARAA"),t.POINTSIZE&&s.addFallback(c,"POINTSIZE"),t.LOGARITHMICDEPTH&&s.addFallback(c,"LOGARITHMICDEPTH"),t.PARALLAX&&s.addFallback(c,"PARALLAX"),t.PARALLAXOCCLUSION&&s.addFallback(c++,"PARALLAXOCCLUSION"),c=Hr.AddFallbacks(t,s,c),c=Hr.AddFallbacks(t,s,c),c=Kr.AddFallbacks(t,s,c),c=Yr.AddFallbacks(t,s,c),t.ENVIRONMENTBRDF&&s.addFallback(c++,"ENVIRONMENTBRDF"),t.TANGENT&&s.addFallback(c++,"TANGENT"),t.BUMP&&s.addFallback(c++,"BUMP"),c=Mr.a.HandleFallbacksForShadows(t,s,this._maxSimultaneousLights,c++),t.SPECULARTERM&&s.addFallback(c++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&s.addFallback(c++,"USESPHERICALFROMREFLECTIONMAP"),t.USEIRRADIANCEMAP&&s.addFallback(c++,"USEIRRADIANCEMAP"),t.LIGHTMAP&&s.addFallback(c++,"LIGHTMAP"),t.NORMAL&&s.addFallback(c++,"NORMAL"),t.AMBIENT&&s.addFallback(c++,"AMBIENT"),t.EMISSIVE&&s.addFallback(c++,"EMISSIVE"),t.VERTEXCOLOR&&s.addFallback(c++,"VERTEXCOLOR"),t.MORPHTARGETS&&s.addFallback(c++,"MORPHTARGETS"),t.MULTIVIEW&&s.addFallback(0,"MULTIVIEW");var l=[Yi.b.PositionKind];t.NORMAL&&l.push(Yi.b.NormalKind),t.TANGENT&&l.push(Yi.b.TangentKind),t.UV1&&l.push(Yi.b.UVKind),t.UV2&&l.push(Yi.b.UV2Kind),t.VERTEXCOLOR&&l.push(Yi.b.ColorKind),Mr.a.PrepareAttributesForBones(l,e,t,s),Mr.a.PrepareAttributesForInstances(l,t),Mr.a.PrepareAttributesForMorphTargets(l,e,t);var u="pbr",h=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vEmissiveColor","visibility","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","vLightingIntensity","logarithmicDepthConstant","vSphericalX","vSphericalY","vSphericalZ","vSphericalXX_ZZ","vSphericalYY_ZZ","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vSphericalL00","vSphericalL1_1","vSphericalL10","vSphericalL11","vSphericalL2_2","vSphericalL2_1","vSphericalL20","vSphericalL21","vSphericalL22","vReflectionMicrosurfaceInfos","vTangentSpaceParams","boneTextureWidth","vDebugMode"],d=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","irradianceSampler","microSurfaceSampler","environmentBrdfSampler","boneSampler"],f=["Material","Scene"];Kr.AddUniforms(h),Kr.AddSamplers(d),Wr.AddUniforms(h),Wr.AddSamplers(d),Hr.AddUniforms(h),Hr.AddSamplers(d),Yr.AddUniforms(h),Yr.AddSamplers(d),Gi.a&&(Gi.a.PrepareUniforms(h,t),Gi.a.PrepareSamplers(d,t)),Mr.a.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:f,samplers:d,defines:t,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(u=this.customShaderNameResolve(u,h,f,d,t));var p=t.toString();return a.createEffect(u,{attributes:l,uniformsNames:h,uniformBuffersNames:f,samplers:d,defines:p,fallbacks:s,onCompiled:i,onError:n,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS}},a)},t.prototype._prepareDefines=function(e,i,n,r){void 0===n&&(n=null),void 0===r&&(r=null);var o=this.getScene(),a=o.getEngine();if(Mr.a.PrepareDefinesForLights(o,e,i,!0,this._maxSimultaneousLights,this._disableLighting),i._needNormals=!0,Mr.a.PrepareDefinesForMultiview(o,i),i.METALLICWORKFLOW=this.isMetallicWorkflow(),i._areTexturesDirty){if(i._needUVs=!1,o.texturesEnabled){o.getEngine().getCaps().textureLOD&&(i.LODBASEDMICROSFURACE=!0),this._albedoTexture&&Dr.a.DiffuseTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._albedoTexture,i,"ALBEDO"):i.ALBEDO=!1,this._ambientTexture&&Dr.a.AmbientTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._ambientTexture,i,"AMBIENT"),i.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):i.AMBIENT=!1,this._opacityTexture&&Dr.a.OpacityTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._opacityTexture,i,"OPACITY"),i.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):i.OPACITY=!1;var s=this._getReflectionTexture();if(s&&Dr.a.ReflectionTextureEnabled){switch(i.REFLECTION=!0,i.GAMMAREFLECTION=s.gammaSpace,i.RGBDREFLECTION=s.isRGBD,i.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,i.LODINREFLECTIONALPHA=s.lodLevelInAlpha,i.LINEARSPECULARREFLECTION=s.linearSpecularLOD,s.coordinatesMode===$e.a.INVCUBIC_MODE&&(i.INVERTCUBICMAP=!0),i.REFLECTIONMAP_3D=s.isCube,i.REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,s.coordinatesMode){case $e.a.EXPLICIT_MODE:i.REFLECTIONMAP_EXPLICIT=!0;break;case $e.a.PLANAR_MODE:i.REFLECTIONMAP_PLANAR=!0;break;case $e.a.PROJECTION_MODE:i.REFLECTIONMAP_PROJECTION=!0;break;case $e.a.SKYBOX_MODE:i.REFLECTIONMAP_SKYBOX=!0;break;case $e.a.SPHERICAL_MODE:i.REFLECTIONMAP_SPHERICAL=!0;break;case $e.a.EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MODE:i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case $e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case $e.a.CUBIC_MODE:case $e.a.INVCUBIC_MODE:default:i.REFLECTIONMAP_CUBIC=!0,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!!s.boundingBoxSize}s.coordinatesMode!==$e.a.SKYBOX_MODE?s.irradianceTexture?(i.USEIRRADIANCEMAP=!0,i.USESPHERICALFROMREFLECTIONMAP=!1):s.sphericalPolynomial&&(i.USESPHERICALFROMREFLECTIONMAP=!0,i.USEIRRADIANCEMAP=!1,this._forceIrradianceInFragment||o.getEngine().getCaps().maxVaryingVectors<=8?i.USESPHERICALINVERTEX=!1:i.USESPHERICALINVERTEX=!0):i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!s.getReflectionTextureMatrix().isIdentity()}else i.REFLECTION=!1,i.REFLECTIONMAP_3D=!1,i.REFLECTIONMAP_SPHERICAL=!1,i.REFLECTIONMAP_PLANAR=!1,i.REFLECTIONMAP_CUBIC=!1,i.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,i.REFLECTIONMAP_PROJECTION=!1,i.REFLECTIONMAP_SKYBOX=!1,i.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,i.REFLECTIONMAP_EXPLICIT=!1,i.REFLECTIONMAP_EQUIRECTANGULAR=!1,i.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,i.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,i.INVERTCUBICMAP=!1,i.USESPHERICALFROMREFLECTIONMAP=!1,i.USEIRRADIANCEMAP=!1,i.USESPHERICALINVERTEX=!1,i.REFLECTIONMAP_OPPOSITEZ=!1,i.LODINREFLECTIONALPHA=!1,i.GAMMAREFLECTION=!1,i.RGBDREFLECTION=!1,i.LINEARSPECULARREFLECTION=!1;this._lightmapTexture&&Dr.a.LightmapTextureEnabled?(Mr.a.PrepareDefinesForMergedUV(this._lightmapTexture,i,"LIGHTMAP"),i.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,i.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace):i.LIGHTMAP=!1,this._emissiveTexture&&Dr.a.EmissiveTextureEnabled?Mr.a.PrepareDefinesForMergedUV(this._emissiveTexture,i,"EMISSIVE"):i.EMISSIVE=!1,Dr.a.SpecularTextureEnabled?(this._metallicTexture?(Mr.a.PrepareDefinesForMergedUV(this._metallicTexture,i,"REFLECTIVITY"),i.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,i.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,i.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,i.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(Mr.a.PrepareDefinesForMergedUV(this._reflectivityTexture,i,"REFLECTIVITY"),i.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,i.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):i.REFLECTIVITY=!1,this._microSurfaceTexture?Mr.a.PrepareDefinesForMergedUV(this._microSurfaceTexture,i,"MICROSURFACEMAP"):i.MICROSURFACEMAP=!1):(i.REFLECTIVITY=!1,i.MICROSURFACEMAP=!1),o.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap?(Mr.a.PrepareDefinesForMergedUV(this._bumpTexture,i,"BUMP"),this._useParallax&&this._albedoTexture&&Dr.a.DiffuseTextureEnabled?(i.PARALLAX=!0,i.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):i.PARALLAX=!1,i.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):i.BUMP=!1,this._environmentBRDFTexture&&Dr.a.ReflectionTextureEnabled?(i.ENVIRONMENTBRDF=!0,i.ENVIRONMENTBRDF_RGBD=this._environmentBRDFTexture.isRGBD):(i.ENVIRONMENTBRDF=!1,i.ENVIRONMENTBRDF_RGBD=!1),this._shouldUseAlphaFromAlbedoTexture()?i.ALPHAFROMALBEDO=!0:i.ALPHAFROMALBEDO=!1}i.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===t.LIGHTFALLOFF_STANDARD?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===t.LIGHTFALLOFF_GLTF?(i.USEPHYSICALLIGHTFALLOFF=!1,i.USEGLTFLIGHTFALLOFF=!0):(i.USEPHYSICALLIGHTFALLOFF=!0,i.USEGLTFLIGHTFALLOFF=!1),i.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?i.TWOSIDEDLIGHTING=!0:i.TWOSIDEDLIGHTING=!1,i.SPECULARAA=o.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}(i._areTexturesDirty||i._areMiscDirty)&&(i.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),i.PREMULTIPLYALPHA=this.alphaMode===g.a.ALPHA_PREMULTIPLIED||this.alphaMode===g.a.ALPHA_PREMULTIPLIED_PORTERDUFF,i.ALPHABLEND=this.needAlphaBlendingForMesh(e),i.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,i.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel),i._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(i),i.FORCENORMALFORWARD=this._forceNormalForward,i.RADIANCEOCCLUSION=this._useRadianceOcclusion,i.HORIZONOCCLUSION=this._useHorizonOcclusion,i._areMiscDirty&&(Mr.a.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,i),i.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(Yi.b.NormalKind),i.DEBUGMODE=this._debugMode),this.subSurface.prepareDefines(i,o),this.clearCoat.prepareDefines(i,o),this.anisotropy.prepareDefines(i,e,o),this.brdf.prepareDefines(i),this.sheen.prepareDefines(i,o),Mr.a.PrepareDefinesForFrameBoundValues(o,a,i,!!n,r),Mr.a.PrepareDefinesForAttributes(e,i,!0,!0,!0,this._transparencyMode!==t.PBRMATERIAL_OPAQUE)},t.prototype.forceCompilation=function(e,t,i){var n=this,r=h.a({clipPlane:!1},i),o=new uo,a=this._prepareEffect(e,o,void 0,void 0,void 0,r.clipPlane);a.isReady()?t&&t(this):a.onCompileObservable.add(function(){t&&t(n)})},t.prototype.buildUniformLayout=function(){var e=this._uniformBuffer;e.addUniform("vAlbedoInfos",2),e.addUniform("vAmbientInfos",4),e.addUniform("vOpacityInfos",2),e.addUniform("vEmissiveInfos",2),e.addUniform("vLightmapInfos",2),e.addUniform("vReflectivityInfos",3),e.addUniform("vMicroSurfaceSamplerInfos",2),e.addUniform("vReflectionInfos",2),e.addUniform("vReflectionPosition",3),e.addUniform("vReflectionSize",3),e.addUniform("vBumpInfos",3),e.addUniform("albedoMatrix",16),e.addUniform("ambientMatrix",16),e.addUniform("opacityMatrix",16),e.addUniform("emissiveMatrix",16),e.addUniform("lightmapMatrix",16),e.addUniform("reflectivityMatrix",16),e.addUniform("microSurfaceSamplerMatrix",16),e.addUniform("bumpMatrix",16),e.addUniform("vTangentSpaceParams",2),e.addUniform("reflectionMatrix",16),e.addUniform("vReflectionColor",3),e.addUniform("vAlbedoColor",4),e.addUniform("vLightingIntensity",4),e.addUniform("vReflectionMicrosurfaceInfos",3),e.addUniform("pointSize",1),e.addUniform("vReflectivityColor",4),e.addUniform("vEmissiveColor",3),e.addUniform("visibility",1),Wr.PrepareUniformBuffer(e),Hr.PrepareUniformBuffer(e),Yr.PrepareUniformBuffer(e),Kr.PrepareUniformBuffer(e),e.create()},t.prototype.unbind=function(){if(this._activeEffect){var t=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),t=!0),this.subSurface.unbind(this._activeEffect)&&(t=!0),t&&this._markAllSubMeshesAsTexturesDirty()}e.prototype.unbind.call(this)},t.prototype.bindForSubMesh=function(e,i,n){var r=this.getScene(),o=n._materialDefines;if(o){var a=n.effect;if(a){this._activeEffect=a,o.INSTANCES||this.bindOnlyWorldMatrix(e),o.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var c=this._mustRebind(r,a,i.visibility);Mr.a.BindBonesParameters(i,this._activeEffect);var l=null,u=this._uniformBuffer;if(c){var h=r.getEngine();if(u.bindToEffect(a,"Material"),this.bindViewProjection(a),l=this._getReflectionTexture(),!u.useUbo||!this.isFrozen||!u.isSync){if(r.texturesEnabled){if(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&(u.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),Mr.a.BindTextureMatrix(this._albedoTexture,u,"albedo")),this._ambientTexture&&Dr.a.AmbientTextureEnabled&&(u.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),Mr.a.BindTextureMatrix(this._ambientTexture,u,"ambient")),this._opacityTexture&&Dr.a.OpacityTextureEnabled&&(u.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),Mr.a.BindTextureMatrix(this._opacityTexture,u,"opacity")),l&&Dr.a.ReflectionTextureEnabled){if(u.updateMatrix("reflectionMatrix",l.getReflectionTextureMatrix()),u.updateFloat2("vReflectionInfos",l.level,0),l.boundingBoxSize){var d=l;u.updateVector3("vReflectionPosition",d.boundingBoxPosition),u.updateVector3("vReflectionSize",d.boundingBoxSize)}if(!o.USEIRRADIANCEMAP){var f=l.sphericalPolynomial;if(o.USESPHERICALFROMREFLECTIONMAP&&f)if(o.SPHERICAL_HARMONICS){var p=f.preScaledHarmonics;this._activeEffect.setVector3("vSphericalL00",p.l00),this._activeEffect.setVector3("vSphericalL1_1",p.l1_1),this._activeEffect.setVector3("vSphericalL10",p.l10),this._activeEffect.setVector3("vSphericalL11",p.l11),this._activeEffect.setVector3("vSphericalL2_2",p.l2_2),this._activeEffect.setVector3("vSphericalL2_1",p.l2_1),this._activeEffect.setVector3("vSphericalL20",p.l20),this._activeEffect.setVector3("vSphericalL21",p.l21),this._activeEffect.setVector3("vSphericalL22",p.l22)}else this._activeEffect.setFloat3("vSphericalX",f.x.x,f.x.y,f.x.z),this._activeEffect.setFloat3("vSphericalY",f.y.x,f.y.y,f.y.z),this._activeEffect.setFloat3("vSphericalZ",f.z.x,f.z.y,f.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",f.xx.x-f.zz.x,f.xx.y-f.zz.y,f.xx.z-f.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",f.yy.x-f.zz.x,f.yy.y-f.zz.y,f.yy.z-f.zz.z),this._activeEffect.setFloat3("vSphericalZZ",f.zz.x,f.zz.y,f.zz.z),this._activeEffect.setFloat3("vSphericalXY",f.xy.x,f.xy.y,f.xy.z),this._activeEffect.setFloat3("vSphericalYZ",f.yz.x,f.yz.y,f.yz.z),this._activeEffect.setFloat3("vSphericalZX",f.zx.x,f.zx.y,f.zx.z)}u.updateFloat3("vReflectionMicrosurfaceInfos",l.getSize().width,l.lodGenerationScale,l.lodGenerationOffset)}this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&(u.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),Mr.a.BindTextureMatrix(this._emissiveTexture,u,"emissive")),this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&(u.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),Mr.a.BindTextureMatrix(this._lightmapTexture,u,"lightmap")),Dr.a.SpecularTextureEnabled&&(this._metallicTexture?(u.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),Mr.a.BindTextureMatrix(this._metallicTexture,u,"reflectivity")):this._reflectivityTexture&&(u.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),Mr.a.BindTextureMatrix(this._reflectivityTexture,u,"reflectivity")),this._microSurfaceTexture&&(u.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),Mr.a.BindTextureMatrix(this._microSurfaceTexture,u,"microSurfaceSampler"))),this._bumpTexture&&h.getCaps().standardDerivatives&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&(u.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),Mr.a.BindTextureMatrix(this._bumpTexture,u,"bump"),r._mirroredCameraPosition?u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):u.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1))}this.pointsCloud&&u.updateFloat("pointSize",this.pointSize),o.METALLICWORKFLOW?(s.c.Color3[0].r=void 0===this._metallic||null===this._metallic?1:this._metallic,s.c.Color3[0].g=void 0===this._roughness||null===this._roughness?1:this._roughness,u.updateColor4("vReflectivityColor",s.c.Color3[0],0)):u.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),u.updateColor3("vEmissiveColor",Dr.a.EmissiveTextureEnabled?this._emissiveColor:s.a.BlackReadOnly),u.updateColor3("vReflectionColor",this._reflectionColor),!o.SS_REFRACTION&&this.subSurface.linkRefractionWithTransparency?u.updateColor4("vAlbedoColor",this._albedoColor,1):u.updateColor4("vAlbedoColor",this._albedoColor,this.alpha),u.updateFloat("visibility",i.visibility),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity*r.environmentIntensity,this._lightingInfos.w=this._specularIntensity,u.updateVector4("vLightingIntensity",this._lightingInfos)}r.texturesEnabled&&(this._albedoTexture&&Dr.a.DiffuseTextureEnabled&&u.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&Dr.a.AmbientTextureEnabled&&u.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&Dr.a.OpacityTextureEnabled&&u.setTexture("opacitySampler",this._opacityTexture),l&&Dr.a.ReflectionTextureEnabled&&(o.LODBASEDMICROSFURACE?u.setTexture("reflectionSampler",l):(u.setTexture("reflectionSampler",l._lodTextureMid||l),u.setTexture("reflectionSamplerLow",l._lodTextureLow||l),u.setTexture("reflectionSamplerHigh",l._lodTextureHigh||l)),o.USEIRRADIANCEMAP&&u.setTexture("irradianceSampler",l.irradianceTexture)),o.ENVIRONMENTBRDF&&u.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),this._emissiveTexture&&Dr.a.EmissiveTextureEnabled&&u.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&Dr.a.LightmapTextureEnabled&&u.setTexture("lightmapSampler",this._lightmapTexture),Dr.a.SpecularTextureEnabled&&(this._metallicTexture?u.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&u.setTexture("reflectivitySampler",this._reflectivityTexture),this._microSurfaceTexture&&u.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&h.getCaps().standardDerivatives&&Dr.a.BumpTextureEnabled&&!this._disableBumpMap&&u.setTexture("bumpSampler",this._bumpTexture)),this.subSurface.bindForSubMesh(u,r,h,this.isFrozen,o.LODBASEDMICROSFURACE),this.clearCoat.bindForSubMesh(u,r,h,this._disableBumpMap,this.isFrozen,this._invertNormalMapX,this._invertNormalMapY),this.anisotropy.bindForSubMesh(u,r,this.isFrozen),this.sheen.bindForSubMesh(u,r,this.isFrozen),Mr.a.BindClipPlane(this._activeEffect,r),r.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var _=r._forcedViewPosition?r._forcedViewPosition:r._mirroredCameraPosition?r._mirroredCameraPosition:r.activeCamera.globalPosition,m=r.useRightHandedSystem===(null!=r._mirroredCameraPosition);a.setFloat4("vEyePosition",_.x,_.y,_.z,m?-1:1),a.setColor3("vAmbientColor",this._globalAmbientColor),a.setFloat2("vDebugMode",this.debugLimit,this.debugFactor)}!c&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&Mr.a.BindLights(r,i,this._activeEffect,o,this._maxSimultaneousLights,this._lightFalloff!==t.LIGHTFALLOFF_STANDARD),(r.fogEnabled&&i.applyFog&&r.fogMode!==K.a.FOGMODE_NONE||l)&&this.bindView(a),Mr.a.BindFogParameters(r,i,this._activeEffect,!0),o.NUM_MORPH_INFLUENCERS&&Mr.a.BindMorphTargetParameters(i,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),Mr.a.BindLogDepth(o,this._activeEffect,r)),u.update(),this._afterBind(i,this._activeEffect)}}},t.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&this._albedoTexture.animations.length>0&&e.push(this._albedoTexture),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._metallicTexture&&this._metallicTexture.animations&&this._metallicTexture.animations.length>0?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&this._reflectivityTexture.animations.length>0&&e.push(this._reflectivityTexture),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.subSurface.getAnimatables(e),this.clearCoat.getAnimatables(e),this.sheen.getAnimatables(e),this.anisotropy.getAnimatables(e),e},t.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},t.prototype.getActiveTextures=function(){var t=e.prototype.getActiveTextures.call(this);return this._albedoTexture&&t.push(this._albedoTexture),this._ambientTexture&&t.push(this._ambientTexture),this._opacityTexture&&t.push(this._opacityTexture),this._reflectionTexture&&t.push(this._reflectionTexture),this._emissiveTexture&&t.push(this._emissiveTexture),this._reflectivityTexture&&t.push(this._reflectivityTexture),this._metallicTexture&&t.push(this._metallicTexture),this._microSurfaceTexture&&t.push(this._microSurfaceTexture),this._bumpTexture&&t.push(this._bumpTexture),this._lightmapTexture&&t.push(this._lightmapTexture),this.subSurface.getActiveTextures(t),this.clearCoat.getActiveTextures(t),this.sheen.getActiveTextures(t),this.anisotropy.getActiveTextures(t),t},t.prototype.hasTexture=function(t){return!!e.prototype.hasTexture.call(this,t)||(this._albedoTexture===t||(this._ambientTexture===t||(this._opacityTexture===t||(this._reflectionTexture===t||(this._reflectivityTexture===t||(this._metallicTexture===t||(this._microSurfaceTexture===t||(this._bumpTexture===t||(this._lightmapTexture===t||(this.subSurface.hasTexture(t)||this.clearCoat.hasTexture(t)||this.sheen.hasTexture(t)||this.anisotropy.hasTexture(t)))))))))))},t.prototype.dispose=function(t,i){i&&(this._albedoTexture&&this._albedoTexture.dispose(),this._ambientTexture&&this._ambientTexture.dispose(),this._opacityTexture&&this._opacityTexture.dispose(),this._reflectionTexture&&this._reflectionTexture.dispose(),this._environmentBRDFTexture&&this.getScene().environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._emissiveTexture&&this._emissiveTexture.dispose(),this._metallicTexture&&this._metallicTexture.dispose(),this._reflectivityTexture&&this._reflectivityTexture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._lightmapTexture&&this._lightmapTexture.dispose()),this.subSurface.dispose(i),this.clearCoat.dispose(i),this.sheen.dispose(i),this.anisotropy.dispose(i),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e.prototype.dispose.call(this,t,i)},t.PBRMATERIAL_OPAQUE=0,t.PBRMATERIAL_ALPHATEST=1,t.PBRMATERIAL_ALPHABLEND=2,t.PBRMATERIAL_ALPHATESTANDBLEND=3,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=0,t.LIGHTFALLOFF_PHYSICAL=0,t.LIGHTFALLOFF_GLTF=1,t.LIGHTFALLOFF_STANDARD=2,h.c([Object(F.i)()],t.prototype,"_imageProcessingConfiguration",void 0),h.c([Object(F.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"debugMode",void 0),h.c([Object(F.c)()],t.prototype,"useLogarithmicDepth",null),h.c([Object(F.c)()],t.prototype,"transparencyMode",null),t}(Ir.a),fo=function(e){function t(i,n){var r=e.call(this,i,n)||this;return r.directIntensity=1,r.emissiveIntensity=1,r.environmentIntensity=1,r.specularIntensity=1,r.disableBumpMap=!1,r.ambientTextureStrength=1,r.ambientTextureImpactOnAnalyticalLights=t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,r.ambientColor=new s.a(0,0,0),r.albedoColor=new s.a(1,1,1),r.reflectivityColor=new s.a(1,1,1),r.reflectionColor=new s.a(1,1,1),r.emissiveColor=new s.a(0,0,0),r.microSurface=1,r.useLightmapAsShadowmap=!1,r.useAlphaFromAlbedoTexture=!1,r.forceAlphaTest=!1,r.alphaCutOff=.4,r.useSpecularOverAlpha=!0,r.useMicroSurfaceFromReflectivityMapAlpha=!1,r.useRoughnessFromMetallicTextureAlpha=!0,r.useRoughnessFromMetallicTextureGreen=!1,r.useMetallnessFromMetallicTextureBlue=!1,r.useAmbientOcclusionFromMetallicTextureRed=!1,r.useAmbientInGrayScale=!1,r.useAutoMicroSurfaceFromReflectivityMap=!1,r.useRadianceOverAlpha=!0,r.useObjectSpaceNormalMap=!1,r.useParallax=!1,r.useParallaxOcclusion=!1,r.parallaxScaleBias=.05,r.disableLighting=!1,r.forceIrradianceInFragment=!1,r.maxSimultaneousLights=4,r.invertNormalMapX=!1,r.invertNormalMapY=!1,r.twoSidedLighting=!1,r.useAlphaFresnel=!1,r.useLinearAlphaFresnel=!1,r.environmentBRDFTexture=null,r.forceNormalForward=!1,r.enableSpecularAntiAliasing=!1,r.useHorizonOcclusion=!0,r.useRadianceOcclusion=!0,r.unlit=!1,r._environmentBRDFTexture=jr.GetEnvironmentBRDFTexture(n),r}return h.d(t,e),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this.subSurface.refractionTexture},set:function(e){this.subSurface.refractionTexture=e,e?this.subSurface.isRefractionEnabled=!0:this.subSurface.linkRefractionWithTransparency||(this.subSurface.isRefractionEnabled=!1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"indexOfRefraction",{get:function(){return 1/this.subSurface.indexOfRefraction},set:function(e){this.subSurface.indexOfRefraction=1/e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"invertRefractionY",{get:function(){return this.subSurface.invertRefractionY},set:function(e){this.subSurface.invertRefractionY=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkRefractionWithTransparency",{get:function(){return this.subSurface.linkRefractionWithTransparency},set:function(e){this.subSurface.linkRefractionWithTransparency=e,e&&(this.subSurface.isRefractionEnabled=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===ho.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ho.LIGHTFALLOFF_PHYSICAL:ho.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===ho.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?ho.LIGHTFALLOFF_GLTF:ho.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),t.prototype.getClassName=function(){return"PBRMaterial"},t.prototype.clone=function(e){var i=this,n=F.a.Clone(function(){return new t(e,i.getScene())},this);return n.id=e,n.name=e,this.clearCoat.copyTo(n.clearCoat),this.anisotropy.copyTo(n.anisotropy),this.brdf.copyTo(n.brdf),this.sheen.copyTo(n.sheen),n},t.prototype.serialize=function(){var e=F.a.Serialize(this);return e.customType="BABYLON.PBRMaterial",e.clearCoat=this.clearCoat.serialize(),e.anisotropy=this.anisotropy.serialize(),e.brdf=this.brdf.serialize(),e.sheen=this.sheen.serialize(),e.subSurface=this.subSurface.serialize(),e},t.Parse=function(e,i,n){var r=F.a.Parse(function(){return new t(e.name,i)},e,i,n);return e.clearCoat&&r.clearCoat.parse(e.clearCoat,i,n),e.anisotropy&&r.anisotropy.parse(e.anisotropy,i,n),e.brdf&&r.brdf.parse(e.brdf,i,n),e.sheen&&r.sheen.parse(e.sheen,i,n),e.subSurface&&r.subSurface.parse(e.subSurface,i,n),r},t.PBRMATERIAL_OPAQUE=ho.PBRMATERIAL_OPAQUE,t.PBRMATERIAL_ALPHATEST=ho.PBRMATERIAL_ALPHATEST,t.PBRMATERIAL_ALPHABLEND=ho.PBRMATERIAL_ALPHABLEND,t.PBRMATERIAL_ALPHATESTANDBLEND=ho.PBRMATERIAL_ALPHATESTANDBLEND,t.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=ho.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"directIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"specularIntensity",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"disableBumpMap",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureStrength",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"opacityTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallicTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"metallic",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"roughness",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurfaceTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty",null)],t.prototype,"lightmapTexture",void 0),h.c([Object(F.e)("ambient"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"ambientColor",void 0),h.c([Object(F.e)("albedo"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"albedoColor",void 0),h.c([Object(F.e)("reflectivity"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectivityColor",void 0),h.c([Object(F.e)("reflection"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"reflectionColor",void 0),h.c([Object(F.e)("emissive"),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"emissiveColor",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"microSurface",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLightmapAsShadowmap",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"useAlphaFromAlbedoTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"forceAlphaTest",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesAndMiscDirty")],t.prototype,"alphaCutOff",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useSpecularOverAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRoughnessFromMetallicTextureGreen",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useMetallnessFromMetallicTextureBlue",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAmbientInGrayScale",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),h.c([Object(F.c)()],t.prototype,"usePhysicalLightFalloff",null),h.c([Object(F.c)()],t.prototype,"useGLTFLightFalloff",null),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOverAlpha",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useObjectSpaceNormalMap",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallax",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useParallaxOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"parallaxScaleBias",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceIrradianceInFragment",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapX",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"invertNormalMapY",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"twoSidedLighting",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useAlphaFresnel",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useLinearAlphaFresnel",void 0),h.c([Object(F.m)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"environmentBRDFTexture",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"forceNormalForward",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"enableSpecularAntiAliasing",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useHorizonOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsTexturesDirty")],t.prototype,"useRadianceOcclusion",void 0),h.c([Object(F.c)(),Object(F.b)("_markAllSubMeshesAsMiscDirty")],t.prototype,"unlit",void 0),t}(ho);c.a.RegisteredTypes["BABYLON.PBRMaterial"]=fo;var po=i(71),_o=i(83);function mo(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var go=mo("DXT1"),vo=mo("DXT3"),yo=mo("DXT5"),bo=mo("DX10"),To=function(){function e(){}return e.GetDDSInfo=function(e){var t=new Int32Array(e,0,31),i=new Int32Array(e,0,35),n=1;131072&t[2]&&(n=Math.max(1,t[7]));var r=t[21],o=r===bo?i[32]:0,a=g.a.TEXTURETYPE_UNSIGNED_INT;switch(r){case 113:a=g.a.TEXTURETYPE_HALF_FLOAT;break;case 116:a=g.a.TEXTURETYPE_FLOAT;break;case bo:if(10===o){a=g.a.TEXTURETYPE_HALF_FLOAT;break}if(2===o){a=g.a.TEXTURETYPE_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:n,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:131072==(131072&t[20]),isCube:512==(512&t[28]),isCompressed:r===go||r===vo||r===yo,dxgiFormat:o,textureType:a}},e._ToHalfFloat=function(t){e._FloatView||(e._FloatView=new Float32Array(1),e._Int32View=new Int32Array(e._FloatView.buffer)),e._FloatView[0]=t;var i=e._Int32View[0],n=i>>16&32768,r=i>>12&2047,o=i>>23&255;return o<103?n:o>142?(n|=31744,n|=(255==o?0:1)&&8388607&i):o<113?n|=((r|=2048)>>114-o)+(r>>113-o&1):(n|=o-112<<10|r>>1,n+=1&r)},e._FromHalfFloat=function(e){var t=(32768&e)>>15,i=(31744&e)>>10,n=1023&e;return 0===i?(t?-1:1)*Math.pow(2,-14)*(n/Math.pow(2,10)):31==i?n?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+n/Math.pow(2,10))},e._GetHalfFloatAsFloatRGBAArrayBuffer=function(t,i,n,r,o,a){for(var s=new Float32Array(r),c=new Uint16Array(o,n),l=0,u=0;u>8)},e._GetRGBArrayBuffer=function(e,t,i,n,r,o,a,s){for(var c=new Uint8Array(n),l=new Uint8Array(r,i),u=0,h=0;h>8&255,S>>16&255,S>>24&255)))}var C=e._ExtractLongWordOrder(b[23]),M=e._ExtractLongWordOrder(b[24]),O=e._ExtractLongWordOrder(b[25]),I=e._ExtractLongWordOrder(b[26]);R&&(E=t._getRGBABufferInternalSizedFormat(r.textureType)),_=1,131072&b[2]&&!1!==o&&(_=Math.max(1,b[7]));for(var D=c||0;D0?r.sphericalPolynomial=_o.a.ConvertCubeMapToSphericalPolynomial({size:b[4],right:l[0],left:l[1],up:l[2],down:l[3],front:l[4],back:l[5],format:g.a.TEXTUREFORMAT_RGBA,type:g.a.TEXTURETYPE_FLOAT,gammaSpace:!1}):r.sphericalPolynomial=void 0}else m.a.Error("Compressed textures are not supported on this platform.");else m.a.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else m.a.Error("Invalid magic number in DDS header")},e.StoreLODInAlphaChannel=!1,e}();Ce.b.prototype.createPrefilteredCubeTexture=function(e,t,i,n,r,o,a,s,c){var l=this;void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===c&&(c=!0);return this.createCubeTexture(e,t,null,!1,function(e){if(e){var o=e.texture;if(c?e.info.sphericalPolynomial&&(o._sphericalPolynomial=e.info.sphericalPolynomial):o._sphericalPolynomial=new po.b,o._dataSource=et.a.DATASOURCE_CUBEPREFILTERED,l.getCaps().textureLOD)r&&r(o);else{var a=l._gl,s=e.width;if(s){for(var u=[],h=0;h<3;h++){var d=1-h/2,f=n,p=w.a.Log2(s)*i+n,_=f+(p-f)*d,g=Math.round(Math.min(Math.max(_,0),p)),v=new et.a(l,et.a.DATASOURCE_TEMP);if(v.type=o.type,v.format=o.format,v.width=Math.pow(2,Math.max(w.a.Log2(s)-g,0)),v.height=v.width,v.isCube=!0,l._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),e.isDDS){var y=e.info,b=e.data;l._unpackFlipY(y.isCompressed),To.UploadDDSLevels(l,v,b,y,!0,6,g)}else m.a.Warn("DDS is the only prefiltered cube map supported so far.");l._bindTextureDirectly(a.TEXTURE_CUBE_MAP,null);var T=new yr.a(t);T.isCube=!0,T._texture=v,v.isReady=!0,u.push(T)}o._lodTextureHigh=u[2],o._lodTextureMid=u[1],o._lodTextureLow=u[0],r&&r(o)}}}else r&&r(null)},o,a,s,c,i,n)};var Eo=function(){function e(){this.supportCascades=!0}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".dds")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,n,r){var o,a=t.getEngine(),s=!1;if(Array.isArray(e))for(var c=0;c1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),To.UploadDDSLevels(a,t,l,o,s,6,-1,c),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}else{var u=e;o=To.GetDDSInfo(u),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new po.b),s=(o.isRGB||o.isLuminance||o.mipmapCount>1)&&t.generateMipMaps,a._unpackFlipY(o.isCompressed),To.UploadDDSLevels(a,t,u,o,s,6),o.isFourCC||1!==o.mipmapCount||a.generateMipMapsForCubemap(t)}a._setCubeMapTextureParams(s),t.isReady=!0,n&&n({isDDS:!0,width:t.width,info:o,data:e,texture:t})},e.prototype.loadData=function(e,t,i){var n=To.GetDDSInfo(e),r=(n.isRGB||n.isLuminance||n.mipmapCount>1)&&t.generateMipMaps&&n.width>>n.mipmapCount-1==1;i(n.width,n.height,r,n.isFourCC,function(){To.UploadDDSLevels(t.getEngine(),t,e,n,r,1)})},e}();Ce.b._TextureLoaders.push(new Eo);var Ao="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include\nvoid main(void)\n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}";ni.a.ShadersStore.rgbdEncodePixelShader=Ao;var Po=function(){function e(){}return e.GetEnvInfo=function(t){for(var i=new DataView(t),n=0,r=0;r-1?e.substring(0,i):e)+t},e.prototype.getFallbackTextureUrl=function(e,t){var i=new RegExp(t+"$");return e.replace(i,"")},e.prototype.loadCubeData=function(e,t,i,n,r){if(!Array.isArray(e)){t._invertVScale=!t.invertY;var o=t.getEngine(),a=new Ro(e,6),s=a.numberOfMipmapLevels>1&&t.generateMipMaps;o._unpackFlipY(!0),a.uploadLevels(t,t.generateMipMaps),t.width=a.pixelWidth,t.height=a.pixelHeight,o._setCubeMapTextureParams(s),t.isReady=!0}},e.prototype.loadData=function(e,t,i){t._invertVScale=!t.invertY;var n=new Ro(e,1);i(n.pixelWidth,n.pixelHeight,!1,!0,function(){n.uploadLevels(t,t.generateMipMaps)},n.isInvalid)},e}();Ce.b._TextureLoaders.unshift(new xo);var Co=function(){function e(){}return e.CreateAsync=function(t,i){var n=new e;return sn.CreateAsync(t).then(function(e){return n.baseExperience=e,n.input=new dn(e),n.controllerModelLoader=new Sn(n.input),n.pointerSelection=new pn(n.input),n.teleportation=new fn(n.input,i.floorMeshes),n.outputCanvas=new Rn(e,t.getEngine().getRenderingCanvas()),un.CreateAsync(t,n.baseExperience,{webXRManagedOutputCanvas:n.outputCanvas})}).then(function(e){return n.enterExitUI=e,n})},e.prototype.dispose=function(){this.baseExperience&&this.baseExperience.dispose(),this.input&&this.input.dispose(),this.enterExitUI&&this.enterExitUI.dispose(),this.outputCanvas&&this.outputCanvas.dispose()},e}();K.a.prototype.createDefaultLight=function(e){if(void 0===e&&(e=!1),e&&this.lights)for(var t=0;t=c.video.HAVE_CURRENT_DATA;return!s.poster||s.autoPlay&&l?l&&c._createInternalTexture():(c._texture=c._engine.createTexture(s.poster,!1,!0,n),c._displayingPosterTexture=!0),c}return h.d(t,e),Object.defineProperty(t.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new o.c),this._onUserActionRequestedObservable},enumerable:!0,configurable:!0}),t.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},t.prototype._getVideo=function(e){if(e instanceof HTMLVideoElement)return Ie.b.SetCorsBehavior(e.currentSrc,e),e;var t=document.createElement("video");return"string"==typeof e?(Ie.b.SetCorsBehavior(e,t),t.src=e):(Ie.b.SetCorsBehavior(e[0],t),e.forEach(function(e){var i=document.createElement("source");i.src=e,t.appendChild(i)})),t},t.prototype._rebuild=function(){this.update()},t.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},t.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},t.prototype.updateURL=function(e){this.video.src=e},t.prototype.dispose=function(){e.prototype.dispose.call(this),this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener(this._createInternalTextureOnEvent,this._createInternalTexture),this.video.removeEventListener("paused",this._updateInternalTexture),this.video.removeEventListener("seeked",this._updateInternalTexture),this.video.removeEventListener("emptied",this.reset),this.video.pause()},t.CreateFromStreamAsync=function(e,i){var n=document.createElement("video");return n.setAttribute("autoplay",""),n.setAttribute("muted","true"),n.setAttribute("playsinline",""),n.muted=!0,void 0!==n.mozSrcObject?n.mozSrcObject=i:"object"==typeof n.srcObject?n.srcObject=i:(window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,n.src=window.URL&&window.URL.createObjectURL(i)),new Promise(function(i){var r=function(){i(new t("video",n,e,!0,!0)),n.removeEventListener("playing",r)};n.addEventListener("playing",r),n.play()})},t.CreateFromWebCamAsync=function(e,t,i){var n,r=this;return void 0===i&&(i=!1),t&&t.deviceId&&(n={exact:t.deviceId}),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({video:t,audio:i}).then(function(t){return r.CreateFromStreamAsync(e,t)}):(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia&&navigator.getUserMedia({video:{deviceId:n,width:{min:t&&t.minWidth||256,max:t&&t.maxWidth||640},height:{min:t&&t.minHeight||256,max:t&&t.maxHeight||480}},audio:i},function(t){return r.CreateFromStreamAsync(e,t)},function(e){m.a.Error(e.name)}),Promise.reject("No support for userMedia on this device"))},t.CreateFromWebCam=function(e,t,i,n){void 0===n&&(n=!1),this.CreateFromWebCamAsync(e,i,n).then(function(e){t&&t(e)}).catch(function(e){m.a.Error(e.name)})},t}($e.a),Oo=function(){function e(e,t){void 0===e&&(e=a.e.Zero()),void 0===t&&(t=a.e.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e}(),Io=function(){function e(e,t,i){void 0===e&&(e=a.e.Zero()),void 0===t&&(t=a.e.Up()),void 0===i&&(i=a.d.Zero()),this.position=e,this.normal=t,this.uv=i}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e}(),Do=function(e){function t(i,n,r,o){var s=e.call(this,i,o)||this;s._halfDome=!1,s._useDirectMapping=!1,s._videoMode=t.MODE_MONOSCOPIC,s._onBeforeCameraRenderObserver=null,o=s.getScene(),i=i||"videoDome",r.resolution=0|Math.abs(r.resolution)||32,r.clickToPlay=Boolean(r.clickToPlay),r.autoPlay=void 0===r.autoPlay||Boolean(r.autoPlay),r.loop=void 0===r.loop||Boolean(r.loop),r.size=Math.abs(r.size)||(o.activeCamera?.48*o.activeCamera.maxZ:1e3),void 0===r.useDirectMapping?s._useDirectMapping=!0:s._useDirectMapping=r.useDirectMapping,void 0===r.faceForward&&(r.faceForward=!0),s._setReady(!1);var c={loop:r.loop,autoPlay:r.autoPlay,autoUpdateTexture:!0,poster:r.poster},l=s._material=new Vr(i+"_material",o),u=s._videoTexture=new Mo(i+"_texture",n,o,!1,s._useDirectMapping,$e.a.TRILINEAR_SAMPLINGMODE,c);if(s._mesh=Se.a.CreateSphere(i+"_mesh",r.resolution,r.size,o,!1,Se.a.BACKSIDE),u.onLoadObservable.addOnce(function(){s._setReady(!0)}),l.useEquirectangularFOV=!0,l.fovMultiplier=1,l.opacityFresnel=!1,s._useDirectMapping?(u.wrapU=$e.a.CLAMP_ADDRESSMODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,l.diffuseTexture=u):(u.coordinatesMode=$e.a.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,u.wrapV=$e.a.CLAMP_ADDRESSMODE,l.reflectionTexture=u),s._mesh.material=l,s._mesh.parent=s,s._halfDomeMask=tr.a.CreateSphere("",{slice:.5,diameter:.99*r.size,segments:r.resolution,sideOrientation:Se.a.BACKSIDE},o),s._halfDomeMask.rotate(Z.a.X,-Math.PI/2),s._halfDomeMask.parent=s._mesh,s._halfDome=!!r.halfDomeMode,s._halfDomeMask.setEnabled(s._halfDome),r.clickToPlay&&(o.onPointerUp=function(){s._videoTexture.video.play()}),r.faceForward&&o.activeCamera){var h=o.activeCamera,d=a.e.Forward(),f=a.e.TransformNormal(d,h.getViewMatrix());f.normalize(),s.rotation.y=Math.acos(a.e.Dot(d,f))}return s}return h.d(t,e),Object.defineProperty(t.prototype,"videoTexture",{get:function(){return this._videoTexture},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"videoMode",{get:function(){return this._videoMode},set:function(e){this._videoMode!==e&&this._changeVideoMode(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"halfDome",{get:function(){return this._halfDome},set:function(e){this._halfDome=e,this._halfDomeMask.setEnabled(e)},enumerable:!0,configurable:!0}),t.prototype._changeVideoMode=function(e){var i=this;switch(this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._videoMode=e,this._videoTexture.uScale=1,this._videoTexture.vScale=1,this._videoTexture.uOffset=0,this._videoTexture.vOffset=0,e){case t.MODE_SIDEBYSIDE:this._videoTexture.uScale=this._halfDome?.99999:.5;var n=this._halfDome?0:.5,r=this._halfDome?.5:0;this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){i._videoTexture.uOffset=e.isRightCamera?n:r});break;case t.MODE_TOPBOTTOM:this._videoTexture.vScale=this._halfDome?.99999:.5,this._onBeforeCameraRenderObserver=this._scene.onBeforeCameraRenderObservable.add(function(e){i._videoTexture.vOffset=e.isRightCamera?.5:0})}},t.prototype.dispose=function(t,i){void 0===i&&(i=!1),this._videoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),this._scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),e.prototype.dispose.call(this,t,i)},t.MODE_MONOSCOPIC=0,t.MODE_TOPBOTTOM=1,t.MODE_SIDEBYSIDE=2,t}(ar.a),Lo=i(47),wo=function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new Lo.a,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Lo.a,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}return Object.defineProperty(e.prototype,"gpuFrameTimeCounter",{get:function(){return this._gpuFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureGPUFrameTime",{get:function(){return this._captureGPUFrameTime},set:function(e){var t=this;e!==this._captureGPUFrameTime&&(this._captureGPUFrameTime=e,e?(this._onBeginFrameObserver=this.engine.onBeginFrameObservable.add(function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.engine.startTimeQuery())}),this._onEndFrameObserver=this.engine.onEndFrameObservable.add(function(){if(t._gpuFrameTimeToken){var e=t.engine.endTimeQuery(t._gpuFrameTimeToken);e>-1&&(t._gpuFrameTimeToken=null,t._gpuFrameTime.fetchNewFrame(),t._gpuFrameTime.addCount(e,!0))}})):(this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shaderCompilationTimeCounter",{get:function(){return this._shaderCompilationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureShaderCompilationTime",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&(this._captureShaderCompilationTime=e,e?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add(function(){t._shaderCompilationTime.fetchNewFrame(),t._shaderCompilationTime.beginMonitoring()}),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add(function(){t._shaderCompilationTime.endMonitoring()})):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null},e}(),Fo=function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Lo.a,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Lo.a,this._captureFrameTime=!1,this._frameTime=new Lo.a,this._captureRenderTime=!1,this._renderTime=new Lo.a,this._captureInterFrameTime=!1,this._interFrameTime=new Lo.a,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Lo.a,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Lo.a,this._capturePhysicsTime=!1,this._physicsTime=new Lo.a,this._captureAnimationsTime=!1,this._animationsTime=new Lo.a,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Lo.a,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add(function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(Ie.b.StartPerformanceCounter("Scene rendering"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame()}),this._onAfterRenderObserver=e.onAfterRenderObservable.add(function(){t._captureFrameTime&&(Ie.b.EndPerformanceCounter("Scene rendering"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()})}return Object.defineProperty(e.prototype,"activeMeshesEvaluationTimeCounter",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureActiveMeshesEvaluationTime",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&(this._captureActiveMeshesEvaluationTime=e,e?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add(function(){Ie.b.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()}),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add(function(){Ie.b.EndPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.endMonitoring()})):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTargetsRenderTimeCounter",{get:function(){return this._renderTargetsRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTargetsRenderTime",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&(this._captureRenderTargetsRenderTime=e,e?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add(function(){Ie.b.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()}),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add(function(){Ie.b.EndPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.endMonitoring(!1)})):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"particlesRenderTimeCounter",{get:function(){return this._particlesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureParticlesRenderTime",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&(this._captureParticlesRenderTime=e,e?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add(function(){Ie.b.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()}),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add(function(){Ie.b.EndPerformanceCounter("Particles"),t._particlesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spritesRenderTimeCounter",{get:function(){return this._spritesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureSpritesRenderTime",{get:function(){return this._captureSpritesRenderTime},set:function(e){var t=this;e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add(function(){Ie.b.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()}),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add(function(){Ie.b.EndPerformanceCounter("Sprites"),t._spritesRenderTime.endMonitoring(!1)})):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicsTimeCounter",{get:function(){return this._physicsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"capturePhysicsTime",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&(this._capturePhysicsTime=e,e?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add(function(){Ie.b.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()}),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add(function(){Ie.b.EndPerformanceCounter("Physics"),t._physicsTime.endMonitoring()})):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationsTimeCounter",{get:function(){return this._animationsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureAnimationsTime",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&(this._captureAnimationsTime=e,e?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add(function(){t._animationsTime.endMonitoring()}):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameTimeCounter",{get:function(){return this._frameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureFrameTime",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interFrameTimeCounter",{get:function(){return this._interFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureInterFrameTime",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&(this._captureRenderTime=e,e?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add(function(){t._renderTime.beginMonitoring(),Ie.b.StartPerformanceCounter("Main render")}),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add(function(){t._renderTime.endMonitoring(!1),Ie.b.EndPerformanceCounter("Main render")})):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraRenderTimeCounter",{get:function(){return this._cameraRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureCameraRenderTime",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&(this._captureCameraRenderTime=e,e?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add(function(e){t._cameraRenderTime.beginMonitoring(),Ie.b.StartPerformanceCounter("Rendering camera "+e.name)}),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add(function(e){t._cameraRenderTime.endMonitoring(!1),Ie.b.EndPerformanceCounter("Rendering camera "+e.name)})):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"drawCallsCounter",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null},e}(),No=i(25),Bo="#ifdef DIFFUSE\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef OPACITY\nvarying vec2 vUVOpacity;\nuniform sampler2D opacitySampler;\nuniform float opacityIntensity;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef VERTEXALPHA\nvarying vec4 vColor;\n#endif\nuniform vec4 glowColor;\nvoid main(void)\n{\nvec4 finalColor=glowColor;\n\n#ifdef DIFFUSE\nvec4 albedoTexture=texture2D(diffuseSampler,vUVDiffuse);\nfinalColor.a*=albedoTexture.a;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vUVOpacity);\n#ifdef OPACITYRGB\nfinalColor.a*=getLuminance(opacityMap.rgb);\n#else\nfinalColor.a*=opacityMap.a;\n#endif\nfinalColor.a*=opacityIntensity;\n#endif\n#ifdef VERTEXALPHA\nfinalColor.a*=vColor.a;\n#endif\n#ifdef ALPHATEST\nif (finalColor.a4&&(o.push(Yi.b.MatricesIndicesExtraKind),o.push(Yi.b.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+a.numBoneInfluencers);var p=a.skeleton;p&&p.isUsingTextureForMatrices?r.push("#define BONETEXTURE"):r.push("#define BonesPerMesh "+(p?p.bones.length+1:0)),a.numBoneInfluencers>0&&f.addCPUSkinningFallback(0,a)}else r.push("#define NUM_BONE_INFLUENCERS 0");var _=a.morphTargetManager,m=0;_&&_.numInfluencers>0&&(r.push("#define MORPHTARGETS"),m=_.numInfluencers,r.push("#define NUM_MORPH_INFLUENCERS "+m),Mr.a.PrepareAttributesForMorphTargetsInfluencers(o,a,m)),t&&(r.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(o)),this._addCustomEffectDefines(r);var g=r.join("\n");return this._cachedDefines!==g&&(this._cachedDefines=g,this._effectLayerMapGenerationEffect=this._scene.getEngine().createEffect("glowMapGeneration",o,["world","mBones","viewProjection","glowColor","morphTargetInfluences","boneTextureWidth","diffuseMatrix","emissiveMatrix","opacityMatrix","opacityIntensity"],["diffuseSampler","emissiveSampler","opacitySampler","boneSampler"],g,f,void 0,void 0,{maxSimultaneousMorphTargets:m})),this._effectLayerMapGenerationEffect.isReady()},e.prototype.render=function(){var e=this._mergeEffect;if(e.isReady()){for(var t=0;t-1&&this._scene.effectLayers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},e.prototype.getClassName=function(){return"EffectLayer"},e.Parse=function(e,t,i){return Ie.b.Instantiate(e.customType).Parse(e,t,i)},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("EffectLayerSceneComponent")},h.c([Object(F.c)()],e.prototype,"name",void 0),h.c([Object(F.f)()],e.prototype,"neutralColor",void 0),h.c([Object(F.c)()],e.prototype,"isEnabled",void 0),h.c([Object(F.d)()],e.prototype,"camera",null),h.c([Object(F.c)()],e.prototype,"renderingGroupId",null),e}();n.a.AddParser(Fe.a.NAME_EFFECTLAYER,function(e,t,i,n){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var r=0;r0){this._previousStencilState=this._engine.getStencilBuffer();for(var n=0,r=i;n-1)){this._renderEffects=!0,this._needStencil=this._needStencil||o.needStencil();var a=o._mainTexture;a._shouldRender()&&(this.scene.incrementRenderId(),a.render(!1,!1),t=!0)}}this.scene.incrementRenderId()}return t},e.prototype._setStencil=function(){this._needStencil&&this._engine.setStencilBuffer(!0)},e.prototype._setStencilBack=function(){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},e.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i0&&e.isBackground===t&&e.renderTargetTextures.indexOf(n)>-1&&0!=(e.layerMask&i)},e.prototype._drawRenderTargetBackground=function(e){var t=this;this._draw(function(i){return t._drawRenderTargetPredicate(i,!0,t.scene.activeCamera.layerMask,e)})},e.prototype._drawRenderTargetForeground=function(e){var t=this;this._draw(function(i){return t._drawRenderTargetPredicate(i,!1,t.scene.activeCamera.layerMask,e)})},e.prototype.addFromContainer=function(e){var t=this;e.layers&&e.layers.forEach(function(e){t.scene.layers.push(e)})},e.prototype.removeFromContainer=function(e,t){var i=this;void 0===t&&(t=!1),e.layers&&e.layers.forEach(function(e){var n=i.scene.layers.indexOf(e);-1!==n&&i.scene.layers.splice(n,1),t&&e.dispose()})},e}(),Ko="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}";ni.a.ShadersStore.layerPixelShader=Ko;var Qo="\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}";ni.a.ShadersStore.layerVertexShader=Qo;var qo=function(){function e(e,t,i,n,r){this.name=e,this.scale=new a.d(1,1),this.offset=new a.d(0,0),this.alphaBlendingMode=g.a.ALPHA_COMBINE,this.layerMask=268435455,this.renderTargetTextures=[],this.renderOnlyInRenderTargetTextures=!1,this._vertexBuffers={},this.onDisposeObservable=new o.c,this.onBeforeRenderObservable=new o.c,this.onAfterRenderObservable=new o.c,this.texture=t?new $e.a(t,i,!0):null,this.isBackground=void 0===n||n,this.color=void 0===r?new s.b(1,1,1,1):r,this._scene=i||C.a.LastCreatedScene;var c=this._scene._getComponent(Fe.a.NAME_LAYER);c||(c=new Yo(this._scene),this._scene._addComponent(c)),this._scene.layers.push(this);var l=this._scene.getEngine(),u=[];u.push(1,1),u.push(-1,1),u.push(-1,-1),u.push(1,-1);var h=new Yi.b(l,u,Yi.b.PositionKind,!1,!1,2);this._vertexBuffers[Yi.b.PositionKind]=h,this._createIndexBuffer(),this._effect=l.createEffect("layer",[Yi.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],""),this._alphaTestEffect=l.createEffect("layer",[Yi.b.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],"#define ALPHATEST")}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!0,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){var e=this.alphaTest?this._alphaTestEffect:this._effect;if(e.isReady()&&this.texture&&this.texture.isReady()){var t=this._scene.getEngine();this.onBeforeRenderObservable.notifyObservers(this),t.enableEffect(e),t.setState(!1),e.setTexture("textureSampler",this.texture),e.setMatrix("textureMatrix",this.texture.getTextureMatrix()),e.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),e.setVector2("offset",this.offset),e.setVector2("scale",this.scale),t.bindBuffers(this._vertexBuffers,this._indexBuffer,e),this.alphaTest?t.drawElementsType(No.a.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(No.a.TriangleFillMode,0,6),t.setAlphaMode(g.a.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&(e.dispose(),this._vertexBuffers[Yi.b.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null),this.renderTargetTextures=[];var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e}(),Zo=function(){function e(e,t,i,n,r){this.size=e,this.position=t,this.alphaMode=g.a.ALPHA_ONEONE,this.color=i||new s.a(1,1,1),this.texture=n?new $e.a(n,r.getScene(),!0):null,this._system=r,r.lensFlares.push(this)}return e.AddFlare=function(t,i,n,r,o){return new e(t,i,n,r,o)},e.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},e}(),Jo="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}";ni.a.ShadersStore.lensFlarePixelShader=Jo;var $o="\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.lensFlareVertexShader=$o;var ea=function(){function e(t,i,n){this.name=t,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=n||C.a.LastCreatedScene,e._SceneComponentInitialization(this._scene),this._emitter=i,this.id=t,n.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return n.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&n.activeCamera.layerMask)};var r=n.getEngine(),o=[];o.push(1,1),o.push(-1,1),o.push(-1,-1),o.push(1,-1),this._vertexBuffers[Yi.b.PositionKind]=new Yi.b(r,o,Yi.b.PositionKind,!1,!1,2);var a=[];a.push(0),a.push(1),a.push(2),a.push(0),a.push(2),a.push(3),this._indexBuffer=r.createIndexBuffer(a),this._effect=r.createEffect("lensFlare",[Yi.b.PositionKind],["color","viewportMatrix"],["textureSampler"],"")}return Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEmitter=function(){return this._emitter},e.prototype.setEmitter=function(e){this._emitter=e},e.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},e.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition();return t=a.e.Project(t,a.a.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=a.e.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),this.viewportBorder>0&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder),t.z>0&&(this._positionX>e.x&&this._positionXe.y&&(this._positionY,e.y,e.height),!0)},e.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();var i=new jt.a(this._scene.activeCamera.globalPosition,e),n=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!n||!n.hit||n.distance>t},e.prototype.render=function(){if(!this._effect.isReady()||!this._scene.activeCamera)return!1;var e,t,i=this._scene.getEngine(),n=this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(!0),i.getRenderHeight(!0));if(!this.computeEffectivePosition(n))return!1;if(!this._isVisible())return!1;var r=(e=this._positionXn.x+n.width-this.borderLimit?this._positionX-n.x-n.width+this.borderLimit:0)>(t=this._positionYn.y+n.height-this.borderLimit?this._positionY-n.y-n.height+this.borderLimit:0)?e:t;(r-=this.viewportBorder)>this.borderLimit&&(r=this.borderLimit);var o=1-w.a.Clamp(r/this.borderLimit,0,1);if(o<0)return!1;o>1&&(o=1),this.viewportBorder>0&&(n.x+=this.viewportBorder,n.y+=this.viewportBorder,n.width-=2*this.viewportBorder,n.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var s=n.x+n.width/2,c=n.y+n.height/2,l=s-this._positionX,u=c-this._positionY;i.enableEffect(this._effect),i.setState(!1),i.setDepthBuffer(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect);for(var h=0;h0);for(var i=0,n=t;i0)}},e}();ea._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_LENSFLARESYSTEM);t||(t=new ta(e),e._addComponent(t))};var ia="#ifndef FLOAT\n#include\n#endif\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=vDepthMetric;\n#ifdef ESM\ndepth=clamp(exp(-min(87.,biasAndScale.z*depth)),0.,1.);\n#endif\n#ifdef FLOAT\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depth);\n#endif\n}";ni.a.ShadersStore.shadowMapPixelShader=ia;var na="\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\nuniform vec3 lightData;\n#endif\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\n#include\n#include\nuniform mat4 viewProjection;\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#include\n#include\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvec3 worldNor=normalize(normalWorld*normal);\n#ifdef DIRECTIONINLIGHTDATA\nvec3 worldLightDir=normalize(-lightData.xyz);\n#else\nvec3 directionToLight=lightData.xyz-worldPos.xyz;\nvec3 worldLightDir=normalize(directionToLight);\n#endif\nfloat ndl=dot(worldNor,worldLightDir);\nfloat sinNL=sqrt(1.0-ndl*ndl);\nfloat normalBias=biasAndScale.y*sinNL;\nworldPos.xyz-=worldNor*normalBias;\n#endif\n\ngl_Position=viewProjection*worldPos;\n#ifdef DEPTHTEXTURE\n\ngl_Position.z+=biasAndScale.x*gl_Position.w;\n#endif\n\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y))+biasAndScale.x;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}";ni.a.ShadersStore.shadowMapVertexShader=na;var ra="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}";ni.a.ShadersStore.depthBoxBlurPixelShader=ra;var oa=function(){function e(t,i,n){this.onBeforeShadowMapRenderObservable=new o.c,this.onAfterShadowMapRenderObservable=new o.c,this.onBeforeShadowMapRenderMeshObservable=new o.c,this.onAfterShadowMapRenderMeshObservable=new o.c,this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=e.FILTER_NONE,this._filteringQuality=e.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=a.e.Zero(),this._viewMatrix=a.a.Zero(),this._projectionMatrix=a.a.Zero(),this._transformMatrix=a.a.Zero(),this._cachedPosition=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new a.e(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=a.a.Identity(),this._mapSize=t,this._light=i,this._scene=i.getScene(),i._shadowGenerator=this,e._SceneComponentInitialization(this._scene);var r=this._scene.getEngine().getCaps();n?r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_FLOAT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_HALF_FLOAT:this._textureType=g.a.TEXTURETYPE_UNSIGNED_INT:r.textureHalfFloatRender&&r.textureHalfFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_HALF_FLOAT:r.textureFloatRender&&r.textureFloatLinearFiltering?this._textureType=g.a.TEXTURETYPE_FLOAT:this._textureType=g.a.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}return Object.defineProperty(e.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},set:function(t){if(this._light.needCube()){if(t===e.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(t===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(t===e.FILTER_PCF||t===e.FILTER_PCSS)return void(this.usePoissonSampling=!0)}t!==e.FILTER_PCF&&t!==e.FILTER_PCSS||1!==this._scene.getEngine().webGLVersion?this._filter!==t&&(this._filter=t,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePoissonSampling",{get:function(){return this.filter===e.FILTER_POISSONSAMPLING},set:function(t){(t||this.filter===e.FILTER_POISSONSAMPLING)&&(this.filter=t?e.FILTER_POISSONSAMPLING:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useExponentialShadowMap",{get:function(){return this.filter===e.FILTER_EXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_EXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_BLUREXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_CLOSEEXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(t){(t||this.filter===e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=t?e.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===e.FILTER_PCF},set:function(t){(t||this.filter===e.FILTER_PCF)&&(this.filter=t?e.FILTER_PCF:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality!==e&&(this._filteringQuality=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useContactHardeningShadow",{get:function(){return this.filter===e.FILTER_PCSS},set:function(t){(t||this.filter===e.FILTER_PCSS)&&(this.filter=t?e.FILTER_PCSS:e.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"darkness",{get:function(){return this._darkness},set:function(e){this.setDarkness(e)},enumerable:!0,configurable:!0}),e.prototype.getDarkness=function(){return this._darkness},e.prototype.setDarkness=function(e){return this._darkness=e>=1?1:e<=0?0:e,this},Object.defineProperty(e.prototype,"transparencyShadow",{get:function(){return this._transparencyShadow},set:function(e){this.setTransparencyShadow(e)},enumerable:!0,configurable:!0}),e.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},e.prototype.getShadowMap=function(){return this._shadowMap},e.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},e.prototype.getClassName=function(){return"ShadowGenerator"},e.prototype.addShadowCaster=function(e,t){var i;return void 0===t&&(t=!0),this._shadowMap?(this._shadowMap.renderList||(this._shadowMap.renderList=[]),this._shadowMap.renderList.push(e),t&&(i=this._shadowMap.renderList).push.apply(i,e.getChildMeshes()),this):this},e.prototype.removeShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap||!this._shadowMap.renderList)return this;var i=this._shadowMap.renderList.indexOf(e);if(-1!==i&&this._shadowMap.renderList.splice(i,1),t)for(var n=0,r=e.getChildren();n1?(this._shadowMap=new Oi(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture(g.a.LESS,!0)):this._shadowMap=new Oi(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube()),this._shadowMap.wrapU=$e.a.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=$e.a.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode($e.a.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._shadowMap.onBeforeRenderObservable.add(function(n){t._currentFaceIndex=n,t._filter===e.FILTER_PCF&&i.setColorWrite(!1)}),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.onAfterUnbindObservable.add(function(){if(t._filter===e.FILTER_PCF&&i.setColorWrite(!0),t.useBlurExponentialShadowMap||t.useBlurCloseExponentialShadowMap){var n=t.getShadowMapForRendering();n&&t._scene.postProcessManager.directRender(t._blurPostProcesses,n.getInternalTexture(),!0)}});var n=new s.b(0,0,0,0),r=new s.b(1,1,1,1);this._shadowMap.onClearObservable.add(function(i){t._filter===e.FILTER_PCF?i.clear(r,!1,!0,!1):t.useExponentialShadowMap||t.useBlurExponentialShadowMap?i.clear(n,!0,!0,!1):i.clear(r,!0,!0,!1)}),this._shadowMap.onResizeObservable.add(function(e){t._mapSize=e.getRenderSize(),t._light._markMeshesAsLightDirty(),t.recreateShadowMap()})},e.prototype._initializeBlurRTTAndPostProcesses=function(){var e=this,t=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new Oi(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType),this._shadowMap2.wrapU=$e.a.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=$e.a.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode($e.a.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new Sr(this._light.name+"KernelBlurX",new a.d(1,0),this.blurKernel,1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.width=i,this._kernelBlurXPostprocess.height=i,this._kernelBlurXPostprocess.onApplyObservable.add(function(t){t.setTexture("textureSampler",e._shadowMap)}),this._kernelBlurYPostprocess=new Sr(this._light.name+"KernelBlurY",new a.d(0,1),this.blurKernel,1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===g.a.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new oi(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.onApplyObservable.add(function(t){t.setFloat2("screenSize",i,i),t.setTexture("textureSampler",e._shadowMap)}),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])},e.prototype._renderForShadowMap=function(e,t,i,n){var r,o=this._scene.getEngine();if(n.length){for(o.setColorWrite(!1),r=0;r=a.length)return void(e&&e(i));setTimeout(d,16)}};d()}else e&&e(this)}else e&&e(this)}else e&&e(this)},e.prototype.forceCompilationAsync=function(e){var t=this;return new Promise(function(i){t.forceCompilation(function(){i()},e)})},e.prototype.isReady=function(e,t){var i=[];this._textureType!==g.a.TEXTURETYPE_UNSIGNED_INT&&i.push("#define FLOAT"),this.useExponentialShadowMap||this.useBlurExponentialShadowMap?i.push("#define ESM"):(this.usePercentageCloserFiltering||this.useContactHardeningShadow)&&i.push("#define DEPTHTEXTURE");var n=[Yi.b.PositionKind],r=e.getMesh(),o=e.getMaterial();if(this.normalBias&&r.isVerticesDataPresent(Yi.b.NormalKind)&&(n.push(Yi.b.NormalKind),i.push("#define NORMAL"),r.nonUniformScaling&&i.push("#define NONUNIFORMSCALING"),this.getLight().getTypeID()===fr.a.LIGHTTYPEID_DIRECTIONALLIGHT&&i.push("#define DIRECTIONINLIGHTDATA")),o&&o.needAlphaTesting()){var a=o.getAlphaTestTexture();a&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Yi.b.UVKind)&&(n.push(Yi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Yi.b.UV2Kind)&&1===a.coordinatesIndex&&(n.push(Yi.b.UV2Kind),i.push("#define UV2")))}var s=new ni.c;if(r.useBones&&r.computeBonesUsingShaders&&r.skeleton){n.push(Yi.b.MatricesIndicesKind),n.push(Yi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Yi.b.MatricesIndicesExtraKind),n.push(Yi.b.MatricesWeightsExtraKind));var c=r.skeleton;i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),r.numBoneInfluencers>0&&s.addCPUSkinningFallback(0,r),c.isUsingTextureForMatrices?i.push("#define BONETEXTURE"):i.push("#define BonesPerMesh "+(c.bones.length+1))}else i.push("#define NUM_BONE_INFLUENCERS 0");var l=r.morphTargetManager,u=0;if(l&&l.numInfluencers>0&&(i.push("#define MORPHTARGETS"),u=l.numInfluencers,i.push("#define NUM_MORPH_INFLUENCERS "+u),Mr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,u)),t&&(i.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(n)),this.customShaderOptions&&this.customShaderOptions.defines)for(var h=0,d=this.customShaderOptions.defines;hMath.PI;)r-=2*Math.PI;var a=r/Math.PI,s=o/Math.PI;a=.5*a+.5;var c=Math.round(a*i);c<0?c=0:c>=i&&(c=i-1);var l=Math.round(s*n);l<0?l=0:l>=n&&(l=n-1);var u=n-l-1;return{r:t[u*i*3+3*c+0],g:t[u*i*3+3*c+1],b:t[u*i*3+3*c+2]}},e.FACE_FRONT=[new a.e(-1,-1,-1),new a.e(1,-1,-1),new a.e(-1,1,-1),new a.e(1,1,-1)],e.FACE_BACK=[new a.e(1,-1,1),new a.e(-1,-1,1),new a.e(1,1,1),new a.e(-1,1,1)],e.FACE_RIGHT=[new a.e(1,-1,-1),new a.e(1,-1,1),new a.e(1,1,-1),new a.e(1,1,1)],e.FACE_LEFT=[new a.e(-1,-1,1),new a.e(-1,-1,-1),new a.e(-1,1,1),new a.e(-1,1,-1)],e.FACE_DOWN=[new a.e(-1,1,-1),new a.e(1,1,-1),new a.e(-1,1,1),new a.e(1,1,1)],e.FACE_UP=[new a.e(-1,-1,1),new a.e(1,-1,1),new a.e(-1,-1,-1),new a.e(1,-1,-1)],e}(),da=function(){function e(){}return e.Ldexp=function(e,t){return t>1023?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)},e.Rgbe2float=function(e,t,i,n,r,o){r>0?(r=this.Ldexp(1,r-136),e[o+0]=t*r,e[o+1]=i*r,e[o+2]=n*r):(e[o+0]=0,e[o+1]=0,e[o+2]=0)},e.readStringLine=function(e,t){for(var i="",n="",r=t;r32767)throw"HDR Bad header format, unsupported size";return{height:t,width:i,dataPosition:a+=n.length+1}},e.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e),n=this.RGBE_ReadHeader(i),r=this.RGBE_ReadPixels_RLE(i,n);return ha.ConvertPanoramaToCubemap(r,n.width,n.height,t)},e.RGBE_ReadPixels=function(e,t){return this.RGBE_ReadPixels_RLE(e,t)},e.RGBE_ReadPixels_RLE=function(e,t){for(var i,n,r,o,a,s=t.height,c=t.width,l=t.dataPosition,u=0,h=0,d=0,f=new ArrayBuffer(4*c),p=new Uint8Array(f),_=new ArrayBuffer(t.width*t.height*4*3),m=new Float32Array(_);s>0;){if(i=e[l++],n=e[l++],r=e[l++],o=e[l++],2!=i||2!=n||128&r)throw"HDR Bad header format, not RLE";if((r<<8|o)!=c)throw"HDR Bad header format, wrong scan line width";for(u=0,d=0;d<4;d++)for(h=(d+1)*c;u128){if(0==(a=i-128)||a>h-u)throw"HDR Bad Format, bad scanline data (run)";for(;a-- >0;)p[u++]=n}else{if(0==(a=i)||a>h-u)throw"HDR Bad Format, bad scanline data (non-run)";if(p[u++]=n,--a>0)for(var g=0;g255){var m=255/_;d*=m,f*=m,p*=m}s[3*h+0]=d,s[3*h+1]=f,s[3*h+2]=p}s?a.push(s):a.push(u)}return a},null,this._onLoad,this._onError))},t.prototype.clone=function(){var e=this.getScene();if(!e)return this;var i=new t(this.url,e,this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i.coordinatesIndex=this.coordinatesIndex,i.coordinatesMode=this.coordinatesMode,i},t.prototype.delayLoad=function(){this.delayLoadState===Ce.b.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=Ce.b.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this.loadTexture())},t.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},t.prototype.setReflectionTextureMatrix=function(e){var t=this;this._textureMatrix=e,e.updateFlag!==this._textureMatrix.updateFlag&&e.isIdentity()!==this._textureMatrix.isIdentity()&&this.getScene().markAllMaterialsAsDirty(g.a.MATERIAL_TextureDirtyFlag,function(e){return-1!==e.getActiveTextures().indexOf(t)})},t.Parse=function(e,i,n){var r=null;return e.name&&!e.isRenderTarget&&((r=new t(n+e.name,i,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,r.hasAlpha=e.hasAlpha,r.level=e.level,r.coordinatesMode=e.coordinatesMode,r.isBlocking=e.isBlocking),r&&(e.boundingBoxPosition&&(r.boundingBoxPosition=a.e.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=a.e.FromArray(e.boundingBoxSize)),e.rotationY&&(r.rotationY=e.rotationY)),r},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType="BABYLON.HDRCubeTexture",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},t._facesMapping=["right","left","up","down","front","back"],t}(yr.a);c.a.RegisteredTypes["BABYLON.HDRCubeTexture"]=fa;var pa=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this._uvs=null,this.onInfluenceChanged=new o.c,this._onDataLayoutChanged=new o.c,this._animationPropertiesOverride=null,this._scene=i||C.a.LastCreatedScene,this.influence=t}return Object.defineProperty(e.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasUVs",{get:function(){return!!this._uvs},enumerable:!0,configurable:!0}),e.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getPositions=function(){return this._positions},e.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getNormals=function(){return this._normals},e.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getTangents=function(){return this._tangents},e.prototype.setUVs=function(e){var t=this.hasUVs;this._uvs=e,t!==this.hasUVs&&this._onDataLayoutChanged.notifyObservers(void 0)},e.prototype.getUVs=function(){return this._uvs},e.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),null!=this.id&&(e.id=this.id),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),this.hasUVs&&(e.uvs=Array.prototype.slice.call(this.getUVs())),F.a.AppendSerializedAnimations(this,e),e},e.prototype.getClassName=function(){return"MorphTarget"},e.Parse=function(t){var i=new e(t.name,t.influence);if(i.setPositions(t.positions),null!=t.id&&(i.id=t.id),t.normals&&i.setNormals(t.normals),t.tangents&&i.setTangents(t.tangents),t.uvs&&i.setUVs(t.uvs),t.animations)for(var n=0;n=0&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},e.prototype.serialize=function(){var e={};e.id=this.uniqueId,e.targets=[];for(var t=0,i=this._targets;t-1&&(this._impostors.splice(t,1).length&&this.getPhysicsPlugin().removePhysicsBody(e))},e.prototype.addJoint=function(e,t,i){var n={mainImpostor:e,connectedImpostor:t,joint:i};i.physicsPlugin=this._physicsPlugin,this._joints.push(n),this._physicsPlugin.generateJoint(n)},e.prototype.removeJoint=function(e,t,i){var n=this._joints.filter(function(n){return n.connectedImpostor===t&&n.joint===i&&n.mainImpostor===e});n.length&&this._physicsPlugin.removeJoint(n[0])},e.prototype._step=function(e){var t=this;this._impostors.forEach(function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)}),e>.1?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.getImpostors=function(){return this._impostors},e.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t0&&(this._physicsBodysToRemoveAfterStep.forEach(function(t){e.world.remove(t)}),this._physicsBodysToRemoveAfterStep=[])},e.prototype.applyImpulse=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyImpulse(r,n)},e.prototype.applyForce=function(e,t,i){var n=new this.BJSCANNON.Vec3(i.x,i.y,i.z),r=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyForce(r,n)},e.prototype.generatePhysicsBody=function(e){if(this._removeMarkedPhysicsBodiesFromWorld(),e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var t=this._createShape(e),i=e.physicsBody;i&&this.removePhysicsBody(e);var n=this._addMaterial("mat-"+e.uniqueId,e.getParam("friction"),e.getParam("restitution")),r={mass:e.getParam("mass"),material:n},o=e.getParam("nativeOptions");for(var a in o)o.hasOwnProperty(a)&&(r[a]=o[a]);e.physicsBody=new this.BJSCANNON.Body(r),e.physicsBody.addEventListener("collide",e.onCollide),this.world.addEventListener("preStep",e.beforeStep),this.world.addEventListener("postStep",e.afterStep),e.physicsBody.addShape(t),this.world.add(e.physicsBody),i&&["force","torque","velocity","angularVelocity"].forEach(function(t){e.physicsBody[t].copy(i[t])}),this._processChildMeshes(e)}this._updatePhysicsBodyTransformation(e)}},e.prototype._processChildMeshes=function(e){var t=this,i=e.object.getChildMeshes?e.object.getChildMeshes(!0):[],n=e.object.rotationQuaternion;if(i.length){var r=function(i,o){if(n&&o.rotationQuaternion){var s=o.getPhysicsImpostor();if(s)if(s.parent!==e){var c=o.getAbsolutePosition().subtract(e.object.getAbsolutePosition()),l=o.rotationQuaternion.multiply(a.b.Inverse(n));s.physicsBody&&(t.removePhysicsBody(s),s.physicsBody=null),s.parent=e,s.resetUpdateFlags(),e.physicsBody.addShape(t._createShape(s),new t.BJSCANNON.Vec3(c.x,c.y,c.z),new t.BJSCANNON.Quaternion(l.x,l.y,l.z,l.w)),e.physicsBody.mass+=s.getParam("mass")}n.multiplyInPlace(o.rotationQuaternion),o.getChildMeshes(!0).filter(function(e){return!!e.physicsImpostor}).forEach(r.bind(t,o.getAbsolutePosition()))}};i.filter(function(e){return!!e.physicsImpostor}).forEach(r.bind(this,e.object.getAbsolutePosition()))}},e.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),-1===this._physicsBodysToRemoveAfterStep.indexOf(e.physicsBody)&&this._physicsBodysToRemoveAfterStep.push(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o={pivotA:r.mainPivot?(new this.BJSCANNON.Vec3).copy(r.mainPivot):null,pivotB:r.connectedPivot?(new this.BJSCANNON.Vec3).copy(r.connectedPivot):null,axisA:r.mainAxis?(new this.BJSCANNON.Vec3).copy(r.mainAxis):null,axisB:r.connectedAxis?(new this.BJSCANNON.Vec3).copy(r.connectedAxis):null,maxForce:r.nativeParams.maxForce,collideConnected:!!r.collision};switch(e.joint.type){case ga.e.HingeJoint:case ga.e.Hinge2Joint:n=new this.BJSCANNON.HingeConstraint(t,i,o);break;case ga.e.DistanceJoint:n=new this.BJSCANNON.DistanceConstraint(t,i,r.maxDistance||2);break;case ga.e.SpringJoint:var a=r;n=new this.BJSCANNON.Spring(t,i,{restLength:a.length,stiffness:a.stiffness,damping:a.damping,localAnchorA:o.pivotA,localAnchorB:o.pivotB});break;case ga.e.LockJoint:n=new this.BJSCANNON.LockConstraint(t,i,o);break;case ga.e.PointToPointJoint:case ga.e.BallAndSocketJoint:default:n=new this.BJSCANNON.PointToPointConstraint(t,o.pivotA,i,o.pivotB,o.maxForce)}n.collideConnected=!!r.collision,e.joint.physicsJoint=n,e.joint.type!==ga.e.SpringJoint?this.world.addConstraint(n):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){n.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},e.prototype.removeJoint=function(e){e.joint.type!==ga.e.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},e.prototype._addMaterial=function(e,t,i){var n,r;for(n=0;n1e3*i));s++);this.time+=n;for(var c=this.time%i/i,l=e,u=this.bodies,h=0;h!==u.length;h++){var d=u[h];d.type!==t.Body.STATIC&&d.sleepState!==t.Body.SLEEPING?(d.position.vsub(d.previousPosition,l),l.scale(c,l),d.position.vadd(l,d.interpolatedPosition)):(d.interpolatedPosition.copy(d.position),d.interpolatedQuaternion.copy(d.quaternion))}}}},e.prototype.raycast=function(e,t){return this._cannonRaycastResult.reset(),this.world.raycastClosest(e,t,{},this._cannonRaycastResult),this._raycastResult.reset(e,t),this._cannonRaycastResult.hasHit&&(this._raycastResult.setHitData({x:this._cannonRaycastResult.hitNormalWorld.x,y:this._cannonRaycastResult.hitNormalWorld.y,z:this._cannonRaycastResult.hitNormalWorld.z},{x:this._cannonRaycastResult.hitPointWorld.x,y:this._cannonRaycastResult.hitPointWorld.y,z:this._cannonRaycastResult.hitPointWorld.z}),this._raycastResult.setHitDistance(this._cannonRaycastResult.distance)),this._raycastResult},e}();va.DefaultPluginFactory=function(){return new ba};var Ta=function(){function e(e,t){void 0===t&&(t=OIMO),this.name="OimoJSPlugin",this._tmpImpostorsArray=[],this._tmpPositionVector=a.e.Zero(),this.BJSOIMO=t,this.world=new this.BJSOIMO.World({iterations:e}),this.world.clear(),this._raycastResult=new ya}return e.prototype.setGravity=function(e){this.world.gravity.copy(e)},e.prototype.setTimeStep=function(e){this.world.timeStep=e},e.prototype.getTimeStep=function(){return this.world.timeStep},e.prototype.executeStep=function(e,t){var i=this;t.forEach(function(e){e.beforeStep()}),this.world.step(),t.forEach(function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e});for(var n=this.world.contacts;null!==n;)if(!n.touching||n.body1.sleeping||n.body2.sleeping){var r=this._tmpImpostorsArray[+n.body1.name],o=this._tmpImpostorsArray[+n.body2.name];r&&o?(r.onCollide({body:o.physicsBody}),o.onCollide({body:r.physicsBody}),n=n.next):n=n.next}else n=n.next},e.prototype.applyImpulse=function(e,t,i){var n=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*n))},e.prototype.applyForce=function(e,t,i){m.a.Warn("Oimo doesn't support applying force. Using impule instead."),this.applyImpulse(e,t,i)},e.prototype.generatePhysicsBody=function(e){var t=this;if(e.parent)e.physicsBody&&(this.removePhysicsBody(e),e.forceUpdate());else{if(e.isBodyInitRequired()){var i={name:e.uniqueId,config:[e.getParam("mass")||1,e.getParam("friction"),e.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==e.getParam("mass"),density:e.getParam("mass"),friction:e.getParam("friction"),restitution:e.getParam("restitution"),world:this.world},n=[e];(s=e.object).getChildMeshes&&s.getChildMeshes().forEach(function(e){e.physicsImpostor&&n.push(e.physicsImpostor)});var r=function(e){return Math.max(e,va.Epsilon)},o=new a.b;n.forEach(function(n){if(n.object.rotationQuaternion){var a=n.object.rotationQuaternion;o=a.clone();var s=a.toEulerAngles(),c=n.getObjectExtendSize();if(n===e){var l=e.getObjectCenter();e.object.getAbsolutePivotPoint().subtractToRef(l,t._tmpPositionVector),t._tmpPositionVector.divideInPlace(e.object.scaling),i.pos.push(l.x),i.pos.push(l.y),i.pos.push(l.z),i.posShape.push(0,0,0),i.rotShape.push(0,0,0)}else{var u=n.object.getAbsolutePosition().subtract(e.object.getAbsolutePosition());i.posShape.push(u.x),i.posShape.push(u.y),i.posShape.push(u.z),i.pos.push(0,0,0),i.rotShape.push(57.29577951308232*s.x),i.rotShape.push(57.29577951308232*s.y),i.rotShape.push(57.29577951308232*s.z)}switch(n.type){case ma.a.ParticleImpostor:m.a.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case ma.a.SphereImpostor:var h=c.x,d=c.y,f=c.z,p=Math.max(r(h),r(d),r(f))/2;i.type.push("sphere"),i.size.push(p),i.size.push(p),i.size.push(p);break;case ma.a.CylinderImpostor:var _=r(c.x)/2,g=r(c.y);i.type.push("cylinder"),i.size.push(_),i.size.push(g),i.size.push(g);break;case ma.a.PlaneImpostor:case ma.a.BoxImpostor:default:_=r(c.x),g=r(c.y);var v=r(c.z);i.type.push("box"),i.size.push(_),i.size.push(g),i.size.push(v)}n.object.rotationQuaternion=a}}),e.physicsBody=this.world.add(i),e.physicsBody.resetQuaternion(o),e.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);var s;e.setDeltaPosition(this._tmpPositionVector)}},e.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var n,r=e.joint.jointData,o=r.nativeParams||{},a={body1:t,body2:i,axe1:o.axe1||(r.mainAxis?r.mainAxis.asArray():null),axe2:o.axe2||(r.connectedAxis?r.connectedAxis.asArray():null),pos1:o.pos1||(r.mainPivot?r.mainPivot.asArray():null),pos2:o.pos2||(r.connectedPivot?r.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||r.collision,spring:o.spring,world:this.world};switch(e.joint.type){case ga.e.BallAndSocketJoint:n="jointBall";break;case ga.e.SpringJoint:m.a.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");var s=r;a.min=s.length||a.min,a.max=Math.max(a.min,a.max);case ga.e.DistanceJoint:n="jointDistance",a.max=r.maxDistance;break;case ga.e.PrismaticJoint:n="jointPrisme";break;case ga.e.SliderJoint:n="jointSlide";break;case ga.e.WheelJoint:n="jointWheel";break;case ga.e.HingeJoint:default:n="jointHinge"}a.type=n,e.joint.physicsJoint=this.world.add(a)}},e.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){m.a.Warn(e)}},e.prototype.isSupported=function(){return void 0!==this.BJSOIMO},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.sleeping||(e.object.position.copyFrom(e.physicsBody.getPosition()),e.object.rotationQuaternion&&e.object.rotationQuaternion.copyFrom(e.physicsBody.getQuaternion()))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody;n.position.copy(t),n.orientation.copy(i),n.syncShapes(),n.awake()},e.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.copy(t)},e.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.copy(t)},e.prototype.getLinearVelocity=function(e){var t=e.physicsBody.linearVelocity;return t?new a.e(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new a.e(t.x,t.y,t.z):null},e.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},e.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},e.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},e.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},e.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},e.prototype.sleepBody=function(e){e.physicsBody.sleep()},e.prototype.wakeUpBody=function(e){e.physicsBody.awake()},e.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},e.prototype.setMotor=function(e,t,i,n){void 0!==i?m.a.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter"):i=1e6,t*=-1;var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setMotor(t,i)},e.prototype.setLimit=function(e,t,i,n){var r=n?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;r&&r.setLimit(t,void 0===i?-t:i)},e.prototype.syncMeshWithImpostor=function(e,t){var i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.orientation.x,e.rotationQuaternion.y=i.orientation.y,e.rotationQuaternion.z=i.orientation.z,e.rotationQuaternion.w=i.orientation.s)},e.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},e.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes;t.x=2*i.halfWidth,t.y=2*i.halfHeight,t.z=2*i.halfDepth},e.prototype.dispose=function(){this.world.clear()},e.prototype.raycast=function(e,t){return m.a.Warn("raycast is not currently supported by the Oimo physics plugin"),this._raycastResult.reset(e,t),this._raycastResult},e}();Xi.a.CreateRibbon=function(e){var t=e.pathArray,i=e.closeArray||!1,n=e.closePath||!1,r=e.invertUV||!1,o=Math.floor(t[0].length/2),a=e.offset||o;a=a>o?o:Math.floor(a);var s,c,l,u,h=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE,d=e.uvs,f=e.colors,p=[],_=[],m=[],g=[],v=[],y=[],b=[],T=[],E=[],A=[];if(t.length<2){var P=[],S=[];for(l=0;l0&&(C=R[u].subtract(R[u-1]).length()+b[c],v[c].push(C),b[c]=C),u++;n&&(u--,p.push(R[0].x,R[0].y,R[0].z),C=R[u].subtract(R[0]).length()+b[c],v[c].push(C),b[c]=C),E[c]=x+D,A[c]=I,I+=x+D}var L,w,F=null,N=null;for(l=0;l3?0:u,h);var A=Ea.CreateRibbon(e,{pathArray:b,closeArray:c,closePath:l,updatable:f,sideOrientation:p,invertUV:m,frontUVs:g||void 0,backUVs:v||void 0},d);return A._creationDataStorage.pathArray=b,A._creationDataStorage.path3D=y,A._creationDataStorage.cap=u,A},e}(),Pa=function(){function e(e,t,i){var n=this;void 0===e&&(e=!0),void 0===t&&(t=Ammo),void 0===i&&(i=null),this._useDeltaForWorldStep=e,this.bjsAMMO={},this.name="AmmoJSPlugin",this._timeStep=1/60,this._fixedTimeStep=1/60,this._maxSteps=5,this._tmpQuaternion=new a.b,this._tmpContactCallbackResult=!1,this._tmpVector=new a.e,this._tmpMatrix=new a.a,"function"==typeof t?t(this.bjsAMMO):this.bjsAMMO=t,this.isSupported()?(this._collisionConfiguration=new this.bjsAMMO.btSoftBodyRigidBodyCollisionConfiguration,this._dispatcher=new this.bjsAMMO.btCollisionDispatcher(this._collisionConfiguration),this._overlappingPairCache=i||new this.bjsAMMO.btDbvtBroadphase,this._solver=new this.bjsAMMO.btSequentialImpulseConstraintSolver,this._softBodySolver=new this.bjsAMMO.btDefaultSoftBodySolver,this.world=new this.bjsAMMO.btSoftRigidDynamicsWorld(this._dispatcher,this._overlappingPairCache,this._solver,this._collisionConfiguration,this._softBodySolver),this._tmpAmmoConcreteContactResultCallback=new this.bjsAMMO.ConcreteContactResultCallback,this._tmpAmmoConcreteContactResultCallback.addSingleResult=function(){n._tmpContactCallbackResult=!0},this._raycastResult=new ya,this._tmpAmmoTransform=new this.bjsAMMO.btTransform,this._tmpAmmoTransform.setIdentity(),this._tmpAmmoQuaternion=new this.bjsAMMO.btQuaternion(0,0,0,1),this._tmpAmmoVectorA=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorB=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorC=new this.bjsAMMO.btVector3(0,0,0),this._tmpAmmoVectorD=new this.bjsAMMO.btVector3(0,0,0)):m.a.Error("AmmoJS is not available. Please make sure you included the js file.")}return e.prototype.setGravity=function(e){this._tmpAmmoVectorA.setValue(e.x,e.y,e.z),this.world.setGravity(this._tmpAmmoVectorA),this.world.getWorldInfo().set_m_gravity(this._tmpAmmoVectorA)},e.prototype.setTimeStep=function(e){this._timeStep=e},e.prototype.setFixedTimeStep=function(e){this._fixedTimeStep=e},e.prototype.setMaxSteps=function(e){this._maxSteps=e},e.prototype.getTimeStep=function(){return this._timeStep},e.prototype._isImpostorInContact=function(e){return this._tmpContactCallbackResult=!1,this.world.contactTest(e.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._isImpostorPairInContact=function(e,t){return this._tmpContactCallbackResult=!1,this.world.contactPairTest(e.physicsBody,t.physicsBody,this._tmpAmmoConcreteContactResultCallback),this._tmpContactCallbackResult},e.prototype._stepSimulation=function(e,t,i){if(void 0===e&&(e=1/60),void 0===t&&(t=10),void 0===i&&(i=1/60),0==t)this.world.stepSimulation(e,0);else for(;t>0&&e>0;)e-i0&&this._isImpostorInContact(s))for(var c=0,l=s._onPhysicsCollideCallbacks;c3?3:s;var c=(new Ammo.btSoftBodyHelpers).CreateRope(this.world.getWorldInfo(),this._tmpAmmoVectorA,this._tmpAmmoVectorB,i-1,s);return c.get_m_cfg().set_collisions(17),c},e.prototype._addHullVerts=function(e,t,i){var n=this,r=0;if(i&&i.getIndices&&i.getWorldMatrix&&i.getChildMeshes){var o=i.getIndices();o||(o=[]);var s=i.getVerticesData(Yi.b.PositionKind);s||(s=[]),i.computeWorldMatrix(!1);for(var c=o.length/3,l=0;l0){if(e.type!=ma.a.NoImpostor){var l=this._createShape(e,!0);l&&(this._tmpAmmoTransform.getOrigin().setValue(0,0,0),this._tmpAmmoQuaternion.setValue(0,0,0,1),this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion),n.addChildShape(this._tmpAmmoTransform,l))}return n}Ammo.destroy(n),n=null}switch(e.type){case ma.a.SphereImpostor:if(w.a.WithinEpsilon(o.x,o.y,1e-4)&&w.a.WithinEpsilon(o.x,o.z,1e-4))n=new Ammo.btSphereShape(o.x/2);else{var u=[new Ammo.btVector3(0,0,0)];(n=new Ammo.btMultiSphereShape(u,[1],1)).setLocalScaling(new Ammo.btVector3(o.x/2,o.y/2,o.z/2))}break;case ma.a.CapsuleImpostor:n=new Ammo.btCapsuleShape(o.x/2,o.y/2);break;case ma.a.CylinderImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btCylinderShape(this._tmpAmmoVectorA);break;case ma.a.PlaneImpostor:case ma.a.BoxImpostor:this._tmpAmmoVectorA.setValue(o.x/2,o.y/2,o.z/2),n=new Ammo.btBoxShape(this._tmpAmmoVectorA);break;case ma.a.MeshImpostor:if(0==e.getParam("mass")){var h=new Ammo.btTriangleMesh;e._pluginData.toDispose.push(h);var d=this._addMeshVerts(h,r,r);n=0==d?new Ammo.btCompoundShape:new Ammo.btBvhTriangleMeshShape(h);break}case ma.a.ConvexHullImpostor:var f=new Ammo.btConvexHullShape;0==(d=this._addHullVerts(f,r,r))?(e._pluginData.toDispose.push(f),n=new Ammo.btCompoundShape):n=f;break;case ma.a.NoImpostor:n=new Ammo.btSphereShape(o.x/2);break;case ma.a.SoftbodyImpostor:n=this._createSoftbody(e);break;case ma.a.ClothImpostor:n=this._createCloth(e);break;case ma.a.RopeImpostor:n=this._createRope(e);break;default:m.a.Warn("The impostor type is not currently supported by the ammo plugin.")}return n},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.object.position.set(this._tmpAmmoTransform.getOrigin().x(),this._tmpAmmoTransform.getOrigin().y(),this._tmpAmmoTransform.getOrigin().z()),e.object.rotationQuaternion?e.object.rotationQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()):e.object.rotation&&(this._tmpQuaternion.set(this._tmpAmmoTransform.getRotation().x(),this._tmpAmmoTransform.getRotation().y(),this._tmpAmmoTransform.getRotation().z(),this._tmpAmmoTransform.getRotation().w()),this._tmpQuaternion.toEulerAnglesToRef(e.object.rotation))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var n=e.physicsBody.getWorldTransform();if(n.getOrigin().x()!=t.x||n.getOrigin().y()!=t.y||n.getOrigin().z()!=t.z||n.getRotation().x()!=i.x||n.getRotation().y()!=i.y||n.getRotation().z()!=i.z||n.getRotation().w()!=i.w)if(this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),n.setOrigin(this._tmpAmmoVectorA),this._tmpAmmoQuaternion.setValue(i.x,i.y,i.z,i.w),n.setRotation(this._tmpAmmoQuaternion),e.physicsBody.setWorldTransform(n),0==e.mass){var r=e.physicsBody.getMotionState();r&&r.setWorldTransform(n)}else e.physicsBody.activate()},e.prototype.isSupported=function(){return void 0!==this.bjsAMMO},e.prototype.setLinearVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.linearVelocity(this._tmpAmmoVectorA):e.physicsBody.setLinearVelocity(this._tmpAmmoVectorA)},e.prototype.setAngularVelocity=function(e,t){this._tmpAmmoVectorA.setValue(t.x,t.y,t.z),e.soft?e.physicsBody.angularVelocity(this._tmpAmmoVectorA):e.physicsBody.setAngularVelocity(this._tmpAmmoVectorA)},e.prototype.getLinearVelocity=function(e){if(e.soft)var t=e.physicsBody.linearVelocity();else t=e.physicsBody.getLinearVelocity();if(!t)return null;var i=new a.e(t.x(),t.y(),t.z());return Ammo.destroy(t),i},e.prototype.getAngularVelocity=function(e){if(e.soft)var t=e.physicsBody.angularVelocity();else t=e.physicsBody.getAngularVelocity();if(!t)return null;var i=new a.e(t.x(),t.y(),t.z());return Ammo.destroy(t),i},e.prototype.setBodyMass=function(e,t){e.soft?e.physicsBody.setTotalMass(t,!1):e.physicsBody.setMassProps(t),e._pluginData.mass=t},e.prototype.getBodyMass=function(e){return e._pluginData.mass||0},e.prototype.getBodyFriction=function(e){return e._pluginData.friction||0},e.prototype.setBodyFriction=function(e,t){e.soft?e.physicsBody.get_m_cfg().set_kDF(t):e.physicsBody.setFriction(t),e._pluginData.friction=t},e.prototype.getBodyRestitution=function(e){return e._pluginData.restitution||0},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.setRestitution(t),e._pluginData.restitution=t},e.prototype.getBodyPressure=function(e){return e.soft?e._pluginData.pressure||0:(m.a.Warn("Pressure is not a property of a rigid body"),0)},e.prototype.setBodyPressure=function(e,t){e.soft?e.type===ma.a.SoftbodyImpostor?(e.physicsBody.get_m_cfg().set_kPR(t),e._pluginData.pressure=t):(e.physicsBody.get_m_cfg().set_kPR(0),e._pluginData.pressure=0):m.a.Warn("Pressure can only be applied to a softbody")},e.prototype.getBodyStiffness=function(e){return e.soft?e._pluginData.stiffness||0:(m.a.Warn("Stiffness is not a property of a rigid body"),0)},e.prototype.setBodyStiffness=function(e,t){e.soft?(t=(t=t<0?0:t)>1?1:t,e.physicsBody.get_m_materials().at(0).set_m_kLST(t),e._pluginData.stiffness=t):m.a.Warn("Stiffness cannot be applied to a rigid body")},e.prototype.getBodyVelocityIterations=function(e){return e.soft?e._pluginData.velocityIterations||0:(m.a.Warn("Velocity iterations is not a property of a rigid body"),0)},e.prototype.setBodyVelocityIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_viterations(t),e._pluginData.velocityIterations=t):m.a.Warn("Velocity iterations cannot be applied to a rigid body")},e.prototype.getBodyPositionIterations=function(e){return e.soft?e._pluginData.positionIterations||0:(m.a.Warn("Position iterations is not a property of a rigid body"),0)},e.prototype.setBodyPositionIterations=function(e,t){e.soft?(t=t<0?0:t,e.physicsBody.get_m_cfg().set_piterations(t),e._pluginData.positionIterations=t):m.a.Warn("Position iterations cannot be applied to a rigid body")},e.prototype.appendAnchor=function(e,t,i,n,r,o){void 0===r&&(r=1),void 0===o&&(o=!1);var a=e.segments,s=Math.round((a-1)*i)+a*(a-1-Math.round((a-1)*n));e.physicsBody.appendAnchor(s,t.physicsBody,o,r)},e.prototype.appendHook=function(e,t,i,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var o=Math.round(e.segments*i);e.physicsBody.appendAnchor(o,t.physicsBody,r,n)},e.prototype.sleepBody=function(e){m.a.Warn("sleepBody is not currently supported by the Ammo physics plugin")},e.prototype.wakeUpBody=function(e){e.physicsBody.activate()},e.prototype.updateDistanceJoint=function(e,t,i){m.a.Warn("updateDistanceJoint is not currently supported by the Ammo physics plugin")},e.prototype.setMotor=function(e,t,i,n){e.physicsJoint.enableAngularMotor(!0,t,i)},e.prototype.setLimit=function(e,t,i){m.a.Warn("setLimit is not currently supported by the Ammo physics plugin")},e.prototype.syncMeshWithImpostor=function(e,t){t.physicsBody.getMotionState().getWorldTransform(this._tmpAmmoTransform),e.position.x=this._tmpAmmoTransform.getOrigin().x(),e.position.y=this._tmpAmmoTransform.getOrigin().y(),e.position.z=this._tmpAmmoTransform.getOrigin().z(),e.rotationQuaternion&&(e.rotationQuaternion.x=this._tmpAmmoTransform.getRotation().x(),e.rotationQuaternion.y=this._tmpAmmoTransform.getRotation().y(),e.rotationQuaternion.z=this._tmpAmmoTransform.getRotation().z(),e.rotationQuaternion.w=this._tmpAmmoTransform.getRotation().w())},e.prototype.getRadius=function(e){return e.getObjectExtendSize().x/2},e.prototype.getBoxSizeToRef=function(e,t){var i=e.getObjectExtendSize();t.x=i.x,t.y=i.y,t.z=i.z},e.prototype.dispose=function(){Ammo.destroy(this.world),Ammo.destroy(this._solver),Ammo.destroy(this._overlappingPairCache),Ammo.destroy(this._dispatcher),Ammo.destroy(this._collisionConfiguration),Ammo.destroy(this._tmpAmmoVectorA),Ammo.destroy(this._tmpAmmoVectorB),Ammo.destroy(this._tmpAmmoVectorC),Ammo.destroy(this._tmpAmmoTransform),Ammo.destroy(this._tmpAmmoQuaternion),Ammo.destroy(this._tmpAmmoConcreteContactResultCallback),this.world=null},e.prototype.raycast=function(e,t){this._tmpAmmoVectorRCA=new this.bjsAMMO.btVector3(e.x,e.y,e.z),this._tmpAmmoVectorRCB=new this.bjsAMMO.btVector3(t.x,t.y,t.z);var i=new this.bjsAMMO.ClosestRayResultCallback(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB);return this.world.rayTest(this._tmpAmmoVectorRCA,this._tmpAmmoVectorRCB,i),this._raycastResult.reset(e,t),i.hasHit()&&(this._raycastResult.setHitData({x:i.get_m_hitNormalWorld().x(),y:i.get_m_hitNormalWorld().y(),z:i.get_m_hitNormalWorld().z()},{x:i.get_m_hitPointWorld().x(),y:i.get_m_hitPointWorld().y(),z:i.get_m_hitPointWorld().z()}),this._raycastResult.calculateHitDistance()),Ammo.destroy(i),Ammo.destroy(this._tmpAmmoVectorRCA),Ammo.destroy(this._tmpAmmoVectorRCB),this._raycastResult},e.DISABLE_COLLISION_FLAG=4,e.KINEMATIC_FLAG=2,e.DISABLE_DEACTIVATION_FLAG=4,e}();n.a.prototype.removeReflectionProbe=function(e){if(!this.reflectionProbes)return-1;var t=this.reflectionProbes.indexOf(e);return-1!==t&&this.reflectionProbes.splice(t,1),t},n.a.prototype.addReflectionProbe=function(e){this.reflectionProbes||(this.reflectionProbes=[]),this.reflectionProbes.push(e)};var Sa=function(){function e(e,t,i,n,r){var o=this;void 0===n&&(n=!0),void 0===r&&(r=!1),this.name=e,this._viewMatrix=a.a.Identity(),this._target=a.e.Zero(),this._add=a.e.Zero(),this._invertYAxis=!1,this.position=a.e.Zero(),this._scene=i,this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this),this._renderTargetTexture=new Oi(e,t,i,n,!0,r?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_UNSIGNED_INT,!0),this._renderTargetTexture.onBeforeRenderObservable.add(function(e){switch(e){case 0:o._add.copyFromFloats(1,0,0);break;case 1:o._add.copyFromFloats(-1,0,0);break;case 2:o._add.copyFromFloats(0,o._invertYAxis?1:-1,0);break;case 3:o._add.copyFromFloats(0,o._invertYAxis?-1:1,0);break;case 4:o._add.copyFromFloats(0,0,1);break;case 5:o._add.copyFromFloats(0,0,-1)}o._attachedMesh&&o.position.copyFrom(o._attachedMesh.getAbsolutePosition()),o.position.addToRef(o._add,o._target),a.a.LookAtLHToRef(o.position,o._target,a.e.Up(),o._viewMatrix),i.activeCamera&&(o._projectionMatrix=a.a.PerspectiveFovLH(Math.PI/2,1,i.activeCamera.minZ,i.activeCamera.maxZ),i.setTransformMatrix(o._viewMatrix,o._projectionMatrix)),i._forcedViewPosition=o.position}),this._renderTargetTexture.onAfterUnbindObservable.add(function(){i._forcedViewPosition=null,i.updateTransformMatrix(!0)})}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},enumerable:!0,configurable:!0}),e.prototype.attachToMesh=function(e){this._attachedMesh=e},e.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},e.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);-1!==e&&this._scene.reflectionProbes.splice(e,1),this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null)},e.prototype.toString=function(e){var t="Name: "+this.name;return e&&(t+=", position: "+this.position.toString(),this._attachedMesh&&(t+=", attached mesh: "+this._attachedMesh.name)),t},e.prototype.getClassName=function(){return"ReflectionProbe"},e.prototype.serialize=function(){var e=F.a.Serialize(this,this._renderTargetTexture.serialize());return e.isReflectionProbe=!0,e},e.Parse=function(t,i,n){var r=null;if(i.reflectionProbes)for(var o=0;o0){var n=t._waitingData.lods.ids,r=i.isEnabled(!1);if(t._waitingData.lods.distances){var o=t._waitingData.lods.distances;if(o.length>=n.length){var a=o.length>n.length?o[o.length-1]:0;i.setEnabled(!1);for(var s=0;s0&&i.addLODLevel(a,null),!0===r&&i.setEnabled(!0)}else Ie.b.Warn("Invalid level of detail distances for "+t.name)}}t._waitingData.lods=null}},Ia=function(e,t,i,r,o){void 0===o&&(o=!1);var a=new xe(e),s="importScene has failed JSON parse";try{var l=JSON.parse(t);s="";var u,h,d=vn.loggingLevel===vn.DETAILED_LOGGING;if(void 0!==l.environmentTexture&&null!==l.environmentTexture){var f=void 0===l.isPBR||l.isPBR;if(l.environmentTextureType&&"BABYLON.HDRCubeTexture"===l.environmentTextureType){var p=l.environmentTextureSize?l.environmentTextureSize:128,_=new fa((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e,p,!0,!f);l.environmentTextureRotationY&&(_.rotationY=l.environmentTextureRotationY),e.environmentTexture=_}else if(Ra.a.EndsWith(l.environmentTexture,".env")){var g=new Cr((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(g.rotationY=l.environmentTextureRotationY),e.environmentTexture=g}else{var v=Cr.CreateFromPrefilteredData((l.environmentTexture.match(/https?:\/\//g)?"":i)+l.environmentTexture,e);l.environmentTextureRotationY&&(v.rotationY=l.environmentTextureRotationY),e.environmentTexture=v}if(!0===l.createDefaultSkybox){var y=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,b=l.skyboxBlurLevel||0;e.createDefaultSkybox(e.environmentTexture,f,y,b)}a.environmentTexture=e.environmentTexture}if(void 0!==l.environmentIntensity&&null!==l.environmentIntensity&&(e.environmentIntensity=l.environmentIntensity),void 0!==l.lights&&null!==l.lights)for(u=0,h=l.lights.length;u0){for(var ee=0;ee<$._excludedMeshesIds.length;ee++){var te=e.getMeshByID($._excludedMeshesIds[ee]);te&&$.excludedMeshes.push(te)}$._excludedMeshesIds=[]}if($._includedOnlyMeshesIds.length>0){for(var ne=0;ne<$._includedOnlyMeshesIds.length;ne++){var re=e.getMeshByID($._includedOnlyMeshesIds[ne]);re&&$.includedOnlyMeshes.push(re)}$._includedOnlyMeshesIds=[]}}for(n.a.Parse(l,e,a,i),u=0,h=e.meshes.length;u-1&&void 0!==u.skeletons&&null!==u.skeletons)if(!1===g.indexOf(y.skeletonId)>-1)for(var O=0,I=u.skeletons.length;O1,n.wrapU=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapV=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.wrapR=g.a.TEXTURE_CLAMP_ADDRESSMODE,n.anisotropicFilteringLevel=1,n._texture=n._getFromCache(t,!0),n._texture||(i.useDelayedTextureLoading?n.delayLoadState=g.a.DELAYLOADSTATE_NOTLOADED:n.loadTexture()),n):n}return h.d(t,e),t.prototype.getTextureMatrix=function(){return this._textureMatrix},t.prototype.load3dlTexture=function(){var e,i=this._engine;e=1===i.webGLVersion?i.createRawTexture(null,1,1,g.a.TEXTUREFORMAT_RGBA,!1,!1,g.a.TEXTURE_BILINEAR_SAMPLINGMODE):i.createRawTexture3D(null,1,1,1,g.a.TEXTUREFORMAT_RGBA,!1,!1,g.a.TEXTURE_BILINEAR_SAMPLINGMODE),this._texture=e;var n=function(n){if("string"==typeof n){for(var r,o=null,a=null,s=n.split("\n"),c=0,l=0,u=0,h=0,d=0,f=0;f0&&(f+1)%4==0)o[f]=255;else{var b=a[f];o[f]=b/d*255}e.is3D?(e.updateSize(c,c,c),i.updateRawTexture3D(e,o,g.a.TEXTUREFORMAT_RGBA,!1)):(e.updateSize(c*c,c),i.updateRawTexture(e,o,g.a.TEXTUREFORMAT_RGBA,!1))}},r=this.getScene();return r?r._loadFile(this.url,n):this._engine._loadFile(this.url,n),this._texture},t.prototype.loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this.load3dlTexture()},t.prototype.clone=function(){var e=new t(this.url,this.getScene());return e.level=this.level,e},t.prototype.delayLoad=function(){this.delayLoadState===g.a.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=g.a.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this.loadTexture())},t.Parse=function(e,i){var n=null;return e.name&&!e.isRenderTarget&&((n=new t(e.name,i)).name=e.name,n.level=e.level),n},t.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},t._noneEmptyLineRegex=/\S+/,t}(yr.a);c.a.RegisteredTypes["BABYLON.ColorGradingTexture"]=Ua;var Va=function(e){function t(t,i,n,r,o,a,s){void 0===r&&(r=!1),void 0===o&&(o=!0),void 0===a&&(a=null),void 0===s&&(s=null);var c=e.call(this,i)||this;if(c._onLoad=null,c._onError=null,c.coordinatesMode=$e.a.CUBIC_MODE,!t)throw new Error("Image url is not set");return c.name=t,c.url=t,c._size=n,c._noMipmap=r,c.gammaSpace=o,c._onLoad=a,c._onError=s,c.hasAlpha=!1,c.isCube=!0,c._texture=c._getFromCache(t,c._noMipmap),c._texture?a&&(c._texture.isReady?Ie.b.SetImmediate(function(){return a()}):c._texture.onLoadedObservable.add(a)):i.useDelayedTextureLoading?c.delayLoadState=Ce.b.DELAYLOADSTATE_NOTLOADED:c.loadImage(c.loadTexture.bind(c),c._onError),c}return h.d(t,e),t.prototype.loadImage=function(e,t){var i=this,n=document.createElement("canvas"),r=new Image;r.addEventListener("load",function(){i._width=r.width,i._height=r.height,n.width=i._width,n.height=i._height;var t=n.getContext("2d");t.drawImage(r,0,0);var o=t.getImageData(0,0,r.width,r.height);i._buffer=o.data.buffer,n.remove(),e()}),r.addEventListener("error",function(e){t&&t(i.getClassName()+" could not be loaded",e)}),r.src=this.url},t.prototype.loadTexture=function(){var e=this,i=this.getScene();i&&(this._texture=i.getEngine().createRawCubeTextureFromUrl(this.url,i,this._size,Ce.b.TEXTUREFORMAT_RGB,i.getEngine().getCaps().textureFloat?Ce.b.TEXTURETYPE_FLOAT:Ce.b.TEXTURETYPE_UNSIGNED_INTEGER,this._noMipmap,function(){for(var i=e.getFloat32ArrayFromArrayBuffer(e._buffer),n=ha.ConvertPanoramaToCubemap(i,e._width,e._height,e._size),r=[],o=0;o<6;o++){var a=n[t._FacesMapping[o]];r.push(a)}return r},null,this._onLoad,this._onError))},t.prototype.getFloat32ArrayFromArrayBuffer=function(e){for(var t=new DataView(e),i=new Float32Array(3*e.byteLength/4),n=0,r=0;ri.length)m.a.Error("Unable to load TGA file - Not enough data");else{n+=r.id_length;var o,a=!1,s=!1,c=!1;switch(r.image_type){case e._TYPE_RLE_INDEXED:a=!0;case e._TYPE_INDEXED:s=!0;break;case e._TYPE_RLE_RGB:a=!0;case e._TYPE_RGB:break;case e._TYPE_RLE_GREY:a=!0;case e._TYPE_GREY:c=!0}var l,u,h,d,f,p,_,g=r.pixel_size>>3,v=r.width*r.height*g;if(s&&(l=i.subarray(n,n+=r.colormap_length*(r.colormap_size>>3))),a){var y,b,T;o=new Uint8Array(v);for(var E=0,A=new Uint8Array(g);n>e._ORIGIN_SHIFT){default:case e._ORIGIN_UL:u=0,d=1,_=r.width,h=0,f=1,p=r.height;break;case e._ORIGIN_BL:u=0,d=1,_=r.width,h=r.height-1,f=-1,p=-1;break;case e._ORIGIN_UR:u=r.width-1,d=-1,_=-1,h=0,f=1,p=r.height;break;case e._ORIGIN_BR:u=r.width-1,d=-1,_=-1,h=r.height-1,f=-1,p=-1}var P=e["_getImageData"+(c?"Grey":"")+r.pixel_size+"bits"](r,l,o,h,f,p,u,d,_);t.getEngine()._uploadDataToTextureDirectly(t,P)}}},e._getImageData8bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=t,p=e.width,_=e.height,m=0,g=new Uint8Array(p*_*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,m++)l=d[m],g[4*(u+p*h)+3]=255,g[4*(u+p*h)+2]=f[3*l+0],g[4*(u+p*h)+1]=f[3*l+1],g[4*(u+p*h)+0]=f[3*l+2];return g},e._getImageData16bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,_+=2){var g=255*((31744&(l=d[_+0]+(d[_+1]<<8)))>>10)/31|0,v=255*((992&l)>>5)/31|0,y=255*(31&l)/31|0;m[4*(u+f*h)+0]=g,m[4*(u+f*h)+1]=v,m[4*(u+f*h)+2]=y,m[4*(u+f*h)+3]=32768&l?0:255}return m},e._getImageData24bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=3)_[4*(l+d*u)+3]=255,_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+1]=h[p+1],_[4*(l+d*u)+0]=h[p+2];return _},e._getImageData32bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=4)_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+1]=h[p+1],_[4*(l+d*u)+0]=h[p+2],_[4*(l+d*u)+3]=h[p+3];return _},e._getImageDataGrey8bits=function(e,t,i,n,r,o,a,s,c){var l,u,h,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(h=n;h!==o;h+=r)for(u=a;u!==c;u+=s,_++)l=d[_],m[4*(u+f*h)+0]=l,m[4*(u+f*h)+1]=l,m[4*(u+f*h)+2]=l,m[4*(u+f*h)+3]=255;return m},e._getImageDataGrey16bits=function(e,t,i,n,r,o,a,s,c){var l,u,h=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(u=n;u!==o;u+=r)for(l=a;l!==c;l+=s,p+=2)_[4*(l+d*u)+0]=h[p+0],_[4*(l+d*u)+1]=h[p+0],_[4*(l+d*u)+2]=h[p+0],_[4*(l+d*u)+3]=h[p+1];return _},e._TYPE_INDEXED=1,e._TYPE_RGB=2,e._TYPE_GREY=3,e._TYPE_RLE_INDEXED=9,e._TYPE_RLE_RGB=10,e._TYPE_RLE_GREY=11,e._ORIGIN_MASK=48,e._ORIGIN_SHIFT=4,e._ORIGIN_BL=0,e._ORIGIN_BR=1,e._ORIGIN_UL=2,e._ORIGIN_UR=3,e}(),Ga=function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,n,r){return 0===e.indexOf(".tga")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,n,r){throw".env not supported in Cube."},e.prototype.loadData=function(e,t,i){var n=new Uint8Array(e),r=ka.GetTGAHeader(n);i(r.width,r.height,t.generateMipMaps,!1,function(){ka.UploadContent(t,n)})},e}();Ce.b._TextureLoaders.push(new Ga);var za;!function(e){e[e.cTFETC1=0]="cTFETC1",e[e.cTFBC1=1]="cTFBC1",e[e.cTFBC4=2]="cTFBC4",e[e.cTFPVRTC1_4_OPAQUE_ONLY=3]="cTFPVRTC1_4_OPAQUE_ONLY",e[e.cTFBC7_M6_OPAQUE_ONLY=4]="cTFBC7_M6_OPAQUE_ONLY",e[e.cTFETC2=5]="cTFETC2",e[e.cTFBC3=6]="cTFBC3",e[e.cTFBC5=7]="cTFBC5"}(za||(za={}));var ja=function(){function e(){}return e.GetInternalFormatFromBasisFormat=function(e){if(e===za.cTFETC1)return 36196;if(e===za.cTFBC1)return 33776;if(e===za.cTFBC3)return 33779;throw"The chosen Basis transcoder format is not currently supported"},e._CreateWorkerAsync=function(){var t=this;return this._WorkerPromise||(this._WorkerPromise=new Promise(function(i){t._Worker?i(t._Worker):Ie.b.LoadFileAsync(e.WasmModuleURL).then(function(n){var r=URL.createObjectURL(new Blob(["("+Wa+")()"],{type:"application/javascript"}));t._Worker=new Worker(r);var o=function(e){"init"===e.data.action&&(t._Worker.removeEventListener("message",o),i(t._Worker))};t._Worker.addEventListener("message",o),t._Worker.postMessage({action:"init",url:e.JSModuleURL,wasmBinary:n})})})),this._WorkerPromise},e.TranscodeAsync=function(e,t){var i=this;return new Promise(function(n,r){i._CreateWorkerAsync().then(function(){var o=i._actionId++,a=function(e){"transcode"===e.data.action&&e.data.id===o&&(i._Worker.removeEventListener("message",a),e.data.success?n(e.data):r("Transcode is not supported on this device"))};i._Worker.addEventListener("message",a),i._Worker.postMessage({action:"transcode",id:o,imageData:e,config:t,ignoreSupportedFormats:i._IgnoreSupportedFormats},[e])})})},e.LoadTextureFromTranscodeResult=function(t,i){for(var n,r=function(){if(n=i.fileInfo.images[o].levels[0],t._invertVScale=t.invertY,-1===i.format)if(t.type=Ce.b.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,t.format=Ce.b.TEXTUREFORMAT_RGB,t.getEngine().webGLVersion<2&&(w.a.Log2(n.width)%1!=0||w.a.Log2(n.height)%1!=0)){var r=new et.a(t.getEngine(),et.a.DATASOURCE_TEMP);t._invertVScale=t.invertY,r.type=Ce.b.TEXTURETYPE_UNSIGNED_SHORT_5_6_5,r.format=Ce.b.TEXTUREFORMAT_RGB,r.width=n.width+3&-4,r.height=n.height+3&-4,t.getEngine()._bindTextureDirectly(r.getEngine()._gl.TEXTURE_2D,r,!0),t.getEngine()._uploadDataToTextureDirectly(r,n.transcodedPixels,o,0,Ce.b.TEXTUREFORMAT_RGB,!0),r.getEngine()._rescaleTexture(r,t,t.getEngine().scenes[0],r.getEngine()._getInternalFormat(Ce.b.TEXTUREFORMAT_RGB),function(){r.getEngine()._releaseTexture(r),r.getEngine()._bindTextureDirectly(r.getEngine()._gl.TEXTURE_2D,t,!0)})}else t._invertVScale=!t.invertY,t.width=n.width+3&-4,t.height=n.height+3&-4,t.getEngine()._uploadDataToTextureDirectly(t,n.transcodedPixels,o,0,Ce.b.TEXTUREFORMAT_RGB,!0);else t.width=n.width,t.height=n.height,i.fileInfo.images[o].levels.forEach(function(n,r){t.getEngine()._uploadCompressedDataToTextureDirectly(t,e.GetInternalFormatFromBasisFormat(i.format),n.width,n.height,n.transcodedPixels,o,r)}),t.getEngine().webGLVersion<2&&(w.a.Log2(t.width)%1!=0||w.a.Log2(t.height)%1!=0)&&(Ie.b.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1."),t._cachedWrapU=$e.a.CLAMP_ADDRESSMODE,t._cachedWrapV=$e.a.CLAMP_ADDRESSMODE)},o=0;o>2&3],o[f++]=r[d>>4&3],o[f++]=r[d>>6&3]}}return o}(a,0,e.getImageWidth(t,i)+3&-4,e.getImageHeight(t,i)+3&-4));return a}onmessage=function(n){if("init"===n.data.action)t||(Module={wasmBinary:n.data.wasmBinary},importScripts(n.data.url),t=new Promise(function(e){Module.onRuntimeInitialized=function(){Module.initializeBasis(),e()}})),t.then(function(){postMessage({action:"init"})});else if("transcode"===n.data.action){var r=n.data.config,o=n.data.imageData,a=new Module.BasisFile(new Uint8Array(o)),s=function(e){for(var t=e.getHasAlpha(),i=e.getNumImages(),n=[],r=0;r1&&t.generateMipMaps;ja.LoadTextureFromTranscodeResult(t,e),t.getEngine()._setCubeMapTextureParams(i),t.isReady=!0}).catch(function(e){Ie.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),t.isReady=!0})}},e.prototype.loadData=function(e,t,i){var n=t.getEngine().getCaps(),r={supportedCompressionFormats:{etc1:!!n.etc1,s3tc:!!n.s3tc,pvrtc:!!n.pvrtc,etc2:!!n.etc2}};ja.TranscodeAsync(e,r).then(function(e){var n=e.fileInfo.images[0].levels[0],r=e.fileInfo.images[0].levels.length>1&&t.generateMipMaps;i(n.width,n.height,r,-1!==e.format,function(){ja.LoadTextureFromTranscodeResult(t,e)})}).catch(function(e){Ie.b.Warn("Failed to transcode Basis file, transcoding may not be supported on this device"),i(0,0,!1,!1,function(){})})},e}();Ce.b._TextureLoaders.push(new Ha),Ce.b.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var n=this._gl;if(e[0]._MSAAFramebuffer){n.bindFramebuffer(n.READ_FRAMEBUFFER,e[0]._MSAAFramebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,e[0]._framebuffer);var r=e[0]._attachments;r||(r=new Array(e.length),e[0]._attachments=r);for(var o=0;o1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"],n.readBuffer(r[o]),n.drawBuffers(r),n.blitFramebuffer(0,0,a.width,a.height,0,0,a.width,a.height,n.COLOR_BUFFER_BIT,n.NEAREST)}for(o=0;o1?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"];n.drawBuffers(r)}for(o=0;o1?"COLOR_ATTACHMENT"+y:"COLOR_ATTACHMENT"+y+"_WEBGL"];_.push(A),g.push(P),h.activeTexture(h["TEXTURE"+y]),h.bindTexture(h.TEXTURE_2D,A._webGLTexture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,E.mag),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,E.min),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(T),f,p,0,h.RGBA,this._getWebGLTextureType(T),null),h.framebufferTexture2D(h.DRAW_FRAMEBUFFER,P,h.TEXTURE_2D,A._webGLTexture,0),i&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(h.TEXTURE_2D,null),A._framebuffer=d,A._depthStencilBuffer=v,A.baseWidth=f,A.baseHeight=p,A.width=f,A.height=p,A.isReady=!0,A.samples=1,A.generateMipMaps=i,A.samplingMode=b,A.type=T,A._generateDepthBuffer=n,A._generateStencilBuffer=r,A._attachments=g,this._internalTexturesCache.push(A)}if(o&&this._caps.depthTextureExtension){var S=new et.a(this,et.a.DATASOURCE_MULTIRENDERTARGET);h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,S._webGLTexture),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texImage2D(h.TEXTURE_2D,0,this.webGLVersion<2?h.DEPTH_COMPONENT:h.DEPTH_COMPONENT16,f,p,0,h.DEPTH_COMPONENT,h.UNSIGNED_SHORT,null),h.framebufferTexture2D(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.TEXTURE_2D,S._webGLTexture,0),S._framebuffer=d,S.baseWidth=f,S.baseHeight=p,S.width=f,S.height=p,S.isReady=!0,S.samples=1,S.generateMipMaps=i,S.samplingMode=h.NEAREST,S._generateDepthBuffer=n,S._generateStencilBuffer=r,_.push(S),this._internalTexturesCache.push(S)}return h.drawBuffers(g),h.bindRenderbuffer(h.RENDERBUFFER,null),this._bindUnboundFramebuffer(null),this.resetTextureCache(),_},Ce.b.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||0==e.length)return 1;if(e[0].samples===t)return t;var i=this._gl;t=Math.min(t,this.getCaps().maxMSAASamples),e[0]._depthStencilBuffer&&(i.deleteRenderbuffer(e[0]._depthStencilBuffer),e[0]._depthStencilBuffer=null),e[0]._MSAAFramebuffer&&(i.deleteFramebuffer(e[0]._MSAAFramebuffer),e[0]._MSAAFramebuffer=null);for(var n=0;n1){var r=i.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");this._bindUnboundFramebuffer(r);var o=this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer,e[0]._generateDepthBuffer,e[0].width,e[0].height,t),a=[];for(n=0;n1?"COLOR_ATTACHMENT"+n:"COLOR_ATTACHMENT"+n+"_WEBGL"],l=i.createRenderbuffer();if(!l)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,l),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(s.type),s.width,s.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,c,i.RENDERBUFFER,l),s._MSAAFramebuffer=r,s._MSAARenderBuffer=l,s.samples=t,s._depthStencilBuffer=o,i.bindRenderbuffer(i.RENDERBUFFER,null),a.push(c)}i.drawBuffers(a)}else this._bindUnboundFramebuffer(e[0]._framebuffer);return this._bindUnboundFramebuffer(null),t};var Xa=function(e){function t(t,i,n,r,o){var a=this,s=!(!o||!o.generateMipMaps)&&o.generateMipMaps,c=!(!o||!o.generateDepthTexture)&&o.generateDepthTexture,l=!o||void 0===o.doNotChangeAspectRatio||o.doNotChangeAspectRatio;if((a=e.call(this,t,i,r,s,l)||this)._engine=r.getEngine(),a.isSupported){for(var u=[],h=[],d=0;d1||this._engine.getCaps().drawBuffersExtension},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this._textures},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t=0;e--)void 0!==this._internalTextures[e]&&(this._internalTextures[e].dispose(),this._internalTextures.splice(e,1))},t}(Oi),Ya=function(){function e(e){this.name=Fe.a.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array}return e.prototype.register=function(){this.scene._beforeClearStage.registerStep(Fe.a.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){Ie.b.StartPerformanceCounter("Procedural textures",this.scene.proceduralTextures.length>0);for(var e=0;e0)}},e}(),Ka="\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}";ni.a.ShadersStore.proceduralVertexShader=Ka;var Qa=function(e){function t(t,i,n,r,a,s,c){void 0===a&&(a=null),void 0===s&&(s=!0),void 0===c&&(c=!1);var l=e.call(this,null,r,!s)||this;l.isCube=c,l.isEnabled=!0,l.autoClear=!0,l.onGeneratedObservable=new o.c,l._textures={},l._currentRefreshId=-1,l._refreshRate=1,l._vertexBuffers={},l._uniforms=new Array,l._samplers=new Array,l._floats={},l._ints={},l._floatsArrays={},l._colors3={},l._colors4={},l._vectors2={},l._vectors3={},l._matrices={},l._fallbackTextureUsed=!1,l._cachedDefines="",l._contentUpdateId=-1;var u=(r=l.getScene())._getComponent(Fe.a.NAME_PROCEDURALTEXTURE);u||(u=new Ya(r),r._addComponent(u)),r.proceduralTextures.push(l),l._engine=r.getEngine(),l.name=t,l.isRenderTarget=!0,l._size=i,l._generateMipMaps=s,l.setFragment(n),l._fallbackTexture=a,c?(l._texture=l._engine.createRenderTargetCubeTexture(i,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1}),l.setFloat("face",0)):l._texture=l._engine.createRenderTargetTexture(i,{generateMipMaps:s,generateDepthBuffer:!1,generateStencilBuffer:!1});var h=[];return h.push(1,1),h.push(-1,1),h.push(-1,-1),h.push(1,-1),l._vertexBuffers[Yi.b.PositionKind]=new Yi.b(l._engine,h,Yi.b.PositionKind,!1,!1,2),l._createIndexBuffer(),l}return h.d(t,e),t.prototype.getEffect=function(){return this._effect},t.prototype.getContent=function(){return this._contentData&&this._currentRefreshId==this._contentUpdateId?this._contentData:(this._contentData=this.readPixels(0,0,this._contentData),this._contentUpdateId=this._currentRefreshId,this._contentData)},t.prototype._createIndexBuffer=function(){var e=this._engine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},t.prototype._rebuild=function(){var e=this._vertexBuffers[Yi.b.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===Oi.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Oi.REFRESHRATE_RENDER_ONCE)},t.prototype.reset=function(){void 0!==this._effect&&this._effect.dispose()},t.prototype._getDefines=function(){return""},t.prototype.isReady=function(){var e,t=this,i=this._engine;if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;var n=this._getDefines();return!(!this._effect||n!==this._cachedDefines||!this._effect.isReady())||(e=void 0!==this._fragment.fragmentElement?{vertex:"procedural",fragmentElement:this._fragment.fragmentElement}:{vertex:"procedural",fragment:this._fragment},this._cachedDefines=n,this._effect=i.createEffect(e,[Yi.b.PositionKind],this._uniforms,this._samplers,n,void 0,void 0,function(){t.releaseInternalTexture(),t._fallbackTexture&&(t._texture=t._fallbackTexture._texture,t._texture&&t._texture.incrementReferences()),t._fallbackTextureUsed=!0}),this._effect.isReady())},t.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},t.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(t.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!0,configurable:!0}),t.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},t.prototype.getRenderSize=function(){return this._size},t.prototype.resize=function(e,t){this._fallbackTextureUsed||(this.releaseInternalTexture(),this._texture=this._engine.createRenderTargetTexture(e,t),this._size=e,this._generateMipMaps=t)},t.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},t.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},t.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},t.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},t.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},t.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},t.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},t.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},t.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},t.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},t.prototype.render=function(e){var t=this.getScene();if(t){var i=this._engine;for(var n in i.enableEffect(this._effect),i.setState(!1),this._textures)this._effect.setTexture(n,this._textures[n]);for(n in this._ints)this._effect.setInt(n,this._ints[n]);for(n in this._floats)this._effect.setFloat(n,this._floats[n]);for(n in this._floatsArrays)this._effect.setArray(n,this._floatsArrays[n]);for(n in this._colors3)this._effect.setColor3(n,this._colors3[n]);for(n in this._colors4){var r=this._colors4[n];this._effect.setFloat4(n,r.r,r.g,r.b,r.a)}for(n in this._vectors2)this._effect.setVector2(n,this._vectors2[n]);for(n in this._vectors3)this._effect.setVector3(n,this._vectors3[n]);for(n in this._matrices)this._effect.setMatrix(n,this._matrices[n]);if(this._texture){if(this.isCube)for(var o=0;o<6;o++)i.bindFramebuffer(this._texture,o,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this._effect.setFloat("face",o),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(No.a.TriangleFillMode,0,6),5===o&&i.generateMipMapsForCubemap(this._texture);else i.bindFramebuffer(this._texture,0,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(No.a.TriangleFillMode,0,6);i.unBindFramebuffer(this._texture,this.isCube),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},t.prototype.clone=function(){var e=this.getSize(),i=new t(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.coordinatesMode=this.coordinatesMode,i},t.prototype.dispose=function(){var t=this.getScene();if(t){var i=t.proceduralTextures.indexOf(this);i>=0&&t.proceduralTextures.splice(i,1);var n=this._vertexBuffers[Yi.b.PositionKind];n&&(n.dispose(),this._vertexBuffers[Yi.b.PositionKind]=null),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),e.prototype.dispose.call(this)}},h.c([Object(F.c)()],t.prototype,"isEnabled",void 0),h.c([Object(F.c)()],t.prototype,"autoClear",void 0),h.c([Object(F.c)()],t.prototype,"_generateMipMaps",void 0),h.c([Object(F.c)()],t.prototype,"_size",void 0),h.c([Object(F.c)()],t.prototype,"refreshRate",null),t}($e.a),qa=i(66),Za=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,n,null,r,o,a)||this;return s._animate=!0,s._time=0,s._texturePath=i,s._loadJson(i),s.refreshRate=1,s}return h.d(t,e),t.prototype._loadJson=function(e){var t=this,i=function(){m.a.Log("No config file found in "+e+" trying to use ShadersStore or DOM element");try{t.setFragment(t._texturePath)}catch(e){m.a.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture")}},n=e+"/config.json",r=new qa.a;r.open("GET",n),r.addEventListener("load",function(){if(200===r.status||r.responseText&&r.responseText.length>0)try{t._config=JSON.parse(r.response),t.updateShaderUniforms(),t.updateTextures(),t.setFragment(t._texturePath+"/custom"),t._animate=t._config.animate,t.refreshRate=t._config.refreshrate}catch(e){i()}else i()},!1),r.addEventListener("error",function(){i()},!1);try{r.send()}catch(e){m.a.Error("CustomProceduralTexture: Error on XHR send request.")}},t.prototype.isReady=function(){if(!e.prototype.isReady.call(this))return!1;for(var t in this._textures){if(!this._textures[t].isReady())return!1}return!0},t.prototype.render=function(t){var i=this.getScene();this._animate&&i&&(this._time+=.03*i.getAnimationRatio(),this.updateShaderUniforms()),e.prototype.render.call(this,t)},t.prototype.updateTextures=function(){for(var e=0;e0},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"NodeMaterialConnectionPoint"},e.prototype.canConnectTo=function(e){if(this.type!==e.type&&e.type!==ts.AutoDetect){switch(this.type){case ts.Vector3:if(e.type===ts.Color3)return!0;case ts.Vector4:if(e.type===ts.Color4)return!0;case ts.Color3:if(e.type===ts.Vector3)return!0;case ts.Color4:if(e.type===ts.Vector4)return!0}return e.acceptedConnectionPointTypes&&-1!==e.acceptedConnectionPointTypes.indexOf(this.type)}return!0},e.prototype.connectTo=function(e,t){if(void 0===t&&(t=!1),!t&&!this.canConnectTo(e))throw"Cannot connect two different connection types.";return this._endpoints.push(e),e._connectedPoint=this,this._enforceAssociatedVariableName=!1,this},e.prototype.disconnectFrom=function(e){var t=this._endpoints.indexOf(e);return-1===t?this:(this._endpoints.splice(t,1),e._connectedPoint=null,this._enforceAssociatedVariableName=!1,e._enforceAssociatedVariableName=!1,this)},e.prototype.serialize=function(){var e={};return e.name=this.name,this.connectedPoint&&(e.inputName=this.name,e.targetBlockId=this.connectedPoint.ownerBlock.uniqueId,e.targetConnectionName=this.connectedPoint.name),e},e}(),ss=i(129),cs=function(){function e(e,t,i,n){void 0===t&&(t=es.Vertex),void 0===i&&(i=!1),void 0===n&&(n=!1),this._isFinalMerger=!1,this._isInput=!1,this._codeVariableName="",this._inputs=new Array,this._outputs=new Array,this.name=e,this._target=t,this._isFinalMerger=i,this._isInput=n,this.uniqueId=ss.a.UniqueId}return Object.defineProperty(e.prototype,"isFinalMerger",{get:function(){return this._isFinalMerger},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInput",{get:function(){return this._isInput},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buildId",{get:function(){return this._buildId},set:function(e){this._buildId=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){0==(this._target&e)&&(this._target=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputs",{get:function(){return this._inputs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outputs",{get:function(){return this._outputs},enumerable:!0,configurable:!0}),e.prototype.getInputByName=function(e){var t=this._inputs.filter(function(t){return t.name===e});return t.length?t[0]:null},e.prototype.getOutputByName=function(e){var t=this._outputs.filter(function(t){return t.name===e});return t.length?t[0]:null},e.prototype.initialize=function(e){},e.prototype.bind=function(e,t,i){},e.prototype._declareOutput=function(e,t){return t._getGLType(e.type)+" "+e.associatedVariableName},e.prototype._writeVariable=function(e){return e.connectedPoint?""+e.associatedVariableName:"0."},e.prototype._writeFloat=function(e){var t=e.toString();return-1===t.indexOf(".")&&(t+=".0"),""+t},e.prototype.getClassName=function(){return"NodeMaterialBlock"},e.prototype.registerInput=function(e,t,i,n){void 0===i&&(i=!1);var r=new as(e,this);return r.type=t,r.isOptional=i,n&&(r.target=n),this._inputs.push(r),this},e.prototype.registerOutput=function(e,t,i){var n=new as(e,this);return n.type=t,i&&(n.target=i),this._outputs.push(n),this},e.prototype.getFirstAvailableInput=function(e){void 0===e&&(e=null);for(var t=0,i=this._inputs;t=this._outputs.length?null:this._outputs[t+1]},e.prototype.connectTo=function(e,t){if(0!==this._outputs.length){for(var i=t&&t.output?this.getOutputByName(t.output):this.getFirstAvailableOutput(e),n=!0;n;){var r=t&&t.input?e.getInputByName(t.input):e.getFirstAvailableInput(i);if(i&&r&&i.canConnectTo(r))i.connectTo(r),n=!1;else{if(!i)throw"Unable to find a compatible match";i=this.getSiblingOutput(i)}}return this}},e.prototype._buildBlock=function(e){},e.prototype.updateUniformsAndSamples=function(e,t,i){},e.prototype.provideFallbacks=function(e,t){},e.prototype.prepareDefines=function(e,t,i,n){void 0===n&&(n=!1)},e.prototype.initializeDefines=function(e,t,i,n){void 0===n&&(n=!1)},e.prototype.autoConfigure=function(e){},e.prototype.replaceRepeatableContent=function(e,t,i,n){},e.prototype.isReady=function(e,t,i,n){return void 0===n&&(n=!1),!0},e.prototype._processBuild=function(e,t,i,n){if(e.build(t,n),t._vertexState&&0==(e.target&this.target)&&(!e.isInput&&t.target!==e._buildTarget||e.isInput&&e.isAttribute)){var r=i.connectedPoint;t._vertexState._emitVaryingFromString("v_"+r.associatedVariableName,t._getGLType(r.type)),t._vertexState.compilationString+="v_"+r.associatedVariableName+" = "+r.associatedVariableName+";\r\n",i.associatedVariableName="v_"+r.associatedVariableName,i._enforceAssociatedVariableName=!0}},e.prototype.build=function(e,t){if(this._buildId===e.sharedData.buildId)return!0;for(var i=0,n=this._inputs;i[0.."+i.repeatKey+"]\r\n";var n=ni.a.IncludesShadersStore[e]+"\r\n";if(this.sharedData.emitComments&&(n=t+"\r\n"+n),!i)return n;if(i.replaceStrings)for(var r=0;r[0.."+i.repeatKey+"]\r\n":this.functions[r]="#include<"+e+">\r\n",void(this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]));if(this.functions[r]=ni.a.IncludesShadersStore[e],this.sharedData.emitComments&&(this.functions[r]=t+"\r\n"+this.functions[r]),i.removeIfDef&&(this.functions[r]=this.functions[r].replace(/^\s*?#ifdef.+$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#endif.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#else.*$/gm,""),this.functions[r]=this.functions[r].replace(/^\s*?#elif.*$/gm,"")),i.removeAttributes&&(this.functions[r]=this.functions[r].replace(/^\s*?attribute.+$/gm,"")),i.removeUniforms&&(this.functions[r]=this.functions[r].replace(/^\s*?uniform.+$/gm,"")),i.removeVaryings&&(this.functions[r]=this.functions[r].replace(/^\s*?varying.+$/gm,"")),i.replaceStrings)for(var o=0;o-1))return this._optimizers.push(e),this},t.prototype.unregisterOptimizer=function(e){var t=this._optimizers.indexOf(e);if(-1!==t)return this._optimizers.splice(t,1),this},t.prototype.addOutputNode=function(e){if(null===e.target)throw"This node is not meant to be an output node. You may want to explicitly set its target value.";return 0!=(e.target&es.Vertex)&&this._addVertexOutputNode(e),0!=(e.target&es.Fragment)&&this._addFragmentOutputNode(e),this},t.prototype.removeOutputNode=function(e){return null===e.target?this:(0!=(e.target&es.Vertex)&&this._removeVertexOutputNode(e),0!=(e.target&es.Fragment)&&this._removeFragmentOutputNode(e),this)},t.prototype._addVertexOutputNode=function(e){if(-1===this._vertexOutputNodes.indexOf(e))return e.target=es.Vertex,this._vertexOutputNodes.push(e),this},t.prototype._removeVertexOutputNode=function(e){var t=this._vertexOutputNodes.indexOf(e);if(-1!==t)return this._vertexOutputNodes.splice(t,1),this},t.prototype._addFragmentOutputNode=function(e){if(-1===this._fragmentOutputNodes.indexOf(e))return e.target=es.Fragment,this._fragmentOutputNodes.push(e),this},t.prototype._removeFragmentOutputNode=function(e){var t=this._fragmentOutputNodes.indexOf(e);if(-1!==t)return this._fragmentOutputNodes.splice(t,1),this},t.prototype.needAlphaBlending=function(){return!this.ignoreAlpha&&(this.alpha<1||this._sharedData&&this._sharedData.hints.needAlphaBlending)},t.prototype.needAlphaTesting=function(){return this._sharedData&&this._sharedData.hints.needAlphaTesting},t.prototype._initializeBlock=function(e,t,i){e.initialize(t),e.autoConfigure(this),-1===this.attachedBlocks.indexOf(e)&&this.attachedBlocks.push(e);for(var n=0,r=e.inputs;n0)for(y=0;y1&&r!=e.length-1?i._getNextFrameBuffer():t,i.setViewport(),i.applyEffectWrapper(n),o&&i.engine.bindFramebuffer(o.getInternalTexture()),i.draw(),o&&i.engine.unBindFramebuffer(o.getInternalTexture())})},e.prototype.dispose=function(){this._ringScreenBuffer&&(this._ringScreenBuffer.forEach(function(e){e.dispose()}),this._ringScreenBuffer=null);var e=this._vertexBuffers[Yi.b.PositionKind];e&&(e.dispose(),delete this._vertexBuffers[Yi.b.PositionKind]),this._indexBuffer&&this.engine._releaseBuffer(this._indexBuffer)},e._DefaultOptions={positions:[1,1,-1,1,-1,-1,1,-1],indices:[0,1,2,0,2,3]},e}(),qs=function(){function e(e){var t;this.onApplyObservable=new o.c,t=e.vertexShader?{fragmentSource:e.fragmentShader,vertexSource:e.vertexShader,spectorName:e.name||"effectWrapper"}:{fragmentSource:e.fragmentShader,vertex:"postprocess",spectorName:e.name||"effectWrapper"},this.effect=new ni.a(t,e.attributeNames||["position"],e.uniformNames||["scale"],e.samplerNames,e.engine)}return e.prototype.dispose=function(){this.effect.dispose()},e}(),Zs=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;ee.EPSILON?1:0;l|=h,u.push(h)}switch(l){case 0:(a.e.Dot(this.normal,t.plane.normal)>0?i:n).push(t);break;case 1:r.push(t);break;case 2:o.push(t);break;case 3:var d,f=[],p=[];for(s=0;s=3&&(d=new sc(f,t.shared)).plane&&r.push(d),p.length>=3&&(d=new sc(p,t.shared)).plane&&o.push(d)}},e.EPSILON=1e-5,e}(),sc=function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=ac.FromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map(function(e){return e.clone()}),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map(function(e){e.flip()}),this.plane.flip()},e}(),cc=function(){function e(e){this.plane=null,this.front=null,this.back=null,this.polygons=new Array,e&&this.build(e)}return e.prototype.clone=function(){var t=new e;return t.plane=this.plane&&this.plane.clone(),t.front=this.front&&this.front.clone(),t.back=this.back&&this.back.clone(),t.polygons=this.polygons.map(function(e){return e.clone()}),t},e.prototype.invert=function(){for(var e=0;e1)?1:e.arc||1,c=0===e.sideOrientation?0:e.sideOrientation||Xi.a.DEFAULTSIDE;t.push(0,0,0),r.push(.5,.5);for(var l=2*Math.PI*s,u=l/a,h=0;ht.x&&(t.x=i.x),i.yt.y&&(t.y=i.y)}),{min:e,max:t,width:t.x-e.x,height:t.y-e.y}},e}(),vc=function(){function e(){}return e.Rectangle=function(e,t,i,n){return[new a.d(e,t),new a.d(i,t),new a.d(i,n),new a.d(e,n)]},e.Circle=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=32);for(var r=new Array,o=0,s=2*Math.PI/n,c=0;c0){var u=r.length/3;this._points.elements.forEach(function(t){n.push(0,-1,0),r.push(t.x,-e,t.y),o.push(1-(t.x-a.min.x)/a.width,1-(t.y-a.min.y)/a.height)});var h=s.length;for(l=0;lo.elements.length-1?o.elements[0]:o.elements[h+1],e.push(f.x,0,f.y),e.push(f.x,-s,f.y),e.push(d.x,0,d.y),e.push(d.x,-s,d.y);var p=new a.e(f.x,0,f.y),_=new a.e(d.x,0,d.y).subtract(p),m=new a.e(0,1,0),g=a.e.Cross(_,m);g=g.normalize(),i.push(u/r.width,0),i.push(u/r.width,1),u+=_.length(),i.push(u/r.width,0),i.push(u/r.width,1),c?(t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),t.push(g.x,g.y,g.z),n.push(l),n.push(l+2),n.push(l+1),n.push(l+1),n.push(l+2),n.push(l+3)):(t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),t.push(-g.x,-g.y,-g.z),n.push(l),n.push(l+1),n.push(l+2),n.push(l+1),n.push(l+3),n.push(l+2)),l+=4}},e}();Xi.a.CreatePolygon=function(e,t,i,n,r,o){for(var c=i||new Array(3),l=n,u=[],h=0;h<3;h++)void 0===c[h]&&(c[h]=new a.f(0,0,1,1)),l&&void 0===l[h]&&(l[h]=new s.b(1,1,1,1));for(var d=e.getVerticesData(Yi.b.PositionKind),f=e.getVerticesData(Yi.b.NormalKind),p=e.getVerticesData(Yi.b.UVKind),_=e.getIndices(),m=0,g=0,v=0;v1?1:t.arc:1,o=void 0===t.closed||t.closed,s=t.shape,c=t.radius||1,l=t.tessellation||64,u=t.clip||0,h=t.updatable,d=Se.a._GetDefaultSideOrientation(t.sideOrientation),f=t.cap||Se.a.NO_CAP,p=2*Math.PI,_=new Array,m=t.invertUV||!1,g=0,v=0,y=p/l*r,b=new Array;for(g=0;g<=l-u;g++){b=[];for(f!=Se.a.CAP_START&&f!=Se.a.CAP_ALL||(b.push(new a.e(0,s[0].y,0)),b.push(new a.e(Math.cos(g*y)*s[0].x*c,s[0].y,Math.sin(g*y)*s[0].x*c))),v=0;v0||h>0){m=-d,g=-f;v=d,y=f;switch(r){case Se.a.CENTER:m-=c/=2,v+=c;break;case Se.a.LEFT:v+=c,p=-c/2;break;case Se.a.RIGHT:m-=c,p=c/2}switch(o){case Se.a.CENTER:g-=h/=2,y+=h;break;case Se.a.BOTTOM:y+=h,_=-h/2;break;case Se.a.TOP:g-=h,_=h/2}}var b=[],T=[],E=[];E[0]=[0,0,1,0,1,1,0,1],E[1]=[0,0,1,0,1,1,0,1],t!==Se.a.ROTATE_TILE&&t!==Se.a.ROTATE_ROW||(E[1]=[1,1,0,1,0,0,1,0]),t!==Se.a.FLIP_TILE&&t!==Se.a.FLIP_ROW||(E[1]=[1,0,0,0,0,1,1,1]),t!==Se.a.FLIP_N_ROTATE_TILE&&t!==Se.a.FLIP_N_ROTATE_ROW||(E[1]=[0,1,1,1,1,0,0,0]);for(var A=[],P=[],S=[],R=0,x=0;x0||h>0){var M,O,I,D,L=h>0&&(o===Se.a.CENTER||o===Se.a.TOP),w=h>0&&(o===Se.a.CENTER||o===Se.a.BOTTOM),F=c>0&&(r===Se.a.CENTER||r===Se.a.RIGHT),N=c>0&&(r===Se.a.CENTER||r===Se.a.LEFT),B=[];if(L&&F&&(b.push(m+p,g+_,0),b.push(-d+p,g+_,0),b.push(-d+p,g+h+_,0),b.push(m+p,g+h+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=1-c/i,O=1-h/n,I=1,O,I,D=1,M,D],t===Se.a.ROTATE_ROW&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),t===Se.a.FLIP_ROW&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),t===Se.a.FLIP_N_ROTATE_ROW&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),L&&N&&(b.push(d+p,g+_,0),b.push(v+p,g+_,0),b.push(v+p,g+h+_,0),b.push(d+p,g+h+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=0,O=1-h/n,I=c/i,O,I,D=1,M,D],(t===Se.a.ROTATE_ROW||t===Se.a.ROTATE_TILE&&s%2==0)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW||t===Se.a.FLIP_TILE&&s%2==0)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW||t===Se.a.FLIP_N_ROTATE_TILE&&s%2==0)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&F&&(b.push(m+p,f+_,0),b.push(-d+p,f+_,0),b.push(-d+p,y+_,0),b.push(m+p,y+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=1-c/i,O=0,I=1,O,I,D=h/n,M,D],(t===Se.a.ROTATE_ROW&&u%2==1||t===Se.a.ROTATE_TILE&&u%1==0)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW&&u%2==1||t===Se.a.FLIP_TILE&&u%2==0)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW&&u%2==1||t===Se.a.FLIP_N_ROTATE_TILE&&u%2==0)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),w&&N&&(b.push(d+p,f+_,0),b.push(v+p,f+_,0),b.push(v+p,y+_,0),b.push(d+p,y+_,0),S.push(R,R+1,R+3,R+1,R+2,R+3),R+=4,B=[M=0,O=0,I=c/i,O,I,D=h/n,M,D],(t===Se.a.ROTATE_ROW&&u%2==1||t===Se.a.ROTATE_TILE&&(u+s)%2==1)&&(B=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),(t===Se.a.FLIP_ROW&&u%2==1||t===Se.a.FLIP_TILE&&(u+s)%2==1)&&(B=[1-M,O,1-I,O,1-I,D,1-M,D]),(t===Se.a.FLIP_N_ROTATE_ROW&&u%2==1||t===Se.a.FLIP_N_ROTATE_TILE&&(u+s)%2==1)&&(B=[M,1-O,I,1-O,I,1-D,M,1-D]),A=A.concat(B),P.push(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),T.push(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),L){var U=[];M=0,O=1-h/n,I=1,D=1,U[0]=[M,O,I,O,I,D,M,D],U[1]=[M,O,I,O,I,D,M,D],t!==Se.a.ROTATE_TILE&&t!==Se.a.ROTATE_ROW||(U[1]=[1-M,1-O,1-I,1-O,1-I,1-D,1-M,1-D]),t!==Se.a.FLIP_TILE&&t!==Se.a.FLIP_ROW||(U[1]=[1-M,O,1-I,O,1-I,D,1-M,D]),t!==Se.a.FLIP_N_ROTATE_TILE&&t!==Se.a.FLIP_N_ROTATE_ROW||(U[1]=[M,1-O,I,1-O,I,1-D,M,1-D]);for(C=0;C1)?1:t.arc||1;var f,p,_=function(e,t,i,n,r,o,s,c){for(var l,u,h,d,f=t.getTangents(),p=t.getNormals(),_=t.getDistances(),m=2*Math.PI/r*c,g=o||function(){return n},v=a.c.Matrix[0],y=s===Se.a.NO_CAP||s===Se.a.CAP_END?0:2,b=0;b3?0:l,t.arc);var v=Ea.CreateRibbon(e,{pathArray:p,closePath:!0,closeArray:!1,updatable:h,sideOrientation:d,invertUV:u,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return v._creationDataStorage.pathArray=p,v._creationDataStorage.path3D=f,v._creationDataStorage.tessellation=s,v._creationDataStorage.cap=l,v._creationDataStorage.arc=t.arc,v._creationDataStorage.radius=o,v},e}();Xi.a.CreateIcoSphere=function(e){var t,i=e.sideOrientation||Xi.a.DEFAULTSIDE,n=e.radius||1,r=void 0===e.flat||e.flat,o=e.subdivisions||4,s=e.radiusX||n,c=e.radiusY||n,l=e.radiusZ||n,u=(1+Math.sqrt(5))/2,h=[-1,u,-0,1,u,0,-1,-u,0,1,-u,0,0,-1,-u,0,1,-u,0,-1,u,0,1,u,u,0,1,u,0,-1,-u,0,1,-u,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],f=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],p=[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],_=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],m=new Array,g=new Array,v=new Array,y=new Array,b=0,T=new Array(3),E=new Array(3);for(t=0;t<3;t++)T[t]=a.e.Zero(),E[t]=a.d.Zero();for(var A=0;A<20;A++){for(t=0;t<3;t++){var P=d[3*A+t];T[t].copyFromFloats(h[3*f[P]],h[3*f[P]+1],h[3*f[P]+2]),T[t].normalize().scaleInPlace(n),E[t].copyFromFloats(p[2*P]*(138/1024)+60/1024+_[A]*(-40/1024),p[2*P+1]*(239/1024)+26/1024+_[A]*(20/1024))}for(var S=function(e,t,i,n){var u,h=a.e.Lerp(T[0],T[2],t/o),d=a.e.Lerp(T[1],T[2],t/o),f=o===t?T[2]:a.e.Lerp(h,d,e/(o-t));if(f.normalize(),r){var p=a.e.Lerp(T[0],T[2],n/o),_=a.e.Lerp(T[1],T[2],n/o);u=a.e.Lerp(p,_,i/(o-n))}else u=new a.e(f.x,f.y,f.z);u.x/=s,u.y/=c,u.z/=l,u.normalize();var A=a.d.Lerp(E[0],E[2],t/o),P=a.d.Lerp(E[1],E[2],t/o),S=o===t?E[2]:a.d.Lerp(A,P,e/(o-t));g.push(f.x*s,f.y*c,f.z*l),v.push(u.x,u.y,u.z),y.push(S.x,S.y),m.push(b),b++},R=0;R0)?1:0)+((c=a.e.Dot(e[o+1].position,t)-i>0)?1:0)+((u=a.e.Dot(e[o+2].position,t)-i>0)?1:0)){case 0:r.push(e[o]),r.push(e[o+1]),r.push(e[o+2]);break;case 1:if(s&&(h=e[o+1],d=e[o+2],f=n(e[o],h),p=n(e[o],d)),c){h=e[o],d=e[o+2],f=n(e[o+1],h),p=n(e[o+1],d),r.push(f),r.push(d.clone()),r.push(h.clone()),r.push(d.clone()),r.push(f.clone()),r.push(p);break}u&&(h=e[o],d=e[o+1],f=n(e[o+2],h),p=n(e[o+2],d)),h&&d&&f&&p&&(r.push(h.clone()),r.push(d.clone()),r.push(f),r.push(p),r.push(f.clone()),r.push(d.clone()));break;case 2:s||(d=n(h=e[o].clone(),e[o+1]),f=n(h,e[o+2]),r.push(h),r.push(d),r.push(f)),c||(d=n(h=e[o+1].clone(),e[o+2]),f=n(h,e[o]),r.push(h),r.push(d),r.push(f)),u||(d=n(h=e[o+2].clone(),e[o]),f=n(h,e[o+1]),r.push(h),r.push(d),r.push(f))}}return r},P=0;Pc||i.deleted||i.isDirty))for(var r=0;r<3;++r)if(i.error[r]>0,function(e){if(r){var t=e+s.verticesStart,o=a.e.FromArray(r,3*t),l=function(e){if(i)for(var t=0;t0&&this._reconstructedMesh.setVerticesData(Yi.b.UVKind,s),c.length>0&&this._reconstructedMesh.setVerticesData(Yi.b.ColorKind,c);var y=this._mesh.subMeshes[e];e>0&&(this._reconstructedMesh.subMeshes=[],m.forEach(function(e){nc.b.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())}),nc.b.AddToMesh(y.materialIndex,_,d,p,3*r.length,this._reconstructedMesh))},e.prototype.initDecimatedMesh=function(){this._reconstructedMesh=new Se.a(this._mesh.name+"Decimated",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId},e.prototype.isFlipped=function(e,t,i,n,r){for(var o=0;o.999)return!0;var f=a.e.Cross(h,d).normalize();if(n[o]=!1,a.e.Dot(f,s.normal)<.2)return!0}else n[o]=!0,r.push(s)}}return!1},e.prototype.updateTriangles=function(e,t,i,n){for(var r=n,o=0;o-1&&(this.agents.splice(t,1),this.transforms.splice(t,1))},e.prototype.getAgents=function(){return this.agents},e.prototype.update=function(e){this.recastCrowd.update(e);for(var t=0;t=400&&o?o(l):i()},!1),l.addEventListener("error",function(){m.a.Error("error on XHR request."),i()},!1),l.send()}else m.a.Error("Error: IndexedDB not supported by your browser or Babylon.js Database is not open."),i()},e._ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&e.responseText.length>0)return!0;if(1===t)return!1}if(2&t){var i=ka.GetTGAHeader(e.response);if(i.width&&i.height&&i.width>0&&i.height>0)return!0;if(2===t)return!1}if(4&t){var n=new Uint8Array(e.response,0,3);return 68===n[0]&&68===n[1]&&83===n[2]}}catch(e){}return!1},e.IsUASupportingBlobStorage=!0,e.IDBStorageEnabled=!1,e._ParseURL=function(e){document.createElement("a").href=e;var t=e.substring(0,e.lastIndexOf("#")),i=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(i,0))},e._ReturnFullUrlLocation=function(t){return-1===t.indexOf("http:/")&&-1===t.indexOf("https:/")?e._ParseURL(window.location.href)+t:t},e}(),jc=function(){function e(){this.direction1=new a.e(0,1,0),this.direction2=new a.e(0,1,0),this.minEmitBox=new a.e(-.5,-.5,-.5),this.maxEmitBox=new a.e(.5,.5,.5)}return e.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=w.a.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),r=w.a.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),o=w.a.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);a.e.TransformCoordinatesFromFloatsToRef(n,r,o,e,t)},e.prototype.clone=function(){var t=new e;return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)},e.prototype.getEffectDefines=function(){return"#define BOXEMITTER"},e.prototype.getClassName=function(){return"BoxParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e},e.prototype.parse=function(e){a.e.FromArrayToRef(e.direction1,0,this.direction1),a.e.FromArrayToRef(e.direction2,0,this.direction2),a.e.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),a.e.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},e}(),Wc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=Math.PI),void 0===i&&(i=0),this.directionRandomizer=i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}return Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!0,configurable:!0}),e.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},e.prototype.startDirectionFunction=function(e,t,i){if(1===Math.abs(Math.cos(this._angle)))a.e.TransformNormalFromFloatsToRef(0,1,0,e,t);else{var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)}},e.prototype.startPositionFunction=function(e,t,i){var n,r=w.a.RandomRange(0,2*Math.PI);n=this.emitFromSpawnPointOnly?1e-4:1-(n=w.a.RandomRange(0,this.heightRange))*n;var o=this._radius-w.a.RandomRange(0,this._radius*this.radiusRange),s=(o*=n)*Math.sin(r),c=o*Math.cos(r),l=n*this._height;a.e.TransformCoordinatesFromFloatsToRef(s,l,c,e,t)},e.prototype.clone=function(){var t=new e(this._radius,this._angle,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},e.prototype.getClassName=function(){return"ConeParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer},e}(),Hc=function(){function e(e,t,i,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=0),this.radius=e,this.height=t,this.radiusRange=i,this.directionRandomizer=n}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),o=Math.atan2(n.x,n.z);o+=w.a.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,n.y=r,n.x=Math.sin(o),n.z=Math.cos(o),n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=w.a.RandomRange(-this.height/2,this.height/2),r=w.a.RandomRange(0,2*Math.PI),o=w.a.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(o)*this.radius,c=s*Math.cos(r),l=s*Math.sin(r);a.e.TransformCoordinatesFromFloatsToRef(c,n,l,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},e.prototype.getClassName=function(){return"CylinderParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Xc=function(e){function t(t,i,n,r,o){void 0===t&&(t=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=new a.e(0,1,0)),void 0===o&&(o=new a.e(0,1,0));var s=e.call(this,t,i,n)||this;return s.direction1=r,s.direction2=o,s}return h.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return M.a.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},t.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(Hc),Yc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-w.a.RandomRange(0,this.radius*this.radiusRange),r=w.a.RandomRange(0,1),o=w.a.RandomRange(0,2*Math.PI),s=Math.acos(2*r-1),c=n*Math.cos(o)*Math.sin(s),l=n*Math.cos(s),u=n*Math.sin(o)*Math.sin(s);a.e.TransformCoordinatesFromFloatsToRef(c,Math.abs(l),u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},e.prototype.getClassName=function(){return"HemisphericParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),Kc=function(){function e(){this.direction1=new a.e(0,1,0),this.direction2=new a.e(0,1,0)}return e.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},e.prototype.startPositionFunction=function(e,t,i){a.e.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},e.prototype.clone=function(){var t=new e;return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},e.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},e.prototype.getClassName=function(){return"PointParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},e.prototype.parse=function(e){a.e.FromArrayToRef(e.direction1,0,this.direction1),a.e.FromArrayToRef(e.direction2,0,this.direction2)},e}(),Qc=function(){function e(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return e.prototype.startDirectionFunction=function(e,t,i){var n=i.position.subtract(e.getTranslation()).normalize(),r=w.a.RandomRange(0,this.directionRandomizer),o=w.a.RandomRange(0,this.directionRandomizer),s=w.a.RandomRange(0,this.directionRandomizer);n.x+=r,n.y+=o,n.z+=s,n.normalize(),a.e.TransformNormalFromFloatsToRef(n.x,n.y,n.z,e,t)},e.prototype.startPositionFunction=function(e,t,i){var n=this.radius-w.a.RandomRange(0,this.radius*this.radiusRange),r=w.a.RandomRange(0,1),o=w.a.RandomRange(0,2*Math.PI),s=Math.acos(2*r-1),c=n*Math.cos(o)*Math.sin(s),l=n*Math.cos(s),u=n*Math.sin(o)*Math.sin(s);a.e.TransformCoordinatesFromFloatsToRef(c,l,u,e,t)},e.prototype.clone=function(){var t=new e(this.radius,this.directionRandomizer);return M.a.DeepCopy(this,t),t},e.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},e.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},e.prototype.getClassName=function(){return"SphereParticleEmitter"},e.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},e.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},e}(),qc=function(e){function t(t,i,n){void 0===t&&(t=1),void 0===i&&(i=new a.e(0,1,0)),void 0===n&&(n=new a.e(0,1,0));var r=e.call(this,t)||this;return r.direction1=i,r.direction2=n,r}return h.d(t,e),t.prototype.startDirectionFunction=function(e,t,i){var n=w.a.RandomRange(this.direction1.x,this.direction2.x),r=w.a.RandomRange(this.direction1.y,this.direction2.y),o=w.a.RandomRange(this.direction1.z,this.direction2.z);a.e.TransformNormalFromFloatsToRef(n,r,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return M.a.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},t.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},t.prototype.serialize=function(){var t=e.prototype.serialize.call(this);return t.direction1=this.direction1.asArray(),t.direction2=this.direction2.asArray(),t},t.prototype.parse=function(t){e.prototype.parse.call(this,t),this.direction1.copyFrom(t.direction1),this.direction2.copyFrom(t.direction2)},t}(Qc),Zc=function(){function e(t){this.animations=[],this.renderingGroupId=0,this.emitter=null,this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this.noiseStrength=new a.e(10,10,10),this.onAnimationEnd=null,this.blendMode=e.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteRandomStartCell=!1,this.translationPivot=new a.d(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.worldOffset=new a.e(0,0,0),this.gravity=a.e.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new s.b(1,1,1,1),this.color2=new s.b(1,1,1,1),this.colorDead=new s.b(0,0,0,1),this.textureMask=new s.b(1,1,1,1),this._isSubEmitter=!1,this.billboardMode=g.a.PARTICLES_BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new Gi.b,this.id=t,this.name=t}return Object.defineProperty(e.prototype,"noiseTexture",{get:function(){return this._noiseTexture},set:function(e){this._noiseTexture!==e&&(this._noiseTexture=e,this._reset())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAnimationSheetEnabled",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&this._startSizeGradients.length>0||this._emitRateGradients&&this._emitRateGradients.length>0||this._lifeTimeGradients&&this._lifeTimeGradients.length>0},e.prototype.getDragGradients=function(){return this._dragGradients},e.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},e.prototype.getColorGradients=function(){return this._colorGradients},e.prototype.getSizeGradients=function(){return this._sizeGradients},e.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},e.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},e.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},e.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},e.prototype.getVelocityGradients=function(){return this._velocityGradients},e.prototype.getStartSizeGradients=function(){return this._startSizeGradients},e.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(e.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:a.e.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:a.e.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:a.e.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration=e||this._scene.imageProcessingConfiguration)},e.prototype._reset=function(){},e.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var n=0,r=0,o=t;r=r.gradient&&e<=o.gradient)return void i(r,o,(e-r.gradient)/(o.gradient-r.gradient))}var a=t.length-1;i(t[a],t[a],1)},e}(),il=function(){function e(t){this.particleSystem=t,this.position=a.e.Zero(),this.direction=a.e.Zero(),this.color=new s.b(0,0,0,0),this.colorStep=new s.b(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new a.d(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new s.b(0,0,0,0),this._currentColor2=new s.b(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=e._Count++,this.particleSystem.isAnimationSheetEnabled&&this.updateCellInfoFromSystem()}return e.prototype.updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},e.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i=this._initialEndSpriteCellID-this._initialStartSpriteCellID,n=w.a.Clamp(e*t%this.lifeTime/this.lifeTime);this.cellIndex=this._initialStartSpriteCellID+n*i|0},e.prototype._inheritParticleInfoToSubEmitter=function(e){if(e.particleSystem.emitter.position){var t=e.particleSystem.emitter;t.position.copyFrom(this.position),e.inheritDirection&&(t.position.subtractToRef(this.direction,a.c.Vector3[0]),t.lookAt(a.c.Vector3[0],0,Math.PI/2))}else{e.particleSystem.emitter.copyFrom(this.position)}this.direction.scaleToRef(e.inheritedVelocityAmount/2,a.c.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(a.c.Vector3[0])},e.prototype._inheritParticleInfoToSubEmitters=function(){var e=this;this._attachedSubEmitters&&this._attachedSubEmitters.length>0&&this._attachedSubEmitters.forEach(function(t){e._inheritParticleInfoToSubEmitter(t)})},e.prototype._reset=function(){this.age=0,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0},e.prototype.copyTo=function(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID),this.particleSystem.useRampGradients&&e.remapData.copyFrom(this.remapData),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},e._Count=0,e}();!function(e){e[e.ATTACHED=0]="ATTACHED",e[e.END=1]="END"}(Gc||(Gc={}));var nl=function(){function e(e){this.particleSystem=e,this.type=Gc.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(e.emitter=new Ye.a("SubemitterSystemEmitter",e.getScene())),e.onDisposeObservable.add(function(){e.emitter&&e.emitter.dispose&&e.emitter.dispose()})}return e.prototype.clone=function(){var t=this.particleSystem.emitter;t?t instanceof a.e?t=t.clone():t instanceof Ye.a&&((t=new Se.a("",t.getScene())).isVisible=!1):t=new a.e;var i=new e(this.particleSystem.clone("",t));return i.particleSystem.name+="Clone",i.type=this.type,i.inheritDirection=this.inheritDirection,i.inheritedVelocityAmount=this.inheritedVelocityAmount,i.particleSystem._disposeEmitterOnDispose=!0,i.particleSystem.disposeOnStop=!0,i},e.prototype.serialize=function(){var e={};return e.type=this.type,e.inheritDirection=this.inheritDirection,e.inheritedVelocityAmount=this.inheritedVelocityAmount,e.particleSystem=this.particleSystem.serialize(),e},e._ParseParticleSystem=function(e,t,i){throw De.a.WarnImport("ParseParticle")},e.Parse=function(t,i,n){var r=t.particleSystem,o=new e(e._ParseParticleSystem(r,i,n));return o.type=t.type,o.inheritDirection=t.inheritDirection,o.inheritedVelocityAmount=t.inheritedVelocityAmount,o.particleSystem._isSubEmitter=!0,o},e.prototype.dispose=function(){this.particleSystem.dispose()},e}(),rl="\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include\n#include\n#include\n#include\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\n\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n}";ni.a.ShadersStore.particlesPixelShader=rl;var ol="\nattribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET\nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD\nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction;\n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET\nuniform vec3 particlesInfos;\n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include\n#ifdef BILLBOARD\nuniform vec3 eyePosition;\n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#endif\nvoid main(void) {\nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD\n\nvec3 rotatedCorner;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition;\nvec3 worldPos=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz;\n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;\n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\n\ngl_Position=projection*vec4(viewPos,1.0);\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(worldPos,1.0);\n#endif\nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset*particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*vec4(viewPos,1.0);\n#endif\n#include\n}";ni.a.ShadersStore.particlesVertexShader=ol;var al=function(e){function t(t,i,n,r,c,l){void 0===r&&(r=null),void 0===c&&(c=!1),void 0===l&&(l=.01);var u=e.call(this,t)||this;return u._inheritedVelocityOffset=new a.e,u.onDisposeObservable=new o.c,u._particles=new Array,u._stockParticles=new Array,u._newPartsExcess=0,u._vertexBuffers={},u._scaledColorStep=new s.b(0,0,0,0),u._colorDiff=new s.b(0,0,0,0),u._scaledDirection=a.e.Zero(),u._scaledGravity=a.e.Zero(),u._currentRenderId=-1,u._useInstancing=!1,u._started=!1,u._stopped=!1,u._actualFrame=0,u._currentEmitRate1=0,u._currentEmitRate2=0,u._currentStartSize1=0,u._currentStartSize2=0,u._rawTextureWidth=256,u._useRampGradients=!1,u._disposeEmitterOnDispose=!1,u.recycleParticle=function(e){var t=u._particles.pop();t!==e&&t.copyTo(e),u._stockParticles.push(t)},u._createParticle=function(){var e;if(0!==u._stockParticles.length?(e=u._stockParticles.pop())._reset():e=new il(u),u._subEmitters&&u._subEmitters.length>0){var t=u._subEmitters[Math.floor(Math.random()*u._subEmitters.length)];e._attachedSubEmitters=[],t.forEach(function(t){if(t.type===Gc.ATTACHED){var i=t.clone();e._attachedSubEmitters.push(i),i.particleSystem.start()}})}return e},u._emitFromParticle=function(e){if(u._subEmitters&&0!==u._subEmitters.length){var t=Math.floor(Math.random()*u._subEmitters.length);u._subEmitters[t].forEach(function(t){if(t.type===Gc.END){var i=t.clone();e._inheritParticleInfoToSubEmitter(i),i.particleSystem._rootParticleSystem=u,u.activeSubSystems.push(i.particleSystem),i.particleSystem.start()}})}},u._capacity=i,u._epsilon=l,u._isAnimationSheetEnabled=c,u._scene=n||C.a.LastCreatedScene,u._attachImageProcessingConfiguration(null),u._customEffect=r,u._scene.particleSystems.push(u),u._useInstancing=u._scene.getEngine().getCaps().instancedArrays,u._createIndexBuffer(),u._createVertexBuffers(),u.particleEmitterType=new jc,u.updateFunction=function(e){var t=null,i=null;u.noiseTexture&&(t=u.noiseTexture.getSize(),i=u.noiseTexture.getContent());for(var n,r=function(){n=e[o];var r=u._scaledUpdateSpeed,c=n.age;if(n.age+=r,n.age>n.lifeTime){var l=n.age-c;r=(n.lifeTime-c)*r/l,n.age=n.lifeTime}var h=n.age/n.lifeTime;u._colorGradients&&u._colorGradients.length>0?tl.GetCurrentGradient(h,u._colorGradients,function(e,t,i){e!==n._currentColorGradient&&(n._currentColor1.copyFrom(n._currentColor2),t.getColorToRef(n._currentColor2),n._currentColorGradient=e),s.b.LerpToRef(n._currentColor1,n._currentColor2,i,n.color)}):(n.colorStep.scaleToRef(r,u._scaledColorStep),n.color.addInPlace(u._scaledColorStep),n.color.a<0&&(n.color.a=0)),u._angularSpeedGradients&&u._angularSpeedGradients.length>0&&tl.GetCurrentGradient(h,u._angularSpeedGradients,function(e,t,i){e!==n._currentAngularSpeedGradient&&(n._currentAngularSpeed1=n._currentAngularSpeed2,n._currentAngularSpeed2=t.getFactor(),n._currentAngularSpeedGradient=e),n.angularSpeed=w.a.Lerp(n._currentAngularSpeed1,n._currentAngularSpeed2,i)}),n.angle+=n.angularSpeed*r;var d=r;if(u._velocityGradients&&u._velocityGradients.length>0&&tl.GetCurrentGradient(h,u._velocityGradients,function(e,t,i){e!==n._currentVelocityGradient&&(n._currentVelocity1=n._currentVelocity2,n._currentVelocity2=t.getFactor(),n._currentVelocityGradient=e),d*=w.a.Lerp(n._currentVelocity1,n._currentVelocity2,i)}),n.direction.scaleToRef(d,u._scaledDirection),u._limitVelocityGradients&&u._limitVelocityGradients.length>0&&tl.GetCurrentGradient(h,u._limitVelocityGradients,function(e,t,i){e!==n._currentLimitVelocityGradient&&(n._currentLimitVelocity1=n._currentLimitVelocity2,n._currentLimitVelocity2=t.getFactor(),n._currentLimitVelocityGradient=e);var r=w.a.Lerp(n._currentLimitVelocity1,n._currentLimitVelocity2,i);n.direction.length()>r&&n.direction.scaleInPlace(u.limitVelocityDamping)}),u._dragGradients&&u._dragGradients.length>0&&tl.GetCurrentGradient(h,u._dragGradients,function(e,t,i){e!==n._currentDragGradient&&(n._currentDrag1=n._currentDrag2,n._currentDrag2=t.getFactor(),n._currentDragGradient=e);var r=w.a.Lerp(n._currentDrag1,n._currentDrag2,i);u._scaledDirection.scaleInPlace(1-r)}),n.position.addInPlace(u._scaledDirection),i&&t&&n._randomNoiseCoordinates1){var f=u._fetchR(n._randomNoiseCoordinates1.x,n._randomNoiseCoordinates1.y,t.width,t.height,i),p=u._fetchR(n._randomNoiseCoordinates1.z,n._randomNoiseCoordinates2.x,t.width,t.height,i),_=u._fetchR(n._randomNoiseCoordinates2.y,n._randomNoiseCoordinates2.z,t.width,t.height,i),m=a.c.Vector3[0],g=a.c.Vector3[1];m.copyFromFloats((2*f-1)*u.noiseStrength.x,(2*p-1)*u.noiseStrength.y,(2*_-1)*u.noiseStrength.z),m.scaleToRef(r,g),n.direction.addInPlace(g)}if(u.gravity.scaleToRef(r,u._scaledGravity),n.direction.addInPlace(u._scaledGravity),u._sizeGradients&&u._sizeGradients.length>0&&tl.GetCurrentGradient(h,u._sizeGradients,function(e,t,i){e!==n._currentSizeGradient&&(n._currentSize1=n._currentSize2,n._currentSize2=t.getFactor(),n._currentSizeGradient=e),n.size=w.a.Lerp(n._currentSize1,n._currentSize2,i)}),u._useRampGradients&&(u._colorRemapGradients&&u._colorRemapGradients.length>0&&tl.GetCurrentGradient(h,u._colorRemapGradients,function(e,t,i){var r=w.a.Lerp(e.factor1,t.factor1,i),o=w.a.Lerp(e.factor2,t.factor2,i);n.remapData.x=r,n.remapData.y=o-r}),u._alphaRemapGradients&&u._alphaRemapGradients.length>0&&tl.GetCurrentGradient(h,u._alphaRemapGradients,function(e,t,i){var r=w.a.Lerp(e.factor1,t.factor1,i),o=w.a.Lerp(e.factor2,t.factor2,i);n.remapData.z=r,n.remapData.w=o-r})),u._isAnimationSheetEnabled&&n.updateCellIndex(),n._inheritParticleInfoToSubEmitters(),n.age>=n.lifeTime)return u._emitFromParticle(n),n._attachedSubEmitters&&(n._attachedSubEmitters.forEach(function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()}),n._attachedSubEmitters=null),u.recycleParticle(n),o--,"continue"},o=0;ot.gradient?1:0})},t.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,n=0,r=e;nt.gradient?1:0}),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture(),this},t.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&this._rampGradients.length>0&&this._createRampGradientTexture(),this},t.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new Jc;return n.gradient=e,n.color1=t,n.color2=i,this._colorGradients.push(n),this._colorGradients.sort(function(e,t){return e.gradientt.gradient?1:0}),this},t.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,n=this._colorGradients;i0&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),this._emitRateGradients.length>1&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(this._startSizeGradients.length>0&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),this._startSizeGradients.length>1&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){this.emitter instanceof Ye.a&&this.emitter.computeWorldMatrix(!0);var i=this.noiseTexture;if(i&&i.onGeneratedObservable)i.onGeneratedObservable.addOnce(function(){setTimeout(function(){for(var e=0;e0&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},t.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped=!0,e&&this._stopSubEmitters()},t.prototype.reset=function(){this._stockParticles=[],this._particles=[]},t.prototype._appendParticleVertex=function(e,i,n,r){var o=e*this._vertexBufferSize;this._vertexData[o++]=i.position.x+this.worldOffset.x,this._vertexData[o++]=i.position.y+this.worldOffset.y,this._vertexData[o++]=i.position.z+this.worldOffset.z,this._vertexData[o++]=i.color.r,this._vertexData[o++]=i.color.g,this._vertexData[o++]=i.color.b,this._vertexData[o++]=i.color.a,this._vertexData[o++]=i.angle,this._vertexData[o++]=i.scale.x*i.size,this._vertexData[o++]=i.scale.y*i.size,this._isAnimationSheetEnabled&&(this._vertexData[o++]=i.cellIndex),this._isBillboardBased?this.billboardMode===t.BILLBOARDMODE_STRETCHED&&(this._vertexData[o++]=i.direction.x,this._vertexData[o++]=i.direction.y,this._vertexData[o++]=i.direction.z):i._initialDirection?(this._vertexData[o++]=i._initialDirection.x,this._vertexData[o++]=i._initialDirection.y,this._vertexData[o++]=i._initialDirection.z):(this._vertexData[o++]=i.direction.x,this._vertexData[o++]=i.direction.y,this._vertexData[o++]=i.direction.z),this._useRampGradients&&(this._vertexData[o++]=i.remapData.x,this._vertexData[o++]=i.remapData.y,this._vertexData[o++]=i.remapData.z,this._vertexData[o++]=i.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon)),this._vertexData[o++]=n,this._vertexData[o++]=r)},t.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach(function(e){e.stop(!0)}),this.activeSubSystems=new Array)},t.prototype._removeFromRoot=function(){if(this._rootParticleSystem){var e=this._rootParticleSystem.activeSubSystems.indexOf(this);-1!==e&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null}},t.prototype._update=function(e){var t,i=this;if(this._alive=this._particles.length>0,this.emitter.position){var n=this.emitter;this._emitterWorldMatrix=n.getWorldMatrix()}else{var r=this.emitter;this._emitterWorldMatrix=a.a.Translation(r.x,r.y,r.z)}this.updateFunction(this._particles);for(var o,c=function(){if(l._particles.length===l._capacity)return"break";t=l._createParticle(),l._particles.push(t);var e=w.a.RandomRange(l.minEmitPower,l.maxEmitPower);if(l.startPositionFunction?l.startPositionFunction(l._emitterWorldMatrix,t.position,t):l.particleEmitterType.startPositionFunction(l._emitterWorldMatrix,t.position,t),l.startDirectionFunction?l.startDirectionFunction(l._emitterWorldMatrix,t.direction,t):l.particleEmitterType.startDirectionFunction(l._emitterWorldMatrix,t.direction,t),0===e?t._initialDirection?t._initialDirection.copyFrom(t.direction):t._initialDirection=t.direction.clone():t._initialDirection=null,t.direction.scaleInPlace(e),l.targetStopDuration&&l._lifeTimeGradients&&l._lifeTimeGradients.length>0){var n=w.a.Clamp(l._actualFrame/l.targetStopDuration);tl.GetCurrentGradient(n,l._lifeTimeGradients,function(e,i){var r=e,o=i,a=r.getFactor(),s=o.getFactor(),c=(n-r.gradient)/(o.gradient-r.gradient);t.lifeTime=w.a.Lerp(a,s,c)})}else t.lifeTime=w.a.RandomRange(l.minLifeTime,l.maxLifeTime);if(l._sizeGradients&&0!==l._sizeGradients.length?(t._currentSizeGradient=l._sizeGradients[0],t._currentSize1=t._currentSizeGradient.getFactor(),t.size=t._currentSize1,l._sizeGradients.length>1?t._currentSize2=l._sizeGradients[1].getFactor():t._currentSize2=t._currentSize1):t.size=w.a.RandomRange(l.minSize,l.maxSize),t.scale.copyFromFloats(w.a.RandomRange(l.minScaleX,l.maxScaleX),w.a.RandomRange(l.minScaleY,l.maxScaleY)),l._startSizeGradients&&l._startSizeGradients[0]&&l.targetStopDuration){var r=l._actualFrame/l.targetStopDuration;tl.GetCurrentGradient(r,l._startSizeGradients,function(e,n,r){e!==i._currentStartSizeGradient&&(i._currentStartSize1=i._currentStartSize2,i._currentStartSize2=n.getFactor(),i._currentStartSizeGradient=e);var o=w.a.Lerp(i._currentStartSize1,i._currentStartSize2,r);t.scale.scaleInPlace(o)})}l._angularSpeedGradients&&0!==l._angularSpeedGradients.length?(t._currentAngularSpeedGradient=l._angularSpeedGradients[0],t.angularSpeed=t._currentAngularSpeedGradient.getFactor(),t._currentAngularSpeed1=t.angularSpeed,l._angularSpeedGradients.length>1?t._currentAngularSpeed2=l._angularSpeedGradients[1].getFactor():t._currentAngularSpeed2=t._currentAngularSpeed1):t.angularSpeed=w.a.RandomRange(l.minAngularSpeed,l.maxAngularSpeed),t.angle=w.a.RandomRange(l.minInitialRotation,l.maxInitialRotation),l._velocityGradients&&l._velocityGradients.length>0&&(t._currentVelocityGradient=l._velocityGradients[0],t._currentVelocity1=t._currentVelocityGradient.getFactor(),l._velocityGradients.length>1?t._currentVelocity2=l._velocityGradients[1].getFactor():t._currentVelocity2=t._currentVelocity1),l._limitVelocityGradients&&l._limitVelocityGradients.length>0&&(t._currentLimitVelocityGradient=l._limitVelocityGradients[0],t._currentLimitVelocity1=t._currentLimitVelocityGradient.getFactor(),l._limitVelocityGradients.length>1?t._currentLimitVelocity2=l._limitVelocityGradients[1].getFactor():t._currentLimitVelocity2=t._currentLimitVelocity1),l._dragGradients&&l._dragGradients.length>0&&(t._currentDragGradient=l._dragGradients[0],t._currentDrag1=t._currentDragGradient.getFactor(),l._dragGradients.length>1?t._currentDrag2=l._dragGradients[1].getFactor():t._currentDrag2=t._currentDrag1),l._colorGradients&&0!==l._colorGradients.length?(t._currentColorGradient=l._colorGradients[0],t._currentColorGradient.getColorToRef(t.color),t._currentColor1.copyFrom(t.color),l._colorGradients.length>1?l._colorGradients[1].getColorToRef(t._currentColor2):t._currentColor2.copyFrom(t.color)):(o=w.a.RandomRange(0,1),s.b.LerpToRef(l.color1,l.color2,o,t.color),l.colorDead.subtractToRef(t.color,l._colorDiff),l._colorDiff.scaleToRef(1/t.lifeTime,t.colorStep)),l._isAnimationSheetEnabled&&(t._initialStartSpriteCellID=l.startSpriteCellID,t._initialEndSpriteCellID=l.endSpriteCellID),t.direction.addInPlace(l._inheritedVelocityOffset),l._useRampGradients&&(t.remapData=new a.f(0,1,0,1)),l.noiseTexture&&(t._randomNoiseCoordinates1?(t._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(t._randomNoiseCoordinates1=new a.e(Math.random(),Math.random(),Math.random()),t._randomNoiseCoordinates2=new a.e(Math.random(),Math.random(),Math.random()))),t._inheritParticleInfoToSubEmitters()},l=this,u=0;u-1)i=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{var n=this.emitRate;if(this._emitRateGradients&&this._emitRateGradients.length>0&&this.targetStopDuration){var r=this._actualFrame/this.targetStopDuration;tl.GetCurrentGradient(r,this._emitRateGradients,function(e,i,r){e!==t._currentEmitRateGradient&&(t._currentEmitRate1=t._currentEmitRate2,t._currentEmitRate2=i.getFactor(),t._currentEmitRateGradient=e),n=w.a.Lerp(t._currentEmitRate1,t._currentEmitRate2,r)})}i=n*this._scaledUpdateSpeed>>0,this._newPartsExcess+=n*this._scaledUpdateSpeed-i}if(this._newPartsExcess>1&&(i+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?i=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(i),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene._toBeDisposed.push(this))),!e){for(var o=0,a=0;a-1&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.reset()},t.prototype.clone=function(e,i){var n=null,r=null;if(null!=this.customShader){var o=(r=this.customShader).shaderOptions.defines.length>0?r.shaderOptions.defines.join("\n"):"";n=this._scene.getEngine().createEffectForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,o)}else this._customEffect&&(n=this._customEffect);var a=new t(e,this._capacity,this._scene,n);return a.customShader=r,M.a.DeepCopy(this,a,["particles","customShader","noiseTexture","particleTexture","onDisposeObservable"]),void 0===i&&(i=this.emitter),a.noiseTexture=this.noiseTexture,a.emitter=i,this.particleTexture&&(a.particleTexture=new $e.a(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach(function(e){a.addColorGradient(e.gradient,e.color1,e.color2)}),this._dragGradients&&this._dragGradients.forEach(function(e){a.addDragGradient(e.gradient,e.factor1,e.factor2)}),this._angularSpeedGradients&&this._angularSpeedGradients.forEach(function(e){a.addAngularSpeedGradient(e.gradient,e.factor1,e.factor2)}),this._emitRateGradients&&this._emitRateGradients.forEach(function(e){a.addEmitRateGradient(e.gradient,e.factor1,e.factor2)}),this._lifeTimeGradients&&this._lifeTimeGradients.forEach(function(e){a.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)}),this._limitVelocityGradients&&this._limitVelocityGradients.forEach(function(e){a.addLimitVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._sizeGradients&&this._sizeGradients.forEach(function(e){a.addSizeGradient(e.gradient,e.factor1,e.factor2)}),this._startSizeGradients&&this._startSizeGradients.forEach(function(e){a.addStartSizeGradient(e.gradient,e.factor1,e.factor2)}),this._velocityGradients&&this._velocityGradients.forEach(function(e){a.addVelocityGradient(e.gradient,e.factor1,e.factor2)}),this._rampGradients&&this._rampGradients.forEach(function(e){a.addRampGradient(e.gradient,e.color)}),this._colorRemapGradients&&this._colorRemapGradients.forEach(function(e){a.addColorRemapGradient(e.gradient,e.factor1,e.factor2)}),this._alphaRemapGradients&&this._alphaRemapGradients.forEach(function(e){a.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)}),this.preventAutoStart||a.start(),a},t.prototype.serialize=function(){var e={};if(t._Serialize(e,this),e.textureMask=this.textureMask.asArray(),e.customShader=this.customShader,e.preventAutoStart=this.preventAutoStart,this.subEmitters){e.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var i=0,n=this._subEmitters;i0?c.shaderOptions.defines.join("\n"):"";a=i.getEngine().createEffectForParticles(c.shaderPath.fragmentElement,c.shaderOptions.uniforms,c.shaderOptions.samplers,l)}var u=new t(o,e.capacity,i,a,e.isAnimationSheetEnabled);if(u.customShader=c,e.id&&(u.id=e.id),e.subEmitters){u.subEmitters=[];for(var h=0,d=e.subEmitters;h1},enumerable:!0,configurable:!0}),t.prototype.getCapacity=function(){return this._capacity},Object.defineProperty(t.prototype,"activeParticleCount",{get:function(){return this._activeCount},set:function(e){this._activeCount=Math.min(e,this._capacity)},enumerable:!0,configurable:!0}),t.prototype.isReady=function(){return this._updateEffect?!!(this.emitter&&this._updateEffect.isReady()&&this._imageProcessingConfiguration.isReady()&&this._renderEffect.isReady()&&this.particleTexture&&this.particleTexture.isReady()):(this._recreateUpdateEffect(),this._recreateRenderEffect(),!1)},t.prototype.isStarted=function(){return this._started},t.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";e?setTimeout(function(){t.start(0)},e):(this._started=!0,this._stopped=!1,this._preWarmDone=!1,this.beginAnimationOnStart&&this.animations&&this.animations.length>0&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},t.prototype.stop=function(){this._stopped=!0},t.prototype.reset=function(){this._releaseBuffers(),this._releaseVAOs(),this._currentActiveCount=0,this._targetIndex=0},t.prototype.getClassName=function(){return"GPUParticleSystem"},t.prototype._removeGradientAndTexture=function(t,i,n){return e.prototype._removeGradientAndTexture.call(this,t,i,n),this._releaseBuffers(),this},t.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var n=new Jc;return n.gradient=e,n.color1=t,this._colorGradients.push(n),this._colorGradients.sort(function(e,t){return e.gradientt.gradient?1:0}),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},t.prototype._addFactorGradient=function(e,t,i){var n=new el;n.gradient=t,n.factor1=i,e.push(n),e.sort(function(e,t){return e.gradientt.gradient?1:0}),this._releaseBuffers()},t.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},t.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},t.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},t.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},t.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._releaseBuffers(),this},t.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},t.prototype.addEmitRateGradient=function(e,t,i){return this},t.prototype.removeEmitRateGradient=function(e){return this},t.prototype.addStartSizeGradient=function(e,t,i){return this},t.prototype.removeStartSizeGradient=function(e){return this},t.prototype.addColorRemapGradient=function(e,t,i){return this},t.prototype.removeColorRemapGradient=function(){return this},t.prototype.addAlphaRemapGradient=function(e,t,i){return this},t.prototype.removeAlphaRemapGradient=function(){return this},t.prototype.addRampGradient=function(e,t){return this},t.prototype.removeRampGradient=function(){return this},t.prototype.getRampGradients=function(){return null},Object.defineProperty(t.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!0,configurable:!0}),t.prototype.addLifeTimeGradient=function(e,t,i){return this},t.prototype.removeLifeTimeGradient=function(e){return this},t.prototype._reset=function(){this._releaseBuffers()},t.prototype._createUpdateVAO=function(e){var t={};t.position=e.createVertexBuffer("position",0,3),t.age=e.createVertexBuffer("age",3,1),t.life=e.createVertexBuffer("life",4,1),t.seed=e.createVertexBuffer("seed",5,4),t.size=e.createVertexBuffer("size",9,3);var i=12;this._colorGradientsTexture||(t.color=e.createVertexBuffer("color",i,4),i+=4),t.direction=e.createVertexBuffer("direction",i,3),i+=3,this._isBillboardBased||(t.initialDirection=e.createVertexBuffer("initialDirection",i,3),i+=3),this._angularSpeedGradientsTexture?(t.angle=e.createVertexBuffer("angle",i,1),i+=1):(t.angle=e.createVertexBuffer("angle",i,2),i+=2),this._isAnimationSheetEnabled&&(t.cellIndex=e.createVertexBuffer("cellIndex",i,1),i+=1,this.spriteRandomStartCell&&(t.cellStartOffset=e.createVertexBuffer("cellStartOffset",i,1),i+=1)),this.noiseTexture&&(t.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",i,3),i+=3,t.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",i,3),i+=3);var n=this._engine.recordVertexArrayObject(t,null,this._updateEffect);return this._engine.bindArrayBuffer(null),n},t.prototype._createRenderVAO=function(e,t){var i={};i.position=e.createVertexBuffer("position",0,3,this._attributesStrideSize,!0),i.age=e.createVertexBuffer("age",3,1,this._attributesStrideSize,!0),i.life=e.createVertexBuffer("life",4,1,this._attributesStrideSize,!0),i.size=e.createVertexBuffer("size",9,3,this._attributesStrideSize,!0);var n=12;this._colorGradientsTexture||(i.color=e.createVertexBuffer("color",n,4,this._attributesStrideSize,!0),n+=4),this.billboardMode===al.BILLBOARDMODE_STRETCHED&&(i.direction=e.createVertexBuffer("direction",n,3,this._attributesStrideSize,!0)),n+=3,this._isBillboardBased||(i.initialDirection=e.createVertexBuffer("initialDirection",n,3,this._attributesStrideSize,!0),n+=3),i.angle=e.createVertexBuffer("angle",n,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?n++:n+=2,this._isAnimationSheetEnabled&&(i.cellIndex=e.createVertexBuffer("cellIndex",n,1,this._attributesStrideSize,!0),n+=1,this.spriteRandomStartCell&&(i.cellStartOffset=e.createVertexBuffer("cellStartOffset",n,1,this._attributesStrideSize,!0),n+=1)),this.noiseTexture&&(i.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",n,3,this._attributesStrideSize,!0),n+=3,i.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",n,3,this._attributesStrideSize,!0),n+=3),i.offset=t.createVertexBuffer("offset",0,2),i.uv=t.createVertexBuffer("uv",2,2);var r=this._engine.recordVertexArrayObject(i,null,this._renderEffect);return this._engine.bindArrayBuffer(null),r},t.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._scene.getEngine(),i=new Array;this._attributesStrideSize=21,this._targetIndex=0,this.isBillboardBased||(this._attributesStrideSize+=3),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6);for(var n=0;n=this.targetStopDuration&&this.stop()},t.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var n=new Float32Array(this._rawTextureWidth),r=0;r1){var i=0|this._accumulatedCount;this._accumulatedCount-=i,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+i)}if(!this._currentActiveCount)return 0;var n;if(this._engine.enableEffect(this._updateEffect),this._engine.setState(!1),this._updateEffect.setFloat("currentCount",this._currentActiveCount),this._updateEffect.setFloat("timeDelta",this._timeDelta),this._updateEffect.setFloat("stopFactor",this._stopped?0:1),this._updateEffect.setTexture("randomSampler",this._randomTexture),this._updateEffect.setTexture("randomSampler2",this._randomTexture2),this._updateEffect.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateEffect.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateEffect.setDirectColor4("color1",this.color1),this._updateEffect.setDirectColor4("color2",this.color2)),this._updateEffect.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateEffect.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateEffect.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateEffect.setVector3("gravity",this.gravity),this._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._sizeGradientsTexture),this._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._angularSpeedGradientsTexture),this._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._velocityGradientsTexture),this._limitVelocityGradientsTexture&&(this._updateEffect.setTexture("limitVelocityGradientSampler",this._limitVelocityGradientsTexture),this._updateEffect.setFloat("limitVelocityDamping",this.limitVelocityDamping)),this._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._dragGradientsTexture),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateEffect),this._isAnimationSheetEnabled&&this._updateEffect.setFloat3("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed),this.noiseTexture&&(this._updateEffect.setTexture("noiseSampler",this.noiseTexture),this._updateEffect.setVector3("noiseStrength",this.noiseStrength)),this.emitter.position){n=this.emitter.getWorldMatrix()}else{var r=this.emitter;n=a.a.Translation(r.x,r.y,r.z)}if(this._updateEffect.setMatrix("emitterWM",n),this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex],null),this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer()),this._engine.setRasterizerState(!1),this._engine.beginTransformFeedback(!0),this._engine.drawArraysType(No.a.PointListDrawMode,0,this._currentActiveCount),this._engine.endTransformFeedback(),this._engine.setRasterizerState(!0),this._engine.bindTransformFeedbackBuffer(null),!e){this._engine.enableEffect(this._renderEffect);var o=this._scene.getViewMatrix();if(this._renderEffect.setMatrix("view",o),this._renderEffect.setMatrix("projection",this._scene.getProjectionMatrix()),this._renderEffect.setTexture("textureSampler",this.particleTexture),this._renderEffect.setVector2("translationPivot",this.translationPivot),this._renderEffect.setVector3("worldOffset",this.worldOffset),this._colorGradientsTexture?this._renderEffect.setTexture("colorGradientSampler",this._colorGradientsTexture):this._renderEffect.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture){var s=this.particleTexture.getBaseSize();this._renderEffect.setFloat3("sheetInfos",this.spriteCellWidth/s.width,this.spriteCellHeight/s.height,s.width/this.spriteCellWidth)}if(this._isBillboardBased){var c=this._scene.activeCamera;this._renderEffect.setVector3("eyePosition",c.globalPosition)}if(this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4){var l=o.clone();l.invert(),this._renderEffect.setMatrix("invView",l),Mr.a.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case al.BLENDMODE_ADD:this._engine.setAlphaMode(g.a.ALPHA_ADD);break;case al.BLENDMODE_ONEONE:this._engine.setAlphaMode(g.a.ALPHA_ONEONE);break;case al.BLENDMODE_STANDARD:this._engine.setAlphaMode(g.a.ALPHA_COMBINE);break;case al.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(g.a.ALPHA_MULTIPLY)}this.forceDepthWrite&&this._engine.setDepthWrite(!0),this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex],null),this._engine.drawArraysType(No.a.TriangleFanDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(g.a.ALPHA_DISABLE)}this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var u=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=u,this._currentActiveCount},t.prototype.rebuild=function(){this._initialize(!0)},t.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null)},t.prototype._releaseVAOs=function(){if(this._updateVAO){for(var e=0;e-1&&this._scene.particleSystems.splice(t,1),this._releaseBuffers(),this._releaseVAOs(),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},t.prototype.clone=function(e,i){var n=new t(e,{capacity:this._capacity,randomTextureSize:this._randomTextureSize},this._scene);return M.a.DeepCopy(this,n,["particles","customShader","noiseTexture","particleTexture","onDisposeObservable"]),void 0===i&&(i=this.emitter),n.emitter=i,this.particleTexture&&(n.particleTexture=new $e.a(this.particleTexture.url,this._scene)),n.noiseTexture=this.noiseTexture,n.emitter=i,this.particleTexture&&(n.particleTexture=new $e.a(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach(function(e){n.addColorGradient(e.gradient,e.color1,e.color2)}),this._dragGradients&&this._dragGradients.forEach(function(e){n.addDragGradient(e.gradient,e.factor1)}),this._angularSpeedGradients&&this._angularSpeedGradients.forEach(function(e){n.addAngularSpeedGradient(e.gradient,e.factor1)}),this._emitRateGradients&&this._emitRateGradients.forEach(function(e){n.addEmitRateGradient(e.gradient,e.factor1,e.factor2)}),this._lifeTimeGradients&&this._lifeTimeGradients.forEach(function(e){n.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)}),this._limitVelocityGradients&&this._limitVelocityGradients.forEach(function(e){n.addLimitVelocityGradient(e.gradient,e.factor1)}),this._sizeGradients&&this._sizeGradients.forEach(function(e){n.addSizeGradient(e.gradient,e.factor1)}),this._startSizeGradients&&this._startSizeGradients.forEach(function(e){n.addStartSizeGradient(e.gradient,e.factor1,e.factor2)}),this._velocityGradients&&this._velocityGradients.forEach(function(e){n.addVelocityGradient(e.gradient,e.factor1)}),this._rampGradients&&this._rampGradients.forEach(function(e){n.addRampGradient(e.gradient,e.color)}),this._colorRemapGradients&&this._colorRemapGradients.forEach(function(e){n.addColorRemapGradient(e.gradient,e.factor1,e.factor2)}),this._alphaRemapGradients&&this._alphaRemapGradients.forEach(function(e){n.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)}),n},t.prototype.serialize=function(){var e={};return al._Serialize(e,this),e.activeParticleCount=this.activeParticleCount,e},t.Parse=function(e,i,n,r){void 0===r&&(r=!1);var o=new t(e.name,{capacity:e.capacity,randomTextureSize:e.randomTextureSize},i);return e.activeParticleCount&&(o.activeParticleCount=e.activeParticleCount),al._Parse(e,o,i,n),e.preventAutoStart&&(o.preventAutoStart=e.preventAutoStart),r||o.preventAutoStart||o.start(),o},t}(Zc),fl=function(){function e(){this.systems=new Array}return Object.defineProperty(e.prototype,"emitterNode",{get:function(){return this._emitterNode},enumerable:!0,configurable:!0}),e.prototype.setEmitterAsSphere=function(e,t,i){this._emitterNode&&this._emitterNode.dispose(),this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};var n=tr.a.CreateSphere("emitterSphere",{diameter:e.diameter,segments:e.segments},i);n.renderingGroupId=t;var r=new zi.a("emitterSphereMaterial",i);r.emissiveColor=e.color,n.material=r;for(var o=0,a=this.systems;o0&&t.set(this._uvs32,Yi.b.UVKind),this._colors32.length>0&&t.set(this._colors32,Yi.b.ColorKind);var i=new Se.a(this.name,this._scene);return t.applyToMesh(i,this._updatable),this.mesh=i,this.mesh.isPickable=this._pickable,this._depthSort||(this._indices=null),this._positions=null,this._normals=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0),i},e.prototype.digest=function(e,t){var i=t&&t.facetNb||1,n=t&&t.number||0,r=t&&t.delta||0,o=e.getVerticesData(Yi.b.PositionKind),s=e.getIndices(),c=e.getVerticesData(Yi.b.UVKind),l=e.getVerticesData(Yi.b.ColorKind),u=e.getVerticesData(Yi.b.NormalKind),h=0,d=s.length/3;n?(n=n>d?d:n,i=Math.round(d/n),r=0):i=i>d?d:i;for(var f=[],p=[],_=[],m=[],g=a.e.Zero(),v=i;hd-(i=v+Math.floor((1+r)*Math.random()))&&(i=d-h),f.length=0,p.length=0,_.length=0,m.length=0;for(var y=0,b=3*h;b<3*(h+i);b++){p.push(y);var T=s[b];f.push(o[3*T],o[3*T+1],o[3*T+2]),c&&_.push(c[2*T],c[2*T+1]),l&&m.push(l[4*T],l[4*T+1],l[4*T+2],l[4*T+3]),y++}var E,A,P=this.nbParticles,S=this._posToShape(f),R=this._uvsToShapeUV(_);for(E=0;E65535&&(this._needs32Bits=!0)}if(this._pickable){var C=n.length/3;for(_=0;_=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0!=e||t!=this.nbParticles-1)){var O=this.mesh._boundingInfo;O&&(v.copyFrom(O.minimum),y.copyFrom(O.maximum))}var I=(P=this.particles[e]._pos)/3|0;R=4*I,C=2*I;for(var D=e;D<=t;D++){var L=this.particles[D];this.updateParticle(L);var w=L._model._shape,F=L._model._shapeUV,N=L._rotationMatrix,B=L.position,U=L.rotation,V=L.scaling,k=L._globalPosition;if(this._depthSort&&this._depthSortParticles){var G=this.depthSortedParticles[D];G.ind=L._ind,G.indicesLength=L._model._indicesLength,G.sqDistance=a.e.DistanceSquared(L.position,b)}if(!L.alive||L._stillInvisible&&!L.isVisible)P+=3*(M=w.length),R+=4*M,C+=2*M;else{if(L.isVisible){L._stillInvisible=!1;var z=p[12];if(L.pivot.multiplyToRef(V,z),this.billboard&&(U.x=0,U.y=0),(this._computeParticleRotation||this.billboard)&&L.getRotationMatrix(n),null!==L.parentId){var j=this.particles[L.parentId],W=j._rotationMatrix,H=j._globalPosition,X=B.x*W[1]+B.y*W[4]+B.z*W[7],Y=B.x*W[0]+B.y*W[3]+B.z*W[6],K=B.x*W[2]+B.y*W[5]+B.z*W[8];if(k.x=H.x+Y,k.y=H.y+X,k.z=H.z+K,this._computeParticleRotation||this.billboard){var Q=n.m;N[0]=Q[0]*W[0]+Q[1]*W[3]+Q[2]*W[6],N[1]=Q[0]*W[1]+Q[1]*W[4]+Q[2]*W[7],N[2]=Q[0]*W[2]+Q[1]*W[5]+Q[2]*W[8],N[3]=Q[4]*W[0]+Q[5]*W[3]+Q[6]*W[6],N[4]=Q[4]*W[1]+Q[5]*W[4]+Q[6]*W[7],N[5]=Q[4]*W[2]+Q[5]*W[5]+Q[6]*W[8],N[6]=Q[8]*W[0]+Q[9]*W[3]+Q[10]*W[6],N[7]=Q[8]*W[1]+Q[9]*W[4]+Q[10]*W[7],N[8]=Q[8]*W[2]+Q[9]*W[5]+Q[10]*W[8]}}else if(k.x=B.x,k.y=B.y,k.z=B.z,this._computeParticleRotation||this.billboard){Q=n.m;N[0]=Q[0],N[1]=Q[1],N[2]=Q[2],N[3]=Q[4],N[4]=Q[5],N[5]=Q[6],N[6]=Q[8],N[7]=Q[9],N[8]=Q[10]}var q=p[11];for(L.translateFromPivot?q.setAll(0):q.copyFrom(z),M=0;Mthis._options.radius)return null;var o=this._options.falloff===bl.Constant?this._options.strength:this._options.strength*(1-r/this._options.radius);return{force:i.multiplyByFloats(o,o,o),contactPoint:n,distanceFromOrigin:r}},e.prototype.triggerAffectedImpostorsCallback=function(e){this._options.affectedImpostorsCallback&&this._options.affectedImpostorsCallback(e)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},e.prototype._prepareSphere=function(){this._sphere||(this._sphere=tr.a.CreateSphere("radialExplosionEventSphere",this._options.sphere,this._scene),this._sphere.isVisible=!1)},e.prototype._intersectsWithSphere=function(e,t,i){var n=e.object;return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling=new a.e(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(n,!0)},e}(),Sl=function(){function e(e,t,i,n){this._physicsHelper=e,this._scene=t,this._origin=i,this._options=n,this._dataFetched=!1,this._options=h.a({},new Cl,this._options),this._tickCallback=this._tick.bind(this),this._options.strength=-1*this._options.strength}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout(function(){t._dataFetched||t._sphere.dispose()},0)},e.prototype._tick=function(){if(this._sphere)this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);else{var e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._options);e&&(this._sphere=e.getData().sphere.clone("radialExplosionEventSphereClone"))}},e}(),Rl=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=a.e.Zero(),this._originDirection=a.e.Zero(),this._cylinderPosition=a.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=h.a({},new Ml,this._options),this._origin.addToRef(new a.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new a.e(0,this._options.height,0),this._originTop),this._options.updraftMode===Tl.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),this._cylinder&&(e?this._cylinder.dispose():setTimeout(function(){t._dataFetched||t._cylinder.dispose()},0))},e.prototype.getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;var t=e.getObjectCenter();if(this._options.updraftMode===Tl.Perpendicular)var i=this._originDirection;else i=t.subtract(this._originTop);var n=a.e.Distance(this._origin,t),r=-1*this._options.strength;return{force:i.multiplyByFloats(r,r,r),contactPoint:t,distanceFromOrigin:n}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach(function(t){var i=e.getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)})},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Ji.a.CreateCylinder("updraftEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),xl=function(){function e(e,t,i){this._scene=e,this._origin=t,this._options=i,this._originTop=a.e.Zero(),this._cylinderPosition=a.e.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._options=h.a({},new Ol,this._options),this._origin.addToRef(new a.e(0,this._options.height/2,0),this._cylinderPosition),this._origin.addToRef(new a.e(0,this._options.height,0),this._originTop),this._tickCallback=this._tick.bind(this),this._prepareCylinder()}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout(function(){t._dataFetched||t._cylinder.dispose()},0)},e.prototype.getImpostorHitData=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return null;var t=e.getObjectCenter(),i=new a.e(this._origin.x,t.y,this._origin.z),n=t.subtract(i),r=new jt.a(i,n,this._options.radius).intersectsMesh(e.object),o=r.pickedPoint;if(!o)return null;var s=r.distance/this._options.radius,c=o.normalize();if(s>this._options.centripetalForceThreshold&&(c=c.negate()),s>this._options.centripetalForceThreshold)var l=c.x*this._options.centripetalForceMultiplier,u=c.y*this._options.updraftForceMultiplier,h=c.z*this._options.centripetalForceMultiplier;else{var d=a.e.Cross(i,t).normalize();l=(d.x+c.x)*this._options.centrifugalForceMultiplier,u=this._originTop.y*this._options.updraftForceMultiplier,h=(d.z+c.z)*this._options.centrifugalForceMultiplier}var f=new a.e(l,u,h);return{force:f=f.multiplyByFloats(this._options.strength,this._options.strength,this._options.strength),contactPoint:t,distanceFromOrigin:s}},e.prototype._tick=function(){var e=this;this._physicsEngine.getImpostors().forEach(function(t){var i=e.getImpostorHitData(t);i&&t.applyForce(i.force,i.contactPoint)})},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=Ji.a.CreateCylinder("vortexEventCylinder",{height:this._options.height,diameter:2*this._options.radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e}(),Cl=function(){this.radius=5,this.strength=10,this.falloff=bl.Constant,this.sphere={segments:32,diameter:1}},Ml=function(){this.radius=5,this.strength=10,this.height=10,this.updraftMode=Tl.Center},Ol=function(){this.radius=5,this.strength=10,this.height=10,this.centripetalForceThreshold=.7,this.centripetalForceMultiplier=5,this.centrifugalForceMultiplier=.5,this.updraftForceMultiplier=.02};!function(e){e[e.Constant=0]="Constant",e[e.Linear=1]="Linear"}(bl||(bl={})),function(e){e[e.Center=0]="Center",e[e.Perpendicular=1]="Perpendicular"}(Tl||(Tl={}));var Il="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\nvoid main(void)\n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11));\nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}";ni.a.ShadersStore.blackAndWhitePixelShader=Il;var Dl=function(e){function t(t,i,n,r,o,a){var s=e.call(this,t,"blackAndWhite",["degree"],null,i,n,r,o,a)||this;return s.degree=1,s.onApplyObservable.add(function(e){e.setFloat("degree",s.degree)}),s}return h.d(t,e),t}(oi),Ll=function(){function e(e,t,i,n){this._name=t,this._singleInstance=n||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}return Object.defineProperty(e.prototype,"isSupported",{get:function(){for(var e in this._postProcesses)if(this._postProcesses.hasOwnProperty(e))for(var t=this._postProcesses[e],i=0;i-1?"#define MALI 1\n":null},t}(oi),au="#include\n\nuniform sampler2D textureSampler;\n\nuniform float intensity;\nuniform float animatedSeed;\n\nvarying vec2 vUV;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\n\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}";ni.a.ShadersStore.grainPixelShader=au;var su=function(e){function t(t,i,n,r,o,a,s,c){void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var l=e.call(this,t,"grain",["intensity","animatedSeed"],[],i,n,r,o,a,null,s,void 0,null,c)||this;return l.intensity=30,l.animated=!1,l.onApplyObservable.add(function(e){e.setFloat("intensity",l.intensity),e.setFloat("animatedSeed",l.animated?Math.random()+1:1)}),l}return h.d(t,e),t}(oi),cu="\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvoid main(void)\n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a);\n}";ni.a.ShadersStore.highlightsPixelShader=cu;var lu=function(e){function t(t,i,n,r,o,a,s){return void 0===s&&(s=g.a.TEXTURETYPE_UNSIGNED_INT),e.call(this,t,"highlights",null,null,i,n,r,o,a,null,s)||this}return h.d(t,e),t}(oi);ni.a.IncludesShadersStore.mrtFragmentDeclaration="#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n";var uu="#extension GL_EXT_draw_buffers : require\nprecision highp float;\nprecision highp int;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include[RENDER_TARGET_COUNT]\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n\n#ifdef POSITION\ngl_FragData[POSITION_INDEX]=vec4(vPosition,1.0);\n#endif\n#ifdef VELOCITY\nvec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;\nvec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;\nvec2 velocity=abs(a-b);\nvelocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;\ngl_FragData[VELOCITY_INDEX]=vec4(velocity,0.0,1.0);\n#endif\n}";ni.a.ShadersStore.geometryPixelShader=uu;var hu="precision highp float;\nprecision highp int;\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n#include\nattribute vec3 position;\nattribute vec3 normal;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n\nuniform mat4 viewProjection;\nuniform mat4 view;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef VELOCITY\nuniform mat4 previousWorld;\nuniform mat4 previousViewProjection;\n#ifdef BONES_VELOCITY_ENABLED\n#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mPreviousBones[BonesPerMesh];\n#endif\n#endif\nvarying vec4 vCurrentPosition;\nvarying vec4 vPreviousPosition;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\n#include\n#if defined(VELOCITY) && !defined(BONES_VELOCITY_ENABLED)\n\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#include\nvec4 pos=vec4(finalWorld*vec4(positionUpdated,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normalUpdated,0.0)));\nvViewPos=view*pos;\n#if defined(VELOCITY) && defined(BONES_VELOCITY_ENABLED)\nvCurrentPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if NUM_BONE_INFLUENCERS>0\nmat4 previousInfluence;\npreviousInfluence=mPreviousBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\npreviousInfluence+=mPreviousBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif\n#if NUM_BONE_INFLUENCERS>2\npreviousInfluence+=mPreviousBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif\n#if NUM_BONE_INFLUENCERS>3\npreviousInfluence+=mPreviousBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif\n#if NUM_BONE_INFLUENCERS>4\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif\n#if NUM_BONE_INFLUENCERS>5\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif\n#if NUM_BONE_INFLUENCERS>6\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif\n#if NUM_BONE_INFLUENCERS>7\npreviousInfluence+=mPreviousBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif\nvPreviousPosition=previousViewProjection*previousWorld*previousInfluence*vec4(positionUpdated,1.0);\n#else\nvPreviousPosition=previousViewProjection*previousWorld*vec4(positionUpdated,1.0);\n#endif\n#endif\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}\n";ni.a.ShadersStore.geometryVertexShader=hu;var du=function(){function e(t,i){void 0===i&&(i=1),this._previousTransformationMatrices={},this._previousBonesTransformationMatrices={},this.excludedSkinnedMeshesFromVelocity=[],this._enablePosition=!1,this._enableVelocity=!1,this._positionIndex=-1,this._velocityIndex=-1,this._scene=t,this._ratio=i,e._SceneComponentInitialization(this._scene),this._createRenderTargets()}return Object.defineProperty(e.prototype,"renderList",{set:function(e){this._multiRenderTarget.renderList=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSupported",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!0,configurable:!0}),e.prototype.getTextureIndex=function(t){switch(t){case e.POSITION_TEXTURE_TYPE:return this._positionIndex;case e.VELOCITY_TEXTURE_TYPE:return this._velocityIndex;default:return-1}},Object.defineProperty(e.prototype,"enablePosition",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this.dispose(),this._createRenderTargets()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableVelocity",{get:function(){return this._enableVelocity},set:function(e){this._enableVelocity=e,e||(this._previousTransformationMatrices={}),this.dispose(),this._createRenderTargets()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ratio",{get:function(){return this._ratio},enumerable:!0,configurable:!0}),e.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var n=[],r=[Yi.b.PositionKind,Yi.b.NormalKind],o=e.getMesh();i&&i.needAlphaTesting()&&(n.push("#define ALPHATEST"),o.isVerticesDataPresent(Yi.b.UVKind)&&(r.push(Yi.b.UVKind),n.push("#define UV1")),o.isVerticesDataPresent(Yi.b.UV2Kind)&&(r.push(Yi.b.UV2Kind),n.push("#define UV2"))),this._enablePosition&&(n.push("#define POSITION"),n.push("#define POSITION_INDEX "+this._positionIndex)),this._enableVelocity&&(n.push("#define VELOCITY"),n.push("#define VELOCITY_INDEX "+this._velocityIndex),-1===this.excludedSkinnedMeshesFromVelocity.indexOf(o)&&n.push("#define BONES_VELOCITY_ENABLED")),o.useBones&&o.computeBonesUsingShaders?(r.push(Yi.b.MatricesIndicesKind),r.push(Yi.b.MatricesWeightsKind),o.numBoneInfluencers>4&&(r.push(Yi.b.MatricesIndicesExtraKind),r.push(Yi.b.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(r)),n.push("#define RENDER_TARGET_COUNT "+this._multiRenderTarget.textures.length);var c=n.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffect("geometry",r,["world","mBones","viewProjection","diffuseMatrix","view","previousWorld","previousViewProjection","mPreviousBones","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{buffersCount:this._enablePosition?3:2,maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(e.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.getGBuffer().dispose()},e.prototype._createRenderTargets=function(){var e=this,t=this._scene.getEngine(),i=2;if(this._enablePosition&&(this._positionIndex=i,i++),this._enableVelocity&&(this._velocityIndex=i,i++),this._multiRenderTarget=new Xa("gBuffer",{width:t.getRenderWidth()*this._ratio,height:t.getRenderHeight()*this._ratio},i,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:g.a.TEXTURETYPE_FLOAT}),this.isSupported){this._multiRenderTarget.wrapU=$e.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=$e.a.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add(function(e){e.clear(new s.b(0,0,0,1),!0,!0,!0)});var n=function(t){var i=t.getRenderingMesh(),n=e._scene,r=n.getEngine(),o=t.getMaterial();if(o){if(i._internalAbstractMeshDataInfo._isActiveIntermediate=!1,e._enableVelocity&&!e._previousTransformationMatrices[i.uniqueId]&&(e._previousTransformationMatrices[i.uniqueId]={world:a.a.Identity(),viewProjection:n.getTransformMatrix()},i.skeleton)){var s=i.skeleton.getTransformMatrices(i);e._previousBonesTransformationMatrices[i.uniqueId]=e._copyBonesTransformationMatrices(s,new Float32Array(s.length))}r.setState(o.backFaceCulling,0,!1,n.useRightHandedSystem);var c=i._getInstancesRenderList(t._id);if(!c.mustReturn){var l=r.getCaps().instancedArrays&&null!==c.visibleInstances[t._id];if(e.isReady(t,l)){if(r.enableEffect(e._effect),i._bind(t,e._effect,No.a.TriangleFillMode),e._effect.setMatrix("viewProjection",n.getTransformMatrix()),e._effect.setMatrix("view",n.getViewMatrix()),o&&o.needAlphaTesting()){var u=o.getAlphaTestTexture();u&&(e._effect.setTexture("diffuseSampler",u),e._effect.setMatrix("diffuseMatrix",u.getTextureMatrix()))}i.useBones&&i.computeBonesUsingShaders&&i.skeleton&&(e._effect.setMatrices("mBones",i.skeleton.getTransformMatrices(i)),e._enableVelocity&&e._effect.setMatrices("mPreviousBones",e._previousBonesTransformationMatrices[i.uniqueId])),Mr.a.BindMorphTargetParameters(i,e._effect),e._enableVelocity&&(e._effect.setMatrix("previousWorld",e._previousTransformationMatrices[i.uniqueId].world),e._effect.setMatrix("previousViewProjection",e._previousTransformationMatrices[i.uniqueId].viewProjection)),i._processRendering(t,e._effect,No.a.TriangleFillMode,c,l,function(t,i){return e._effect.setMatrix("world",i)})}e._enableVelocity&&(e._previousTransformationMatrices[i.uniqueId].world=i.getWorldMatrix().clone(),e._previousTransformationMatrices[i.uniqueId].viewProjection=e._scene.getTransformMatrix().clone(),i.skeleton&&e._copyBonesTransformationMatrices(i.skeleton.getTransformMatrices(i),e._previousBonesTransformationMatrices[i.uniqueId]))}}};this._multiRenderTarget.customRenderFunction=function(e,i,r,o){var a;if(o.length){for(t.setColorWrite(!1),a=0;a0){var i=this._renderEffects[t[0]].getPostProcesses();i&&(i[0].samples=e)}return!0},e.prototype.dispose=function(){},h.c([Object(F.c)()],e.prototype,"_name",void 0),e}(),Tu=function(){function e(){this._renderPipelines={}}return Object.defineProperty(e.prototype,"supportedPipelines",{get:function(){var e=[];for(var t in this._renderPipelines)if(this._renderPipelines.hasOwnProperty(t)){var i=this._renderPipelines[t];i.isSupported&&e.push(i)}return e},enumerable:!0,configurable:!0}),e.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},e.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1);var n=this._renderPipelines[e];n&&n._attachCameras(t,i)},e.prototype.detachCamerasFromRenderPipeline=function(e,t){var i=this._renderPipelines[e];i&&i._detachCameras(t)},e.prototype.enableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._enableEffect(t,i)},e.prototype.disableEffectInPipeline=function(e,t,i){var n=this._renderPipelines[e];n&&n._disableEffect(t,i)},e.prototype.update=function(){for(var e in this._renderPipelines)if(this._renderPipelines.hasOwnProperty(e)){var t=this._renderPipelines[e];t.isSupported?t._update():(t.dispose(),delete this._renderPipelines[e])}},e.prototype._rebuild=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e]._rebuild()}},e.prototype.dispose=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e].dispose()}},e}();Object.defineProperty(K.a.prototype,"postProcessRenderPipelineManager",{get:function(){if(!this._postProcessRenderPipelineManager){var e=this._getComponent(Fe.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new Eu(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new Tu}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var Eu=function(){function e(e){this.name=Fe.a.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Fe.a.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},e.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},e.prototype._gatherRenderTargets=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()},e}(),Au=function(e){function t(t,i,n,r,o){void 0===t&&(t=""),void 0===i&&(i=!0),void 0===n&&(n=C.a.LastCreatedScene),void 0===o&&(o=!0);var a=e.call(this,n.getEngine(),t)||this;a._camerasToBeAttached=[],a.SharpenPostProcessId="SharpenPostProcessEffect",a.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",a.FxaaPostProcessId="FxaaPostProcessEffect",a.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",a.GrainPostProcessId="GrainPostProcessEffect",a._glowLayer=null,a.animations=[],a._imageProcessingConfigurationObserver=null,a._sharpenEnabled=!1,a._bloomEnabled=!1,a._depthOfFieldEnabled=!1,a._depthOfFieldBlurLevel=Ql.Low,a._fxaaEnabled=!1,a._imageProcessingEnabled=!0,a._bloomScale=.5,a._chromaticAberrationEnabled=!1,a._grainEnabled=!1,a._buildAllowed=!0,a._resizeObserver=null,a._hardwareScaleLevel=1,a._bloomKernel=64,a._bloomWeight=.15,a._bloomThreshold=.9,a._samples=1,a._hasCleared=!1,a._prevPostProcess=null,a._prevPrevPostProcess=null,a._depthOfFieldSceneObserver=null,a._cameras=r||n.cameras,a._cameras=a._cameras.slice(),a._camerasToBeAttached=a._cameras.slice(),a._buildAllowed=o,a._scene=n;var s=a._scene.getEngine().getCaps();a._hdr=i&&(s.textureHalfFloatRender||s.textureFloatRender),a._hdr?s.textureHalfFloatRender?a._defaultPipelineTextureType=g.a.TEXTURETYPE_HALF_FLOAT:s.textureFloatRender&&(a._defaultPipelineTextureType=g.a.TEXTURETYPE_FLOAT):a._defaultPipelineTextureType=g.a.TEXTURETYPE_UNSIGNED_INT,n.postProcessRenderPipelineManager.addPipeline(a);var c=a._scene.getEngine();return a.sharpen=new yu("sharpen",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._sharpenEffect=new Ll(c,a.SharpenPostProcessId,function(){return a.sharpen},!0),a.depthOfField=new Jl(a._scene,null,a._depthOfFieldBlurLevel,a._defaultPipelineTextureType,!0),a.bloom=new Ul(a._scene,a._bloomScale,a._bloomWeight,a.bloomKernel,a._defaultPipelineTextureType,!0),a.chromaticAberration=new kl("ChromaticAberration",c.getRenderWidth(),c.getRenderHeight(),1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._chromaticAberrationEffect=new Ll(c,a.ChromaticAberrationPostProcessId,function(){return a.chromaticAberration},!0),a.grain=new su("Grain",1,null,$e.a.BILINEAR_SAMPLINGMODE,c,!1,a._defaultPipelineTextureType,!0),a._grainEffect=new Ll(c,a.GrainPostProcessId,function(){return a.grain},!0),a._resizeObserver=c.onResizeObservable.add(function(){a._hardwareScaleLevel=c.getHardwareScalingLevel(),a.bloomKernel=a.bloomKernel}),a._imageProcessingConfigurationObserver=a._scene.imageProcessingConfiguration.onUpdateParameters.add(function(){a.bloom._downscale._exposure=a._scene.imageProcessingConfiguration.exposure}),a._buildPipeline(),a}return h.d(t,e),Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sharpenEnabled",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomKernel",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomWeight",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomThreshold",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomScale",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),t.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new Ul(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t1){for(var i=0,n=this._cameras;i-1&&(e.depthOfField.depthTexture=t.enableDepthRenderer(t.activeCamera).getDepthMap())})}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new Hi("imageProcessing",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this._hdr?(this.addEffect(new Ll(t,this.ImageProcessingPostProcessId,function(){return e.imageProcessing},!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new ou("fxaa",1,null,$e.a.BILINEAR_SAMPLINGMODE,t,!1,this._defaultPipelineTextureType),this.addEffect(new Ll(t,this.FxaaPostProcessId,function(){return e.fxaa},!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),this._scene.activeCameras&&this._scene.activeCameras.length>1&&(this._scene.autoClear=!0),!this._enableMSAAOnFirstPostProcess(this.samples)&&this.samples>1&&m.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")}},t.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t0?i._ssaoCombinePostProcess.width:i._originalColorPostProcess.width),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&e.setArray("samplerOffsets",i._samplerOffsets))},this._blurVPostProcess=new oi("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],t,null,$e.a.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE "+(n?"1":"0")+"\n"),this._blurVPostProcess.onApply=function(e){i._scene.activeCamera&&(e.setFloat("outSize",i._ssaoCombinePostProcess.height>0?i._ssaoCombinePostProcess.height:i._originalColorPostProcess.height),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&(e.setArray("samplerOffsets",i._samplerOffsets),i._firstUpdate=!1))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples},t.prototype._rebuild=function(){this._firstUpdate=!0,e.prototype._rebuild.call(this)},t.prototype._radicalInverse_VdC=function(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},t.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},t.prototype._hemisphereSample_uniform=function(e,t){var i=2*t*Math.PI,n=1-(.85*e+.15),r=Math.sqrt(1-n*n);return new a.e(Math.cos(i)*r,Math.sin(i)*r,n)},t.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],n=0;n1&&m.a.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},t.prototype._createDownSampleX4PostProcess=function(e,t){var i=this,n=new Array(32);this.downSampleX4PostProcess=new oi("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",g.a.TEXTURETYPE_UNSIGNED_INT),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,r=i.downSampleX4PostProcess.width,o=i.downSampleX4PostProcess.height,a=-2;a<2;a++)for(var s=-2;s<2;s++)n[t]=(a+.5)*(1/r),n[t+1]=(s+.5)*(1/o),t+=2;e.setArray2("dsOffsets",n)},this.addEffect(new Ll(e.getEngine(),"HDRDownSampleX4",function(){return i.downSampleX4PostProcess},!0))},t.prototype._createBrightPassPostProcess=function(e,t){var i=this,n=new Array(8);this.brightPassPostProcess=new oi("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",g.a.TEXTURETYPE_UNSIGNED_INT),this.brightPassPostProcess.onApply=function(e){var t=1/i.brightPassPostProcess.width,r=1/i.brightPassPostProcess.height;n[0]=-.5*t,n[1]=.5*r,n[2]=.5*t,n[3]=.5*r,n[4]=-.5*t,n[5]=-.5*r,n[6]=.5*t,n[7]=-.5*r,e.setArray2("dsOffsets",n),e.setFloat("brightThreshold",i.brightThreshold)},this.addEffect(new Ll(e.getEngine(),"HDRBrightPass",function(){return i.brightPassPostProcess},!0))},t.prototype._createBlurPostProcesses=function(e,t,i,n){var r=this;void 0===n&&(n="blurWidth");var o=e.getEngine(),s=new Sr("HDRBlurH_"+i,new a.d(1,0),this[n],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT),c=new Sr("HDRBlurV_"+i,new a.d(0,1),this[n],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT);s.onActivateObservable.add(function(){var e=s.width/o.getRenderWidth();s.kernel=r[n]*e}),c.onActivateObservable.add(function(){var e=c.height/o.getRenderHeight();c.kernel=r.horizontalBlur?64*e:r[n]*e}),this.addEffect(new Ll(e.getEngine(),"HDRBlurH"+i,function(){return s},!0)),this.addEffect(new Ll(e.getEngine(),"HDRBlurV"+i,function(){return c},!0)),this.blurHPostProcesses.push(s),this.blurVPostProcesses.push(c)},t.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new oi("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",g.a.TEXTURETYPE_UNSIGNED_INT),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._vlsEnabled?i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture("lensSampler",i.lensTexture),e.setFloat("exposure",i._currentExposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDRTextureAdder",function(){return i.textureAdderPostProcess},!0))},t.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,n=e.enableGeometryBufferRenderer();n.enablePosition=!0;var r=n.getGBuffer();this.volumetricLightPostProcess=new oi("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=a.d.Zero();this.volumetricLightPostProcess.onApply=function(e){if(i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera){var t=i.sourceLight.getShadowGenerator();e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",r.textures[2]),e.setColor3("sunColor",i.sourceLight.diffuse),e.setVector3("sunDirection",i.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",i._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",i.volumetricLightCoefficient),e.setFloat("scatteringPower",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",o)}},this.addEffect(new Ll(e.getEngine(),"HDRVLS",function(){return i.volumetricLightPostProcess},!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new oi("HDRVLSMerge","standard",[],["originalSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess("originalSampler",i._bloomEnabled?i.textureAdderFinalPostProcess:i.originalPostProcess),i._currentDepthOfFieldSource=i.volumetricLightFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDRVLSMerge",function(){return i.volumetricLightMergePostProces},!0))},t.prototype._createLuminancePostProcesses=function(e,i){var n=this,r=Math.pow(3,t.LuminanceSteps);this.luminancePostProcess=new oi("HDRLuminance","standard",["lumOffsets"],[],{width:r,height:r},null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LUMINANCE",i);var o=[];this.luminancePostProcess.onApply=function(e){var t=1/n.luminancePostProcess.width,i=1/n.luminancePostProcess.height;o[0]=-.5*t,o[1]=.5*i,o[2]=.5*t,o[3]=.5*i,o[4]=-.5*t,o[5]=-.5*i,o[6]=.5*t,o[7]=-.5*i,e.setArray2("lumOffsets",o)},this.addEffect(new Ll(e.getEngine(),"HDRLuminance",function(){return n.luminancePostProcess},!0));for(var s=t.LuminanceSteps-1;s>=0;s--){r=Math.pow(3,s);var c="#define LUMINANCE_DOWN_SAMPLE\n";0===s&&(c+="#define FINAL_DOWN_SAMPLER");var l=new oi("HDRLuminanceDownSample"+s,"standard",["dsOffsets","halfDestPixelSize"],[],{width:r,height:r},null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,c,i);this.luminanceDownSamplePostProcesses.push(l)}var u=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach(function(t,i){var r=new Array(18);t.onApply=function(e){if(u){for(var o=0,a=-1;a<2;a++)for(var s=-1;s<2;s++)r[o]=a/u.width,r[o+1]=s/u.height,o+=2;e.setArray2("dsOffsets",r),e.setFloat("halfDestPixelSize",.5/u.width),u=i===n.luminanceDownSamplePostProcesses.length-1?n.luminancePostProcess:t}},i===n.luminanceDownSamplePostProcesses.length-1&&(t.onAfterRender=function(){var t=e.getEngine().readPixels(0,0,1,1),i=new a.f(1/16581375,1/65025,1/255,1);n._hdrCurrentLuminance=(t[0]*i.x+t[1]*i.y+t[2]*i.z+t[3]*i.w)/100}),n.addEffect(new Ll(e.getEngine(),"HDRLuminanceDownSample"+i,function(){return t},!0))})},t.prototype._createHdrPostProcess=function(e,t){var i=this,n=["#define HDR"];this._hdrAutoExposure&&n.push("#define AUTO_EXPOSURE"),this.hdrPostProcess=new oi("HDR","standard",["averageLuminance"],["textureAdderSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n.join("\n"),g.a.TEXTURETYPE_UNSIGNED_INT);var r=1,o=0,a=0;this.hdrPostProcess.onApply=function(t){if(t.setTextureFromPostProcess("textureAdderSampler",i._currentDepthOfFieldSource),o+=e.getEngine().getDeltaTime(),r<0)r=i._hdrCurrentLuminance;else{var n=(a-o)/1e3;i._hdrCurrentLuminancer-i.hdrIncreaseRate*n?r-=i.hdrIncreaseRate*n:r=i._hdrCurrentLuminance}i.hdrAutoExposure?i._currentExposure=i._fixedExposure/r:(r=w.a.Clamp(r,i.hdrMinimumLuminance,1e20),t.setFloat("averageLuminance",r)),a=o,i._currentDepthOfFieldSource=i.hdrFinalPostProcess},this.addEffect(new Ll(e.getEngine(),"HDR",function(){return i.hdrPostProcess},!0))},t.prototype._createLensFlarePostProcess=function(e,t){var i=this;this.lensFlarePostProcess=new oi("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",g.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ll(e.getEngine(),"HDRLensFlare",function(){return i.lensFlarePostProcess},!0)),this._createBlurPostProcesses(e,t/4,2,"lensFlareBlurWidth"),this.lensFlareComposePostProcess=new oi("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",g.a.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new Ll(e.getEngine(),"HDRLensFlareCompose",function(){return i.lensFlareComposePostProcess},!0));var n=new a.d(0,0);this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",i._bloomEnabled?i.blurHPostProcesses[0]:i.originalPostProcess),e.setTexture("lensColorSampler",i.lensColorTexture),e.setFloat("strength",i.lensFlareStrength),e.setFloat("ghostDispersal",i.lensFlareGhostDispersal),e.setFloat("haloWidth",i.lensFlareHaloWidth),n.x=i.lensFlarePostProcess.width,n.y=i.lensFlarePostProcess.height,e.setVector2("resolution",n),e.setFloat("distortionStrength",i.lensFlareDistortionStrength)};var r=a.a.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),o=a.a.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){if(i._scene.activeCamera){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("lensDirtSampler",i.lensFlareDirtTexture),e.setTexture("lensStarSampler",i.lensStarTexture);var t=i._scene.activeCamera.getViewMatrix().getRow(0),n=i._scene.activeCamera.getViewMatrix().getRow(2),s=a.e.Dot(t.toVector3(),new a.e(1,0,0))+a.e.Dot(n.toVector3(),new a.e(0,0,1));s*=4;var c=a.a.FromValues(.5*Math.cos(s),-Math.sin(s),0,0,Math.sin(s),.5*Math.cos(s),0,0,0,0,1,0,0,0,0,1),l=o.multiply(c).multiply(r);e.setMatrix("lensStarMatrix",l),i._currentDepthOfFieldSource=i.lensFlareFinalPostProcess}}},t.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new oi("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",g.a.TEXTURETYPE_UNSIGNED_INT),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("depthSampler",i._getDepthTexture()),e.setFloat("distance",i.depthOfFieldDistance)},this.addEffect(new Ll(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},t.prototype._createMotionBlurPostProcess=function(e,t){var i=this;if(this._isObjectBasedMotionBlur){var n=new _u("HDRMotionBlur",e,t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,g.a.TEXTURETYPE_UNSIGNED_INT);n.motionStrength=this.motionStrength,n.motionBlurSamples=this.motionBlurSamples,this.motionBlurPostProcess=n}else{this.motionBlurPostProcess=new oi("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],t,null,$e.a.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),g.a.TEXTURETYPE_UNSIGNED_INT);var r=0,o=a.a.Identity(),s=a.a.Identity(),c=a.a.Identity(),l=a.d.Zero();this.motionBlurPostProcess.onApply=function(t){(c=e.getProjectionMatrix().multiply(e.getViewMatrix())).invertToRef(s),t.setMatrix("inverseViewProjection",s),t.setMatrix("prevViewProjection",o),o=c,l.x=i.motionBlurPostProcess.width,l.y=i.motionBlurPostProcess.height,t.setVector2("screenSize",l),r=e.getEngine().getFps()/60,t.setFloat("motionScale",r),t.setFloat("motionStrength",i.motionStrength),t.setTexture("depthSampler",i._getDepthTexture())}}this.addEffect(new Ll(e.getEngine(),"HDRMotionBlur",function(){return i.motionBlurPostProcess},!0))},t.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},t.prototype._disposePostProcesses=function(){for(var e=0;e0&&-1!==this.excludedMeshes.indexOf(e)},t.prototype._createPass=function(e,t){var i=this,n=e.getEngine();this._volumetricLightScatteringRTT=new Oi("volumetricLightScatteringMap",{width:n.getRenderWidth()*t,height:n.getRenderHeight()*t},e,!1,!0,g.a.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=$e.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=$e.a.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var r=this.getCamera();r?r.customRenderTargets.push(this._volumetricLightScatteringRTT):e.customRenderTargets.push(this._volumetricLightScatteringRTT);var o,a=function(e){var t=e.getRenderingMesh();if(!i._meshExcluded(t)){t._internalAbstractMeshDataInfo._isActiveIntermediate=!1;var n=e.getMaterial();if(n){var r=t.getScene(),o=r.getEngine();o.setState(n.backFaceCulling);var a=t._getInstancesRenderList(e._id);if(!a.mustReturn){var s=o.getCaps().instancedArrays&&null!==a.visibleInstances[e._id];if(i._isReady(e,s)){var c=i._volumetricLightScatteringPass;if(t===i.mesh&&(c=e.effect?e.effect:n.getEffect()),o.enableEffect(c),t._bind(e,c,No.a.TriangleFillMode),t===i.mesh)n.bind(t.getWorldMatrix(),t);else{if(i._volumetricLightScatteringPass.setMatrix("viewProjection",r.getTransformMatrix()),n&&n.needAlphaTesting()){var l=n.getAlphaTestTexture();i._volumetricLightScatteringPass.setTexture("diffuseSampler",l),l&&i._volumetricLightScatteringPass.setMatrix("diffuseMatrix",l.getTextureMatrix())}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&i._volumetricLightScatteringPass.setMatrices("mBones",t.skeleton.getTransformMatrices(t))}t._processRendering(e,i._volumetricLightScatteringPass,No.a.TriangleFillMode,a,s,function(e,t){return c.setMatrix("world",t)})}}}}},c=new s.b(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add(function(){o=e.clearColor,e.clearColor=c}),this._volumetricLightScatteringRTT.onAfterRenderObservable.add(function(){e.clearColor=o}),this._volumetricLightScatteringRTT.customRenderFunction=function(t,i,n,r){var o,s=e.getEngine();if(r.length){for(s.setColorWrite(!1),o=0;ot._alphaIndex?1:e._alphaIndext._distanceToCamera?-1:0}),s.setAlphaMode(g.a.ALPHA_COMBINE),o=0;o\n#endif\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#ifdef NONLINEARDEPTH\n#ifdef PACKED\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(gl_FragCoord.z,0.0,0.0,0.0);\n#endif\n#else\n#ifdef PACKED\ngl_FragColor=pack(vDepthMetric);\n#else\ngl_FragColor=vec4(vDepthMetric,0.0,0.0,1.0);\n#endif\n#endif\n}";ni.a.ShadersStore.depthPixelShader=ju;var Wu=function(){function e(t,i,n,r){var o=this;void 0===i&&(i=g.a.TEXTURETYPE_FLOAT),void 0===n&&(n=null),void 0===r&&(r=!1),this.useOnlyInActiveCamera=!1,this._scene=t,this._storeNonLinearDepth=r,this.isPacked=i===g.a.TEXTURETYPE_UNSIGNED_BYTE,this.isPacked?this._clearColor=new s.b(1,1,1,1):this._clearColor=new s.b(1,0,0,1),e._SceneComponentInitialization(this._scene),this._camera=n;var a=t.getEngine(),c=this.isPacked||1===a.webGLVersion?g.a.TEXTUREFORMAT_RGBA:g.a.TEXTUREFORMAT_R;this._depthMap=new Oi("depthMap",{width:a.getRenderWidth(),height:a.getRenderHeight()},this._scene,!1,!0,i,!1,void 0,void 0,void 0,void 0,c),this._depthMap.wrapU=$e.a.CLAMP_ADDRESSMODE,this._depthMap.wrapV=$e.a.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add(function(e){e.clear(o._clearColor,!0,!0,!0)});var l=function(e){var t=e.getRenderingMesh(),i=o._scene,n=i.getEngine(),r=e.getMaterial();if(t._internalAbstractMeshDataInfo._isActiveIntermediate=!1,r){n.setState(r.backFaceCulling,0,!1,i.useRightHandedSystem);var a=t._getInstancesRenderList(e._id);if(!a.mustReturn){var s=n.getCaps().instancedArrays&&null!==a.visibleInstances[e._id],c=o._camera||i.activeCamera;if(o.isReady(e,s)&&c){if(n.enableEffect(o._effect),t._bind(e,o._effect,No.a.TriangleFillMode),o._effect.setMatrix("viewProjection",i.getTransformMatrix()),o._effect.setFloat2("depthValues",c.minZ,c.minZ+c.maxZ),r&&r.needAlphaTesting()){var l=r.getAlphaTestTexture();l&&(o._effect.setTexture("diffuseSampler",l),o._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()))}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&o._effect.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),Mr.a.BindMorphTargetParameters(t,o._effect),t._processRendering(e,o._effect,No.a.TriangleFillMode,a,s,function(e,t){return o._effect.setMatrix("world",t)})}}}};this._depthMap.customRenderFunction=function(e,t,i,n){var r;if(n.length){for(a.setColorWrite(!1),r=0;r4&&(r.push(Yi.b.MatricesIndicesExtraKind),r.push(Yi.b.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),n.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var a=o.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,n.push("#define MORPHTARGETS"),n.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(r,o,s)),t&&(n.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(r)),this._storeNonLinearDepth&&n.push("#define NONLINEARDEPTH"),this.isPacked&&n.push("#define PACKED");var c=n.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffect("depth",r,["world","mBones","viewProjection","diffuseMatrix","depthValues","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){this._depthMap.dispose()},e._SceneComponentInitialization=function(e){throw De.a.WarnImport("DepthRendererSceneComponent")},e}();K.a.prototype.enableDepthRenderer=function(e,t){if(void 0===t&&(t=!1),!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";if(this._depthRenderer||(this._depthRenderer={}),!this._depthRenderer[e.id]){var i=0;i=this.getEngine().getCaps().textureHalfFloatRender?g.a.TEXTURETYPE_HALF_FLOAT:this.getEngine().getCaps().textureFloatRender?g.a.TEXTURETYPE_FLOAT:g.a.TEXTURETYPE_UNSIGNED_BYTE,this._depthRenderer[e.id]=new Wu(this,i,e,t)}return this._depthRenderer[e.id]},K.a.prototype.disableDepthRenderer=function(e){(e=e||this.activeCamera)&&this._depthRenderer&&this._depthRenderer[e.id]&&(this._depthRenderer[e.id].dispose(),delete this._depthRenderer[e.id])};var Hu=function(){function e(e){this.name=Fe.a.NAME_DEPTHRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(Fe.a.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(Fe.a.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER,this,this._gatherActiveCameraRenderTargets)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){for(var e in this.scene._depthRenderer)this.scene._depthRenderer[e].dispose()},e.prototype._gatherRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera||e.push(i.getDepthMap())}},e.prototype._gatherActiveCameraRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera&&this.scene.activeCamera.id===t&&e.push(i.getDepthMap())}},e}();Wu._SceneComponentInitialization=function(e){var t=e._getComponent(Fe.a.NAME_DEPTHRENDERER);t||(t=new Hu(e),e._addComponent(t))};var Xu="uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}";ni.a.ShadersStore.linePixelShader=Xu;var Yu="\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}";ni.a.ShadersStore.lineVertexShader=Yu;Ye.a.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},Ye.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new Qu(this,e,t),this},Object.defineProperty(Ye.a.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),dc.b.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new qu(this,e,t),this},dc.a.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),dc.b.prototype.enableEdgesRendering.apply(this,arguments),this};var Ku=function(){this.edges=new Array,this.edgesConnectedCount=0},Qu=function(){function e(e,t,i,n){var r=this;void 0===t&&(t=.95),void 0===i&&(i=!1),void 0===n&&(n=!0),this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this._source=e,this._checkVerticesInsteadOfIndices=i,this._epsilon=t,this._prepareRessources(),n&&this._generateEdgesLines(),this._meshRebuildObserver=this._source.onRebuildObservable.add(function(){r._rebuild()}),this._meshDisposeObserver=this._source.onDisposeObservable.add(function(){r.dispose()})}return e.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=new Ba.a("lineShader",this._source.getScene(),"line",{attributes:["position","normal"],uniforms:["worldViewProjection","color","width","aspectRatio"]}),this._lineShader.disableDepthWrite=!0,this._lineShader.backFaceCulling=!1)},e.prototype._rebuild=function(){var e=this._buffers[Yi.b.PositionKind];e&&e._rebuild(),(e=this._buffers[Yi.b.NormalKind])&&e._rebuild();var t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)},e.prototype.dispose=function(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var e=this._buffers[Yi.b.PositionKind];e&&(e.dispose(),this._buffers[Yi.b.PositionKind]=null),(e=this._buffers[Yi.b.NormalKind])&&(e.dispose(),this._buffers[Yi.b.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose()},e.prototype._processEdgeForAdjacencies=function(e,t,i,n,r){return e===i&&t===n||e===n&&t===i?0:e===n&&t===r||e===r&&t===n?1:e===r&&t===i||e===i&&t===r?2:-1},e.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,n,r){return e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(n)||e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(i)?0:e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(r)||e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(n)?1:e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(i)||e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(r)?2:-1},e.prototype._checkEdge=function(e,t,i,n,r){var o;void 0===t?o=!0:o=a.e.Dot(i[e],i[t])\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include\ngl_FragColor=color;\n}";ni.a.ShadersStore.outlinePixelShader=Zu;var Ju="\nattribute vec3 position;\nattribute vec3 normal;\n#include\n#include\n#include[0..maxSimultaneousMorphTargets]\n\nuniform float offset;\n#include\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include\nvoid main(void)\n{\nvec3 positionUpdated=position;\nvec3 normalUpdated=normal;\n#ifdef UV1\nvec2 uvUpdated=uv;\n#endif\n#include[0..maxSimultaneousMorphTargets]\nvec3 offsetPosition=positionUpdated+(normalUpdated*offset);\n#include\n#include\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uvUpdated,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include\n}\n";ni.a.ShadersStore.outlineVertexShader=Ju;K.a.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new $u(this)),this._outlineRenderer},Object.defineProperty(Ye.a.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ye.a.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var $u=function(){function e(e){this.name=Fe.a.NAME_OUTLINERENDERER,this.zOffset=1,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this)}return e.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(Fe.a.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(Fe.a.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype.render=function(e,t,i){var n=this;void 0===i&&(i=!1);var r=this.scene,o=r.getEngine(),a=o.getCaps().instancedArrays&&null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id];if(this.isReady(e,a)){var s=e.getRenderingMesh(),c=e.getMaterial();if(c&&r.activeCamera){if(o.enableEffect(this._effect),c.useLogarithmicDepth&&this._effect.setFloat("logarithmicDepthConstant",2/(Math.log(r.activeCamera.maxZ+1)/Math.LN2)),this._effect.setFloat("offset",i?0:s.outlineWidth),this._effect.setColor4("color",i?s.overlayColor:s.outlineColor,i?s.overlayAlpha:c.alpha),this._effect.setMatrix("viewProjection",r.getTransformMatrix()),s.useBones&&s.computeBonesUsingShaders&&s.skeleton&&this._effect.setMatrices("mBones",s.skeleton.getTransformMatrices(s)),Mr.a.BindMorphTargetParameters(s,this._effect),s._bind(e,this._effect,No.a.TriangleFillMode),c&&c.needAlphaTesting()){var l=c.getAlphaTestTexture();l&&(this._effect.setTexture("diffuseSampler",l),this._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()))}o.setZOffset(-this.zOffset),s._processRendering(e,this._effect,No.a.TriangleFillMode,t,a,function(e,t){n._effect.setMatrix("world",t)}),o.setZOffset(0)}}},e.prototype.isReady=function(e,t){var i=[],n=[Yi.b.PositionKind,Yi.b.NormalKind],r=e.getMesh(),o=e.getMaterial();o&&(o.needAlphaTesting()&&(i.push("#define ALPHATEST"),r.isVerticesDataPresent(Yi.b.UVKind)&&(n.push(Yi.b.UVKind),i.push("#define UV1")),r.isVerticesDataPresent(Yi.b.UV2Kind)&&(n.push(Yi.b.UV2Kind),i.push("#define UV2"))),o.useLogarithmicDepth&&i.push("#define LOGARITHMICDEPTH")),r.useBones&&r.computeBonesUsingShaders?(n.push(Yi.b.MatricesIndicesKind),n.push(Yi.b.MatricesWeightsKind),r.numBoneInfluencers>4&&(n.push(Yi.b.MatricesIndicesExtraKind),n.push(Yi.b.MatricesWeightsExtraKind)),i.push("#define NUM_BONE_INFLUENCERS "+r.numBoneInfluencers),i.push("#define BonesPerMesh "+(r.skeleton?r.skeleton.bones.length+1:0))):i.push("#define NUM_BONE_INFLUENCERS 0");var a=r.morphTargetManager,s=0;a&&a.numInfluencers>0&&(s=a.numInfluencers,i.push("#define MORPHTARGETS"),i.push("#define NUM_MORPH_INFLUENCERS "+s),Mr.a.PrepareAttributesForMorphTargetsInfluencers(n,r,s)),t&&(i.push("#define INSTANCES"),Mr.a.PushAttributesForInstances(n));var c=i.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this.scene.getEngine().createEffect("outline",n,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:s})),this._effect.isReady()},e.prototype._beforeRenderingMesh=function(t,i,n){if(this._savedDepthWrite=this._engine.getDepthWrite(),t.renderOutline){var r=i.getMaterial();r&&r.needAlphaBlending()&&(this._engine.cacheStencilState(),this._engine.setDepthWrite(!1),this._engine.setColorWrite(!1),this._engine.setStencilBuffer(!0),this._engine.setStencilOperationPass(g.a.REPLACE),this._engine.setStencilFunction(g.a.ALWAYS),this._engine.setStencilMask(e._StencilReference),this._engine.setStencilFunctionReference(e._StencilReference),this.render(i,n,!0),this._engine.setColorWrite(!0),this._engine.setStencilFunction(g.a.NOTEQUAL)),this._engine.setDepthWrite(!1),this.render(i,n),this._engine.setDepthWrite(this._savedDepthWrite),r&&r.needAlphaBlending()&&this._engine.restoreStencilState()}},e.prototype._afterRenderingMesh=function(e,t,i){if(e.renderOverlay){var n=this._engine.getAlphaMode();this._engine.setAlphaMode(g.a.ALPHA_COMBINE),this.render(t,i,!0),this._engine.setAlphaMode(n)}e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i),this._engine.setColorWrite(!0))},e._StencilReference=4,e}(),eh=i(125),th=function(){function e(e,t){this.name=e,this.color=new s.b(1,1,1,1),this.width=1,this.height=1,this.angle=0,this.invertU=0,this.invertV=0,this.animations=new Array,this.isPickable=!1,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this.isVisible=!0,this._manager=t,this._manager.sprites.push(this),this.position=a.e.Zero()}return Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!0,configurable:!0}),e.prototype.playAnimation=function(e,t,i,n,r){this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=n,this._animationStarted=!0,ethis._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,(this._direction>0&&this.cellIndex>this._toIndex||this._direction<0&&this.cellIndex0?this._fromIndex:this._toIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onAnimationEnd&&this._onAnimationEnd(),this.disposeWhenFinishedAnimating&&this.dispose()))))},e.prototype.dispose=function(){for(var e=0;e0)for(var o=0;o=r.distance))&&(r=s,i))break}}return r||new In.a},K.a.prototype._internalMultiPickSprites=function(e,t,i){if(!In.a)return null;var n=new Array;if(!i){if(!this.activeCamera)return null;i=this.activeCamera}if(this.spriteManagers.length>0)for(var r=0;r0&&(i=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(r._pickedDownSprite=i.pickedSprite,n.button){case 0:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnLeftPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 1:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnCenterPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n));break;case 2:i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnRightPickTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickDownTrigger,u.a.CreateNewFromSprite(i.pickedSprite,r,n))}return i},e.prototype._pointerUp=function(e,t,i,n){var r=this.scene;if(r.spriteManagers.length>0){var o=r.pickSprite(e,t,this._spritePredicate,!1,r.cameraToUseForPointers||void 0);o&&(o.hit&&o.pickedSprite&&o.pickedSprite.actionManager&&(o.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickUpTrigger,u.a.CreateNewFromSprite(o.pickedSprite,r,n)),o.pickedSprite.actionManager&&(this.scene._inputManager._isPointerSwiping()||o.pickedSprite.actionManager.processTrigger(g.a.ACTION_OnPickTrigger,u.a.CreateNewFromSprite(o.pickedSprite,r,n)))),r._pickedDownSprite&&r._pickedDownSprite.actionManager&&r._pickedDownSprite!==o.pickedSprite&&r._pickedDownSprite.actionManager.processTrigger(g.a.ACTION_OnPickOutTrigger,u.a.CreateNewFromSprite(r._pickedDownSprite,r,n)))}return i},e}(),nh="uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest)\n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include\ngl_FragColor=color;\n}";ni.a.ShadersStore.spritesPixelShader=nh;var rh="\nattribute vec4 position;\nattribute vec4 options;\nattribute vec2 inverts;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include\nvoid main(void) {\nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz;\nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0);\n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-inverts.x),abs(1.0-offset.y-inverts.y));\nvec2 uvPlace=cellInfo.xy;\nvec2 uvSize=cellInfo.zw;\nvUV.x=uvPlace.x+uvSize.x*uvOffset.x;\nvUV.y=uvPlace.y+uvSize.y*uvOffset.y;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}";ni.a.ShadersStore.spritesVertexShader=rh;var oh,ah=function(){function e(e,t,i,n,r,a,s,c,l){if(void 0===a&&(a=.01),void 0===s&&(s=$e.a.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=!1),void 0===l&&(l=null),this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.fogEnabled=!0,this.isPickable=!1,this._packedAndReady=!1,this.onDisposeObservable=new o.c,this._vertexBuffers={},r._getComponent(Fe.a.NAME_SPRITE)||r._addComponent(new ih(r)),this._capacity=i,this._fromPacked=c,this._spriteTexture=new $e.a(t,r,!0,!1,s),this._spriteTexture.wrapU=$e.a.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=$e.a.CLAMP_ADDRESSMODE,n.width&&n.height)this.cellWidth=n.width,this.cellHeight=n.height;else{if(void 0===n)return;this.cellWidth=n,this.cellHeight=n}this._epsilon=a,this._scene=r,this._scene.spriteManagers.push(this);for(var u=[],h=0,d=0;d0);var s=e.substring(0,a-1)+".json",c=new XMLHttpRequest;c.open("GET",s,!0),c.onerror=function(){m.a.Error("Unable to Load Sprite JSON Data. Spritesheet managed with constant cell size."),i._fromPacked=!1,i._packedAndReady=!1},c.onload=function(){try{var e=JSON.parse(c.response),t=Reflect.ownKeys(e.frames);i._spriteMap=t,i._packedAndReady=!0,i._cellData=e.frames}catch(e){throw i._fromPacked=!1,i._packedAndReady=!1,new Error("Invalid JSON from file. Spritesheet managed with constant cell size.")}},c.send()}},e.prototype._appendSpriteVertex=function(e,t,i,n,r){var o=18*e;if(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===n?n=this._epsilon:1===n&&(n=1-this._epsilon),this._vertexData[o]=t.position.x,this._vertexData[o+1]=t.position.y,this._vertexData[o+2]=t.position.z,this._vertexData[o+3]=t.angle,this._vertexData[o+4]=t.width,this._vertexData[o+5]=t.height,this._vertexData[o+6]=i,this._vertexData[o+7]=n,this._vertexData[o+8]=t.invertU?1:0,this._vertexData[o+9]=t.invertV?1:0,this._packedAndReady){t.cellRef||(t.cellIndex=0);var a=t.cellIndex;"number"==typeof a&&isFinite(a)&&Math.floor(a)===a&&(t.cellRef=this._spriteMap[t.cellIndex]),this._vertexData[o+10]=this._cellData[t.cellRef].frame.x/r.width,this._vertexData[o+11]=this._cellData[t.cellRef].frame.y/r.height,this._vertexData[o+12]=this._cellData[t.cellRef].frame.w/r.width,this._vertexData[o+13]=this._cellData[t.cellRef].frame.h/r.height}else{t.cellIndex||(t.cellIndex=0);var s=r.width/this.cellWidth,c=t.cellIndex/s>>0;this._vertexData[o+10]=(t.cellIndex-c*s)*this.cellWidth/r.width,this._vertexData[o+11]=c*this.cellHeight/r.height,this._vertexData[o+12]=this.cellWidth/r.width,this._vertexData[o+13]=this.cellHeight/r.height}this._vertexData[o+14]=t.color.r,this._vertexData[o+15]=t.color.g,this._vertexData[o+16]=t.color.b,this._vertexData[o+17]=t.color.a},e.prototype.intersects=function(e,t,i,n){for(var r=Math.min(this._capacity,this.sprites.length),o=a.e.Zero(),s=a.e.Zero(),c=Number.MAX_VALUE,l=null,u=a.c.Vector3[0],h=a.c.Vector3[1],d=t.getViewMatrix(),f=0;f_&&(c=_,l=p,n))break}}}if(l){var m=new In.a;d.invertToRef(a.c.Matrix[0]),m.hit=!0,m.pickedSprite=l,m.distance=c;var g=a.c.Vector3[2];return g.copyFrom(e.direction),g.normalize(),g.scaleInPlace(c),e.origin.addToRef(g,u),m.pickedPoint=a.e.TransformCoordinates(u,a.c.Matrix[0]),m}return null},e.prototype.multiIntersects=function(e,t,i){for(var n,r=Math.min(this._capacity,this.sprites.length),o=a.e.Zero(),s=a.e.Zero(),c=[],l=a.c.Vector3[0].copyFromFloats(0,0,0),u=a.c.Vector3[1].copyFromFloats(0,0,0),h=t.getViewMatrix(),d=0;d-1&&this._tasks.splice(t,1)},e.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new dh(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){m.a.Error("Error running progress callbacks."),console.log(e)}if(0===this._waitingTasksCount){try{this.onFinish&&this.onFinish(this._tasks);for(var t=this._tasks.slice(),i=0,n=t;i-1&&this._tasks.splice(r,1)}}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){m.a.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,this.autoHideLoadingUI&&this._scene.getEngine().hideLoadingUI()}},e.prototype._runTask=function(e){var t=this,i=function(i,n){e._setErrorObject(i,n),t.onTaskError&&t.onTaskError(e),t.onTaskErrorObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)};e.run(this._scene,function(){try{t.onTaskSuccess&&t.onTaskSuccess(e),t.onTaskSuccessObservable.notifyObservers(e),t._decreaseWaitingTasksCount(e)}catch(e){i("Error executing task success callbacks",e)}},i)},e.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},e.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e=0&&this._meshes.splice(i,1),this._centerPosition=this._centerMesh.getAbsolutePosition().clone();for(var n=0;n0&&this._textureLoadingCallback(e)}this._currentScene.render()}},e.prototype.drag=function(e){e.stopPropagation(),e.preventDefault()},e.prototype.drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},e.prototype._traverseFolder=function(e,t,i,n){var r=this,o=e.createReader(),a=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");o.readEntries(function(e){i.count+=e.length;for(var o=0,s=e;o0)){for(var i=new Array,n=[],r=e.dataTransfer?e.dataTransfer.items:null,o=0;o0&&m.a.ClearLogCache(),this._engine.stopRenderLoop()),vn.LoadAsync("file:",this._sceneFileToLoad,this._engine,function(t){e._progressCallback&&e._progressCallback(t)}).then(function(t){e._currentScene&&e._currentScene.dispose(),e._currentScene=t,e._sceneLoadedCallback&&e._sceneLoadedCallback(e._sceneFileToLoad,e._currentScene),e._currentScene.executeWhenReady(function(){e._engine.runRenderLoop(function(){e.renderFunction()})})}).catch(function(t){e._errorCallback&&e._errorCallback(e._sceneFileToLoad,e._currentScene,t.message)})):m.a.Error("Please provide a valid .babylon file.")},e}(),Sh=i(121),Rh=i(120),xh=function(){function e(e){void 0===e&&(e=0),this.priority=e}return e.prototype.getDescription=function(){return""},e.prototype.apply=function(e,t){return!0},e}(),Ch=function(e){function t(t,i,n){void 0===t&&(t=0),void 0===i&&(i=1024),void 0===n&&(n=.5);var r=e.call(this,t)||this;return r.priority=t,r.maximumSize=i,r.step=n,r}return h.d(t,e),t.prototype.getDescription=function(){return"Reducing render target texture size to "+this.maximumSize},t.prototype.apply=function(e,t){for(var i=!0,n=0;nthis.maximumSize&&(r.scale(this.step),i=!1)}}return i},t}(xh),Mh=function(e){function t(t,i,n){void 0===t&&(t=0),void 0===i&&(i=2),void 0===n&&(n=.25);var r=e.call(this,t)||this;return r.priority=t,r.maximumScale=i,r.step=n,r._currentScale=-1,r._directionOffset=1,r}return h.d(t,e),t.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},t.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},t}(xh),Oh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning shadows on/off"},t.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},t}(xh),Ih=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning post-processes on/off"},t.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},t}(xh),Dh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning lens flares on/off"},t.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},t}(xh),Lh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},t.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},t}(xh),wh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning particles on/off"},t.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},t}(xh),Fh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h.d(t,e),t.prototype.getDescription=function(){return"Turning render targets off"},t.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},t}(xh),Nh=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._canBeMerged=function(e){if(!(e instanceof Se.a))return!1;var t=e;return!t.isDisposed()&&(!(!t.isVisible||!t.isEnabled())&&(!(t.instances.length>0)&&(!t.skeleton&&!t.hasLODLevels)))},t}return h.d(t,e),Object.defineProperty(t,"UpdateSelectionTree",{get:function(){return t._UpdateSelectionTree},set:function(e){t._UpdateSelectionTree=e},enumerable:!0,configurable:!0}),t.prototype.getDescription=function(){return"Merging similar meshes together"},t.prototype.apply=function(e,i,n){for(var r=e.meshes.slice(0),o=r.length,a=0;a=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var n=!0,r=!0,o=0;o0){o.animationGroups=[];for(var h=0;h0)for(o.reflectionProbes=[],i=0;i0&&setTimeout(function(){i.stopRecording()},1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise(function(e,t){i._resolve=e,i._reject=t})},e.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},e.prototype._handleDataAvailable=function(e){e.data.size>0&&this._recordedChunks.push(e.data)},e.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},e.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&Ie.b.Download(e,this._fileName)},e._defaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},e}(),Xh=function(){function e(){}return e.CreateScreenshot=function(t,i,n,r,o){void 0===o&&(o="image/png");var a=e._getScreenshotSize(t,i,n),s=a.height,c=a.width;if(s&&c){Ie.b._ScreenshotCanvas||(Ie.b._ScreenshotCanvas=document.createElement("canvas")),Ie.b._ScreenshotCanvas.width=c,Ie.b._ScreenshotCanvas.height=s;var l=Ie.b._ScreenshotCanvas.getContext("2d"),u=t.getRenderWidth()/t.getRenderHeight(),h=c,d=h/u;d>s&&(h=(d=s)*u);var f=Math.max(0,c-h)/2,p=Math.max(0,s-d)/2,_=t.getRenderingCanvas();l&&_&&l.drawImage(_,f,p,h,d),Ie.b.EncodeScreenshotCanvasData(r,o)}else m.a.Error("Invalid 'size' parameter !")},e.CreateScreenshotAsync=function(t,i,n,r){return void 0===r&&(r="image/png"),new Promise(function(o,a){e.CreateScreenshot(t,i,n,function(e){void 0!==e?o(e):a(new Error("Data is undefined"))},r)})},e.CreateScreenshotUsingRenderTarget=function(t,i,n,r,o,a,s,c){void 0===o&&(o="image/png"),void 0===a&&(a=1),void 0===s&&(s=!1);var l=e._getScreenshotSize(t,i,n),u=l.height,h=l.width,d={width:h,height:u};if(u&&h){var f=i.getScene(),p=null;f.activeCamera!==i&&(p=f.activeCamera,f.activeCamera=i);var _=t.getRenderingCanvas();if(_){var v={width:_.width,height:_.height};t.setSize(h,u),f.render();var y=new Oi("screenShot",d,f,!1,!1,g.a.TEXTURETYPE_UNSIGNED_INT,!1,$e.a.NEAREST_SAMPLINGMODE);y.renderList=null,y.samples=a,s&&y.addPostProcess(new ou("antialiasing",1,f.activeCamera)),y.onAfterRenderObservable.add(function(){Ie.b.DumpFramebuffer(h,u,t,r,o,c)}),f.incrementRenderId(),f.resetCachedMaterial(),y.render(!0),y.dispose(),p&&(f.activeCamera=p),t.setSize(v.width,v.height),i.getProjectionMatrix(!0)}else m.a.Error("No rendering canvas found !")}else m.a.Error("Invalid 'size' parameter !")},e.CreateScreenshotUsingRenderTargetAsync=function(t,i,n,r,o,a,s){return void 0===r&&(r="image/png"),void 0===o&&(o=1),void 0===a&&(a=!1),new Promise(function(c,l){e.CreateScreenshotUsingRenderTarget(t,i,n,function(e){void 0!==e?c(e):l(new Error("Data is undefined"))},r,o,a,s)})},e._getScreenshotSize=function(e,t,i){var n=0,r=0;if("object"==typeof i){var o=i.precision?Math.abs(i.precision):1;i.width&&i.height?(n=i.height*o,r=i.width*o):i.width&&!i.height?(r=i.width*o,n=Math.round(r/e.getAspectRatio(t))):i.height&&!i.width?(n=i.height*o,r=Math.round(n*e.getAspectRatio(t))):(r=Math.round(e.getRenderWidth()*o),n=Math.round(r/e.getAspectRatio(t)))}else isNaN(i)||(n=i,r=i);return{height:n,width:r}},e}();Ie.b.CreateScreenshot=Xh.CreateScreenshot,Ie.b.CreateScreenshotAsync=Xh.CreateScreenshotAsync,Ie.b.CreateScreenshotUsingRenderTarget=Xh.CreateScreenshotUsingRenderTarget,Ie.b.CreateScreenshotUsingRenderTargetAsync=Xh.CreateScreenshotUsingRenderTargetAsync,function(e){e[e.Checkbox=0]="Checkbox",e[e.Slider=1]="Slider",e[e.Vector3=2]="Vector3",e[e.Quaternion=3]="Quaternion",e[e.Color3=4]="Color3",e[e.String=5]="String"}(uh||(uh={}));var Yh=i(119),Kh=i(118);i.d(t,"AbstractScene",function(){return n.a}),i.d(t,"AbstractActionManager",function(){return r.a}),i.d(t,"Action",function(){return l}),i.d(t,"ActionEvent",function(){return u.a}),i.d(t,"ActionManager",function(){return O}),i.d(t,"Condition",function(){return d}),i.d(t,"ValueCondition",function(){return f}),i.d(t,"PredicateCondition",function(){return p}),i.d(t,"StateCondition",function(){return _}),i.d(t,"SwitchBooleanAction",function(){return v}),i.d(t,"SetStateAction",function(){return y}),i.d(t,"SetValueAction",function(){return b}),i.d(t,"IncrementValueAction",function(){return T}),i.d(t,"PlayAnimationAction",function(){return E}),i.d(t,"StopAnimationAction",function(){return A}),i.d(t,"DoNothingAction",function(){return P}),i.d(t,"CombineAction",function(){return S}),i.d(t,"ExecuteCodeAction",function(){return R}),i.d(t,"SetParentAction",function(){return x}),i.d(t,"PlaySoundAction",function(){return I}),i.d(t,"StopSoundAction",function(){return D}),i.d(t,"InterpolateValueAction",function(){return G}),i.d(t,"Animatable",function(){return $}),i.d(t,"_IAnimationState",function(){return V}),i.d(t,"Animation",function(){return k}),i.d(t,"TargetedAnimation",function(){return te}),i.d(t,"AnimationGroup",function(){return ie}),i.d(t,"AnimationPropertiesOverride",function(){return ne}),i.d(t,"EasingFunction",function(){return he}),i.d(t,"CircleEase",function(){return de}),i.d(t,"BackEase",function(){return fe}),i.d(t,"BounceEase",function(){return pe}),i.d(t,"CubicEase",function(){return _e}),i.d(t,"ElasticEase",function(){return me}),i.d(t,"ExponentialEase",function(){return ge}),i.d(t,"PowerEase",function(){return ve}),i.d(t,"QuadraticEase",function(){return ye}),i.d(t,"QuarticEase",function(){return be}),i.d(t,"QuinticEase",function(){return Te}),i.d(t,"SineEase",function(){return Ee}),i.d(t,"BezierCurveEase",function(){return Ae}),i.d(t,"RuntimeAnimation",function(){return Y}),i.d(t,"AnimationEvent",function(){return Pe}),i.d(t,"AnimationKeyInterpolation",function(){return L}),i.d(t,"AnimationRange",function(){return N}),i.d(t,"KeepAssets",function(){return Re}),i.d(t,"AssetContainer",function(){return xe}),i.d(t,"Analyser",function(){return Me}),i.d(t,"AudioEngine",function(){return Oe}),i.d(t,"AudioSceneComponent",function(){return Ne}),i.d(t,"Sound",function(){return Le}),i.d(t,"SoundTrack",function(){return we}),i.d(t,"WeightedSound",function(){return Be}),i.d(t,"AutoRotationBehavior",function(){return Ve}),i.d(t,"BouncingBehavior",function(){return ke}),i.d(t,"FramingBehavior",function(){return Ge}),i.d(t,"AttachToBoxBehavior",function(){return je}),i.d(t,"FadeInOutBehavior",function(){return We}),i.d(t,"MultiPointerScaleBehavior",function(){return Xe}),i.d(t,"PointerDragBehavior",function(){return He.a}),i.d(t,"SixDofDragBehavior",function(){return qe}),i.d(t,"Bone",function(){return J}),i.d(t,"BoneIKController",function(){return Ze}),i.d(t,"BoneLookController",function(){return Je}),i.d(t,"Skeleton",function(){return it}),i.d(t,"CameraInputTypes",function(){return nt}),i.d(t,"CameraInputsManager",function(){return rt}),i.d(t,"Camera",function(){return Ke.a}),i.d(t,"TargetCamera",function(){return It}),i.d(t,"FreeCamera",function(){return Dt}),i.d(t,"FreeCameraInputsManager",function(){return Pt}),i.d(t,"TouchCamera",function(){return Lt}),i.d(t,"ArcRotateCamera",function(){return wt}),i.d(t,"ArcRotateCameraInputsManager",function(){return pt}),i.d(t,"DeviceOrientationCamera",function(){return Ft}),i.d(t,"FlyCamera",function(){return Bt}),i.d(t,"FlyCameraInputsManager",function(){return Nt}),i.d(t,"FollowCamera",function(){return kt}),i.d(t,"ArcFollowCamera",function(){return Gt}),i.d(t,"FollowCameraInputsManager",function(){return Ut}),i.d(t,"GamepadCamera",function(){return ti}),i.d(t,"UniversalCamera",function(){return ei}),i.d(t,"VirtualJoysticksCamera",function(){return Ei}),i.d(t,"ArcRotateCameraGamepadInput",function(){return ct}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return ut}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return ht}),i.d(t,"ArcRotateCameraPointersInput",function(){return ft}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return _t}),i.d(t,"FlyCameraKeyboardInput",function(){return mt}),i.d(t,"FlyCameraMouseInput",function(){return gt}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return vt}),i.d(t,"FollowCameraMouseWheelInput",function(){return yt}),i.d(t,"FollowCameraPointersInput",function(){return bt}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return St}),i.d(t,"FreeCameraGamepadInput",function(){return Rt}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return Tt}),i.d(t,"FreeCameraMouseInput",function(){return Et}),i.d(t,"FreeCameraTouchInput",function(){return At}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return Ot}),i.d(t,"AnaglyphArcRotateCamera",function(){return di}),i.d(t,"AnaglyphFreeCamera",function(){return fi}),i.d(t,"AnaglyphGamepadCamera",function(){return pi}),i.d(t,"AnaglyphUniversalCamera",function(){return _i}),i.d(t,"StereoscopicArcRotateCamera",function(){return vi}),i.d(t,"StereoscopicFreeCamera",function(){return yi}),i.d(t,"StereoscopicGamepadCamera",function(){return bi}),i.d(t,"StereoscopicUniversalCamera",function(){return Ti}),i.d(t,"VRCameraMetrics",function(){return Ai}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return Fi}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return Ni}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return Bi}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return nn}),i.d(t,"VRExperienceHelper",function(){return rn}),i.d(t,"WebVRFreeCamera",function(){return Vi}),i.d(t,"WebXRCamera",function(){return on}),i.d(t,"WebXREnterExitUIButton",function(){return cn}),i.d(t,"WebXREnterExitUIOptions",function(){return ln}),i.d(t,"WebXREnterExitUI",function(){return un}),i.d(t,"WebXRState",function(){return qi}),i.d(t,"WebXRExperienceHelper",function(){return sn}),i.d(t,"WebXRInput",function(){return dn}),i.d(t,"WebXRControllerTeleportation",function(){return fn}),i.d(t,"WebXRControllerPointerSelection",function(){return pn}),i.d(t,"WebXRControllerModelLoader",function(){return Sn}),i.d(t,"WebXRController",function(){return hn}),i.d(t,"WebXRManagedOutputCanvas",function(){return Rn}),i.d(t,"WebXRSessionManager",function(){return an}),i.d(t,"Collider",function(){return Mn}),i.d(t,"DefaultCollisionCoordinator",function(){return On}),i.d(t,"PickingInfo",function(){return In.a}),i.d(t,"IntersectionInfo",function(){return Dn.a}),i.d(t,"_MeshCollisionData",function(){return Ln.a}),i.d(t,"BoundingBox",function(){return wn.a}),i.d(t,"BoundingInfo",function(){return Fn.a}),i.d(t,"BoundingSphere",function(){return Nn.a}),i.d(t,"Ray",function(){return jt.a}),i.d(t,"Octree",function(){return Un}),i.d(t,"OctreeBlock",function(){return Bn}),i.d(t,"OctreeSceneComponent",function(){return Vn}),i.d(t,"AxesViewer",function(){return kn.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return kn.BoneAxesViewer}),i.d(t,"DebugLayer",function(){return kn.DebugLayer}),i.d(t,"PhysicsViewer",function(){return kn.PhysicsViewer}),i.d(t,"RayHelper",function(){return kn.RayHelper}),i.d(t,"SkeletonViewer",function(){return kn.SkeletonViewer}),i.d(t,"Constants",function(){return g.a}),i.d(t,"InstancingAttributeInfo",function(){return Ce.d}),i.d(t,"DepthTextureCreationOptions",function(){return Ce.a}),i.d(t,"EngineCapabilities",function(){return Ce.c}),i.d(t,"Engine",function(){return Ce.b}),i.d(t,"EngineStore",function(){return C.a}),i.d(t,"NullEngineOptions",function(){return Gn.b}),i.d(t,"NullEngine",function(){return Gn.a}),i.d(t,"WebGLPipelineContext",function(){return Wn.a}),i.d(t,"WebGL2ShaderProcessor",function(){return Hn.a}),i.d(t,"_OcclusionDataStorage",function(){return jn}),i.d(t,"_forceTransformFeedbackToBundle",function(){return!0}),i.d(t,"KeyboardEventTypes",function(){return lt.a}),i.d(t,"KeyboardInfo",function(){return lt.b}),i.d(t,"KeyboardInfoPre",function(){return lt.c}),i.d(t,"PointerEventTypes",function(){return Ue.a}),i.d(t,"PointerInfoBase",function(){return Ue.c}),i.d(t,"PointerInfoPre",function(){return Ue.d}),i.d(t,"PointerInfo",function(){return Ue.b}),i.d(t,"ClipboardEventTypes",function(){return Xn}),i.d(t,"ClipboardInfo",function(){return Yn}),i.d(t,"StickValues",function(){return ot}),i.d(t,"Gamepad",function(){return at}),i.d(t,"GenericPad",function(){return st}),i.d(t,"GamepadManager",function(){return Jt}),i.d(t,"GamepadSystemSceneComponent",function(){return $t}),i.d(t,"Xbox360Button",function(){return Wt}),i.d(t,"Xbox360Dpad",function(){return Ht}),i.d(t,"Xbox360Pad",function(){return qt}),i.d(t,"DualShockButton",function(){return Kt}),i.d(t,"DualShockDpad",function(){return Qt}),i.d(t,"DualShockPad",function(){return Zt}),i.d(t,"DaydreamController",function(){return Kn}),i.d(t,"GearVRController",function(){return Qn}),i.d(t,"GenericController",function(){return yn}),i.d(t,"OculusTouchController",function(){return En}),i.d(t,"PoseEnabledControllerType",function(){return Vt}),i.d(t,"PoseEnabledControllerHelper",function(){return Xt}),i.d(t,"PoseEnabledController",function(){return Yt}),i.d(t,"ViveController",function(){return An}),i.d(t,"WebVRController",function(){return ki}),i.d(t,"WindowsMotionController",function(){return Tn}),i.d(t,"AxisDragGizmo",function(){return qn.a}),i.d(t,"AxisScaleGizmo",function(){return er}),i.d(t,"BoundingBoxGizmo",function(){return nr}),i.d(t,"Gizmo",function(){return Jn.a}),i.d(t,"GizmoManager",function(){return dr}),i.d(t,"PlaneRotationGizmo",function(){return rr}),i.d(t,"PositionGizmo",function(){return lr}),i.d(t,"RotationGizmo",function(){return or}),i.d(t,"ScaleGizmo",function(){return hr}),i.d(t,"LightGizmo",function(){return vr}),i.d(t,"PlaneDragGizmo",function(){return cr}),i.d(t,"EnvironmentHelper",function(){return kr}),i.d(t,"PhotoDome",function(){return Gr}),i.d(t,"_forceSceneHelpersToBundle",function(){return!0}),i.d(t,"VideoDome",function(){return Do}),i.d(t,"EngineInstrumentation",function(){return wo}),i.d(t,"SceneInstrumentation",function(){return Fo}),i.d(t,"_TimeToken",function(){return zn}),i.d(t,"EffectLayer",function(){return Vo}),i.d(t,"EffectLayerSceneComponent",function(){return ko}),i.d(t,"GlowLayer",function(){return jo}),i.d(t,"HighlightLayer",function(){return Xo}),i.d(t,"Layer",function(){return qo}),i.d(t,"LayerSceneComponent",function(){return Yo}),i.d(t,"LensFlare",function(){return Zo}),i.d(t,"LensFlareSystem",function(){return ea}),i.d(t,"LensFlareSystemSceneComponent",function(){return ta}),i.d(t,"Light",function(){return fr.a}),i.d(t,"ShadowLight",function(){return pr}),i.d(t,"DirectionalLight",function(){return _r}),i.d(t,"HemisphericLight",function(){return Ui.a}),i.d(t,"PointLight",function(){return sa}),i.d(t,"SpotLight",function(){return gr}),i.d(t,"ShadowGenerator",function(){return oa}),i.d(t,"ShadowGeneratorSceneComponent",function(){return aa}),i.d(t,"DefaultLoadingScreen",function(){return ca}),i.d(t,"SceneLoaderProgressEvent",function(){return gn}),i.d(t,"SceneLoader",function(){return vn}),i.d(t,"SceneLoaderFlags",function(){return mn.a}),i.d(t,"_BabylonLoaderRegistered",function(){return!0}),i.d(t,"ColorCurves",function(){return Da.a}),i.d(t,"EffectFallbacks",function(){return ni.c}),i.d(t,"EffectCreationOptions",function(){return ni.b}),i.d(t,"Effect",function(){return ni.a}),i.d(t,"FresnelParameters",function(){return La}),i.d(t,"ImageProcessingConfigurationDefines",function(){return Gi.b}),i.d(t,"ImageProcessingConfiguration",function(){return Gi.a}),i.d(t,"Material",function(){return No.a}),i.d(t,"MaterialDefines",function(){return Or.a}),i.d(t,"MaterialHelper",function(){return Mr.a}),i.d(t,"MultiMaterial",function(){return ua.a}),i.d(t,"PushMaterial",function(){return Ir.a}),i.d(t,"ShaderMaterial",function(){return Ba.a}),i.d(t,"StandardMaterialDefines",function(){return zi.b}),i.d(t,"StandardMaterial",function(){return zi.a}),i.d(t,"BaseTexture",function(){return yr.a}),i.d(t,"CubeTexture",function(){return Cr}),i.d(t,"DynamicTexture",function(){return ji}),i.d(t,"EquiRectangularCubeTexture",function(){return Va}),i.d(t,"HDRCubeTexture",function(){return fa}),i.d(t,"InternalTexture",function(){return et.a}),i.d(t,"MirrorTexture",function(){return Rr}),i.d(t,"MultiRenderTarget",function(){return Xa}),i.d(t,"RawTexture",function(){return tt}),i.d(t,"RenderTargetTexture",function(){return Oi}),i.d(t,"Texture",function(){return $e.a}),i.d(t,"UniformBuffer",function(){return xi.a}),i.d(t,"MaterialFlags",function(){return Dr.a}),i.d(t,"EffectRenderer",function(){return Qs}),i.d(t,"EffectWrapper",function(){return qs}),i.d(t,"BackgroundMaterial",function(){return Vr}),i.d(t,"PBRMaterialDefines",function(){return uo}),i.d(t,"PBRBaseMaterial",function(){return ho}),i.d(t,"PBRBaseSimpleMaterial",function(){return wa}),i.d(t,"PBRMaterial",function(){return fo}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return Fa}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return Na}),i.d(t,"ColorGradingTexture",function(){return Ua}),i.d(t,"ProceduralTexture",function(){return Qa}),i.d(t,"RawCubeTexture",function(){return is}),i.d(t,"RawTexture3D",function(){return ns}),i.d(t,"RefractionTexture",function(){return rs}),i.d(t,"VideoTexture",function(){return Mo}),i.d(t,"HtmlElementTexture",function(){return os}),i.d(t,"NodeMaterialBlockTargets",function(){return es}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return ts}),i.d(t,"NodeMaterialConnectionPoint",function(){return as}),i.d(t,"NodeMaterialBlock",function(){return cs}),i.d(t,"NodeMaterialDefines",function(){return vs}),i.d(t,"NodeMaterial",function(){return ys}),i.d(t,"NodeMaterialWellKnownValues",function(){return ps}),i.d(t,"_DDSTextureLoader",function(){return Eo}),i.d(t,"_ENVTextureLoader",function(){return So}),i.d(t,"_KTXTextureLoader",function(){return xo}),i.d(t,"_TGATextureLoader",function(){return Ga}),i.d(t,"_BasisTextureLoader",function(){return Ha}),i.d(t,"CustomProceduralTexture",function(){return Za}),i.d(t,"NoiseProceduralTexture",function(){return $a}),i.d(t,"ProceduralTextureSceneComponent",function(){return Ya}),i.d(t,"MultiplyBlock",function(){return Os}),i.d(t,"AddBlock",function(){return Is}),i.d(t,"ScaleBlock",function(){return Ds}),i.d(t,"ClampBlock",function(){return Ls}),i.d(t,"CrossBlock",function(){return ws}),i.d(t,"DotBlock",function(){return Fs}),i.d(t,"TransformBlock",function(){return hs}),i.d(t,"RemapBlock",function(){return Ns}),i.d(t,"NormalizeBlock",function(){return Us}),i.d(t,"TrigonometryBlockOperations",function(){return Bs}),i.d(t,"TrigonometryBlock",function(){return Vs}),i.d(t,"ColorMergerBlock",function(){return ks}),i.d(t,"VectorMergerBlock",function(){return Gs}),i.d(t,"ColorSplitterBlock",function(){return zs}),i.d(t,"VectorSplitterBlock",function(){return js}),i.d(t,"LerpBlock",function(){return Ws}),i.d(t,"DivideBlock",function(){return Hs}),i.d(t,"SubtractBlock",function(){return Xs}),i.d(t,"StepBlock",function(){return Ys}),i.d(t,"NodeMaterialOptimizer",function(){return Ks}),i.d(t,"VertexOutputBlock",function(){return ds}),i.d(t,"BonesBlock",function(){return bs}),i.d(t,"InstancesBlock",function(){return Ts}),i.d(t,"MorphTargetsBlock",function(){return Es}),i.d(t,"FragmentOutputBlock",function(){return ms}),i.d(t,"AlphaTestBlock",function(){return As}),i.d(t,"FresnelBlock",function(){return Ps}),i.d(t,"ImageProcessingBlock",function(){return Ss}),i.d(t,"FogBlock",function(){return Rs}),i.d(t,"LightBlock",function(){return xs}),i.d(t,"TextureBlock",function(){return Cs}),i.d(t,"ReflectionTextureBlock",function(){return Ms}),i.d(t,"InputBlock",function(){return gs}),i.d(t,"AnimatedInputBlockTypes",function(){return _s}),i.d(t,"Scalar",function(){return w.a}),i.d(t,"Space",function(){return Z.b}),i.d(t,"Axis",function(){return Z.a}),i.d(t,"Color3",function(){return s.a}),i.d(t,"Color4",function(){return s.b}),i.d(t,"TmpColors",function(){return s.c}),i.d(t,"ToGammaSpace",function(){return re.b}),i.d(t,"ToLinearSpace",function(){return re.c}),i.d(t,"Epsilon",function(){return re.a}),i.d(t,"Frustum",function(){return Di.a}),i.d(t,"Plane",function(){return xn.a}),i.d(t,"Size",function(){return U.a}),i.d(t,"Vector2",function(){return a.d}),i.d(t,"Vector3",function(){return a.e}),i.d(t,"Vector4",function(){return a.f}),i.d(t,"Quaternion",function(){return a.b}),i.d(t,"Matrix",function(){return a.a}),i.d(t,"TmpVectors",function(){return a.c}),i.d(t,"Viewport",function(){return wi.a}),i.d(t,"SphericalHarmonics",function(){return po.a}),i.d(t,"SphericalPolynomial",function(){return po.b}),i.d(t,"Orientation",function(){return ee}),i.d(t,"BezierCurve",function(){return oe}),i.d(t,"Angle",function(){return ae}),i.d(t,"Arc2",function(){return se}),i.d(t,"Path2",function(){return ce}),i.d(t,"Path3D",function(){return le}),i.d(t,"Curve3",function(){return ue}),i.d(t,"PositionNormalVertex",function(){return Oo}),i.d(t,"PositionNormalTextureVertex",function(){return Io}),i.d(t,"AbstractMesh",function(){return Ye.a}),i.d(t,"Buffer",function(){return Yi.a}),i.d(t,"VertexBuffer",function(){return Yi.b}),i.d(t,"CSG",function(){return lc}),i.d(t,"Geometry",function(){return la.a}),i.d(t,"GroundMesh",function(){return Ki}),i.d(t,"TrailMesh",function(){return uc}),i.d(t,"InstancedMesh",function(){return hc.a}),i.d(t,"LinesMesh",function(){return dc.b}),i.d(t,"InstancedLinesMesh",function(){return dc.a}),i.d(t,"_CreationDataStorage",function(){return Se.b}),i.d(t,"_InstancesBatch",function(){return Se.c}),i.d(t,"Mesh",function(){return Se.a}),i.d(t,"VertexData",function(){return Xi.a}),i.d(t,"MeshBuilder",function(){return xc}),i.d(t,"SimplificationSettings",function(){return Cc}),i.d(t,"SimplificationQueue",function(){return Mc}),i.d(t,"SimplificationType",function(){return Sc}),i.d(t,"SimplicationQueueSceneComponent",function(){return Fc}),i.d(t,"Polygon",function(){return vc}),i.d(t,"PolygonMeshBuilder",function(){return yc}),i.d(t,"BaseSubMesh",function(){return nc.a}),i.d(t,"SubMesh",function(){return nc.b}),i.d(t,"MeshLODLevel",function(){return Nc.a}),i.d(t,"TransformNode",function(){return ar.a}),i.d(t,"BoxBuilder",function(){return Zn.a}),i.d(t,"SphereBuilder",function(){return tr.a}),i.d(t,"CylinderBuilder",function(){return Ji.a}),i.d(t,"TorusBuilder",function(){return Zi}),i.d(t,"LinesBuilder",function(){return ir.a}),i.d(t,"PlaneBuilder",function(){return sr.a}),i.d(t,"GroundBuilder",function(){return Qi}),i.d(t,"DataBuffer",function(){return Bc.a}),i.d(t,"WebGLDataBuffer",function(){return Uc.a}),i.d(t,"DracoCompression",function(){return ic}),i.d(t,"TiledBoxBuilder",function(){return pc}),i.d(t,"DiscBuilder",function(){return fc}),i.d(t,"RibbonBuilder",function(){return Ea}),i.d(t,"HemisphereBuilder",function(){return mr}),i.d(t,"TorusKnotBuilder",function(){return _c}),i.d(t,"PolygonBuilder",function(){return bc}),i.d(t,"ShapeBuilder",function(){return Aa}),i.d(t,"LatheBuilder",function(){return Tc}),i.d(t,"TiledPlaneBuilder",function(){return Ec}),i.d(t,"TubeBuilder",function(){return Ac}),i.d(t,"PolyhedronBuilder",function(){return ur}),i.d(t,"IcoSphereBuilder",function(){return Pc}),i.d(t,"DecalBuilder",function(){return Rc}),i.d(t,"MorphTarget",function(){return pa}),i.d(t,"MorphTargetManager",function(){return _a}),i.d(t,"RecastJSPlugin",function(){return Vc}),i.d(t,"RecastJSCrowd",function(){return kc}),i.d(t,"Node",function(){return B.a}),i.d(t,"Database",function(){return zc}),i.d(t,"BaseParticleSystem",function(){return Zc}),i.d(t,"GPUParticleSystem",function(){return dl}),i.d(t,"Particle",function(){return il}),i.d(t,"ParticleHelper",function(){return pl}),i.d(t,"ParticleSystem",function(){return al}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return 42}),i.d(t,"ParticleSystemSet",function(){return fl}),i.d(t,"SolidParticle",function(){return _l}),i.d(t,"ModelShape",function(){return ml}),i.d(t,"DepthSortedParticle",function(){return gl}),i.d(t,"SolidParticleSystem",function(){return yl}),i.d(t,"SubEmitterType",function(){return Gc}),i.d(t,"SubEmitter",function(){return nl}),i.d(t,"BoxParticleEmitter",function(){return jc}),i.d(t,"ConeParticleEmitter",function(){return Wc}),i.d(t,"CylinderParticleEmitter",function(){return Hc}),i.d(t,"CylinderDirectedParticleEmitter",function(){return Xc}),i.d(t,"HemisphericParticleEmitter",function(){return Yc}),i.d(t,"PointParticleEmitter",function(){return Kc}),i.d(t,"SphereParticleEmitter",function(){return Qc}),i.d(t,"SphereDirectedParticleEmitter",function(){return qc}),i.d(t,"PhysicsEngine",function(){return va}),i.d(t,"PhysicsEngineSceneComponent",function(){return El}),i.d(t,"PhysicsHelper",function(){return Al}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return Cl}),i.d(t,"PhysicsUpdraftEventOptions",function(){return Ml}),i.d(t,"PhysicsVortexEventOptions",function(){return Ol}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return bl}),i.d(t,"PhysicsUpdraftMode",function(){return Tl}),i.d(t,"PhysicsImpostor",function(){return ma.a}),i.d(t,"PhysicsJoint",function(){return ga.e}),i.d(t,"DistanceJoint",function(){return ga.a}),i.d(t,"MotorEnabledJoint",function(){return ga.d}),i.d(t,"HingeJoint",function(){return ga.c}),i.d(t,"Hinge2Joint",function(){return ga.b}),i.d(t,"CannonJSPlugin",function(){return ba}),i.d(t,"AmmoJSPlugin",function(){return Pa}),i.d(t,"OimoJSPlugin",function(){return Ta}),i.d(t,"AnaglyphPostProcess",function(){return hi}),i.d(t,"BlackAndWhitePostProcess",function(){return Dl}),i.d(t,"BloomEffect",function(){return Ul}),i.d(t,"BloomMergePostProcess",function(){return Bl}),i.d(t,"BlurPostProcess",function(){return Sr}),i.d(t,"ChromaticAberrationPostProcess",function(){return kl}),i.d(t,"CircleOfConfusionPostProcess",function(){return zl}),i.d(t,"ColorCorrectionPostProcess",function(){return Wl}),i.d(t,"ConvolutionPostProcess",function(){return Xl}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return Yl}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return Ql}),i.d(t,"DepthOfFieldEffect",function(){return Jl}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return ql}),i.d(t,"DepthOfFieldMergePostProcess",function(){return Zl}),i.d(t,"DisplayPassPostProcess",function(){return eu}),i.d(t,"ExtractHighlightsPostProcess",function(){return Fl}),i.d(t,"FilterPostProcess",function(){return iu}),i.d(t,"FxaaPostProcess",function(){return ou}),i.d(t,"GrainPostProcess",function(){return su}),i.d(t,"HighlightsPostProcess",function(){return lu}),i.d(t,"ImageProcessingPostProcess",function(){return Hi}),i.d(t,"MotionBlurPostProcess",function(){return _u}),i.d(t,"PassPostProcess",function(){return ci}),i.d(t,"PassCubePostProcess",function(){return li}),i.d(t,"PostProcess",function(){return oi}),i.d(t,"PostProcessManager",function(){return Ci.a}),i.d(t,"RefractionPostProcess",function(){return gu}),i.d(t,"SharpenPostProcess",function(){return yu}),i.d(t,"StereoscopicInterlacePostProcess",function(){return gi}),i.d(t,"TonemappingOperator",function(){return Fu}),i.d(t,"TonemapPostProcess",function(){return Nu}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return Gu}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return Si}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return Li}),i.d(t,"PostProcessRenderEffect",function(){return Ll}),i.d(t,"PostProcessRenderPipeline",function(){return bu}),i.d(t,"PostProcessRenderPipelineManager",function(){return Tu}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return Eu}),i.d(t,"DefaultRenderingPipeline",function(){return Au}),i.d(t,"LensRenderingPipeline",function(){return Ru}),i.d(t,"SSAO2RenderingPipeline",function(){return Mu}),i.d(t,"SSAORenderingPipeline",function(){return Iu}),i.d(t,"StandardRenderingPipeline",function(){return Lu}),i.d(t,"ReflectionProbe",function(){return Sa}),i.d(t,"BoundingBoxRenderer",function(){return zu}),i.d(t,"DepthRenderer",function(){return Wu}),i.d(t,"DepthRendererSceneComponent",function(){return Hu}),i.d(t,"EdgesRenderer",function(){return Qu}),i.d(t,"LineEdgesRenderer",function(){return qu}),i.d(t,"GeometryBufferRenderer",function(){return du}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return fu}),i.d(t,"OutlineRenderer",function(){return $u}),i.d(t,"RenderingGroup",function(){return eh.a}),i.d(t,"RenderingGroupInfo",function(){return Mi.a}),i.d(t,"RenderingManager",function(){return Mi.b}),i.d(t,"UtilityLayerRenderer",function(){return $n.a}),i.d(t,"Scene",function(){return K.a}),i.d(t,"SceneComponentConstants",function(){return Fe.a}),i.d(t,"Stage",function(){return Fe.b}),i.d(t,"Sprite",function(){return th}),i.d(t,"SpriteManager",function(){return ah}),i.d(t,"SpritePackedManager",function(){return sh}),i.d(t,"SpriteSceneComponent",function(){return ih}),i.d(t,"_AlphaState",function(){return ch.a}),i.d(t,"_DepthCullingState",function(){return ch.b}),i.d(t,"_StencilState",function(){return ch.c}),i.d(t,"AndOrNotEvaluator",function(){return lh.a}),i.d(t,"AssetTaskState",function(){return oh}),i.d(t,"AbstractAssetTask",function(){return hh}),i.d(t,"AssetsProgressEvent",function(){return dh}),i.d(t,"MeshAssetTask",function(){return fh}),i.d(t,"TextFileAssetTask",function(){return ph}),i.d(t,"BinaryFileAssetTask",function(){return _h}),i.d(t,"ImageAssetTask",function(){return mh}),i.d(t,"TextureAssetTask",function(){return gh}),i.d(t,"CubeTextureAssetTask",function(){return vh}),i.d(t,"HDRCubeTextureAssetTask",function(){return yh}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return bh}),i.d(t,"AssetsManager",function(){return Th}),i.d(t,"DDSTools",function(){return To}),i.d(t,"expandToProperty",function(){return F.b}),i.d(t,"serialize",function(){return F.c}),i.d(t,"serializeAsTexture",function(){return F.m}),i.d(t,"serializeAsColor3",function(){return F.e}),i.d(t,"serializeAsFresnelParameters",function(){return F.h}),i.d(t,"serializeAsVector2",function(){return F.n}),i.d(t,"serializeAsVector3",function(){return F.o}),i.d(t,"serializeAsMeshReference",function(){return F.k}),i.d(t,"serializeAsColorCurves",function(){return F.g}),i.d(t,"serializeAsColor4",function(){return F.f}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return F.i}),i.d(t,"serializeAsQuaternion",function(){return F.l}),i.d(t,"serializeAsMatrix",function(){return F.j}),i.d(t,"serializeAsCameraReference",function(){return F.d}),i.d(t,"SerializationHelper",function(){return F.a}),i.d(t,"Deferred",function(){return Eh}),i.d(t,"EnvironmentTextureTools",function(){return Po}),i.d(t,"MeshExploder",function(){return Ah}),i.d(t,"FilesInput",function(){return Ph}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return _o.a}),i.d(t,"KhronosTextureContainer",function(){return Ro}),i.d(t,"EventState",function(){return o.a}),i.d(t,"Observer",function(){return o.d}),i.d(t,"MultiObserver",function(){return o.b}),i.d(t,"Observable",function(){return o.c}),i.d(t,"PerformanceMonitor",function(){return Sh.a}),i.d(t,"RollingAverage",function(){return Sh.b}),i.d(t,"PromisePolyfill",function(){return Rh.a}),i.d(t,"SceneOptimization",function(){return xh}),i.d(t,"TextureOptimization",function(){return Ch}),i.d(t,"HardwareScalingOptimization",function(){return Mh}),i.d(t,"ShadowsOptimization",function(){return Oh}),i.d(t,"PostProcessesOptimization",function(){return Ih}),i.d(t,"LensFlaresOptimization",function(){return Dh}),i.d(t,"CustomOptimization",function(){return Lh}),i.d(t,"ParticlesOptimization",function(){return wh}),i.d(t,"RenderTargetsOptimization",function(){return Fh}),i.d(t,"MergeMeshesOptimization",function(){return Nh}),i.d(t,"SceneOptimizerOptions",function(){return Bh}),i.d(t,"SceneOptimizer",function(){return Uh}),i.d(t,"SceneSerializer",function(){return zh}),i.d(t,"SmartArray",function(){return ii.a}),i.d(t,"SmartArrayNoDuplicate",function(){return ii.b}),i.d(t,"StringDictionary",function(){return Ct.a}),i.d(t,"Tags",function(){return jh.a}),i.d(t,"TextureTools",function(){return Wh}),i.d(t,"TGATools",function(){return ka}),i.d(t,"Tools",function(){return Ie.b}),i.d(t,"className",function(){return Ie.c}),i.d(t,"AsyncLoop",function(){return Ie.a}),i.d(t,"VideoRecorder",function(){return Hh}),i.d(t,"JoystickAxis",function(){return xt}),i.d(t,"VirtualJoystick",function(){return Mt}),i.d(t,"WorkerPool",function(){return Zs}),i.d(t,"Logger",function(){return m.a}),i.d(t,"_TypeStore",function(){return c.a}),i.d(t,"FilesInputStore",function(){return _n.a}),i.d(t,"DeepCopier",function(){return M.a}),i.d(t,"PivotTools",function(){return Qe.a}),i.d(t,"PrecisionDate",function(){return Q.a}),i.d(t,"ScreenshotTools",function(){return Xh}),i.d(t,"WebRequest",function(){return qa.a}),i.d(t,"InspectableType",function(){return uh}),i.d(t,"BRDFTextureTools",function(){return jr}),i.d(t,"ColorGradient",function(){return Jc}),i.d(t,"Color3Gradient",function(){return $c}),i.d(t,"FactorGradient",function(){return el}),i.d(t,"GradientHelper",function(){return tl}),i.d(t,"PerfCounter",function(){return Lo.a}),i.d(t,"RetryStrategy",function(){return Yh.a}),i.d(t,"LoadFileError",function(){return Kh.a}),i.d(t,"HDRTools",function(){return da}),i.d(t,"PanoramaToCubeMapTools",function(){return ha})},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(37),r=function(){function e(){}return e.SetImmediate=function(e){n.a.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},e}()},function(e,t,i){"use strict";var n="fogFragmentDeclaration",r="#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";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";var n="#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";i(6).a.IncludesShadersStore.fogFragment=n},function(e,t,i){"use strict";var n="fogVertexDeclaration",r="#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";i(6).a.IncludesShadersStore[n]=r},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.Eval=function(t,i){return"true"===(t=t.match(/\([^\(\)]*\)/g)?t.replace(/\([^\(\)]*\)/g,function(t){return t=t.slice(1,t.length-1),e._HandleParenthesisContent(t,i)}):e._HandleParenthesisContent(t,i))||"false"!==t&&e.Eval(t,i)},e._HandleParenthesisContent=function(t,i){var n;i=i||function(e){return"true"===e};var r=t.split("||");for(var o in r)if(r.hasOwnProperty(o)){var a=e._SimplifyNegation(r[o].trim()),s=a.split("&&");if(s.length>1)for(var c=0;c=e||-1!==i.indexOf("file:")?-1:Math.pow(2,r)*t}},e}()},function(e,t,i){"use strict";var n;i.d(t,"a",function(){return a}),function(e){e[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected"}(n||(n={}));var r=function(){this.count=0,this.target=0,this.results=[]},o=function(){function e(e){var t=this;if(this._state=n.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e(function(e){t._resolve(e)},function(e){t._reject(e)})}catch(e){this._reject(e)}}return Object.defineProperty(e.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}),e.prototype.catch=function(e){return this.then(void 0,e)},e.prototype.then=function(t,i){var r=this,o=new e;return o._onFulfilled=t,o._onRejected=i,this._children.push(o),o._parent=this,this._state!==n.Pending&&setTimeout(function(){if(r._state===n.Fulfilled||r._rejectWasConsumed){var e=o._resolve(r._result);if(null!=e)if(void 0!==e._state){var t=e;o._children.push(t),t._parent=o,o=t}else o._result=e}else o._reject(r._reason)}),o},e.prototype._moveChildren=function(e){var t,i=this;if((t=this._children).push.apply(t,e.splice(0,e.length)),this._children.forEach(function(e){e._parent=i}),this._state===n.Fulfilled)for(var r=0,o=this._children;r=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}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return Object.defineProperty(e.prototype,"isAsync",{get:function(){return this.isParallelCompiled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isReady",{get:function(){return!!this.program&&(!this.isParallelCompiled||this.engine._isRenderingStateCompiled(this))},enumerable:!0,configurable:!0}),e.prototype._handlesSpectorRebuildCallback=function(e){e&&this.program&&e(this.program)},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return n});var n=function(){function e(){}return e.prototype.attributeProcessor=function(e){return e.replace("attribute","in")},e.prototype.varyingProcessor=function(e,t){return e.replace("varying",t?"in":"out")},e.prototype.postProcessor=function(e,t,i){var n=-1!==e.search(/#extension.+GL_EXT_draw_buffers.+require/);if(e=(e=e.replace(/#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"")).replace(/texture2D\s*\(/g,"texture("),i)e=(e=(e=(e=(e=(e=(e=e.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(");else if(-1!==t.indexOf("#define MULTIVIEW"))return"#extension GL_OVR_multiview2 : require\nlayout (num_views = 2) in;\n"+e;return e},e}()},function(e,t,i){"use strict";i.d(t,"a",function(){return r});var n=i(0),r=function(){this._checkCollisions=!1,this._collisionMask=-1,this._collisionGroup=-1,this._collider=null,this._oldPositionForCollisions=new n.e(0,0,0),this._diffPositionForCollisions=new n.e(0,0,0)}},function(e,t,i){"use strict";i.d(t,"a",function(){return a});var n=i(32),r=i(0),o=i(3),a=function(){function e(e,t,i,r,o){void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),this.index=e,this._opaqueSubMeshes=new n.a(256),this._transparentSubMeshes=new n.a(256),this._alphaTestSubMeshes=new n.a(256),this._depthOnlySubMeshes=new n.a(256),this._particleSystems=new n.a(256),this._spriteManagers=new n.a(256),this._edgesRenderers=new n.a(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=r,this.transparentSortCompareFn=o}return Object.defineProperty(e.prototype,"opaqueSortCompareFn",{set:function(t){this._opaqueSortCompareFn=t,this._renderOpaque=t?this.renderOpaqueSorted:e.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alphaTestSortCompareFn",{set:function(t){this._alphaTestSortCompareFn=t,this._renderAlphaTest=t?this.renderAlphaTestSorted:e.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"transparentSortCompareFn",{set:function(t){this._transparentSortCompareFn=t||e.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!0,configurable:!0}),e.prototype.render=function(e,t,i,n){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var r=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(r.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),r.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var a=r.getStencilBuffer();if(r.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(n),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(this._renderTransparent(this._transparentSubMeshes),r.setAlphaMode(o.a.ALPHA_DISABLE)),r.setStencilBuffer(!1),this._edgesRenderers.length){for(var s=0;si._alphaIndex?1:t._alphaIndext._distanceToCamera?-1:0},e.frontToBackSortCompare=function(e,t){return e._distanceToCamerat._distanceToCamera?1:0},e.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},e.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},e.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._renderingGroup=this,t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.push(t._edgesRenderer))},e.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},e.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},e.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i\nvoid main(void) {\n#include\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}";n.a.ShadersStore[r]=o},function(e,t,i){"use strict";var n=i(6),r=(i(72),i(111),i(73),i(74),i(75),i(103),"colorVertexShader"),o="\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include\n#include\n\n#include\nuniform mat4 viewProjection;\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include\n#include\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\n#include\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}";n.a.ShadersStore[r]=o},function(e,t,i){"use strict";(function(e){i.d(t,"b",function(){return u}),i.d(t,"a",function(){return h});var n=i(1),r=i(8),o=i(11),a=i(105),s=i(29),c=i(3),l=i(92),u=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4},h=function(t){function i(i){void 0===i&&(i=new u);var n=t.call(this,null)||this;void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),n._options=i,n._caps=new o.c,n._caps.maxTexturesImageUnits=16,n._caps.maxVertexTextureImageUnits=16,n._caps.maxTextureSize=512,n._caps.maxCubemapTextureSize=512,n._caps.maxRenderTextureSize=512,n._caps.maxVertexAttribs=16,n._caps.maxVaryingVectors=16,n._caps.maxFragmentUniformVectors=16,n._caps.maxVertexUniformVectors=16,n._caps.standardDerivatives=!1,n._caps.astc=null,n._caps.s3tc=null,n._caps.pvrtc=null,n._caps.etc1=null,n._caps.etc2=null,n._caps.textureAnisotropicFilterExtension=null,n._caps.maxAnisotropy=0,n._caps.uintIndices=!1,n._caps.fragmentDepthSupported=!1,n._caps.highPrecisionShaderSupported=!0,n._caps.colorBufferFloat=!1,n._caps.textureFloat=!1,n._caps.textureFloatLinearFiltering=!1,n._caps.textureFloatRender=!1,n._caps.textureHalfFloat=!1,n._caps.textureHalfFloatLinearFiltering=!1,n._caps.textureHalfFloatRender=!1,n._caps.textureLOD=!1,n._caps.drawBuffersExtension=!1,n._caps.depthTextureExtension=!1,n._caps.vertexArrayObject=!1,n._caps.instancedArrays=!1,r.a.Log("Babylon.js v"+o.b.Version+" - Null engine");var a="undefined"!=typeof self?self:void 0!==e?e:window;return"undefined"==typeof URL&&(a.URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(a.Blob=function(){}),n}return n.d(i,t),i.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},i.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},i.prototype.getHardwareScalingLevel=function(){return 1},i.prototype.createVertexBuffer=function(e){var t=new l.a;return t.references=1,t},i.prototype.createIndexBuffer=function(e){var t=new l.a;return t.references=1,t},i.prototype.clear=function(e,t,i,n){void 0===n&&(n=!1)},i.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},i.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},i.prototype.setViewport=function(e,t,i){this._cachedViewport=e},i.prototype.createShaderProgram=function(e,t,i,n,r){return{__SPECTOR_rebuildProgram:null}},i.prototype.getUniforms=function(e,t){return[]},i.prototype.getAttributes=function(e,t){return[]},i.prototype.bindSamplers=function(e){this._currentEffect=null},i.prototype.enableEffect=function(e){this._currentEffect=e,e.onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e)},i.prototype.setState=function(e,t,i,n){void 0===t&&(t=0),void 0===n&&(n=!1)},i.prototype.setIntArray=function(e,t){},i.prototype.setIntArray2=function(e,t){},i.prototype.setIntArray3=function(e,t){},i.prototype.setIntArray4=function(e,t){},i.prototype.setFloatArray=function(e,t){},i.prototype.setFloatArray2=function(e,t){},i.prototype.setFloatArray3=function(e,t){},i.prototype.setFloatArray4=function(e,t){},i.prototype.setArray=function(e,t){},i.prototype.setArray2=function(e,t){},i.prototype.setArray3=function(e,t){},i.prototype.setArray4=function(e,t){},i.prototype.setMatrices=function(e,t){},i.prototype.setMatrix3x3=function(e,t){},i.prototype.setMatrix2x2=function(e,t){},i.prototype.setFloat=function(e,t){},i.prototype.setFloat2=function(e,t,i){},i.prototype.setFloat3=function(e,t,i,n){},i.prototype.setBool=function(e,t){},i.prototype.setFloat4=function(e,t,i,n,r){},i.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this._alphaState.alphaBlend=e!==c.a.ALPHA_DISABLE,t||this.setDepthWrite(e===c.a.ALPHA_DISABLE),this._alphaMode=e)},i.prototype.bindBuffers=function(e,t,i){},i.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilState.reset(),this._depthCullingState.reset(),this._alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},i.prototype.draw=function(e,t,i,n){},i.prototype.drawElementsType=function(e,t,i,n){},i.prototype.drawArraysType=function(e,t,i,n){},i.prototype._createTexture=function(){return{}},i.prototype._releaseTexture=function(e){},i.prototype.createTexture=function(e,t,i,n,r,o,a,l,u,h){void 0===r&&(r=c.a.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===a&&(a=null),void 0===l&&(l=null);var d=new s.a(this,s.a.DATASOURCE_URL),f=String(e);return d.url=f,d.generateMipMaps=!t,d.samplingMode=r,d.invertY=i,d.baseWidth=this._options.textureSize,d.baseHeight=this._options.textureSize,d.width=this._options.textureSize,d.height=this._options.textureSize,h&&(d.format=h),d.isReady=!0,o&&o(),this._internalTexturesCache.push(d),d},i.prototype.createRenderTargetTexture=function(e,t){var i=new a.a;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,i.generateStencilBuffer=i.generateDepthBuffer&&t.generateStencilBuffer,i.type=void 0===t.type?c.a.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?c.a.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=c.a.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=c.a.TEXTURE_TRILINEAR_SAMPLINGMODE);var n=new s.a(this,s.a.DATASOURCE_RENDERTARGET),r=e.width||e,o=e.height||e;return n._depthStencilBuffer={},n._framebuffer={},n.baseWidth=r,n.baseHeight=o,n.width=r,n.height=o,n.isReady=!0,n.samples=1,n.generateMipMaps=!!i.generateMipMaps,n.samplingMode=i.samplingMode,n.type=i.type,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(n),n},i.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},i.prototype.bindFramebuffer=function(e,t,i,n,r){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer,this._cachedViewport&&!r&&this.setViewport(this._cachedViewport,i,n)},i.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&(e._MSAAFramebuffer&&(this._currentFramebuffer=e._framebuffer),i()),this._currentFramebuffer=null},i.prototype.createDynamicVertexBuffer=function(e){var t=new l.a;return t.references=1,t.capacity=1,t},i.prototype.updateDynamicTexture=function(e,t,i,n,r){void 0===n&&(n=!1)},i.prototype.areAllEffectsReady=function(){return!0},i.prototype.getError=function(){return 0},i.prototype._getUnpackAlignement=function(){return 1},i.prototype._unpackFlipY=function(e){},i.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},i.prototype.updateDynamicVertexBuffer=function(e,t,i,n){},i.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},i.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},i.prototype._releaseBuffer=function(e){return e.references--,0===e.references},i.prototype.releaseEffects=function(){},i.prototype.displayLoadingUI=function(){},i.prototype.hideLoadingUI=function(){},i.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,n,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0)},i.prototype._uploadDataToTextureDirectly=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadArrayBufferViewToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i.prototype._uploadImageToTexture=function(e,t,i,n){void 0===i&&(i=0),void 0===n&&(n=0)},i}(o.b)}).call(this,i(137))},function(e,t,i){"use strict";i.r(t),function(e){i.d(t,"Debug",function(){return l});var n=i(112),r=i(87);i.d(t,"AbstractScene",function(){return n.AbstractScene}),i.d(t,"KeepAssets",function(){return n.KeepAssets}),i.d(t,"AssetContainer",function(){return n.AssetContainer}),i.d(t,"Node",function(){return n.Node}),i.d(t,"Scene",function(){return n.Scene}),i.d(t,"SceneComponentConstants",function(){return n.SceneComponentConstants}),i.d(t,"Stage",function(){return n.Stage}),i.d(t,"AbstractActionManager",function(){return n.AbstractActionManager}),i.d(t,"Action",function(){return n.Action}),i.d(t,"ActionEvent",function(){return n.ActionEvent}),i.d(t,"ActionManager",function(){return n.ActionManager}),i.d(t,"Condition",function(){return n.Condition}),i.d(t,"ValueCondition",function(){return n.ValueCondition}),i.d(t,"PredicateCondition",function(){return n.PredicateCondition}),i.d(t,"StateCondition",function(){return n.StateCondition}),i.d(t,"SwitchBooleanAction",function(){return n.SwitchBooleanAction}),i.d(t,"SetStateAction",function(){return n.SetStateAction}),i.d(t,"SetValueAction",function(){return n.SetValueAction}),i.d(t,"IncrementValueAction",function(){return n.IncrementValueAction}),i.d(t,"PlayAnimationAction",function(){return n.PlayAnimationAction}),i.d(t,"StopAnimationAction",function(){return n.StopAnimationAction}),i.d(t,"DoNothingAction",function(){return n.DoNothingAction}),i.d(t,"CombineAction",function(){return n.CombineAction}),i.d(t,"ExecuteCodeAction",function(){return n.ExecuteCodeAction}),i.d(t,"SetParentAction",function(){return n.SetParentAction}),i.d(t,"PlaySoundAction",function(){return n.PlaySoundAction}),i.d(t,"StopSoundAction",function(){return n.StopSoundAction}),i.d(t,"InterpolateValueAction",function(){return n.InterpolateValueAction}),i.d(t,"Animatable",function(){return n.Animatable}),i.d(t,"_IAnimationState",function(){return n._IAnimationState}),i.d(t,"Animation",function(){return n.Animation}),i.d(t,"TargetedAnimation",function(){return n.TargetedAnimation}),i.d(t,"AnimationGroup",function(){return n.AnimationGroup}),i.d(t,"AnimationPropertiesOverride",function(){return n.AnimationPropertiesOverride}),i.d(t,"EasingFunction",function(){return n.EasingFunction}),i.d(t,"CircleEase",function(){return n.CircleEase}),i.d(t,"BackEase",function(){return n.BackEase}),i.d(t,"BounceEase",function(){return n.BounceEase}),i.d(t,"CubicEase",function(){return n.CubicEase}),i.d(t,"ElasticEase",function(){return n.ElasticEase}),i.d(t,"ExponentialEase",function(){return n.ExponentialEase}),i.d(t,"PowerEase",function(){return n.PowerEase}),i.d(t,"QuadraticEase",function(){return n.QuadraticEase}),i.d(t,"QuarticEase",function(){return n.QuarticEase}),i.d(t,"QuinticEase",function(){return n.QuinticEase}),i.d(t,"SineEase",function(){return n.SineEase}),i.d(t,"BezierCurveEase",function(){return n.BezierCurveEase}),i.d(t,"RuntimeAnimation",function(){return n.RuntimeAnimation}),i.d(t,"AnimationEvent",function(){return n.AnimationEvent}),i.d(t,"AnimationKeyInterpolation",function(){return n.AnimationKeyInterpolation}),i.d(t,"AnimationRange",function(){return n.AnimationRange}),i.d(t,"Analyser",function(){return n.Analyser}),i.d(t,"AudioEngine",function(){return n.AudioEngine}),i.d(t,"AudioSceneComponent",function(){return n.AudioSceneComponent}),i.d(t,"Sound",function(){return n.Sound}),i.d(t,"SoundTrack",function(){return n.SoundTrack}),i.d(t,"WeightedSound",function(){return n.WeightedSound}),i.d(t,"Bone",function(){return n.Bone}),i.d(t,"BoneIKController",function(){return n.BoneIKController}),i.d(t,"BoneLookController",function(){return n.BoneLookController}),i.d(t,"Skeleton",function(){return n.Skeleton}),i.d(t,"CameraInputTypes",function(){return n.CameraInputTypes}),i.d(t,"CameraInputsManager",function(){return n.CameraInputsManager}),i.d(t,"Camera",function(){return n.Camera}),i.d(t,"TargetCamera",function(){return n.TargetCamera}),i.d(t,"FreeCamera",function(){return n.FreeCamera}),i.d(t,"FreeCameraInputsManager",function(){return n.FreeCameraInputsManager}),i.d(t,"TouchCamera",function(){return n.TouchCamera}),i.d(t,"ArcRotateCamera",function(){return n.ArcRotateCamera}),i.d(t,"ArcRotateCameraInputsManager",function(){return n.ArcRotateCameraInputsManager}),i.d(t,"DeviceOrientationCamera",function(){return n.DeviceOrientationCamera}),i.d(t,"FlyCamera",function(){return n.FlyCamera}),i.d(t,"FlyCameraInputsManager",function(){return n.FlyCameraInputsManager}),i.d(t,"FollowCamera",function(){return n.FollowCamera}),i.d(t,"ArcFollowCamera",function(){return n.ArcFollowCamera}),i.d(t,"FollowCameraInputsManager",function(){return n.FollowCameraInputsManager}),i.d(t,"GamepadCamera",function(){return n.GamepadCamera}),i.d(t,"UniversalCamera",function(){return n.UniversalCamera}),i.d(t,"VirtualJoysticksCamera",function(){return n.VirtualJoysticksCamera}),i.d(t,"Collider",function(){return n.Collider}),i.d(t,"DefaultCollisionCoordinator",function(){return n.DefaultCollisionCoordinator}),i.d(t,"PickingInfo",function(){return n.PickingInfo}),i.d(t,"IntersectionInfo",function(){return n.IntersectionInfo}),i.d(t,"_MeshCollisionData",function(){return n._MeshCollisionData}),i.d(t,"BoundingBox",function(){return n.BoundingBox}),i.d(t,"BoundingInfo",function(){return n.BoundingInfo}),i.d(t,"BoundingSphere",function(){return n.BoundingSphere}),i.d(t,"Ray",function(){return n.Ray}),i.d(t,"AxesViewer",function(){return n.AxesViewer}),i.d(t,"BoneAxesViewer",function(){return n.BoneAxesViewer}),i.d(t,"DebugLayer",function(){return n.DebugLayer}),i.d(t,"PhysicsViewer",function(){return n.PhysicsViewer}),i.d(t,"RayHelper",function(){return n.RayHelper}),i.d(t,"SkeletonViewer",function(){return n.SkeletonViewer}),i.d(t,"Constants",function(){return n.Constants}),i.d(t,"InstancingAttributeInfo",function(){return n.InstancingAttributeInfo}),i.d(t,"DepthTextureCreationOptions",function(){return n.DepthTextureCreationOptions}),i.d(t,"EngineCapabilities",function(){return n.EngineCapabilities}),i.d(t,"Engine",function(){return n.Engine}),i.d(t,"EngineStore",function(){return n.EngineStore}),i.d(t,"NullEngineOptions",function(){return n.NullEngineOptions}),i.d(t,"NullEngine",function(){return n.NullEngine}),i.d(t,"WebGLPipelineContext",function(){return n.WebGLPipelineContext}),i.d(t,"WebGL2ShaderProcessor",function(){return n.WebGL2ShaderProcessor}),i.d(t,"KeyboardEventTypes",function(){return n.KeyboardEventTypes}),i.d(t,"KeyboardInfo",function(){return n.KeyboardInfo}),i.d(t,"KeyboardInfoPre",function(){return n.KeyboardInfoPre}),i.d(t,"PointerEventTypes",function(){return n.PointerEventTypes}),i.d(t,"PointerInfoBase",function(){return n.PointerInfoBase}),i.d(t,"PointerInfoPre",function(){return n.PointerInfoPre}),i.d(t,"PointerInfo",function(){return n.PointerInfo}),i.d(t,"ClipboardEventTypes",function(){return n.ClipboardEventTypes}),i.d(t,"ClipboardInfo",function(){return n.ClipboardInfo}),i.d(t,"StickValues",function(){return n.StickValues}),i.d(t,"Gamepad",function(){return n.Gamepad}),i.d(t,"GenericPad",function(){return n.GenericPad}),i.d(t,"GamepadManager",function(){return n.GamepadManager}),i.d(t,"GamepadSystemSceneComponent",function(){return n.GamepadSystemSceneComponent}),i.d(t,"Xbox360Button",function(){return n.Xbox360Button}),i.d(t,"Xbox360Dpad",function(){return n.Xbox360Dpad}),i.d(t,"Xbox360Pad",function(){return n.Xbox360Pad}),i.d(t,"DualShockButton",function(){return n.DualShockButton}),i.d(t,"DualShockDpad",function(){return n.DualShockDpad}),i.d(t,"DualShockPad",function(){return n.DualShockPad}),i.d(t,"AxisDragGizmo",function(){return n.AxisDragGizmo}),i.d(t,"AxisScaleGizmo",function(){return n.AxisScaleGizmo}),i.d(t,"BoundingBoxGizmo",function(){return n.BoundingBoxGizmo}),i.d(t,"Gizmo",function(){return n.Gizmo}),i.d(t,"GizmoManager",function(){return n.GizmoManager}),i.d(t,"PlaneRotationGizmo",function(){return n.PlaneRotationGizmo}),i.d(t,"PositionGizmo",function(){return n.PositionGizmo}),i.d(t,"RotationGizmo",function(){return n.RotationGizmo}),i.d(t,"ScaleGizmo",function(){return n.ScaleGizmo}),i.d(t,"LightGizmo",function(){return n.LightGizmo}),i.d(t,"PlaneDragGizmo",function(){return n.PlaneDragGizmo}),i.d(t,"EnvironmentHelper",function(){return n.EnvironmentHelper}),i.d(t,"PhotoDome",function(){return n.PhotoDome}),i.d(t,"_forceSceneHelpersToBundle",function(){return n._forceSceneHelpersToBundle}),i.d(t,"VideoDome",function(){return n.VideoDome}),i.d(t,"EngineInstrumentation",function(){return n.EngineInstrumentation}),i.d(t,"SceneInstrumentation",function(){return n.SceneInstrumentation}),i.d(t,"_TimeToken",function(){return n._TimeToken}),i.d(t,"EffectLayer",function(){return n.EffectLayer}),i.d(t,"EffectLayerSceneComponent",function(){return n.EffectLayerSceneComponent}),i.d(t,"GlowLayer",function(){return n.GlowLayer}),i.d(t,"HighlightLayer",function(){return n.HighlightLayer}),i.d(t,"Layer",function(){return n.Layer}),i.d(t,"LayerSceneComponent",function(){return n.LayerSceneComponent}),i.d(t,"LensFlare",function(){return n.LensFlare}),i.d(t,"LensFlareSystem",function(){return n.LensFlareSystem}),i.d(t,"LensFlareSystemSceneComponent",function(){return n.LensFlareSystemSceneComponent}),i.d(t,"Light",function(){return n.Light}),i.d(t,"ShadowLight",function(){return n.ShadowLight}),i.d(t,"DirectionalLight",function(){return n.DirectionalLight}),i.d(t,"HemisphericLight",function(){return n.HemisphericLight}),i.d(t,"PointLight",function(){return n.PointLight}),i.d(t,"SpotLight",function(){return n.SpotLight}),i.d(t,"DefaultLoadingScreen",function(){return n.DefaultLoadingScreen}),i.d(t,"SceneLoaderProgressEvent",function(){return n.SceneLoaderProgressEvent}),i.d(t,"SceneLoader",function(){return n.SceneLoader}),i.d(t,"SceneLoaderFlags",function(){return n.SceneLoaderFlags}),i.d(t,"ColorCurves",function(){return n.ColorCurves}),i.d(t,"EffectFallbacks",function(){return n.EffectFallbacks}),i.d(t,"EffectCreationOptions",function(){return n.EffectCreationOptions}),i.d(t,"Effect",function(){return n.Effect}),i.d(t,"FresnelParameters",function(){return n.FresnelParameters}),i.d(t,"ImageProcessingConfigurationDefines",function(){return n.ImageProcessingConfigurationDefines}),i.d(t,"ImageProcessingConfiguration",function(){return n.ImageProcessingConfiguration}),i.d(t,"Material",function(){return n.Material}),i.d(t,"MaterialDefines",function(){return n.MaterialDefines}),i.d(t,"MaterialHelper",function(){return n.MaterialHelper}),i.d(t,"MultiMaterial",function(){return n.MultiMaterial}),i.d(t,"PushMaterial",function(){return n.PushMaterial}),i.d(t,"ShaderMaterial",function(){return n.ShaderMaterial}),i.d(t,"StandardMaterialDefines",function(){return n.StandardMaterialDefines}),i.d(t,"StandardMaterial",function(){return n.StandardMaterial}),i.d(t,"BaseTexture",function(){return n.BaseTexture}),i.d(t,"CubeTexture",function(){return n.CubeTexture}),i.d(t,"DynamicTexture",function(){return n.DynamicTexture}),i.d(t,"EquiRectangularCubeTexture",function(){return n.EquiRectangularCubeTexture}),i.d(t,"HDRCubeTexture",function(){return n.HDRCubeTexture}),i.d(t,"InternalTexture",function(){return n.InternalTexture}),i.d(t,"MirrorTexture",function(){return n.MirrorTexture}),i.d(t,"MultiRenderTarget",function(){return n.MultiRenderTarget}),i.d(t,"RawTexture",function(){return n.RawTexture}),i.d(t,"RenderTargetTexture",function(){return n.RenderTargetTexture}),i.d(t,"Texture",function(){return n.Texture}),i.d(t,"UniformBuffer",function(){return n.UniformBuffer}),i.d(t,"MaterialFlags",function(){return n.MaterialFlags}),i.d(t,"EffectRenderer",function(){return n.EffectRenderer}),i.d(t,"EffectWrapper",function(){return n.EffectWrapper}),i.d(t,"Scalar",function(){return n.Scalar}),i.d(t,"Space",function(){return n.Space}),i.d(t,"Axis",function(){return n.Axis}),i.d(t,"Color3",function(){return n.Color3}),i.d(t,"Color4",function(){return n.Color4}),i.d(t,"TmpColors",function(){return n.TmpColors}),i.d(t,"ToGammaSpace",function(){return n.ToGammaSpace}),i.d(t,"ToLinearSpace",function(){return n.ToLinearSpace}),i.d(t,"Epsilon",function(){return n.Epsilon}),i.d(t,"Frustum",function(){return n.Frustum}),i.d(t,"Plane",function(){return n.Plane}),i.d(t,"Size",function(){return n.Size}),i.d(t,"Vector2",function(){return n.Vector2}),i.d(t,"Vector3",function(){return n.Vector3}),i.d(t,"Vector4",function(){return n.Vector4}),i.d(t,"Quaternion",function(){return n.Quaternion}),i.d(t,"Matrix",function(){return n.Matrix}),i.d(t,"TmpVectors",function(){return n.TmpVectors}),i.d(t,"Viewport",function(){return n.Viewport}),i.d(t,"SphericalHarmonics",function(){return n.SphericalHarmonics}),i.d(t,"SphericalPolynomial",function(){return n.SphericalPolynomial}),i.d(t,"AbstractMesh",function(){return n.AbstractMesh}),i.d(t,"Buffer",function(){return n.Buffer}),i.d(t,"VertexBuffer",function(){return n.VertexBuffer}),i.d(t,"CSG",function(){return n.CSG}),i.d(t,"Geometry",function(){return n.Geometry}),i.d(t,"GroundMesh",function(){return n.GroundMesh}),i.d(t,"TrailMesh",function(){return n.TrailMesh}),i.d(t,"InstancedMesh",function(){return n.InstancedMesh}),i.d(t,"LinesMesh",function(){return n.LinesMesh}),i.d(t,"InstancedLinesMesh",function(){return n.InstancedLinesMesh}),i.d(t,"_CreationDataStorage",function(){return n._CreationDataStorage}),i.d(t,"_InstancesBatch",function(){return n._InstancesBatch}),i.d(t,"Mesh",function(){return n.Mesh}),i.d(t,"VertexData",function(){return n.VertexData}),i.d(t,"MeshBuilder",function(){return n.MeshBuilder}),i.d(t,"SimplificationSettings",function(){return n.SimplificationSettings}),i.d(t,"SimplificationQueue",function(){return n.SimplificationQueue}),i.d(t,"SimplificationType",function(){return n.SimplificationType}),i.d(t,"SimplicationQueueSceneComponent",function(){return n.SimplicationQueueSceneComponent}),i.d(t,"Polygon",function(){return n.Polygon}),i.d(t,"PolygonMeshBuilder",function(){return n.PolygonMeshBuilder}),i.d(t,"BaseSubMesh",function(){return n.BaseSubMesh}),i.d(t,"SubMesh",function(){return n.SubMesh}),i.d(t,"MeshLODLevel",function(){return n.MeshLODLevel}),i.d(t,"TransformNode",function(){return n.TransformNode}),i.d(t,"BoxBuilder",function(){return n.BoxBuilder}),i.d(t,"SphereBuilder",function(){return n.SphereBuilder}),i.d(t,"CylinderBuilder",function(){return n.CylinderBuilder}),i.d(t,"TorusBuilder",function(){return n.TorusBuilder}),i.d(t,"LinesBuilder",function(){return n.LinesBuilder}),i.d(t,"PlaneBuilder",function(){return n.PlaneBuilder}),i.d(t,"GroundBuilder",function(){return n.GroundBuilder}),i.d(t,"DataBuffer",function(){return n.DataBuffer}),i.d(t,"WebGLDataBuffer",function(){return n.WebGLDataBuffer}),i.d(t,"MorphTarget",function(){return n.MorphTarget}),i.d(t,"MorphTargetManager",function(){return n.MorphTargetManager}),i.d(t,"Database",function(){return n.Database}),i.d(t,"BaseParticleSystem",function(){return n.BaseParticleSystem}),i.d(t,"GPUParticleSystem",function(){return n.GPUParticleSystem}),i.d(t,"Particle",function(){return n.Particle}),i.d(t,"ParticleHelper",function(){return n.ParticleHelper}),i.d(t,"ParticleSystem",function(){return n.ParticleSystem}),i.d(t,"_IDoNeedToBeInTheBuild",function(){return n._IDoNeedToBeInTheBuild}),i.d(t,"ParticleSystemSet",function(){return n.ParticleSystemSet}),i.d(t,"SolidParticle",function(){return n.SolidParticle}),i.d(t,"ModelShape",function(){return n.ModelShape}),i.d(t,"DepthSortedParticle",function(){return n.DepthSortedParticle}),i.d(t,"SolidParticleSystem",function(){return n.SolidParticleSystem}),i.d(t,"SubEmitterType",function(){return n.SubEmitterType}),i.d(t,"SubEmitter",function(){return n.SubEmitter}),i.d(t,"PhysicsEngine",function(){return n.PhysicsEngine}),i.d(t,"PhysicsEngineSceneComponent",function(){return n.PhysicsEngineSceneComponent}),i.d(t,"PhysicsHelper",function(){return n.PhysicsHelper}),i.d(t,"PhysicsRadialExplosionEventOptions",function(){return n.PhysicsRadialExplosionEventOptions}),i.d(t,"PhysicsUpdraftEventOptions",function(){return n.PhysicsUpdraftEventOptions}),i.d(t,"PhysicsVortexEventOptions",function(){return n.PhysicsVortexEventOptions}),i.d(t,"PhysicsRadialImpulseFalloff",function(){return n.PhysicsRadialImpulseFalloff}),i.d(t,"PhysicsUpdraftMode",function(){return n.PhysicsUpdraftMode}),i.d(t,"PhysicsImpostor",function(){return n.PhysicsImpostor}),i.d(t,"PhysicsJoint",function(){return n.PhysicsJoint}),i.d(t,"DistanceJoint",function(){return n.DistanceJoint}),i.d(t,"MotorEnabledJoint",function(){return n.MotorEnabledJoint}),i.d(t,"HingeJoint",function(){return n.HingeJoint}),i.d(t,"Hinge2Joint",function(){return n.Hinge2Joint}),i.d(t,"AnaglyphPostProcess",function(){return n.AnaglyphPostProcess}),i.d(t,"BlackAndWhitePostProcess",function(){return n.BlackAndWhitePostProcess}),i.d(t,"BloomEffect",function(){return n.BloomEffect}),i.d(t,"BloomMergePostProcess",function(){return n.BloomMergePostProcess}),i.d(t,"BlurPostProcess",function(){return n.BlurPostProcess}),i.d(t,"ChromaticAberrationPostProcess",function(){return n.ChromaticAberrationPostProcess}),i.d(t,"CircleOfConfusionPostProcess",function(){return n.CircleOfConfusionPostProcess}),i.d(t,"ColorCorrectionPostProcess",function(){return n.ColorCorrectionPostProcess}),i.d(t,"ConvolutionPostProcess",function(){return n.ConvolutionPostProcess}),i.d(t,"DepthOfFieldBlurPostProcess",function(){return n.DepthOfFieldBlurPostProcess}),i.d(t,"DepthOfFieldEffectBlurLevel",function(){return n.DepthOfFieldEffectBlurLevel}),i.d(t,"DepthOfFieldEffect",function(){return n.DepthOfFieldEffect}),i.d(t,"DepthOfFieldMergePostProcessOptions",function(){return n.DepthOfFieldMergePostProcessOptions}),i.d(t,"DepthOfFieldMergePostProcess",function(){return n.DepthOfFieldMergePostProcess}),i.d(t,"DisplayPassPostProcess",function(){return n.DisplayPassPostProcess}),i.d(t,"ExtractHighlightsPostProcess",function(){return n.ExtractHighlightsPostProcess}),i.d(t,"FilterPostProcess",function(){return n.FilterPostProcess}),i.d(t,"FxaaPostProcess",function(){return n.FxaaPostProcess}),i.d(t,"GrainPostProcess",function(){return n.GrainPostProcess}),i.d(t,"HighlightsPostProcess",function(){return n.HighlightsPostProcess}),i.d(t,"ImageProcessingPostProcess",function(){return n.ImageProcessingPostProcess}),i.d(t,"MotionBlurPostProcess",function(){return n.MotionBlurPostProcess}),i.d(t,"PassPostProcess",function(){return n.PassPostProcess}),i.d(t,"PassCubePostProcess",function(){return n.PassCubePostProcess}),i.d(t,"PostProcess",function(){return n.PostProcess}),i.d(t,"PostProcessManager",function(){return n.PostProcessManager}),i.d(t,"RefractionPostProcess",function(){return n.RefractionPostProcess}),i.d(t,"SharpenPostProcess",function(){return n.SharpenPostProcess}),i.d(t,"StereoscopicInterlacePostProcess",function(){return n.StereoscopicInterlacePostProcess}),i.d(t,"TonemappingOperator",function(){return n.TonemappingOperator}),i.d(t,"TonemapPostProcess",function(){return n.TonemapPostProcess}),i.d(t,"VolumetricLightScatteringPostProcess",function(){return n.VolumetricLightScatteringPostProcess}),i.d(t,"VRDistortionCorrectionPostProcess",function(){return n.VRDistortionCorrectionPostProcess}),i.d(t,"VRMultiviewToSingleviewPostProcess",function(){return n.VRMultiviewToSingleviewPostProcess}),i.d(t,"ReflectionProbe",function(){return n.ReflectionProbe}),i.d(t,"BoundingBoxRenderer",function(){return n.BoundingBoxRenderer}),i.d(t,"DepthRenderer",function(){return n.DepthRenderer}),i.d(t,"DepthRendererSceneComponent",function(){return n.DepthRendererSceneComponent}),i.d(t,"EdgesRenderer",function(){return n.EdgesRenderer}),i.d(t,"LineEdgesRenderer",function(){return n.LineEdgesRenderer}),i.d(t,"GeometryBufferRenderer",function(){return n.GeometryBufferRenderer}),i.d(t,"GeometryBufferRendererSceneComponent",function(){return n.GeometryBufferRendererSceneComponent}),i.d(t,"OutlineRenderer",function(){return n.OutlineRenderer}),i.d(t,"RenderingGroup",function(){return n.RenderingGroup}),i.d(t,"RenderingGroupInfo",function(){return n.RenderingGroupInfo}),i.d(t,"RenderingManager",function(){return n.RenderingManager}),i.d(t,"UtilityLayerRenderer",function(){return n.UtilityLayerRenderer}),i.d(t,"Sprite",function(){return n.Sprite}),i.d(t,"SpriteManager",function(){return n.SpriteManager}),i.d(t,"SpritePackedManager",function(){return n.SpritePackedManager}),i.d(t,"SpriteSceneComponent",function(){return n.SpriteSceneComponent}),i.d(t,"_AlphaState",function(){return n._AlphaState}),i.d(t,"_DepthCullingState",function(){return n._DepthCullingState}),i.d(t,"_StencilState",function(){return n._StencilState}),i.d(t,"AndOrNotEvaluator",function(){return n.AndOrNotEvaluator}),i.d(t,"AssetTaskState",function(){return n.AssetTaskState}),i.d(t,"AbstractAssetTask",function(){return n.AbstractAssetTask}),i.d(t,"AssetsProgressEvent",function(){return n.AssetsProgressEvent}),i.d(t,"MeshAssetTask",function(){return n.MeshAssetTask}),i.d(t,"TextFileAssetTask",function(){return n.TextFileAssetTask}),i.d(t,"BinaryFileAssetTask",function(){return n.BinaryFileAssetTask}),i.d(t,"ImageAssetTask",function(){return n.ImageAssetTask}),i.d(t,"TextureAssetTask",function(){return n.TextureAssetTask}),i.d(t,"CubeTextureAssetTask",function(){return n.CubeTextureAssetTask}),i.d(t,"HDRCubeTextureAssetTask",function(){return n.HDRCubeTextureAssetTask}),i.d(t,"EquiRectangularCubeTextureAssetTask",function(){return n.EquiRectangularCubeTextureAssetTask}),i.d(t,"AssetsManager",function(){return n.AssetsManager}),i.d(t,"DDSTools",function(){return n.DDSTools}),i.d(t,"expandToProperty",function(){return n.expandToProperty}),i.d(t,"serialize",function(){return n.serialize}),i.d(t,"serializeAsTexture",function(){return n.serializeAsTexture}),i.d(t,"serializeAsColor3",function(){return n.serializeAsColor3}),i.d(t,"serializeAsFresnelParameters",function(){return n.serializeAsFresnelParameters}),i.d(t,"serializeAsVector2",function(){return n.serializeAsVector2}),i.d(t,"serializeAsVector3",function(){return n.serializeAsVector3}),i.d(t,"serializeAsMeshReference",function(){return n.serializeAsMeshReference}),i.d(t,"serializeAsColorCurves",function(){return n.serializeAsColorCurves}),i.d(t,"serializeAsColor4",function(){return n.serializeAsColor4}),i.d(t,"serializeAsImageProcessingConfiguration",function(){return n.serializeAsImageProcessingConfiguration}),i.d(t,"serializeAsQuaternion",function(){return n.serializeAsQuaternion}),i.d(t,"serializeAsMatrix",function(){return n.serializeAsMatrix}),i.d(t,"serializeAsCameraReference",function(){return n.serializeAsCameraReference}),i.d(t,"SerializationHelper",function(){return n.SerializationHelper}),i.d(t,"Deferred",function(){return n.Deferred}),i.d(t,"EnvironmentTextureTools",function(){return n.EnvironmentTextureTools}),i.d(t,"MeshExploder",function(){return n.MeshExploder}),i.d(t,"FilesInput",function(){return n.FilesInput}),i.d(t,"CubeMapToSphericalPolynomialTools",function(){return n.CubeMapToSphericalPolynomialTools}),i.d(t,"KhronosTextureContainer",function(){return n.KhronosTextureContainer}),i.d(t,"EventState",function(){return n.EventState}),i.d(t,"Observer",function(){return n.Observer}),i.d(t,"MultiObserver",function(){return n.MultiObserver}),i.d(t,"Observable",function(){return n.Observable}),i.d(t,"PerformanceMonitor",function(){return n.PerformanceMonitor}),i.d(t,"RollingAverage",function(){return n.RollingAverage}),i.d(t,"PromisePolyfill",function(){return n.PromisePolyfill}),i.d(t,"SceneOptimization",function(){return n.SceneOptimization}),i.d(t,"TextureOptimization",function(){return n.TextureOptimization}),i.d(t,"HardwareScalingOptimization",function(){return n.HardwareScalingOptimization}),i.d(t,"ShadowsOptimization",function(){return n.ShadowsOptimization}),i.d(t,"PostProcessesOptimization",function(){return n.PostProcessesOptimization}),i.d(t,"LensFlaresOptimization",function(){return n.LensFlaresOptimization}),i.d(t,"CustomOptimization",function(){return n.CustomOptimization}),i.d(t,"ParticlesOptimization",function(){return n.ParticlesOptimization}),i.d(t,"RenderTargetsOptimization",function(){return n.RenderTargetsOptimization}),i.d(t,"MergeMeshesOptimization",function(){return n.MergeMeshesOptimization}),i.d(t,"SceneOptimizerOptions",function(){return n.SceneOptimizerOptions}),i.d(t,"SceneOptimizer",function(){return n.SceneOptimizer}),i.d(t,"SceneSerializer",function(){return n.SceneSerializer}),i.d(t,"SmartArray",function(){return n.SmartArray}),i.d(t,"SmartArrayNoDuplicate",function(){return n.SmartArrayNoDuplicate}),i.d(t,"StringDictionary",function(){return n.StringDictionary}),i.d(t,"Tags",function(){return n.Tags}),i.d(t,"TextureTools",function(){return n.TextureTools}),i.d(t,"TGATools",function(){return n.TGATools}),i.d(t,"Tools",function(){return n.Tools}),i.d(t,"className",function(){return n.className}),i.d(t,"AsyncLoop",function(){return n.AsyncLoop}),i.d(t,"VideoRecorder",function(){return n.VideoRecorder}),i.d(t,"JoystickAxis",function(){return n.JoystickAxis}),i.d(t,"VirtualJoystick",function(){return n.VirtualJoystick}),i.d(t,"WorkerPool",function(){return n.WorkerPool}),i.d(t,"Logger",function(){return n.Logger}),i.d(t,"_TypeStore",function(){return n._TypeStore}),i.d(t,"FilesInputStore",function(){return n.FilesInputStore}),i.d(t,"DeepCopier",function(){return n.DeepCopier}),i.d(t,"PivotTools",function(){return n.PivotTools}),i.d(t,"PrecisionDate",function(){return n.PrecisionDate}),i.d(t,"ScreenshotTools",function(){return n.ScreenshotTools}),i.d(t,"WebRequest",function(){return n.WebRequest}),i.d(t,"InspectableType",function(){return n.InspectableType}),i.d(t,"BRDFTextureTools",function(){return n.BRDFTextureTools}),i.d(t,"ColorGradient",function(){return n.ColorGradient}),i.d(t,"Color3Gradient",function(){return n.Color3Gradient}),i.d(t,"FactorGradient",function(){return n.FactorGradient}),i.d(t,"GradientHelper",function(){return n.GradientHelper}),i.d(t,"PerfCounter",function(){return n.PerfCounter}),i.d(t,"RetryStrategy",function(){return n.RetryStrategy}),i.d(t,"LoadFileError",function(){return n.LoadFileError}),i.d(t,"AutoRotationBehavior",function(){return n.AutoRotationBehavior}),i.d(t,"BouncingBehavior",function(){return n.BouncingBehavior}),i.d(t,"FramingBehavior",function(){return n.FramingBehavior}),i.d(t,"AttachToBoxBehavior",function(){return n.AttachToBoxBehavior}),i.d(t,"FadeInOutBehavior",function(){return n.FadeInOutBehavior}),i.d(t,"MultiPointerScaleBehavior",function(){return n.MultiPointerScaleBehavior}),i.d(t,"PointerDragBehavior",function(){return n.PointerDragBehavior}),i.d(t,"SixDofDragBehavior",function(){return n.SixDofDragBehavior}),i.d(t,"ArcRotateCameraGamepadInput",function(){return n.ArcRotateCameraGamepadInput}),i.d(t,"ArcRotateCameraKeyboardMoveInput",function(){return n.ArcRotateCameraKeyboardMoveInput}),i.d(t,"ArcRotateCameraMouseWheelInput",function(){return n.ArcRotateCameraMouseWheelInput}),i.d(t,"ArcRotateCameraPointersInput",function(){return n.ArcRotateCameraPointersInput}),i.d(t,"ArcRotateCameraVRDeviceOrientationInput",function(){return n.ArcRotateCameraVRDeviceOrientationInput}),i.d(t,"FlyCameraKeyboardInput",function(){return n.FlyCameraKeyboardInput}),i.d(t,"FlyCameraMouseInput",function(){return n.FlyCameraMouseInput}),i.d(t,"FollowCameraKeyboardMoveInput",function(){return n.FollowCameraKeyboardMoveInput}),i.d(t,"FollowCameraMouseWheelInput",function(){return n.FollowCameraMouseWheelInput}),i.d(t,"FollowCameraPointersInput",function(){return n.FollowCameraPointersInput}),i.d(t,"FreeCameraDeviceOrientationInput",function(){return n.FreeCameraDeviceOrientationInput}),i.d(t,"FreeCameraGamepadInput",function(){return n.FreeCameraGamepadInput}),i.d(t,"FreeCameraKeyboardMoveInput",function(){return n.FreeCameraKeyboardMoveInput}),i.d(t,"FreeCameraMouseInput",function(){return n.FreeCameraMouseInput}),i.d(t,"FreeCameraTouchInput",function(){return n.FreeCameraTouchInput}),i.d(t,"FreeCameraVirtualJoystickInput",function(){return n.FreeCameraVirtualJoystickInput}),i.d(t,"AnaglyphArcRotateCamera",function(){return n.AnaglyphArcRotateCamera}),i.d(t,"AnaglyphFreeCamera",function(){return n.AnaglyphFreeCamera}),i.d(t,"AnaglyphGamepadCamera",function(){return n.AnaglyphGamepadCamera}),i.d(t,"AnaglyphUniversalCamera",function(){return n.AnaglyphUniversalCamera}),i.d(t,"StereoscopicArcRotateCamera",function(){return n.StereoscopicArcRotateCamera}),i.d(t,"StereoscopicFreeCamera",function(){return n.StereoscopicFreeCamera}),i.d(t,"StereoscopicGamepadCamera",function(){return n.StereoscopicGamepadCamera}),i.d(t,"StereoscopicUniversalCamera",function(){return n.StereoscopicUniversalCamera}),i.d(t,"VRCameraMetrics",function(){return n.VRCameraMetrics}),i.d(t,"VRDeviceOrientationArcRotateCamera",function(){return n.VRDeviceOrientationArcRotateCamera}),i.d(t,"VRDeviceOrientationFreeCamera",function(){return n.VRDeviceOrientationFreeCamera}),i.d(t,"VRDeviceOrientationGamepadCamera",function(){return n.VRDeviceOrientationGamepadCamera}),i.d(t,"OnAfterEnteringVRObservableEvent",function(){return n.OnAfterEnteringVRObservableEvent}),i.d(t,"VRExperienceHelper",function(){return n.VRExperienceHelper}),i.d(t,"WebVRFreeCamera",function(){return n.WebVRFreeCamera}),i.d(t,"WebXRCamera",function(){return n.WebXRCamera}),i.d(t,"WebXREnterExitUIButton",function(){return n.WebXREnterExitUIButton}),i.d(t,"WebXREnterExitUIOptions",function(){return n.WebXREnterExitUIOptions}),i.d(t,"WebXREnterExitUI",function(){return n.WebXREnterExitUI}),i.d(t,"WebXRState",function(){return n.WebXRState}),i.d(t,"WebXRExperienceHelper",function(){return n.WebXRExperienceHelper}),i.d(t,"WebXRInput",function(){return n.WebXRInput}),i.d(t,"WebXRControllerTeleportation",function(){return n.WebXRControllerTeleportation}),i.d(t,"WebXRControllerPointerSelection",function(){return n.WebXRControllerPointerSelection}),i.d(t,"WebXRControllerModelLoader",function(){return n.WebXRControllerModelLoader}),i.d(t,"WebXRController",function(){return n.WebXRController}),i.d(t,"WebXRManagedOutputCanvas",function(){return n.WebXRManagedOutputCanvas}),i.d(t,"WebXRSessionManager",function(){return n.WebXRSessionManager}),i.d(t,"Octree",function(){return n.Octree}),i.d(t,"OctreeBlock",function(){return n.OctreeBlock}),i.d(t,"OctreeSceneComponent",function(){return n.OctreeSceneComponent}),i.d(t,"_OcclusionDataStorage",function(){return n._OcclusionDataStorage}),i.d(t,"_forceTransformFeedbackToBundle",function(){return n._forceTransformFeedbackToBundle}),i.d(t,"DaydreamController",function(){return n.DaydreamController}),i.d(t,"GearVRController",function(){return n.GearVRController}),i.d(t,"GenericController",function(){return n.GenericController}),i.d(t,"OculusTouchController",function(){return n.OculusTouchController}),i.d(t,"PoseEnabledControllerType",function(){return n.PoseEnabledControllerType}),i.d(t,"PoseEnabledControllerHelper",function(){return n.PoseEnabledControllerHelper}),i.d(t,"PoseEnabledController",function(){return n.PoseEnabledController}),i.d(t,"ViveController",function(){return n.ViveController}),i.d(t,"WebVRController",function(){return n.WebVRController}),i.d(t,"WindowsMotionController",function(){return n.WindowsMotionController}),i.d(t,"ShadowGenerator",function(){return n.ShadowGenerator}),i.d(t,"ShadowGeneratorSceneComponent",function(){return n.ShadowGeneratorSceneComponent}),i.d(t,"_BabylonLoaderRegistered",function(){return n._BabylonLoaderRegistered}),i.d(t,"BackgroundMaterial",function(){return n.BackgroundMaterial}),i.d(t,"PBRMaterialDefines",function(){return n.PBRMaterialDefines}),i.d(t,"PBRBaseMaterial",function(){return n.PBRBaseMaterial}),i.d(t,"PBRBaseSimpleMaterial",function(){return n.PBRBaseSimpleMaterial}),i.d(t,"PBRMaterial",function(){return n.PBRMaterial}),i.d(t,"PBRMetallicRoughnessMaterial",function(){return n.PBRMetallicRoughnessMaterial}),i.d(t,"PBRSpecularGlossinessMaterial",function(){return n.PBRSpecularGlossinessMaterial}),i.d(t,"ColorGradingTexture",function(){return n.ColorGradingTexture}),i.d(t,"ProceduralTexture",function(){return n.ProceduralTexture}),i.d(t,"RawCubeTexture",function(){return n.RawCubeTexture}),i.d(t,"RawTexture3D",function(){return n.RawTexture3D}),i.d(t,"RefractionTexture",function(){return n.RefractionTexture}),i.d(t,"VideoTexture",function(){return n.VideoTexture}),i.d(t,"HtmlElementTexture",function(){return n.HtmlElementTexture}),i.d(t,"NodeMaterialBlockTargets",function(){return n.NodeMaterialBlockTargets}),i.d(t,"NodeMaterialBlockConnectionPointTypes",function(){return n.NodeMaterialBlockConnectionPointTypes}),i.d(t,"NodeMaterialConnectionPoint",function(){return n.NodeMaterialConnectionPoint}),i.d(t,"NodeMaterialBlock",function(){return n.NodeMaterialBlock}),i.d(t,"NodeMaterialDefines",function(){return n.NodeMaterialDefines}),i.d(t,"NodeMaterial",function(){return n.NodeMaterial}),i.d(t,"NodeMaterialWellKnownValues",function(){return n.NodeMaterialWellKnownValues}),i.d(t,"Orientation",function(){return n.Orientation}),i.d(t,"BezierCurve",function(){return n.BezierCurve}),i.d(t,"Angle",function(){return n.Angle}),i.d(t,"Arc2",function(){return n.Arc2}),i.d(t,"Path2",function(){return n.Path2}),i.d(t,"Path3D",function(){return n.Path3D}),i.d(t,"Curve3",function(){return n.Curve3}),i.d(t,"PositionNormalVertex",function(){return n.PositionNormalVertex}),i.d(t,"PositionNormalTextureVertex",function(){return n.PositionNormalTextureVertex}),i.d(t,"DracoCompression",function(){return n.DracoCompression}),i.d(t,"TiledBoxBuilder",function(){return n.TiledBoxBuilder}),i.d(t,"DiscBuilder",function(){return n.DiscBuilder}),i.d(t,"RibbonBuilder",function(){return n.RibbonBuilder}),i.d(t,"HemisphereBuilder",function(){return n.HemisphereBuilder}),i.d(t,"TorusKnotBuilder",function(){return n.TorusKnotBuilder}),i.d(t,"PolygonBuilder",function(){return n.PolygonBuilder}),i.d(t,"ShapeBuilder",function(){return n.ShapeBuilder}),i.d(t,"LatheBuilder",function(){return n.LatheBuilder}),i.d(t,"TiledPlaneBuilder",function(){return n.TiledPlaneBuilder}),i.d(t,"TubeBuilder",function(){return n.TubeBuilder}),i.d(t,"PolyhedronBuilder",function(){return n.PolyhedronBuilder}),i.d(t,"IcoSphereBuilder",function(){return n.IcoSphereBuilder}),i.d(t,"DecalBuilder",function(){return n.DecalBuilder}),i.d(t,"RecastJSPlugin",function(){return n.RecastJSPlugin}),i.d(t,"RecastJSCrowd",function(){return n.RecastJSCrowd}),i.d(t,"BoxParticleEmitter",function(){return n.BoxParticleEmitter}),i.d(t,"ConeParticleEmitter",function(){return n.ConeParticleEmitter}),i.d(t,"CylinderParticleEmitter",function(){return n.CylinderParticleEmitter}),i.d(t,"CylinderDirectedParticleEmitter",function(){return n.CylinderDirectedParticleEmitter}),i.d(t,"HemisphericParticleEmitter",function(){return n.HemisphericParticleEmitter}),i.d(t,"PointParticleEmitter",function(){return n.PointParticleEmitter}),i.d(t,"SphereParticleEmitter",function(){return n.SphereParticleEmitter}),i.d(t,"SphereDirectedParticleEmitter",function(){return n.SphereDirectedParticleEmitter}),i.d(t,"CannonJSPlugin",function(){return n.CannonJSPlugin}),i.d(t,"AmmoJSPlugin",function(){return n.AmmoJSPlugin}),i.d(t,"OimoJSPlugin",function(){return n.OimoJSPlugin}),i.d(t,"PostProcessRenderEffect",function(){return n.PostProcessRenderEffect}),i.d(t,"PostProcessRenderPipeline",function(){return n.PostProcessRenderPipeline}),i.d(t,"PostProcessRenderPipelineManager",function(){return n.PostProcessRenderPipelineManager}),i.d(t,"PostProcessRenderPipelineManagerSceneComponent",function(){return n.PostProcessRenderPipelineManagerSceneComponent}),i.d(t,"HDRTools",function(){return n.HDRTools}),i.d(t,"PanoramaToCubeMapTools",function(){return n.PanoramaToCubeMapTools}),i.d(t,"_DDSTextureLoader",function(){return n._DDSTextureLoader}),i.d(t,"_ENVTextureLoader",function(){return n._ENVTextureLoader}),i.d(t,"_KTXTextureLoader",function(){return n._KTXTextureLoader}),i.d(t,"_TGATextureLoader",function(){return n._TGATextureLoader}),i.d(t,"_BasisTextureLoader",function(){return n._BasisTextureLoader}),i.d(t,"CustomProceduralTexture",function(){return n.CustomProceduralTexture}),i.d(t,"NoiseProceduralTexture",function(){return n.NoiseProceduralTexture}),i.d(t,"ProceduralTextureSceneComponent",function(){return n.ProceduralTextureSceneComponent}),i.d(t,"MultiplyBlock",function(){return n.MultiplyBlock}),i.d(t,"AddBlock",function(){return n.AddBlock}),i.d(t,"ScaleBlock",function(){return n.ScaleBlock}),i.d(t,"ClampBlock",function(){return n.ClampBlock}),i.d(t,"CrossBlock",function(){return n.CrossBlock}),i.d(t,"DotBlock",function(){return n.DotBlock}),i.d(t,"TransformBlock",function(){return n.TransformBlock}),i.d(t,"RemapBlock",function(){return n.RemapBlock}),i.d(t,"NormalizeBlock",function(){return n.NormalizeBlock}),i.d(t,"TrigonometryBlockOperations",function(){return n.TrigonometryBlockOperations}),i.d(t,"TrigonometryBlock",function(){return n.TrigonometryBlock}),i.d(t,"ColorMergerBlock",function(){return n.ColorMergerBlock}),i.d(t,"VectorMergerBlock",function(){return n.VectorMergerBlock}),i.d(t,"ColorSplitterBlock",function(){return n.ColorSplitterBlock}),i.d(t,"VectorSplitterBlock",function(){return n.VectorSplitterBlock}),i.d(t,"LerpBlock",function(){return n.LerpBlock}),i.d(t,"DivideBlock",function(){return n.DivideBlock}),i.d(t,"SubtractBlock",function(){return n.SubtractBlock}),i.d(t,"StepBlock",function(){return n.StepBlock}),i.d(t,"NodeMaterialOptimizer",function(){return n.NodeMaterialOptimizer}),i.d(t,"DefaultRenderingPipeline",function(){return n.DefaultRenderingPipeline}),i.d(t,"LensRenderingPipeline",function(){return n.LensRenderingPipeline}),i.d(t,"SSAO2RenderingPipeline",function(){return n.SSAO2RenderingPipeline}),i.d(t,"SSAORenderingPipeline",function(){return n.SSAORenderingPipeline}),i.d(t,"StandardRenderingPipeline",function(){return n.StandardRenderingPipeline}),i.d(t,"VertexOutputBlock",function(){return n.VertexOutputBlock}),i.d(t,"BonesBlock",function(){return n.BonesBlock}),i.d(t,"InstancesBlock",function(){return n.InstancesBlock}),i.d(t,"MorphTargetsBlock",function(){return n.MorphTargetsBlock}),i.d(t,"FragmentOutputBlock",function(){return n.FragmentOutputBlock}),i.d(t,"AlphaTestBlock",function(){return n.AlphaTestBlock}),i.d(t,"FresnelBlock",function(){return n.FresnelBlock}),i.d(t,"ImageProcessingBlock",function(){return n.ImageProcessingBlock}),i.d(t,"FogBlock",function(){return n.FogBlock}),i.d(t,"LightBlock",function(){return n.LightBlock}),i.d(t,"TextureBlock",function(){return n.TextureBlock}),i.d(t,"ReflectionTextureBlock",function(){return n.ReflectionTextureBlock}),i.d(t,"InputBlock",function(){return n.InputBlock}),i.d(t,"AnimatedInputBlockTypes",function(){return n.AnimatedInputBlockTypes});var o=void 0!==e?e:"undefined"!=typeof window?window:void 0;if(void 0!==o){o.BABYLON=a,o.BABYLON=o.BABYLON||{};var a=o.BABYLON;a.Debug=a.Debug||{};var s=[];for(var c in r)a.Debug[c]=r[c],s.push(c);for(var c in n)a[c]=n[c]}var l={AxesViewer:r.AxesViewer,BoneAxesViewer:r.BoneAxesViewer,PhysicsViewer:r.PhysicsViewer,SkeletonViewer:r.SkeletonViewer}}.call(this,i(137))}])}); \ No newline at end of file diff --git a/src/Materials/Node/Blocks/Fragment/alphaTestBlock.ts b/src/Materials/Node/Blocks/Fragment/alphaTestBlock.ts index f8607ea4553..5c04a69d456 100644 --- a/src/Materials/Node/Blocks/Fragment/alphaTestBlock.ts +++ b/src/Materials/Node/Blocks/Fragment/alphaTestBlock.ts @@ -62,7 +62,7 @@ export class AlphaTestBlock extends NodeMaterialBlock { return this; } - + protected _dumpPropertiesCode() { var codeString = `${this._codeVariableName}.alphaCutOff = ${this.alphaCutOff};\r\n`; diff --git a/src/Materials/Node/Blocks/transformBlock.ts b/src/Materials/Node/Blocks/transformBlock.ts index e5907a6a29e..2ba7b7cfd83 100644 --- a/src/Materials/Node/Blocks/transformBlock.ts +++ b/src/Materials/Node/Blocks/transformBlock.ts @@ -106,7 +106,7 @@ export class TransformBlock extends NodeMaterialBlock { codeString += `${this._codeVariableName}.complementW = ${this.complementW};\r\n`; return codeString; - } + } } _TypeStore.RegisteredTypes["BABYLON.TransformBlock"] = TransformBlock; \ No newline at end of file diff --git a/src/Materials/Node/nodeMaterial.ts b/src/Materials/Node/nodeMaterial.ts index 9505f31e00e..d8c5ea87015 100644 --- a/src/Materials/Node/nodeMaterial.ts +++ b/src/Materials/Node/nodeMaterial.ts @@ -1112,7 +1112,7 @@ export class NodeMaterial extends PushMaterial { continue; } - outputPoint.connectTo(inputPoint); + outputPoint.connectTo(inputPoint, true); this._restoreConnections(target, source, map); continue; } diff --git a/src/Materials/Node/nodeMaterialBlockConnectionPoint.ts b/src/Materials/Node/nodeMaterialBlockConnectionPoint.ts index 67547bf3492..952cc2877c0 100644 --- a/src/Materials/Node/nodeMaterialBlockConnectionPoint.ts +++ b/src/Materials/Node/nodeMaterialBlockConnectionPoint.ts @@ -214,10 +214,11 @@ export class NodeMaterialConnectionPoint { /** * Connect this point to another connection point * @param connectionPoint defines the other connection point + * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false) * @returns the current connection point */ - public connectTo(connectionPoint: NodeMaterialConnectionPoint): NodeMaterialConnectionPoint { - if (!this.canConnectTo(connectionPoint)) { + public connectTo(connectionPoint: NodeMaterialConnectionPoint, ignoreConstraints = false): NodeMaterialConnectionPoint { + if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) { throw "Cannot connect two different connection types."; }